efficient-shell 13.23.1 → 13.24.1

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.
Files changed (93) hide show
  1. package/dist/{Browser-I2UVUUVV.js → Browser-P6CXFZWM.js} +14 -14
  2. package/dist/Calculator-PKAM5ERT.js +29 -0
  3. package/dist/CurrencyConverter-VH4UVYLO.js +21 -0
  4. package/dist/{Files-KA5Y6G4P.js → Files-NTJ4WI6F.js} +87 -87
  5. package/dist/Notepad-GIRH6KIR.js +24 -0
  6. package/dist/PomodoroTimer-PBSAKRX5.js +91 -0
  7. package/dist/{Preview-EPATSSFI.js → Preview-A4NPS775.js} +20 -20
  8. package/dist/{Sidebar-MY66ILZY.js → Sidebar-HAIHWIJD.js} +22 -22
  9. package/dist/{Stock-SHKXRWJQ.js → Stock-YL732PKW.js} +5 -5
  10. package/dist/{Weather-WMKWOPBU.js → Weather-3CBRXNNM.js} +18 -18
  11. package/dist/{WorldClock-GZYOF4B2.js → WorldClock-LONNWCRG.js} +6 -6
  12. package/dist/ai/index.js +117 -117
  13. package/dist/apps/index.js +1 -1
  14. package/dist/bin/browser-check.js +1 -1
  15. package/dist/bin/media-host-check.js +1 -1
  16. package/dist/bin/ui-check.js +1 -1
  17. package/dist/{chunk-GAEQYCLS.js → chunk-26KHYLJN.js} +1 -1
  18. package/dist/{chunk-T7A3Y64S.js → chunk-2Y4AH7NC.js} +1 -1
  19. package/dist/{chunk-L4W5X3Q4.js → chunk-3OPPTU4V.js} +2 -2
  20. package/dist/chunk-44ERJYNW.js +6 -0
  21. package/dist/{chunk-XYQFTFI7.js → chunk-4VFEPP2W.js} +9 -9
  22. package/dist/{chunk-ZMBGMEN5.js → chunk-527WMFTR.js} +1 -1
  23. package/dist/{chunk-P6H2B635.js → chunk-7N6CVTWO.js} +1 -1
  24. package/dist/{chunk-UR3J4WP6.js → chunk-AAFPAQXH.js} +13 -13
  25. package/dist/{chunk-TJBHFUWV.js → chunk-B5KX7PDG.js} +2 -2
  26. package/dist/{chunk-6AETKYCP.js → chunk-BQQEQCSK.js} +1 -1
  27. package/dist/{chunk-DAUE6ULT.js → chunk-DUEEAP4Y.js} +1 -1
  28. package/dist/{chunk-CZS5UHOU.js → chunk-EXDSYFHB.js} +1 -1
  29. package/dist/chunk-FLQXMCB3.js +8 -0
  30. package/dist/{chunk-2L4IOLOT.js → chunk-HPKQYUQT.js} +1 -1
  31. package/dist/chunk-I52YJ3QD.js +1 -0
  32. package/dist/{chunk-NF5HSFZ3.js → chunk-K4KUGKWP.js} +15 -15
  33. package/dist/chunk-LG6NDTHZ.js +2 -0
  34. package/dist/{chunk-JVENCUUG.js → chunk-LRMDLZMM.js} +4 -4
  35. package/dist/{chunk-TJG76Y7I.js → chunk-LUARJHUK.js} +8 -8
  36. package/dist/chunk-MCLVTQSF.js +16 -0
  37. package/dist/{chunk-LM6MSGDW.js → chunk-OE7BXD3M.js} +1 -1
  38. package/dist/{chunk-VT5HWPE2.js → chunk-SRI2D23Y.js} +7 -7
  39. package/dist/{chunk-TT7KXS2Q.js → chunk-UQV4TSWB.js} +1 -1
  40. package/dist/{chunk-H2Q7G5D6.js → chunk-VGUB7LPF.js} +28 -28
  41. package/dist/chunk-VY6OQRZA.js +1 -0
  42. package/dist/{chunk-7PYJEJDT.js → chunk-XC2GUCTG.js} +1 -1
  43. package/dist/chunk-ZVNU3WJ3.js +28 -0
  44. package/dist/data/EntityList.js +1 -1
  45. package/dist/data/ResizableTable.js +1 -1
  46. package/dist/format/index.js +1 -1
  47. package/dist/forms/BorderInput.js +1 -1
  48. package/dist/forms/ColorPicker.js +1 -1
  49. package/dist/forms/CornersInput.js +1 -1
  50. package/dist/forms/DateRangePicker.js +1 -1
  51. package/dist/forms/IconPicker.js +1 -1
  52. package/dist/forms/Input.js +1 -1
  53. package/dist/forms/InputNumber.js +1 -1
  54. package/dist/forms/LinkPicker.js +1 -1
  55. package/dist/forms/MediaLibrary.js +1 -1
  56. package/dist/forms/PositionInput.js +1 -1
  57. package/dist/forms/RenameField.js +1 -1
  58. package/dist/forms/SidesInput.js +1 -1
  59. package/dist/forms/Slider.js +1 -1
  60. package/dist/forms/WidthsBar.js +1 -1
  61. package/dist/icons/index.js +1 -1
  62. package/dist/index.js +512 -512
  63. package/dist/page-tabs/index.js +5 -5
  64. package/dist/shell/ConfirmDialog.js +1 -1
  65. package/dist/shell/Dialog.js +1 -1
  66. package/dist/shell/Drawer.js +1 -1
  67. package/dist/shell/LanguageSelect.js +1 -1
  68. package/dist/shell/SearchableSelect.js +1 -1
  69. package/dist/shell/SettingRow.js +1 -1
  70. package/dist/shell/SidebarLayout.d.ts +12 -1
  71. package/dist/shell/SidebarLayout.js +1 -1
  72. package/dist/shell/discardGuard.js +1 -1
  73. package/dist/telemetry/index.js +1 -1
  74. package/dist/templates/AuthScreen.js +1 -1
  75. package/dist/templates/ChatTemplate.js +1 -1
  76. package/dist/templates/CheckoutTemplate.js +1 -1
  77. package/dist/templates/DataTablePage.js +1 -1
  78. package/dist/templates/EmailTemplate.js +1 -1
  79. package/dist/templates/FormLayoutPage.js +1 -1
  80. package/dist/ui/index.js +1 -1
  81. package/dist/version.js +1 -1
  82. package/package.json +1 -1
  83. package/dist/Calculator-PHIOJNTS.js +0 -29
  84. package/dist/CurrencyConverter-WZXN6WTD.js +0 -21
  85. package/dist/Notepad-RSEI2F3I.js +0 -24
  86. package/dist/PomodoroTimer-WVIAWG5E.js +0 -91
  87. package/dist/chunk-CJQPC2P3.js +0 -2
  88. package/dist/chunk-KH4AMHSI.js +0 -1
  89. package/dist/chunk-M36B3M2H.js +0 -8
  90. package/dist/chunk-MRFFOJCS.js +0 -28
  91. package/dist/chunk-MRZLFZNJ.js +0 -6
  92. package/dist/chunk-W24THMLI.js +0 -15
  93. /package/dist/{chunk-UAXL44HH.js → chunk-4BYJABCX.js} +0 -0
@@ -0,0 +1,6 @@
1
+ import{useOverlayTarget as e,usePopupAnchor as r,usePanelPosition as l,usePopupLevel as t,usePopupLevelBindings as i,windowScrimStyle as a,OverlayLayerProvider as o,scrimHasCorners as n,popupLayerStyle as s,POPUP_GUTTER as d}from"./chunk-VY6OQRZA.js";import{CloseButton as c}from"./chunk-LG6NDTHZ.js";import{useDiscardGuard as m}from"./chunk-4BYJABCX.js";import{dialogA11y as p}from"./chunk-VWGWZY7A.js";import{useDismissPopupsOnOpen as u}from"./chunk-UVHXVSB2.js";import{useFocusTrap as f,useScrollLock as h}from"./chunk-DWGYC7OD.js";import{HEADING_TEXT as x,DESCRIPTION_TEXT as v,PANEL_SURFACE as b}from"./chunk-BWJZTHZ6.js";import{useHydrated as w}from"./chunk-WCCS4VFE.js";import{registerModalEscapeInterceptor as y}from"./chunk-TWVUQUUD.js";import{useShellStrings as $}from"./chunk-NRHG4R2Q.js";import{useRef as g,useId as N,useState as j,useEffect as k}from"react";import{createPortal as C}from"react-dom";import{jsxs as B,Fragment as V,jsx as W}from"react/jsx-runtime";var H=`calc(100% - ${2*d}px)`,Z="grid grid-cols-[minmax(0,1fr)_auto]",A="bg-black/30 backdrop-blur-sm",D={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-4xl","2xl":"max-w-6xl",full:"max-w-none"};function G({open:d,onClose:G,title:T,description:U,role:Y="dialog",children:E,footer:Q,headerActions:R,blocking:_=!1,size:F="md",aside:J=!1,dirty:O=!1,initialFocus:S,"aria-label":X,"aria-labelledby":z,"aria-describedby":I,className:L=""}){const q=g(null),K=N(),M=N(),P=!_,ee="full"===F,re=ee||null!=R,le=Boolean(T||U),te=N();$().dialog;const ie=e(w()),[ae,oe]=j(null),ne=m({open:d,dirty:O,onClose:G,title:T,layer:ae}),se=g(null),de=r(d&&null!==ie,se),ce=l(de,q),me=t(d&&null!==ie,se),pe=i(me,ae),ue=a(me),fe=null!==me.host;if(u(d),f(q,d&&null!==ie,S,pe),h(d),k(()=>{if(d)return y(()=>!pe.current?.(document.activeElement)&&(_||ne(),!0),()=>q.current)},[d,_,ne,pe]),!d||!ie)return null;/* @__PURE__ */
2
+ return B(V,{children:[/* @__PURE__ */W("span",{ref:se,hidden:!0,"data-popup-anchor":""}),C(
3
+ /* @__PURE__ */W(o,{value:ae,children:/* @__PURE__ */B("div",{ref:oe,className:"fixed inset-0"+(J?" pointer-events-none opacity-0":fe?" pointer-events-none":""),style:s(me),role:"presentation","data-overlay-layer":"","data-aside":J?"":void 0,children:[!fe&&/* @__PURE__ */W("div",{className:`fixed inset-0 ${A}`,"aria-hidden":"true","data-popup-scrim":"system"}),ue&&/* @__PURE__ */W("div",{className:`fixed ${A}${J?"":" pointer-events-auto"}${n(me)?" rounded-(--radius-window)":""}`,style:ue,onClick:_?void 0:ne,"aria-hidden":"true","data-popup-scrim":"window"}),
4
+ /* @__PURE__ */W("div",{className:de?"fixed inset-0":"fixed inset-0 flex items-center justify-center p-4",onClick:_||fe?void 0:e=>{e.target===e.currentTarget&&ne()},children:/* @__PURE__ */B("div",{ref:q,"data-popup-panel":"",style:de?{left:ce?.left??0,top:ce?.top??0,visibility:ce?void 0:"hidden",width:H,[ee?"height":"maxHeight"]:H}:void 0,...p({role:Y,modal:!0,titleId:T?te:void 0,labelledBy:z,label:X}),"aria-describedby":I??(U?M:E?K:void 0),className:(ee?`${de?"absolute":"relative h-full w-full max-h-full"} ${D[F]} ${Z} grid-rows-[auto_minmax(0,1fr)_auto] overflow-hidden rounded-(--radius-popup) ${b}`:`${de?"absolute":"relative max-h-full w-full"} ${D[F]}${re?` ${Z} content-start gap-x-2`:""} overflow-y-auto overscroll-contain rounded-(--radius-card) ${b} p-6`)+`${fe&&!J?" pointer-events-auto":""} ${L}`.trimEnd(),children:[ee?le&&
5
+ /* @__PURE__ */B("div",{className:"col-start-1 row-start-1 flex min-h-(--row-height-window-bar) flex-col justify-center border-b border-line py-2 pl-6 pr-4",children:[T&&/* @__PURE__ */W("h2",{id:te,className:x,children:T}),U&&/* @__PURE__ */W("p",{id:M,className:`${T?"mt-1 ":""}${v}`,children:U})]}):T&&/* @__PURE__ */W("h2",{id:te,className:`${re?"col-start-1 row-start-1 ":P?"pr-8 ":""}${x}`,children:T}),!ee&&U&&/* @__PURE__ */W("p",{id:M,className:`${re?"col-start-1 ":""}${T?"mt-1":P&&!re?"pr-8":""} ${v}`.trim(),children:U}),E&&/* @__PURE__ */W("div",{id:K,className:ee?"col-span-2 row-start-2 min-h-0 overflow-auto":(re?"col-span-2 ":"")+"mt-2 text-sm text-gray-600",children:E}),Q&&/* @__PURE__ */W("div",{className:ee?"col-span-2 row-start-3 flex flex-wrap justify-end gap-3 border-t border-line px-6 py-4":(re?"col-span-2 ":"")+"mt-6 flex flex-wrap justify-end gap-3",children:Q}),re?
6
+ /* @__PURE__ */B("div",{className:"col-start-2 row-start-1 flex items-center gap-1 "+(ee?(le?"border-b border-line ":"")+"pr-3":"-mr-3 -mt-3 self-start"),children:[R,P&&/* @__PURE__ */W(c,{onClose:ne})]}):P&&/* @__PURE__ */W(c,{onClose:ne,className:"absolute right-3 top-3"})]})})]})}),ie)]})}export{G as Dialog};
@@ -1,14 +1,14 @@
1
- import{Dialog as e}from"./chunk-MRZLFZNJ.js";import{Icon as r}from"./chunk-ISVODSRP.js";import{HEADING_TEXT as n}from"./chunk-BWJZTHZ6.js";import{buttonClasses as t}from"./chunk-UQYNPYF4.js";import{useShellStrings as o,splitAround as l}from"./chunk-NRHG4R2Q.js";import{createContext as i,useContext as s,useState as c,useRef as a,useCallback as u,useEffect as d}from"react";import{jsxs as m,jsx as h,Fragment as f}from"react/jsx-runtime";var p=i(()=>Promise.resolve(!1)),g=()=>s(p),b=()=>Promise.resolve(!1),v=e=>b(e),y=()=>Promise.resolve(!1),x=e=>y(e),N=()=>Promise.resolve(null),k=e=>N(e),w={danger:{icon:"text-red-600 bg-red-100",button:t({variant:"danger"})},warning:{icon:"text-yellow-600 bg-yellow-100",button:t({variant:"warning"})},info:{icon:"text-blue-600 bg-accent-tint-strong",button:t({variant:"primary"})}},C=t({variant:"secondary"}),L=t({variant:"primary"}),P="w-full rounded-md border border-line-strong h-8 px-3 text-sm";function j(){/* @__PURE__ */
2
- return h(r,{name:"warning",className:"h-5 w-5",strokeWidth:1.5,"aria-hidden":"true"})}function F({children:r}){const[t,i]=c(!1),[s,g]=c({message:""}),[v,x]=c(0),k=a(),F=a(null),E=a(0),T=a([]),$=a(null),R=a(null),Z=u(e=>{F.current=e.id,k.current=e.resolve,x(e.id),g(e.options),i(!0)},[]),D=u(e=>{const r="string"==typeof e?{message:e}:e;return new Promise(e=>{const n={id:++E.current,options:r,resolve:e};null===F.current?Z(n):T.current.push(n)})},[Z]),[W,H]=c(!1),[J,K]=c({message:""}),[Q,S]=c(""),V=a(),Y=u(e=>(K(e),S(""),H(!0),new Promise(e=>{V.current=e})),[]),[B,G]=c(!1),[I,M]=c({}),[O,U]=c(""),q=a(),z=u(e=>{const r="string"==typeof e?{message:e}:e;return M(r),U(r.defaultValue??""),G(!0),new Promise(e=>{q.current=e})},[]);d(()=>{b=D,y=Y,N=z},[D,Y,z]);const A=(e,r)=>{if(F.current!==e)return;const n=k.current,t=T.current.shift();t?Z(t):(F.current=null,k.current=void 0,i(!1)),n?.(r)},X=e=>{H(!1),S(""),V.current?.(e)},_=e=>{if(e){const e=O.trim();if(!e&&!I.allowEmpty)return G(!1),void q.current?.(null);G(!1),q.current?.(e)}else G(!1),q.current?.(null)},ee=s.variant||(s.confirmLabel?.toLowerCase().includes("delete")||s.message.toLowerCase().includes("delete")?"danger":"info"),re=w[ee],ne=w["warning"===J.variant?"warning":"danger"],te=J.confirmWord,oe=null==te||Q===te,le=o().dialog,[ie,se]=l(le.typeToConfirm);/* @__PURE__ */
1
+ import{Dialog as e}from"./chunk-44ERJYNW.js";import{Icon as r}from"./chunk-ISVODSRP.js";import{HEADING_TEXT as n}from"./chunk-BWJZTHZ6.js";import{buttonClasses as t}from"./chunk-UQYNPYF4.js";import{useShellStrings as o,splitAround as l}from"./chunk-NRHG4R2Q.js";import{createContext as i,useContext as s,useState as c,useRef as a,useCallback as u,useEffect as d}from"react";import{jsxs as m,jsx as h,Fragment as f}from"react/jsx-runtime";var p=i(()=>Promise.resolve(!1)),g=()=>s(p),b=()=>Promise.resolve(!1),v=e=>b(e),y=()=>Promise.resolve(!1),x=e=>y(e),N=()=>Promise.resolve(null),k=e=>N(e),w={danger:{icon:"text-red-600 bg-red-100",button:t({variant:"danger"})},warning:{icon:"text-yellow-600 bg-yellow-100",button:t({variant:"warning"})},info:{icon:"text-blue-600 bg-accent-tint-strong",button:t({variant:"primary"})}},C=t({variant:"secondary"}),P=t({variant:"primary"}),L="w-full rounded-md border border-line-strong h-8 px-3 text-sm";function j(){/* @__PURE__ */
2
+ return h(r,{name:"warning",className:"h-5 w-5",strokeWidth:1.5,"aria-hidden":"true"})}function E({children:r}){const[t,i]=c(!1),[s,g]=c({message:""}),[v,x]=c(0),k=a(),E=a(null),F=a(0),T=a([]),$=a(null),R=a(null),W=u(e=>{E.current=e.id,k.current=e.resolve,x(e.id),g(e.options),i(!0)},[]),D=u(e=>{const r="string"==typeof e?{message:e}:e;return new Promise(e=>{const n={id:++F.current,options:r,resolve:e};null===E.current?W(n):T.current.push(n)})},[W]),[Y,H]=c(!1),[J,K]=c({message:""}),[Q,S]=c(""),V=a(),Z=u(e=>(K(e),S(""),H(!0),new Promise(e=>{V.current=e})),[]),[B,G]=c(!1),[I,O]=c({}),[U,q]=c(""),z=a(),A=u(e=>{const r="string"==typeof e?{message:e}:e;return O(r),q(r.defaultValue??""),G(!0),new Promise(e=>{z.current=e})},[]);d(()=>{b=D,y=Z,N=A},[D,Z,A]);const M=(e,r)=>{if(E.current!==e)return;const n=k.current,t=T.current.shift();t?W(t):(E.current=null,k.current=void 0,i(!1)),n?.(r)},X=e=>{H(!1),S(""),V.current?.(e)},_=e=>{if(e){const e=U.trim();if(!e&&!I.allowEmpty)return G(!1),void z.current?.(null);G(!1),z.current?.(e)}else G(!1),z.current?.(null)},ee=s.variant||(s.confirmLabel?.toLowerCase().includes("delete")||s.message.toLowerCase().includes("delete")?"danger":"info"),re=w[ee],ne=w["warning"===J.variant?"warning":"danger"],te=J.confirmWord,oe=null==te||Q===te,le=o().dialog,[ie,se]=l(le.typeToConfirm);/* @__PURE__ */
3
3
  return m(p.Provider,{value:D,children:[r,
4
- /* @__PURE__ */h(e,{open:t,onClose:()=>A(v,!1),initialFocus:$,footer:/* @__PURE__ */m(f,{children:[
5
- /* @__PURE__ */h("button",{ref:$,type:"button",onClick:()=>A(v,!1),className:C,children:s.cancelLabel||le.cancel}),
6
- /* @__PURE__ */h("button",{type:"button",onClick:()=>A(v,!0),className:re.button,children:s.confirmLabel||le.ok})]}),children:/* @__PURE__ */m("div",{className:"flex gap-4",children:[
4
+ /* @__PURE__ */h(e,{open:t,onClose:()=>M(v,!1),initialFocus:$,footer:/* @__PURE__ */m(f,{children:[
5
+ /* @__PURE__ */h("button",{ref:$,type:"button",onClick:()=>M(v,!1),className:C,children:s.cancelLabel||le.cancel}),
6
+ /* @__PURE__ */h("button",{type:"button",onClick:()=>M(v,!0),className:re.button,children:s.confirmLabel||le.ok})]}),children:/* @__PURE__ */m("div",{className:"flex gap-4",children:[
7
7
  /* @__PURE__ */h("div",{className:`shrink-0 w-10 h-10 rounded-full flex items-center justify-center ${re.icon}`,children:/* @__PURE__ */h(j,{})}),
8
8
  /* @__PURE__ */m("div",{className:"flex-1",children:[
9
9
  /* @__PURE__ */h("h2",{className:n,children:s.title||le.confirmTitle}),
10
10
  /* @__PURE__ */h("p",{className:"mt-2 text-sm text-gray-600",children:s.message})]})]})}),
11
- /* @__PURE__ */h(e,{open:W,onClose:()=>X(!1),initialFocus:null!=te?void 0:R,footer:/* @__PURE__ */m(f,{children:[
11
+ /* @__PURE__ */h(e,{open:Y,onClose:()=>X(!1),initialFocus:null!=te?void 0:R,footer:/* @__PURE__ */m(f,{children:[
12
12
  /* @__PURE__ */h("button",{ref:R,type:"button",onClick:()=>X(!1),className:C,children:J.cancelLabel||le.destructiveCancel}),
13
13
  /* @__PURE__ */h("button",{type:"button",onClick:()=>X(!0),disabled:!oe,className:ne.button,children:te??J.confirmLabel??le.destructiveConfirm})]}),children:/* @__PURE__ */m("div",{className:"flex gap-4",children:[
14
14
  /* @__PURE__ */h("div",{className:`shrink-0 w-10 h-10 rounded-full flex items-center justify-center ${ne.icon}`,children:/* @__PURE__ */h(j,{})}),
@@ -17,8 +17,8 @@ return m(p.Provider,{value:D,children:[r,
17
17
  /* @__PURE__ */h("p",{className:"mt-2 text-sm text-gray-600",children:J.message}),null!=te&&/* @__PURE__ */m(f,{children:[
18
18
  /* @__PURE__ */m("p",{className:"mt-3 text-sm text-gray-700",children:[ie,
19
19
  /* @__PURE__ */h("kbd",{className:"rounded border border-line-strong bg-surface-sunken px-2 py-0.5 text-xs font-bold text-red-600 font-mono",children:te}),se]}),
20
- /* @__PURE__ */h("input",{autoFocus:!0,type:"text",value:Q,onChange:e=>S(e.target.value),onKeyDown:e=>{"Enter"===e.key&&Q===te&&X(!0)},placeholder:te,className:`mt-2 ${P} focus:border-red-500`})]})]})]})}),
20
+ /* @__PURE__ */h("input",{autoFocus:!0,type:"text",value:Q,onChange:e=>S(e.target.value),onKeyDown:e=>{"Enter"===e.key&&Q===te&&X(!0)},placeholder:te,className:`mt-2 ${L} focus:border-red-500`})]})]})]})}),
21
21
  /* @__PURE__ */m(e,{open:B,onClose:()=>_(!1),title:I.title||le.promptTitle,footer:/* @__PURE__ */m(f,{children:[
22
22
  /* @__PURE__ */h("button",{type:"button",onClick:()=>_(!1),className:C,children:I.cancelLabel||le.cancel}),
23
- /* @__PURE__ */h("button",{type:"button",onClick:()=>_(!0),disabled:!I.allowEmpty&&!O.trim(),className:L,children:I.confirmLabel||le.ok})]}),children:[I.message&&/* @__PURE__ */h("p",{className:"text-sm text-gray-600",children:I.message}),
24
- /* @__PURE__ */h("input",{autoFocus:!0,type:"text",value:O,onChange:e=>U(e.target.value),onKeyDown:e=>{"Enter"===e.key?_(!0):"Escape"===e.key&&_(!1)},onFocus:e=>e.target.select(),placeholder:I.placeholder,className:`mt-3 ${P} focus:border-blue-500 rosh-focus-ring focus-visible:ring-1 focus-visible:ring-[color:var(--rosh-focus-ring-accent)]`})]})]})}export{F as ConfirmProvider,v as confirm,x as confirmDestructive,k as prompt,g as useConfirm};
23
+ /* @__PURE__ */h("button",{type:"button",onClick:()=>_(!0),disabled:!I.allowEmpty&&!U.trim(),className:P,children:I.confirmLabel||le.ok})]}),children:[I.message&&/* @__PURE__ */h("p",{className:"text-sm text-gray-600",children:I.message}),
24
+ /* @__PURE__ */h("input",{autoFocus:!0,type:"text",value:U,onChange:e=>q(e.target.value),onKeyDown:e=>{"Enter"===e.key?_(!0):"Escape"===e.key&&_(!1)},onFocus:e=>e.target.select(),placeholder:I.placeholder,className:`mt-3 ${L} focus:border-blue-500 rosh-focus-ring focus-visible:ring-1 focus-visible:ring-[color:var(--rosh-focus-ring-accent)]`})]})]})}export{E as ConfirmProvider,v as confirm,x as confirmDestructive,k as prompt,g as useConfirm};
@@ -1,4 +1,4 @@
1
- import{Card as e}from"./chunk-RKSCB5BJ.js";import{Textarea_default as a}from"./chunk-PB7G6CJ7.js";import{Radio_default as l}from"./chunk-NI5FXWK5.js";import{Select_default as r}from"./chunk-D5PXRJHA.js";import{FormField as n}from"./chunk-6KBDNYRW.js";import{Checkbox_default as i}from"./chunk-CGZBDI6C.js";import{Input_default as c}from"./chunk-TJBHFUWV.js";import{Button_default as o}from"./chunk-UTISUEO4.js";import{useState as t}from"react";import{jsx as m,jsxs as d}from"react/jsx-runtime";function s(){const[s,h]=t("pro"),[u,p]=t(!0),[f,g]=t("us");/* @__PURE__ */
1
+ import{Card as e}from"./chunk-RKSCB5BJ.js";import{Textarea_default as a}from"./chunk-PB7G6CJ7.js";import{Radio_default as l}from"./chunk-NI5FXWK5.js";import{Select_default as r}from"./chunk-D5PXRJHA.js";import{FormField as n}from"./chunk-6KBDNYRW.js";import{Checkbox_default as i}from"./chunk-CGZBDI6C.js";import{Input_default as c}from"./chunk-B5KX7PDG.js";import{Button_default as o}from"./chunk-UTISUEO4.js";import{useState as t}from"react";import{jsx as m,jsxs as d}from"react/jsx-runtime";function s(){const[s,h]=t("pro"),[u,p]=t(!0),[f,g]=t("us");/* @__PURE__ */
2
2
  return m("div",{className:"h-full overflow-auto bg-gray-50 p-6",children:/* @__PURE__ */d("form",{className:"mx-auto max-w-2xl space-y-5",onSubmit:e=>e.preventDefault(),children:[
3
3
  /* @__PURE__ */d("div",{children:[
4
4
  /* @__PURE__ */m("h1",{className:"text-xl font-semibold text-gray-900",children:"Account settings"}),
@@ -1,4 +1,4 @@
1
- import{useClickOutside as e}from"./chunk-SI26KESU.js";import{useColumnConfig as t}from"./chunk-C5OPAULN.js";import{useShellAuth as r}from"./chunk-2QY5BJLA.js";import{useIsMobile as o}from"./chunk-UGTRSRIW.js";import{Icon as l}from"./chunk-ISVODSRP.js";import{TH_ONE_LINE as n}from"./chunk-TD3ZQD5R.js";import{shellHttp as a}from"./chunk-STKJA4PV.js";import{glassStyle as s}from"./chunk-5FYDNH4Y.js";import{useShellStrings as i}from"./chunk-NRHG4R2Q.js";import{useState as c,useMemo as d,useRef as m,useCallback as h}from"react";import{jsxs as u,jsx as p}from"react/jsx-runtime";function f({tableId:f,columns:g,sort:x,onSort:y,footer:b,afterBody:v,saveDefaultPerms:k=["change_numberingconfig"],children:N}){const w=o(),[D,j]=c(!1),S=d(()=>w&&!D?g.filter(e=>"_select"!==e.key):g,[g,w,D]),{orderedColumns:C,allColumns:R,onResizeStart:_,onDragStart:z,onDragOver:P,onDrop:$,onDragEnd:I,toggleColumn:L,resetColumns:T,draggedIdx:A,dropGap:O}=t(f,S),{hasAnyPerm:E}=r(),G=i().columns,[Q,U]=c(!1),[W,Y]=c(!1),[B,F]=c(!1),H=m(null),J=k.length>0&&E(k);e(H,h(()=>{Q&&U(!1)},[Q]));const K=C.reduce((e,t)=>e+t.width,0),V=C.map(e=>`${e.width}px`),M={tableLayout:"fixed",width:K,minWidth:"100%"},Z=m(null),q=h(e=>{const t=Z.current;t&&(t.scrollLeft=e.currentTarget.scrollLeft)},[]),X=d(()=>g.some(e=>"_select"===e.key),[g]);/* @__PURE__ */
1
+ import{useColumnConfig as e}from"./chunk-C5OPAULN.js";import{useClickOutside as t}from"./chunk-SI26KESU.js";import{useShellAuth as r}from"./chunk-2QY5BJLA.js";import{useIsMobile as o}from"./chunk-UGTRSRIW.js";import{Icon as l}from"./chunk-ISVODSRP.js";import{TH_ONE_LINE as n}from"./chunk-TD3ZQD5R.js";import{shellHttp as a}from"./chunk-STKJA4PV.js";import{glassStyle as s}from"./chunk-5FYDNH4Y.js";import{useShellStrings as i}from"./chunk-NRHG4R2Q.js";import{useState as c,useMemo as d,useRef as m,useCallback as h}from"react";import{jsxs as u,jsx as p}from"react/jsx-runtime";function f({tableId:f,columns:g,sort:x,onSort:y,footer:b,afterBody:v,saveDefaultPerms:k=["change_numberingconfig"],children:N}){const w=o(),[D,j]=c(!1),S=d(()=>w&&!D?g.filter(e=>"_select"!==e.key):g,[g,w,D]),{orderedColumns:C,allColumns:R,onResizeStart:_,onDragStart:z,onDragOver:P,onDrop:$,onDragEnd:I,toggleColumn:L,resetColumns:T,draggedIdx:A,dropGap:O}=e(f,S),{hasAnyPerm:E}=r(),G=i().columns,[Q,U]=c(!1),[W,Y]=c(!1),[B,F]=c(!1),H=m(null),J=k.length>0&&E(k);t(H,h(()=>{Q&&U(!1)},[Q]));const K=C.reduce((e,t)=>e+t.width,0),V=C.map(e=>`${e.width}px`),M={tableLayout:"fixed",width:K,minWidth:"100%"},Z=m(null),q=h(e=>{const t=Z.current;t&&(t.scrollLeft=e.currentTarget.scrollLeft)},[]),X=d(()=>g.some(e=>"_select"===e.key),[g]);/* @__PURE__ */
2
2
  return u("div",{className:"flex flex-col flex-1 min-h-0 "+(w?"-mx-4":""),children:[
3
3
  /* @__PURE__ */p("div",{ref:Z,className:"shrink-0 overflow-x-hidden",children:/* @__PURE__ */u("table",{className:"divide-y divide-gray-200",style:M,children:[
4
4
  /* @__PURE__ */p("colgroup",{children:C.map((e,t)=>/* @__PURE__ */p("col",{style:{width:V[t]}},e.key))}),
@@ -1,13 +1,13 @@
1
- import{nextEnabledIndex as e}from"./chunk-EO5RLFRX.js";import{flattenOptionItems as t,filterOptionItems as n,optionMatches as r,groupedRows as l,OptionCheck as o,OptionSublabel as i}from"./chunk-K5YT5PMJ.js";import{END_ACTIONS_PAD as a,InputEndActionSlot as s,InputEndActionButton as c}from"./chunk-TJBHFUWV.js";import{INPUT_BASE_ON as u,INPUT_BASE as d}from"./chunk-AYZY3YNC.js";import{Button_default as h}from"./chunk-UTISUEO4.js";import{Icon as p}from"./chunk-ISVODSRP.js";import{LoadingSpinner as m}from"./chunk-R2VKEMZH.js";import{Tooltip as f}from"./chunk-F2RAIGCG.js";import{onOverlayOpen as b}from"./chunk-PGN5ME7B.js";import{Z_LAYERS as g}from"./chunk-62LW225J.js";import{useDropdownPosition as v,MENU_MAX_HEIGHT as w}from"./chunk-VY3UA6AR.js";import{useBrowserLayoutEffect as y}from"./chunk-ZDXRSY2Y.js";import{registerModalEscapeInterceptor as x}from"./chunk-TWVUQUUD.js";import{GLASS_DIVIDER as k,glassStyle as j}from"./chunk-5FYDNH4Y.js";import{useShellStrings as $}from"./chunk-NRHG4R2Q.js";import{useState as N,useId as D,useRef as C,useMemo as S,useEffect as R}from"react";import{createPortal as W}from"react-dom";import{jsxs as F,jsx as M}from"react/jsx-runtime";function A(e,t){const n=e.length;if(0===n||t(e.join(", ")))return{shown:n,cut:!1};if(1===n)return{shown:1,cut:!0};let r=0;for(let l=1;l<n&&t(`${e.slice(0,l).join(", ")} +${n-l}`);l+=1)r=l;return{shown:r,cut:!1}}var E=["right-2","right-8","right-16"],T=[8,32,64];function Y(Y){const{options:z,placeholder:O,emptyOptionLabel:U,className:I="",disabled:L,id:H,filter:V=!1,allowFreeText:B=!1,freeTextOption:G,onSearchChange:J,loading:K=!1,error:P,onRetry:Z,rightAdornment:Q,endAction:X,renderOption:q,clearable:_=!0,"aria-label":ee,"aria-labelledby":te,"aria-describedby":ne}=Y,re=!0===Y.multiple,le=Y.multiple?Y.value:Y.value?[Y.value]:[],oe=Y.multiple?"":Y.value,ie=e=>{Y.multiple?Y.onChange(e):Y.onChange(e[0]??"")},ae=le.length>0,se=V&&ae&&!L,ce=re||V,ue=null!=G,de=B||ue,[he,pe]=N(!1),[me,fe]=N(-1),be=D(),ge=H??`${be}-input`,ve=`${be}-listbox`,we=e=>`${be}-opt-${e}`,[ye,xe]=N(""),ke=$(),je=U??ke.select.none,$e=e=>{xe(e),fe(-1),J?.(e)},Ne=C(null),De=C(null),Ce=C(null),Se=C(null),Re=C(he);Re.current=he;const We=C(!1),Fe=e=>{Re.current&&(Re.current=!1,e&&B&&!ue&&et&&(re?le.includes(et)||ie([...le,et]):et!==oe&&ie([et])),pe(!1),$e(""))},Me=(e,t)=>{if(!e.disabled){if(re)return ie(le.includes(e.value)?le.filter(t=>t!==e.value):[...le,e.value]),void(e===tt?$e(""):fe(t));ie([e.value]),Fe(!1)}},[Ae,Ee]=N(null);y(()=>{if(!Q||he)return void Ee(null);const e=Se.current?.offsetWidth??0;Ee(e?e+T[Le]+6:null)});const Te=v(De,he,ce?{popupRef:Ce}:{matchTriggerWidth:!0}),Ye=S(()=>t(z),[z]),ze=le.join("\0"),Oe=S(()=>{const e=[],t=/* @__PURE__ */new Set;for(const n of Ye)le.includes(n.value)&&!t.has(n.value)&&(t.add(n.value),e.push(n.label));if(de)for(const n of le)t.has(n)||e.push(n);return e},[Ye,ze,de]),Ue=Oe.join(", "),Ie=_&&ae&&!L,Le=(Ie?1:0)+(X?1:0),[He,Ve]=N(null),Be=C(null),Ge=C(""),Je=C(()=>{});Je.current=()=>{const e=De.current,t=Be.current;if(!re||!e||!t)return;const n=getComputedStyle(e),r=e.clientWidth-(parseFloat(n.paddingLeft)||0)-(parseFloat(n.paddingRight)||0),l=[n.fontStyle,n.fontWeight,n.fontSize,n.fontFamily,n.letterSpacing].join("|"),o=`${r}|${l}|${Oe.join("\0")}`;if(o===Ge.current)return;Ge.current=o;let i=null;r>0&&Oe.length>0&&(t.style.fontStyle=n.fontStyle,t.style.fontWeight=n.fontWeight,t.style.fontSize=n.fontSize,t.style.fontFamily=n.fontFamily,t.style.letterSpacing=n.letterSpacing,i=A(Oe,e=>(t.textContent=e,t.getBoundingClientRect().width<=r)),t.textContent=""),Ve(e=>e?.shown===i?.shown&&e?.cut===i?.cut?e:i)},y(()=>{Je.current()}),R(()=>{const e=De.current;if(!re||!e||"undefined"==typeof ResizeObserver)return;const t=new ResizeObserver(()=>Je.current());return t.observe(e),()=>t.disconnect()},[re]);const Ke=Oe.length,Pe=!re||!He||He.shown>=Ke?Ue:0===He.shown?ke.select.selectedCount(Ke):`${Oe.slice(0,He.shown).join(", ")} +${Ke-He.shown}`,Ze=re&&null!==He&&(He.shown<Ke||He.cut),Qe=he&&ae&&ce;R(()=>{if(!he)return;const e=e=>{const t=e.target;Ne.current?.contains(t)||Ce.current?.contains(t)||Fe(!0)};document.addEventListener("mousedown",e);const t=b(()=>Fe(!0));return()=>{document.removeEventListener("mousedown",e),t()}},[he,B,ye,ze,Y.onChange]),R(()=>{if(he)return x(e=>!("Escape"!==e.key||!Re.current)&&(Fe(!1),De.current?.blur(),!0),()=>Ce.current)},[he]);const Xe=S(()=>{const e=/* @__PURE__ */new Set;return n(z,t=>!e.has(t.value)&&(e.add(t.value),!0))},[z]),qe=S(()=>{if(J)return Xe;const e=ye.trim().toLowerCase();return e?n(Xe,t=>r(t,e)):Xe},[Xe,ye,J]),_e=S(()=>t(qe),[qe]),et=ye.trim(),tt=S(()=>ue&&et?Ye.some(e=>e.label===et)||le.includes(et)?null:{value:et,label:et}:null,[ue,et,Ye,ze]),nt=S(()=>tt?[..._e,tt]:_e,[_e,tt]);/* @__PURE__ */
2
- return F("div",{ref:Ne,className:"relative group",onBlur:e=>{const t=e.relatedTarget;t&&(Ne.current?.contains(t)||Ce.current?.contains(t))||We.current||document.activeElement!==De.current&&Fe(!0)},children:[(rt=/* @__PURE__ */M("input",{id:ge,ref:De,type:"text",autoComplete:"off",role:"combobox","aria-expanded":he,"aria-haspopup":"listbox","aria-autocomplete":"list","aria-controls":he?ve:void 0,"aria-activedescendant":he&&me>=0&&me<nt.length?we(me):void 0,"aria-label":te?void 0:ee,"aria-labelledby":te,"aria-describedby":ne,value:he?ye:Pe,onChange:e=>{$e(e.target.value),pe(!0)},onFocus:()=>{L||($e(""),pe(!0))},onKeyDown:t=>{if("ArrowDown"===t.key||"ArrowUp"===t.key){if(L)return;if(t.preventDefault(),!he)return void pe(!0);if(0===nt.length)return;const n="ArrowDown"===t.key?1:-1;return void fe(t=>e(nt,t,n))}"Enter"===t.key?(t.preventDefault(),he&&me>=0&&me<nt.length?Me(nt[me],me):1!==_e.length||_e[0].disabled?B&&!ue&&et&&(re?(le.includes(et)||ie([...le,et]),$e("")):(ie([et]),Fe(!1),De.current?.blur())):Me(_e[0],0)):"Escape"===t.key?(Fe(!1),De.current?.blur()):"Tab"===t.key&&Fe(!0)},placeholder:Qe?Pe:O||je,className:`${se?u:d} ${I} ${a[Le]}${L?"bg-surface-sunken text-ink-faintest cursor-not-allowed":""} truncate${Qe?" rosh-field-shows-choice":""}`,style:Ae?{paddingRight:Ae}:void 0,disabled:L}),re?/* @__PURE__ */M(f,{content:!he&&Ze?Ue:null,className:"block",children:rt}):rt),re&&
3
- /* @__PURE__ */M("div",{"aria-hidden":"true",className:"pointer-events-none invisible absolute left-0 top-0 h-0 w-0 overflow-hidden",children:/* @__PURE__ */M("span",{ref:Be,className:"whitespace-pre"})}),Le>0&&
4
- /* @__PURE__ */F(s,{children:[Ie&&
5
- /* @__PURE__ */M("span",{onMouseDown:e=>e.preventDefault(),className:"flex opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100",children:/* @__PURE__ */M(c,{action:{label:ke.select.clear,icon:/* @__PURE__ */M(p,{name:"close"}),onClick:()=>{ie([]),Fe(!1)}}})}),X&&/* @__PURE__ */M("span",{onMouseDown:e=>e.preventDefault(),className:"flex",children:/* @__PURE__ */M(c,{action:X})})]}),Q&&!he&&/* @__PURE__ */M("div",{ref:Se,className:`absolute top-1/2 -translate-y-1/2 ${E[Le]} flex items-center gap-1 flex-nowrap justify-end pointer-events-none`,children:Q}),he&&W(
6
- /* @__PURE__ */F("div",{ref:Ce,onMouseDownCapture:()=>{We.current=!0,setTimeout(()=>{We.current=!1},0)},className:"fixed rounded-(--radius-popup) overflow-hidden",style:{zIndex:g.popup,left:Te?.left,right:Te?.right,top:Te?.top,bottom:Te?.bottom,minWidth:Te?.minWidth,width:Te?.width,...ce&&{maxWidth:Te?.maxWidth},visibility:Te?void 0:"hidden",...j()},children:[re&&ae&&_&&!L&&
7
- /* @__PURE__ */M("button",{type:"button",tabIndex:-1,onMouseDown:e=>{e.preventDefault(),ie([])},className:`block w-full text-left px-3 min-h-(--row-height-menu) py-2 leading-5 text-sm text-gray-600 hover:bg-row-hover border-b ${k}`,children:ke.select.clearAll}),K?
8
- /* @__PURE__ */M(m,{size:"sm",padding:"py-2",label:ke.search.searching}):P?/* @__PURE__ */F("div",{role:"alert",className:"flex items-center gap-2 px-3 py-2 text-sm text-red-600",children:[
9
- /* @__PURE__ */M("span",{className:"min-w-0 flex-1",children:P}),Z&&/* @__PURE__ */M(h,{variant:"link",size:"sm",onMouseDown:e=>e.preventDefault(),onClick:Z,className:"shrink-0",children:ke.list.retry})]}):null,
10
- /* @__PURE__ */F("div",{id:ve,role:nt.length?"listbox":void 0,"aria-labelledby":nt.length?te??(ee?void 0:ge):void 0,"aria-label":nt.length&&!te?ee:void 0,"aria-multiselectable":!(!nt.length||!re)||void 0,className:"overflow-y-auto",style:{maxHeight:Te?.maxHeight??w},children:[0===nt.length?K||P?null:/* @__PURE__ */M("p",{className:"px-3 py-3 text-sm text-ink-faintest text-center",children:ke.select.noMatches}):0===_e.length?null:l(qe,(e,t)=>{const n=le.includes(e.value);/* @__PURE__ */
11
- return F("button",{id:we(t),type:"button",role:"option","aria-selected":n,"aria-disabled":e.disabled||void 0,tabIndex:-1,onMouseDown:n=>{(e.disabled||re)&&n.preventDefault(),Me(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 ${n?"text-blue-600 font-medium":"text-gray-700"} ${t===me?"bg-gray-100":n?"bg-blue-50/50":""}`),children:[re&&/* @__PURE__ */M(o,{selected:n}),
12
- /* @__PURE__ */M("span",{className:`min-w-0 ${ce?"flex-auto":"flex-1"} truncate`,children:q?q(e,{selected:n,active:t===me}):e.label}),e.sublabel&&/* @__PURE__ */M(i,{grows:ce,children:e.sublabel})]},e.value)},be),tt&&G&&
13
- /* @__PURE__ */M("button",{id:we(_e.length),type:"button",role:"option","aria-selected":!1,tabIndex:-1,onMouseDown:e=>{re&&e.preventDefault(),Me(tt,_e.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-ink hover:bg-row-hover ${_e.length?`border-t ${k}`:""} ${me===_e.length?"bg-gray-100":""}`,children:/* @__PURE__ */M("span",{className:"min-w-0 flex-1 truncate",children:G(tt.value)})},`${be}-typed`)]})]}),document.body)]});var rt}export{Y as SearchableSelect,A as fitChoice};
1
+ import{nextEnabledIndex as e}from"./chunk-EO5RLFRX.js";import{flattenOptionItems as t,filterOptionItems as n,optionMatches as r,groupedRows as l,OptionCheck as o,OptionSublabel as i}from"./chunk-K5YT5PMJ.js";import{END_ACTIONS_PAD as a,InputEndActionSlot as s,InputEndActionButton as c}from"./chunk-B5KX7PDG.js";import{INPUT_BASE_ON as u,INPUT_BASE as d}from"./chunk-AYZY3YNC.js";import{Button_default as h}from"./chunk-UTISUEO4.js";import{Icon as p}from"./chunk-ISVODSRP.js";import{LoadingSpinner as m}from"./chunk-R2VKEMZH.js";import{Tooltip as f}from"./chunk-F2RAIGCG.js";import{onOverlayOpen as b}from"./chunk-PGN5ME7B.js";import{Z_LAYERS as g}from"./chunk-62LW225J.js";import{useDropdownPosition as v,MENU_MAX_HEIGHT as w}from"./chunk-VY3UA6AR.js";import{useBrowserLayoutEffect as y}from"./chunk-ZDXRSY2Y.js";import{registerModalEscapeInterceptor as x}from"./chunk-TWVUQUUD.js";import{GLASS_DIVIDER as k,glassStyle as j}from"./chunk-5FYDNH4Y.js";import{useShellStrings as $}from"./chunk-NRHG4R2Q.js";import{useState as N,useId as D,useRef as C,useMemo as S,useEffect as R}from"react";import{createPortal as W}from"react-dom";import{jsxs as M,jsx as A}from"react/jsx-runtime";function E(e,t){const n=e.length;if(0===n||t(e.join(", ")))return{shown:n,cut:!1};if(1===n)return{shown:1,cut:!0};let r=0;for(let l=1;l<n&&t(`${e.slice(0,l).join(", ")} +${n-l}`);l+=1)r=l;return{shown:r,cut:!1}}var F=["right-2","right-8","right-16"],T=[8,32,64];function Y(Y){const{options:z,placeholder:O,emptyOptionLabel:I,className:L="",disabled:U,id:G,filter:H=!1,allowFreeText:B=!1,freeTextOption:K,onSearchChange:P,loading:V=!1,error:X,onRetry:Z,rightAdornment:J,endAction:Q,renderOption:q,clearable:_=!0,"aria-label":ee,"aria-labelledby":te,"aria-describedby":ne}=Y,re=!0===Y.multiple,le=Y.multiple?Y.value:Y.value?[Y.value]:[],oe=Y.multiple?"":Y.value,ie=e=>{Y.multiple?Y.onChange(e):Y.onChange(e[0]??"")},ae=le.length>0,se=H&&ae&&!U,ce=re||H,ue=null!=K,de=B||ue,[he,pe]=N(!1),[me,fe]=N(-1),be=D(),ge=G??`${be}-input`,ve=`${be}-listbox`,we=e=>`${be}-opt-${e}`,[ye,xe]=N(""),ke=$(),je=I??ke.select.none,$e=e=>{xe(e),fe(-1),P?.(e)},Ne=C(null),De=C(null),Ce=C(null),Se=C(null),Re=C(he);Re.current=he;const We=C(!1),Me=e=>{Re.current&&(Re.current=!1,e&&B&&!ue&&et&&(re?le.includes(et)||ie([...le,et]):et!==oe&&ie([et])),pe(!1),$e(""))},Ae=(e,t)=>{if(!e.disabled){if(re)return ie(le.includes(e.value)?le.filter(t=>t!==e.value):[...le,e.value]),void(e===tt?$e(""):fe(t));ie([e.value]),Me(!1)}},[Ee,Fe]=N(null);y(()=>{if(!J||he)return void Fe(null);const e=Se.current?.offsetWidth??0;Fe(e?e+T[Ue]+6:null)});const Te=v(De,he,ce?{popupRef:Ce}:{matchTriggerWidth:!0}),Ye=S(()=>t(z),[z]),ze=le.join("\0"),Oe=S(()=>{const e=[],t=/* @__PURE__ */new Set;for(const n of Ye)le.includes(n.value)&&!t.has(n.value)&&(t.add(n.value),e.push(n.label));if(de)for(const n of le)t.has(n)||e.push(n);return e},[Ye,ze,de]),Ie=Oe.join(", "),Le=_&&ae&&!U,Ue=(Le?1:0)+(Q?1:0),[Ge,He]=N(null),Be=C(null),Ke=C(""),Pe=C(()=>{});Pe.current=()=>{const e=De.current,t=Be.current;if(!re||!e||!t)return;const n=getComputedStyle(e),r=e.clientWidth-(parseFloat(n.paddingLeft)||0)-(parseFloat(n.paddingRight)||0),l=[n.fontStyle,n.fontWeight,n.fontSize,n.fontFamily,n.letterSpacing].join("|"),o=`${r}|${l}|${Oe.join("\0")}`;if(o===Ke.current)return;Ke.current=o;let i=null;r>0&&Oe.length>0&&(t.style.fontStyle=n.fontStyle,t.style.fontWeight=n.fontWeight,t.style.fontSize=n.fontSize,t.style.fontFamily=n.fontFamily,t.style.letterSpacing=n.letterSpacing,i=E(Oe,e=>(t.textContent=e,t.getBoundingClientRect().width<=r)),t.textContent=""),He(e=>e?.shown===i?.shown&&e?.cut===i?.cut?e:i)},y(()=>{Pe.current()}),R(()=>{const e=De.current;if(!re||!e||"undefined"==typeof ResizeObserver)return;const t=new ResizeObserver(()=>Pe.current());return t.observe(e),()=>t.disconnect()},[re]);const Ve=Oe.length,Xe=!re||!Ge||Ge.shown>=Ve?Ie:0===Ge.shown?ke.select.selectedCount(Ve):`${Oe.slice(0,Ge.shown).join(", ")} +${Ve-Ge.shown}`,Ze=re&&null!==Ge&&(Ge.shown<Ve||Ge.cut),Je=he&&ae&&ce;R(()=>{if(!he)return;const e=e=>{const t=e.target;Ne.current?.contains(t)||Ce.current?.contains(t)||Me(!0)};document.addEventListener("mousedown",e);const t=b(()=>Me(!0));return()=>{document.removeEventListener("mousedown",e),t()}},[he,B,ye,ze,Y.onChange]),R(()=>{if(he)return x(e=>!("Escape"!==e.key||!Re.current)&&(Me(!1),De.current?.blur(),!0),()=>Ce.current)},[he]);const Qe=S(()=>{const e=/* @__PURE__ */new Set;return n(z,t=>!e.has(t.value)&&(e.add(t.value),!0))},[z]),qe=S(()=>{if(P)return Qe;const e=ye.trim().toLowerCase();return e?n(Qe,t=>r(t,e)):Qe},[Qe,ye,P]),_e=S(()=>t(qe),[qe]),et=ye.trim(),tt=S(()=>ue&&et?Ye.some(e=>e.label===et)||le.includes(et)?null:{value:et,label:et}:null,[ue,et,Ye,ze]),nt=S(()=>tt?[..._e,tt]:_e,[_e,tt]);/* @__PURE__ */
2
+ return M("div",{ref:Ne,className:"relative group",onBlur:e=>{const t=e.relatedTarget;t&&(Ne.current?.contains(t)||Ce.current?.contains(t))||We.current||document.activeElement!==De.current&&Me(!0)},children:[(rt=/* @__PURE__ */A("input",{id:ge,ref:De,type:"text",autoComplete:"off",role:"combobox","aria-expanded":he,"aria-haspopup":"listbox","aria-autocomplete":"list","aria-controls":he?ve:void 0,"aria-activedescendant":he&&me>=0&&me<nt.length?we(me):void 0,"aria-label":te?void 0:ee,"aria-labelledby":te,"aria-describedby":ne,value:he?ye:Xe,onChange:e=>{$e(e.target.value),pe(!0)},onFocus:()=>{U||($e(""),pe(!0))},onKeyDown:t=>{if("ArrowDown"===t.key||"ArrowUp"===t.key){if(U)return;if(t.preventDefault(),!he)return void pe(!0);if(0===nt.length)return;const n="ArrowDown"===t.key?1:-1;return void fe(t=>e(nt,t,n))}"Enter"===t.key?(t.preventDefault(),he&&me>=0&&me<nt.length?Ae(nt[me],me):1!==_e.length||_e[0].disabled?B&&!ue&&et&&(re?(le.includes(et)||ie([...le,et]),$e("")):(ie([et]),Me(!1),De.current?.blur())):Ae(_e[0],0)):"Escape"===t.key?(Me(!1),De.current?.blur()):"Tab"===t.key&&Me(!0)},placeholder:Je?Xe:O||je,className:`${se?u:d} ${L} ${a[Ue]}${U?"bg-surface-sunken text-ink-faintest cursor-not-allowed":""} truncate${Je?" rosh-field-shows-choice":""}`,style:Ee?{paddingRight:Ee}:void 0,disabled:U}),re?/* @__PURE__ */A(f,{content:!he&&Ze?Ie:null,className:"block",children:rt}):rt),re&&
3
+ /* @__PURE__ */A("div",{"aria-hidden":"true",className:"pointer-events-none invisible absolute left-0 top-0 h-0 w-0 overflow-hidden",children:/* @__PURE__ */A("span",{ref:Be,className:"whitespace-pre"})}),Ue>0&&
4
+ /* @__PURE__ */M(s,{children:[Le&&
5
+ /* @__PURE__ */A("span",{onMouseDown:e=>e.preventDefault(),className:"flex opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100",children:/* @__PURE__ */A(c,{action:{label:ke.select.clear,icon:/* @__PURE__ */A(p,{name:"close"}),onClick:()=>{ie([]),Me(!1)}}})}),Q&&/* @__PURE__ */A("span",{onMouseDown:e=>e.preventDefault(),className:"flex",children:/* @__PURE__ */A(c,{action:Q})})]}),J&&!he&&/* @__PURE__ */A("div",{ref:Se,className:`absolute top-1/2 -translate-y-1/2 ${F[Ue]} flex items-center gap-1 flex-nowrap justify-end pointer-events-none`,children:J}),he&&W(
6
+ /* @__PURE__ */M("div",{ref:Ce,onMouseDownCapture:()=>{We.current=!0,setTimeout(()=>{We.current=!1},0)},className:"fixed rounded-(--radius-popup) overflow-hidden",style:{zIndex:g.popup,left:Te?.left,right:Te?.right,top:Te?.top,bottom:Te?.bottom,minWidth:Te?.minWidth,width:Te?.width,...ce&&{maxWidth:Te?.maxWidth},visibility:Te?void 0:"hidden",...j()},children:[re&&ae&&_&&!U&&
7
+ /* @__PURE__ */A("button",{type:"button",tabIndex:-1,onMouseDown:e=>{e.preventDefault(),ie([])},className:`block w-full text-left px-3 min-h-(--row-height-menu) py-2 leading-5 text-sm text-gray-600 hover:bg-row-hover border-b ${k}`,children:ke.select.clearAll}),V?
8
+ /* @__PURE__ */A(m,{size:"sm",padding:"py-2",label:ke.search.searching}):X?/* @__PURE__ */M("div",{role:"alert",className:"flex items-center gap-2 px-3 py-2 text-sm text-red-600",children:[
9
+ /* @__PURE__ */A("span",{className:"min-w-0 flex-1",children:X}),Z&&/* @__PURE__ */A(h,{variant:"link",size:"sm",onMouseDown:e=>e.preventDefault(),onClick:Z,className:"shrink-0",children:ke.list.retry})]}):null,
10
+ /* @__PURE__ */M("div",{id:ve,role:nt.length?"listbox":void 0,"aria-labelledby":nt.length?te??(ee?void 0:ge):void 0,"aria-label":nt.length&&!te?ee:void 0,"aria-multiselectable":!(!nt.length||!re)||void 0,className:"overflow-y-auto",style:{maxHeight:Te?.maxHeight??w},children:[0===nt.length?V||X?null:/* @__PURE__ */A("p",{className:"px-3 py-3 text-sm text-ink-faintest text-center",children:ke.select.noMatches}):0===_e.length?null:l(qe,(e,t)=>{const n=le.includes(e.value);/* @__PURE__ */
11
+ return M("button",{id:we(t),type:"button",role:"option","aria-selected":n,"aria-disabled":e.disabled||void 0,tabIndex:-1,onMouseDown:n=>{(e.disabled||re)&&n.preventDefault(),Ae(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 ${n?"text-blue-600 font-medium":"text-gray-700"} ${t===me?"bg-gray-100":n?"bg-blue-50/50":""}`),children:[re&&/* @__PURE__ */A(o,{selected:n}),
12
+ /* @__PURE__ */A("span",{className:`min-w-0 ${ce?"flex-auto":"flex-1"} truncate`,children:q?q(e,{selected:n,active:t===me}):e.label}),e.sublabel&&/* @__PURE__ */A(i,{grows:ce,children:e.sublabel})]},e.value)},be),tt&&K&&
13
+ /* @__PURE__ */A("button",{id:we(_e.length),type:"button",role:"option","aria-selected":!1,tabIndex:-1,onMouseDown:e=>{re&&e.preventDefault(),Ae(tt,_e.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-ink hover:bg-row-hover ${_e.length?`border-t ${k}`:""} ${me===_e.length?"bg-gray-100":""}`,children:/* @__PURE__ */A("span",{className:"min-w-0 flex-1 truncate",children:K(tt.value)})},`${be}-typed`)]})]}),document.body)]});var rt}export{Y as SearchableSelect,E as fitChoice};
@@ -1,5 +1,5 @@
1
- import{inputClasses as e,PLACEHOLDER_INK as r}from"./chunk-AYZY3YNC.js";import{IconButton_default as n}from"./chunk-NWS5G7FE.js";import{DropdownMenu as t}from"./chunk-EX3DARI3.js";import{Tooltip as i}from"./chunk-F2RAIGCG.js";import{iconButtonClasses as a}from"./chunk-UQYNPYF4.js";import{forwardRef as s}from"react";import{jsx as o,jsxs as l}from"react/jsx-runtime";var c={sm:"sm",md:"sm",lg:"md",touch:"touch-sm"},m={sm:"pr-8",md:"pr-8",lg:"pr-10",touch:"pr-12"};function p({children:e}){/* @__PURE__ */
1
+ import{inputClasses as e,PLACEHOLDER_INK as r}from"./chunk-AYZY3YNC.js";import{DropdownMenu as n}from"./chunk-EX3DARI3.js";import{IconButton_default as t}from"./chunk-NWS5G7FE.js";import{Tooltip as i}from"./chunk-F2RAIGCG.js";import{iconButtonClasses as a}from"./chunk-UQYNPYF4.js";import{forwardRef as s}from"react";import{jsx as o,jsxs as l}from"react/jsx-runtime";var c={sm:"sm",md:"sm",lg:"md",touch:"touch-sm"},m={sm:"pr-8",md:"pr-8",lg:"pr-10",touch:"pr-12"};function p({children:e}){/* @__PURE__ */
2
2
  return o("span",{className:"absolute right-1 top-1/2 flex -translate-y-1/2 items-center gap-1",children:e})}function d({action:e,size:r="md"}){/* @__PURE__ */
3
3
  return o(h,{action:e,size:c[r]})}var u=["","pr-8","pr-16"];function h({action:e,size:r}){const{label:s,icon:l,onClick:c,menu:m}=e;/* @__PURE__ */
4
- return o(i,{content:s,describe:!1,children:m?/* @__PURE__ */o(t,{"aria-label":s,trigger:l,items:m,triggerClassName:a({size:r})}):/* @__PURE__ */o(n,{"aria-label":s,size:r,onClick:c,children:l})})}var f=s(function({invalid:n,leftIcon:t,rightAdornment:i,endAction:a,size:s,className:c="",readOnly:u,...h},f){const g=s??"md",N=`${t?"pl-10":""} ${a?m[g]:i?"pr-10":""}`.trim(),v=
4
+ return o(i,{content:s,describe:!1,children:m?/* @__PURE__ */o(n,{"aria-label":s,trigger:l,items:m,triggerClassName:a({size:r})}):/* @__PURE__ */o(t,{"aria-label":s,size:r,onClick:c,children:l})})}var f=s(function({invalid:n,leftIcon:t,rightAdornment:i,endAction:a,size:s,className:c="",readOnly:u,...h},f){const g=s??"md",N=`${t?"pl-10":""} ${a?m[g]:i?"pr-10":""}`.trim(),v=
5
5
  /* @__PURE__ */o("input",{ref:f,"aria-invalid":n||void 0,readOnly:u,className:e({invalid:n,size:s,readOnly:u,className:[N,c].filter(Boolean).join(" ")}),...h});return t||i||a?/* @__PURE__ */l("div",{className:"relative",children:[t&&/* @__PURE__ */o("span",{className:`pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 ${r}`,children:t}),v,a?/* @__PURE__ */o(p,{children:/* @__PURE__ */o(d,{action:a,size:g})}):i&&/* @__PURE__ */o("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400",children:i})]}):v});export{u as END_ACTIONS_PAD,c as INPUT_END_ACTION_SIZE,d as InputEndActionButton,p as InputEndActionSlot,f as Input_default};
@@ -1,4 +1,4 @@
1
- import{Card as e}from"./chunk-RKSCB5BJ.js";import{FormField as t}from"./chunk-6KBDNYRW.js";import{Checkbox_default as r}from"./chunk-CGZBDI6C.js";import{Input_default as l}from"./chunk-TJBHFUWV.js";import{Button_default as a}from"./chunk-UTISUEO4.js";import{useState as i}from"react";import{jsx as c,jsxs as n,Fragment as s}from"react/jsx-runtime";var o={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 m({mode:m="login"}){const[u,d]=i(!0),h=o[m];/* @__PURE__ */
1
+ import{Card as e}from"./chunk-RKSCB5BJ.js";import{FormField as t}from"./chunk-6KBDNYRW.js";import{Checkbox_default as r}from"./chunk-CGZBDI6C.js";import{Input_default as l}from"./chunk-B5KX7PDG.js";import{Button_default as a}from"./chunk-UTISUEO4.js";import{useState as i}from"react";import{jsx as c,jsxs as n,Fragment as s}from"react/jsx-runtime";var o={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 m({mode:m="login"}){const[u,d]=i(!0),h=o[m];/* @__PURE__ */
2
2
  return c("div",{className:"flex h-full items-center justify-center overflow-auto bg-gray-50 p-6",children:/* @__PURE__ */n("div",{className:"w-full max-w-sm",children:[
3
3
  /* @__PURE__ */n("div",{className:"mb-6 text-center",children:[
4
4
  /* @__PURE__ */c("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"}),
@@ -1,4 +1,4 @@
1
- import{SidebarLayout as e}from"./chunk-W24THMLI.js";import{Avatar as t}from"./chunk-SCNQK5NF.js";import{ItemCount as r}from"./chunk-LC2UF3AA.js";import{Button_default as a}from"./chunk-UTISUEO4.js";import{useState as i}from"react";import{jsx as l,jsxs as n}from"react/jsx-runtime";var s=[{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"}],d=[{id:1,from:"Marco Reyes",subject:"Q3 roadmap review",preview:"Sharing the deck ahead of Thursday — let me know what you think before the review.",time:"9:14",unread:!0},{id:2,from:"Priya Patel",subject:"Design handoff",preview:"The Figma file is ready for engineering. I exported every icon at 1x and 2x.",time:"8:02",unread:!0},{id:3,from:"GitHub",subject:"[acme/web] PR #482 merged",preview:"Your pull request was merged into main by the release bot after all checks passed.",time:"Yest"},{id:4,from:"Sara Lind",subject:"Lunch Friday?",preview:"A few of us are heading to the new place on 5th at noon if you want to join.",time:"Yest"}];function c(){const[c,o]=i(1),m=d.find(e=>e.id===c)??d[0];/* @__PURE__ */
1
+ import{SidebarLayout as e}from"./chunk-MCLVTQSF.js";import{Avatar as t}from"./chunk-SCNQK5NF.js";import{ItemCount as r}from"./chunk-LC2UF3AA.js";import{Button_default as a}from"./chunk-UTISUEO4.js";import{useState as i}from"react";import{jsx as l,jsxs as n}from"react/jsx-runtime";var s=[{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"}],d=[{id:1,from:"Marco Reyes",subject:"Q3 roadmap review",preview:"Sharing the deck ahead of Thursday — let me know what you think before the review.",time:"9:14",unread:!0},{id:2,from:"Priya Patel",subject:"Design handoff",preview:"The Figma file is ready for engineering. I exported every icon at 1x and 2x.",time:"8:02",unread:!0},{id:3,from:"GitHub",subject:"[acme/web] PR #482 merged",preview:"Your pull request was merged into main by the release bot after all checks passed.",time:"Yest"},{id:4,from:"Sara Lind",subject:"Lunch Friday?",preview:"A few of us are heading to the new place on 5th at noon if you want to join.",time:"Yest"}];function c(){const[c,o]=i(1),m=d.find(e=>e.id===c)??d[0];/* @__PURE__ */
2
2
  return l("div",{className:"h-full",children:/* @__PURE__ */l(e,{side:"left",defaultWidth:200,sidebar:/* @__PURE__ */n("div",{className:"flex h-full flex-col p-2",children:[
3
3
  /* @__PURE__ */l(a,{block:!0,className:"mb-2",children:"Compose"}),s.map((e,t)=>/* @__PURE__ */n("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:[
4
4
  /* @__PURE__ */l("span",{children:e.label}),null!=e.count&&/* @__PURE__ */l(r,{count:e.count,active:0===t})]},e.id))]}),children:/* @__PURE__ */n("div",{className:"flex h-full",children:[
@@ -1,4 +1,4 @@
1
- import{SidebarLayout as e}from"./chunk-W24THMLI.js";import{Avatar as t}from"./chunk-SCNQK5NF.js";import{Input_default as a}from"./chunk-TJBHFUWV.js";import{Button_default as i}from"./chunk-UTISUEO4.js";import{useState as s}from"react";import{jsx as n,jsxs as l}from"react/jsx-runtime";var r=[{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"}],m=[{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 d(){const[d,o]=s(1),c=r.find(e=>e.id===d)??r[0];/* @__PURE__ */
1
+ import{SidebarLayout as e}from"./chunk-MCLVTQSF.js";import{Avatar as t}from"./chunk-SCNQK5NF.js";import{Input_default as a}from"./chunk-B5KX7PDG.js";import{Button_default as i}from"./chunk-UTISUEO4.js";import{useState as s}from"react";import{jsx as n,jsxs as l}from"react/jsx-runtime";var r=[{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"}],m=[{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 d(){const[d,o]=s(1),c=r.find(e=>e.id===d)??r[0];/* @__PURE__ */
2
2
  return n("div",{className:"h-full",children:/* @__PURE__ */n(e,{side:"left",defaultWidth:260,sidebar:/* @__PURE__ */n("div",{className:"h-full overflow-auto",children:r.map(e=>/* @__PURE__ */l("button",{onClick:()=>o(e.id),className:"flex w-full items-center gap-3 border-b border-gray-100 px-3 py-3 text-left hover:bg-gray-50 "+(e.id===d?"bg-blue-50/50":""),children:[
3
3
  /* @__PURE__ */n(t,{name:e.name,status:e.status}),
4
4
  /* @__PURE__ */l("div",{className:"min-w-0 flex-1",children:[
@@ -0,0 +1,8 @@
1
+ import{useOverlayTarget as e,usePopupAnchor as i,usePopupLevel as t,usePopupLevelBindings as r,windowScrimStyle as o,OverlayLayerProvider as n,scrimHasCorners as l,popupLayerStyle as d}from"./chunk-VY6OQRZA.js";import{CloseButton as s}from"./chunk-LG6NDTHZ.js";import{useDiscardGuard as a}from"./chunk-4BYJABCX.js";import{dialogA11y as m}from"./chunk-VWGWZY7A.js";import{useDismissPopupsOnOpen as c}from"./chunk-UVHXVSB2.js";import{useFocusTrap as p,useScrollLock as h}from"./chunk-DWGYC7OD.js";import{HEADING_TEXT as u,DESCRIPTION_TEXT as f,PANEL_SURFACE as b}from"./chunk-BWJZTHZ6.js";import{useHydrated as y}from"./chunk-WCCS4VFE.js";import{registerModalEscapeInterceptor as v}from"./chunk-TWVUQUUD.js";import{useRef as x,useId as w,useState as g,useEffect as k}from"react";import{createPortal as j}from"react-dom";import{jsxs as N,Fragment as C,jsx as W}from"react/jsx-runtime";var B={sm:"sm:w-[320px]",md:"sm:w-[448px]",lg:"sm:w-[640px]"},V={right:"inset-y-0 right-0",left:"inset-y-0 left-0",bottom:"inset-x-0 bottom-0"};function H(e,i){const t=window.innerHeight-(i.top+i.height);if("bottom"===e)return{left:i.left,width:i.width,bottom:t};const r={top:i.top,height:i.height};return"left"===e?{...r,left:i.left}:{...r,right:window.innerWidth-(i.left+i.width)}}function Z({open:Z,onClose:$,side:D="right",size:U="md",title:Y,description:A,footer:G,children:T,blocking:z=!1,dirty:E=!1,initialFocus:F,"aria-label":J,"aria-labelledby":O,"aria-describedby":Q,className:S=""}){const X=x(null),I=w(),L=w(),R=w(),q=e(y()),[K,M]=g(null),P=a({open:Z,dirty:E,onClose:$,title:Y,layer:K}),_=x(null),ee=i(Z&&null!==q,_),ie=t(Z&&null!==q,_),te=r(ie,K),re=o(ie),oe=null!==ie.host;if(c(Z),p(X,Z&&null!==q,F,te),h(Z),k(()=>{if(Z)return v(()=>!te.current?.(document.activeElement)&&(z||P(),!0),()=>X.current)},[Z,z,P,te]),!Z||!q)return null;const ne="bottom"===D,le={...ne?{maxHeight:"85vh"}:{},...ee?H(D,ee):{}};/* @__PURE__ */
2
+ return N(C,{children:[/* @__PURE__ */W("span",{ref:_,hidden:!0,"data-popup-anchor":""}),j(
3
+ /* @__PURE__ */W(n,{value:K,children:/* @__PURE__ */N("div",{ref:M,className:oe?"fixed inset-0 pointer-events-none":"fixed inset-0",style:d(ie),role:"presentation","data-overlay-layer":"",children:[
4
+ /* @__PURE__ */W("div",{className:"fixed bg-black/30 backdrop-blur-sm "+(oe?"pointer-events-auto"+(l(ie)?" rounded-(--radius-window)":""):"inset-0"),style:re??void 0,hidden:oe&&!re,onClick:z?void 0:P,"aria-hidden":"true","data-popup-scrim":oe?"window":"system"}),
5
+ /* @__PURE__ */N("div",{ref:X,...m({modal:!0,titleId:Y?R:void 0,labelledBy:O,label:J}),"aria-describedby":Q??(A?L:T?I:void 0),"data-drawer-side":D,"data-popup-panel":"",style:le,className:[`fixed flex flex-col ${b}`,oe?"pointer-events-auto":"",ne?"":`w-full max-w-full ${B[U]}`,ee?"":V[D],ne?"rounded-t-xl":"",S].filter(Boolean).join(" "),children:[Y?/* @__PURE__ */N("div",{className:"flex shrink-0 items-center justify-between gap-4 border-b border-gray-100 px-4 py-3",children:[
6
+ /* @__PURE__ */N("div",{className:"min-w-0",children:[
7
+ /* @__PURE__ */W("h2",{id:R,className:u,children:Y}),A&&/* @__PURE__ */W("p",{id:L,className:`mt-0.5 ${f}`,children:A})]}),!z&&/* @__PURE__ */W(s,{onClose:P})]}):!z&&/* @__PURE__ */W("div",{className:"absolute right-2 top-2 z-10",children:/* @__PURE__ */W(s,{onClose:P})}),
8
+ /* @__PURE__ */N("div",{id:I,className:"min-h-0 flex-1 overflow-y-auto px-4 py-4",children:[A&&!Y&&/* @__PURE__ */W("p",{id:L,className:`mb-3 ${f} ${z?"":"pr-8"}`.trim(),children:A}),T]}),G&&/* @__PURE__ */W("div",{className:"flex shrink-0 justify-end gap-3 border-t border-gray-100 px-4 py-3",children:G})]})]})}),q)]})}export{Z as Drawer};
@@ -1,2 +1,2 @@
1
- import{Input_default as e}from"./chunk-TJBHFUWV.js";import{useState as r,useRef as t}from"react";import{jsx as o}from"react/jsx-runtime";function n({value:n,label:a,onDone:u}){const[l,c]=r(n),i=t(!1),p=e=>{i.current||(i.current=!0,u(e))};/* @__PURE__ */
1
+ import{Input_default as e}from"./chunk-B5KX7PDG.js";import{useState as r,useRef as t}from"react";import{jsx as o}from"react/jsx-runtime";function n({value:n,label:a,onDone:u}){const[l,c]=r(n),i=t(!1),p=e=>{i.current||(i.current=!0,u(e))};/* @__PURE__ */
2
2
  return o(e,{size:"sm",autoFocus:!0,"aria-label":a,value:l,onChange:e=>c(e.target.value),onFocus:e=>e.currentTarget.select(),onKeyDown:e=>{e.stopPropagation(),"Enter"===e.key?(e.preventDefault(),p(l.trim()||n)):"Escape"===e.key&&(e.preventDefault(),p(null))},onBlur:()=>p(l.trim()||n),onClick:e=>e.stopPropagation()})}export{n as RenameField};
@@ -0,0 +1 @@
1
+ var r="13.24.1",a=r;export{a as APP_VERSION,r as VERSION};
@@ -1,23 +1,23 @@
1
- import{Calendar as e}from"./chunk-RFWBNKKB.js";import{gridColumnCount as t}from"./chunk-VNNVG4NR.js";import{END_ACTIONS_PAD as r,InputEndActionSlot as n,InputEndActionButton as a}from"./chunk-TJBHFUWV.js";import{FILTER_ON as o,FILTER_ON_INK as i,FILTER_OFF as l}from"./chunk-AYZY3YNC.js";import{userToday as s,calendarNames as c}from"./chunk-NHKT5IH6.js";import{toDateKey as d,fromDateKey as m,toMonthKey as u}from"./chunk-JRQMX4PK.js";import{pad2 as h}from"./chunk-LF27WIN2.js";import{Icon as p}from"./chunk-ISVODSRP.js";import{onOverlayOpen as f}from"./chunk-PGN5ME7B.js";import{Z_LAYERS as g}from"./chunk-62LW225J.js";import{useDropdownPosition as b}from"./chunk-VY3UA6AR.js";import{useBrowserLayoutEffect as x}from"./chunk-ZDXRSY2Y.js";import{buttonClasses as v}from"./chunk-UQYNPYF4.js";import{glassStyle as y}from"./chunk-5FYDNH4Y.js";import{useShellStrings as N,useShellLocale as w}from"./chunk-NRHG4R2Q.js";import{useState as k,useRef as C,useId as j,useEffect as M}from"react";import{createPortal as D}from"react-dom";import{jsxs as W,Fragment as $,jsx as Y}from"react/jsx-runtime";var F=["last2Weeks","lastMonth","last3Months","last6Months","last12Months"],R=d;function S(e,t){const r=t.getFullYear(),n=t.getMonth(),a=new Date(r,n,t.getDate()),o=new Date(r,n,0),i=e=>new Date(r,n-e,1);switch(e){case"last2Weeks":return{from:d(new Date(r,n,t.getDate()-14)),to:d(a)};case"lastMonth":return{from:d(i(1)),to:d(o)};case"last3Months":return{from:d(i(3)),to:d(o)};case"last6Months":return{from:d(i(6)),to:d(o)};case"last12Months":return{from:d(i(12)),to:d(o)}}}function H(e,t,r){const n=u(e);return t&&n<t.slice(0,7)?t.slice(0,7):r&&n>r.slice(0,7)?r.slice(0,7):n}function O(e){const t=m(e);return t?`${h(t.getDate())}/${h(t.getMonth()+1)}/${t.getFullYear()}`:e}var B=/* @__PURE__ */new Map;function T({from:d,to:u,onChange:h,formatDisplay:R,clearable:T,required:V=!1,name:A,id:I,"aria-labelledby":L,"aria-label":U,weekStartsOn:E,placeholder:G,fullWidth:K=!1,min:P,max:q,disabled:J=!1,allowOpenEnd:Q=!1}){const Z=N().dateRange,X=w(),z=R??(X?function(e){let t=B.get(e);t||(t=new Intl.DateTimeFormat(e,{year:"numeric",month:"2-digit",day:"2-digit",timeZone:"UTC",calendar:"gregory"}),B.set(e,t));const r=t;return e=>{const t=m(e);return t?r.format(new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()))):e}}(X):O),_=G??Z.placeholder,ee=T??!V,[te,re]=k(!1),[ne,ae]=k(d),[oe,ie]=k(u),[le,se]=k(null),[ce,de]=k("from"),me=C(null),ue=C(null),he=C(null),pe=j(),fe=j(),ge=j(),[be,xe]=k(!1),ve=b(me,te,{preferredMaxWidth:520,preferredMaxHeight:be?720:560,popupRef:he}),ye=C(null),Ne=C(null),[we,ke]=k(!0);x(()=>{const e=Ne.current;if(!te||!be||!e)return;const r=t(getComputedStyle(e).gridTemplateColumns)||1,n=parseFloat(getComputedStyle(e).columnGap)||0,a=(e.clientWidth-n*(r-1))/r,o=Math.max(...Array.from(e.querySelectorAll("[data-preset-measure]"),e=>e.offsetWidth))+24+2<=a+.5;o!==we&&ke(o)});const Ce=C(null);x(()=>{const e=he.current;if(!te||!ve||!e)return;const t=getComputedStyle(e),r=ve.maxWidth-(e.offsetWidth-e.clientWidth)-parseFloat(t.paddingLeft)-parseFloat(t.paddingRight);if(be)null!==Ce.current&&Ce.current<=r&&xe(!1);else{const e=ye.current?.offsetWidth??0;if(0===e)return;Ce.current=e,e>r+.5&&xe(!0)}});const[je,Me]=k(!1);x(()=>{const e=!!I&&(ue.current?.labels?.length??0)>0;e!==je&&Me(e)});const De=!!U||!!L||je,We=m(s())??/* @__PURE__ */new Date(0),[$e,Ye]=k(()=>d?d.slice(0,7):H(We,P,q)),Fe=F.filter(e=>((e,t,r)=>(!t||e.from>=t)&&(!r||e.to<=r))(S(e,We),P,q)),Re=e=>e?z(e):"";M(()=>{if(!te)return;const e=e=>{const t=e.target;me.current?.contains(t)||he.current?.contains(t)||re(!1)};document.addEventListener("mousedown",e);const t=f(()=>re(!1));return()=>{document.removeEventListener("mousedown",e),t()}},[te]),M(()=>{J&&re(!1)},[J]);const Se=()=>{h("",""),re(!1)},He=ee&&!J&&Boolean(d||u),Oe=d&&u?`${Re(d)} — ${Re(u)}`:d?Z.fromOnly(Re(d)):u?Z.toOnly(Re(u)):"",Be=c(X),Te=e=>{const t=m(e);return t?Be.longDate(t.getFullYear(),t.getMonth(),t.getDate()):e},Ve=d&&u?Z.range(Te(d),Te(u)):d?Z.fromOnly(Te(d)):u?Z.toOnly(Te(u)):_,Ae=e=>be?"h-8 w-full min-w-0 truncate rounded-(--radius-control) border px-3 text-sm transition-colors "+(le===e?"border-blue-300 bg-accent-tint text-blue-700 font-medium":"border-line text-ink hover:bg-row-hover"):"h-8 text-left px-3 text-sm rounded-(--radius-control) transition-colors "+(le===e?"bg-accent-tint text-blue-700 font-medium":"text-ink hover:bg-row-hover"),Ie=/* @__PURE__ */W($,{children:[Fe.map(e=>/* @__PURE__ */Y("button",{type:"button",onClick:()=>(e=>{if("Custom"===e)return;const t=S(e,We);ae(t.from),ie(t.to),se(e),Ye(t.from.slice(0,7))})(e),className:Ae(e),"aria-label":be?Z[e]:void 0,children:be?we?Z[e]:Z[`${e}Short`]:Z[e]},e)),
2
- /* @__PURE__ */Y("button",{type:"button",onClick:()=>se("Custom"),className:Ae("Custom"),children:Z.custom})]}),Le=(e,t)=>Q?/* @__PURE__ */Y("button",{type:"button","data-range-end":e,"aria-pressed":ce===e,onClick:()=>de(e),className:"flex items-center gap-2 whitespace-nowrap rounded rosh-focus-ring",children:t}):/* @__PURE__ */Y("div",{className:"flex items-center gap-2 whitespace-nowrap",children:t}),Ue=e=>Q&&ce===e?" ring-1 ring-blue-400":"",Ee=
3
- /* @__PURE__ */Y(e,{mode:"range",min:P,max:q,value:ne||null,endValue:oe||null,month:$e,onMonthChange:Ye,onSelect:e=>{se("Custom"),Q?"from"===ce?(oe&&e>oe?(ae(oe),ie(e)):ae(e),de("to")):ne&&e<ne?(ie(ne),ae(e)):ie(e):!ne||ne&&oe?(ae(e),ie("")):e<ne?(ie(ne),ae(e)):ie(e)},weekStartsOn:E,"aria-label":Z.dialog});/* @__PURE__ */
4
- return W("div",{className:"relative"+(K?" w-full":""),ref:me,children:[
5
- /* @__PURE__ */W("div",{className:`relative ${K?"flex w-full":"inline-flex"} h-8 items-center gap-2 border rounded-lg px-3 ${He?r[1]:""} text-sm focus-within:border-blue-500 has-focus-visible:ring-1 has-focus-visible:ring-[color:var(--rosh-focus-ring-deep)] ${d||u?`${o} ${i}`:l}${J?" cursor-not-allowed opacity-60":""}`,children:[
6
- /* @__PURE__ */W("button",{ref:ue,type:"button",onClick:()=>{J||(ae(d),ie(u),se(null),de(d&&!u?"to":"from"),Ye(d?d.slice(0,7):H(We,P,q)),re(!0))},"aria-haspopup":"dialog","aria-expanded":te,id:I,disabled:J||void 0,"aria-label":U,"aria-labelledby":L,"aria-describedby":[De?fe:void 0,V?ge:void 0].filter(Boolean).join(" ")||void 0,"aria-controls":te?pe:void 0,className:"inline-flex items-center gap-2 rosh-focus-ring"+(K?" min-w-0 flex-1 justify-start":""),children:[
1
+ import{Calendar as e}from"./chunk-RFWBNKKB.js";import{gridColumnCount as t}from"./chunk-VNNVG4NR.js";import{END_ACTIONS_PAD as r,InputEndActionSlot as n,InputEndActionButton as a}from"./chunk-B5KX7PDG.js";import{FILTER_ON as o,FILTER_ON_INK as i,FILTER_OFF as l}from"./chunk-AYZY3YNC.js";import{userToday as s,calendarNames as c}from"./chunk-NHKT5IH6.js";import{toDateKey as d,fromDateKey as m,toMonthKey as u}from"./chunk-JRQMX4PK.js";import{pad2 as h}from"./chunk-LF27WIN2.js";import{Icon as p}from"./chunk-ISVODSRP.js";import{onOverlayOpen as f}from"./chunk-PGN5ME7B.js";import{Z_LAYERS as g}from"./chunk-62LW225J.js";import{useDropdownPosition as b}from"./chunk-VY3UA6AR.js";import{useBrowserLayoutEffect as x}from"./chunk-ZDXRSY2Y.js";import{buttonClasses as v}from"./chunk-UQYNPYF4.js";import{glassStyle as y}from"./chunk-5FYDNH4Y.js";import{useShellStrings as N,useShellLocale as w}from"./chunk-NRHG4R2Q.js";import{useState as k,useRef as C,useId as j,useEffect as D}from"react";import{createPortal as M}from"react-dom";import{jsxs as W,Fragment as $,jsx as Y}from"react/jsx-runtime";var F=["last2Weeks","lastMonth","last3Months","last6Months","last12Months"],R=d;function S(e,t){const r=t.getFullYear(),n=t.getMonth(),a=new Date(r,n,t.getDate()),o=new Date(r,n,0),i=e=>new Date(r,n-e,1);switch(e){case"last2Weeks":return{from:d(new Date(r,n,t.getDate()-14)),to:d(a)};case"lastMonth":return{from:d(i(1)),to:d(o)};case"last3Months":return{from:d(i(3)),to:d(o)};case"last6Months":return{from:d(i(6)),to:d(o)};case"last12Months":return{from:d(i(12)),to:d(o)}}}function H(e,t,r){const n=u(e);return t&&n<t.slice(0,7)?t.slice(0,7):r&&n>r.slice(0,7)?r.slice(0,7):n}function O(e){const t=m(e);return t?`${h(t.getDate())}/${h(t.getMonth()+1)}/${t.getFullYear()}`:e}var B=/* @__PURE__ */new Map;function A({from:d,to:u,onChange:h,formatDisplay:R,clearable:A,required:G=!1,name:I,id:K,"aria-labelledby":L,"aria-label":P,weekStartsOn:T,placeholder:V,fullWidth:E=!1,min:U,max:q,disabled:Q=!1,allowOpenEnd:X=!1}){const Z=N().dateRange,J=w(),z=R??(J?function(e){let t=B.get(e);t||(t=new Intl.DateTimeFormat(e,{year:"numeric",month:"2-digit",day:"2-digit",timeZone:"UTC",calendar:"gregory"}),B.set(e,t));const r=t;return e=>{const t=m(e);return t?r.format(new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()))):e}}(J):O),_=V??Z.placeholder,ee=A??!G,[te,re]=k(!1),[ne,ae]=k(d),[oe,ie]=k(u),[le,se]=k(null),[ce,de]=k("from"),me=C(null),ue=C(null),he=C(null),pe=j(),fe=j(),ge=j(),[be,xe]=k(!1),ve=b(me,te,{preferredMaxWidth:520,preferredMaxHeight:be?720:560,popupRef:he}),ye=C(null),Ne=C(null),[we,ke]=k(!0);x(()=>{const e=Ne.current;if(!te||!be||!e)return;const r=t(getComputedStyle(e).gridTemplateColumns)||1,n=parseFloat(getComputedStyle(e).columnGap)||0,a=(e.clientWidth-n*(r-1))/r,o=Math.max(...Array.from(e.querySelectorAll("[data-preset-measure]"),e=>e.offsetWidth))+24+2<=a+.5;o!==we&&ke(o)});const Ce=C(null);x(()=>{const e=he.current;if(!te||!ve||!e)return;const t=getComputedStyle(e),r=ve.maxWidth-(e.offsetWidth-e.clientWidth)-parseFloat(t.paddingLeft)-parseFloat(t.paddingRight);if(be)null!==Ce.current&&Ce.current<=r&&xe(!1);else{const e=ye.current?.offsetWidth??0;if(0===e)return;Ce.current=e,e>r+.5&&xe(!0)}});const[je,De]=k(!1);x(()=>{const e=!!K&&(ue.current?.labels?.length??0)>0;e!==je&&De(e)});const Me=!!P||!!L||je,We=m(s())??/* @__PURE__ */new Date(0),[$e,Ye]=k(()=>d?d.slice(0,7):H(We,U,q)),Fe=F.filter(e=>((e,t,r)=>(!t||e.from>=t)&&(!r||e.to<=r))(S(e,We),U,q)),Re=e=>e?z(e):"";D(()=>{if(!te)return;const e=e=>{const t=e.target;me.current?.contains(t)||he.current?.contains(t)||re(!1)};document.addEventListener("mousedown",e);const t=f(()=>re(!1));return()=>{document.removeEventListener("mousedown",e),t()}},[te]),D(()=>{Q&&re(!1)},[Q]);const Se=()=>{h("",""),re(!1)},He=ee&&!Q&&Boolean(d||u),Oe=d&&u?`${Re(d)} — ${Re(u)}`:d?Z.fromOnly(Re(d)):u?Z.toOnly(Re(u)):"",Be=c(J),Ae=e=>{const t=m(e);return t?Be.longDate(t.getFullYear(),t.getMonth(),t.getDate()):e},Ge=d&&u?Z.range(Ae(d),Ae(u)):d?Z.fromOnly(Ae(d)):u?Z.toOnly(Ae(u)):_,Ie=e=>be?"h-8 w-full min-w-0 truncate rounded-(--radius-control) border px-3 text-sm transition-colors "+(le===e?"border-blue-300 bg-accent-tint text-blue-700 font-medium":"border-line text-ink hover:bg-row-hover"):"h-8 text-left px-3 text-sm rounded-(--radius-control) transition-colors "+(le===e?"bg-accent-tint text-blue-700 font-medium":"text-ink hover:bg-row-hover"),Ke=/* @__PURE__ */W($,{children:[Fe.map(e=>/* @__PURE__ */Y("button",{type:"button",onClick:()=>(e=>{if("Custom"===e)return;const t=S(e,We);ae(t.from),ie(t.to),se(e),Ye(t.from.slice(0,7))})(e),className:Ie(e),"aria-label":be?Z[e]:void 0,children:be?we?Z[e]:Z[`${e}Short`]:Z[e]},e)),
2
+ /* @__PURE__ */Y("button",{type:"button",onClick:()=>se("Custom"),className:Ie("Custom"),children:Z.custom})]}),Le=(e,t)=>X?/* @__PURE__ */Y("button",{type:"button","data-range-end":e,"aria-pressed":ce===e,onClick:()=>de(e),className:"flex items-center gap-2 whitespace-nowrap rounded rosh-focus-ring",children:t}):/* @__PURE__ */Y("div",{className:"flex items-center gap-2 whitespace-nowrap",children:t}),Pe=e=>X&&ce===e?" ring-1 ring-blue-400":"",Te=
3
+ /* @__PURE__ */Y(e,{mode:"range",min:U,max:q,value:ne||null,endValue:oe||null,month:$e,onMonthChange:Ye,onSelect:e=>{se("Custom"),X?"from"===ce?(oe&&e>oe?(ae(oe),ie(e)):ae(e),de("to")):ne&&e<ne?(ie(ne),ae(e)):ie(e):!ne||ne&&oe?(ae(e),ie("")):e<ne?(ie(ne),ae(e)):ie(e)},weekStartsOn:T,"aria-label":Z.dialog});/* @__PURE__ */
4
+ return W("div",{className:"relative"+(E?" w-full":""),ref:me,children:[
5
+ /* @__PURE__ */W("div",{className:`relative ${E?"flex w-full":"inline-flex"} h-8 items-center gap-2 border rounded-lg px-3 ${He?r[1]:""} text-sm focus-within:border-blue-500 has-focus-visible:ring-1 has-focus-visible:ring-[color:var(--rosh-focus-ring-deep)] ${d||u?`${o} ${i}`:l}${Q?" cursor-not-allowed opacity-60":""}`,children:[
6
+ /* @__PURE__ */W("button",{ref:ue,type:"button",onClick:()=>{Q||(ae(d),ie(u),se(null),de(d&&!u?"to":"from"),Ye(d?d.slice(0,7):H(We,U,q)),re(!0))},"aria-haspopup":"dialog","aria-expanded":te,id:K,disabled:Q||void 0,"aria-label":P,"aria-labelledby":L,"aria-describedby":[Me?fe:void 0,G?ge:void 0].filter(Boolean).join(" ")||void 0,"aria-controls":te?pe:void 0,className:"inline-flex items-center gap-2 rosh-focus-ring"+(E?" min-w-0 flex-1 justify-start":""),children:[
7
7
  /* @__PURE__ */Y(p,{name:"date",className:"w-4 h-4 shrink-0",strokeWidth:"2","aria-hidden":"true"}),
8
- /* @__PURE__ */Y("span",{className:"truncate",children:Oe||_})]}),He&&/* @__PURE__ */Y(n,{children:/* @__PURE__ */Y(a,{action:{label:Z.clearRange,icon:/* @__PURE__ */Y(p,{name:"close"}),onClick:Se}})})]}),De&&/* @__PURE__ */Y("span",{id:fe,className:"sr-only",children:Ve}),V&&/* @__PURE__ */Y("span",{id:ge,className:"sr-only",children:Z.required}),A&&/* @__PURE__ */W($,{children:[
9
- /* @__PURE__ */Y("input",{type:"hidden",name:A.from,value:d,disabled:J||void 0}),
10
- /* @__PURE__ */Y("input",{type:"hidden",name:A.to,value:u,disabled:J||void 0})]}),te&&D(
8
+ /* @__PURE__ */Y("span",{className:"truncate",children:Oe||_})]}),He&&/* @__PURE__ */Y(n,{children:/* @__PURE__ */Y(a,{action:{label:Z.clearRange,icon:/* @__PURE__ */Y(p,{name:"close"}),onClick:Se}})})]}),Me&&/* @__PURE__ */Y("span",{id:fe,className:"sr-only",children:Ge}),G&&/* @__PURE__ */Y("span",{id:ge,className:"sr-only",children:Z.required}),I&&/* @__PURE__ */W($,{children:[
9
+ /* @__PURE__ */Y("input",{type:"hidden",name:I.from,value:d,disabled:Q||void 0}),
10
+ /* @__PURE__ */Y("input",{type:"hidden",name:I.to,value:u,disabled:Q||void 0})]}),te&&M(
11
11
  /* @__PURE__ */W("div",{ref:he,id:pe,role:"dialog","aria-label":Z.dialog,"data-layout":be?"stacked":"side",className:"fixed rounded-(--radius-popup) p-4",style:{zIndex:g.popup,left:ve?.left,right:ve?.right,top:ve?.top,bottom:ve?.bottom,width:be&&ve?ve.maxWidth:"max-content",maxWidth:ve?.maxWidth,maxHeight:ve?.maxHeight,overflowY:"auto",visibility:ve?void 0:"hidden",...y()},children:[
12
12
  /* @__PURE__ */W("div",{className:be?"mb-3 flex flex-wrap items-center gap-x-4 gap-y-2":"flex items-center gap-3 mb-3",children:[Le("from",/* @__PURE__ */W($,{children:[
13
13
  /* @__PURE__ */Y("span",{className:"text-xs font-medium text-gray-500",children:Z.from}),
14
- /* @__PURE__ */Y("span",{className:`text-sm px-2 py-1 rounded border min-w-[90px] ${ne?"border-blue-300 bg-accent-tint text-blue-700":"border-line bg-surface-sunken text-ink-faintest"}${Ue("from")}`,children:ne?Re(ne):Z.start})]})),!be&&/* @__PURE__ */Y("span",{className:"text-gray-300",children:"—"}),Le("to",/* @__PURE__ */W($,{children:[
14
+ /* @__PURE__ */Y("span",{className:`text-sm px-2 py-1 rounded border min-w-[90px] ${ne?"border-blue-300 bg-accent-tint text-blue-700":"border-line bg-surface-sunken text-ink-faintest"}${Pe("from")}`,children:ne?Re(ne):Z.start})]})),!be&&/* @__PURE__ */Y("span",{className:"text-gray-300",children:"—"}),Le("to",/* @__PURE__ */W($,{children:[
15
15
  /* @__PURE__ */Y("span",{className:"text-xs font-medium text-gray-500",children:Z.to}),
16
- /* @__PURE__ */Y("span",{className:`text-sm px-2 py-1 rounded border min-w-[90px] ${oe?"border-blue-300 bg-accent-tint text-blue-700":"border-line bg-surface-sunken text-ink-faintest"}${Ue("to")}`,children:oe?Re(oe):Z.end})]}))]}),be?/* @__PURE__ */W($,{children:[Fe.length>0&&/* @__PURE__ */W("div",{className:"mb-3 @container",children:[!we&&/* @__PURE__ */Y("p",{"aria-hidden":"true",className:"mb-1 text-xs font-medium text-ink-faint",children:Z.lastHeading}),
17
- /* @__PURE__ */W("div",{ref:Ne,className:"relative grid grid-cols-2 gap-2 @min-[320px]:grid-cols-3",children:[Ie,Fe.map(e=>/* @__PURE__ */Y("span",{"data-preset-measure":"","aria-hidden":"true",className:"invisible absolute left-0 top-0 whitespace-nowrap text-sm",children:Z[e]},e))]})]}),
18
- /* @__PURE__ */Y("div",{className:"w-full",children:Ee})]}):
16
+ /* @__PURE__ */Y("span",{className:`text-sm px-2 py-1 rounded border min-w-[90px] ${oe?"border-blue-300 bg-accent-tint text-blue-700":"border-line bg-surface-sunken text-ink-faintest"}${Pe("to")}`,children:oe?Re(oe):Z.end})]}))]}),be?/* @__PURE__ */W($,{children:[Fe.length>0&&/* @__PURE__ */W("div",{className:"mb-3 @container",children:[!we&&/* @__PURE__ */Y("p",{"aria-hidden":"true",className:"mb-1 text-xs font-medium text-ink-faint",children:Z.lastHeading}),
17
+ /* @__PURE__ */W("div",{ref:Ne,className:"relative grid grid-cols-2 gap-2 @min-[320px]:grid-cols-3",children:[Ke,Fe.map(e=>/* @__PURE__ */Y("span",{"data-preset-measure":"","aria-hidden":"true",className:"invisible absolute left-0 top-0 whitespace-nowrap text-sm",children:Z[e]},e))]})]}),
18
+ /* @__PURE__ */Y("div",{className:"w-full",children:Te})]}):
19
19
  /* @__PURE__ */W("div",{ref:ye,className:"flex w-max gap-4",children:[
20
- /* @__PURE__ */Y("div",{className:"w-64",children:Ee}),Fe.length>0&&/* @__PURE__ */Y("div",{className:"border-l border-gray-200 pl-4 flex flex-col gap-1 min-w-[130px]",children:Ie})]}),
20
+ /* @__PURE__ */Y("div",{className:"w-64",children:Te}),Fe.length>0&&/* @__PURE__ */Y("div",{className:"border-l border-gray-200 pl-4 flex flex-col gap-1 min-w-[130px]",children:Ke})]}),
21
21
  /* @__PURE__ */W("div",{className:"flex flex-wrap justify-end gap-2 mt-4 pt-3 border-t border-gray-200",children:[ee&&/* @__PURE__ */Y("button",{type:"button",onClick:Se,className:v({variant:"ghost"}),children:Z.clear}),
22
22
  /* @__PURE__ */Y("button",{type:"button",onClick:()=>re(!1),className:v({variant:"secondary"}),children:Z.cancel}),
23
- /* @__PURE__ */Y("button",{type:"button",onClick:()=>{h(ne,oe),re(!1)},disabled:Q?!ne&&!oe:!ne||!oe,className:v({variant:"primary"}),children:Z.apply})]})]}),document.body)]})}export{T as DateRangePicker,S as presetRange,R as toISODate};
23
+ /* @__PURE__ */Y("button",{type:"button",onClick:()=>{h(ne,oe),re(!1)},disabled:X?!ne&&!oe:!ne||!oe,className:v({variant:"primary"}),children:Z.apply})]})]}),document.body)]})}export{A as DateRangePicker,S as presetRange,R as toISODate};
@@ -0,0 +1,2 @@
1
+ import{IconButton_default as o}from"./chunk-NWS5G7FE.js";import{Icon as r}from"./chunk-ISVODSRP.js";import{useShellStrings as e}from"./chunk-NRHG4R2Q.js";import{jsx as a}from"react/jsx-runtime";function s({onClose:s,className:i,label:t}){const n=e().dialog;/* @__PURE__ */
2
+ return a(o,{variant:"ghost",onClick:s,"aria-label":t??n.close,className:i,children:/* @__PURE__ */a(r,{name:"close",className:"size-[18px]",strokeWidth:1.5,"aria-hidden":"true"})})}export{s as CloseButton};
@@ -1,9 +1,9 @@
1
- import{CountBadge as e}from"./chunk-PFOTEDSQ.js";import{isShown as i}from"./chunk-HCP7WOAL.js";import{SettingRowNameContext as n,SettingAutoContext as a}from"./chunk-2NMW66P5.js";import{useShellStrings as t}from"./chunk-NRHG4R2Q.js";import{isValidElement as l}from"react";import{jsx as s,jsxs as r,Fragment as d}from"react/jsx-runtime";var c={pad:"p-4",gap:"gap-4",text:"text-sm",bodyTop:"mt-4",bodyPad:"pt-3"},m=e=>Array.isArray(e)?e.some(m):l(e);function o({label:l,icon:o,action:h,value:u,readout:f,changed:p=!1,description:x,children:N,controlId:v,labelId:g,unknownText:b="—",quiet:y=!1,size:k="default",viewState:w,divider:$=!0,showWhen:j,values:P,context:T,className:A=""}){const F=t();if(!i(j,P,T))return null;const W="auto"===w?/* @__PURE__ */s("span",{"data-setting-auto":"","aria-hidden":"true",className:"shrink-0 rounded-sm border border-line px-1 text-2xs font-normal leading-4 text-ink-faint",children:F.settingView.auto}):"edited"===w?/* @__PURE__ */r("span",{"data-setting-edited":"",className:"inline-flex shrink-0 items-center",children:[
1
+ import{CountBadge as e}from"./chunk-PFOTEDSQ.js";import{SettingRowNameContext as i,SettingAutoContext as n}from"./chunk-2NMW66P5.js";import{isShown as a}from"./chunk-HCP7WOAL.js";import{useShellStrings as t}from"./chunk-NRHG4R2Q.js";import{isValidElement as l}from"react";import{jsx as s,jsxs as r,Fragment as d}from"react/jsx-runtime";var c={pad:"p-4",gap:"gap-4",text:"text-sm",bodyTop:"mt-4",bodyPad:"pt-3"},m=e=>Array.isArray(e)?e.some(m):l(e);function o({label:l,icon:o,action:h,value:u,readout:f,changed:p=!1,description:x,children:N,controlId:v,labelId:g,unknownText:b="—",quiet:y=!1,size:k="default",viewState:w,divider:$=!0,showWhen:j,values:P,context:T,className:A=""}){const F=t();if(!a(j,P,T))return null;const W="auto"===w?/* @__PURE__ */s("span",{"data-setting-auto":"","aria-hidden":"true",className:"shrink-0 rounded-sm border border-line px-1 text-2xs font-normal leading-4 text-ink-faint",children:F.settingView.auto}):"edited"===w?/* @__PURE__ */r("span",{"data-setting-edited":"",className:"inline-flex shrink-0 items-center",children:[
2
2
  /* @__PURE__ */s("span",{"aria-hidden":"true",className:"inline-flex",children:/* @__PURE__ */s(e,{dot:!0,tone:"accent"})}),
3
- /* @__PURE__ */s("span",{className:"sr-only",children:F.settingView.edited})]}):null,H=null!=f&&!1!==f;if("compact"===k){const e=m(u),i=m(h);if(!e&&!i)return null;const t=g,c=["es-field"];e||c.push("is-inline"),p&&c.push("is-changed"),A&&c.push(A);const b=/* @__PURE__ */r(d,{children:[null!=o&&/* @__PURE__ */s("span",{className:"es-field-icon","aria-hidden":"true",children:o}),
4
- /* @__PURE__ */s("span",{className:"es-field-label",id:t,children:l}),W]}),y=e=>/* @__PURE__ */s(n.Provider,{value:t,children:/* @__PURE__ */s(a.Provider,{value:"auto"===w,children:e})});/* @__PURE__ */
3
+ /* @__PURE__ */s("span",{className:"sr-only",children:F.settingView.edited})]}):null,H=null!=f&&!1!==f;if("compact"===k){const e=m(u),a=m(h);if(!e&&!a)return null;const t=g,c=["es-field"];e||c.push("is-inline"),p&&c.push("is-changed"),A&&c.push(A);const b=/* @__PURE__ */r(d,{children:[null!=o&&/* @__PURE__ */s("span",{className:"es-field-icon","aria-hidden":"true",children:o}),
4
+ /* @__PURE__ */s("span",{className:"es-field-label",id:t,children:l}),W]}),y=e=>/* @__PURE__ */s(i.Provider,{value:t,children:/* @__PURE__ */s(n.Provider,{value:"auto"===w,children:e})});/* @__PURE__ */
5
5
  return r("div",{className:c.join(" "),children:[
6
- /* @__PURE__ */r("div",{className:"es-field-head",children:[v?/* @__PURE__ */s("label",{className:"es-field-name",htmlFor:v,children:b}):/* @__PURE__ */s("span",{className:"es-field-name",children:b}),H&&/* @__PURE__ */s("span",{className:"es-field-value",children:f}),i&&y(h)]}),e&&/* @__PURE__ */s("div",{className:"es-field-ctl",children:y(u)}),x?/* @__PURE__ */s("p",{className:"es-field-hint",children:x}):null,N]})}const I=c,O=void 0!==u||void 0===N&&null==h,Q=null==u||""===u,R=y?"text-gray-500":"text-gray-800",S=Q?"text-gray-400":y?"text-gray-500":"text-gray-900",V=`${I.text} font-medium ${R}`,q=v?/* @__PURE__ */s("label",{htmlFor:v,id:g,className:V,children:l}):/* @__PURE__ */s("span",{id:g,className:V,children:l}),z=/* @__PURE__ */s(n.Provider,{value:g,children:/* @__PURE__ */s(a.Provider,{value:"auto"===w,children:Q?b:u})}),B=[$?"border-t border-line-subtle first:border-t-0":"",I.pad,A].filter(Boolean).join(" "),C=null!=N&&!1!==N&&/* @__PURE__ */s("div",{className:`${I.bodyTop} border-t border-line-subtle ${I.bodyPad}`,children:N});/* @__PURE__ */
6
+ /* @__PURE__ */r("div",{className:"es-field-head",children:[v?/* @__PURE__ */s("label",{className:"es-field-name",htmlFor:v,children:b}):/* @__PURE__ */s("span",{className:"es-field-name",children:b}),H&&/* @__PURE__ */s("span",{className:"es-field-value",children:f}),a&&y(h)]}),e&&/* @__PURE__ */s("div",{className:"es-field-ctl",children:y(u)}),x?/* @__PURE__ */s("p",{className:"es-field-hint",children:x}):null,N]})}const I=c,O=void 0!==u||void 0===N&&null==h,Q=null==u||""===u,R=y?"text-gray-500":"text-gray-800",S=Q?"text-gray-400":y?"text-gray-500":"text-gray-900",V=`${I.text} font-medium ${R}`,q=v?/* @__PURE__ */s("label",{htmlFor:v,id:g,className:V,children:l}):/* @__PURE__ */s("span",{id:g,className:V,children:l}),z=/* @__PURE__ */s(i.Provider,{value:g,children:/* @__PURE__ */s(n.Provider,{value:"auto"===w,children:Q?b:u})}),B=[$?"border-t border-line-subtle first:border-t-0":"",I.pad,A].filter(Boolean).join(" "),C=null!=N&&!1!==N&&/* @__PURE__ */s("div",{className:`${I.bodyTop} border-t border-line-subtle ${I.bodyPad}`,children:N});/* @__PURE__ */
7
7
  return r("div",H?{className:B,children:[
8
8
  /* @__PURE__ */r("div",{"data-setting-line":"",className:"flex flex-wrap items-center justify-between gap-x-2 gap-y-2",children:[
9
9
  /* @__PURE__ */s("div",{className:"flex-1 basis-0",children:/* @__PURE__ */r("div",{className:`flex min-w-0 items-center gap-2 ${R}`,children:[null!=o&&/* @__PURE__ */s("span",{"aria-hidden":"true",className:"inline-flex h-4 w-4 shrink-0 items-center justify-center",children:o}),q,W]})}),
@@ -1,13 +1,13 @@
1
- import{copyToClipboard as e,selectionAt as t}from"./chunk-XYVFJLAU.js";import{useTableNav as n}from"./chunk-ATMJ5ZPK.js";import{escapeHtml as r}from"./chunk-G6DKCCWH.js";import{ListFooter as o}from"./chunk-U73K3ICC.js";import{ListLoadError as l}from"./chunk-2YHS5E27.js";import{ResizableTable as i}from"./chunk-P6H2B635.js";import{Checkbox_default as a}from"./chunk-CGZBDI6C.js";import{LoadingSpinner as c}from"./chunk-4PJFL26P.js";import{PopupMenu as d,PopupMenuLabel as s,PopupMenuItem as h,PopupMenuDivider as m}from"./chunk-THAPVKEJ.js";import{keepsNativeMenu as u}from"./chunk-5QFPTDQF.js";import{LoadingSpinner as p}from"./chunk-R2VKEMZH.js";import{shellHttp as f}from"./chunk-STKJA4PV.js";import{toast_default as g}from"./chunk-I2NVBDKH.js";import{useShellStrings as y}from"./chunk-NRHG4R2Q.js";import{useState as k,useRef as b}from"react";import{jsx as x,Fragment as w,jsxs as C}from"react/jsx-runtime";function j(e){return Array.from(e.children).filter(e=>void 0!==e.dataset?.colKey&&"_select"!==e.dataset.colKey)}function v(e){return("string"==typeof e.innerText?e.innerText:e.textContent??"").replace(/\s+/g," ").trim()}function S(S){const{items:R,isLoading:N,emptyState:L,totalCount:$,isError:A,onRetry:K,errorTitle:P,errorMessage:T,tableId:E,columns:F,renderCell:H,getRowId:M=e=>e.id,sort:I,onSort:U,selected:D,setSelected:J,onRowClick:B,onRowHover:V,getRowClassName:O,footerLabel:W,footerExtra:_,footerExtraAfter:G,sentinelRef:Q,isFetchingNextPage:Y,saveDefaultPerms:Z,exportEndpoint:z,exportFilename:X="export.csv",contextActions:q}=S,[ee,te]=k(null),ne=b(null),re=y(),oe=re.entityList,le=e=>{J(t=>{const n=new Set(t),r=M(e);return n.has(r)?n.delete(r):n.add(r),n})},ie=()=>{J(e=>{const t=R.map(M),n=new Set(e);return t.every(t=>e.has(t))?t.forEach(e=>n.delete(e)):t.forEach(e=>n.add(e)),n})},ae=n(R,B,le,ie,(e,t)=>{J(n=>{const r=new Set(n);for(let n=e;n<=t;n++)r.add(M(R[n]));return r})},ne),ce=R.filter(e=>D.has(M(e))),de=()=>{const e=[...ne.current?.querySelectorAll("tr[data-row-idx]")??[]].filter(e=>{const t=R[Number(e.dataset.rowIdx)];return void 0!==t&&D.has(M(t))}),t=e.length?j(e[0]).map(e=>e.dataset.colKey??""):[],n=new Map(F.map(e=>[e.key,e.label]));return{keys:t,header:t.map(e=>n.get(e)??e),body:e.map(e=>j(e).map(v))}},se=()=>{te(null);const{header:t,body:n}=de();if(!n.length)return;const o=[t,...n].map(e=>e.join("\t")).join("\n"),l="<table><thead><tr>"+t.map(e=>`<th>${r(e)}</th>`).join("")+"</tr></thead><tbody>"+n.map(e=>`<tr>${e.map(e=>`<td>${r(e)}</td>`).join("")}</tr>`).join("")+"</tbody></table>";e(oe.copiedRows(n.length),o,l)},he=async()=>{te(null);const e=ce.map(M);if(!e.length||!z)return;const t=new URLSearchParams({ids:e.join(",")}),n=(()=>{const e=new Map(F.map(e=>[e.key,e.exportLabel??e.label]));try{const t=localStorage.getItem(`col-config-${E}`);if(t){const n=JSON.parse(t).filter(t=>!t.hidden&&"_select"!==t.key&&e.has(t.key)).map(t=>`${t.key}|${e.get(t.key)}`);if(n.length)return n.join(",")}}catch{}return F.filter(e=>!e.defaultHidden).map(e=>`${e.key}|${e.exportLabel??e.label}`).join(",")})();n&&t.set("cols",n);const r=z.includes("?")?"&":"?";try{const n=await f.get(`${z}${r}${t}`,{responseType:"blob"}),o=window.URL.createObjectURL(new Blob([n.data],{type:"text/csv"})),l=document.createElement("a");l.href=o,l.download=X,l.click(),window.URL.revokeObjectURL(o);const i=n.headers??{},a=Number(i["x-row-count"]);if("true"===String(i["x-truncated"]))return void g.notify(Number.isFinite(a)?oe.exportTruncated(a,e.length):oe.exportTruncatedUnknown(e.length));g.success(oe.exported(e.length))}catch{g.error(oe.exportFailed)}};if(N)/* @__PURE__ */return x(c,{});if(A&&0===R.length)/* @__PURE__ */
2
- return x(l,{title:P,message:T,onRetry:K});if(0===R.length)/* @__PURE__ */return x(w,{children:L});const me=R.length>0&&ce.length===R.length,ue=ce.length>0&&!me,pe=D.size-ce.length,fe=[{key:"_select",label:"",defaultWidth:52,minWidth:52,headerNode:/* @__PURE__ */x(a,{"aria-label":re.table.selectAll,checked:me,indeterminate:ue,onChange:ie,style:{height:14,width:14}})},...F],ge=/* @__PURE__ */x(o,{selectedCount:ce.length,hiddenSelectedCount:pe,loadedCount:R.length,totalCount:$,label:W,isFetchingMore:Y,extra:_,extraAfter:G}),ye=Q?/* @__PURE__ */C(w,{children:[
3
- /* @__PURE__ */x("div",{ref:Q}),Y&&/* @__PURE__ */x(p,{size:"sm",padding:"py-3",label:re.list.loadingMore})]}):void 0;let ke=null;if(ee){const{x:t,y:n,item:r,text:o,firstColumn:l}=ee,i=q?q(ce):[],a=ce.length,c=()=>te(null),u=void 0!==$&&$>R.length;ke=/* @__PURE__ */C(d,{portal:!0,style:{left:t,top:n},onClose:c,minWidth:210,children:[
1
+ import{copyToClipboard as e,selectionAt as t}from"./chunk-XYVFJLAU.js";import{useTableNav as n}from"./chunk-ATMJ5ZPK.js";import{escapeHtml as r}from"./chunk-G6DKCCWH.js";import{ListFooter as o}from"./chunk-U73K3ICC.js";import{ListLoadError as l}from"./chunk-2YHS5E27.js";import{ResizableTable as i}from"./chunk-7N6CVTWO.js";import{Checkbox_default as a}from"./chunk-CGZBDI6C.js";import{LoadingSpinner as c}from"./chunk-4PJFL26P.js";import{PopupMenu as d,PopupMenuLabel as s,PopupMenuItem as h,PopupMenuDivider as m}from"./chunk-THAPVKEJ.js";import{keepsNativeMenu as u}from"./chunk-5QFPTDQF.js";import{LoadingSpinner as p}from"./chunk-R2VKEMZH.js";import{shellHttp as f}from"./chunk-STKJA4PV.js";import{toast_default as g}from"./chunk-I2NVBDKH.js";import{useShellStrings as y}from"./chunk-NRHG4R2Q.js";import{useState as k,useRef as b}from"react";import{jsx as x,Fragment as w,jsxs as C}from"react/jsx-runtime";function j(e){return Array.from(e.children).filter(e=>void 0!==e.dataset?.colKey&&"_select"!==e.dataset.colKey)}function v(e){return("string"==typeof e.innerText?e.innerText:e.textContent??"").replace(/\s+/g," ").trim()}function S(S){const{items:R,isLoading:N,emptyState:L,totalCount:T,isError:$,onRetry:A,errorTitle:K,errorMessage:E,tableId:P,columns:F,renderCell:M,getRowId:H=e=>e.id,sort:I,onSort:U,selected:D,setSelected:J,onRowClick:V,onRowHover:O,getRowClassName:W,footerLabel:B,footerExtra:_,footerExtraAfter:G,sentinelRef:Q,isFetchingNextPage:Y,saveDefaultPerms:Z,exportEndpoint:z,exportFilename:X="export.csv",contextActions:q}=S,[ee,te]=k(null),ne=b(null),re=y(),oe=re.entityList,le=e=>{J(t=>{const n=new Set(t),r=H(e);return n.has(r)?n.delete(r):n.add(r),n})},ie=()=>{J(e=>{const t=R.map(H),n=new Set(e);return t.every(t=>e.has(t))?t.forEach(e=>n.delete(e)):t.forEach(e=>n.add(e)),n})},ae=n(R,V,le,ie,(e,t)=>{J(n=>{const r=new Set(n);for(let n=e;n<=t;n++)r.add(H(R[n]));return r})},ne),ce=R.filter(e=>D.has(H(e))),de=()=>{const e=[...ne.current?.querySelectorAll("tr[data-row-idx]")??[]].filter(e=>{const t=R[Number(e.dataset.rowIdx)];return void 0!==t&&D.has(H(t))}),t=e.length?j(e[0]).map(e=>e.dataset.colKey??""):[],n=new Map(F.map(e=>[e.key,e.label]));return{keys:t,header:t.map(e=>n.get(e)??e),body:e.map(e=>j(e).map(v))}},se=()=>{te(null);const{header:t,body:n}=de();if(!n.length)return;const o=[t,...n].map(e=>e.join("\t")).join("\n"),l="<table><thead><tr>"+t.map(e=>`<th>${r(e)}</th>`).join("")+"</tr></thead><tbody>"+n.map(e=>`<tr>${e.map(e=>`<td>${r(e)}</td>`).join("")}</tr>`).join("")+"</tbody></table>";e(oe.copiedRows(n.length),o,l)},he=async()=>{te(null);const e=ce.map(H);if(!e.length||!z)return;const t=new URLSearchParams({ids:e.join(",")}),n=(()=>{const e=new Map(F.map(e=>[e.key,e.exportLabel??e.label]));try{const t=localStorage.getItem(`col-config-${P}`);if(t){const n=JSON.parse(t).filter(t=>!t.hidden&&"_select"!==t.key&&e.has(t.key)).map(t=>`${t.key}|${e.get(t.key)}`);if(n.length)return n.join(",")}}catch{}return F.filter(e=>!e.defaultHidden).map(e=>`${e.key}|${e.exportLabel??e.label}`).join(",")})();n&&t.set("cols",n);const r=z.includes("?")?"&":"?";try{const n=await f.get(`${z}${r}${t}`,{responseType:"blob"}),o=window.URL.createObjectURL(new Blob([n.data],{type:"text/csv"})),l=document.createElement("a");l.href=o,l.download=X,l.click(),window.URL.revokeObjectURL(o);const i=n.headers??{},a=Number(i["x-row-count"]);if("true"===String(i["x-truncated"]))return void g.notify(Number.isFinite(a)?oe.exportTruncated(a,e.length):oe.exportTruncatedUnknown(e.length));g.success(oe.exported(e.length))}catch{g.error(oe.exportFailed)}};if(N)/* @__PURE__ */return x(c,{});if($&&0===R.length)/* @__PURE__ */
2
+ return x(l,{title:K,message:E,onRetry:A});if(0===R.length)/* @__PURE__ */return x(w,{children:L});const me=R.length>0&&ce.length===R.length,ue=ce.length>0&&!me,pe=D.size-ce.length,fe=[{key:"_select",label:"",defaultWidth:52,minWidth:52,headerNode:/* @__PURE__ */x(a,{"aria-label":re.table.selectAll,checked:me,indeterminate:ue,onChange:ie,style:{height:14,width:14}})},...F],ge=/* @__PURE__ */x(o,{selectedCount:ce.length,hiddenSelectedCount:pe,loadedCount:R.length,totalCount:T,label:B,isFetchingMore:Y,extra:_,extraAfter:G}),ye=Q?/* @__PURE__ */C(w,{children:[
3
+ /* @__PURE__ */x("div",{ref:Q}),Y&&/* @__PURE__ */x(p,{size:"sm",padding:"py-3",label:re.list.loadingMore})]}):void 0;let ke=null;if(ee){const{x:t,y:n,item:r,text:o,firstColumn:l}=ee,i=q?q(ce):[],a=ce.length,c=()=>te(null),u=void 0!==T&&T>R.length;ke=/* @__PURE__ */C(d,{portal:!0,style:{left:t,top:n},onClose:c,minWidth:210,children:[
4
4
  /* @__PURE__ */x(s,{children:pe>0?re.list.selectedNotShown(a,pe):re.list.selected(a)}),
5
- /* @__PURE__ */x(h,{className:"font-medium",onClick:()=>{c(),B(r)},children:oe.open}),
5
+ /* @__PURE__ */x(h,{className:"font-medium",onClick:()=>{c(),V(r)},children:oe.open}),
6
6
  /* @__PURE__ */x(m,{}),o&&/* @__PURE__ */x(h,{onClick:()=>{c(),e(oe.copiedText,o.text,o.html)},children:oe.copy}),l&&/* @__PURE__ */x(h,{onClick:()=>(t=>{te(null);const{keys:n,body:r}=de(),o=n.indexOf(t.key);o<0||!r.length||e(t.label,r.map(e=>e[o]).join("\n"))})(l),children:oe.copyColumn(l.label)}),
7
7
  /* @__PURE__ */x(h,{disabled:0===a,onClick:se,children:oe.copyRows(a)}),z&&/* @__PURE__ */x(h,{onClick:he,children:oe.exportSelected}),i.map((e,t)=>/* @__PURE__ */C("div",{children:[(e.divider||0===t)&&/* @__PURE__ */x(m,{}),
8
8
  /* @__PURE__ */x(h,{danger:e.danger,disabled:e.disabled,onClick:()=>{c(),e.onClick(ce)},children:e.label})]},t)),
9
- /* @__PURE__ */x(m,{}),!me&&/* @__PURE__ */x(h,{onClick:()=>{c(),J(e=>/* @__PURE__ */new Set([...e,...R.map(M)]))},children:u?oe.selectAllLoaded(R.length):oe.selectAll}),
10
- /* @__PURE__ */x(h,{onClick:()=>{c(),J(/* @__PURE__ */new Set)},children:oe.clearSelection}),K&&/* @__PURE__ */x(h,{onClick:()=>{c(),K()},children:oe.refresh})]})}/* @__PURE__ */
9
+ /* @__PURE__ */x(m,{}),!me&&/* @__PURE__ */x(h,{onClick:()=>{c(),J(e=>/* @__PURE__ */new Set([...e,...R.map(H)]))},children:u?oe.selectAllLoaded(R.length):oe.selectAll}),
10
+ /* @__PURE__ */x(h,{onClick:()=>{c(),J(/* @__PURE__ */new Set)},children:oe.clearSelection}),A&&/* @__PURE__ */x(h,{onClick:()=>{c(),A()},children:oe.refresh})]})}/* @__PURE__ */
11
11
  return C("div",{className:"flex-1 flex flex-col mb-1 bg-white rounded-lg shadow overflow-hidden",children:[
12
- /* @__PURE__ */x("div",{className:"flex-1 min-h-0 flex flex-col",children:/* @__PURE__ */x(i,{tableId:E,columns:fe,sort:I,onSort:U,footer:ge,afterBody:ye,saveDefaultPerms:Z,children:e=>/* @__PURE__ */x("tbody",{ref:ne,className:"divide-y divide-gray-100",children:R.map((n,r)=>{const o=M(n);/* @__PURE__ */
13
- return x("tr",{"data-row-idx":r,className:`cursor-pointer ${ae===r?"bg-blue-50 ring-1 ring-inset ring-blue-300":D.has(o)?"bg-blue-50 hover:bg-blue-100":"hover:bg-gray-50"} ${O?.(n)??""}`,onClick:()=>B(n),onContextMenu:e=>((e,n)=>{if(e.shiftKey||u(e.target))return;e.preventDefault();const r=M(n);D.has(r)||J(/* @__PURE__ */new Set([r]));const o=j(e.currentTarget)[0]?.dataset.colKey,l=o?F.find(e=>e.key===o)?.label:void 0;te({x:e.clientX,y:e.clientY,item:n,text:t(e.target),firstColumn:o&&l?{key:o,label:l}:null})})(e,n),onMouseEnter:V?()=>V(n):void 0,children:e.map(e=>/* @__PURE__ */x("td",{"data-col-key":e.key,className:"px-4 py-3 whitespace-nowrap text-sm overflow-hidden",children:"_select"===e.key?/* @__PURE__ */x(a,{"aria-label":re.table.selectRow,checked:D.has(o),onChange:()=>le(n),onClick:e=>e.stopPropagation(),style:{height:14,width:14}}):H(n,e.key)},e.key))},o)})})})}),ke]})}export{S as EntityList};
12
+ /* @__PURE__ */x("div",{className:"flex-1 min-h-0 flex flex-col",children:/* @__PURE__ */x(i,{tableId:P,columns:fe,sort:I,onSort:U,footer:ge,afterBody:ye,saveDefaultPerms:Z,children:e=>/* @__PURE__ */x("tbody",{ref:ne,className:"divide-y divide-gray-100",children:R.map((n,r)=>{const o=H(n);/* @__PURE__ */
13
+ return x("tr",{"data-row-idx":r,className:`cursor-pointer ${ae===r?"bg-blue-50 ring-1 ring-inset ring-blue-300":D.has(o)?"bg-blue-50 hover:bg-blue-100":"hover:bg-gray-50"} ${W?.(n)??""}`,onClick:()=>V(n),onContextMenu:e=>((e,n)=>{if(e.shiftKey||u(e.target))return;e.preventDefault();const r=H(n);D.has(r)||J(/* @__PURE__ */new Set([r]));const o=j(e.currentTarget)[0]?.dataset.colKey,l=o?F.find(e=>e.key===o)?.label:void 0;te({x:e.clientX,y:e.clientY,item:n,text:t(e.target),firstColumn:o&&l?{key:o,label:l}:null})})(e,n),onMouseEnter:O?()=>O(n):void 0,children:e.map(e=>/* @__PURE__ */x("td",{"data-col-key":e.key,className:"px-4 py-3 whitespace-nowrap text-sm overflow-hidden",children:"_select"===e.key?/* @__PURE__ */x(a,{"aria-label":re.table.selectRow,checked:D.has(o),onChange:()=>le(n),onClick:e=>e.stopPropagation(),style:{height:14,width:14}}):M(n,e.key)},e.key))},o)})})})}),ke]})}export{S as EntityList};
@@ -0,0 +1,16 @@
1
+ import{SidebarBarContext as e,SidebarSheetContext as r}from"./chunk-QWK6DRSN.js";import{readStoredWidth as l,ResizeHandle as a}from"./chunk-JLSXDYS4.js";import{WindowInsetContext as n}from"./chunk-YI4T5I5D.js";import{useIsPhone as t}from"./chunk-UGTRSRIW.js";import{Icon as i}from"./chunk-ISVODSRP.js";import{PANEL_SURFACE as o}from"./chunk-BWJZTHZ6.js";import{useBrowserState as s}from"./chunk-WCCS4VFE.js";import{useBrowserLayoutEffect as c}from"./chunk-ZDXRSY2Y.js";import{useShellStrings as d}from"./chunk-NRHG4R2Q.js";import{useContext as h,useRef as u,useState as m,useReducer as f,useMemo as p,Fragment as b,useEffect as x}from"react";import{jsxs as g,jsx as v,Fragment as w}from"react/jsx-runtime";var N=(e,r,l)=>Math.min(Math.max(e,r),l);function k({sidebar:e,sidebarTop:r,sidebarBottom:i,rail:o,railClassName:b="border-r border-line px-1 pb-2",children:x,side:k="left",storageKey:C,defaultWidth:S=256,minWidth:$=180,maxWidth:D=480,className:R="",sidebarClassName:W=("right"===k?"border-l border-gray-200 bg-gray-50":"border-r border-gray-200 bg-gray-50"),contentClassName:I="bg-white"}){const z="right"===k,O=d().sidebar,P=t(),E=function(){const[e,r]=m(!1),l=u(null),a=u(/* @__PURE__ */new Map),[,n]=f(e=>e+1,0),t=p(()=>({report(e,r,l){const t={label:r,el:l};return a.current.set(e,t),n(),()=>{a.current.get(e)===t&&(a.current.delete(e),n())}}}),[]);return{api:t,open:e,setOpen:r,current:()=>[...a.current.values()].sort((e,r)=>e.el&&r.el&&e.el.compareDocumentPosition(r.el)&Node.DOCUMENT_POSITION_PRECEDING?1:-1).map(e=>e.label()),trigger:l}}(),[T,K]=s(()=>(C?l(C,$,D):null)??N(S,$,D),N(S,$,D)),M=null!=r||null!=i,Y=h(n),G=u(null),[L,Z]=m(!1),B=Y?.claim;c(()=>{if(!B||z||P||!G.current)return;const e=B(G.current);return e?(Z(!0),()=>{Z(!1),e()}):void 0},[B,z,P]);const F=L&&!!Y?.over,H=M||F,J="shrink-0 "+(Y?.compact?"h-(--row-height-compact-bar)":"h-(--row-height-window-bar)"),Q=/* @__PURE__ */g("div",{className:"relative flex h-full shrink-0 flex-col",style:{width:T},children:[
2
+ /* @__PURE__ */g("div",{className:`flex h-full flex-col ${H?"overflow-hidden":"overflow-y-auto"} ${W}`,children:[F&&/* @__PURE__ */v("div",{"data-window-strip":"","aria-hidden":"true",className:J}),null!=r&&/* @__PURE__ */v("div",{className:"flex shrink-0 flex-col gap-2 px-2 pb-2 "+(F?"pt-1":"pt-3"),children:r}),H?/* @__PURE__ */v("div",{className:"min-h-0 flex-1 overflow-y-auto",children:e}):e,null!=i&&/* @__PURE__ */v("div",{className:"mt-auto flex shrink-0 flex-col gap-2 border-t border-gray-200 px-2 py-3",children:i})]}),
3
+ /* @__PURE__ */v(a,{side:k,width:T,onResize:K,min:$,max:D,defaultWidth:N(S,$,D),storageKey:C,hint:O.resize})]}),U=null==o||z?null:/* @__PURE__ */g("div",{"data-sidebar-rail":"",className:`flex h-full shrink-0 flex-col ${b}`,children:[/* @__PURE__ */v("div",F?{"data-window-strip":"","aria-hidden":"true",className:J}:{"aria-hidden":"true",className:"h-2 shrink-0"}),o]}),V=
4
+ /* @__PURE__ */v("div",{className:`flex min-w-0 flex-1 flex-col ${I}${L?" pr-1":""}`,children:x});if(!P)/* @__PURE__ */
5
+ return v("div",{ref:G,className:`flex h-full w-full overflow-hidden ${R}`,children:/* @__PURE__ */g(w,U?{children:[U,
6
+ /* @__PURE__ */g("div",{className:"flex h-full min-w-0 flex-1 overflow-hidden",children:[Q,V,null]})]}:{children:[z?null:Q,V,z?Q:null]})});const X=/* @__PURE__ */g("div",{className:"relative flex h-full min-w-0 flex-col overflow-hidden "+(U?"flex-1":`w-full ${R}`),children:[
7
+ /* @__PURE__ */v(y,{phone:E,top:r,fallback:O.sections}),V,
8
+ /* @__PURE__ */v(j,{phone:E,bottom:i,label:O.sections,closeLabel:O.closeSections,children:e})]});return U?/* @__PURE__ */v("div",{className:`flex h-full w-full overflow-hidden ${R}`,children:/* @__PURE__ */g(w,{children:[U,X]})}):X}function y({phone:r,top:l,fallback:a}){const n=r.current();/* @__PURE__ */
9
+ return g("div",{"data-sidebar-section-bar":!0,className:"flex h-11 shrink-0 items-center gap-2 border-b border-gray-200 bg-white px-3",children:[
10
+ /* @__PURE__ */g("button",{ref:r.trigger,type:"button","aria-haspopup":"dialog","aria-expanded":r.open,onClick:()=>r.setOpen(!0),className:"flex h-8 min-w-0 flex-1 items-center gap-1 text-left text-sm font-semibold text-gray-900",children:[
11
+ /* @__PURE__ */v("span",{className:"min-w-0 truncate",children:0===n.length?a:n.map((e,r)=>/* @__PURE__ */g(b,{children:[r>0&&" · ",e]},r))}),
12
+ /* @__PURE__ */v(i,{name:"chevron-down",className:"size-4 shrink-0",strokeWidth:2,"aria-hidden":"true"})]}),null!=l&&/* @__PURE__ */v(e.Provider,{value:!0,children:/* @__PURE__ */v("div",{className:"flex min-w-0 max-w-[60%] shrink-0 items-center gap-2",children:l})})]})}function j({phone:e,bottom:l,label:a,closeLabel:n,children:t}){const i=u(null),{open:s,setOpen:c,trigger:d}=e,h=()=>{c(!1),i.current?.contains(document.activeElement)&&d.current?.focus()};return x(()=>{s&&i.current?.focus()},[s]),
13
+ /* @__PURE__ */g(r.Provider,{value:e.api,children:[s&&/* @__PURE__ */v("button",{type:"button","aria-label":n,onClick:h,className:"absolute inset-0 z-(--z-in-box) cursor-default bg-gray-900/40"}),
14
+ /* @__PURE__ */g("div",{ref:i,role:"dialog","aria-modal":"true","aria-label":a,tabIndex:-1,"data-sidebar-section-sheet":!0,onKeyDown:e=>{"Escape"===e.key&&(e.stopPropagation(),h())},onClick:e=>{const r=e.target.closest("button, a");!r||r.hasAttribute("aria-expanded")||r.closest("[data-sheet-keep-open]")||h()},className:`${s?"flex":"hidden"} absolute inset-x-0 bottom-0 z-(--z-in-box) max-h-[75%] flex-col rounded-t-2xl pt-2 ${o}`,children:[
15
+ /* @__PURE__ */v("div",{className:"mx-auto mb-2 h-1 w-9 shrink-0 rounded-full bg-gray-300","aria-hidden":"true"}),
16
+ /* @__PURE__ */v("div",{className:"min-h-0 flex-1 overflow-y-auto px-2 pb-3",children:t}),null!=l&&/* @__PURE__ */v("div",{className:"flex shrink-0 flex-col gap-2 border-t border-gray-200 px-2 py-3",children:l})]})]})}export{k as SidebarLayout};
@@ -1 +1 @@
1
- import{setBoundaryErrorReporter as e}from"./chunk-KNUR2UEG.js";import{VERSION as t}from"./chunk-KH4AMHSI.js";var n=-1,i=()=>n,a=e=>{addEventListener("pageshow",t=>{t.persisted&&(n=t.timeStamp,e(t))},!0)},r=(e,t,n,i)=>{let a,r;return o=>{var s,c;t.value>=0&&(o||i)&&(r=t.value-(a??0),(r||void 0===a)&&(a=t.value,t.delta=r,t.rating=(s=t.value)>(c=n)[1]?"poor":s>c[0]?"needs-improvement":"good",e(t)))}},o=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},s=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},c=()=>s()?.activationStart??0,d=-1,l=/* @__PURE__ */new Set,u=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,f=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of l)e();isFinite(d)||(d="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",f,!0))}},h=(e=!1)=>{if(e&&(d=1/0),d<0){const e=c(),t=document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").find(t=>"hidden"===t.name&&t.startTime>=e)?.startTime;d=t??u(),addEventListener("visibilitychange",f,!0),addEventListener("prerenderingchange",f,!0),a(()=>{setTimeout(()=>{d=u()})})}return{get firstHiddenTime(){return d},onHidden(e){l.add(e)}}},g=(e,t=-1,n,a=0,r,o,d)=>{const l=s(),u=l?.navigationId||0;let f="navigate";return n?f=n:i()>=0?f="back-forward-cache":l&&(document.prerendering||c()>0?f="prerender":document.wasDiscarded?f="restore":l.type&&(f=l.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:f,navigationId:a||u,navigationInteractionId:r,navigationURL:o||l?.name,navigationStartTime:d||0}},v=/* @__PURE__ */new WeakMap;function p(e,t){let n=v.get(t);return n||(n=/* @__PURE__ */new WeakMap,v.set(t,n)),n.get(e)||n.set(e,new t),n.get(e)}var m,y=class{t;i=0;o=[];h(e){if(e.hadRecentInput)return;const t=this.o[0],n=this.o.at(-1);this.i&&t&&n&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}},T=(e,t,n={})=>{try{const i=e.filter(e=>PerformanceObserver.supportedEntryTypes.includes(e));if(i.length>0){const e=new PerformanceObserver(e=>{queueMicrotask(()=>{const n=e.getEntries();i.length>1&&n.sort((e,t)=>e.startTime+e.duration-(t.startTime+t.duration)),t(n)})});for(const t of i)e.observe({type:t,buffered:!0,...n});return e}}catch{}},w=e=>globalThis.PerformanceObserver?.supportedEntryTypes?.includes("soft-navigation")&&"function"==typeof globalThis.PerformanceSoftNavigation?.prototype?.getLargestInteractionContentfulPaint&&e&&e.reportSoftNavs,I=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){const t=e.keys().next().value;void 0!==t&&e.delete(t)}},b=e=>{let t=!1;return()=>{t||(e(),t=!0)}},C=class{l},E=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},L=[1800,3e3],P=(e,t={})=>{const n=w(t);E(()=>{const s=p(t,C),d=h();let l,u=g("FCP");const f=T(["paint"],e=>{for(const t of e)"first-contentful-paint"===t.name&&(f.disconnect(),t.startTime<d.firstHiddenTime&&(u.value=Math.max(t.startTime-c(),0),u.entries.push(t),u.navigationId=t.navigationId||u.navigationId,l(!0)))});f&&(l=r(e,u,L,t.reportAllChanges),a(n=>{u=g("FCP",-1,"back-forward-cache",u.navigationId,u.navigationInteractionId,u.navigationURL,i()),l=r(e,u,L,t.reportAllChanges),o(()=>{u.value=performance.now()-n.timeStamp,l(!0)})})),n&&T(["soft-navigation"],n=>{n.forEach(n=>{s.l&&n.navigationId&&I(s.l,n);const i=Math.max((n.presentationTime||n.paintTime||0)-n.startTime,0);u=g("FCP",i,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),l=r(e,u,L,t.reportAllChanges),l(!0)})},t)})},A=[.1,.25],k=0,S=1/0,z=0,M=e=>{for(const t of e)t.interactionId&&(S=Math.min(S,t.interactionId),z=Math.max(z,t.interactionId),k=z?(z-S)/7+1:0)},$=()=>m?k:performance.interactionCount??0,_=class{u=0;v=[];m=/* @__PURE__ */new Map;p;T;_(){return $()-this.u}M(){this.u=$(),this.v.length=0,this.m.clear()}L(e){const t=this._(),n=Math.min(this.v.length-1,Math.floor(t/50));return!t||-1!==n||"soft-navigation"!==e&&"back-forward-cache"!==e?this.v[n]:{P:8,id:-1,entries:[]}}h(e){if(this.p?.(e),!e.interactionId)return;const t=this.v.at(-1);let n=this.m.get(e.interactionId);if(n||this.v.length<10||e.duration>t.P){if(n?e.duration>n.P?(n.entries=[e],n.P=e.duration):e.duration===n.P&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],P:e.duration},this.m.set(n.id,n),this.v.push(n)),this.v.sort((e,t)=>t.P-e.P),this.v.length>10){const e=this.v.splice(10);for(const t of e)this.m.delete(t.id)}this.T?.(n)}}},Z=e=>{const t="requestIdleCallback"in globalThis?1e3:0,n=globalThis.requestIdleCallback||setTimeout,i=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{const a=b(e);let r=-1;const o=()=>{i(r),a()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),r=n(()=>{removeEventListener("visibilitychange",o,{capture:!0}),a()},{timeout:t})}},F=[200,500],R=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const n=h();E(()=>{"interactionCount"in performance||m||(m=T(["event"],M,{durationThreshold:0}));let o,s=g("INP");const c=p(t,_),d=(n,i,a,d,l)=>{c.M(),s=g("INP",-1,n,i,a,d,l),o=r(e,s,F,t.reportAllChanges)},l=()=>{const e=c.L(s.navigationType);e&&e.P!==s.value&&(s.value=e.P,s.entries=e.entries,o())},u=e=>{l(),o(!0),d("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},f=(e,t=!1)=>{Z(()=>{for(const t of e)"soft-navigation"!==t.entryType?c.h(t):u(t);l(),t&&o(!0)})},h=["event","first-input"];w(t)&&h.push("soft-navigation");const v=T(h,f,{...t,durationThreshold:t.durationThreshold??40});o=r(e,s,F,t.reportAllChanges),v&&(n.onHidden(()=>{f(v.takeRecords(),!0)}),a(()=>{d("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,i())}))})},j=class{p;l;h(e){this.p?.(e)}},x=[2500,4e3],B=[800,1800],H=e=>{document.prerendering?E(()=>H(e)):"complete"!==document.readyState?addEventListener("load",()=>H(e),!0):setTimeout(e)};var N=/^[A-Za-z0-9/_:.\-[\]{}*@~]+$/,U=/^[A-Za-z_$][A-Za-z0-9_$.]*$/,O=/^[A-Za-z0-9][A-Za-z0-9.+_-]*$/;var q=class{constructor(e){this.head=e}head;events=[];waiting=/* @__PURE__ */new Map;seen=/* @__PURE__ */new Set;get size(){return this.events.length}addVital(e){this.events.push(e)}addError(e){const t=function(e){return e.frames.length?`${e.name}|${e.frames.join("|")}`:`${e.name}|${e.message.replace(/\d/g,"0")}`}(e),n=this.waiting.get(t);return n?(n.count=Math.min(1e3,n.count+e.count),!0):!(this.seen.has(t)||this.seen.size>=20)&&(this.seen.add(t),this.waiting.set(t,e),this.events.push(e),!0)}drain(){const e=this.events;this.events=[],this.waiting.clear();const t=[],n=JSON.stringify({...this.head,events:[]}).length;let i=[],a=n;for(const r of e){const e=JSON.stringify(r).length+1;n+e>30720||((50===i.length||a+e>30720)&&(t.push({...this.head,events:i}),i=[],a=n),i.push(r),a+=e)}return i.length&&t.push({...this.head,events:i}),t}},K=/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g,J=/\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}(?:\.[A-Za-z0-9_-]*)?|\b[Bb]earer\s+[A-Za-z0-9._~+/=-]{8,}/g,V=/\b[a-z][a-z0-9+.-]*:\/\/\S+/gi,W=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi,D=/\d{4,}/g,G=/(^|[/:])(?:\d+|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|[0-9a-f]{16,})(?=$|[/:])/gi,Q=/^[a-z][a-z0-9+.-]*:\/\/[^/]*/i,X=/(?:\(|@|\bat\s+)?((?:[a-z][a-z0-9+.-]*:\/\/|\/)[^\s()@]*?):(\d+):(\d+)\)?\s*$/i;function Y(e,t,n){const i=e.replace(Q,"").split(/[?#]/,1)[0];return i?`${i}:${t}:${n}`.slice(0,256):null}function ee(e){if("string"!=typeof e)return[];const t=[];for(const n of e.split("\n")){const e=X.exec(n.trim()),i=e&&Y(e[1],e[2],e[3]);if(i&&t.push(i),5===t.length)break}return t}function te(e){const t=e instanceof Error?e.name:void 0;return"string"==typeof t&&t.length<=64&&U.test(t)?t:"Error"}function ne(e){if("string"!=typeof e)return"unknown";const t=e.trim().replace(Q,"").split(/[?#]/,1)[0].replace(G,(e,t)=>":"===t?":id":`${t}:id`);return t&&t.length<=128&&!t.includes("//")&&N.test(t)?t:"unknown"}var ie={flush(){},reportError(){},stop(){}},ae=null,re=/* @__PURE__ */new Set(["LCP","FCP","TTFB"]);function oe(e,t,n){const i=function(e){if(e.anonymous)return{credentials:"omit",headers:{"Content-Type":"application/json"}};const t=e.getAccessToken();return t?{credentials:"same-origin",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}}:null}(t);if(!i)return;const a=t.anonymous?"/api/storefront-analytics/web-vitals/":"/api/client-telemetry/web-batches/";n(t.endpoint??a,{...i,method:"POST",keepalive:!0,body:JSON.stringify(e)}).catch(e=>{console.debug("[efficient-shell] client telemetry batch dropped:",e)})}function se(e){((e,t={})=>{let n=!1;const s=w(t);E(()=>{let d,l=h(),u=g("LCP");const f=p(t,j),v=(i,a,o,s,c)=>{u=g("LCP",-1,i,a,o,s,c),d=r(e,u,x,t.reportAllChanges),n=!1,"soft-navigation"===i&&(l=h(!0))},m=e=>{f.l&&e.navigationId&&I(f.l,e),n||d(!0),v("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime);const t=e.getLargestInteractionContentfulPaint?.();t&&y([t])},y=e=>{t.reportAllChanges||s||(e=e.slice(-1));for(const t of e){if(!t)continue;if("soft-navigation"===t.entryType){m(t);continue}let e=0,n=[],i=t.startTime;if("largest-contentful-paint"===t.entryType)e=Math.max(t.startTime-c(),0),f.h(t),n=[t];else if("interaction-contentful-paint"===t.entryType){const a=t;if(!u.navigationId)continue;if("interactionId"in a&&a.interactionId!=u.navigationInteractionId)continue;i=a.largestContentfulPaint?.renderTime||0,e=Math.max(i-t.startTime,0),a.largestContentfulPaint&&(f.h(a.largestContentfulPaint),n=[a.largestContentfulPaint])}i<l.firstHiddenTime&&(u.value=e,u.entries=n,d())}},w=["largest-contentful-paint"];s&&w.push("interaction-contentful-paint","soft-navigation");const b=T(w,y);if(b){d=r(e,u,x,t.reportAllChanges);const c=["keydown","click","visibilitychange"],l=e=>{if(e.isTrusted&&!n){const e=u.id;Z(()=>{if(!n){if(!s){b.disconnect();for(const e of c)removeEventListener(e,l,{capture:!0})}e===u.id&&(n=!0,d(!0))}})}};for(const e of c)addEventListener(e,l,{capture:!0});a(a=>{v("back-forward-cache",u.navigationId,u.navigationInteractionId,u.navigationURL,i()),d=r(e,u,x,t.reportAllChanges),o(()=>{u.value=performance.now()-a.timeStamp,n=!0,d(!0)})})}})})(e),R(e),((e,t={})=>{const n=h();P(b(()=>{let s,c=g("CLS",0);const d=p(t,y),l=(n,i,a,o,l)=>{c=g("CLS",0,n,i,a,o,l),d.i=0,s=r(e,c,A,t.reportAllChanges)},u=(e=!1)=>{d.i>c.value&&(c.value=d.i,c.entries=d.o),s(e)},f=e=>{u(!0),l("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},h=e=>{for(const t of e)"soft-navigation"!==t.entryType?d.h(t):f(t);u()},v=["layout-shift"];w(t)&&v.push("soft-navigation");const m=T(v,h);m&&(s=r(e,c,A,t.reportAllChanges),n.onHidden(()=>{h(m.takeRecords()),s(!0)}),a(()=>{l("back-forward-cache",c.navigationId,c.navigationInteractionId,c.navigationURL,i()),o(s)}),setTimeout(s))}))})(e),P(e),((e,t={})=>{const n=w(t);let o=g("TTFB"),d=r(e,o,B,t.reportAllChanges);H(()=>{const l=s();if(l){const s=l.responseStart;o.value=Math.max(s-c(),0),o.entries=[l],d(!0),a(()=>{o=g("TTFB",0,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,i()),d=r(e,o,B,t.reportAllChanges),d(!0)}),n&&T(["soft-navigation"],n=>{n.forEach(n=>{n.navigationId&&(o=g("TTFB",0,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),o.entries=[n],d=r(e,o,B,t.reportAllChanges),d(!0))})},t)}})})(e)}function ce(n){if(ae?.stop(),ae=null,!1===n.enabled||"undefined"==typeof window||"undefined"==typeof document)return ie;if(!function(e){const t="string"==typeof e.app&&O.test(e.app),n="string"==typeof e.release&&O.test(e.release);return t&&n||console.warn("[efficient-shell] client telemetry not started: `app` and `release` must be version-like strings."),t&&n}(n))return ie;const i=function(e){const t=e.vitalsSampleRate??1;return t>0&&(t>=1||(e.random??Math.random)()<t)}(n);if(n.anonymous&&!i)return ie;const a=n.fetch??window.fetch.bind(window),r=new q({app:n.app,release:n.release,shell_version:O.test(t)?t:""}),o=ne(n.routeKey()),s=function(e=("undefined"==typeof window?void 0:window)){if(!e)return"desktop";const t="function"==typeof e.matchMedia&&e.matchMedia("(pointer: coarse)").matches,n=e.innerWidth;return n<600?"mobile":t&&n<1280?"tablet":"desktop"}(window);let c=!1;const d=()=>{for(const e of r.drain())oe(e,n,a)},l=e=>{c||n.anonymous||(r.addError(e),r.size>=50&&d())},u=(e,t)=>{return{type:"error",source:t,name:te(e),message:(a=e,i=a instanceof Error?a.message:"string"==typeof a?a:a&&"object"==typeof a&&"string"==typeof a.message?a.message:"",i.slice(0,640).replace(K,"[redacted]").replace(J,"[redacted]").replace(V,"[url]").replace(W,"[id]").replace(D,"[n]").replace(/\s+/g," ").trim().slice(0,160)),frames:ee(e instanceof Error?e.stack:void 0),route:ne(n.routeKey()),count:1};var i,a};i&&(n.observeVitals??se)(e=>{c||(r.addVital(function(e,t,n,i){return{type:"vital",name:e.name,value:e.value,route:re.has(e.name)?t:n(),navigation:e.navigationType??"navigate",device:i}}(e,o,()=>ne(n.routeKey()),s)),r.size>=50&&d())});const f=n.anonymous?()=>{}:function(t,n){const i=e=>{const{error:i,message:a,filename:r,lineno:o,colno:s}=e;if(null!=i)return void t(n(i,"onerror"));const c=r?ee(`at ${r}:${o??0}:${s??0}`):[];t({...n(a??"","onerror"),frames:c})},a=e=>t(n(e.reason,"unhandledrejection"));window.addEventListener("error",i),window.addEventListener("unhandledrejection",a);const r=e(e=>t(n(e,"boundary")));return()=>{window.removeEventListener("error",i),window.removeEventListener("unhandledrejection",a),r()}}(l,u),h=()=>{"hidden"===document.visibilityState&&d()};document.addEventListener("visibilitychange",h),window.addEventListener("pagehide",d);const g=window.setInterval(d,n.flushIntervalMs??6e4),v={flush:d,reportError:e=>l(u(e,"boundary")),stop(){c||(d(),c=!0,f(),document.removeEventListener("visibilitychange",h),window.removeEventListener("pagehide",d),window.clearInterval(g),ae===v&&(ae=null))}};return ae=v,v}export{ce as startClientTelemetry};
1
+ import{setBoundaryErrorReporter as e}from"./chunk-KNUR2UEG.js";import{VERSION as t}from"./chunk-I52YJ3QD.js";var n=-1,i=()=>n,a=e=>{addEventListener("pageshow",t=>{t.persisted&&(n=t.timeStamp,e(t))},!0)},r=(e,t,n,i)=>{let a,r;return o=>{var s,c;t.value>=0&&(o||i)&&(r=t.value-(a??0),(r||void 0===a)&&(a=t.value,t.delta=r,t.rating=(s=t.value)>(c=n)[1]?"poor":s>c[0]?"needs-improvement":"good",e(t)))}},o=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},s=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},c=()=>s()?.activationStart??0,d=-1,l=/* @__PURE__ */new Set,u=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,f=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of l)e();isFinite(d)||(d="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",f,!0))}},h=(e=!1)=>{if(e&&(d=1/0),d<0){const e=c(),t=document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").find(t=>"hidden"===t.name&&t.startTime>=e)?.startTime;d=t??u(),addEventListener("visibilitychange",f,!0),addEventListener("prerenderingchange",f,!0),a(()=>{setTimeout(()=>{d=u()})})}return{get firstHiddenTime(){return d},onHidden(e){l.add(e)}}},g=(e,t=-1,n,a=0,r,o,d)=>{const l=s(),u=l?.navigationId||0;let f="navigate";return n?f=n:i()>=0?f="back-forward-cache":l&&(document.prerendering||c()>0?f="prerender":document.wasDiscarded?f="restore":l.type&&(f=l.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:f,navigationId:a||u,navigationInteractionId:r,navigationURL:o||l?.name,navigationStartTime:d||0}},v=/* @__PURE__ */new WeakMap;function p(e,t){let n=v.get(t);return n||(n=/* @__PURE__ */new WeakMap,v.set(t,n)),n.get(e)||n.set(e,new t),n.get(e)}var m,y=class{t;i=0;o=[];h(e){if(e.hadRecentInput)return;const t=this.o[0],n=this.o.at(-1);this.i&&t&&n&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}},T=(e,t,n={})=>{try{const i=e.filter(e=>PerformanceObserver.supportedEntryTypes.includes(e));if(i.length>0){const e=new PerformanceObserver(e=>{queueMicrotask(()=>{const n=e.getEntries();i.length>1&&n.sort((e,t)=>e.startTime+e.duration-(t.startTime+t.duration)),t(n)})});for(const t of i)e.observe({type:t,buffered:!0,...n});return e}}catch{}},w=e=>globalThis.PerformanceObserver?.supportedEntryTypes?.includes("soft-navigation")&&"function"==typeof globalThis.PerformanceSoftNavigation?.prototype?.getLargestInteractionContentfulPaint&&e&&e.reportSoftNavs,I=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){const t=e.keys().next().value;void 0!==t&&e.delete(t)}},b=e=>{let t=!1;return()=>{t||(e(),t=!0)}},C=class{l},E=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},L=[1800,3e3],P=(e,t={})=>{const n=w(t);E(()=>{const s=p(t,C),d=h();let l,u=g("FCP");const f=T(["paint"],e=>{for(const t of e)"first-contentful-paint"===t.name&&(f.disconnect(),t.startTime<d.firstHiddenTime&&(u.value=Math.max(t.startTime-c(),0),u.entries.push(t),u.navigationId=t.navigationId||u.navigationId,l(!0)))});f&&(l=r(e,u,L,t.reportAllChanges),a(n=>{u=g("FCP",-1,"back-forward-cache",u.navigationId,u.navigationInteractionId,u.navigationURL,i()),l=r(e,u,L,t.reportAllChanges),o(()=>{u.value=performance.now()-n.timeStamp,l(!0)})})),n&&T(["soft-navigation"],n=>{n.forEach(n=>{s.l&&n.navigationId&&I(s.l,n);const i=Math.max((n.presentationTime||n.paintTime||0)-n.startTime,0);u=g("FCP",i,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),l=r(e,u,L,t.reportAllChanges),l(!0)})},t)})},A=[.1,.25],k=0,S=1/0,z=0,M=e=>{for(const t of e)t.interactionId&&(S=Math.min(S,t.interactionId),z=Math.max(z,t.interactionId),k=z?(z-S)/7+1:0)},$=()=>m?k:performance.interactionCount??0,_=class{u=0;v=[];m=/* @__PURE__ */new Map;p;T;_(){return $()-this.u}M(){this.u=$(),this.v.length=0,this.m.clear()}L(e){const t=this._(),n=Math.min(this.v.length-1,Math.floor(t/50));return!t||-1!==n||"soft-navigation"!==e&&"back-forward-cache"!==e?this.v[n]:{P:8,id:-1,entries:[]}}h(e){if(this.p?.(e),!e.interactionId)return;const t=this.v.at(-1);let n=this.m.get(e.interactionId);if(n||this.v.length<10||e.duration>t.P){if(n?e.duration>n.P?(n.entries=[e],n.P=e.duration):e.duration===n.P&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],P:e.duration},this.m.set(n.id,n),this.v.push(n)),this.v.sort((e,t)=>t.P-e.P),this.v.length>10){const e=this.v.splice(10);for(const t of e)this.m.delete(t.id)}this.T?.(n)}}},Z=e=>{const t="requestIdleCallback"in globalThis?1e3:0,n=globalThis.requestIdleCallback||setTimeout,i=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{const a=b(e);let r=-1;const o=()=>{i(r),a()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),r=n(()=>{removeEventListener("visibilitychange",o,{capture:!0}),a()},{timeout:t})}},F=[200,500],R=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const n=h();E(()=>{"interactionCount"in performance||m||(m=T(["event"],M,{durationThreshold:0}));let o,s=g("INP");const c=p(t,_),d=(n,i,a,d,l)=>{c.M(),s=g("INP",-1,n,i,a,d,l),o=r(e,s,F,t.reportAllChanges)},l=()=>{const e=c.L(s.navigationType);e&&e.P!==s.value&&(s.value=e.P,s.entries=e.entries,o())},u=e=>{l(),o(!0),d("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},f=(e,t=!1)=>{Z(()=>{for(const t of e)"soft-navigation"!==t.entryType?c.h(t):u(t);l(),t&&o(!0)})},h=["event","first-input"];w(t)&&h.push("soft-navigation");const v=T(h,f,{...t,durationThreshold:t.durationThreshold??40});o=r(e,s,F,t.reportAllChanges),v&&(n.onHidden(()=>{f(v.takeRecords(),!0)}),a(()=>{d("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,i())}))})},j=class{p;l;h(e){this.p?.(e)}},x=[2500,4e3],B=[800,1800],N=e=>{document.prerendering?E(()=>N(e)):"complete"!==document.readyState?addEventListener("load",()=>N(e),!0):setTimeout(e)};var U=/^[A-Za-z0-9/_:.\-[\]{}*@~]+$/,O=/^[A-Za-z_$][A-Za-z0-9_$.]*$/,H=/^[A-Za-z0-9][A-Za-z0-9.+_-]*$/;var q=class{constructor(e){this.head=e}head;events=[];waiting=/* @__PURE__ */new Map;seen=/* @__PURE__ */new Set;get size(){return this.events.length}addVital(e){this.events.push(e)}addError(e){const t=function(e){return e.frames.length?`${e.name}|${e.frames.join("|")}`:`${e.name}|${e.message.replace(/\d/g,"0")}`}(e),n=this.waiting.get(t);return n?(n.count=Math.min(1e3,n.count+e.count),!0):!(this.seen.has(t)||this.seen.size>=20)&&(this.seen.add(t),this.waiting.set(t,e),this.events.push(e),!0)}drain(){const e=this.events;this.events=[],this.waiting.clear();const t=[],n=JSON.stringify({...this.head,events:[]}).length;let i=[],a=n;for(const r of e){const e=JSON.stringify(r).length+1;n+e>30720||((50===i.length||a+e>30720)&&(t.push({...this.head,events:i}),i=[],a=n),i.push(r),a+=e)}return i.length&&t.push({...this.head,events:i}),t}},J=/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g,K=/\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}(?:\.[A-Za-z0-9_-]*)?|\b[Bb]earer\s+[A-Za-z0-9._~+/=-]{8,}/g,D=/\b[a-z][a-z0-9+.-]*:\/\/\S+/gi,V=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi,W=/\d{4,}/g,G=/(^|[/:])(?:\d+|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|[0-9a-f]{16,})(?=$|[/:])/gi,Q=/^[a-z][a-z0-9+.-]*:\/\/[^/]*/i,Y=/(?:\(|@|\bat\s+)?((?:[a-z][a-z0-9+.-]*:\/\/|\/)[^\s()@]*?):(\d+):(\d+)\)?\s*$/i;function X(e,t,n){const i=e.replace(Q,"").split(/[?#]/,1)[0];return i?`${i}:${t}:${n}`.slice(0,256):null}function ee(e){if("string"!=typeof e)return[];const t=[];for(const n of e.split("\n")){const e=Y.exec(n.trim()),i=e&&X(e[1],e[2],e[3]);if(i&&t.push(i),5===t.length)break}return t}function te(e){const t=e instanceof Error?e.name:void 0;return"string"==typeof t&&t.length<=64&&O.test(t)?t:"Error"}function ne(e){if("string"!=typeof e)return"unknown";const t=e.trim().replace(Q,"").split(/[?#]/,1)[0].replace(G,(e,t)=>":"===t?":id":`${t}:id`);return t&&t.length<=128&&!t.includes("//")&&U.test(t)?t:"unknown"}var ie={flush(){},reportError(){},stop(){}},ae=null,re=/* @__PURE__ */new Set(["LCP","FCP","TTFB"]);function oe(e,t,n){const i=function(e){if(e.anonymous)return{credentials:"omit",headers:{"Content-Type":"application/json"}};const t=e.getAccessToken();return t?{credentials:"same-origin",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}}:null}(t);if(!i)return;const a=t.anonymous?"/api/storefront-analytics/web-vitals/":"/api/client-telemetry/web-batches/";n(t.endpoint??a,{...i,method:"POST",keepalive:!0,body:JSON.stringify(e)}).catch(e=>{console.debug("[efficient-shell] client telemetry batch dropped:",e)})}function se(e){((e,t={})=>{let n=!1;const s=w(t);E(()=>{let d,l=h(),u=g("LCP");const f=p(t,j),v=(i,a,o,s,c)=>{u=g("LCP",-1,i,a,o,s,c),d=r(e,u,x,t.reportAllChanges),n=!1,"soft-navigation"===i&&(l=h(!0))},m=e=>{f.l&&e.navigationId&&I(f.l,e),n||d(!0),v("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime);const t=e.getLargestInteractionContentfulPaint?.();t&&y([t])},y=e=>{t.reportAllChanges||s||(e=e.slice(-1));for(const t of e){if(!t)continue;if("soft-navigation"===t.entryType){m(t);continue}let e=0,n=[],i=t.startTime;if("largest-contentful-paint"===t.entryType)e=Math.max(t.startTime-c(),0),f.h(t),n=[t];else if("interaction-contentful-paint"===t.entryType){const a=t;if(!u.navigationId)continue;if("interactionId"in a&&a.interactionId!=u.navigationInteractionId)continue;i=a.largestContentfulPaint?.renderTime||0,e=Math.max(i-t.startTime,0),a.largestContentfulPaint&&(f.h(a.largestContentfulPaint),n=[a.largestContentfulPaint])}i<l.firstHiddenTime&&(u.value=e,u.entries=n,d())}},w=["largest-contentful-paint"];s&&w.push("interaction-contentful-paint","soft-navigation");const b=T(w,y);if(b){d=r(e,u,x,t.reportAllChanges);const c=["keydown","click","visibilitychange"],l=e=>{if(e.isTrusted&&!n){const e=u.id;Z(()=>{if(!n){if(!s){b.disconnect();for(const e of c)removeEventListener(e,l,{capture:!0})}e===u.id&&(n=!0,d(!0))}})}};for(const e of c)addEventListener(e,l,{capture:!0});a(a=>{v("back-forward-cache",u.navigationId,u.navigationInteractionId,u.navigationURL,i()),d=r(e,u,x,t.reportAllChanges),o(()=>{u.value=performance.now()-a.timeStamp,n=!0,d(!0)})})}})})(e),R(e),((e,t={})=>{const n=h();P(b(()=>{let s,c=g("CLS",0);const d=p(t,y),l=(n,i,a,o,l)=>{c=g("CLS",0,n,i,a,o,l),d.i=0,s=r(e,c,A,t.reportAllChanges)},u=(e=!1)=>{d.i>c.value&&(c.value=d.i,c.entries=d.o),s(e)},f=e=>{u(!0),l("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},h=e=>{for(const t of e)"soft-navigation"!==t.entryType?d.h(t):f(t);u()},v=["layout-shift"];w(t)&&v.push("soft-navigation");const m=T(v,h);m&&(s=r(e,c,A,t.reportAllChanges),n.onHidden(()=>{h(m.takeRecords()),s(!0)}),a(()=>{l("back-forward-cache",c.navigationId,c.navigationInteractionId,c.navigationURL,i()),o(s)}),setTimeout(s))}))})(e),P(e),((e,t={})=>{const n=w(t);let o=g("TTFB"),d=r(e,o,B,t.reportAllChanges);N(()=>{const l=s();if(l){const s=l.responseStart;o.value=Math.max(s-c(),0),o.entries=[l],d(!0),a(()=>{o=g("TTFB",0,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,i()),d=r(e,o,B,t.reportAllChanges),d(!0)}),n&&T(["soft-navigation"],n=>{n.forEach(n=>{n.navigationId&&(o=g("TTFB",0,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),o.entries=[n],d=r(e,o,B,t.reportAllChanges),d(!0))})},t)}})})(e)}function ce(n){if(ae?.stop(),ae=null,!1===n.enabled||"undefined"==typeof window||"undefined"==typeof document)return ie;if(!function(e){const t="string"==typeof e.app&&H.test(e.app),n="string"==typeof e.release&&H.test(e.release);return t&&n||console.warn("[efficient-shell] client telemetry not started: `app` and `release` must be version-like strings."),t&&n}(n))return ie;const i=function(e){const t=e.vitalsSampleRate??1;return t>0&&(t>=1||(e.random??Math.random)()<t)}(n);if(n.anonymous&&!i)return ie;const a=n.fetch??window.fetch.bind(window),r=new q({app:n.app,release:n.release,shell_version:H.test(t)?t:""}),o=ne(n.routeKey()),s=function(e=("undefined"==typeof window?void 0:window)){if(!e)return"desktop";const t="function"==typeof e.matchMedia&&e.matchMedia("(pointer: coarse)").matches,n=e.innerWidth;return n<600?"mobile":t&&n<1280?"tablet":"desktop"}(window);let c=!1;const d=()=>{for(const e of r.drain())oe(e,n,a)},l=e=>{c||n.anonymous||(r.addError(e),r.size>=50&&d())},u=(e,t)=>{return{type:"error",source:t,name:te(e),message:(a=e,i=a instanceof Error?a.message:"string"==typeof a?a:a&&"object"==typeof a&&"string"==typeof a.message?a.message:"",i.slice(0,640).replace(J,"[redacted]").replace(K,"[redacted]").replace(D,"[url]").replace(V,"[id]").replace(W,"[n]").replace(/\s+/g," ").trim().slice(0,160)),frames:ee(e instanceof Error?e.stack:void 0),route:ne(n.routeKey()),count:1};var i,a};i&&(n.observeVitals??se)(e=>{c||(r.addVital(function(e,t,n,i){return{type:"vital",name:e.name,value:e.value,route:re.has(e.name)?t:n(),navigation:e.navigationType??"navigate",device:i}}(e,o,()=>ne(n.routeKey()),s)),r.size>=50&&d())});const f=n.anonymous?()=>{}:function(t,n){const i=e=>{const{error:i,message:a,filename:r,lineno:o,colno:s}=e;if(null!=i)return void t(n(i,"onerror"));const c=r?ee(`at ${r}:${o??0}:${s??0}`):[];t({...n(a??"","onerror"),frames:c})},a=e=>t(n(e.reason,"unhandledrejection"));window.addEventListener("error",i),window.addEventListener("unhandledrejection",a);const r=e(e=>t(n(e,"boundary")));return()=>{window.removeEventListener("error",i),window.removeEventListener("unhandledrejection",a),r()}}(l,u),h=()=>{"hidden"===document.visibilityState&&d()};document.addEventListener("visibilitychange",h),window.addEventListener("pagehide",d);const g=window.setInterval(d,n.flushIntervalMs??6e4),v={flush:d,reportError:e=>l(u(e,"boundary")),stop(){c||(d(),c=!0,f(),document.removeEventListener("visibilitychange",h),window.removeEventListener("pagehide",d),window.clearInterval(g),ae===v&&(ae=null))}};return ae=v,v}export{ce as startClientTelemetry};