@pg-boss/dashboard 1.1.0 → 1.1.2

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 (39) hide show
  1. package/README.md +25 -173
  2. package/build/client/assets/MenuTrigger-CoRd-BqL.js +1 -0
  3. package/build/client/assets/{_index-Bcg_-XSd.js → _index-BTx7NRR8.js} +1 -1
  4. package/build/client/assets/{badge-Cd8v3tl3.js → badge-DBD4CzAv.js} +1 -1
  5. package/build/client/assets/{button-BaXUPm8v.js → button-Ba8FWhqs.js} +1 -1
  6. package/build/client/assets/{chevron-down-xu6Uceu-.js → chevron-down-CYa4FYmp.js} +1 -1
  7. package/build/client/assets/chunk-UVKPFVEO-YfSfkVr_.js +26 -0
  8. package/build/client/assets/{createLucideIcon-BXGwbdrh.js → createLucideIcon-Bt-yXILq.js} +1 -1
  9. package/build/client/assets/db-link-CU7IJqbq.js +1 -0
  10. package/build/client/assets/dialog-Dkx42Rkd.js +1 -0
  11. package/build/client/assets/{entry.client-COnaNoy-.js → entry.client-DXZUROTm.js} +4 -4
  12. package/build/client/assets/{error-card-DmoxS3Ao.js → error-card-D-uZRy_l.js} +1 -1
  13. package/build/client/assets/{filter-select-mMC79WOR.js → filter-select-Tk_CBvrn.js} +1 -1
  14. package/build/client/assets/{index-DhMkYPMa.js → index-DuhoQwUK.js} +1 -1
  15. package/build/client/assets/{jobs-DtmTCs8I.js → jobs-ouYjIGAi.js} +1 -1
  16. package/build/client/assets/manifest-72f6b3e9.js +1 -0
  17. package/build/client/assets/{pagination-NfhvsUbp.js → pagination-BItl293Q.js} +1 -1
  18. package/build/client/assets/{queues._index-Cw1B49mg.js → queues._index-_ID9kaow.js} +1 -1
  19. package/build/client/assets/{queues._name-D0cG_qDX.js → queues._name-DwdbQND-.js} +1 -1
  20. package/build/client/assets/{queues._name.jobs._jobId-uJ3dfM3J.js → queues._name.jobs._jobId-DrgG3VBb.js} +1 -1
  21. package/build/client/assets/{queues.create-BGXDhJ3m.js → queues.create-CmVW5UVm.js} +1 -1
  22. package/build/client/assets/root-Bpb4WtY4.css +1 -0
  23. package/build/client/assets/{root-NWrBrGvr.js → root-DDqOT0vL.js} +1 -1
  24. package/build/client/assets/{schedules-DzgBEayh.js → schedules-B6ixYsvz.js} +1 -1
  25. package/build/client/assets/{schedules._name._key-i42S9kw2.js → schedules._name._key-CXTVKoOc.js} +1 -1
  26. package/build/client/assets/{schedules.new-Dt78KptL.js → schedules.new-Dmasri9v.js} +1 -1
  27. package/build/client/assets/{send-0eWgiWNl.js → send-CqR34Z50.js} +1 -1
  28. package/build/client/assets/{table-CTo0I5HG.js → table-Au2E5mnP.js} +1 -1
  29. package/build/client/assets/useOpenInteractionType-mgYMZAa8.js +12 -0
  30. package/build/client/assets/{warnings-BhQM6lFV.js → warnings-Dj3qacgN.js} +1 -1
  31. package/build/server/assets/server-build.js +417 -79
  32. package/package.json +18 -18
  33. package/build/client/assets/MenuTrigger-SThQHnlb.js +0 -1
  34. package/build/client/assets/chunk-JZWAC4HX-DC8i-F7r.js +0 -26
  35. package/build/client/assets/db-link-CtPnIrIr.js +0 -1
  36. package/build/client/assets/dialog-Bl8T588f.js +0 -1
  37. package/build/client/assets/manifest-25954681.js +0 -1
  38. package/build/client/assets/root-DJRlbyb5.css +0 -1
  39. package/build/client/assets/useOpenInteractionType-C_L8nZ_l.js +0 -12
package/README.md CHANGED
@@ -4,14 +4,13 @@ A web-based dashboard for monitoring and managing [pg-boss](https://github.com/t
4
4
 
5
5
  ## Features
6
6
 
7
- - **Overview Dashboard**: Aggregate statistics, problem queues, and recent warnings at a glance
8
- - **Queue Management**: Browse all queues with real-time stats (queued, active, deferred, total)
9
- - **Job Browser**: View and manage individual jobs with smart filtering (defaults to pending jobs)
10
- - **Job Detail Inspector**: View full job payloads, output data, and metadata
7
+ - **Overview**: Aggregate statistics, problem queues, and recent warnings at a glance
8
+ - **Queue Management**: View all queues with cached statistics and create new queues
9
+ - **Job List**: View jobs with state and queue filtering
10
+ - **Job Details**: View full job payloads, output data, and metadata
11
11
  - **Job Actions**: Create, cancel, retry, resume, or delete jobs directly from the UI
12
- - **Warning History**: Track slow queries, queue backlogs, and clock skew issues
13
- - **Multi-Database Support**: Monitor multiple pg-boss instances from a single dashboard
14
- - **Pagination**: Efficiently browse large datasets with cached statistics
12
+ - **Warning History**: When `persistWarnings` is enabled, browse through previously emitted warning events.
13
+ - **Multi-Schema Support**: Monitor multiple pg-boss instances from a single dashboard
15
14
  - **Mobile Responsive**: Full functionality on mobile devices with collapsible sidebar
16
15
  - **Shareable URLs**: Database selection and filters are preserved in URLs for easy sharing
17
16
 
@@ -46,6 +45,21 @@ The dashboard is configured via environment variables:
46
45
  | `DATABASE_URL` | PostgreSQL connection string(s) | `postgres://localhost/pgboss` |
47
46
  | `PGBOSS_SCHEMA` | pg-boss schema name(s) | `pgboss` |
48
47
  | `PORT` | Server port | `3000` |
48
+ | `PGBOSS_DASHBOARD_AUTH_USERNAME` | Basic auth username (optional) | - |
49
+ | `PGBOSS_DASHBOARD_AUTH_PASSWORD` | Basic auth password (optional) | - |
50
+
51
+ ### Basic Authentication
52
+
53
+ To protect the dashboard with basic authentication, set `PGBOSS_DASHBOARD_AUTH_USERNAME` and `PGBOSS_DASHBOARD_AUTH_PASSWORD`:
54
+
55
+ ```bash
56
+ PGBOSS_DASHBOARD_AUTH_USERNAME=admin \
57
+ PGBOSS_DASHBOARD_AUTH_PASSWORD=secret \
58
+ DATABASE_URL="postgres://localhost/mydb" \
59
+ npx pg-boss-dashboard
60
+ ```
61
+
62
+ Both variables must be provided together. If only one is set, the dashboard will throw an error on startup.
49
63
 
50
64
  ### Multi-Database Configuration
51
65
 
@@ -139,87 +153,6 @@ server {
139
153
  }
140
154
  ```
141
155
 
142
- ## Pages
143
-
144
- ### Dashboard (`/`)
145
-
146
- The overview page displays:
147
-
148
- - **Stats Cards**: Total queues, total jobs, active jobs, and failed jobs
149
- - **Problem Queues**: Queues exceeding their `warningQueueSize` threshold
150
- - **Recent Warnings**: Latest 5 warnings (requires `persistWarnings: true` in pg-boss config)
151
- - **Queue Summary**: Table of first 10 queues with quick stats
152
-
153
- ### Queues List (`/queues`)
154
-
155
- Paginated list of all queues showing:
156
-
157
- - Queue name (links to detail page)
158
- - Policy type (standard, short, singleton, stately)
159
- - Job counts: Queued, Active, Deferred, Total
160
- - Last monitored timestamp
161
- - Status indicator (Backlogged, Processing, Idle)
162
-
163
- ### Queue Detail (`/queues/:name`)
164
-
165
- Detailed view of a single queue:
166
-
167
- - **Stats Cards**: Queued, Active, Deferred, Total counts
168
- - **Queue Info**: Policy type badge and partition indicator
169
- - **Jobs Table**: Paginated list of jobs (50 per page) with:
170
- - Job ID (truncated UUID, click to copy full ID)
171
- - State (created, retry, active, completed, cancelled, failed)
172
- - Priority
173
- - Retry count / limit
174
- - Created timestamp
175
- - Actions (View, Cancel, Retry, Resume, Delete - availability depends on job state)
176
-
177
- **Job Detail Dialog**: Click "View" on any job to open a modal with complete job information:
178
-
179
- - Full Job ID (with copy button)
180
- - Priority, retry count/limit
181
- - All timestamps (created, started, completed)
182
- - Singleton key (if applicable)
183
- - Group ID and tier (for grouped jobs)
184
- - Dead letter queue (if configured)
185
- - **Job Data**: Full JSON payload submitted with the job
186
- - **Job Output**: Result data returned by the worker (if completed)
187
-
188
- **Filtering**: Use the state dropdown to filter jobs by state. Available filters:
189
-
190
- | Filter | Description |
191
- |--------|-------------|
192
- | **Pending** (default) | Shows only non-final state jobs: `created`, `retry`, and `active`. This is the default view to handle queues with large job history efficiently. |
193
- | **All States** | Shows all jobs including completed, cancelled, and failed. Use with caution on queues with many historical jobs. |
194
- | **Individual states** | Filter by specific state: Created, Retry, Active, Completed, Cancelled, or Failed |
195
-
196
- > **Performance Note**: The "Pending" filter is the default because queues can accumulate large numbers of completed/failed jobs over time. Showing all jobs by default could cause performance issues and make it harder to find actionable jobs.
197
-
198
- > **Pagination Note**: Job counts are displayed when available from cached statistics. For some filters (Created, Retry, Completed, Cancelled, Failed), exact counts require database queries and are not shown to maintain performance.
199
-
200
- **Job Actions** (shown based on job state):
201
-
202
- | Action | Available States | Description |
203
- |--------|------------------|-------------|
204
- | **View** | All states | Opens job detail dialog with full job information |
205
- | **Cancel** | created, retry, active | Stops the job from being processed |
206
- | **Retry** | failed | Re-queues the job for another attempt |
207
- | **Resume** | cancelled | Restores a cancelled job back to `created` state |
208
- | **Delete** | All except active | Permanently removes the job |
209
-
210
- ### Warnings (`/warnings`)
211
-
212
- History of pg-boss warnings with:
213
-
214
- - Warning type (Slow Query, Queue Backlog, Clock Skew)
215
- - Message
216
- - Additional details (elapsed time, queue name, etc.)
217
- - Timestamp
218
-
219
- **Filtering**: Use the type dropdown to filter by warning type.
220
-
221
- > **Note**: Warnings are only recorded when pg-boss is configured with `persistWarnings: true`.
222
-
223
156
  ## Enabling Warning Persistence
224
157
 
225
158
  To capture warnings in the dashboard, enable warning persistence in your pg-boss configuration:
@@ -233,7 +166,7 @@ const boss = new PgBoss({
233
166
  });
234
167
  ```
235
168
 
236
- This creates a `warning` table in your pg-boss schema that stores:
169
+ Warnings correlate to `warning` events already emitted by pg-boss:
237
170
  - `slow_query`: Queries taking longer than expected
238
171
  - `queue_backlog`: Queues exceeding their warning threshold
239
172
  - `clock_skew`: Database clock drift detection
@@ -280,97 +213,16 @@ The `dev:init-db` script creates the pg-boss schema and populates it with sample
280
213
 
281
214
  The `dev:worker` script starts a worker that processes jobs from the same pg-boss instance as the dashboard. This is useful for testing the dashboard while jobs are being processed. The worker will stay running until you stop it with Ctrl+C.
282
215
 
283
- ### Project Structure
284
-
285
- ```
286
- packages/dashboard/
287
- ├── app/
288
- │ ├── components/
289
- │ │ ├── layout/ # Sidebar, page layout
290
- │ │ └── ui/ # Reusable UI components
291
- │ ├── lib/
292
- │ │ ├── db.server.ts # Database connection pool
293
- │ │ ├── queries.server.ts # SQL queries
294
- │ │ ├── types.ts # TypeScript types
295
- │ │ └── utils.ts # Shared utilities
296
- │ ├── routes/
297
- │ │ ├── _index.tsx # Dashboard overview
298
- │ │ ├── queues._index.tsx # Queues list
299
- │ │ ├── queues.$name.tsx # Queue detail
300
- │ │ └── warnings.tsx # Warnings history
301
- │ ├── root.tsx # Root layout
302
- │ ├── routes.ts # Route configuration
303
- │ └── server.ts # Hono server setup
304
- ├── tests/
305
- │ ├── frontend/ # React component tests
306
- │ ├── server/ # Server-side tests (queries, utils)
307
- │ └── setup.ts # Test setup (jsdom, mocks)
308
- ├── package.json
309
- ├── vite.config.ts
310
- ├── vitest.config.frontend.ts # Frontend test config
311
- └── vitest.config.server.ts # Server test config
312
- ```
313
-
314
- ### Running Tests
216
+ ### Testing
315
217
 
316
218
  ```bash
317
219
  # All tests (frontend + server)
318
220
  npm test
319
221
 
320
- # Frontend tests only (React components)
321
- npm run test:frontend
322
-
323
- # Server tests only (queries, utils - requires PostgreSQL)
324
- npm run test:server
325
-
326
- # All tests with coverage
327
- npm run cover
328
-
329
- # Individual coverage reports
330
- npm run cover:frontend
331
- npm run cover:server
222
+ # Full CI test (used by GitHub Actions)
223
+ npm run ci
332
224
  ```
333
225
 
334
- ### Type Checking
335
-
336
- ```bash
337
- npm run typecheck
338
- ```
339
-
340
- ## API Reference
341
-
342
- The dashboard reads directly from pg-boss database tables:
343
-
344
- - `{schema}.queue` - Queue metadata and cached job counts
345
- - `{schema}.job` - Individual jobs
346
- - `{schema}.warning` - Warning history (when `persistWarnings` is enabled)
347
-
348
- ### Queue Table Fields Used
349
-
350
- | Field | Description |
351
- |-------|-------------|
352
- | `name` | Queue name |
353
- | `policy` | Queue policy (standard, short, singleton, stately) |
354
- | `queued_count` | Number of jobs waiting to be processed |
355
- | `active_count` | Number of jobs currently being processed |
356
- | `deferred_count` | Number of jobs scheduled for later |
357
- | `total_count` | Total job count |
358
- | `warning_queued` | Threshold for backlog warnings |
359
- | `monitor_on` | Last monitoring timestamp |
360
-
361
- ### Job States
362
-
363
- | State | Description | Category |
364
- |-------|-------------|----------|
365
- | `created` | Job is queued and waiting | Pending (non-final) |
366
- | `retry` | Job failed and is scheduled for retry | Pending (non-final) |
367
- | `active` | Job is currently being processed | Pending (non-final) |
368
- | `completed` | Job finished successfully | Final |
369
- | `cancelled` | Job was cancelled | Final |
370
- | `failed` | Job failed after exhausting retries | Final |
371
-
372
- **Pending vs Final States**: Jobs in pending states (`created`, `retry`, `active`) are still being processed or waiting to be processed. Jobs in final states (`completed`, `cancelled`, `failed`) have finished processing. The dashboard's default "Pending" filter shows only non-final state jobs.
373
-
374
226
  ## Troubleshooting
375
227
 
376
228
  ### "Failed to load dashboard"
@@ -0,0 +1 @@
1
+ import{a as u,p as ve}from"./chunk-UVKPFVEO-YfSfkVr_.js";import{g as lt,m as qt,h as In,i as ut,E as Je,j as st,k as Qt}from"./db-link-CU7IJqbq.js";import{i as An,a as kn,u as Fn,b as Z,c as Ln,d as it,t as nn,e as Oo,f as _e,g as To,h as re,j as Dn,k as We,l as Pe,m as Ie,n as So,o as Mo,p as Po,q as Io,r as Ze,s as ct,v as Te,w as Nn,x as Hn,y as Mt,z as Ao,A as Bn,B as Jt,C as Vn,D as Zt,E as ae,F as Ue,G as De,H as Ve,I as dn,J as $e,K as xt,L as Ae,M as Pt,N as _n,O as on,P as Qe,Q as at,R as ko,S as Wn,T as Fo,U as rn,V as sn,W as Lt,X as $n,Y as ft,Z as Lo,_ as Un,$ as dt,a0 as Do,a1 as ot,a2 as me,a3 as It,a4 as rt,a5 as Dt,a6 as No,a7 as ke,a8 as Ho,a9 as Yn,aa as Bo,ab as Vo,ac as en,ad as se,ae as Se,af as tn,ag as Me,ah as _o,ai as Wo,aj as gn,ak as pn,al as Yt,am as mn,an as Be,ao as Ct,ap as $o,aq as zt,ar as Uo,as as Yo,at as Nt,au as gt,av as pt,aw as zo,ax as yt,ay as At,az as Ko,aA as Xo,aB as zn,aC as jo,aD as Go,aE as qo,aF as Qo,aG as Jo,aH as Kn,aI as Zo,aJ as er,aK as tr,aL as nr,aM as or,aN as rr,aO as sr,aP as ir,aQ as cr,aR as nt,aS as ar,aT as lr,aU as Xn,aV as ur,aW as ge,aX as fr,aY as dr,aZ as jn,a_ as gr,a$ as pr,b0 as mr,b1 as hr,b2 as xr,b3 as yr,b4 as Rr,b5 as vr,b6 as br,b7 as Gn,b8 as Er,b9 as qn,ba as wr,bb as Cr,bc as Or,bd as Tr,be as Sr,bf as Mr,bg as Pr,bh as hn,bi as xn,bj as Ir}from"./useOpenInteractionType-mgYMZAa8.js";import{a as kt}from"./index-DuhoQwUK.js";const Qn=u.createContext(void 0);function Jn(e){const n=u.useContext(Qn);if(n===void 0&&!e)throw new Error(lt(33));return n}const Zn=u.createContext(void 0);function je(e){const n=u.useContext(Zn);if(n===void 0&&!e)throw new Error(lt(36));return n}const Ar=u.createContext(void 0);function Ht(e=!0){const n=u.useContext(Ar);if(n===void 0&&!e)throw new Error(lt(25));return n}function kr(e){const{closeOnClick:n,highlighted:t,id:o,nodeId:r,store:s,typingRef:a,itemRef:i,itemMetadata:p}=e,{events:h}=s.useState("floatingTreeRoot"),c=Ht(!0),g=c!==void 0;return u.useMemo(()=>({id:o,role:"menuitem",tabIndex:t?0:-1,onKeyDown(R){R.key===" "&&a?.current&&R.preventDefault()},onMouseMove(R){r&&h.emit("itemhover",{nodeId:r,target:R.currentTarget})},onClick(R){n&&h.emit("close",{domEvent:R,reason:kn})},onMouseUp(R){if(c){const x=c.initialCursorPointRef.current;if(c.initialCursorPointRef.current=null,g&&x&&Math.abs(R.clientX-x.x)<=1&&Math.abs(R.clientY-x.y)<=1||g&&!An&&R.button===2)return}i.current&&s.context.allowMouseUpTriggerRef.current&&(!g||R.button===2)&&(!p||p.type==="regular-item")&&i.current.click()}}),[n,t,o,h,r,s,a,i,c,g,p])}const Fr={type:"regular-item"};function Lr(e){const{closeOnClick:n,disabled:t=!1,highlighted:o,id:r,store:s,typingRef:a=s.context.typingRef,nativeButton:i,itemMetadata:p,nodeId:h}=e,c=u.useRef(null),{getButtonProps:g,buttonRef:R}=Fn({disabled:t,focusableWhenDisabled:!0,native:i,composite:!0}),x=kr({closeOnClick:n,highlighted:o,id:r,nodeId:h,store:s,typingRef:a,itemRef:c,itemMetadata:p}),d=u.useCallback(l=>qt(x,{onMouseEnter(){p.type==="submenu-trigger"&&p.setActive()}},l,g),[x,g,p]),m=In(c,R);return u.useMemo(()=>({getItemProps:d,itemRef:m}),[d,m])}const eo=u.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function Dr(){return u.useContext(eo)}let Nr=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function to(e={}){const{label:n,metadata:t,textRef:o,indexGuessBehavior:r,index:s}=e,{register:a,unregister:i,subscribeMapChange:p,elementsRef:h,labelsRef:c,nextIndexRef:g}=Dr(),R=u.useRef(-1),[x,d]=u.useState(s??(r===Nr.GuessFromOrder?()=>{if(R.current===-1){const y=g.current;g.current+=1,R.current=y}return R.current}:-1)),m=u.useRef(null),l=u.useCallback(y=>{if(m.current=y,x!==-1&&y!==null&&(h.current[x]=y,c)){const v=n!==void 0;c.current[x]=v?n:o?.current?.textContent??y.textContent}},[x,h,c,n,o]);return Z(()=>{if(s!=null)return;const y=m.current;if(y)return a(y,t),()=>{i(y)}},[s,a,i,t]),Z(()=>{if(s==null)return p(y=>{const v=m.current?y.get(m.current)?.index:null;v!=null&&d(v)})},[s,p,d]),u.useMemo(()=>({ref:l,index:x}),[x,l])}const yi=u.forwardRef(function(n,t){const{render:o,className:r,id:s,label:a,nativeButton:i=!1,disabled:p=!1,closeOnClick:h=!0,...c}=n,g=to({label:a}),R=Jn(!0),x=Ln(s),{store:d}=je(),m=d.useState("isActive",g.index),l=d.useState("itemProps"),{getItemProps:y,itemRef:v}=Lr({closeOnClick:h,disabled:p,highlighted:m,id:x,store:d,nativeButton:i,nodeId:R?.nodeId,itemMetadata:Fr});return ut("div",n,{state:{disabled:p,highlighted:m},props:[l,c,y],ref:[v,t,g.ref]})});function Hr(e,n){return n!=null&&!it(n)?0:typeof e=="function"?e():e}function Ot(e,n,t){const o=Hr(e,t);return typeof o=="number"?o:o?.[n]}function yn(e){return typeof e=="function"?e():e}function no(e,n){return n||e==="click"||e==="mousedown"}function Br(e,n={}){const t="rootStore"in e?e.rootStore:e,o=t.context.dataRef,{enabled:r=!0,event:s="click",toggle:a=!0,ignoreMouse:i=!1,stickIfOpen:p=!0,touchOpenDelay:h=0,reason:c=nn}=n,g=u.useRef(void 0),R=Oo(),x=_e(),d=u.useMemo(()=>({onPointerDown(m){g.current=m.pointerType},onMouseDown(m){const l=g.current,y=m.nativeEvent,v=t.select("open");if(m.button!==0||s==="click"||it(l,!0)&&i)return;const E=o.current.openEvent,O=E?.type,b=t.select("domReferenceElement")!==m.currentTarget,f=v&&b||!(v&&a&&(!(E&&p)||O==="click"||O==="mousedown"));if(Dn(y.target)){const P=re(c,y,y.target);f&&l==="touch"&&h>0?x.start(h,()=>{t.setOpen(!0,P)}):t.setOpen(f,P);return}const C=m.currentTarget;R.request(()=>{const P=re(c,y,C);f&&l==="touch"&&h>0?x.start(h,()=>{t.setOpen(!0,P)}):t.setOpen(f,P)})},onClick(m){if(s==="mousedown-only")return;const l=g.current;if(s==="mousedown"&&l){g.current=void 0;return}if(it(l,!0)&&i)return;const y=t.select("open"),v=o.current.openEvent,E=t.select("domReferenceElement")!==m.currentTarget,O=y&&E||!(y&&a&&(!(v&&p)||To(v))),b=re(c,m.nativeEvent,m.currentTarget);O&&l==="touch"&&h>0?x.start(h,()=>{t.setOpen(!0,b)}):t.setOpen(O,b)},onKeyDown(){g.current=void 0}}),[o,s,i,t,p,a,R,x,h,c]);return u.useMemo(()=>r?{reference:d}:Je,[r,d])}function Rn(e,n,t){let{reference:o,floating:r}=e;const s=Ie(n),a=Nn(n),i=Bn(a),p=Pe(n),h=s==="y",c=o.x+o.width/2-r.width/2,g=o.y+o.height/2-r.height/2,R=o[i]/2-r[i]/2;let x;switch(p){case"top":x={x:c,y:o.y-r.height};break;case"bottom":x={x:c,y:o.y+o.height};break;case"right":x={x:o.x+o.width,y:g};break;case"left":x={x:o.x-r.width,y:g};break;default:x={x:o.x,y:o.y}}switch(Ze(n)){case"start":x[a]-=R*(t&&h?-1:1);break;case"end":x[a]+=R*(t&&h?-1:1);break}return x}async function Vr(e,n){var t;n===void 0&&(n={});const{x:o,y:r,platform:s,rects:a,elements:i,strategy:p}=e,{boundary:h="clippingAncestors",rootBoundary:c="viewport",elementContext:g="floating",altBoundary:R=!1,padding:x=0}=We(n,e),d=Hn(x),l=i[R?g==="floating"?"reference":"floating":g],y=Mt(await s.getClippingRect({element:(t=await(s.isElement==null?void 0:s.isElement(l)))==null||t?l:l.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(i.floating)),boundary:h,rootBoundary:c,strategy:p})),v=g==="floating"?{x:o,y:r,width:a.floating.width,height:a.floating.height}:a.reference,E=await(s.getOffsetParent==null?void 0:s.getOffsetParent(i.floating)),O=await(s.isElement==null?void 0:s.isElement(E))?await(s.getScale==null?void 0:s.getScale(E))||{x:1,y:1}:{x:1,y:1},b=Mt(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:v,offsetParent:E,strategy:p}):v);return{top:(y.top-b.top+d.top)/O.y,bottom:(b.bottom-y.bottom+d.bottom)/O.y,left:(y.left-b.left+d.left)/O.x,right:(b.right-y.right+d.right)/O.x}}const _r=50,Wr=async(e,n,t)=>{const{placement:o="bottom",strategy:r="absolute",middleware:s=[],platform:a}=t,i=a.detectOverflow?a:{...a,detectOverflow:Vr},p=await(a.isRTL==null?void 0:a.isRTL(n));let h=await a.getElementRects({reference:e,floating:n,strategy:r}),{x:c,y:g}=Rn(h,o,p),R=o,x=0;const d={};for(let m=0;m<s.length;m++){const l=s[m];if(!l)continue;const{name:y,fn:v}=l,{x:E,y:O,data:b,reset:f}=await v({x:c,y:g,initialPlacement:o,placement:R,strategy:r,middlewareData:d,rects:h,platform:i,elements:{reference:e,floating:n}});c=E??c,g=O??g,d[y]={...d[y],...b},f&&x<_r&&(x++,typeof f=="object"&&(f.placement&&(R=f.placement),f.rects&&(h=f.rects===!0?await a.getElementRects({reference:e,floating:n,strategy:r}):f.rects),{x:c,y:g}=Rn(h,R,p)),m=-1)}return{x:c,y:g,placement:R,strategy:r,middlewareData:d}},$r=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(n){var t,o;const{placement:r,middlewareData:s,rects:a,initialPlacement:i,platform:p,elements:h}=n,{mainAxis:c=!0,crossAxis:g=!0,fallbackPlacements:R,fallbackStrategy:x="bestFit",fallbackAxisSideDirection:d="none",flipAlignment:m=!0,...l}=We(e,n);if((t=s.arrow)!=null&&t.alignmentOffset)return{};const y=Pe(r),v=Ie(i),E=Pe(i)===i,O=await(p.isRTL==null?void 0:p.isRTL(h.floating)),b=R||(E||!m?[So(i)]:Mo(i)),f=d!=="none";!R&&f&&b.push(...Po(i,m,d,O));const C=[i,...b],P=await p.detectOverflow(n,l),D=[];let V=((o=s.flip)==null?void 0:o.overflows)||[];if(c&&D.push(P[y]),g){const I=Io(r,a,O);D.push(P[I[0]],P[I[1]])}if(V=[...V,{placement:r,overflows:D}],!D.every(I=>I<=0)){var F,N;const I=(((F=s.flip)==null?void 0:F.index)||0)+1,w=C[I];if(w&&(!(g==="alignment"?v!==Ie(w):!1)||V.every(S=>Ie(S.placement)===v?S.overflows[0]>0:!0)))return{data:{index:I,overflows:V},reset:{placement:w}};let k=(N=V.filter(T=>T.overflows[0]<=0).sort((T,S)=>T.overflows[1]-S.overflows[1])[0])==null?void 0:N.placement;if(!k)switch(x){case"bestFit":{var A;const T=(A=V.filter(S=>{if(f){const L=Ie(S.placement);return L===v||L==="y"}return!0}).map(S=>[S.placement,S.overflows.filter(L=>L>0).reduce((L,B)=>L+B,0)]).sort((S,L)=>S[1]-L[1])[0])==null?void 0:A[0];T&&(k=T);break}case"initialPlacement":k=i;break}if(r!==k)return{reset:{placement:k}}}return{}}}};function vn(e,n){return{top:e.top-n.height,right:e.right-n.width,bottom:e.bottom-n.height,left:e.left-n.width}}function bn(e){return Ao.some(n=>e[n]>=0)}const Ur=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(n){const{rects:t,platform:o}=n,{strategy:r="referenceHidden",...s}=We(e,n);switch(r){case"referenceHidden":{const a=await o.detectOverflow(n,{...s,elementContext:"reference"}),i=vn(a,t.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:bn(i)}}}case"escaped":{const a=await o.detectOverflow(n,{...s,altBoundary:!0}),i=vn(a,t.floating);return{data:{escapedOffsets:i,escaped:bn(i)}}}default:return{}}}}},oo=new Set(["left","top"]);async function Yr(e,n){const{placement:t,platform:o,elements:r}=e,s=await(o.isRTL==null?void 0:o.isRTL(r.floating)),a=Pe(t),i=Ze(t),p=Ie(t)==="y",h=oo.has(a)?-1:1,c=s&&p?-1:1,g=We(n,e);let{mainAxis:R,crossAxis:x,alignmentAxis:d}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return i&&typeof d=="number"&&(x=i==="end"?d*-1:d),p?{x:x*c,y:R*h}:{x:R*h,y:x*c}}const zr=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(n){var t,o;const{x:r,y:s,placement:a,middlewareData:i}=n,p=await Yr(n,e);return a===((t=i.offset)==null?void 0:t.placement)&&(o=i.arrow)!=null&&o.alignmentOffset?{}:{x:r+p.x,y:s+p.y,data:{...p,placement:a}}}}},Kr=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(n){const{x:t,y:o,placement:r,platform:s}=n,{mainAxis:a=!0,crossAxis:i=!1,limiter:p={fn:y=>{let{x:v,y:E}=y;return{x:v,y:E}}},...h}=We(e,n),c={x:t,y:o},g=await s.detectOverflow(n,h),R=Ie(Pe(r)),x=Vn(R);let d=c[x],m=c[R];if(a){const y=x==="y"?"top":"left",v=x==="y"?"bottom":"right",E=d+g[y],O=d-g[v];d=Jt(E,d,O)}if(i){const y=R==="y"?"top":"left",v=R==="y"?"bottom":"right",E=m+g[y],O=m-g[v];m=Jt(E,m,O)}const l=p.fn({...n,[x]:d,[R]:m});return{...l,data:{x:l.x-t,y:l.y-o,enabled:{[x]:a,[R]:i}}}}}},Xr=function(e){return e===void 0&&(e={}),{options:e,fn(n){const{x:t,y:o,placement:r,rects:s,middlewareData:a}=n,{offset:i=0,mainAxis:p=!0,crossAxis:h=!0}=We(e,n),c={x:t,y:o},g=Ie(r),R=Vn(g);let x=c[R],d=c[g];const m=We(i,n),l=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(p){const E=R==="y"?"height":"width",O=s.reference[R]-s.floating[E]+l.mainAxis,b=s.reference[R]+s.reference[E]-l.mainAxis;x<O?x=O:x>b&&(x=b)}if(h){var y,v;const E=R==="y"?"width":"height",O=oo.has(Pe(r)),b=s.reference[g]-s.floating[E]+(O&&((y=a.offset)==null?void 0:y[g])||0)+(O?0:l.crossAxis),f=s.reference[g]+s.reference[E]+(O?0:((v=a.offset)==null?void 0:v[g])||0)-(O?l.crossAxis:0);d<b?d=b:d>f&&(d=f)}return{[R]:x,[g]:d}}}},jr=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(n){var t,o;const{placement:r,rects:s,platform:a,elements:i}=n,{apply:p=()=>{},...h}=We(e,n),c=await a.detectOverflow(n,h),g=Pe(r),R=Ze(r),x=Ie(r)==="y",{width:d,height:m}=s.floating;let l,y;g==="top"||g==="bottom"?(l=g,y=R===(await(a.isRTL==null?void 0:a.isRTL(i.floating))?"start":"end")?"left":"right"):(y=g,l=R==="end"?"top":"bottom");const v=m-c.top-c.bottom,E=d-c.left-c.right,O=ct(m-c[l],v),b=ct(d-c[y],E),f=!n.middlewareData.shift;let C=O,P=b;if((t=n.middlewareData.shift)!=null&&t.enabled.x&&(P=E),(o=n.middlewareData.shift)!=null&&o.enabled.y&&(C=v),f&&!R){const V=Te(c.left,0),F=Te(c.right,0),N=Te(c.top,0),A=Te(c.bottom,0);x?P=d-2*(V!==0||F!==0?V+F:Te(c.left,c.right)):C=m-2*(N!==0||A!==0?N+A:Te(c.top,c.bottom))}await p({...n,availableWidth:P,availableHeight:C});const D=await a.getDimensions(i.floating);return d!==D.width||m!==D.height?{reset:{rects:!0}}:{}}}};function ro(e){const n=$e(e);let t=parseFloat(n.width)||0,o=parseFloat(n.height)||0;const r=Ae(e),s=r?e.offsetWidth:t,a=r?e.offsetHeight:o,i=Pt(t)!==s||Pt(o)!==a;return i&&(t=s,o=a),{width:t,height:o,$:i}}function cn(e){return ae(e)?e:e.contextElement}function qe(e){const n=cn(e);if(!Ae(n))return De(1);const t=n.getBoundingClientRect(),{width:o,height:r,$:s}=ro(n);let a=(s?Pt(t.width):t.width)/o,i=(s?Pt(t.height):t.height)/r;return(!a||!Number.isFinite(a))&&(a=1),(!i||!Number.isFinite(i))&&(i=1),{x:a,y:i}}const Gr=De(0);function so(e){const n=Ve(e);return!_n()||!n.visualViewport?Gr:{x:n.visualViewport.offsetLeft,y:n.visualViewport.offsetTop}}function qr(e,n,t){return n===void 0&&(n=!1),!t||n&&t!==Ve(e)?!1:n}function Xe(e,n,t,o){n===void 0&&(n=!1),t===void 0&&(t=!1);const r=e.getBoundingClientRect(),s=cn(e);let a=De(1);n&&(o?ae(o)&&(a=qe(o)):a=qe(e));const i=qr(s,t,o)?so(s):De(0);let p=(r.left+i.x)/a.x,h=(r.top+i.y)/a.y,c=r.width/a.x,g=r.height/a.y;if(s){const R=Ve(s),x=o&&ae(o)?Ve(o):o;let d=R,m=dn(d);for(;m&&o&&x!==d;){const l=qe(m),y=m.getBoundingClientRect(),v=$e(m),E=y.left+(m.clientLeft+parseFloat(v.paddingLeft))*l.x,O=y.top+(m.clientTop+parseFloat(v.paddingTop))*l.y;p*=l.x,h*=l.y,c*=l.x,g*=l.y,p+=E,h+=O,d=Ve(m),m=dn(d)}}return Mt({width:c,height:g,x:p,y:h})}function Bt(e,n){const t=Lt(e).scrollLeft;return n?n.left+t:Xe(Ue(e)).left+t}function io(e,n){const t=e.getBoundingClientRect(),o=t.left+n.scrollLeft-Bt(e,t),r=t.top+n.scrollTop;return{x:o,y:r}}function Qr(e){let{elements:n,rect:t,offsetParent:o,strategy:r}=e;const s=r==="fixed",a=Ue(o),i=n?on(n.floating):!1;if(o===a||i&&s)return t;let p={scrollLeft:0,scrollTop:0},h=De(1);const c=De(0),g=Ae(o);if((g||!g&&!s)&&((rn(o)!=="body"||sn(a))&&(p=Lt(o)),g)){const x=Xe(o);h=qe(o),c.x=x.x+o.clientLeft,c.y=x.y+o.clientTop}const R=a&&!g&&!s?io(a,p):De(0);return{width:t.width*h.x,height:t.height*h.y,x:t.x*h.x-p.scrollLeft*h.x+c.x+R.x,y:t.y*h.y-p.scrollTop*h.y+c.y+R.y}}function Jr(e){return Array.from(e.getClientRects())}function Zr(e){const n=Ue(e),t=Lt(e),o=e.ownerDocument.body,r=Te(n.scrollWidth,n.clientWidth,o.scrollWidth,o.clientWidth),s=Te(n.scrollHeight,n.clientHeight,o.scrollHeight,o.clientHeight);let a=-t.scrollLeft+Bt(e);const i=-t.scrollTop;return $e(o).direction==="rtl"&&(a+=Te(n.clientWidth,o.clientWidth)-r),{width:r,height:s,x:a,y:i}}const En=25;function es(e,n){const t=Ve(e),o=Ue(e),r=t.visualViewport;let s=o.clientWidth,a=o.clientHeight,i=0,p=0;if(r){s=r.width,a=r.height;const c=_n();(!c||c&&n==="fixed")&&(i=r.offsetLeft,p=r.offsetTop)}const h=Bt(o);if(h<=0){const c=o.ownerDocument,g=c.body,R=getComputedStyle(g),x=c.compatMode==="CSS1Compat"&&parseFloat(R.marginLeft)+parseFloat(R.marginRight)||0,d=Math.abs(o.clientWidth-g.clientWidth-x);d<=En&&(s-=d)}else h<=En&&(s+=h);return{width:s,height:a,x:i,y:p}}function ts(e,n){const t=Xe(e,!0,n==="fixed"),o=t.top+e.clientTop,r=t.left+e.clientLeft,s=Ae(e)?qe(e):De(1),a=e.clientWidth*s.x,i=e.clientHeight*s.y,p=r*s.x,h=o*s.y;return{width:a,height:i,x:p,y:h}}function wn(e,n,t){let o;if(n==="viewport")o=es(e,t);else if(n==="document")o=Zr(Ue(e));else if(ae(n))o=ts(n,t);else{const r=so(e);o={x:n.x-r.x,y:n.y-r.y,width:n.width,height:n.height}}return Mt(o)}function co(e,n){const t=Qe(e);return t===n||!ae(t)||at(t)?!1:$e(t).position==="fixed"||co(t,n)}function ns(e,n){const t=n.get(e);if(t)return t;let o=Zt(e,[],!1).filter(i=>ae(i)&&rn(i)!=="body"),r=null;const s=$e(e).position==="fixed";let a=s?Qe(e):e;for(;ae(a)&&!at(a);){const i=$e(a),p=Wn(a);!p&&i.position==="fixed"&&(r=null),(s?!p&&!r:!p&&i.position==="static"&&!!r&&(r.position==="absolute"||r.position==="fixed")||sn(a)&&!p&&co(e,a))?o=o.filter(c=>c!==a):r=i,a=Qe(a)}return n.set(e,o),o}function os(e){let{element:n,boundary:t,rootBoundary:o,strategy:r}=e;const a=[...t==="clippingAncestors"?on(n)?[]:ns(n,this._c):[].concat(t),o],i=wn(n,a[0],r);let p=i.top,h=i.right,c=i.bottom,g=i.left;for(let R=1;R<a.length;R++){const x=wn(n,a[R],r);p=Te(x.top,p),h=ct(x.right,h),c=ct(x.bottom,c),g=Te(x.left,g)}return{width:h-g,height:c-p,x:g,y:p}}function rs(e){const{width:n,height:t}=ro(e);return{width:n,height:t}}function ss(e,n,t){const o=Ae(n),r=Ue(n),s=t==="fixed",a=Xe(e,!0,s,n);let i={scrollLeft:0,scrollTop:0};const p=De(0);function h(){p.x=Bt(r)}if(o||!o&&!s)if((rn(n)!=="body"||sn(r))&&(i=Lt(n)),o){const x=Xe(n,!0,s,n);p.x=x.x+n.clientLeft,p.y=x.y+n.clientTop}else r&&h();s&&!o&&r&&h();const c=r&&!o&&!s?io(r,i):De(0),g=a.left+i.scrollLeft-p.x-c.x,R=a.top+i.scrollTop-p.y-c.y;return{x:g,y:R,width:a.width,height:a.height}}function Kt(e){return $e(e).position==="static"}function Cn(e,n){if(!Ae(e)||$e(e).position==="fixed")return null;if(n)return n(e);let t=e.offsetParent;return Ue(e)===t&&(t=t.ownerDocument.body),t}function ao(e,n){const t=Ve(e);if(on(e))return t;if(!Ae(e)){let r=Qe(e);for(;r&&!at(r);){if(ae(r)&&!Kt(r))return r;r=Qe(r)}return t}let o=Cn(e,n);for(;o&&ko(o)&&Kt(o);)o=Cn(o,n);return o&&at(o)&&Kt(o)&&!Wn(o)?t:o||Fo(e)||t}const is=async function(e){const n=this.getOffsetParent||ao,t=this.getDimensions,o=await t(e.floating);return{reference:ss(e.reference,await n(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function cs(e){return $e(e).direction==="rtl"}const as={convertOffsetParentRelativeRectToViewportRelativeRect:Qr,getDocumentElement:Ue,getClippingRect:os,getOffsetParent:ao,getElementRects:is,getClientRects:Jr,getDimensions:rs,getScale:qe,isElement:ae,isRTL:cs};function lo(e,n){return e.x===n.x&&e.y===n.y&&e.width===n.width&&e.height===n.height}function ls(e,n){let t=null,o;const r=Ue(e);function s(){var i;clearTimeout(o),(i=t)==null||i.disconnect(),t=null}function a(i,p){i===void 0&&(i=!1),p===void 0&&(p=1),s();const h=e.getBoundingClientRect(),{left:c,top:g,width:R,height:x}=h;if(i||n(),!R||!x)return;const d=xt(g),m=xt(r.clientWidth-(c+R)),l=xt(r.clientHeight-(g+x)),y=xt(c),E={rootMargin:-d+"px "+-m+"px "+-l+"px "+-y+"px",threshold:Te(0,ct(1,p))||1};let O=!0;function b(f){const C=f[0].intersectionRatio;if(C!==p){if(!O)return a();C?a(!1,C):o=setTimeout(()=>{a(!1,1e-7)},1e3)}C===1&&!lo(h,e.getBoundingClientRect())&&a(),O=!1}try{t=new IntersectionObserver(b,{...E,root:r.ownerDocument})}catch{t=new IntersectionObserver(b,E)}t.observe(e)}return a(!0),s}function On(e,n,t,o){o===void 0&&(o={});const{ancestorScroll:r=!0,ancestorResize:s=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:i=typeof IntersectionObserver=="function",animationFrame:p=!1}=o,h=cn(e),c=r||s?[...h?Zt(h):[],...n?Zt(n):[]]:[];c.forEach(y=>{r&&y.addEventListener("scroll",t,{passive:!0}),s&&y.addEventListener("resize",t)});const g=h&&i?ls(h,t):null;let R=-1,x=null;a&&(x=new ResizeObserver(y=>{let[v]=y;v&&v.target===h&&x&&n&&(x.unobserve(n),cancelAnimationFrame(R),R=requestAnimationFrame(()=>{var E;(E=x)==null||E.observe(n)})),t()}),h&&!p&&x.observe(h),n&&x.observe(n));let d,m=p?Xe(e):null;p&&l();function l(){const y=Xe(e);m&&!lo(m,y)&&t(),m=y,d=requestAnimationFrame(l)}return t(),()=>{var y;c.forEach(v=>{r&&v.removeEventListener("scroll",t),s&&v.removeEventListener("resize",t)}),g?.(),(y=x)==null||y.disconnect(),x=null,p&&cancelAnimationFrame(d)}}const us=zr,fs=Kr,ds=$r,gs=jr,ps=Ur,ms=Xr,hs=(e,n,t)=>{const o=new Map,r={platform:as,...t},s={...r.platform,_c:o};return Wr(e,n,{...r,platform:s})};var xs=typeof document<"u",ys=function(){},Tt=xs?u.useLayoutEffect:ys;function Ft(e,n){if(e===n)return!0;if(typeof e!=typeof n)return!1;if(typeof e=="function"&&e.toString()===n.toString())return!0;let t,o,r;if(e&&n&&typeof e=="object"){if(Array.isArray(e)){if(t=e.length,t!==n.length)return!1;for(o=t;o--!==0;)if(!Ft(e[o],n[o]))return!1;return!0}if(r=Object.keys(e),t=r.length,t!==Object.keys(n).length)return!1;for(o=t;o--!==0;)if(!{}.hasOwnProperty.call(n,r[o]))return!1;for(o=t;o--!==0;){const s=r[o];if(!(s==="_owner"&&e.$$typeof)&&!Ft(e[s],n[s]))return!1}return!0}return e!==e&&n!==n}function uo(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Tn(e,n){const t=uo(e);return Math.round(n*t)/t}function Xt(e){const n=u.useRef(e);return Tt(()=>{n.current=e}),n}function Rs(e){e===void 0&&(e={});const{placement:n="bottom",strategy:t="absolute",middleware:o=[],platform:r,elements:{reference:s,floating:a}={},transform:i=!0,whileElementsMounted:p,open:h}=e,[c,g]=u.useState({x:0,y:0,strategy:t,placement:n,middlewareData:{},isPositioned:!1}),[R,x]=u.useState(o);Ft(R,o)||x(o);const[d,m]=u.useState(null),[l,y]=u.useState(null),v=u.useCallback(S=>{S!==f.current&&(f.current=S,m(S))},[]),E=u.useCallback(S=>{S!==C.current&&(C.current=S,y(S))},[]),O=s||d,b=a||l,f=u.useRef(null),C=u.useRef(null),P=u.useRef(c),D=p!=null,V=Xt(p),F=Xt(r),N=Xt(h),A=u.useCallback(()=>{if(!f.current||!C.current)return;const S={placement:n,strategy:t,middleware:R};F.current&&(S.platform=F.current),hs(f.current,C.current,S).then(L=>{const B={...L,isPositioned:N.current!==!1};I.current&&!Ft(P.current,B)&&(P.current=B,kt.flushSync(()=>{g(B)}))})},[R,n,t,F,N]);Tt(()=>{h===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,g(S=>({...S,isPositioned:!1})))},[h]);const I=u.useRef(!1);Tt(()=>(I.current=!0,()=>{I.current=!1}),[]),Tt(()=>{if(O&&(f.current=O),b&&(C.current=b),O&&b){if(V.current)return V.current(O,b,A);A()}},[O,b,A,V,D]);const w=u.useMemo(()=>({reference:f,floating:C,setReference:v,setFloating:E}),[v,E]),k=u.useMemo(()=>({reference:O,floating:b}),[O,b]),T=u.useMemo(()=>{const S={position:t,left:0,top:0};if(!k.floating)return S;const L=Tn(k.floating,c.x),B=Tn(k.floating,c.y);return i?{...S,transform:"translate("+L+"px, "+B+"px)",...uo(k.floating)>=1.5&&{willChange:"transform"}}:{position:t,left:L,top:B}},[t,i,k.floating,c.x,c.y]);return u.useMemo(()=>({...c,update:A,refs:w,elements:k,floatingStyles:T}),[c,A,w,k,T])}const vs=(e,n)=>{const t=us(e);return{name:t.name,fn:t.fn,options:[e,n]}},bs=(e,n)=>{const t=fs(e);return{name:t.name,fn:t.fn,options:[e,n]}},Es=(e,n)=>({fn:ms(e).fn,options:[e,n]}),ws=(e,n)=>{const t=ds(e);return{name:t.name,fn:t.fn,options:[e,n]}},Cs=(e,n)=>{const t=gs(e);return{name:t.name,fn:t.fn,options:[e,n]}},Os=(e,n)=>{const t=ps(e);return{name:t.name,fn:t.fn,options:[e,n]}};function Ts(e){const{open:n=!1,onOpenChange:t,elements:o={}}=e,r=$n(),s=ft()!=null,a=st(()=>new Lo({open:n,onOpenChange:t,referenceElement:o.reference??null,floatingElement:o.floating??null,triggerElements:new Un,floatingId:r,nested:s,noEmit:!1})).current;return Z(()=>{const i={open:n,floatingId:r};o.reference!==void 0&&(i.referenceElement=o.reference,i.domReferenceElement=ae(o.reference)?o.reference:null),o.floating!==void 0&&(i.floatingElement=o.floating),a.update(i)},[n,r,o.reference,o.floating,a]),a.context.onOpenChange=t,a.context.nested=s,a.context.noEmit=!1,a}function Ss(e={}){const{nodeId:n,externalTree:t}=e,o=Ts(e),r=e.rootContext||o,s={reference:r.useState("referenceElement"),floating:r.useState("floatingElement"),domReference:r.useState("domReferenceElement")},[a,i]=u.useState(null),p=u.useRef(null),h=dt(t);Z(()=>{s.domReference&&(p.current=s.domReference)},[s.domReference]);const c=Rs({...e,elements:{...s,...a&&{reference:a}}}),g=u.useCallback(C=>{const P=ae(C)?{getBoundingClientRect:()=>C.getBoundingClientRect(),getClientRects:()=>C.getClientRects(),contextElement:C}:C;i(P),c.refs.setReference(P)},[c.refs]),[R,x]=u.useState(null),[d,m]=u.useState(null);r.useSyncedValue("referenceElement",R),r.useSyncedValue("domReferenceElement",ae(R)?R:null),r.useSyncedValue("floatingElement",d);const l=u.useCallback(C=>{(ae(C)||C===null)&&(p.current=C,x(C)),(ae(c.refs.reference.current)||c.refs.reference.current===null||C!==null&&!ae(C))&&c.refs.setReference(C)},[c.refs,x]),y=u.useCallback(C=>{m(C),c.refs.setFloating(C)},[c.refs]),v=u.useMemo(()=>({...c.refs,setReference:l,setFloating:y,setPositionReference:g,domReference:p}),[c.refs,l,y,g]),E=u.useMemo(()=>({...c.elements,domReference:s.domReference}),[c.elements,s.domReference]),O=r.useState("open"),b=r.useState("floatingId"),f=u.useMemo(()=>({...c,dataRef:r.context.dataRef,open:O,onOpenChange:r.setOpen,events:r.context.events,floatingId:b,refs:v,elements:E,nodeId:n,rootStore:r}),[c,v,E,n,r,O,b]);return Z(()=>{r.context.dataRef.current.floatingContext=f;const C=h?.nodesRef.current.find(P=>P.id===n);C&&(C.context=f)}),u.useMemo(()=>({...c,context:f,refs:v,elements:E,rootStore:r}),[c,v,E,f,r])}const jt=An&&Ho;function Ms(e,n={}){const t="rootStore"in e?e.rootStore:e,{events:o,dataRef:r}=t.context,{enabled:s=!0,delay:a}=n,i=u.useRef(!1),p=u.useRef(null),h=_e(),c=u.useRef(!0);u.useEffect(()=>{const R=t.select("domReferenceElement");if(!s)return;const x=Ve(R);function d(){const y=t.select("domReferenceElement");!t.select("open")&&Ae(y)&&y===ot(ke(y))&&(i.current=!0)}function m(){c.current=!0}function l(){c.current=!1}return x.addEventListener("blur",d),jt&&(x.addEventListener("keydown",m,!0),x.addEventListener("pointerdown",l,!0)),()=>{x.removeEventListener("blur",d),jt&&(x.removeEventListener("keydown",m,!0),x.removeEventListener("pointerdown",l,!0))}},[t,s]),u.useEffect(()=>{if(!s)return;function R(x){if(x.reason===nn||x.reason===Yn){const d=t.select("domReferenceElement");ae(d)&&(p.current=d,i.current=!0)}}return o.on("openchange",R),()=>{o.off("openchange",R)}},[o,s,t]);const g=u.useMemo(()=>({onMouseLeave(){i.current=!1,p.current=null},onFocus(R){const x=R.currentTarget;if(i.current){if(p.current===x)return;i.current=!1,p.current=null}const d=Dt(R.nativeEvent);if(ae(d)){if(jt&&!R.relatedTarget){if(!c.current&&!Dn(d))return}else if(!No(d))return}const m=It(R.relatedTarget,t.context.triggerElements),{nativeEvent:l,currentTarget:y}=R,v=typeof a=="function"?a():a;if(t.select("open")&&m||v===0||v===void 0){t.setOpen(!0,re(rt,l,y));return}h.start(v,()=>{i.current||t.setOpen(!0,re(rt,l,y))})},onBlur(R){i.current=!1,p.current=null;const x=R.relatedTarget,d=R.nativeEvent,m=ae(x)&&x.hasAttribute(Do("focus-guard"))&&x.getAttribute("data-type")==="outside";h.start(0,()=>{const l=t.select("domReferenceElement"),y=ot(l?l.ownerDocument:document);!x&&y===l||me(r.current.floatingContext?.refs.floating.current,y)||me(l,y)||m||It(x??y,t.context.triggerElements)||t.setOpen(!1,re(rt,d))})}}),[r,t,h,a]);return u.useMemo(()=>s?{reference:g,trigger:g}:{},[s,g])}const Ps=`button,a,[role="button"],select,[tabindex]:not([tabindex="-1"]),${Vo}`;function Is(e){return e?!!e.closest(Ps):!1}class an{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new en,this.restTimeout=new en,this.handleCloseOptions=void 0}static create(){return new an}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}function ln(e){e.performedPointerEventsMutation&&(e.pointerEventsScopeElement?.style.removeProperty("pointer-events"),e.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),e.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null)}function As(e,n){const{scopeElement:t,referenceElement:o,floatingElement:r}=n;ln(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=t,e.pointerEventsReferenceElement=o,e.pointerEventsFloatingElement=r,t.style.pointerEvents="none",o.style.pointerEvents="auto",r.style.pointerEvents="auto"}function fo(e){const n=st(an.create).current,t=e.context.dataRef.current;return t.hoverInteractionState||(t.hoverInteractionState=n),Bo(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function ks(e,n={}){const t="rootStore"in e?e.rootStore:e,o=t.useState("open"),r=t.useState("floatingElement"),s=t.useState("domReferenceElement"),{dataRef:a}=t.context,{enabled:i=!0,closeDelay:p=0}=n,h=fo(t),c=dt(),g=ft(),R=se(()=>no(a.current.openEvent?.type,h.interactedInside)),x=se(()=>{const E=a.current.openEvent?.type;return E?.includes("mouse")&&E!=="mousedown"}),d=se(E=>It(E,t.context.triggerElements)),m=u.useCallback(E=>{const O=Ot(p,"close",h.pointerType),b=()=>{t.setOpen(!1,re(Se,E)),c?.events.emit("floating.closed",E)};O?h.openChangeTimeout.start(O,b):(h.openChangeTimeout.clear(),b())},[p,t,h,c]),l=se(()=>{ln(h)}),y=se(E=>{const O=Dt(E);if(!Is(O)){h.interactedInside=!1;return}h.interactedInside=O?.closest("[aria-haspopup]")!=null});Z(()=>{o||(h.pointerType=void 0,h.restTimeoutPending=!1,h.interactedInside=!1,l())},[o,h,l]),u.useEffect(()=>l,[l]),Z(()=>{if(i&&o&&h.handleCloseOptions?.blockPointerEvents&&x()&&ae(s)&&r){const E=s,O=r,b=ke(r),f=c?.nodesRef.current.find(P=>P.id===g)?.context?.elements.floating;f&&(f.style.pointerEvents="");const C=h.handleCloseOptions?.getScope?.()??h.pointerEventsScopeElement??f??E.closest("[data-rootownerid]")??b.body;return As(h,{scopeElement:C,referenceElement:E,floatingElement:O}),()=>{l()}}},[i,o,s,r,h,x,c,g,l]);const v=_e();u.useEffect(()=>{if(!i)return;function E(){h.openChangeTimeout.clear(),v.clear(),c?.events.off("floating.closed",b),l()}function O(C){if(c&&g&&tn(c.nodesRef.current,g).length>0){c.events.on("floating.closed",b);return}if(!d(C.relatedTarget)){if(h.handler){h.handler(C);return}l(),R()||m(C)}}function b(C){!c||!g||tn(c.nodesRef.current,g).length>0||v.start(0,()=>{c.events.off("floating.closed",b),t.setOpen(!1,re(Se,C)),c.events.emit("floating.closed",C)})}const f=r;return f&&(f.addEventListener("mouseenter",E),f.addEventListener("mouseleave",O),f.addEventListener("pointerdown",y,!0)),()=>{f&&(f.removeEventListener("mouseenter",E),f.removeEventListener("mouseleave",O),f.removeEventListener("pointerdown",y,!0)),c?.events.off("floating.closed",b)}},[i,r,t,a,R,d,m,l,y,h,c,g,v])}const Fs={current:null};function Ls(e,n={}){const t="rootStore"in e?e.rootStore:e,{dataRef:o,events:r}=t.context,{enabled:s=!0,delay:a=0,handleClose:i=null,mouseOnly:p=!1,restMs:h=0,move:c=!0,triggerElementRef:g=Fs,externalTree:R,isActiveTrigger:x=!0,getHandleCloseContext:d}=n,m=dt(R),l=fo(t),y=Me(i),v=Me(a),E=Me(h),O=Me(s);x&&(l.handleCloseOptions=y.current?.__options);const b=se(()=>no(o.current.openEvent?.type,l.interactedInside)),f=se(F=>It(F,t.context.triggerElements)),C=se((F,N,A)=>{const I=t.context.triggerElements;if(I.hasElement(N))return!F||!me(F,N);if(!ae(A))return!1;const w=A;return I.hasMatchingElement(k=>me(k,w))&&(!F||!me(F,w))}),P=u.useCallback((F,N=!0)=>{const A=Ot(v.current,"close",l.pointerType);A?l.openChangeTimeout.start(A,()=>{t.setOpen(!1,re(Se,F)),m?.events.emit("floating.closed",F)}):N&&(l.openChangeTimeout.clear(),t.setOpen(!1,re(Se,F)),m?.events.emit("floating.closed",F))},[v,t,l,m]),D=se(()=>{if(!l.handler)return;ke(t.select("domReferenceElement")).removeEventListener("mousemove",l.handler),l.handler=void 0});u.useEffect(()=>D,[D]);const V=se(()=>{ln(l)});return u.useEffect(()=>{if(!s)return;function F(N){N.open||(D(),l.openChangeTimeout.clear(),l.restTimeout.clear(),l.blockMouseMove=!0,l.restTimeoutPending=!1)}return r.on("openchange",F),()=>{r.off("openchange",F)}},[s,r,l,D]),u.useEffect(()=>{if(!s)return;const F=g.current??(x?t.select("domReferenceElement"):null);if(!ae(F))return;function N(I){if(l.openChangeTimeout.clear(),l.blockMouseMove=!1,p&&!it(l.pointerType)||yn(E.current)>0&&!Ot(v.current,"open"))return;const k=Ot(v.current,"open",l.pointerType),T=I.currentTarget??null,S=t.select("domReferenceElement"),L=T==null?!1:C(S,T,I.target),B=t.select("open"),ee=!B||L;L&&B?t.setOpen(!0,re(Se,I,T)):k?l.openChangeTimeout.start(k,()=>{ee&&t.setOpen(!0,re(Se,I,T))}):ee&&t.setOpen(!0,re(Se,I,T))}function A(I){if(b()){V();return}D();const w=t.select("domReferenceElement"),k=ke(w);l.restTimeout.clear(),l.restTimeoutPending=!1;const T=o.current.floatingContext??d?.();if(f(I.relatedTarget))return;if(y.current&&T){t.select("open")||l.openChangeTimeout.clear();const B=g.current;l.handler=y.current({...T,tree:m,x:I.clientX,y:I.clientY,onClose(){V(),D(),O.current&&!b()&&B===t.select("domReferenceElement")&&P(I,!0)}}),k.addEventListener("mousemove",l.handler),l.handler(I);return}(l.pointerType!=="touch"||!me(t.select("floatingElement"),I.relatedTarget))&&P(I)}return c&&F.addEventListener("mousemove",N,{once:!0}),F.addEventListener("mouseenter",N),F.addEventListener("mouseleave",A),()=>{c&&F.removeEventListener("mousemove",N),F.removeEventListener("mouseenter",N),F.removeEventListener("mouseleave",A)}},[D,V,o,v,P,t,s,y,l,x,C,b,f,p,c,E,g,m,O,d]),u.useMemo(()=>{if(!s)return;function F(N){l.pointerType=N.pointerType}return{onPointerDown:F,onPointerEnter:F,onMouseMove(N){const{nativeEvent:A}=N,I=N.currentTarget,w=t.select("domReferenceElement"),k=t.select("open"),T=C(w,I,N.target);if(p&&!it(l.pointerType))return;const S=yn(E.current);if(k&&!T||S===0||!T&&l.restTimeoutPending&&N.movementX**2+N.movementY**2<2)return;l.restTimeout.clear();function L(){if(l.restTimeoutPending=!1,b())return;const B=t.select("open");!l.blockMouseMove&&(!B||T)&&t.setOpen(!0,re(Se,A,I))}l.pointerType==="touch"?kt.flushSync(()=>{L()}):T&&k?L():(l.restTimeoutPending=!0,l.restTimeout.start(S,L))}}},[s,l,b,C,p,t,E])}const Ds="Escape";function Vt(e,n,t){switch(e){case"vertical":return n;case"horizontal":return t;default:return n||t}}function Rt(e,n){return Vt(n,e===zn||e===Nt,e===gt||e===pt)}function Gt(e,n,t){return Vt(n,e===Nt,t?e===gt:e===pt)||e==="Enter"||e===" "||e===""}function Ns(e,n,t){return Vt(n,t?e===gt:e===pt,e===Nt)}function Hs(e,n,t,o){const r=t?e===pt:e===gt,s=e===zn;return n==="both"||n==="horizontal"&&o&&o>1?e===Ds:Vt(n,r,s)}function Bs(e,n){const t="rootStore"in e?e.rootStore:e,o=t.useState("open"),r=t.useState("floatingElement"),s=t.useState("domReferenceElement"),a=t.context.dataRef,{listRef:i,activeIndex:p,onNavigate:h=()=>{},enabled:c=!0,selectedIndex:g=null,allowEscape:R=!1,loopFocus:x=!1,nested:d=!1,rtl:m=!1,virtual:l=!1,focusItemOnOpen:y="auto",focusItemOnHover:v=!0,openOnArrowKeyDown:E=!0,disabledIndices:O=void 0,orientation:b="vertical",parentOrientation:f,cols:C=1,id:P,resetOnPointerLeave:D=!0,externalTree:V}=n,F=_o(r),N=Me(F),A=ft(),I=dt(V);Z(()=>{a.current.orientation=b},[a,b]);const w=Wo(s),k=u.useRef(y),T=u.useRef(g??-1),S=u.useRef(null),L=u.useRef(!0),B=se(M=>{h(T.current===-1?null:T.current,M)}),ee=u.useRef(B),le=u.useRef(!!r),ue=u.useRef(o),j=u.useRef(!1),K=u.useRef(!1),_=Me(O),G=Me(o),te=Me(g),ne=Me(D),$=se(()=>{function M(X){l?I?.events.emit("virtualfocus",X):gn(X,{sync:j.current,preventScroll:!0})}const W=i.current[T.current],H=K.current;W&&M(W),(j.current?X=>X():requestAnimationFrame)(()=>{const X=i.current[T.current]||W;if(!X)return;W||M(X),fe&&(H||!L.current)&&X.scrollIntoView?.({block:"nearest",inline:"nearest"})})});Z(()=>{c&&(o&&r?(T.current=g??-1,k.current&&g!=null&&(K.current=!0,B())):le.current&&(T.current=-1,ee.current()))},[c,o,r,g,B]),Z(()=>{if(c){if(!o){j.current=!1;return}if(r)if(p==null){if(j.current=!1,te.current!=null)return;if(le.current&&(T.current=-1,$()),(!ue.current||!le.current)&&k.current&&(S.current!=null||k.current===!0&&S.current==null)){let M=0;const W=()=>{i.current[0]==null?(M<2&&(M?requestAnimationFrame:queueMicrotask)(W),M+=1):(T.current=S.current==null||Gt(S.current,b,m)||d?Yt(i):mn(i),S.current=null,B())};W()}}else pn(i,p)||(T.current=p,$(),K.current=!1)}},[c,o,r,p,te,d,i,b,m,B,$,_]),Z(()=>{if(!c||r||!I||l||!le.current)return;const M=I.nodesRef.current,W=M.find(X=>X.id===A)?.context?.elements.floating,H=ot(ke(r)),oe=M.some(X=>X.context&&me(X.context.elements.floating,H));W&&!oe&&L.current&&W.focus({preventScroll:!0})},[c,r,I,A,l]),Z(()=>{ee.current=B,ue.current=o,le.current=!!r}),Z(()=>{o||(S.current=null,k.current=y)},[o,y]);const ie=p!=null,fe=u.useMemo(()=>{function M(H){if(!G.current)return;const oe=i.current.indexOf(H.currentTarget);oe!==-1&&T.current!==oe&&(T.current=oe,B(H))}return{onFocus(H){j.current=!0,M(H)},onClick:({currentTarget:H})=>H.focus({preventScroll:!0}),onMouseMove(H){j.current=!0,K.current=!1,v&&M(H)},onPointerLeave(H){if(!G.current||!L.current||H.pointerType==="touch")return;j.current=!0;const oe=H.relatedTarget;if(!(!v||i.current.includes(oe))&&ne.current&&(gn(null,{sync:!0}),T.current=-1,B(H),!l)){const X=N.current,ce=ot(ke(X));X&&me(X,ce)&&X.focus({preventScroll:!0})}}}},[G,N,v,i,B,ne,l]),be=u.useCallback(()=>f??I?.nodesRef.current.find(M=>M.id===A)?.context?.dataRef?.current.orientation,[A,I,f]),he=se(M=>{if(L.current=!1,j.current=!0,M.which===229||!G.current&&M.currentTarget===N.current)return;if(d&&Hs(M.key,b,m,C)){Rt(M.key,be())||Be(M),t.setOpen(!1,re(Ct,M.nativeEvent)),Ae(s)&&(l?I?.events.emit("virtualfocus",s):s.focus());return}const W=T.current,H=Yt(i,O),oe=mn(i,O);if(w||(M.key==="Home"&&(Be(M),T.current=H,B(M)),M.key==="End"&&(Be(M),T.current=oe,B(M))),C>1){const X=Array.from({length:i.current.length},()=>({width:1,height:1})),ce=$o(X,C),Fe=ce.findIndex(Ee=>Ee!=null&&!zt(i,Ee,O)),Ne=ce.reduce((Ee,Le,Ye)=>Le!=null&&!zt(i,Le,O)?Ye:Ee,-1),He=ce[Uo({current:ce.map(Ee=>Ee!=null?i.current[Ee]:null)},{event:M,orientation:b,loopFocus:x,rtl:m,cols:C,disabledIndices:zo([...(typeof O!="function"?O:null)||i.current.map((Ee,Le)=>zt(i,Le,O)?Le:void 0),void 0],ce),minIndex:Fe,maxIndex:Ne,prevIndex:Yo(T.current>oe?H:T.current,X,ce,C,M.key===Nt?"bl":M.key===(m?gt:pt)?"tr":"tl"),stopEvent:!0})];if(He!=null&&(T.current=He,B(M)),b==="both")return}if(Rt(M.key,b)){if(Be(M),o&&!l&&ot(M.currentTarget.ownerDocument)===M.currentTarget){T.current=Gt(M.key,b,m)?H:oe,B(M);return}Gt(M.key,b,m)?x?W>=oe?R&&W!==i.current.length?T.current=-1:(j.current=!1,T.current=H):T.current=yt(i,{startingIndex:W,disabledIndices:O}):T.current=Math.min(oe,yt(i,{startingIndex:W,disabledIndices:O})):x?W<=H?R&&W!==-1?T.current=i.current.length:(j.current=!1,T.current=oe):T.current=yt(i,{startingIndex:W,decrement:!0,disabledIndices:O}):T.current=Math.max(H,yt(i,{startingIndex:W,decrement:!0,disabledIndices:O})),pn(i,T.current)&&(T.current=-1),B(M)}}),de=u.useMemo(()=>l&&o&&ie&&{"aria-activedescendant":`${P}-${p}`},[l,o,ie,P,p]),xe=u.useMemo(()=>({"aria-orientation":b==="both"?void 0:b,...w?{}:de,onKeyDown(M){if(M.key==="Tab"&&M.shiftKey&&o&&!l){const W=Dt(M.nativeEvent);if(W&&!me(N.current,W))return;Be(M),t.setOpen(!1,re(At,M.nativeEvent)),Ae(s)&&s.focus();return}he(M)},onPointerMove(){L.current=!0}}),[de,he,N,b,w,t,o,l,s]),z=u.useMemo(()=>{function M(H){y==="auto"&&Ko(H.nativeEvent)&&(k.current=!l)}function W(H){k.current=y,y==="auto"&&Xo(H.nativeEvent)&&(k.current=!0)}return{onKeyDown(H){const oe=t.select("open");L.current=!1;const X=H.key.startsWith("Arrow"),ce=Ns(H.key,be(),m),Fe=Rt(H.key,b),Ne=(d?ce:Fe)||H.key==="Enter"||H.key.trim()==="";if(l&&oe)return he(H);if(!(!oe&&!E&&X)){if(Ne){const He=Rt(H.key,be());S.current=d&&He?null:H.key}if(d){ce&&(Be(H),oe?(T.current=Yt(i,_.current),B(H)):t.setOpen(!0,re(Ct,H.nativeEvent,H.currentTarget)));return}Fe&&(te.current!=null&&(T.current=te.current),Be(H),!oe&&E?t.setOpen(!0,re(Ct,H.nativeEvent,H.currentTarget)):he(H),oe&&B(H))}},onFocus(H){t.select("open")&&!l&&(T.current=-1,B(H))},onPointerDown:W,onPointerEnter:W,onMouseDown:M,onClick:M}},[he,_,y,i,d,B,t,E,b,be,m,te,l]),U=u.useMemo(()=>({...de,...z}),[de,z]);return u.useMemo(()=>c?{reference:U,floating:xe,item:fe,trigger:z}:{},[c,U,xe,z,fe])}function Vs(e,n){const t="rootStore"in e?e.rootStore:e,o=t.context.dataRef,r=t.useState("open"),{listRef:s,elementsRef:a,activeIndex:i,onMatch:p,onTypingChange:h,enabled:c=!0,resetMs:g=750,selectedIndex:R=null}=n,x=_e(),d=u.useRef(""),m=u.useRef(R??i??-1),l=u.useRef(null);Z(()=>{!r&&R!==null||(x.clear(),l.current=null,d.current!==""&&(d.current=""))},[r,R,x]),Z(()=>{r&&d.current===""&&(m.current=R??i??-1)},[r,R,i]);const y=se(f=>{f?o.current.typing||(o.current.typing=f,h?.(f)):o.current.typing&&(o.current.typing=f,h?.(f))}),v=se(f=>{function C(w){const k=a?.current[w];return!k||jo(k)}function P(w,k,T=0){if(w.length===0)return-1;const S=(T%w.length+w.length)%w.length,L=k.toLocaleLowerCase();for(let B=0;B<w.length;B+=1){const ee=(S+B)%w.length;if(!(!w[ee]?.toLocaleLowerCase().startsWith(L)||!C(ee)))return ee}return-1}const D=s.current;if(d.current.length>0&&f.key===" "&&(Be(f),y(!0)),d.current.length>0&&d.current[0]!==" "&&P(D,d.current)===-1&&f.key!==" "&&y(!1),D==null||f.key.length!==1||f.ctrlKey||f.metaKey||f.altKey)return;r&&f.key!==" "&&(Be(f),y(!0));const V=d.current==="";V&&(m.current=R??i??-1),D.every(w=>w?w[0]?.toLocaleLowerCase()!==w[1]?.toLocaleLowerCase():!0)&&d.current===f.key&&(d.current="",m.current=l.current),d.current+=f.key,x.start(g,()=>{d.current="",m.current=l.current,y(!1)});const A=((V?R??i??-1:m.current)??0)+1,I=P(D,d.current,A);I!==-1?(p?.(I),l.current=I):f.key!==" "&&(d.current="",y(!1))}),E=se(f=>{const C=f.relatedTarget,P=t.select("domReferenceElement"),D=t.select("floatingElement"),V=me(P,C),F=me(D,C);V||F||(x.clear(),d.current="",m.current=l.current,y(!1))}),O=u.useMemo(()=>({onKeyDown:v,onBlur:E}),[v,E]),b=u.useMemo(()=>({onKeyDown:v,onBlur:E}),[v,E]);return u.useMemo(()=>c?{reference:O,floating:b}:{},[c,O,b])}const Sn=.1,_s=Sn*Sn,J=.5;function vt(e,n,t,o,r,s){return o>=n!=s>=n&&e<=(r-t)*(n-o)/(s-o)+t}function bt(e,n,t,o,r,s,a,i,p,h){let c=!1;return vt(e,n,t,o,r,s)&&(c=!c),vt(e,n,r,s,a,i)&&(c=!c),vt(e,n,a,i,p,h)&&(c=!c),vt(e,n,p,h,t,o)&&(c=!c),c}function Ws(e,n,t){return e>=t.x&&e<=t.x+t.width&&n>=t.y&&n<=t.y+t.height}function Et(e,n,t,o,r,s){const a=Math.min(t,r),i=Math.max(t,r),p=Math.min(o,s),h=Math.max(o,s);return e>=a&&e<=i&&n>=p&&n<=h}function $s(e={}){const{blockPointerEvents:n=!1}=e,t=new en,o=({x:r,y:s,placement:a,elements:i,onClose:p,nodeId:h,tree:c})=>{const g=a?.split("-")[0];let R=!1,x=null,d=null,m=typeof performance<"u"?performance.now():0;function l(v,E){const O=performance.now(),b=O-m;if(x===null||d===null||b===0)return x=v,d=E,m=O,!1;const f=v-x,C=E-d,P=f*f+C*C,D=b*b*_s;return x=v,d=E,m=O,P<D}function y(){t.clear(),p()}return function(E){t.clear();const O=i.domReference,b=i.floating;if(!O||!b||g==null||r==null||s==null)return;const{clientX:f,clientY:C}=E,P=Dt(E),D=E.type==="mouseleave",V=me(b,P),F=me(O,P);if(V&&(R=!0,!D))return;if(F&&(R=!1,!D)){R=!0;return}if(D&&ae(E.relatedTarget)&&me(b,E.relatedTarget))return;function N(){return!!(c&&tn(c.nodesRef.current,h).length>0)}function A(){N()||y()}if(N())return;const I=O.getBoundingClientRect(),w=b.getBoundingClientRect(),k=r>w.right-w.width/2,T=s>w.bottom-w.height/2,S=w.width>I.width,L=w.height>I.height,B=(S?I:w).left,ee=(S?I:w).right,le=(L?I:w).top,ue=(L?I:w).bottom;if(g==="top"&&s>=I.bottom-1||g==="bottom"&&s<=I.top+1||g==="left"&&r>=I.right-1||g==="right"&&r<=I.left+1){A();return}let j=!1;switch(g){case"top":j=Et(f,C,B,I.top+1,ee,w.bottom-1);break;case"bottom":j=Et(f,C,B,w.top+1,ee,I.bottom-1);break;case"left":j=Et(f,C,w.right-1,ue,I.left+1,le);break;case"right":j=Et(f,C,I.right-1,ue,w.left+1,le);break}if(j)return;if(R&&!Ws(f,C,I)){A();return}if(!D&&l(f,C)){A();return}let K=!1;switch(g){case"top":{const _=S?J/2:J*4,G=S||k?r+_:r-_,te=S?r-_:k?r+_:r-_,ne=s+J+1,$=k||S?w.bottom-J:w.top,ie=k?S?w.bottom-J:w.top:w.bottom-J;K=bt(f,C,G,ne,te,ne,w.left,$,w.right,ie);break}case"bottom":{const _=S?J/2:J*4,G=S||k?r+_:r-_,te=S?r-_:k?r+_:r-_,ne=s-J,$=k||S?w.top+J:w.bottom,ie=k?S?w.top+J:w.bottom:w.top+J;K=bt(f,C,G,ne,te,ne,w.left,$,w.right,ie);break}case"left":{const _=L?J/2:J*4,G=L||T?s+_:s-_,te=L?s-_:T?s+_:s-_,ne=r+J+1,$=T||L?w.right-J:w.left,ie=T?L?w.right-J:w.left:w.right-J;K=bt(f,C,$,w.top,ie,w.bottom,ne,G,ne,te);break}case"right":{const _=L?J/2:J*4,G=L||T?s+_:s-_,te=L?s-_:T?s+_:s-_,ne=r-J,$=T||L?w.left+J:w.right,ie=T?L?w.left+J:w.right:w.left+J;K=bt(f,C,ne,G,ne,te,$,w.top,ie,w.bottom);break}}K?R||t.start(40,A):A()}};return o.__options={blockPointerEvents:n},o}const Us=u.createContext(void 0);function Ys(e){return u.useContext(Us)}function go(e){return e==="starting"?Go:Je}const zs={...Kn,...Zo},Ri=u.forwardRef(function(n,t){const{render:o,className:r,finalFocus:s,...a}=n,{store:i}=je(),{side:p,align:h}=Jn(),c=Ys()!=null,g=i.useState("open"),R=i.useState("transitionStatus"),x=i.useState("popupProps"),d=i.useState("mounted"),m=i.useState("instantType"),l=i.useState("activeTriggerElement"),y=i.useState("parent"),v=i.useState("lastOpenChangeReason"),E=i.useState("rootId"),O=i.useState("floatingRootContext"),b=i.useState("floatingTreeRoot"),f=i.useState("closeDelay"),C=i.useState("activeTriggerElement"),P=y.type==="context-menu";qo({open:g,ref:i.context.popupRef,onComplete(){g&&i.context.onOpenChangeComplete?.(!0)}}),u.useEffect(()=>{function w(k){i.setOpen(!1,re(k.reason,k.domEvent))}return b.events.on("close",w),()=>{b.events.off("close",w)}},[b.events,i]);const D=i.useState("hoverEnabled"),V=i.useState("disabled");ks(O,{enabled:D&&!V&&!P&&y.type!=="menubar",closeDelay:f});const F={transitionStatus:R,side:p,align:h,open:g,nested:y.type==="menu",instant:m},N=u.useCallback(w=>{i.set("popupElement",w)},[i]),A=ut("div",n,{state:F,ref:[t,i.context.popupRef,N],stateAttributesMapping:zs,props:[x,{onKeyDown(w){c&&er.has(w.key)&&w.stopPropagation()}},go(R),a,{"data-rootownerid":E}]});let I=y.type===void 0||P;return(l||y.type==="menubar"&&v!==Qo)&&(I=!0),ve.jsx(Jo,{context:O,modal:P,disabled:!d,returnFocus:s===void 0?I:s,initialFocus:y.type!=="menu",restoreFocus:!0,externalTree:y.type!=="menubar"?b:void 0,previousFocusableElement:C,nextFocusableElement:y.type===void 0?i.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:y.type===void 0?i.context.beforeContentFocusGuardRef:void 0,children:A})}),po=u.createContext(void 0);function Ks(){const e=u.useContext(po);if(e===void 0)throw new Error(lt(32));return e}const vi=u.forwardRef(function(n,t){const{keepMounted:o=!1,...r}=n,{store:s}=je();return s.useState("mounted")||o?ve.jsx(po.Provider,{value:o,children:ve.jsx(tr,{ref:t,...r})}):null}),Xs=u.createContext(void 0);function mo(){return u.useContext(Xs)?.direction??"ltr"}const js=e=>({name:"arrow",options:e,async fn(n){const{x:t,y:o,placement:r,rects:s,platform:a,elements:i,middlewareData:p}=n,{element:h,padding:c=0,offsetParent:g="real"}=We(e,n)||{};if(h==null)return{};const R=Hn(c),x={x:t,y:o},d=Nn(r),m=Bn(d),l=await a.getDimensions(h),y=d==="y",v=y?"top":"left",E=y?"bottom":"right",O=y?"clientHeight":"clientWidth",b=s.reference[m]+s.reference[d]-x[d]-s.floating[m],f=x[d]-s.reference[d],C=g==="real"?await a.getOffsetParent?.(h):i.floating;let P=i.floating[O]||s.floating[m];(!P||!await a.isElement?.(C))&&(P=i.floating[O]||s.floating[m]);const D=b/2-f/2,V=P/2-l[m]/2-1,F=Math.min(R[v],V),N=Math.min(R[E],V),A=F,I=P-l[m]-N,w=P/2-l[m]/2+D,k=Jt(A,w,I),T=!p.arrow&&Ze(r)!=null&&w!==k&&s.reference[m]/2-(w<A?F:N)-l[m]/2<0,S=T?w<A?w-A:w-I:0;return{[d]:x[d]+S,data:{[d]:k,centerOffset:w-k-S,...T&&{alignmentOffset:S}},reset:T}}}),Gs=(e,n)=>({...js(e),options:[e,n]}),qs={name:"hide",async fn(e){const{width:n,height:t,x:o,y:r}=e.rects.reference,s=n===0&&t===0&&o===0&&r===0;return{data:{referenceHidden:(await Os().fn(e)).data?.referenceHidden||s}}}},St={sideX:"left",sideY:"top"},Qs={name:"adaptiveOrigin",async fn(e){const{x:n,y:t,rects:{floating:o},elements:{floating:r},platform:s,strategy:a,placement:i}=e,p=Ve(r),h=p.getComputedStyle(r);if(!(h.transitionDuration!=="0s"&&h.transitionDuration!==""))return{x:n,y:t,data:St};const g=await s.getOffsetParent?.(r);let R={width:0,height:0};if(a==="fixed"&&p?.visualViewport)R={width:p.visualViewport.width,height:p.visualViewport.height};else if(g===p){const v=ke(r);R={width:v.documentElement.clientWidth,height:v.documentElement.clientHeight}}else await s.isElement?.(g)&&(R=await s.getDimensions(g));const x=Pe(i);let d=n,m=t;x==="left"&&(d=R.width-(n+o.width)),x==="top"&&(m=R.height-(t+o.height));const l=x==="left"?"right":St.sideX,y=x==="top"?"bottom":St.sideY;return{x:d,y:m,data:{sideX:l,sideY:y}}}};function ho(e,n,t){const o=e==="inline-start"||e==="inline-end";return{top:"top",right:o?t?"inline-start":"inline-end":"right",bottom:"bottom",left:o?t?"inline-end":"inline-start":"left"}[n]}function Mn(e,n,t){const{rects:o,placement:r}=e;return{side:ho(n,Pe(r),t),align:Ze(r)||"center",anchor:{width:o.reference.width,height:o.reference.height},positioner:{width:o.floating.width,height:o.floating.height}}}function Js(e){const{anchor:n,positionMethod:t="absolute",side:o="bottom",sideOffset:r=0,align:s="center",alignOffset:a=0,collisionBoundary:i,collisionPadding:p=5,sticky:h=!1,arrowPadding:c=5,disableAnchorTracking:g=!1,keepMounted:R=!1,floatingRootContext:x,mounted:d,collisionAvoidance:m,shiftCrossAxis:l=!1,nodeId:y,adaptiveOrigin:v,lazyFlip:E=!1,externalTree:O}=e,[b,f]=u.useState(null);!d&&b!==null&&f(null);const C=m.side||"flip",P=m.align||"flip",D=m.fallbackAxisSide||"end",V=typeof n=="function"?n:void 0,F=se(V),N=V?F:n,A=Me(n),w=mo()==="rtl",k=b||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":w?"left":"right","inline-start":w?"right":"left"}[o],T=s==="center"?k:`${k}-${s}`;let S=p;const L=1,B=o==="bottom"?L:0,ee=o==="top"?L:0,le=o==="right"?L:0,ue=o==="left"?L:0;typeof S=="number"?S={top:S+B,right:S+ue,bottom:S+ee,left:S+le}:S&&(S={top:(S.top||0)+B,right:(S.right||0)+ue,bottom:(S.bottom||0)+ee,left:(S.left||0)+le});const j={boundary:i==="clipping-ancestors"?"clippingAncestors":i,padding:S},K=u.useRef(null),_=Me(r),G=Me(a),$=[vs(Q=>{const ye=Mn(Q,o,w),Ce=typeof _.current=="function"?_.current(ye):_.current,Re=typeof G.current=="function"?G.current(ye):G.current;return{mainAxis:Ce,crossAxis:Re,alignmentAxis:Re}},[typeof r!="function"?r:0,typeof a!="function"?a:0,w,o])],ie=P==="none"&&C!=="shift",fe=!ie&&(h||l||C==="shift"),be=C==="none"?null:ws({...j,padding:{top:S.top+L,right:S.right+L,bottom:S.bottom+L,left:S.left+L},mainAxis:!l&&C==="flip",crossAxis:P==="flip"?"alignment":!1,fallbackAxisSideDirection:D}),he=ie?null:bs(Q=>{const ye=ke(Q.elements.floating).documentElement;return{...j,rootBoundary:l?{x:0,y:0,width:ye.clientWidth,height:ye.clientHeight}:void 0,mainAxis:P!=="none",crossAxis:fe,limiter:h||l?void 0:Es(Ce=>{if(!K.current)return{};const{width:Re,height:Oe}=K.current.getBoundingClientRect(),we=Ie(Pe(Ce.placement)),Ke=we==="y"?Re:Oe,Ge=we==="y"?S.left+S.right:S.top+S.bottom;return{offset:Ke/2+Ge/2}})}},[j,h,l,S,P]);C==="shift"||P==="shift"||s==="center"?$.push(he,be):$.push(be,he),$.push(Cs({...j,apply({elements:{floating:Q},availableWidth:ye,availableHeight:Ce,rects:Re}){const Oe=Q.style;Oe.setProperty("--available-width",`${ye}px`),Oe.setProperty("--available-height",`${Ce}px`);const we=window.devicePixelRatio||1,{x:Ke,y:Ge,width:ht,height:_t}=Re.reference,Wt=(Math.round((Ke+ht)*we)-Math.round(Ke*we))/we,$t=(Math.round((Ge+_t)*we)-Math.round(Ge*we))/we;Oe.setProperty("--anchor-width",`${Wt}px`),Oe.setProperty("--anchor-height",`${$t}px`)}}),Gs(()=>({element:K.current||document.createElement("div"),padding:c,offsetParent:"floating"}),[c]),{name:"transformOrigin",fn(Q){const{elements:ye,middlewareData:Ce,placement:Re,rects:Oe,y:we}=Q,Ke=Pe(Re),Ge=Ie(Ke),ht=K.current,_t=Ce.arrow?.x||0,Wt=Ce.arrow?.y||0,$t=ht?.clientWidth||0,Ro=ht?.clientHeight||0,Ut=_t+$t/2,fn=Wt+Ro/2,vo=Math.abs(Ce.shift?.y||0),bo=Oe.reference.height/2,tt=typeof r=="function"?r(Mn(Q,o,w)):r,Eo=vo>tt,wo={top:`${Ut}px calc(100% + ${tt}px)`,bottom:`${Ut}px ${-tt}px`,left:`calc(100% + ${tt}px) ${fn}px`,right:`${-tt}px ${fn}px`}[Ke],Co=`${Ut}px ${Oe.reference.y+bo-we}px`;return ye.floating.style.setProperty("--transform-origin",fe&&Ge==="y"&&Eo?Co:wo),{}}},qs,v),Z(()=>{!d&&x&&x.update({referenceElement:null,floatingElement:null,domReferenceElement:null})},[d,x]);const de=u.useMemo(()=>({elementResize:!g&&typeof ResizeObserver<"u",layoutShift:!g&&typeof IntersectionObserver<"u"}),[g]),{refs:xe,elements:z,x:U,y:M,middlewareData:W,update:H,placement:oe,context:X,isPositioned:ce,floatingStyles:Fe}=Ss({rootContext:x,placement:T,middleware:$,strategy:t,whileElementsMounted:R?void 0:(...Q)=>On(...Q,de),nodeId:y,externalTree:O}),{sideX:Ne,sideY:He}=W.adaptiveOrigin||St,Ee=ce?t:"fixed",Le=u.useMemo(()=>{const Q=v?{position:Ee,[Ne]:U,[He]:M}:{position:Ee,...Fe};return ce||(Q.opacity=0),Q},[v,Ee,Ne,U,He,M,Fe,ce]),Ye=u.useRef(null);Z(()=>{if(!d)return;const Q=A.current,ye=typeof Q=="function"?Q():Q,Re=(Pn(ye)?ye.current:ye)||null||null;Re!==Ye.current&&(xe.setPositionReference(Re),Ye.current=Re)},[d,xe,N,A]),u.useEffect(()=>{if(!d)return;const Q=A.current;typeof Q!="function"&&Pn(Q)&&Q.current!==Ye.current&&(xe.setPositionReference(Q.current),Ye.current=Q.current)},[d,xe,N,A]),u.useEffect(()=>{if(R&&d&&z.domReference&&z.floating)return On(z.domReference,z.floating,H,de)},[R,d,z,H,de]);const ze=Pe(oe),et=ho(o,ze,w),Y=Ze(oe)||"center",q=!!W.hide?.referenceHidden;Z(()=>{E&&d&&ce&&f(ze)},[E,d,ce,ze]);const pe=u.useMemo(()=>({position:"absolute",top:W.arrow?.y,left:W.arrow?.x}),[W.arrow]),mt=W.arrow?.centerOffset!==0;return u.useMemo(()=>({positionerStyles:Le,arrowStyles:pe,arrowRef:K,arrowUncentered:mt,side:et,align:Y,physicalSide:ze,anchorHidden:q,refs:xe,context:X,isPositioned:ce,update:H}),[Le,pe,K,mt,et,Y,ze,q,xe,X,ce,H])}function Pn(e){return e!=null&&"current"in e}function Zs(e){const{children:n,elementsRef:t,labelsRef:o,onMapChange:r}=e,s=se(r),a=u.useRef(0),i=st(ti).current,p=st(ei).current,[h,c]=u.useState(0),g=u.useRef(h),R=se((y,v)=>{p.set(y,v??null),g.current+=1,c(g.current)}),x=se(y=>{p.delete(y),g.current+=1,c(g.current)}),d=u.useMemo(()=>{const y=new Map;return Array.from(p.keys()).filter(E=>E.isConnected).sort(ni).forEach((E,O)=>{const b=p.get(E)??{};y.set(E,{...b,index:O})}),y},[p,h]);Z(()=>{if(typeof MutationObserver!="function"||d.size===0)return;const y=new MutationObserver(v=>{const E=new Set,O=b=>E.has(b)?E.delete(b):E.add(b);v.forEach(b=>{b.removedNodes.forEach(O),b.addedNodes.forEach(O)}),E.size===0&&(g.current+=1,c(g.current))});return d.forEach((v,E)=>{E.parentElement&&y.observe(E.parentElement,{childList:!0})}),()=>{y.disconnect()}},[d]),Z(()=>{g.current===h&&(t.current.length!==d.size&&(t.current.length=d.size),o&&o.current.length!==d.size&&(o.current.length=d.size),a.current=d.size),s(d)},[s,d,t,o,h]),Z(()=>()=>{t.current=[]},[t]),Z(()=>()=>{o&&(o.current=[])},[o]);const m=se(y=>(i.add(y),()=>{i.delete(y)}));Z(()=>{i.forEach(y=>y(d))},[i,d]);const l=u.useMemo(()=>({register:R,unregister:x,subscribeMapChange:m,elementsRef:t,labelsRef:o,nextIndexRef:a}),[R,x,m,t,o,a]);return ve.jsx(eo.Provider,{value:l,children:n})}function ei(){return new Map}function ti(){return new Set}function ni(e,n){const t=e.compareDocumentPosition(n);return t&Node.DOCUMENT_POSITION_FOLLOWING||t&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:t&Node.DOCUMENT_POSITION_PRECEDING||t&Node.DOCUMENT_POSITION_CONTAINS?1:0}const bi=u.forwardRef(function(n,t){const{anchor:o,positionMethod:r="absolute",className:s,render:a,side:i,align:p,sideOffset:h=0,alignOffset:c=0,collisionBoundary:g="clipping-ancestors",collisionPadding:R=5,arrowPadding:x=5,sticky:d=!1,disableAnchorTracking:m=!1,collisionAvoidance:l=nr,...y}=n,{store:v}=je(),E=Ks(),O=Ht(!0),b=v.useState("parent"),f=v.useState("floatingRootContext"),C=v.useState("floatingTreeRoot"),P=v.useState("mounted"),D=v.useState("open"),V=v.useState("modal"),F=v.useState("activeTriggerElement"),N=v.useState("transitionStatus"),A=v.useState("positionerElement"),I=v.useState("instantType"),w=v.useState("hasViewport"),k=v.useState("lastOpenChangeReason"),T=v.useState("floatingNodeId"),S=v.useState("floatingParentNodeId"),L=f.useState("domReferenceElement"),B=u.useRef(null),ee=or(A,!1,!1);let le=o,ue=h,j=c,K=p,_=l;b.type==="context-menu"&&(le=o??b.context?.anchor,K=K??"start",!i&&K!=="center"&&(j=n.alignOffset??2,ue=n.sideOffset??-5));let G=i,te=K;b.type==="menu"?(G=G??"inline-end",te=te??"start",_=n.collisionAvoidance??rr):b.type==="menubar"&&(G=G??"bottom",te=te??"start");const ne=b.type==="context-menu",$=Js({anchor:le,floatingRootContext:f,positionMethod:O?"fixed":r,mounted:P,side:G,sideOffset:ue,align:te,alignOffset:j,arrowPadding:ne?0:x,collisionBoundary:g,collisionPadding:R,sticky:d,nodeId:T,keepMounted:E,disableAnchorTracking:m,collisionAvoidance:_,shiftCrossAxis:ne&&!("side"in _&&_.side==="flip"),externalTree:C,adaptiveOrigin:w?Qs:void 0}),ie=u.useMemo(()=>{const U={};return D||(U.pointerEvents="none"),{role:"presentation",hidden:!P,style:{...$.positionerStyles,...U}}},[D,P,$.positionerStyles]);u.useEffect(()=>{function U(M){M.open&&(M.parentNodeId===T&&v.set("hoverEnabled",!1),M.nodeId!==T&&M.parentNodeId===v.select("floatingParentNodeId")&&v.setOpen(!1,re(nt)))}return C.events.on("menuopenchange",U),()=>{C.events.off("menuopenchange",U)}},[v,C.events,T]),u.useEffect(()=>{if(v.select("floatingParentNodeId")==null)return;function U(M){if(M.open||M.nodeId!==v.select("floatingParentNodeId"))return;const W=M.reason??nt;v.setOpen(!1,re(W))}return C.events.on("menuopenchange",U),()=>{C.events.off("menuopenchange",U)}},[C.events,v]);const fe=_e();u.useEffect(()=>{D||fe.clear()},[D,fe]),u.useEffect(()=>{function U(M){if(!(!D||M.nodeId!==v.select("floatingParentNodeId")))if(M.target&&F&&F!==M.target){const W=v.select("closeDelay");W>0?fe.isStarted()||fe.start(W,()=>{v.setOpen(!1,re(nt))}):v.setOpen(!1,re(nt))}else fe.clear()}return C.events.on("itemhover",U),()=>{C.events.off("itemhover",U)}},[C.events,D,F,v,fe]),u.useEffect(()=>{const U={open:D,nodeId:T,parentNodeId:S,reason:v.select("lastOpenChangeReason")};C.events.emit("menuopenchange",U)},[C.events,D,v,T,S]),Z(()=>{const U=L,M=B.current;if(U&&(B.current=U),M&&U&&U!==M){v.set("instantType",void 0);const W=new AbortController;return ee(()=>{v.set("instantType","trigger-change")},W.signal),()=>{W.abort()}}},[L,ee,v]);const be={open:D,side:$.side,align:$.align,anchorHidden:$.anchorHidden,nested:b.type==="menu",instant:I},he=u.useMemo(()=>({side:$.side,align:$.align,arrowRef:$.arrowRef,arrowUncentered:$.arrowUncentered,arrowStyles:$.arrowStyles,nodeId:$.context.nodeId}),[$.side,$.align,$.arrowRef,$.arrowUncentered,$.arrowStyles,$.context.nodeId]),de=ut("div",n,{state:be,stateAttributesMapping:Kn,ref:[t,v.useStateSetter("positionerElement")],props:[ie,go(N),y]}),xe=P&&b.type!=="menu"&&(b.type!=="menubar"&&V&&k!==Se||b.type==="menubar"&&b.context.modal);let z=null;return b.type==="menubar"?z=b.context.contentElement:b.type===void 0&&(z=F),ve.jsxs(Qn.Provider,{value:he,children:[xe&&ve.jsx(sr,{ref:b.type==="context-menu"||b.type==="nested-context-menu"?b.context.internalBackdropRef:null,inert:ir(!D),cutout:z}),ve.jsx(cr,{id:T,children:ve.jsx(Zs,{elementsRef:v.context.itemDomElements,labelsRef:v.context.itemLabels,children:de})})]})}),oi=u.createContext(null);function xo(e){return u.useContext(oi)}const ri={...lr,disabled:ge(e=>e.parent.type==="menubar"&&e.parent.context.disabled||e.disabled),modal:ge(e=>(e.parent.type===void 0||e.parent.type==="context-menu")&&(e.modal??!0)),allowMouseEnter:ge(e=>e.allowMouseEnter),stickIfOpen:ge(e=>e.stickIfOpen),parent:ge(e=>e.parent),rootId:ge(e=>e.parent.type==="menu"?e.parent.store.select("rootId"):e.parent.type!==void 0?e.parent.context.rootId:e.rootId),activeIndex:ge(e=>e.activeIndex),isActive:ge((e,n)=>e.activeIndex===n),hoverEnabled:ge(e=>e.hoverEnabled),instantType:ge(e=>e.instantType),lastOpenChangeReason:ge(e=>e.openChangeReason),floatingTreeRoot:ge(e=>e.parent.type==="menu"?e.parent.store.select("floatingTreeRoot"):e.floatingTreeRoot),floatingNodeId:ge(e=>e.floatingNodeId),floatingParentNodeId:ge(e=>e.floatingParentNodeId),itemProps:ge(e=>e.itemProps),closeDelay:ge(e=>e.closeDelay),hasViewport:ge(e=>e.hasViewport),keyboardEventRelay:ge(e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type==="menu")return e.parent.store.select("keyboardEventRelay")})};class un extends ar{constructor(n){super({...si(),...n},{positionerRef:u.createRef(),popupRef:u.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:u.createRef(),beforeContentFocusGuardRef:u.createRef(),onOpenChangeComplete:void 0,triggerElements:new Un},ri),this.unsubscribeParentListener=this.observe("parent",t=>{if(this.unsubscribeParentListener?.(),t.type==="menu"){let o=t.store.select("rootId"),r=t.store.select("floatingTreeRoot"),s=t.store.select("keyboardEventRelay");this.unsubscribeParentListener=t.store.subscribe(()=>{const a=t.store.select("rootId"),i=t.store.select("floatingTreeRoot"),p=t.store.select("keyboardEventRelay");o===a&&r===i&&s===p||(o=a,r=i,s=p,this.notifyAll())}),this.context.allowMouseUpTriggerRef=t.store.context.allowMouseUpTriggerRef;return}t.type!==void 0&&(this.context.allowMouseUpTriggerRef=t.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(n,t){this.state.floatingRootContext.context.events.emit("setOpen",{open:n,eventDetails:t})}static useStore(n,t){const o=st(()=>new un(t)).current;return n??o}unsubscribeParentListener=null}function si(){return{...ur(),disabled:!1,modal:!0,allowMouseEnter:!1,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new Xn,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:Je,keyboardEventRelay:void 0,closeDelay:0,hasViewport:!1}}const ii=u.createContext(void 0);function ci(){return u.useContext(ii)}const Ei=fr(function(n){const{children:t,open:o,onOpenChange:r,onOpenChangeComplete:s,defaultOpen:a=!1,disabled:i=!1,modal:p,loopFocus:h=!0,orientation:c="vertical",actionsRef:g,closeParentOnEsc:R=!1,handle:x,triggerId:d,defaultTriggerId:m=null,highlightItemOnHover:l=!0}=n,y=Ht(!0),v=je(!0),E=xo(!0),O=ci(),b=u.useMemo(()=>O&&v?{type:"menu",store:v.store}:E?{type:"menubar",context:E}:y&&!v?{type:"context-menu",context:y}:{type:void 0},[y,v,E,O]),f=un.useStore(x?.store,{open:a,openProp:o,activeTriggerId:m,triggerIdProp:d,parent:b});dr(()=>{o===void 0&&f.state.open===!1&&a===!0&&f.update({open:!0,activeTriggerId:m})}),f.useControlledProp("openProp",o),f.useControlledProp("triggerIdProp",d),f.useContextCallback("onOpenChangeComplete",s);const C=f.useState("floatingTreeRoot"),P=jn(C),D=ft();Z(()=>{y&&!v?f.update({parent:{type:"context-menu",context:y},floatingNodeId:P,floatingParentNodeId:D}):v&&f.update({floatingNodeId:P,floatingParentNodeId:D})},[y,v,P,D,f]);const V=f.useState("open"),F=f.useState("activeTriggerElement"),N=f.useState("positionerElement"),A=f.useState("hoverEnabled"),I=f.useState("modal"),w=f.useState("disabled"),k=f.useState("lastOpenChangeReason"),T=f.useState("parent"),S=f.useState("activeIndex"),L=f.useState("payload"),B=f.useState("floatingParentNodeId"),ee=u.useRef(null),le=B!=null;let ue;f.useSyncedValues({disabled:i,modal:T.type===void 0?p:void 0,rootId:$n()});const{openMethod:j,triggerProps:K}=gr(V);pr(f);const{forceUnmount:_}=mr(V,f,()=>{f.update({allowMouseEnter:!1,stickIfOpen:!0})}),G=u.useRef(T.type!=="context-menu"),te=_e();u.useEffect(()=>{if(V||(ee.current=null),T.type==="context-menu"){if(!V){te.clear(),G.current=!1;return}te.start(500,()=>{G.current=!0})}},[te,V,T.type]),hr(V&&I&&k!==Se&&j!=="touch",N),Z(()=>{!V&&!A&&f.set("hoverEnabled",!0)},[V,A,f]);const ne=u.useRef(!0),$=_e(),ie=se((Y,q)=>{const pe=q.reason;if(V===Y&&q.trigger===F&&k===pe||(q.preventUnmountOnClose=()=>{f.set("preventUnmountingOnClose",!0)},!Y&&q.trigger==null&&(q.trigger=F??void 0),r?.(Y,q),q.isCanceled))return;const mt={open:Y,nativeEvent:q.event,reason:q.reason,nested:le};ue?.emit("openchange",mt);const Q=q.event;if(Y===!1&&Q?.type==="click"&&Q.pointerType==="touch"&&!ne.current)return;if(!Y&&S!==null){const we=f.context.itemDomElements.current[S];queueMicrotask(()=>{we?.setAttribute("tabindex","-1")})}Y&&pe===rt?(ne.current=!1,$.start(300,()=>{ne.current=!0})):(ne.current=!0,$.clear());const ye=(pe===nn||pe===kn)&&Q.detail===0&&Q?.isTrusted,Ce=!Y&&(pe===Yn||pe==null),Re={open:Y,openChangeReason:pe};ee.current=q.event??null;const Oe=q.trigger?.id??null;(Oe||Y)&&(Re.activeTriggerId=Oe,Re.activeTriggerElement=q.trigger??null),f.update(Re),T.type==="menubar"&&(pe===rt||pe===At||pe===Se||pe===Ct||pe===nt)?f.set("instantType","group"):ye||Ce?f.set("instantType",ye?"click":"dismiss"):f.set("instantType",void 0)}),fe=u.useCallback(Y=>{const q=re(Y);return q.preventUnmountOnClose=()=>{f.set("preventUnmountingOnClose",!0)},q},[f]),be=u.useCallback(()=>{f.setOpen(!1,fe(xr))},[f,fe]);u.useImperativeHandle(g,()=>({unmount:_,close:be}),[_,be]);let he;T.type==="context-menu"&&(he=T.context),u.useImperativeHandle(he?.positionerRef,()=>N,[N]),u.useImperativeHandle(he?.actionsRef,()=>({setOpen:ie}),[ie]);const de=yr({popupStore:f,onOpenChange:ie});ue=de.context.events,u.useEffect(()=>{const Y=({open:q,eventDetails:pe})=>ie(q,pe);return ue.on("setOpen",Y),()=>{ue?.off("setOpen",Y)}},[ue,ie]);const xe=Rr(de,{enabled:!w,bubbles:{escapeKey:R&&T.type==="menu"},outsidePress(){return T.type!=="context-menu"||ee.current?.type==="contextmenu"?!0:G.current},externalTree:le?C:void 0}),z=vr(de,{role:"menu"}),U=mo(),M=u.useCallback(Y=>{f.select("activeIndex")!==Y&&f.set("activeIndex",Y)},[f]),W=Bs(de,{enabled:!w,listRef:f.context.itemDomElements,activeIndex:S,nested:T.type!==void 0,loopFocus:h,orientation:c,parentOrientation:T.type==="menubar"?T.context.orientation:void 0,rtl:U==="rtl",disabledIndices:Qt,onNavigate:M,openOnArrowKeyDown:T.type!=="context-menu",externalTree:le?C:void 0,focusItemOnHover:l}),H=u.useCallback(Y=>{f.context.typingRef.current=Y},[f]),oe=Vs(de,{listRef:f.context.itemLabels,elementsRef:f.context.itemDomElements,activeIndex:S,resetMs:br,onMatch:Y=>{V&&Y!==S&&f.set("activeIndex",Y)},onTypingChange:H}),{getReferenceProps:X,getFloatingProps:ce,getItemProps:Fe,getTriggerProps:Ne}=Gn([xe,z,W,oe]),He=u.useMemo(()=>{const Y=qt(X(),{onMouseMove(){f.set("allowMouseEnter",!0)}},K);return delete Y.role,Y},[X,f,K]),Ee=u.useMemo(()=>{const Y=Ne();if(!Y)return Y;const q=qt(Y,K);return delete q.role,delete q["aria-controls"],q},[Ne,K]),Le=u.useMemo(()=>ce({onMouseMove(){f.set("allowMouseEnter",!0),T.type==="menu"&&f.set("hoverEnabled",!1)},onClick(){f.select("hoverEnabled")&&f.set("hoverEnabled",!1)},onKeyDown(Y){const q=f.select("keyboardEventRelay");q&&!Y.isPropagationStopped()&&q(Y)}}),[ce,T.type,f]),Ye=u.useMemo(()=>Fe(),[Fe]);f.useSyncedValues({floatingRootContext:de,activeTriggerProps:He,inactiveTriggerProps:Ee,popupProps:Le,itemProps:Ye});const ze=u.useMemo(()=>({store:f,parent:b}),[f,b]),et=ve.jsx(Zn.Provider,{value:ze,children:typeof t=="function"?t({payload:L}):t});return T.type===void 0||T.type==="context-menu"?ve.jsx(Er,{externalTree:C,children:et}):et});function ai(e){const n=e.getBoundingClientRect(),t=window.getComputedStyle(e,"::before"),o=window.getComputedStyle(e,"::after");if(!(t.content!=="none"||o.content!=="none"))return n;const s=parseFloat(t.width)||0,a=parseFloat(t.height)||0,i=parseFloat(o.width)||0,p=parseFloat(o.height)||0,h=Math.max(n.width,s,i),c=Math.max(n.height,a,p),g=h-n.width,R=c-n.height;return{left:n.left-g/2,right:n.right+g/2,top:n.top-R/2,bottom:n.bottom+R/2}}function li(e={}){const{highlightItemOnHover:n,highlightedIndex:t,onHighlightedIndexChange:o}=qn(),{ref:r,index:s}=to(e),a=t===s,i=u.useRef(null),p=In(r,i);return{compositeProps:u.useMemo(()=>({tabIndex:a?0:-1,onFocus(){o(s)},onMouseMove(){const c=i.current;if(!n||!c)return;const g=c.hasAttribute("disabled")||c.ariaDisabled==="true";!a&&!g&&c.focus()}}),[a,o,s,n]),compositeRef:p,index:s}}function ui(e){const{render:n,className:t,state:o=Je,props:r=Qt,refs:s=Qt,metadata:a,stateAttributesMapping:i,tag:p="div",...h}=e,{compositeProps:c,compositeRef:g}=li({metadata:a});return ut(p,e,{state:o,ref:[...s,g],props:[c,...r,h],stateAttributesMapping:i})}function yo(e){if(Ae(e)&&e.hasAttribute("data-rootownerid"))return e.getAttribute("data-rootownerid")??void 0;if(!at(e))return yo(Qe(e))}function fi(e){const{enabled:n=!0,mouseDownAction:t,open:o}=e,r=u.useRef(!1);return u.useMemo(()=>n?{onMouseDown:s=>{(t==="open"&&!o||t==="close"&&o)&&(r.current=!0,ke(s.currentTarget).addEventListener("click",()=>{r.current=!1},{once:!0}))},onClick:s=>{r.current&&(r.current=!1,s.preventBaseUIHandler())}}:Je,[n,t,o])}const wt=2,wi=wr(function(n,t){const{render:o,className:r,disabled:s=!1,nativeButton:a=!0,id:i,openOnHover:p,delay:h=100,closeDelay:c=0,handle:g,payload:R,...x}=n,d=je(!0),m=g?.store??d?.store;if(!m)throw new Error(lt(85));const l=Ln(i),y=m.useState("isTriggerActive",l),v=m.useState("floatingRootContext"),E=m.useState("isOpenedByTrigger",l),O=u.useRef(null),b=gi(),f=qn(!0),C=dt(),P=u.useMemo(()=>C??new Xn,[C]),D=jn(P),V=ft(),{registerTrigger:F,isMountedByThisTrigger:N}=Cr(l,O,m,{payload:R,closeDelay:c,parent:b,floatingTreeRoot:P,floatingNodeId:D,floatingParentNodeId:V,keyboardEventRelay:f?.relayKeyboardEvent}),A=b.type==="menubar",I=m.useState("disabled"),w=s||I||A&&b.context.disabled,{getButtonProps:k,buttonRef:T}=Fn({disabled:w,native:a});u.useEffect(()=>{!E&&b.type===void 0&&(m.context.allowMouseUpTriggerRef.current=!1)},[m,E,b.type]);const S=u.useRef(null),L=_e(),B=se(z=>{if(!S.current)return;L.clear(),m.context.allowMouseUpTriggerRef.current=!1;const U=z.target;if(me(S.current,U)||me(m.select("positionerElement"),U)||U===S.current||U!=null&&yo(U)===m.select("rootId"))return;const M=ai(S.current);z.clientX>=M.left-wt&&z.clientX<=M.right+wt&&z.clientY>=M.top-wt&&z.clientY<=M.bottom+wt||P.events.emit("close",{domEvent:z,reason:Or})});u.useEffect(()=>{E&&m.select("lastOpenChangeReason")===Se&&ke(S.current).addEventListener("mouseup",B,{once:!0})},[E,B,m]);const ee=A&&b.context.hasSubmenuOpen,ue=Ls(v,{enabled:(p??ee)&&!w&&b.type!=="context-menu"&&(!A||ee&&!N),handleClose:$s({blockPointerEvents:!A}),mouseOnly:!0,move:!1,restMs:b.type===void 0?h:void 0,delay:{close:c},triggerElementRef:O,externalTree:P,isActiveTrigger:y}),j=di(E,m.select("lastOpenChangeReason")),K=Br(v,{enabled:!w&&b.type!=="context-menu",event:E&&A?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:b.type===void 0?j:!1}),_=Ms(v,{enabled:!w&&ee}),G=fi({open:E,enabled:A,mouseDownAction:"open"}),te=Gn([K,_]),ne={disabled:w,open:E},$=m.useState("triggerProps",N),ie=[S,t,T,F,O],fe=[te.getReferenceProps(),ue??Je,$,{"aria-haspopup":"menu",id:l,onMouseDown:z=>{if(m.select("open"))return;L.start(200,()=>{m.context.allowMouseUpTriggerRef.current=!0}),ke(z.currentTarget).addEventListener("mouseup",B,{once:!0})}},A?{role:"menuitem"}:{},G,x,k],be=u.useRef(null),he=se(z=>{kt.flushSync(()=>{m.setOpen(!1,re(At,z.nativeEvent,z.currentTarget))}),Tr(be.current)?.focus()}),de=se(z=>{const U=m.select("positionerElement");if(U&&Sr(z,U))m.context.beforeContentFocusGuardRef.current?.focus();else{kt.flushSync(()=>{m.setOpen(!1,re(At,z.nativeEvent,z.currentTarget))});let M=Mr(m.context.triggerFocusTargetRef.current||O.current);for(;M!==null&&me(U,M);){const W=M;if(M=Pr(M),M===W)break}M?.focus()}}),xe=ut("button",n,{enabled:!A,stateAttributesMapping:hn,state:ne,ref:ie,props:fe});return A?ve.jsx(ui,{tag:"button",render:o,className:r,state:ne,refs:ie,props:fe,stateAttributesMapping:hn}):E?ve.jsxs(u.Fragment,{children:[ve.jsx(xn,{ref:be,onFocus:he},`${l}-pre-focus-guard`),ve.jsx(u.Fragment,{children:xe},l),ve.jsx(xn,{ref:m.context.triggerFocusTargetRef,onFocus:de},`${l}-post-focus-guard`)]}):ve.jsx(u.Fragment,{children:xe},l)});function di(e,n){const t=_e(),[o,r]=u.useState(!1);return Z(()=>{e&&n==="trigger-hover"?(r(!0),t.start(Ir,()=>{r(!1)})):e||(t.clear(),r(!1))},[e,n,t]),o}function gi(){const e=Ht(!0),n=je(!0),t=xo();return u.useMemo(()=>t?{type:"menubar",context:t}:e&&!n?{type:"context-menu",context:e}:{type:void 0},[e,n,t])}export{Ei as M,wi as a,vi as b,bi as c,Ri as d,yi as e};
@@ -1 +1 @@
1
- import{p as e,A as u,B as b}from"./chunk-JZWAC4HX-DC8i-F7r.js";import{c as t,D as i,W as p,b as k,f as N}from"./db-link-CtPnIrIr.js";import{B as v,C as x,a as m,b as h,c as g}from"./button-BaXUPm8v.js";import{B as f}from"./badge-Cd8v3tl3.js";import{T as C,a as w,b as j,c as d,d as L,e as l}from"./table-CTo0I5HG.js";import{E as T}from"./error-card-DmoxS3Ao.js";const B=[{name:"Queued Jobs",key:"totalQueued",description:"Jobs waiting to be processed",color:"text-gray-600 dark:text-gray-400",bgColor:"bg-gray-50 dark:bg-gray-800"},{name:"Active Jobs",key:"totalActive",description:"Jobs currently processing",color:"text-gray-600 dark:text-gray-400",bgColor:"bg-gray-50 dark:bg-gray-800"},{name:"Deferred Jobs",key:"totalDeferred",description:"Jobs scheduled for later",color:"text-gray-600 dark:text-gray-400",bgColor:"bg-gray-50 dark:bg-gray-800"},{name:"Total Jobs",key:"totalJobs",description:"All jobs across queues",color:"text-gray-600 dark:text-gray-400",bgColor:"bg-gray-50 dark:bg-gray-800"}];function A({stats:r}){return e.jsx(e.Fragment,{children:B.map(a=>e.jsx("div",{className:t("overflow-hidden rounded-xl border shadow-sm","bg-white border-gray-200","dark:bg-gray-900 dark:border-gray-800"),children:e.jsx("div",{className:"p-5",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:t("flex-shrink-0 rounded-lg p-3",a.bgColor),children:e.jsx(S,{className:t("h-6 w-6",a.color)})}),e.jsxs("div",{className:"ml-4 flex-1",children:[e.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 truncate",children:a.name}),e.jsx("p",{className:t("text-2xl font-semibold",a.color),children:r[a.key].toLocaleString()})]})]})})},a.key))})}function S({className:r}){return e.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 13.125C3 12.504 3.504 12 4.125 12h2.25c.621 0 1.125.504 1.125 1.125v6.75C7.5 20.496 6.996 21 6.375 21h-2.25A1.125 1.125 0 0 1 3 19.875v-6.75ZM9.75 8.625c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125v11.25c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 0 1-1.125-1.125V8.625ZM16.5 4.125c0-.621.504-1.125 1.125-1.125h2.25C20.496 3 21 3.504 21 4.125v15.75c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 0 1-1.125-1.125V4.125Z"})})}function M({totalQueues:r,problemQueues:a}){return e.jsx(i,{to:"/queues",className:t("block overflow-hidden rounded-xl border shadow-sm transition-all","bg-white border-gray-200 hover:shadow-md hover:border-gray-300","dark:bg-gray-900 dark:border-gray-800 dark:hover:border-gray-700"),children:e.jsx("div",{className:"p-5",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"flex-shrink-0 rounded-lg p-3 bg-gray-50 dark:bg-gray-800",children:e.jsx(Q,{className:"h-6 w-6 text-gray-600 dark:text-gray-400"})}),e.jsxs("div",{className:"ml-4",children:[e.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:"Queues"}),e.jsx("p",{className:"text-2xl font-semibold text-gray-600 dark:text-gray-400",children:r.toLocaleString()})]})]}),a>0&&e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"flex-shrink-0 rounded-lg p-3 bg-gray-50 dark:bg-gray-800",children:e.jsx(W,{className:"h-6 w-6 text-amber-600 dark:text-amber-400"})}),e.jsxs("div",{className:"ml-4 text-right",children:[e.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:"Needing Attention"}),e.jsx("p",{className:"text-2xl font-semibold text-amber-600 dark:text-amber-400",children:a.toLocaleString()})]})]})]})})})}function Q({className:r}){return e.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 12h16.5m-16.5 3.75h16.5M3.75 19.5h16.5M5.625 4.5h12.75a1.875 1.875 0 0 1 0 3.75H5.625a1.875 1.875 0 0 1 0-3.75Z"})})}function W({className:r}){return e.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z"})})}const _=b(function(){return e.jsx(T,{title:"Failed to load dashboard"})}),P=u(function({loaderData:a}){const{stats:y,warnings:n,topQueues:o,queueStats:c}=a;return e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100",children:"Dashboard"}),e.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:"Monitor your pg-boss job queues"})]}),e.jsx(i,{to:"/send",children:e.jsx(v,{variant:"primary",size:"md",children:"Send Job"})})]}),e.jsxs("section",{children:[e.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 mb-4",children:"Overview"}),e.jsxs("div",{className:"space-y-5",children:[e.jsx("div",{className:"grid grid-cols-1 gap-5 sm:grid-cols-2",children:e.jsx(M,{totalQueues:c.totalQueues,problemQueues:c.problemQueues})}),e.jsx("div",{className:"grid grid-cols-1 gap-5 sm:grid-cols-2 lg:grid-cols-4",children:e.jsx(A,{stats:y})})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs(x,{children:[e.jsx(m,{children:e.jsx(h,{children:"Top Queues"})}),e.jsx(g,{className:"p-0",children:o.length===0?e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 p-6",children:"No queues found"}):e.jsxs(C,{children:[e.jsx(w,{children:e.jsxs(j,{children:[e.jsx(d,{children:"Name"}),e.jsx(d,{className:"text-right hidden md:table-cell",children:"Queued"}),e.jsx(d,{className:"text-right hidden md:table-cell",children:"Active"}),e.jsx(d,{className:"text-right",children:"Total"})]})}),e.jsx(L,{children:o.map(s=>e.jsxs(j,{children:[e.jsx(l,{children:e.jsx(i,{to:`/queues/${encodeURIComponent(s.name)}`,className:"font-medium text-primary-600 hover:text-primary-700 dark:text-primary-400 dark:hover:text-primary-300",children:s.name})}),e.jsx(l,{className:"text-right text-gray-700 dark:text-gray-300 hidden md:table-cell",children:s.queuedCount.toLocaleString()}),e.jsx(l,{className:"text-right text-gray-700 dark:text-gray-300 hidden md:table-cell",children:s.activeCount.toLocaleString()}),e.jsx(l,{className:"text-right text-gray-700 dark:text-gray-300",children:s.totalCount.toLocaleString()})]},s.name))})]})})]}),e.jsxs(x,{children:[e.jsxs(m,{className:"flex flex-row items-center justify-between",children:[e.jsx(h,{children:"Recent Warnings"}),e.jsx(i,{to:"/warnings",className:"text-sm font-medium text-primary-600 hover:text-primary-700 dark:text-primary-400 dark:hover:text-primary-300",children:"View all"})]}),e.jsx(g,{children:n.length===0?e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"No warnings recorded"}):e.jsx("ul",{className:"space-y-3",children:n.map(s=>e.jsxs("li",{className:t("flex items-start gap-3 p-3 rounded-lg","bg-gray-50 dark:bg-gray-800"),children:[e.jsx(E,{className:"w-5 h-5 text-amber-500 flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(f,{variant:k[s.type],size:"sm",children:p[s.type]}),e.jsx("span",{className:"text-xs text-gray-400",children:N(new Date(s.createdOn))})]}),e.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 truncate",children:s.message})]})]},s.id))})})]})]})]})});function E({className:r}){return e.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z"})})}export{_ as ErrorBoundary,P as default};
1
+ import{p as e,A as u,B as b}from"./chunk-UVKPFVEO-YfSfkVr_.js";import{c as t,D as i,W as p,b as k,f as N}from"./db-link-CU7IJqbq.js";import{B as v,C as x,a as m,b as h,c as g}from"./button-Ba8FWhqs.js";import{B as f}from"./badge-DBD4CzAv.js";import{T as C,a as w,b as j,c as d,d as L,e as l}from"./table-Au2E5mnP.js";import{E as T}from"./error-card-D-uZRy_l.js";const B=[{name:"Queued Jobs",key:"totalQueued",description:"Jobs waiting to be processed",color:"text-gray-600 dark:text-gray-400",bgColor:"bg-gray-50 dark:bg-gray-800"},{name:"Active Jobs",key:"totalActive",description:"Jobs currently processing",color:"text-gray-600 dark:text-gray-400",bgColor:"bg-gray-50 dark:bg-gray-800"},{name:"Deferred Jobs",key:"totalDeferred",description:"Jobs scheduled for later",color:"text-gray-600 dark:text-gray-400",bgColor:"bg-gray-50 dark:bg-gray-800"},{name:"Total Jobs",key:"totalJobs",description:"All jobs across queues",color:"text-gray-600 dark:text-gray-400",bgColor:"bg-gray-50 dark:bg-gray-800"}];function A({stats:r}){return e.jsx(e.Fragment,{children:B.map(a=>e.jsx("div",{className:t("overflow-hidden rounded-xl border shadow-sm","bg-white border-gray-200","dark:bg-gray-900 dark:border-gray-800"),children:e.jsx("div",{className:"p-5",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:t("flex-shrink-0 rounded-lg p-3",a.bgColor),children:e.jsx(S,{className:t("h-6 w-6",a.color)})}),e.jsxs("div",{className:"ml-4 flex-1",children:[e.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 truncate",children:a.name}),e.jsx("p",{className:t("text-2xl font-semibold",a.color),children:r[a.key].toLocaleString()})]})]})})},a.key))})}function S({className:r}){return e.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 13.125C3 12.504 3.504 12 4.125 12h2.25c.621 0 1.125.504 1.125 1.125v6.75C7.5 20.496 6.996 21 6.375 21h-2.25A1.125 1.125 0 0 1 3 19.875v-6.75ZM9.75 8.625c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125v11.25c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 0 1-1.125-1.125V8.625ZM16.5 4.125c0-.621.504-1.125 1.125-1.125h2.25C20.496 3 21 3.504 21 4.125v15.75c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 0 1-1.125-1.125V4.125Z"})})}function M({totalQueues:r,problemQueues:a}){return e.jsx(i,{to:"/queues",className:t("block overflow-hidden rounded-xl border shadow-sm transition-all","bg-white border-gray-200 hover:shadow-md hover:border-gray-300","dark:bg-gray-900 dark:border-gray-800 dark:hover:border-gray-700"),children:e.jsx("div",{className:"p-5",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"flex-shrink-0 rounded-lg p-3 bg-gray-50 dark:bg-gray-800",children:e.jsx(Q,{className:"h-6 w-6 text-gray-600 dark:text-gray-400"})}),e.jsxs("div",{className:"ml-4",children:[e.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:"Queues"}),e.jsx("p",{className:"text-2xl font-semibold text-gray-600 dark:text-gray-400",children:r.toLocaleString()})]})]}),a>0&&e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"flex-shrink-0 rounded-lg p-3 bg-gray-50 dark:bg-gray-800",children:e.jsx(W,{className:"h-6 w-6 text-amber-600 dark:text-amber-400"})}),e.jsxs("div",{className:"ml-4 text-right",children:[e.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:"Needing Attention"}),e.jsx("p",{className:"text-2xl font-semibold text-amber-600 dark:text-amber-400",children:a.toLocaleString()})]})]})]})})})}function Q({className:r}){return e.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 12h16.5m-16.5 3.75h16.5M3.75 19.5h16.5M5.625 4.5h12.75a1.875 1.875 0 0 1 0 3.75H5.625a1.875 1.875 0 0 1 0-3.75Z"})})}function W({className:r}){return e.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z"})})}const _=b(function(){return e.jsx(T,{title:"Failed to load dashboard"})}),P=u(function({loaderData:a}){const{stats:y,warnings:n,topQueues:o,queueStats:c}=a;return e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100",children:"Dashboard"}),e.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:"Monitor your pg-boss job queues"})]}),e.jsx(i,{to:"/send",children:e.jsx(v,{variant:"primary",size:"md",children:"Send Job"})})]}),e.jsxs("section",{children:[e.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 mb-4",children:"Overview"}),e.jsxs("div",{className:"space-y-5",children:[e.jsx("div",{className:"grid grid-cols-1 gap-5 sm:grid-cols-2",children:e.jsx(M,{totalQueues:c.totalQueues,problemQueues:c.problemQueues})}),e.jsx("div",{className:"grid grid-cols-1 gap-5 sm:grid-cols-2 lg:grid-cols-4",children:e.jsx(A,{stats:y})})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs(x,{children:[e.jsx(m,{children:e.jsx(h,{children:"Top Queues"})}),e.jsx(g,{className:"p-0",children:o.length===0?e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 p-6",children:"No queues found"}):e.jsxs(C,{children:[e.jsx(w,{children:e.jsxs(j,{children:[e.jsx(d,{children:"Name"}),e.jsx(d,{className:"text-right hidden md:table-cell",children:"Queued"}),e.jsx(d,{className:"text-right hidden md:table-cell",children:"Active"}),e.jsx(d,{className:"text-right",children:"Total"})]})}),e.jsx(L,{children:o.map(s=>e.jsxs(j,{children:[e.jsx(l,{children:e.jsx(i,{to:`/queues/${encodeURIComponent(s.name)}`,className:"font-medium text-primary-600 hover:text-primary-700 dark:text-primary-400 dark:hover:text-primary-300",children:s.name})}),e.jsx(l,{className:"text-right text-gray-700 dark:text-gray-300 hidden md:table-cell",children:s.queuedCount.toLocaleString()}),e.jsx(l,{className:"text-right text-gray-700 dark:text-gray-300 hidden md:table-cell",children:s.activeCount.toLocaleString()}),e.jsx(l,{className:"text-right text-gray-700 dark:text-gray-300",children:s.totalCount.toLocaleString()})]},s.name))})]})})]}),e.jsxs(x,{children:[e.jsxs(m,{className:"flex flex-row items-center justify-between",children:[e.jsx(h,{children:"Recent Warnings"}),e.jsx(i,{to:"/warnings",className:"text-sm font-medium text-primary-600 hover:text-primary-700 dark:text-primary-400 dark:hover:text-primary-300",children:"View all"})]}),e.jsx(g,{children:n.length===0?e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"No warnings recorded"}):e.jsx("ul",{className:"space-y-3",children:n.map(s=>e.jsxs("li",{className:t("flex items-start gap-3 p-3 rounded-lg","bg-gray-50 dark:bg-gray-800"),children:[e.jsx(E,{className:"w-5 h-5 text-amber-500 flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(f,{variant:k[s.type],size:"sm",children:p[s.type]}),e.jsx("span",{className:"text-xs text-gray-400",children:N(new Date(s.createdOn))})]}),e.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 truncate",children:s.message})]})]},s.id))})})]})]})]})});function E({className:r}){return e.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z"})})}export{_ as ErrorBoundary,P as default};
@@ -1 +1 @@
1
- import{p as a}from"./chunk-JZWAC4HX-DC8i-F7r.js";import{c as e,a as s}from"./db-link-CtPnIrIr.js";const d=s("inline-flex items-center gap-1.5 rounded-full font-medium ring-1 ring-inset",{variants:{variant:{gray:"bg-gray-100 text-gray-700 ring-gray-500/10 dark:bg-gray-800 dark:text-gray-300 dark:ring-gray-500/20",primary:"bg-primary-50 text-primary-700 ring-primary-600/10 dark:bg-primary-950 dark:text-primary-300 dark:ring-primary-400/20",success:"bg-green-50 text-green-700 ring-green-600/10 dark:bg-green-950 dark:text-green-300 dark:ring-green-400/20",warning:"bg-warning-50 text-amber-700 ring-warning-600/10 dark:bg-warning-950 dark:text-amber-300 dark:ring-warning-400/20",error:"bg-red-50 text-red-700 ring-red-600/10 dark:bg-red-950 dark:text-red-300 dark:ring-red-400/20"},size:{sm:"px-2 py-0.5 text-xs",md:"px-2.5 py-1 text-xs",lg:"px-3 py-1 text-sm"}},defaultVariants:{variant:"gray",size:"md"}}),m={gray:"bg-gray-500",primary:"bg-primary-500 dark:bg-primary-400",success:"bg-green-500",warning:"bg-warning-500",error:"bg-red-500"};function x({children:g,variant:r="gray",size:n,dot:i=!1,className:t}){return a.jsxs("span",{className:e(d({variant:r,size:n,className:t})),children:[i&&a.jsx("span",{className:e("h-1.5 w-1.5 rounded-full",m[r??"gray"])}),g]})}export{x as B};
1
+ import{p as a}from"./chunk-UVKPFVEO-YfSfkVr_.js";import{c as e,a as s}from"./db-link-CU7IJqbq.js";const d=s("inline-flex items-center gap-1.5 rounded-full font-medium ring-1 ring-inset",{variants:{variant:{gray:"bg-gray-100 text-gray-700 ring-gray-500/10 dark:bg-gray-800 dark:text-gray-300 dark:ring-gray-500/20",primary:"bg-primary-50 text-primary-700 ring-primary-600/10 dark:bg-primary-950 dark:text-primary-300 dark:ring-primary-400/20",success:"bg-green-50 text-green-700 ring-green-600/10 dark:bg-green-950 dark:text-green-300 dark:ring-green-400/20",warning:"bg-warning-50 text-amber-700 ring-warning-600/10 dark:bg-warning-950 dark:text-amber-300 dark:ring-warning-400/20",error:"bg-red-50 text-red-700 ring-red-600/10 dark:bg-red-950 dark:text-red-300 dark:ring-red-400/20"},size:{sm:"px-2 py-0.5 text-xs",md:"px-2.5 py-1 text-xs",lg:"px-3 py-1 text-sm"}},defaultVariants:{variant:"gray",size:"md"}}),m={gray:"bg-gray-500",primary:"bg-primary-500 dark:bg-primary-400",success:"bg-green-500",warning:"bg-warning-500",error:"bg-red-500"};function x({children:g,variant:r="gray",size:n,dot:i=!1,className:t}){return a.jsxs("span",{className:e(d({variant:r,size:n,className:t})),children:[i&&a.jsx("span",{className:e("h-1.5 w-1.5 rounded-full",m[r??"gray"])}),g]})}export{x as B};
@@ -1 +1 @@
1
- import{p as o,a as n}from"./chunk-JZWAC4HX-DC8i-F7r.js";import{c as t,u as g,m as y,a as m}from"./db-link-CtPnIrIr.js";function x({children:r,className:a,...e}){return o.jsx("div",{className:t("bg-white rounded-xl border border-gray-200 shadow-sm overflow-hidden","dark:bg-gray-900 dark:border-gray-800",a),...e,children:r})}function f({children:r,className:a,...e}){return o.jsx("div",{className:t("px-6 py-5 border-b border-gray-200 dark:border-gray-800",a),...e,children:r})}function l({children:r,className:a,...e}){return o.jsx("h3",{className:t("text-lg font-semibold text-gray-900 dark:text-gray-100",a),...e,children:r})}function h({children:r,className:a,...e}){return o.jsx("div",{className:t("px-6 py-5",a),...e,children:r})}const p=m("inline-flex items-center justify-center font-semibold rounded-lg transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed dark:focus:ring-offset-gray-900",{variants:{variant:{primary:"bg-primary-600 text-white hover:bg-primary-700 focus:ring-primary-600 shadow-sm",secondary:"bg-primary-50 text-primary-700 hover:bg-primary-100 focus:ring-primary-600 dark:bg-primary-950 dark:text-primary-300 dark:hover:bg-primary-900",outline:"bg-white text-gray-700 border border-gray-300 hover:bg-gray-50 focus:ring-primary-600 shadow-sm dark:bg-gray-900 dark:text-gray-300 dark:border-gray-700 dark:hover:bg-gray-800",ghost:"text-gray-700 hover:bg-gray-100 focus:ring-primary-600 dark:text-gray-300 dark:hover:bg-gray-800",danger:"bg-red-600 text-white hover:bg-red-700 focus:ring-red-600 shadow-sm"},size:{sm:"px-3 py-1.5 text-sm",md:"px-4 py-2 text-sm",lg:"px-5 py-2.5 text-base"}},defaultVariants:{variant:"primary",size:"md"}}),b=n.forwardRef(({className:r,variant:a,size:e,render:s,...d},i)=>g({defaultTagName:"button",render:s,props:y({className:t(p({variant:a,size:e,className:r}))},d),ref:i}));b.displayName="Button";export{b as B,x as C,f as a,l as b,h as c};
1
+ import{p as o,a as n}from"./chunk-UVKPFVEO-YfSfkVr_.js";import{c as t,u as g,m as y,a as m}from"./db-link-CU7IJqbq.js";function x({children:r,className:a,...e}){return o.jsx("div",{className:t("bg-white rounded-xl border border-gray-200 shadow-sm overflow-hidden","dark:bg-gray-900 dark:border-gray-800",a),...e,children:r})}function f({children:r,className:a,...e}){return o.jsx("div",{className:t("px-6 py-5 border-b border-gray-200 dark:border-gray-800",a),...e,children:r})}function l({children:r,className:a,...e}){return o.jsx("h3",{className:t("text-lg font-semibold text-gray-900 dark:text-gray-100",a),...e,children:r})}function h({children:r,className:a,...e}){return o.jsx("div",{className:t("px-6 py-5",a),...e,children:r})}const p=m("inline-flex items-center justify-center font-semibold rounded-lg transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed dark:focus:ring-offset-gray-900",{variants:{variant:{primary:"bg-primary-600 text-white hover:bg-primary-700 focus:ring-primary-600 shadow-sm",secondary:"bg-primary-50 text-primary-700 hover:bg-primary-100 focus:ring-primary-600 dark:bg-primary-950 dark:text-primary-300 dark:hover:bg-primary-900",outline:"bg-white text-gray-700 border border-gray-300 hover:bg-gray-50 focus:ring-primary-600 shadow-sm dark:bg-gray-900 dark:text-gray-300 dark:border-gray-700 dark:hover:bg-gray-800",ghost:"text-gray-700 hover:bg-gray-100 focus:ring-primary-600 dark:text-gray-300 dark:hover:bg-gray-800",danger:"bg-red-600 text-white hover:bg-red-700 focus:ring-red-600 shadow-sm"},size:{sm:"px-3 py-1.5 text-sm",md:"px-4 py-2 text-sm",lg:"px-5 py-2.5 text-base"}},defaultVariants:{variant:"primary",size:"md"}}),b=n.forwardRef(({className:r,variant:a,size:e,render:s,...d},i)=>g({defaultTagName:"button",render:s,props:y({className:t(p({variant:a,size:e,className:r}))},d),ref:i}));b.displayName="Button";export{b as B,x as C,f as a,l as b,h as c};
@@ -1 +1 @@
1
- import{c as o}from"./createLucideIcon-BXGwbdrh.js";const n=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],e=o("chevron-down",n);export{e as C};
1
+ import{c as o}from"./createLucideIcon-Bt-yXILq.js";const n=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],e=o("chevron-down",n);export{e as C};