@lunora/studio 1.0.0-alpha.376 → 1.0.0-alpha.377
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.
- package/dist/index.d.mts +14 -5
- package/dist/index.d.ts +14 -5
- package/dist/index.mjs +1 -1
- package/dist/mount.d.mts +1 -1
- package/dist/mount.d.ts +1 -1
- package/dist/mount.mjs +1 -1
- package/dist/packem_chunks/AdvisorHealthPanel.mjs +1 -1
- package/dist/packem_chunks/ApiTab.mjs +1 -1
- package/dist/packem_chunks/AuditPanel.mjs +1 -1
- package/dist/packem_chunks/ExportImportPanel.mjs +1 -1
- package/dist/packem_chunks/FileBrowser.mjs +1 -1
- package/dist/packem_chunks/FunctionRunner.mjs +1 -1
- package/dist/packem_chunks/FunctionStatsPanel.mjs +1 -1
- package/dist/packem_chunks/HealthPanel.mjs +1 -1
- package/dist/packem_chunks/InsightsPanel.mjs +1 -1
- package/dist/packem_chunks/LogsPanel.mjs +1 -1
- package/dist/packem_chunks/MailPanel.mjs +1 -1
- package/dist/packem_chunks/MetricsPanel.mjs +1 -1
- package/dist/packem_chunks/NotificationsPanel.mjs +1 -1
- package/dist/packem_chunks/PitrPanel.mjs +1 -1
- package/dist/packem_chunks/SchemaViewer.mjs +1 -1
- package/dist/packem_chunks/SecurityAdvisorPanel.mjs +1 -1
- package/dist/packem_chunks/SettingsPanel.mjs +1 -1
- package/dist/packem_chunks/SqlEditorPanel.mjs +1 -1
- package/dist/packem_chunks/TableEditor.mjs +1 -1
- package/dist/packem_chunks/agents-panel.mjs +1 -1
- package/dist/packem_chunks/ai-usage-panel.mjs +1 -1
- package/dist/packem_chunks/assistant-panel.mjs +1 -1
- package/dist/packem_chunks/auth-audit-panel.mjs +1 -1
- package/dist/packem_chunks/containers-panel.mjs +1 -1
- package/dist/packem_chunks/dashboards-panel.mjs +1 -1
- package/dist/packem_chunks/evals-panel.mjs +1 -1
- package/dist/packem_chunks/fanout-panel.mjs +1 -1
- package/dist/packem_chunks/flags-panel.mjs +1 -1
- package/dist/packem_chunks/issues-panel.mjs +1 -1
- package/dist/packem_chunks/kv-browser.mjs +1 -1
- package/dist/packem_chunks/migrations-route.mjs +1 -1
- package/dist/packem_chunks/payments-panel.mjs +1 -1
- package/dist/packem_chunks/permissions-panel.mjs +1 -1
- package/dist/packem_chunks/privacy-requests-panel.mjs +1 -1
- package/dist/packem_chunks/queues-panel.mjs +1 -1
- package/dist/packem_chunks/reactors-panel.mjs +1 -1
- package/dist/packem_chunks/rls-panel.mjs +1 -1
- package/dist/packem_chunks/schedule-panel.mjs +1 -1
- package/dist/packem_chunks/storage-rules-panel.mjs +1 -1
- package/dist/packem_chunks/subscriptions-panel.mjs +1 -1
- package/dist/packem_chunks/traces-panel.mjs +1 -1
- package/dist/packem_chunks/workflows-panel.mjs +1 -1
- package/dist/packem_shared/ADMIN_FUNCTIONS-DAHZ35kM.mjs +1 -0
- package/dist/packem_shared/{ApiDocsPanel-xqgxgYCy.mjs → ApiDocsPanel-sEDqUNQq.mjs} +1 -1
- package/dist/packem_shared/{DataBrowser-BR2nrvMW.mjs → DataBrowser-CkVOu6py.mjs} +1 -1
- package/dist/packem_shared/{GlobalDataBrowser-Df5S1NxG.mjs → GlobalDataBrowser-l2ECwXCm.mjs} +1 -1
- package/dist/packem_shared/{HomePanel-CHq9VBrh.mjs → HomePanel-c7as4tvl.mjs} +1 -1
- package/dist/packem_shared/{MigrationsPanel-BWGgOwmX.mjs → MigrationsPanel-BQol4Un1.mjs} +1 -1
- package/dist/packem_shared/{Studio-JuMI1hpi.mjs → Studio-BmbkaUrx.mjs} +1 -1
- package/dist/packem_shared/{StudioApp-02dw_keu.mjs → StudioApp-CsyDnrg2.mjs} +1 -1
- package/dist/packem_shared/{advisor-view-Dj-mZPAq.mjs → advisor-view-gtf_DhUU.mjs} +1 -1
- package/dist/packem_shared/{app.d-BXrVLb99.d.mts → app.d-DpxFQ0qO.d.mts} +14 -0
- package/dist/packem_shared/{app.d-BXrVLb99.d.ts → app.d-DpxFQ0qO.d.ts} +14 -0
- package/dist/packem_shared/{assistant-provider-BQG7QZAu.mjs → assistant-provider-Dw0roZh3.mjs} +1 -1
- package/dist/packem_shared/{error-alert-BzZfqmf4.mjs → error-alert-3AR_-s_s.mjs} +1 -1
- package/dist/packem_shared/{home-panel-DTWHlX5S.mjs → home-panel-TpxiaHgB.mjs} +1 -1
- package/dist/packem_shared/{studio-DtxNxSjs.mjs → studio-DZlpp4Vx.mjs} +1 -1
- package/dist/packem_shared/{table-list-sidebar-C8qPvzGk.mjs → table-list-sidebar-Bfmg04MD.mjs} +1 -1
- package/dist/packem_shared/{use-assistant-rpc-DCC6ph2u.mjs → use-assistant-rpc-AKu8hvPm.mjs} +1 -1
- package/dist/standalone/{chunk-CURIWKKC.js → chunk-22OYIN7Q.js} +1 -1
- package/dist/standalone/{chunk-EVJSGZXV.js → chunk-2BCNWFC5.js} +1 -1
- package/dist/standalone/{chunk-2MZLFQR5.js → chunk-2BUAJRHS.js} +1 -1
- package/dist/standalone/{chunk-J45HAKBU.js → chunk-2KTN53PK.js} +1 -1
- package/dist/standalone/chunk-2NUCBQFU.js +1 -0
- package/dist/standalone/{chunk-B4PRNI7H.js → chunk-2SKEPLDB.js} +1 -1
- package/dist/standalone/{chunk-BQS3C5V3.js → chunk-3FVWKQLT.js} +1 -1
- package/dist/standalone/{chunk-C4BS3LHQ.js → chunk-3J26FAKO.js} +1 -1
- package/dist/standalone/{chunk-F4S2YEYW.js → chunk-446DKR7O.js} +1 -1
- package/dist/standalone/{chunk-ZCXG3567.js → chunk-44ZHY2EU.js} +1 -1
- package/dist/standalone/{chunk-4EPW63HS.js → chunk-4AG356VE.js} +1 -1
- package/dist/standalone/{chunk-ZSWW2UGP.js → chunk-4KPATTV6.js} +1 -1
- package/dist/standalone/{chunk-JYCGHNPF.js → chunk-4RPRUFVA.js} +1 -1
- package/dist/standalone/{chunk-HFBSWKJS.js → chunk-4SY2N2RS.js} +1 -1
- package/dist/standalone/{chunk-KBYFBEG2.js → chunk-553O7ESU.js} +1 -1
- package/dist/standalone/{chunk-K3MVWN6E.js → chunk-5Z6PF6KC.js} +1 -1
- package/dist/standalone/{chunk-7LCGAQWG.js → chunk-5ZZO5UEC.js} +1 -1
- package/dist/standalone/chunk-6ALD476Y.js +8 -0
- package/dist/standalone/{chunk-B3TXCZUI.js → chunk-6BWAMHRF.js} +1 -1
- package/dist/standalone/{chunk-RTE7SDRS.js → chunk-6ORWM6ZT.js} +1 -1
- package/dist/standalone/{chunk-4RGKUS3H.js → chunk-74OCXJGH.js} +1 -1
- package/dist/standalone/{chunk-QXNMGPXW.js → chunk-7E3RA4X6.js} +1 -1
- package/dist/standalone/{chunk-645S7KRU.js → chunk-7VZPHPTH.js} +1 -1
- package/dist/standalone/chunk-7WGZSDRS.js +2 -0
- package/dist/standalone/{chunk-GWNGVKLG.js → chunk-A6TVTNKO.js} +1 -1
- package/dist/standalone/{chunk-6G3E4PJ2.js → chunk-ADABTCDI.js} +1 -1
- package/dist/standalone/{chunk-G6VBT4AU.js → chunk-AFIY2ATE.js} +1 -1
- package/dist/standalone/{chunk-GXTSE66Z.js → chunk-AFLNQEZ5.js} +1 -1
- package/dist/standalone/{chunk-AERXMIND.js → chunk-AKOBXMLE.js} +1 -1
- package/dist/standalone/{chunk-LKML3CX4.js → chunk-AMWPN5JC.js} +1 -1
- package/dist/standalone/{chunk-ALNEZ5D2.js → chunk-APHDGDQX.js} +1 -1
- package/dist/standalone/{chunk-RDS46R5R.js → chunk-BMDQFH65.js} +1 -1
- package/dist/standalone/{chunk-7SNL633X.js → chunk-BS77NGL6.js} +1 -1
- package/dist/standalone/{chunk-OVEOTKK5.js → chunk-CD6Y4HMA.js} +1 -1
- package/dist/standalone/{chunk-R3P6KKUH.js → chunk-CF2MJGHC.js} +1 -1
- package/dist/standalone/{chunk-JIBRGVA7.js → chunk-CJJSRDJQ.js} +1 -1
- package/dist/standalone/{chunk-QHKR5JW4.js → chunk-COLRWCN5.js} +1 -1
- package/dist/standalone/{chunk-F5WJCL3F.js → chunk-CTIZP3XO.js} +1 -1
- package/dist/standalone/{chunk-QAQ3KMY6.js → chunk-CVPH3ATG.js} +1 -1
- package/dist/standalone/{chunk-OSHODLMU.js → chunk-D76SLSGV.js} +1 -1
- package/dist/standalone/{chunk-WAIESA3E.js → chunk-D7SKD7RO.js} +1 -1
- package/dist/standalone/{chunk-CCETXQNF.js → chunk-DB332GVZ.js} +1 -1
- package/dist/standalone/{chunk-BYUXIOPZ.js → chunk-DBOXAUII.js} +1 -1
- package/dist/standalone/{chunk-HSI24FPH.js → chunk-DBV2V6OY.js} +1 -1
- package/dist/standalone/{chunk-JAAXDIR5.js → chunk-DIZP54PG.js} +1 -1
- package/dist/standalone/{chunk-2DT3QG6Q.js → chunk-DRHZZ7IN.js} +1 -1
- package/dist/standalone/{chunk-PEVNCIZQ.js → chunk-EC3XQQRV.js} +1 -1
- package/dist/standalone/{chunk-3D67ZJRW.js → chunk-EDL46BPM.js} +1 -1
- package/dist/standalone/{chunk-4PI2OSSP.js → chunk-EOFWXI3T.js} +1 -1
- package/dist/standalone/{chunk-CHIQ3CJZ.js → chunk-EYDMS22X.js} +1 -1
- package/dist/standalone/{chunk-B76HLC52.js → chunk-F4KT43QZ.js} +1 -1
- package/dist/standalone/chunk-FH4R64SS.js +5 -0
- package/dist/standalone/{chunk-IJNP6YSD.js → chunk-GBVYBBIF.js} +1 -1
- package/dist/standalone/{chunk-ZFEDRJ7R.js → chunk-GQF53GWD.js} +1 -1
- package/dist/standalone/{chunk-EYMLYHWK.js → chunk-GWRKSV2Q.js} +1 -1
- package/dist/standalone/{chunk-2EB7FN5S.js → chunk-H6VTIXVB.js} +1 -1
- package/dist/standalone/{chunk-PUU56AIE.js → chunk-IAVAD545.js} +1 -1
- package/dist/standalone/{chunk-ELUYMLPL.js → chunk-IDK6WH4X.js} +1 -1
- package/dist/standalone/{chunk-EYJX6GXU.js → chunk-IEMQNFZ7.js} +1 -1
- package/dist/standalone/{chunk-KTK4NDWQ.js → chunk-IQ5CIBXJ.js} +1 -1
- package/dist/standalone/{chunk-CZA2P2TU.js → chunk-IYN56FBP.js} +1 -1
- package/dist/standalone/{chunk-EX2DUBRT.js → chunk-JB5VB7PX.js} +1 -1
- package/dist/standalone/{chunk-HCOF7HOM.js → chunk-JNWK5MJC.js} +1 -1
- package/dist/standalone/{chunk-FERYOTLW.js → chunk-JQH5M3FB.js} +1 -1
- package/dist/standalone/{chunk-WSG35SRF.js → chunk-JUTXPZQK.js} +1 -1
- package/dist/standalone/{chunk-PFPJA2HR.js → chunk-K24LZAP2.js} +1 -1
- package/dist/standalone/{chunk-FWOOA2ZR.js → chunk-K7Z7UTJJ.js} +1 -1
- package/dist/standalone/{chunk-6YBEKVUG.js → chunk-KMA6JR2E.js} +1 -1
- package/dist/standalone/{chunk-YUVGMKHG.js → chunk-L27FKJTG.js} +1 -1
- package/dist/standalone/{chunk-N3FNOCHB.js → chunk-LD6JOIEW.js} +1 -1
- package/dist/standalone/{chunk-AFVVESAA.js → chunk-LIQOSH6R.js} +1 -1
- package/dist/standalone/{chunk-UBX5ZPLV.js → chunk-LMCBMC2V.js} +1 -1
- package/dist/standalone/chunk-LYVYUTQY.js +1 -0
- package/dist/standalone/{chunk-HAK2T6YN.js → chunk-M5VU6MF5.js} +1 -1
- package/dist/standalone/{chunk-ASD6UAND.js → chunk-M7EHYZ6R.js} +1 -1
- package/dist/standalone/{chunk-D3DZZHZA.js → chunk-MAZES4KJ.js} +1 -1
- package/dist/standalone/{chunk-42RZZFLX.js → chunk-MBA6SBBO.js} +1 -1
- package/dist/standalone/chunk-MHZNDDGI.js +1 -0
- package/dist/standalone/{chunk-PYQUCCUO.js → chunk-MUCEG53A.js} +1 -1
- package/dist/standalone/{chunk-K46QTJR6.js → chunk-MWF4AQ5B.js} +1 -1
- package/dist/standalone/{chunk-QGAWQTUE.js → chunk-MWMVXHQM.js} +1 -1
- package/dist/standalone/{chunk-CAEJQOMU.js → chunk-MXYZQCDR.js} +1 -1
- package/dist/standalone/{chunk-FEHRNTIU.js → chunk-N33IYFIX.js} +1 -1
- package/dist/standalone/{chunk-X72A525Z.js → chunk-N6H4WQHD.js} +1 -1
- package/dist/standalone/{chunk-QRA7AKYO.js → chunk-N7FOBAV3.js} +1 -1
- package/dist/standalone/{chunk-D6CDIHHL.js → chunk-NSG5VFIL.js} +1 -1
- package/dist/standalone/{chunk-25WEL5RI.js → chunk-NXNTS5G2.js} +1 -1
- package/dist/standalone/{chunk-TW4O2BA5.js → chunk-O5QATFN3.js} +3 -3
- package/dist/standalone/{chunk-SUUBCPUD.js → chunk-O6HYP4FT.js} +1 -1
- package/dist/standalone/{chunk-6FPV3EK2.js → chunk-ODEIAS3V.js} +1 -1
- package/dist/standalone/{chunk-64LU3VU6.js → chunk-OR2CSCVB.js} +1 -1
- package/dist/standalone/{chunk-OT2YNQPU.js → chunk-OVXKPVKS.js} +1 -1
- package/dist/standalone/{chunk-D65UVZIA.js → chunk-OWRWDDJT.js} +1 -1
- package/dist/standalone/chunk-OYCDWIG2.js +33 -0
- package/dist/standalone/{chunk-VUOEJJUH.js → chunk-OZID3UYF.js} +1 -1
- package/dist/standalone/{chunk-CLQKKJHL.js → chunk-P37L55FP.js} +1 -1
- package/dist/standalone/{chunk-SW52HGM4.js → chunk-PGK4SNG3.js} +1 -1
- package/dist/standalone/{chunk-W2FHSEQW.js → chunk-PP75AWAZ.js} +1 -1
- package/dist/standalone/{chunk-VNH4OBJS.js → chunk-QF743FSL.js} +1 -1
- package/dist/standalone/{chunk-BE3FD3E6.js → chunk-QH6WAQIT.js} +1 -1
- package/dist/standalone/{chunk-ONTGYVAN.js → chunk-QLZGKBOW.js} +1 -1
- package/dist/standalone/{chunk-X45MVUVK.js → chunk-QURAUVUB.js} +1 -1
- package/dist/standalone/{chunk-YTPE33AO.js → chunk-QVFWLGGW.js} +1 -1
- package/dist/standalone/chunk-R3RIZDUS.js +1 -0
- package/dist/standalone/{chunk-2BQNNRAP.js → chunk-RNTEWZRJ.js} +1 -1
- package/dist/standalone/{chunk-LQCF6SZW.js → chunk-RNVK7QCW.js} +1 -1
- package/dist/standalone/{chunk-4DIRNQHR.js → chunk-RQFK2LYP.js} +1 -1
- package/dist/standalone/{chunk-JMZT3CEW.js → chunk-SCTYLLJT.js} +1 -1
- package/dist/standalone/{chunk-O3AZ7JKE.js → chunk-T7UKRA6J.js} +1 -1
- package/dist/standalone/{chunk-WB6VGH7X.js → chunk-TKALUM7Y.js} +1 -1
- package/dist/standalone/{chunk-SWFSB4QT.js → chunk-TLOLN6RV.js} +1 -1
- package/dist/standalone/{chunk-6BH5TIGF.js → chunk-UBAPZPI2.js} +1 -1
- package/dist/standalone/{chunk-MWYGLPDV.js → chunk-VB3BKQCE.js} +1 -1
- package/dist/standalone/{chunk-QURCU2N2.js → chunk-VH4NT2WJ.js} +1 -1
- package/dist/standalone/{chunk-MGFELY5Q.js → chunk-VRAOBE6E.js} +1 -1
- package/dist/standalone/{chunk-VXZAS5VS.js → chunk-VSYZL2WH.js} +1 -1
- package/dist/standalone/{chunk-S36FVTKK.js → chunk-W7CLOQOU.js} +1 -1
- package/dist/standalone/chunk-WUWBRYJG.js +1 -0
- package/dist/standalone/{chunk-M4TCBPSY.js → chunk-XMJB5JOF.js} +1 -1
- package/dist/standalone/{chunk-3D2E7WXH.js → chunk-XNZ4WUSQ.js} +1 -1
- package/dist/standalone/{chunk-UBTKEHX6.js → chunk-Y5HPCYBO.js} +1 -1
- package/dist/standalone/chunk-Y6OVSHPH.js +1 -0
- package/dist/standalone/{chunk-UVNJG3UL.js → chunk-YKUO2I5M.js} +1 -1
- package/dist/standalone/{chunk-XLYFGUEF.js → chunk-YNCZVYCO.js} +1 -1
- package/dist/standalone/{chunk-AQ62YJJ5.js → chunk-YOUTNV5Y.js} +1 -1
- package/dist/standalone/{chunk-A2Q3TGIQ.js → chunk-YYJGL32M.js} +1 -1
- package/dist/standalone/{chunk-SZBLYYV6.js → chunk-ZAWNUXWP.js} +1 -1
- package/dist/standalone/{chunk-GMT66LBU.js → chunk-ZIUDJD6M.js} +1 -1
- package/dist/standalone/{chunk-HPD2PZP2.js → chunk-ZUVDTKXM.js} +1 -1
- package/dist/standalone/studio.js +3 -3
- package/package.json +10 -10
- package/dist/packem_shared/ADMIN_FUNCTIONS-C6U-ugro.mjs +0 -1
- package/dist/standalone/chunk-3BQ6FMEA.js +0 -5
- package/dist/standalone/chunk-6A6AELDJ.js +0 -1
- package/dist/standalone/chunk-BG2CJOVS.js +0 -1
- package/dist/standalone/chunk-BKI3JMXQ.js +0 -1
- package/dist/standalone/chunk-KGLIQIZU.js +0 -1
- package/dist/standalone/chunk-PUK3H4RN.js +0 -33
- package/dist/standalone/chunk-QAOZXPLU.js +0 -1
- package/dist/standalone/chunk-RTS5G3ET.js +0 -2
- package/dist/standalone/chunk-RWMOWRJX.js +0 -1
- package/dist/standalone/chunk-Z7ZGAQ5J.js +0 -8
- /package/dist/standalone/{chunk-NGVP66OH.js → chunk-QHVUXMRV.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as nn}from"./chunk-UBX5ZPLV.js";import{a as ae,b as tn,c as on}from"./chunk-VNH4OBJS.js";import{a as bo,b as wo,c as _o,d as Do,e as Fo,f as Go,g as qo,h as Qo}from"./chunk-KTK4NDWQ.js";import{$ as pt,A as xo,B as Mo,C as dt,E as ho,G as Co,I as vo,J as Io,M as Eo,N as yo,O as Po,P as So,R as No,S as Oo,T as To,U as ko,W as Ut,Y as Ao,_ as Vo,aa as Bo,ba as Lo,ca as lt,ea as Uo,fa as Ho,j as co,k as po,la as zo,ma as Yo,na as Ko,oa as $o,p as Gt,qa as Wo,r as lo,ra as Jo,s as mo,sa as Xo,u as fo,v as at,w as ut,x as go,y as ct,z as Ro}from"./chunk-XLYFGUEF.js";import{b as jo}from"./chunk-D65UVZIA.js";import{i as Zo,k as en}from"./chunk-QAOZXPLU.js";import{D as Ne,H as rt,I as He,J as st,K as it,M as y,N as re,a as Bt,b as Z,c as ot,e as Lt,l as io,o as ao,p as Ft,q as uo,r as nt}from"./chunk-HFBSWKJS.js";import{a as et,b as so,c as Ge}from"./chunk-JMZT3CEW.js";import{f as oo,n as no,q as ro,u as Se,v as se,w as Ke}from"./chunk-VUOEJJUH.js";import{a as Ze,b as he,d as G,e as tt,g as Ue,h as $e,i as ie,j as O}from"./chunk-YUVGMKHG.js";import{x as Fe}from"./chunk-PUK3H4RN.js";import{a as ir}from"./chunk-GWNGVKLG.js";import{a as E,b as me}from"./chunk-6G3E4PJ2.js";import{a as o,c as sr,d as M}from"./chunk-5PEAXTYQ.js";var Ve=M(ir(),1);var ee={};sr(ee,{Arrow:()=>sn,Backdrop:()=>un,CheckboxItem:()=>fn,CheckboxItemIndicator:()=>gn,Group:()=>Mn,GroupLabel:()=>bn,Handle:()=>qe,Item:()=>vn,LinkItem:()=>In,Popup:()=>yn,Portal:()=>Nn,Positioner:()=>On,RadioGroup:()=>kn,RadioItem:()=>Dn,RadioItemIndicator:()=>An,Root:()=>Dt,Separator:()=>nn,SubmenuRoot:()=>Un,SubmenuTrigger:()=>Jn,Trigger:()=>Kn,Viewport:()=>Wn,createHandle:()=>Xn});var rn=M(E(),1);var mt=M(E(),1);var Ht=mt.createContext(void 0);function K(t){let e=mt.useContext(Ht);if(e===void 0&&!t)throw new Error(G(33));return e}o(K,"useMenuPositionerContext");var ft=M(E(),1);var jt=ft.createContext(void 0);function D(t){let e=ft.useContext(jt);if(e===void 0&&!t)throw new Error(G(36));return e}o(D,"useMenuRootContext");var sn=rn.forwardRef(o(function(e,n){let{render:s,className:u,style:c,...i}=e,{store:p}=D(),{arrowRef:r,side:m,align:f,arrowUncentered:R,arrowStyles:h}=K(),P={open:p.useState("open"),side:m,align:f,uncentered:R};return O("div",e,{ref:[r,n],stateAttributesMapping:uo,state:P,props:{style:h,"aria-hidden":!0,...i}})},"MenuArrow"));var an=M(E(),1);var gt=M(E(),1);var ar=gt.createContext(void 0);function Oe(t=!0){let e=gt.useContext(ar);if(e===void 0&&!t)throw new Error(G(25));return e}o(Oe,"useContextMenuRootContext");var un=an.forwardRef(o(function(e,n){let{render:s,className:u,style:c,...i}=e,{store:p}=D(),r=p.useState("open"),m=p.useState("mounted"),f=p.useState("transitionStatus"),R=p.useState("lastOpenChangeReason"),h=Oe(),x={open:r,transitionStatus:f};return O("div",e,{ref:h?.backdropRef?[n,h.backdropRef]:n,state:x,stateAttributesMapping:nt,props:[{role:"presentation",hidden:!m,style:{pointerEvents:R===y.triggerHover?"none":void 0,userSelect:"none",WebkitUserSelect:"none"}},i]})},"MenuBackdrop"));var Mt=M(E(),1);var Rt=M(E(),1);var zt=Rt.createContext(void 0);function cn(){let t=Rt.useContext(zt);if(t===void 0)throw new Error(G(30));return t}o(cn,"useMenuCheckboxItemContext");var je=M(E(),1);var dn=M(E(),1);function xt(t){let{closeOnClick:e,highlighted:n,id:s,nodeId:u,store:c,typingRef:i,itemRef:p,itemMetadata:r}=t,{events:m}=c.useState("floatingTreeRoot"),f=c.useState("open"),R=Oe(!0),h=R!==void 0;return dn.useMemo(()=>({id:s,role:"menuitem",tabIndex:f&&n?0:-1,onKeyDown(x){x.key===" "&&i?.current&&x.preventDefault()},onMouseMove(x){u&&m.emit("itemhover",{nodeId:u,target:x.currentTarget})},onClick(x){e&&m.emit("close",{domEvent:x,reason:y.itemPress})},onMouseUp(x){if(R){let P=R.initialCursorPointRef.current;if(R.initialCursorPointRef.current=null,h&&P&&Math.abs(x.clientX-P.x)<=1&&Math.abs(x.clientY-P.y)<=1||h&&!ot.os.mac&&x.button===2)return}p.current&&c.context.allowMouseUpTriggerRef.current&&(!h||x.button===2)&&r.type==="regular-item"&&so(p.current,x,{detail:1})}}),[e,n,s,m,u,f,c,i,p,R,h,r])}o(xt,"useMenuItemCommonProps");var Te={type:"regular-item"};function ke(t){let{closeOnClick:e,disabled:n,highlighted:s,id:u,store:c,typingRef:i=c.context.typingRef,nativeButton:p,itemMetadata:r,nodeId:m}=t,f=je.useRef(null),{getButtonProps:R,buttonRef:h}=Ge({disabled:n,focusableWhenDisabled:!0,native:p,composite:!0}),x=xt({closeOnClick:e,highlighted:s,id:u,nodeId:m,store:c,typingRef:i,itemRef:f,itemMetadata:r}),P=je.useCallback(A=>he(x,{onMouseEnter(){r.type==="submenu-trigger"&&r.setActive()}},A,R),[x,R,r]),S=tt(f,h);return je.useMemo(()=>({getItemProps:P,itemRef:S}),[P,S])}o(ke,"useMenuItem");var pn="data-checked",ln="data-unchecked";var we={checked(t){return t?{[pn]:""}:{[ln]:""}},...io};var mn=M(me(),1);var fn=Mt.forwardRef(o(function(e,n){let{render:s,className:u,id:c,label:i,nativeButton:p=!1,disabled:r=!1,closeOnClick:m=!1,checked:f,defaultChecked:R,onCheckedChange:h,style:x,...P}=e,S=ae({guess:!0,label:i}),A=K(!0),d=Z(c),{store:g}=D(),l=g.useState("disabled"),V=r||l,v=g.useState("isActive",S.index),C=g.useState("itemProps"),[B,b]=it({controlled:f,default:R??!1,name:"MenuCheckboxItem",state:"checked"}),{getItemProps:z,itemRef:F}=ke({closeOnClick:m,disabled:V,highlighted:v,id:d,store:g,nativeButton:p,nodeId:A?.context.nodeId,itemMetadata:Te}),N=Mt.useMemo(()=>({disabled:V,highlighted:v,checked:B}),[V,v,B]);function a(Y){let T=re(y.itemPress,Y.nativeEvent,void 0,{preventUnmountOnClose:Ue});h?.(!B,T),!T.isCanceled&&b(k=>!k)}o(a,"handleClick");let H=O("div",e,{state:N,stateAttributesMapping:we,props:[C,{role:"menuitemcheckbox","aria-checked":B,onClick:a},P,z],ref:[F,n,S.ref]});return(0,mn.jsx)(zt.Provider,{value:N,children:H})},"MenuCheckboxItem"));var ht=M(E(),1);var gn=ht.forwardRef(o(function(e,n){let{render:s,className:u,style:c,keepMounted:i=!1,...p}=e,r=cn(),m=ht.useRef(null),{transitionStatus:f,mounted:R,setMounted:h}=st(r.checked);He({batch:!0,enabled:!r.checked,open:r.checked,ref:m,onComplete(){r.checked||h(!1)}});let x={checked:r.checked,disabled:r.disabled,highlighted:r.highlighted,transitionStatus:f};return O("span",e,{state:x,ref:[n,m],stateAttributesMapping:we,props:{"aria-hidden":!0,...p},enabled:i||R})},"MenuCheckboxItemIndicator"));var Ct=M(E(),1);var bt=M(E(),1);var We=bt.createContext(void 0);function Rn(){let t=bt.useContext(We);if(t===void 0)throw new Error(G(31));return t}o(Rn,"useMenuGroupRootContext");var xn=M(me(),1);var Mn=Ct.forwardRef(o(function(e,n){let{render:s,className:u,style:c,...i}=e,[p,r]=Ct.useState(void 0),m=O("div",e,{ref:n,props:{role:"group","aria-labelledby":p,...i}});return(0,xn.jsx)(We.Provider,{value:r,children:m})},"MenuGroup"));var hn=M(E(),1);var bn=hn.forwardRef(o(function(e,n){let{render:s,className:u,style:c,id:i,...p}=e,r=Z(i),m=Rn();return se(()=>(m(r),()=>{m(f=>f===r?void 0:f)}),[m,r]),O("div",e,{ref:n,props:{id:r,"aria-hidden":!0,...p}})},"MenuGroupLabel"));var Cn=M(E(),1);var vn=Cn.forwardRef(o(function(e,n){let{render:s,className:u,id:c,label:i,nativeButton:p=!1,disabled:r=!1,closeOnClick:m=!0,style:f,...R}=e,h=ae({guess:!0,label:i}),x=K(!0),P=Z(c),{store:S}=D(),A=S.useState("disabled"),d=r||A,g=S.useState("isActive",h.index),l=S.useState("itemProps"),{getItemProps:V,itemRef:v}=ke({closeOnClick:m,disabled:d,highlighted:g,id:P,store:S,nativeButton:p,nodeId:x?.context.nodeId,itemMetadata:Te});return O("div",e,{state:{disabled:d,highlighted:g},props:[l,R,V],ref:[v,n,h.ref]})},"MenuItem"));var vt=M(E(),1);var In=vt.forwardRef(o(function(e,n){let{render:s,className:u,id:c,label:i,closeOnClick:p=!1,style:r,...m}=e,f=vt.useRef(null),R=ae({guess:!0,label:i}),x=K(!0)?.context.nodeId,P=Z(c),{store:S}=D(),A=S.useState("isActive",R.index),d=S.useState("itemProps"),g=S.context.typingRef,{getButtonProps:l,buttonRef:V}=Ge({native:!1,composite:!0}),v=xt({closeOnClick:p,highlighted:A,id:P,nodeId:x,store:S,typingRef:g,itemRef:f,itemMetadata:Te});function C(b){return he(v,b,l)}return o(C,"getItemProps"),O("a",e,{state:{highlighted:A},props:[d,m,C],ref:[f,V,n,R.ref]})},"MenuLinkItem"));var It=M(E(),1);var En=M(me(),1);var yn=It.forwardRef(o(function(e,n){let{render:s,className:u,style:c,finalFocus:i,...p}=e,{store:r}=D(),{side:m,align:f}=K(),R=Xo(!0)!=null,h=r.useState("open"),x=r.useState("transitionStatus"),P=r.useState("popupProps"),S=r.useState("mounted"),A=r.useState("instantType"),d=r.useState("activeTriggerElement"),g=r.useState("parent"),l=r.useState("lastOpenChangeReason"),V=r.useState("rootId"),v=r.useState("floatingRootContext"),C=r.useState("floatingTreeRoot"),B=r.useState("closeDelay"),b=r.useState("hoverEnabled"),z=r.useState("disabled"),F=r.useState("openMethod"),N=g.type==="context-menu";He({open:h,ref:r.context.popupRef,onComplete(){h&&r.context.onOpenChangeComplete?.(!0)}}),It.useEffect(()=>{function k(ue){r.setOpen(!1,re(ue.reason,ue.domEvent))}return o(k,"handleClose"),C.events.on("close",k),()=>{C.events.off("close",k)}},[C.events,r]),Vo(v,{enabled:b&&!z&&!N&&g.type!=="menubar",closeDelay:B});let a=r.useStateSetter("popupElement"),H={transitionStatus:x,side:m,align:f,open:h,nested:g.type==="menu",instant:A},Y=O("div",e,{state:H,ref:[n,r.context.popupRef,a],stateAttributesMapping:nt,props:[P,{onKeyDown(k){R&&Jo.has(k.key)&&k.stopPropagation()}},Ko(x),p,{"data-rootownerid":V}]}),T=g.type===void 0||N;return(d||g.type==="menubar"&&l!==y.outsidePress)&&(T=!0),(0,En.jsx)(Mo,{context:v,openInteractionType:F,modal:N,disabled:!S,returnFocus:i===void 0?T:i,initialFocus:g.type!=="menu",restoreFocus:!0,externalTree:g.type!=="menubar"?C:void 0,previousFocusableElement:d,nextFocusableElement:g.type===void 0?r.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:g.type===void 0?r.context.beforeContentFocusGuardRef:void 0,children:Y})},"MenuPopup"));var Sn=M(E(),1);var Et=M(E(),1);var Yt=Et.createContext(void 0);function Pn(){let t=Et.useContext(Yt);if(t===void 0)throw new Error(G(32));return t}o(Pn,"useMenuPortalContext");var Kt=M(me(),1);var Nn=Sn.forwardRef(o(function(e,n){let{keepMounted:s=!1,...u}=e,{store:c,parent:i}=D();if(!(c.useState("mounted")||s))return null;let m=i.type==="menu"||i.type==="menubar"?"group":void 0;return(0,Kt.jsx)(Yt.Provider,{value:s,children:(0,Kt.jsx)(fo,{ref:n,...u,portalOwnerRole:m})})},"MenuPortal"));var be=M(E(),1);var ze=M(me(),1);var On=be.forwardRef(o(function(e,n){let{anchor:s,positionMethod:u="absolute",className:c,render:i,side:p,align:r,sideOffset:m=0,alignOffset:f=0,collisionBoundary:R="clipping-ancestors",collisionPadding:h=5,arrowPadding:x=5,sticky:P=!1,disableAnchorTracking:S=!1,collisionAvoidance:A=lo,style:d,...g}=e,{store:l}=D(),V=Pn(),v=Oe(!0),C=l.useState("parent"),B=l.useState("floatingRootContext"),b=l.useState("floatingTreeRoot"),z=l.useState("mounted"),F=l.useState("open"),N=l.useState("modal"),a=l.useState("openMethod"),H=l.useState("activeTriggerElement"),Y=l.useState("transitionStatus"),T=l.useState("positionerElement"),k=l.useState("instantType"),ue=l.useState("adaptiveOrigin"),te=l.useState("lastOpenChangeReason"),W=l.useState("floatingNodeId"),ye=l.useState("floatingParentNodeId"),w=B.useState("domReferenceElement"),fe=be.useRef(null),ge=rt(T),ce=s,Ce=m,Re=f,de=r,X=A;C.type==="context-menu"&&(ce=s??C.context?.anchor,de=de??"start",!p&&de!=="center"&&(Re=e.alignOffset??2,Ce=e.sideOffset??-5));let oe=p,pe=de;C.type==="menu"?(oe=oe??"inline-end",pe=pe??"start",X=e.collisionAvoidance??mo):C.type==="menubar"&&(oe=oe??(C.context.orientation==="vertical"?"inline-end":"bottom"),pe=pe??"start");let q=C.type==="context-menu",ne=zo({anchor:ce,floatingRootContext:B,positionMethod:v?"fixed":u,mounted:z,side:oe,sideOffset:Ce,align:pe,alignOffset:Re,arrowPadding:q?0:x,collisionBoundary:R,collisionPadding:h,sticky:P,nodeId:W,keepMounted:V,disableAnchorTracking:S,collisionAvoidance:X,shift:q?{crossAxis:!("side"in X&&X.side==="flip"),rootBoundary:"layoutViewport"}:void 0,externalTree:b,adaptiveOrigin:ue});be.useEffect(()=>{function L(_){_.open&&(_.parentNodeId===W&&l.set("hoverEnabled",!1),_.nodeId!==W&&_.parentNodeId===l.select("floatingParentNodeId")&&l.setOpen(!1,re(y.siblingOpen)))}return o(L,"onMenuOpenChange"),b.events.on("menuopenchange",L),()=>{b.events.off("menuopenchange",L)}},[l,b.events,W]),be.useEffect(()=>{if(l.select("floatingParentNodeId")==null)return;function L(_){if(_.open||_.nodeId!==l.select("floatingParentNodeId"))return;let Ie=_.reason??y.siblingOpen;l.setOpen(!1,re(Ie))}return o(L,"onParentClose"),b.events.on("menuopenchange",L),()=>{b.events.off("menuopenchange",L)}},[b.events,l]);let le=Ne();be.useEffect(()=>{F||le.clear()},[F,le]),be.useEffect(()=>{function L(_){if(!(!F||_.nodeId!==l.select("floatingParentNodeId")))if(_.target&&H&&H!==_.target){let Ie=l.select("closeDelay");Ie>0?le.isStarted()||le.start(Ie,()=>{l.setOpen(!1,re(y.siblingOpen))}):l.setOpen(!1,re(y.siblingOpen))}else le.clear()}return o(L,"onItemHover"),b.events.on("itemhover",L),()=>{b.events.off("itemhover",L)}},[b.events,F,H,l,le]),be.useEffect(()=>{let L={open:F,nodeId:W,parentNodeId:ye,reason:l.select("lastOpenChangeReason")};b.events.emit("menuopenchange",L)},[b.events,F,l,W,ye]),se(()=>{let L=w,_=fe.current;if(L&&(fe.current=L),_&&L&&L!==_){l.set("instantType",void 0);let Ie=new AbortController;return ge(()=>{l.set("instantType","trigger-change")},Ie.signal),()=>{Ie.abort()}}},[w,ge,l]);let Be={open:F,side:ne.side,align:ne.align,anchorHidden:ne.anchorHidden,nested:C.type==="menu",instant:k},Le=C.type==="menubar"&&C.context.modal,xe=N&&te!==y.triggerHover;Wo(F&&(Le||xe),a==="touch",T,H);let Me=$o(e,Be,{styles:ne.positionerStyles,transitionStatus:Y,props:g,refs:[n,l.useStateSetter("positionerElement")],hidden:!z,inert:!F}),Pe=z&&C.type!=="menu"&&(C.type!=="menubar"&&N&&te!==y.triggerHover||C.type==="menubar"&&C.context.modal),ve=null;return C.type==="menubar"?ve=C.context.contentElement:C.type===void 0&&(ve=H),(0,ze.jsxs)(Ht.Provider,{value:ne,children:[Pe&&(0,ze.jsx)(Yo,{ref:C.type==="context-menu"||C.type==="nested-context-menu"?C.context.internalBackdropRef:null,inert:Ho(!F),cutout:ve}),(0,ze.jsx)(Ro,{id:W,children:(0,ze.jsx)(tn,{elementsRef:l.context.itemDomElements,labelsRef:l.context.itemLabels,children:Me})})]})},"MenuPositioner"));var _e=M(E(),1);var yt=M(E(),1);var $t=yt.createContext(void 0);function Tn(){let t=yt.useContext($t);if(t===void 0)throw new Error(G(34));return t}o(Tn,"useMenuRadioGroupContext");var Wt=M(me(),1);var kn=_e.memo(_e.forwardRef(o(function(e,n){let{render:s,className:u,value:c,defaultValue:i,onValueChange:p,disabled:r=!1,style:m,"aria-labelledby":f,...R}=e,[h,x]=_e.useState(void 0),[P,S]=it({controlled:c,default:i,name:"MenuRadioGroup"}),A=Se((V,v)=>{p?.(V,v),!v.isCanceled&&S(V)}),g=O("div",e,{state:{disabled:r},ref:n,props:{role:"group","aria-labelledby":f??h,"aria-disabled":r||void 0,...R}}),l=_e.useMemo(()=>({value:P,setValue:A,disabled:r}),[P,A,r]);return(0,Wt.jsx)(We.Provider,{value:x,children:(0,Wt.jsx)($t.Provider,{value:l,children:g})})},"MenuRadioGroup")));var St=M(E(),1);var Pt=M(E(),1);var Jt=Pt.createContext(void 0);function wn(){let t=Pt.useContext(Jt);if(t===void 0)throw new Error(G(35));return t}o(wn,"useMenuRadioItemContext");var _n=M(me(),1);var Dn=St.forwardRef(o(function(e,n){let{render:s,className:u,id:c,label:i,nativeButton:p=!1,disabled:r=!1,closeOnClick:m=!1,value:f,style:R,...h}=e,x=ae({guess:!0,label:i}),P=K(!0),S=Z(c),{store:A}=D(),d=A.useState("isActive",x.index),g=A.useState("itemProps"),{value:l,setValue:V,disabled:v}=Tn(),C=A.useState("disabled"),B=r||v||C,b=l===f,{getItemProps:z,itemRef:F}=ke({closeOnClick:m,disabled:B,highlighted:d,id:S,store:A,nativeButton:p,nodeId:P?.context.nodeId,itemMetadata:Te}),N=St.useMemo(()=>({disabled:B,highlighted:d,checked:b}),[B,d,b]);function a(Y){let T=re(y.itemPress,Y.nativeEvent,void 0,{preventUnmountOnClose:Ue});V(f,T)}o(a,"handleClick");let H=O("div",e,{state:N,stateAttributesMapping:we,props:[g,{role:"menuitemradio","aria-checked":b,onClick:a},h,z],ref:[F,n,x.ref]});return(0,_n.jsx)(Jt.Provider,{value:N,children:H})},"MenuRadioItem"));var Nt=M(E(),1);var An=Nt.forwardRef(o(function(e,n){let{render:s,className:u,style:c,keepMounted:i=!1,...p}=e,r=wn(),m=Nt.useRef(null),{transitionStatus:f,mounted:R,setMounted:h}=st(r.checked);He({batch:!0,enabled:!r.checked,open:r.checked,ref:m,onComplete(){r.checked||h(!1)}});let x={checked:r.checked,disabled:r.disabled,highlighted:r.highlighted,transitionStatus:f};return O("span",e,{state:x,stateAttributesMapping:we,ref:[n,m],props:{"aria-hidden":!0,...p},enabled:i||R})},"MenuRadioItemIndicator"));var U=M(E(),1);var Ot=M(E(),1);var cr=Ot.createContext(null);function Tt(t){let e=Ot.useContext(cr);if(e===null&&!t)throw new Error(G(5));return e}o(Tt,"useMenubarContext");var Je=M(E(),1);var Vn={..._o,disabled:o(t=>t.parent.type==="menubar"&&t.parent.context.disabled||t.disabled,"disabled"),modal:o(t=>(t.parent.type===void 0||t.parent.type==="context-menu")&&(t.modal??!0),"modal"),openMethod:o(t=>t.openMethod,"openMethod"),allowMouseEnter:o(t=>t.allowMouseEnter,"allowMouseEnter"),highlightItemOnHover:o(t=>t.highlightItemOnHover,"highlightItemOnHover"),parent:o(t=>t.parent,"parent"),rootId:o(t=>t.parent.type==="menu"?t.parent.store.select("rootId"):t.parent.type!==void 0?t.parent.context.rootId:t.rootId,"rootId"),activeIndex:o(t=>t.activeIndex,"activeIndex"),isActive:o((t,e)=>t.activeIndex===e,"isActive"),hoverEnabled:o(t=>t.hoverEnabled,"hoverEnabled"),instantType:o(t=>t.instantType,"instantType"),lastOpenChangeReason:o(t=>t.openChangeReason,"lastOpenChangeReason"),floatingTreeRoot:o(t=>t.parent.type==="menu"?t.parent.store.select("floatingTreeRoot"):t.floatingTreeRoot,"floatingTreeRoot"),floatingNodeId:o(t=>t.floatingNodeId,"floatingNodeId"),floatingParentNodeId:o(t=>t.floatingParentNodeId,"floatingParentNodeId"),itemProps:o(t=>t.itemProps,"itemProps"),closeDelay:o(t=>t.closeDelay,"closeDelay"),adaptiveOrigin:o(t=>t.adaptiveOrigin,"adaptiveOrigin"),keyboardEventRelay:o(t=>{if(t.keyboardEventRelay)return t.keyboardEventRelay;if(t.parent.type==="menu")return t.parent.store.select("keyboardEventRelay")},"keyboardEventRelay")},kt=class extends Co{static{o(this,"MenuStore")}constructor(e,n,s=!1){let u=new Ut,c=Fn(u,n,s,e);super(c,Ln(u),Vn),this.unsubscribeParentListener=this.observe("parent",i=>{if(this.unsubscribeParentListener?.(),i.type==="menu"){let p=i.store.select("rootId"),r=i.store.select("floatingTreeRoot"),m=i.store.select("keyboardEventRelay");this.unsubscribeParentListener=i.store.subscribe(()=>{let f=i.store.select("rootId"),R=i.store.select("floatingTreeRoot"),h=i.store.select("keyboardEventRelay");p===f&&r===R&&m===h||(p=f,r=R,m=h,this.notifyAll())}),this.context.allowMouseUpTriggerRef=i.store.context.allowMouseUpTriggerRef;return}i.type!==void 0&&(this.context.allowMouseUpTriggerRef=i.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,n){this.state.floatingRootContext.context.events.emit("setOpen",{open:e,eventDetails:n})}unsubscribeParentListener=null};function Bn(){let t=new Ut,e=new Fo(Object.freeze(Fn(t)),Object.freeze(Ln(t)),Vn);return Object.assign(e,{setOpen:Ue})}o(Bn,"createNullMenuStore");function Ln(t){return{positionerRef:Je.createRef(),popupRef:Je.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:Je.createRef(),beforeContentFocusGuardRef:Je.createRef(),onOpenChangeComplete:void 0,triggerElements:t}}o(Ln,"createInitialContext");function Fn(t,e,n=!1,s){return{...wo(t,e,n),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new at,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:ie,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0,...s}}o(Fn,"createInitialState");var wt=M(E(),1);var Xt=wt.createContext(void 0);function _t(){return wt.useContext(Xt)}o(_t,"useMenuSubmenuRootContext");var Xe=M(me(),1);var Dt=co(o(function(e){let{children:n,open:s,onOpenChange:u,onOpenChangeComplete:c,defaultOpen:i=!1,disabled:p=!1,modal:r,loopFocus:m=!0,orientation:f="vertical",actionsRef:R,closeParentOnEsc:h=!1,handle:x,triggerId:P,defaultTriggerId:S=null,highlightItemOnHover:A=!0}=e,d=Oe(!0),g=D(!0),l=Tt(!0),V=_t(),v=U.useMemo(()=>V&&g?{type:"menu",store:g.store}:l?{type:"menubar",context:l}:d&&!g?{type:"context-menu",context:d}:{type:void 0},[d,g,l,V]),C=Bt(),B=Bt(),b=ut(),z=v.type==="menu"?v.store:void 0,F=(s??i)&&z?.state.transitionStatus==="starting",N=Ze(()=>F?z?.state.instantType:void 0).current,a=dr({open:i,openProp:s,activeTriggerId:S,triggerIdProp:P,parent:v,disabled:p,highlightItemOnHover:A,modal:v.type===void 0?r:void 0,rootId:C,instantType:N},B,b!=null);a.useControlledProp("openProp",s),a.useControlledProp("triggerIdProp",P),a.useContextCallback("onOpenChangeComplete",c);let H=a.useState("floatingTreeRoot"),Y=ct(H),T=a.useState("open"),k=a.useState("activeTriggerElement"),ue=a.useState("positionerElement"),te=a.useState("hoverEnabled"),W=a.useState("disabled"),ye=a.useState("lastOpenChangeReason"),w=a.useState("parent"),fe=a.useState("activeIndex"),ge=a.useState("payload"),ce=a.useState("floatingParentNodeId"),Ce=U.useRef(null),Re=U.useRef(w.type!=="context-menu"),de=Ne(),X=U.useRef(!0),oe=Ne(),pe=ce!=null,{openMethod:q,triggerProps:ne}=Uo(T);a.useSyncedValues({disabled:p,highlightItemOnHover:A,modal:w.type===void 0?r:void 0,openMethod:q,rootId:C}),Oo(a);let{forceUnmount:le,transitionStatus:Be}=To(T,a,()=>{a.set("allowMouseEnter",!1)},F),Le=rt(a.context.popupRef);U.useEffect(()=>{if(N===void 0)return;let I=o(()=>{a.state.instantType===N&&a.set("instantType",void 0)},"clearSeededInstantType");if(!T){I();return}if(Be!==void 0)return;if(a.context.popupRef.current==null){I();return}let j=new AbortController;return Le(I,j.signal),()=>{j.abort()}},[N,T,Be,Le,a]),se(()=>{d&&!g?a.update({parent:{type:"context-menu",context:d},floatingNodeId:Y,floatingParentNodeId:b}):g&&a.update({floatingNodeId:Y,floatingParentNodeId:b})},[d,g,Y,b,a]),U.useEffect(()=>{if(T||(Ce.current=null),w.type==="context-menu"){if(!T){de.clear(),Re.current=!1;return}de.start(500,()=>{Re.current=!0})}},[de,T,w.type]),se(()=>{!T&&!te&&a.set("hoverEnabled",!0)},[T,te,a]);let xe=Se((I,j)=>{let Q=j.reason;if(!I&&!a.select("open")||T===I&&j.trigger===k&&ye===Q)return;let nr=So(j);if(!I&&j.trigger==null&&(j.trigger=k??void 0),u?.(I,j),j.isCanceled)return;a.state.floatingRootContext.dispatchOpenChange(I,j);let Vt=j.event;if(I===!1&&Vt?.type==="click"&&Vt.pointerType==="touch"&&!X.current)return;I&&Q===y.triggerFocus?(X.current=!1,oe.start(300,()=>{X.current=!0})):(X.current=!0,oe.clear());let to=(Q===y.triggerPress||Q===y.itemPress)&&Vt.detail===0,rr=!I&&(Q===y.escapeKey||Q==null);Ce.current=j.event;let Ye=Po(a.state,I,j.trigger,nr());Ye.openChangeReason=Q,w.type==="menubar"&&(Q===y.triggerFocus||Q===y.focusOut||Q===y.triggerHover||Q===y.listNavigation||Q===y.siblingOpen)?Ye.instantType="group":to||rr?Ye.instantType=to?"click":"dismiss":Ye.instantType=void 0,a.update(Ye)}),Me=vo({popupStore:a,floatingRootContext:a.state.floatingRootContext,floatingId:B,nested:b!=null,onOpenChange:xe}),Pe=Me.context.events;se(()=>{let I=o(({open:j,eventDetails:Q})=>xe(j,Q),"handleSetOpenEvent");return Pe.on("setOpen",I),()=>{Pe?.off("setOpen",I)}},[Pe,xe]);let ve=U.useCallback(()=>{a.setOpen(!1,re(y.imperativeAction))},[a]);U.useImperativeHandle(R,()=>({unmount:le,close:ve}),[le,ve]);let L;w.type==="context-menu"&&(L=w.context),U.useImperativeHandle(L?.positionerRef,()=>ue,[ue]),U.useImperativeHandle(L?.actionsRef,()=>({setOpen:xe}),[xe]);let _=ho(Me,{enabled:!W,bubbles:{escapeKey:h&&w.type==="menu"},outsidePress(){return w.type!=="context-menu"||Ce.current?.type==="contextmenu"?!0:Re.current},externalTree:pe?H:void 0}),Ie=jo(),qn=U.useCallback(I=>{a.select("activeIndex")!==I&&a.set("activeIndex",I)},[a]),Ae=Bo(Me,{enabled:!W,listRef:a.context.itemDomElements,activeIndex:fe,nested:w.type!==void 0,loopFocus:m,orientation:f,parentOrientation:w.type==="menubar"?w.context.orientation:void 0,rtl:Ie==="rtl",disabledIndices:$e,onNavigate:qn,openOnArrowKeyDown:w.type!=="context-menu",externalTree:pe?H:void 0,focusItemOnHover:A}),Qn=U.useCallback(I=>{a.context.typingRef.current=I},[a]),Qe=Lo(Me,{enabled:!W,listRef:a.context.itemLabels,elementsRef:a.context.itemDomElements,activeIndex:fe,resetMs:500,onMatch:o(I=>{T&&I!==fe&&a.set("activeIndex",I)},"onMatch"),onTyping:Qn}),Zn=U.useMemo(()=>{let I=he(Qe.reference,Ae.reference,_.reference,{onMouseMove(){a.set("allowMouseEnter",!0)}},ne);return I["aria-haspopup"]="menu",I["aria-expanded"]=T,I},[a,Qe.reference,Ae.reference,_.reference,ne,T]),Zt=U.useMemo(()=>{let I=he(Ae.trigger,_.trigger,ne);return I["aria-haspopup"]="menu",I["aria-expanded"]=!1,I},[Ae.trigger,_.trigger,ne]);Ze(()=>(a.update({inactiveTriggerProps:Zt}),null));let er=U.useMemo(()=>he(Io,{id:B,role:"menu","aria-orientation":f==="horizontal"?"horizontal":void 0,"aria-labelledby":k?.id,onMouseMove(){a.set("allowMouseEnter",!0),w.type==="menu"&&a.set("hoverEnabled",!1)},onClick(){a.select("hoverEnabled")&&a.set("hoverEnabled",!1)},onKeyDown(I){let j=a.select("keyboardEventRelay");j&&!I.isPropagationStopped()&&j(I)}},Qe.floating,Ae.floating,_.floating),[k,B,f,w.type,a,Qe.floating,Ae.floating,_.floating]),tr=Ae.item??ie;ko(a,{floatingRootContext:Me,activeTriggerProps:Zn,inactiveTriggerProps:Zt,popupProps:er,itemProps:tr});let or=U.useMemo(()=>({store:a,parent:v}),[a,v]),eo=(0,Xe.jsxs)(jt.Provider,{value:or,children:[x&&(0,Xe.jsx)(Eo,{handle:x,store:a}),typeof n=="function"?n({payload:ge}):n]});return w.type===void 0||w.type==="context-menu"?(0,Xe.jsx)(xo,{externalTree:H,children:eo}):eo},"MenuRoot"));function dr(t,e,n){return Ze(()=>new kt(t,e,n)).current}o(dr,"useMenuRootStore");var Gn=M(E(),1);var qt=M(me(),1);function Un(t){let e=D().store,n=Gn.useMemo(()=>({parentMenu:e}),[e]);return(0,qt.jsx)(Xt.Provider,{value:n,children:(0,qt.jsx)(Dt,{...t})})}o(Un,"MenuSubmenuRoot");var $=M(E(),1);var Hn=M(E(),1);function jn(t={}){let{highlightItemOnHover:e,highlightedIndex:n,onHighlightedIndexChange:s}=et(),{ref:u,index:c}=ae(t),i=n===c,p=Hn.useRef(null),r=tt(u,p);return{compositeProps:{tabIndex:i?0:-1,onFocus(){s(c)},onMouseMove(){let f=p.current;if(!e||!f)return;let R=f.hasAttribute("disabled")||f.ariaDisabled==="true";!i&&!R&&f.focus()}},compositeRef:r,index:c}}o(jn,"useCompositeItem");function zn(t){let{render:e,className:n,style:s,state:u=ie,props:c=$e,refs:i=$e,metadata:p,stateAttributesMapping:r,tag:m="div",...f}=t,{compositeProps:R,compositeRef:h}=jn({metadata:p});return O(m,t,{state:u,ref:[h,...i],props:[R,...c,f],stateAttributesMapping:r})}o(zn,"CompositeItem");function Qt(t){if(oo(t)&&t.hasAttribute("data-rootownerid"))return t.getAttribute("data-rootownerid");if(!no(t))return Qt(ro(t))}o(Qt,"findRootOwnerId");var At=M(E(),1);function Yn(t){let{enabled:e=!0,mouseDownAction:n,open:s}=t,u=At.useRef(!1);return At.useMemo(()=>e?{onMouseDown:o(c=>{(n==="open"&&!s||n==="close"&&s)&&(u.current=!0,Ke(c.currentTarget).addEventListener("click",()=>{u.current=!1},{once:!0}))},"onMouseDown"),onClick:o(c=>{u.current&&(u.current=!1,c.preventBaseUIHandler())},"onClick")}:ie,[e,n,s])}o(Yn,"useMixedToggleClickHandler");var De=M(me(),1);var Kn=po(o(function(e,n){let{render:s,className:u,style:c,disabled:i=!1,nativeButton:p=!0,id:r,openOnHover:m,delay:f=100,closeDelay:R=0,handle:h,payload:x,...P}=e,S=D(!0),d=Do(h)??S?.store;if(!d)throw new Error(G(85));let g=Z(r),l=d.useState("isTriggerActive",g),V=d.useState("floatingRootContext"),v=d.useState("isOpenedByTrigger",g),C=d.useState("triggerPopupId",g),B=$.useRef(null),b=lr(),z=et(!0),F=go(),N=$.useMemo(()=>F??new at,[F]),a=ct(N),H=ut(),{registerTrigger:Y,isMountedByThisTrigger:T}=No(g,B,d,{payload:x,closeDelay:R,parent:b,floatingTreeRoot:N,floatingNodeId:a,floatingParentNodeId:H,keyboardEventRelay:z?.relayKeyboardEvent}),k=b.type==="menubar",ue=d.useState("disabled"),te=i||ue||k&&b.context.disabled,{getButtonProps:W,buttonRef:ye}=Ge({disabled:te,native:p});$.useEffect(()=>{!v&&b.type===void 0&&(d.context.allowMouseUpTriggerRef.current=!1)},[d,v,b.type]);let w=$.useRef(null),fe=Ne(),ge=Se(L=>{if(!w.current)return;fe.clear(),d.context.allowMouseUpTriggerRef.current=!1;let _=L.target;Lt(w.current,_)||Lt(d.select("positionerElement"),_)||_===w.current||_!=null&&Qt(_)===d.select("rootId")||on(L,w.current)||N.events.emit("close",{domEvent:L,reason:y.cancelOpen})});$.useEffect(()=>{v&&d.select("lastOpenChangeReason")===y.triggerHover&&Ke(w.current).addEventListener("mouseup",ge,{once:!0})},[v,ge,d]);let ce=k&&b.context.hasSubmenuOpen,Re=pt(V,{enabled:(m??ce)&&!te&&(!k||ce&&!T),handleClose:lt({blockPointerEvents:!k}),mouseOnly:!0,move:!1,restMs:b.type===void 0?f:void 0,delay:{close:R},triggerElementRef:B,externalTree:N,isActiveTrigger:l,isClosing:o(()=>d.select("transitionStatus")==="ending","isClosing")}),de=pr(v,d.select("lastOpenChangeReason")),X=dt(V,{enabled:!te,event:v&&k?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:b.type===void 0?de:!1}),oe=Ao(V,{enabled:!te&&ce}),pe=Yn({open:v,enabled:k,mouseDownAction:"open"}),q=$.useMemo(()=>he(oe.reference,X.reference),[oe.reference,X.reference]),ne=d.useState("triggerProps",T),{preFocusGuardRef:le,handlePreFocusGuardFocus:Be,handleFocusTargetFocus:Le}=Go(d,B),xe={disabled:te,open:v},Me=[w,n,ye,Y,B],Pe=[q,Re??ie,ne,{"aria-haspopup":"menu","aria-controls":C,id:g,onMouseDown:o(L=>{if(d.select("open"))return;fe.start(200,()=>{d.context.allowMouseUpTriggerRef.current=!0}),Ke(L.currentTarget).addEventListener("mouseup",ge,{once:!0})},"onMouseDown")},k?{role:"menuitem"}:{},pe,P,W],ve=O("button",e,{enabled:!k,stateAttributesMapping:Ft,state:xe,ref:Me,props:Pe});return k?(0,De.jsx)(zn,{tag:"button",render:s,className:u,style:c,state:xe,refs:Me,props:Pe,stateAttributesMapping:Ft}):v?(0,De.jsxs)($.Fragment,{children:[(0,De.jsx)(Gt,{ref:le,onFocus:Be},`${g}-pre-focus-guard`),(0,De.jsx)($.Fragment,{children:ve},g),(0,De.jsx)(Gt,{ref:d.context.triggerFocusTargetRef,onFocus:Le},`${g}-post-focus-guard`)]}):(0,De.jsx)($.Fragment,{children:ve},g)},"MenuTrigger"));function pr(t,e){let n=Ne(),[s,u]=$.useState(!1);return se(()=>{t&&e===y.triggerHover?(u(!0),n.start(500,()=>{u(!1)})):t||(n.clear(),u(!1))},[t,e,n]),s}o(pr,"useStickIfOpen");function lr(){let t=Tt(!0);return $.useMemo(()=>t?{type:"menubar",context:t}:{type:void 0},[t])}o(lr,"useMenuParent");var $n=M(E(),1);var Wn=$n.forwardRef(o(function(e,n){let{render:s,className:u,style:c,children:i,...p}=e,{store:r}=D(),{side:m}=K(),f=r.useState("instantType"),{children:R,state:h}=Qo({store:r,side:m,children:i}),x={activationDirection:h.activationDirection,transitioning:h.transitioning,instant:f};return O("div",e,{state:x,ref:n,props:[p,{children:R}],stateAttributesMapping:qo})},"MenuViewport"));var Ee=M(E(),1);var mr={"aria-expanded":void 0},Jn=Ee.forwardRef(o(function(e,n){let{render:s,className:u,style:c,label:i,id:p,nativeButton:r=!1,openOnHover:m=!0,delay:f=100,closeDelay:R=0,disabled:h=!1,...x}=e,P=_t();if(!P?.parentMenu)throw new Error(G(37));let S=ae({guess:!0,label:i}),A=K(),{store:d}=D(),g=Z(p),l=d.useState("open"),V=d.useState("floatingRootContext"),v=d.useState("floatingTreeRoot"),C=d.useState("triggerPopupId",g),B=yo(g,d),b=Se(q=>{B(q),q!==null&&d.select("open")&&d.select("activeTriggerId")==null&&d.update({activeTriggerId:g??null,activeTriggerElement:q,closeDelay:R})}),z=Ee.useRef(null),F=Ee.useCallback(q=>{z.current=q,d.set("activeTriggerElement",q)},[d]);se(()=>(b(z.current),()=>b(null)),[b,g,d]),d.useSyncedValue("closeDelay",R);let N=P.parentMenu,a=d.useState("disabled"),H=N.useState("disabled"),Y=h||a||H,T=N.useState("itemProps"),k=N.useState("isActive",S.index),ue=Ee.useMemo(()=>({type:"submenu-trigger",setActive(){N.select("highlightItemOnHover")&&N.set("activeIndex",S.index)}}),[N,S.index]),{getItemProps:te,itemRef:W}=ke({closeOnClick:!1,disabled:Y,highlighted:k,id:g,store:d,typingRef:N.context.typingRef,nativeButton:r,itemMetadata:ue,nodeId:A?.context.nodeId}),ye=d.useState("hoverEnabled"),w=pt(V,{enabled:ye&&m&&!Y,handleClose:lt({blockPointerEvents:!0}),mouseOnly:!0,move:!0,restMs:f,delay:{open:f,close:R},shouldOpen:f>0?()=>N.select("allowMouseEnter"):void 0,triggerElementRef:z,externalTree:v,isClosing:o(()=>d.select("transitionStatus")==="ending","isClosing"),guardStaleOpen:!0}),ge=dt(V,{enabled:!Y,event:"mousedown",toggle:!m,ignoreMouse:m,stickIfOpen:!1}).reference??ie,ce=d.useState("triggerProps",!0);delete ce.id;let Ce={disabled:Y,highlighted:k,open:l},Re=d.useState("openMethod"),X=d.useState("lastOpenChangeReason")===y.listNavigation||Re==="keyboard",oe=l&&X&&ot.screenReader.voiceOver;return O("div",e,{state:Ce,stateAttributesMapping:ao,props:[ge,w,ce,T,oe?mr:void 0,{"aria-controls":C,tabIndex:l||k?0:-1,onBlur(){k&&N.set("activeIndex",null)}},x,te],ref:[n,S.ref,W,b,F]})},"MenuSubmenuTrigger"));var qe=class extends bo{static{o(this,"MenuHandle")}constructor(){super(Bn(),"Menu")}open(e){this.openByTrigger(e)}close(){this.closePopup()}get isOpen(){return this.attachedStore?.select("open")??!1}};function Xn(){return new qe}o(Xn,"createMenuHandle");var J=M(me(),1);function Xc(t){let e=(0,Ve.c)(4),n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let s;return e[2]!==n?(s=(0,J.jsx)(ee.Root,{"data-slot":"dropdown-menu",...n}),e[2]=n,e[3]=s):s=e[3],s}o(Xc,"N");function qc(t){let e=(0,Ve.c)(4),n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let s;return e[2]!==n?(s=(0,J.jsx)(ee.Trigger,{"data-slot":"dropdown-menu-trigger",...n}),e[2]=n,e[3]=s):s=e[3],s}o(qc,"z");function Qc({align:t="start",alignOffset:e=0,side:n="bottom",sideOffset:s=4,className:u,...c}){return(0,J.jsx)(ee.Portal,{children:(0,J.jsx)(ee.Positioner,{className:"isolate z-50 outline-none",align:t,alignOffset:e,side:n,sideOffset:s,children:(0,J.jsx)(ee.Popup,{"data-slot":"dropdown-menu-content",className:Fe("z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-start-2 data-[side=inline-start]:slide-in-from-end-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95 animate-none! relative bg-popover before:pointer-events-none before:absolute before:inset-0 before:-z-1 before:rounded-[inherit] **:data-[slot$=-item]:focus:bg-foreground/10 **:data-[slot$=-item]:data-highlighted:bg-foreground/10 **:data-[slot$=-separator]:bg-foreground/5 **:data-[slot$=-trigger]:focus:bg-foreground/10 **:data-[slot$=-trigger]:aria-expanded:bg-foreground/10! **:data-[variant=destructive]:focus:bg-foreground/10! **:data-[variant=destructive]:text-accent-foreground! **:data-[variant=destructive]:**:text-accent-foreground!",u),...c})})})}o(Qc,"D");function Zc(t){let e=(0,Ve.c)(4),n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let s;return e[2]!==n?(s=(0,J.jsx)(ee.Group,{"data-slot":"dropdown-menu-group",...n}),e[2]=n,e[3]=s):s=e[3],s}o(Zc,"M");function ed(t){let e=(0,Ve.c)(10),n,s,u;e[0]!==t?({className:n,inset:s,...u}=t,e[0]=t,e[1]=n,e[2]=s,e[3]=u):(n=e[1],s=e[2],u=e[3]);let c;e[4]!==n?(c=Fe("px-2 py-2 text-xs text-muted-foreground data-inset:ps-7",n),e[4]=n,e[5]=c):c=e[5];let i;return e[6]!==s||e[7]!==u||e[8]!==c?(i=(0,J.jsx)(ee.GroupLabel,{"data-slot":"dropdown-menu-label","data-inset":s,className:c,...u}),e[6]=s,e[7]=u,e[8]=c,e[9]=i):i=e[9],i}o(ed,"y");function td({className:t,inset:e,variant:n="default",...s}){return(0,J.jsx)(ee.Item,{"data-slot":"dropdown-menu-item","data-inset":e,"data-variant":n,className:Fe("group/dropdown-menu-item relative flex cursor-default items-center gap-2 rounded-md px-2 py-2 text-xs outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:ps-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive",t),...s})}o(td,"I");function od(t){let e=(0,Ve.c)(15),n,s,u,c,i;e[0]!==t?({className:u,children:s,checked:n,inset:c,...i}=t,e[0]=t,e[1]=n,e[2]=s,e[3]=u,e[4]=c,e[5]=i):(n=e[1],s=e[2],u=e[3],c=e[4],i=e[5]);let p;e[6]!==u?(p=Fe("relative flex cursor-default items-center gap-2 rounded-md py-2 pe-8 ps-2 text-xs outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:ps-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",u),e[6]=u,e[7]=p):p=e[7];let r;e[8]===Symbol.for("react.memo_cache_sentinel")?(r=(0,J.jsx)("span",{className:"pointer-events-none absolute end-2 flex items-center justify-center","data-slot":"dropdown-menu-checkbox-item-indicator",children:(0,J.jsx)(ee.CheckboxItemIndicator,{children:(0,J.jsx)(en,{icon:Zo,strokeWidth:2})})}),e[8]=r):r=e[8];let m;return e[9]!==n||e[10]!==s||e[11]!==c||e[12]!==i||e[13]!==p?(m=(0,J.jsxs)(ee.CheckboxItem,{"data-slot":"dropdown-menu-checkbox-item","data-inset":c,className:p,checked:n,...i,children:[r,s]}),e[9]=n,e[10]=s,e[11]=c,e[12]=i,e[13]=p,e[14]=m):m=e[14],m}o(od,"_");function nd(t){let e=(0,Ve.c)(8),n,s;e[0]!==t?({className:n,...s}=t,e[0]=t,e[1]=n,e[2]=s):(n=e[1],s=e[2]);let u;e[3]!==n?(u=Fe("-mx-1 h-px bg-border",n),e[3]=n,e[4]=u):u=e[4];let c;return e[5]!==s||e[6]!==u?(c=(0,J.jsx)(ee.Separator,{"data-slot":"dropdown-menu-separator",className:u,...s}),e[5]=s,e[6]=u,e[7]=c):c=e[7],c}o(nd,"C");export{Xc as a,qc as b,Qc as c,Zc as d,ed as e,td as f,od as g,nd as h};
|
|
1
|
+
import{a as nn}from"./chunk-LMCBMC2V.js";import{a as ae,b as tn,c as on}from"./chunk-QF743FSL.js";import{a as bo,b as wo,c as _o,d as Do,e as Fo,f as Go,g as qo,h as Qo}from"./chunk-IQ5CIBXJ.js";import{$ as pt,A as xo,B as Mo,C as dt,E as ho,G as Co,I as vo,J as Io,M as Eo,N as yo,O as Po,P as So,R as No,S as Oo,T as To,U as ko,W as Ut,Y as Ao,_ as Vo,aa as Bo,ba as Lo,ca as lt,ea as Uo,fa as Ho,j as co,k as po,la as zo,ma as Yo,na as Ko,oa as $o,p as Gt,qa as Wo,r as lo,ra as Jo,s as mo,sa as Xo,u as fo,v as at,w as ut,x as go,y as ct,z as Ro}from"./chunk-YNCZVYCO.js";import{b as jo}from"./chunk-OWRWDDJT.js";import{i as Zo,k as en}from"./chunk-2NUCBQFU.js";import{D as Ne,H as rt,I as He,J as st,K as it,M as y,N as re,a as Bt,b as Z,c as ot,e as Lt,l as io,o as ao,p as Ft,q as uo,r as nt}from"./chunk-4SY2N2RS.js";import{a as et,b as so,c as Ge}from"./chunk-SCTYLLJT.js";import{f as oo,n as no,q as ro,u as Se,v as se,w as Ke}from"./chunk-OZID3UYF.js";import{a as Ze,b as he,d as G,e as tt,g as Ue,h as $e,i as ie,j as O}from"./chunk-L27FKJTG.js";import{x as Fe}from"./chunk-OYCDWIG2.js";import{a as ir}from"./chunk-A6TVTNKO.js";import{a as E,b as me}from"./chunk-ADABTCDI.js";import{a as o,c as sr,d as M}from"./chunk-5PEAXTYQ.js";var Ve=M(ir(),1);var ee={};sr(ee,{Arrow:()=>sn,Backdrop:()=>un,CheckboxItem:()=>fn,CheckboxItemIndicator:()=>gn,Group:()=>Mn,GroupLabel:()=>bn,Handle:()=>qe,Item:()=>vn,LinkItem:()=>In,Popup:()=>yn,Portal:()=>Nn,Positioner:()=>On,RadioGroup:()=>kn,RadioItem:()=>Dn,RadioItemIndicator:()=>An,Root:()=>Dt,Separator:()=>nn,SubmenuRoot:()=>Un,SubmenuTrigger:()=>Jn,Trigger:()=>Kn,Viewport:()=>Wn,createHandle:()=>Xn});var rn=M(E(),1);var mt=M(E(),1);var Ht=mt.createContext(void 0);function K(t){let e=mt.useContext(Ht);if(e===void 0&&!t)throw new Error(G(33));return e}o(K,"useMenuPositionerContext");var ft=M(E(),1);var jt=ft.createContext(void 0);function D(t){let e=ft.useContext(jt);if(e===void 0&&!t)throw new Error(G(36));return e}o(D,"useMenuRootContext");var sn=rn.forwardRef(o(function(e,n){let{render:s,className:u,style:c,...i}=e,{store:p}=D(),{arrowRef:r,side:m,align:f,arrowUncentered:R,arrowStyles:h}=K(),P={open:p.useState("open"),side:m,align:f,uncentered:R};return O("div",e,{ref:[r,n],stateAttributesMapping:uo,state:P,props:{style:h,"aria-hidden":!0,...i}})},"MenuArrow"));var an=M(E(),1);var gt=M(E(),1);var ar=gt.createContext(void 0);function Oe(t=!0){let e=gt.useContext(ar);if(e===void 0&&!t)throw new Error(G(25));return e}o(Oe,"useContextMenuRootContext");var un=an.forwardRef(o(function(e,n){let{render:s,className:u,style:c,...i}=e,{store:p}=D(),r=p.useState("open"),m=p.useState("mounted"),f=p.useState("transitionStatus"),R=p.useState("lastOpenChangeReason"),h=Oe(),x={open:r,transitionStatus:f};return O("div",e,{ref:h?.backdropRef?[n,h.backdropRef]:n,state:x,stateAttributesMapping:nt,props:[{role:"presentation",hidden:!m,style:{pointerEvents:R===y.triggerHover?"none":void 0,userSelect:"none",WebkitUserSelect:"none"}},i]})},"MenuBackdrop"));var Mt=M(E(),1);var Rt=M(E(),1);var zt=Rt.createContext(void 0);function cn(){let t=Rt.useContext(zt);if(t===void 0)throw new Error(G(30));return t}o(cn,"useMenuCheckboxItemContext");var je=M(E(),1);var dn=M(E(),1);function xt(t){let{closeOnClick:e,highlighted:n,id:s,nodeId:u,store:c,typingRef:i,itemRef:p,itemMetadata:r}=t,{events:m}=c.useState("floatingTreeRoot"),f=c.useState("open"),R=Oe(!0),h=R!==void 0;return dn.useMemo(()=>({id:s,role:"menuitem",tabIndex:f&&n?0:-1,onKeyDown(x){x.key===" "&&i?.current&&x.preventDefault()},onMouseMove(x){u&&m.emit("itemhover",{nodeId:u,target:x.currentTarget})},onClick(x){e&&m.emit("close",{domEvent:x,reason:y.itemPress})},onMouseUp(x){if(R){let P=R.initialCursorPointRef.current;if(R.initialCursorPointRef.current=null,h&&P&&Math.abs(x.clientX-P.x)<=1&&Math.abs(x.clientY-P.y)<=1||h&&!ot.os.mac&&x.button===2)return}p.current&&c.context.allowMouseUpTriggerRef.current&&(!h||x.button===2)&&r.type==="regular-item"&&so(p.current,x,{detail:1})}}),[e,n,s,m,u,f,c,i,p,R,h,r])}o(xt,"useMenuItemCommonProps");var Te={type:"regular-item"};function ke(t){let{closeOnClick:e,disabled:n,highlighted:s,id:u,store:c,typingRef:i=c.context.typingRef,nativeButton:p,itemMetadata:r,nodeId:m}=t,f=je.useRef(null),{getButtonProps:R,buttonRef:h}=Ge({disabled:n,focusableWhenDisabled:!0,native:p,composite:!0}),x=xt({closeOnClick:e,highlighted:s,id:u,nodeId:m,store:c,typingRef:i,itemRef:f,itemMetadata:r}),P=je.useCallback(A=>he(x,{onMouseEnter(){r.type==="submenu-trigger"&&r.setActive()}},A,R),[x,R,r]),S=tt(f,h);return je.useMemo(()=>({getItemProps:P,itemRef:S}),[P,S])}o(ke,"useMenuItem");var pn="data-checked",ln="data-unchecked";var we={checked(t){return t?{[pn]:""}:{[ln]:""}},...io};var mn=M(me(),1);var fn=Mt.forwardRef(o(function(e,n){let{render:s,className:u,id:c,label:i,nativeButton:p=!1,disabled:r=!1,closeOnClick:m=!1,checked:f,defaultChecked:R,onCheckedChange:h,style:x,...P}=e,S=ae({guess:!0,label:i}),A=K(!0),d=Z(c),{store:g}=D(),l=g.useState("disabled"),V=r||l,v=g.useState("isActive",S.index),C=g.useState("itemProps"),[B,b]=it({controlled:f,default:R??!1,name:"MenuCheckboxItem",state:"checked"}),{getItemProps:z,itemRef:F}=ke({closeOnClick:m,disabled:V,highlighted:v,id:d,store:g,nativeButton:p,nodeId:A?.context.nodeId,itemMetadata:Te}),N=Mt.useMemo(()=>({disabled:V,highlighted:v,checked:B}),[V,v,B]);function a(Y){let T=re(y.itemPress,Y.nativeEvent,void 0,{preventUnmountOnClose:Ue});h?.(!B,T),!T.isCanceled&&b(k=>!k)}o(a,"handleClick");let H=O("div",e,{state:N,stateAttributesMapping:we,props:[C,{role:"menuitemcheckbox","aria-checked":B,onClick:a},P,z],ref:[F,n,S.ref]});return(0,mn.jsx)(zt.Provider,{value:N,children:H})},"MenuCheckboxItem"));var ht=M(E(),1);var gn=ht.forwardRef(o(function(e,n){let{render:s,className:u,style:c,keepMounted:i=!1,...p}=e,r=cn(),m=ht.useRef(null),{transitionStatus:f,mounted:R,setMounted:h}=st(r.checked);He({batch:!0,enabled:!r.checked,open:r.checked,ref:m,onComplete(){r.checked||h(!1)}});let x={checked:r.checked,disabled:r.disabled,highlighted:r.highlighted,transitionStatus:f};return O("span",e,{state:x,ref:[n,m],stateAttributesMapping:we,props:{"aria-hidden":!0,...p},enabled:i||R})},"MenuCheckboxItemIndicator"));var Ct=M(E(),1);var bt=M(E(),1);var We=bt.createContext(void 0);function Rn(){let t=bt.useContext(We);if(t===void 0)throw new Error(G(31));return t}o(Rn,"useMenuGroupRootContext");var xn=M(me(),1);var Mn=Ct.forwardRef(o(function(e,n){let{render:s,className:u,style:c,...i}=e,[p,r]=Ct.useState(void 0),m=O("div",e,{ref:n,props:{role:"group","aria-labelledby":p,...i}});return(0,xn.jsx)(We.Provider,{value:r,children:m})},"MenuGroup"));var hn=M(E(),1);var bn=hn.forwardRef(o(function(e,n){let{render:s,className:u,style:c,id:i,...p}=e,r=Z(i),m=Rn();return se(()=>(m(r),()=>{m(f=>f===r?void 0:f)}),[m,r]),O("div",e,{ref:n,props:{id:r,"aria-hidden":!0,...p}})},"MenuGroupLabel"));var Cn=M(E(),1);var vn=Cn.forwardRef(o(function(e,n){let{render:s,className:u,id:c,label:i,nativeButton:p=!1,disabled:r=!1,closeOnClick:m=!0,style:f,...R}=e,h=ae({guess:!0,label:i}),x=K(!0),P=Z(c),{store:S}=D(),A=S.useState("disabled"),d=r||A,g=S.useState("isActive",h.index),l=S.useState("itemProps"),{getItemProps:V,itemRef:v}=ke({closeOnClick:m,disabled:d,highlighted:g,id:P,store:S,nativeButton:p,nodeId:x?.context.nodeId,itemMetadata:Te});return O("div",e,{state:{disabled:d,highlighted:g},props:[l,R,V],ref:[v,n,h.ref]})},"MenuItem"));var vt=M(E(),1);var In=vt.forwardRef(o(function(e,n){let{render:s,className:u,id:c,label:i,closeOnClick:p=!1,style:r,...m}=e,f=vt.useRef(null),R=ae({guess:!0,label:i}),x=K(!0)?.context.nodeId,P=Z(c),{store:S}=D(),A=S.useState("isActive",R.index),d=S.useState("itemProps"),g=S.context.typingRef,{getButtonProps:l,buttonRef:V}=Ge({native:!1,composite:!0}),v=xt({closeOnClick:p,highlighted:A,id:P,nodeId:x,store:S,typingRef:g,itemRef:f,itemMetadata:Te});function C(b){return he(v,b,l)}return o(C,"getItemProps"),O("a",e,{state:{highlighted:A},props:[d,m,C],ref:[f,V,n,R.ref]})},"MenuLinkItem"));var It=M(E(),1);var En=M(me(),1);var yn=It.forwardRef(o(function(e,n){let{render:s,className:u,style:c,finalFocus:i,...p}=e,{store:r}=D(),{side:m,align:f}=K(),R=Xo(!0)!=null,h=r.useState("open"),x=r.useState("transitionStatus"),P=r.useState("popupProps"),S=r.useState("mounted"),A=r.useState("instantType"),d=r.useState("activeTriggerElement"),g=r.useState("parent"),l=r.useState("lastOpenChangeReason"),V=r.useState("rootId"),v=r.useState("floatingRootContext"),C=r.useState("floatingTreeRoot"),B=r.useState("closeDelay"),b=r.useState("hoverEnabled"),z=r.useState("disabled"),F=r.useState("openMethod"),N=g.type==="context-menu";He({open:h,ref:r.context.popupRef,onComplete(){h&&r.context.onOpenChangeComplete?.(!0)}}),It.useEffect(()=>{function k(ue){r.setOpen(!1,re(ue.reason,ue.domEvent))}return o(k,"handleClose"),C.events.on("close",k),()=>{C.events.off("close",k)}},[C.events,r]),Vo(v,{enabled:b&&!z&&!N&&g.type!=="menubar",closeDelay:B});let a=r.useStateSetter("popupElement"),H={transitionStatus:x,side:m,align:f,open:h,nested:g.type==="menu",instant:A},Y=O("div",e,{state:H,ref:[n,r.context.popupRef,a],stateAttributesMapping:nt,props:[P,{onKeyDown(k){R&&Jo.has(k.key)&&k.stopPropagation()}},Ko(x),p,{"data-rootownerid":V}]}),T=g.type===void 0||N;return(d||g.type==="menubar"&&l!==y.outsidePress)&&(T=!0),(0,En.jsx)(Mo,{context:v,openInteractionType:F,modal:N,disabled:!S,returnFocus:i===void 0?T:i,initialFocus:g.type!=="menu",restoreFocus:!0,externalTree:g.type!=="menubar"?C:void 0,previousFocusableElement:d,nextFocusableElement:g.type===void 0?r.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:g.type===void 0?r.context.beforeContentFocusGuardRef:void 0,children:Y})},"MenuPopup"));var Sn=M(E(),1);var Et=M(E(),1);var Yt=Et.createContext(void 0);function Pn(){let t=Et.useContext(Yt);if(t===void 0)throw new Error(G(32));return t}o(Pn,"useMenuPortalContext");var Kt=M(me(),1);var Nn=Sn.forwardRef(o(function(e,n){let{keepMounted:s=!1,...u}=e,{store:c,parent:i}=D();if(!(c.useState("mounted")||s))return null;let m=i.type==="menu"||i.type==="menubar"?"group":void 0;return(0,Kt.jsx)(Yt.Provider,{value:s,children:(0,Kt.jsx)(fo,{ref:n,...u,portalOwnerRole:m})})},"MenuPortal"));var be=M(E(),1);var ze=M(me(),1);var On=be.forwardRef(o(function(e,n){let{anchor:s,positionMethod:u="absolute",className:c,render:i,side:p,align:r,sideOffset:m=0,alignOffset:f=0,collisionBoundary:R="clipping-ancestors",collisionPadding:h=5,arrowPadding:x=5,sticky:P=!1,disableAnchorTracking:S=!1,collisionAvoidance:A=lo,style:d,...g}=e,{store:l}=D(),V=Pn(),v=Oe(!0),C=l.useState("parent"),B=l.useState("floatingRootContext"),b=l.useState("floatingTreeRoot"),z=l.useState("mounted"),F=l.useState("open"),N=l.useState("modal"),a=l.useState("openMethod"),H=l.useState("activeTriggerElement"),Y=l.useState("transitionStatus"),T=l.useState("positionerElement"),k=l.useState("instantType"),ue=l.useState("adaptiveOrigin"),te=l.useState("lastOpenChangeReason"),W=l.useState("floatingNodeId"),ye=l.useState("floatingParentNodeId"),w=B.useState("domReferenceElement"),fe=be.useRef(null),ge=rt(T),ce=s,Ce=m,Re=f,de=r,X=A;C.type==="context-menu"&&(ce=s??C.context?.anchor,de=de??"start",!p&&de!=="center"&&(Re=e.alignOffset??2,Ce=e.sideOffset??-5));let oe=p,pe=de;C.type==="menu"?(oe=oe??"inline-end",pe=pe??"start",X=e.collisionAvoidance??mo):C.type==="menubar"&&(oe=oe??(C.context.orientation==="vertical"?"inline-end":"bottom"),pe=pe??"start");let q=C.type==="context-menu",ne=zo({anchor:ce,floatingRootContext:B,positionMethod:v?"fixed":u,mounted:z,side:oe,sideOffset:Ce,align:pe,alignOffset:Re,arrowPadding:q?0:x,collisionBoundary:R,collisionPadding:h,sticky:P,nodeId:W,keepMounted:V,disableAnchorTracking:S,collisionAvoidance:X,shift:q?{crossAxis:!("side"in X&&X.side==="flip"),rootBoundary:"layoutViewport"}:void 0,externalTree:b,adaptiveOrigin:ue});be.useEffect(()=>{function L(_){_.open&&(_.parentNodeId===W&&l.set("hoverEnabled",!1),_.nodeId!==W&&_.parentNodeId===l.select("floatingParentNodeId")&&l.setOpen(!1,re(y.siblingOpen)))}return o(L,"onMenuOpenChange"),b.events.on("menuopenchange",L),()=>{b.events.off("menuopenchange",L)}},[l,b.events,W]),be.useEffect(()=>{if(l.select("floatingParentNodeId")==null)return;function L(_){if(_.open||_.nodeId!==l.select("floatingParentNodeId"))return;let Ie=_.reason??y.siblingOpen;l.setOpen(!1,re(Ie))}return o(L,"onParentClose"),b.events.on("menuopenchange",L),()=>{b.events.off("menuopenchange",L)}},[b.events,l]);let le=Ne();be.useEffect(()=>{F||le.clear()},[F,le]),be.useEffect(()=>{function L(_){if(!(!F||_.nodeId!==l.select("floatingParentNodeId")))if(_.target&&H&&H!==_.target){let Ie=l.select("closeDelay");Ie>0?le.isStarted()||le.start(Ie,()=>{l.setOpen(!1,re(y.siblingOpen))}):l.setOpen(!1,re(y.siblingOpen))}else le.clear()}return o(L,"onItemHover"),b.events.on("itemhover",L),()=>{b.events.off("itemhover",L)}},[b.events,F,H,l,le]),be.useEffect(()=>{let L={open:F,nodeId:W,parentNodeId:ye,reason:l.select("lastOpenChangeReason")};b.events.emit("menuopenchange",L)},[b.events,F,l,W,ye]),se(()=>{let L=w,_=fe.current;if(L&&(fe.current=L),_&&L&&L!==_){l.set("instantType",void 0);let Ie=new AbortController;return ge(()=>{l.set("instantType","trigger-change")},Ie.signal),()=>{Ie.abort()}}},[w,ge,l]);let Be={open:F,side:ne.side,align:ne.align,anchorHidden:ne.anchorHidden,nested:C.type==="menu",instant:k},Le=C.type==="menubar"&&C.context.modal,xe=N&&te!==y.triggerHover;Wo(F&&(Le||xe),a==="touch",T,H);let Me=$o(e,Be,{styles:ne.positionerStyles,transitionStatus:Y,props:g,refs:[n,l.useStateSetter("positionerElement")],hidden:!z,inert:!F}),Pe=z&&C.type!=="menu"&&(C.type!=="menubar"&&N&&te!==y.triggerHover||C.type==="menubar"&&C.context.modal),ve=null;return C.type==="menubar"?ve=C.context.contentElement:C.type===void 0&&(ve=H),(0,ze.jsxs)(Ht.Provider,{value:ne,children:[Pe&&(0,ze.jsx)(Yo,{ref:C.type==="context-menu"||C.type==="nested-context-menu"?C.context.internalBackdropRef:null,inert:Ho(!F),cutout:ve}),(0,ze.jsx)(Ro,{id:W,children:(0,ze.jsx)(tn,{elementsRef:l.context.itemDomElements,labelsRef:l.context.itemLabels,children:Me})})]})},"MenuPositioner"));var _e=M(E(),1);var yt=M(E(),1);var $t=yt.createContext(void 0);function Tn(){let t=yt.useContext($t);if(t===void 0)throw new Error(G(34));return t}o(Tn,"useMenuRadioGroupContext");var Wt=M(me(),1);var kn=_e.memo(_e.forwardRef(o(function(e,n){let{render:s,className:u,value:c,defaultValue:i,onValueChange:p,disabled:r=!1,style:m,"aria-labelledby":f,...R}=e,[h,x]=_e.useState(void 0),[P,S]=it({controlled:c,default:i,name:"MenuRadioGroup"}),A=Se((V,v)=>{p?.(V,v),!v.isCanceled&&S(V)}),g=O("div",e,{state:{disabled:r},ref:n,props:{role:"group","aria-labelledby":f??h,"aria-disabled":r||void 0,...R}}),l=_e.useMemo(()=>({value:P,setValue:A,disabled:r}),[P,A,r]);return(0,Wt.jsx)(We.Provider,{value:x,children:(0,Wt.jsx)($t.Provider,{value:l,children:g})})},"MenuRadioGroup")));var St=M(E(),1);var Pt=M(E(),1);var Jt=Pt.createContext(void 0);function wn(){let t=Pt.useContext(Jt);if(t===void 0)throw new Error(G(35));return t}o(wn,"useMenuRadioItemContext");var _n=M(me(),1);var Dn=St.forwardRef(o(function(e,n){let{render:s,className:u,id:c,label:i,nativeButton:p=!1,disabled:r=!1,closeOnClick:m=!1,value:f,style:R,...h}=e,x=ae({guess:!0,label:i}),P=K(!0),S=Z(c),{store:A}=D(),d=A.useState("isActive",x.index),g=A.useState("itemProps"),{value:l,setValue:V,disabled:v}=Tn(),C=A.useState("disabled"),B=r||v||C,b=l===f,{getItemProps:z,itemRef:F}=ke({closeOnClick:m,disabled:B,highlighted:d,id:S,store:A,nativeButton:p,nodeId:P?.context.nodeId,itemMetadata:Te}),N=St.useMemo(()=>({disabled:B,highlighted:d,checked:b}),[B,d,b]);function a(Y){let T=re(y.itemPress,Y.nativeEvent,void 0,{preventUnmountOnClose:Ue});V(f,T)}o(a,"handleClick");let H=O("div",e,{state:N,stateAttributesMapping:we,props:[g,{role:"menuitemradio","aria-checked":b,onClick:a},h,z],ref:[F,n,x.ref]});return(0,_n.jsx)(Jt.Provider,{value:N,children:H})},"MenuRadioItem"));var Nt=M(E(),1);var An=Nt.forwardRef(o(function(e,n){let{render:s,className:u,style:c,keepMounted:i=!1,...p}=e,r=wn(),m=Nt.useRef(null),{transitionStatus:f,mounted:R,setMounted:h}=st(r.checked);He({batch:!0,enabled:!r.checked,open:r.checked,ref:m,onComplete(){r.checked||h(!1)}});let x={checked:r.checked,disabled:r.disabled,highlighted:r.highlighted,transitionStatus:f};return O("span",e,{state:x,stateAttributesMapping:we,ref:[n,m],props:{"aria-hidden":!0,...p},enabled:i||R})},"MenuRadioItemIndicator"));var U=M(E(),1);var Ot=M(E(),1);var cr=Ot.createContext(null);function Tt(t){let e=Ot.useContext(cr);if(e===null&&!t)throw new Error(G(5));return e}o(Tt,"useMenubarContext");var Je=M(E(),1);var Vn={..._o,disabled:o(t=>t.parent.type==="menubar"&&t.parent.context.disabled||t.disabled,"disabled"),modal:o(t=>(t.parent.type===void 0||t.parent.type==="context-menu")&&(t.modal??!0),"modal"),openMethod:o(t=>t.openMethod,"openMethod"),allowMouseEnter:o(t=>t.allowMouseEnter,"allowMouseEnter"),highlightItemOnHover:o(t=>t.highlightItemOnHover,"highlightItemOnHover"),parent:o(t=>t.parent,"parent"),rootId:o(t=>t.parent.type==="menu"?t.parent.store.select("rootId"):t.parent.type!==void 0?t.parent.context.rootId:t.rootId,"rootId"),activeIndex:o(t=>t.activeIndex,"activeIndex"),isActive:o((t,e)=>t.activeIndex===e,"isActive"),hoverEnabled:o(t=>t.hoverEnabled,"hoverEnabled"),instantType:o(t=>t.instantType,"instantType"),lastOpenChangeReason:o(t=>t.openChangeReason,"lastOpenChangeReason"),floatingTreeRoot:o(t=>t.parent.type==="menu"?t.parent.store.select("floatingTreeRoot"):t.floatingTreeRoot,"floatingTreeRoot"),floatingNodeId:o(t=>t.floatingNodeId,"floatingNodeId"),floatingParentNodeId:o(t=>t.floatingParentNodeId,"floatingParentNodeId"),itemProps:o(t=>t.itemProps,"itemProps"),closeDelay:o(t=>t.closeDelay,"closeDelay"),adaptiveOrigin:o(t=>t.adaptiveOrigin,"adaptiveOrigin"),keyboardEventRelay:o(t=>{if(t.keyboardEventRelay)return t.keyboardEventRelay;if(t.parent.type==="menu")return t.parent.store.select("keyboardEventRelay")},"keyboardEventRelay")},kt=class extends Co{static{o(this,"MenuStore")}constructor(e,n,s=!1){let u=new Ut,c=Fn(u,n,s,e);super(c,Ln(u),Vn),this.unsubscribeParentListener=this.observe("parent",i=>{if(this.unsubscribeParentListener?.(),i.type==="menu"){let p=i.store.select("rootId"),r=i.store.select("floatingTreeRoot"),m=i.store.select("keyboardEventRelay");this.unsubscribeParentListener=i.store.subscribe(()=>{let f=i.store.select("rootId"),R=i.store.select("floatingTreeRoot"),h=i.store.select("keyboardEventRelay");p===f&&r===R&&m===h||(p=f,r=R,m=h,this.notifyAll())}),this.context.allowMouseUpTriggerRef=i.store.context.allowMouseUpTriggerRef;return}i.type!==void 0&&(this.context.allowMouseUpTriggerRef=i.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,n){this.state.floatingRootContext.context.events.emit("setOpen",{open:e,eventDetails:n})}unsubscribeParentListener=null};function Bn(){let t=new Ut,e=new Fo(Object.freeze(Fn(t)),Object.freeze(Ln(t)),Vn);return Object.assign(e,{setOpen:Ue})}o(Bn,"createNullMenuStore");function Ln(t){return{positionerRef:Je.createRef(),popupRef:Je.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:Je.createRef(),beforeContentFocusGuardRef:Je.createRef(),onOpenChangeComplete:void 0,triggerElements:t}}o(Ln,"createInitialContext");function Fn(t,e,n=!1,s){return{...wo(t,e,n),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new at,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:ie,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0,...s}}o(Fn,"createInitialState");var wt=M(E(),1);var Xt=wt.createContext(void 0);function _t(){return wt.useContext(Xt)}o(_t,"useMenuSubmenuRootContext");var Xe=M(me(),1);var Dt=co(o(function(e){let{children:n,open:s,onOpenChange:u,onOpenChangeComplete:c,defaultOpen:i=!1,disabled:p=!1,modal:r,loopFocus:m=!0,orientation:f="vertical",actionsRef:R,closeParentOnEsc:h=!1,handle:x,triggerId:P,defaultTriggerId:S=null,highlightItemOnHover:A=!0}=e,d=Oe(!0),g=D(!0),l=Tt(!0),V=_t(),v=U.useMemo(()=>V&&g?{type:"menu",store:g.store}:l?{type:"menubar",context:l}:d&&!g?{type:"context-menu",context:d}:{type:void 0},[d,g,l,V]),C=Bt(),B=Bt(),b=ut(),z=v.type==="menu"?v.store:void 0,F=(s??i)&&z?.state.transitionStatus==="starting",N=Ze(()=>F?z?.state.instantType:void 0).current,a=dr({open:i,openProp:s,activeTriggerId:S,triggerIdProp:P,parent:v,disabled:p,highlightItemOnHover:A,modal:v.type===void 0?r:void 0,rootId:C,instantType:N},B,b!=null);a.useControlledProp("openProp",s),a.useControlledProp("triggerIdProp",P),a.useContextCallback("onOpenChangeComplete",c);let H=a.useState("floatingTreeRoot"),Y=ct(H),T=a.useState("open"),k=a.useState("activeTriggerElement"),ue=a.useState("positionerElement"),te=a.useState("hoverEnabled"),W=a.useState("disabled"),ye=a.useState("lastOpenChangeReason"),w=a.useState("parent"),fe=a.useState("activeIndex"),ge=a.useState("payload"),ce=a.useState("floatingParentNodeId"),Ce=U.useRef(null),Re=U.useRef(w.type!=="context-menu"),de=Ne(),X=U.useRef(!0),oe=Ne(),pe=ce!=null,{openMethod:q,triggerProps:ne}=Uo(T);a.useSyncedValues({disabled:p,highlightItemOnHover:A,modal:w.type===void 0?r:void 0,openMethod:q,rootId:C}),Oo(a);let{forceUnmount:le,transitionStatus:Be}=To(T,a,()=>{a.set("allowMouseEnter",!1)},F),Le=rt(a.context.popupRef);U.useEffect(()=>{if(N===void 0)return;let I=o(()=>{a.state.instantType===N&&a.set("instantType",void 0)},"clearSeededInstantType");if(!T){I();return}if(Be!==void 0)return;if(a.context.popupRef.current==null){I();return}let j=new AbortController;return Le(I,j.signal),()=>{j.abort()}},[N,T,Be,Le,a]),se(()=>{d&&!g?a.update({parent:{type:"context-menu",context:d},floatingNodeId:Y,floatingParentNodeId:b}):g&&a.update({floatingNodeId:Y,floatingParentNodeId:b})},[d,g,Y,b,a]),U.useEffect(()=>{if(T||(Ce.current=null),w.type==="context-menu"){if(!T){de.clear(),Re.current=!1;return}de.start(500,()=>{Re.current=!0})}},[de,T,w.type]),se(()=>{!T&&!te&&a.set("hoverEnabled",!0)},[T,te,a]);let xe=Se((I,j)=>{let Q=j.reason;if(!I&&!a.select("open")||T===I&&j.trigger===k&&ye===Q)return;let nr=So(j);if(!I&&j.trigger==null&&(j.trigger=k??void 0),u?.(I,j),j.isCanceled)return;a.state.floatingRootContext.dispatchOpenChange(I,j);let Vt=j.event;if(I===!1&&Vt?.type==="click"&&Vt.pointerType==="touch"&&!X.current)return;I&&Q===y.triggerFocus?(X.current=!1,oe.start(300,()=>{X.current=!0})):(X.current=!0,oe.clear());let to=(Q===y.triggerPress||Q===y.itemPress)&&Vt.detail===0,rr=!I&&(Q===y.escapeKey||Q==null);Ce.current=j.event;let Ye=Po(a.state,I,j.trigger,nr());Ye.openChangeReason=Q,w.type==="menubar"&&(Q===y.triggerFocus||Q===y.focusOut||Q===y.triggerHover||Q===y.listNavigation||Q===y.siblingOpen)?Ye.instantType="group":to||rr?Ye.instantType=to?"click":"dismiss":Ye.instantType=void 0,a.update(Ye)}),Me=vo({popupStore:a,floatingRootContext:a.state.floatingRootContext,floatingId:B,nested:b!=null,onOpenChange:xe}),Pe=Me.context.events;se(()=>{let I=o(({open:j,eventDetails:Q})=>xe(j,Q),"handleSetOpenEvent");return Pe.on("setOpen",I),()=>{Pe?.off("setOpen",I)}},[Pe,xe]);let ve=U.useCallback(()=>{a.setOpen(!1,re(y.imperativeAction))},[a]);U.useImperativeHandle(R,()=>({unmount:le,close:ve}),[le,ve]);let L;w.type==="context-menu"&&(L=w.context),U.useImperativeHandle(L?.positionerRef,()=>ue,[ue]),U.useImperativeHandle(L?.actionsRef,()=>({setOpen:xe}),[xe]);let _=ho(Me,{enabled:!W,bubbles:{escapeKey:h&&w.type==="menu"},outsidePress(){return w.type!=="context-menu"||Ce.current?.type==="contextmenu"?!0:Re.current},externalTree:pe?H:void 0}),Ie=jo(),qn=U.useCallback(I=>{a.select("activeIndex")!==I&&a.set("activeIndex",I)},[a]),Ae=Bo(Me,{enabled:!W,listRef:a.context.itemDomElements,activeIndex:fe,nested:w.type!==void 0,loopFocus:m,orientation:f,parentOrientation:w.type==="menubar"?w.context.orientation:void 0,rtl:Ie==="rtl",disabledIndices:$e,onNavigate:qn,openOnArrowKeyDown:w.type!=="context-menu",externalTree:pe?H:void 0,focusItemOnHover:A}),Qn=U.useCallback(I=>{a.context.typingRef.current=I},[a]),Qe=Lo(Me,{enabled:!W,listRef:a.context.itemLabels,elementsRef:a.context.itemDomElements,activeIndex:fe,resetMs:500,onMatch:o(I=>{T&&I!==fe&&a.set("activeIndex",I)},"onMatch"),onTyping:Qn}),Zn=U.useMemo(()=>{let I=he(Qe.reference,Ae.reference,_.reference,{onMouseMove(){a.set("allowMouseEnter",!0)}},ne);return I["aria-haspopup"]="menu",I["aria-expanded"]=T,I},[a,Qe.reference,Ae.reference,_.reference,ne,T]),Zt=U.useMemo(()=>{let I=he(Ae.trigger,_.trigger,ne);return I["aria-haspopup"]="menu",I["aria-expanded"]=!1,I},[Ae.trigger,_.trigger,ne]);Ze(()=>(a.update({inactiveTriggerProps:Zt}),null));let er=U.useMemo(()=>he(Io,{id:B,role:"menu","aria-orientation":f==="horizontal"?"horizontal":void 0,"aria-labelledby":k?.id,onMouseMove(){a.set("allowMouseEnter",!0),w.type==="menu"&&a.set("hoverEnabled",!1)},onClick(){a.select("hoverEnabled")&&a.set("hoverEnabled",!1)},onKeyDown(I){let j=a.select("keyboardEventRelay");j&&!I.isPropagationStopped()&&j(I)}},Qe.floating,Ae.floating,_.floating),[k,B,f,w.type,a,Qe.floating,Ae.floating,_.floating]),tr=Ae.item??ie;ko(a,{floatingRootContext:Me,activeTriggerProps:Zn,inactiveTriggerProps:Zt,popupProps:er,itemProps:tr});let or=U.useMemo(()=>({store:a,parent:v}),[a,v]),eo=(0,Xe.jsxs)(jt.Provider,{value:or,children:[x&&(0,Xe.jsx)(Eo,{handle:x,store:a}),typeof n=="function"?n({payload:ge}):n]});return w.type===void 0||w.type==="context-menu"?(0,Xe.jsx)(xo,{externalTree:H,children:eo}):eo},"MenuRoot"));function dr(t,e,n){return Ze(()=>new kt(t,e,n)).current}o(dr,"useMenuRootStore");var Gn=M(E(),1);var qt=M(me(),1);function Un(t){let e=D().store,n=Gn.useMemo(()=>({parentMenu:e}),[e]);return(0,qt.jsx)(Xt.Provider,{value:n,children:(0,qt.jsx)(Dt,{...t})})}o(Un,"MenuSubmenuRoot");var $=M(E(),1);var Hn=M(E(),1);function jn(t={}){let{highlightItemOnHover:e,highlightedIndex:n,onHighlightedIndexChange:s}=et(),{ref:u,index:c}=ae(t),i=n===c,p=Hn.useRef(null),r=tt(u,p);return{compositeProps:{tabIndex:i?0:-1,onFocus(){s(c)},onMouseMove(){let f=p.current;if(!e||!f)return;let R=f.hasAttribute("disabled")||f.ariaDisabled==="true";!i&&!R&&f.focus()}},compositeRef:r,index:c}}o(jn,"useCompositeItem");function zn(t){let{render:e,className:n,style:s,state:u=ie,props:c=$e,refs:i=$e,metadata:p,stateAttributesMapping:r,tag:m="div",...f}=t,{compositeProps:R,compositeRef:h}=jn({metadata:p});return O(m,t,{state:u,ref:[h,...i],props:[R,...c,f],stateAttributesMapping:r})}o(zn,"CompositeItem");function Qt(t){if(oo(t)&&t.hasAttribute("data-rootownerid"))return t.getAttribute("data-rootownerid");if(!no(t))return Qt(ro(t))}o(Qt,"findRootOwnerId");var At=M(E(),1);function Yn(t){let{enabled:e=!0,mouseDownAction:n,open:s}=t,u=At.useRef(!1);return At.useMemo(()=>e?{onMouseDown:o(c=>{(n==="open"&&!s||n==="close"&&s)&&(u.current=!0,Ke(c.currentTarget).addEventListener("click",()=>{u.current=!1},{once:!0}))},"onMouseDown"),onClick:o(c=>{u.current&&(u.current=!1,c.preventBaseUIHandler())},"onClick")}:ie,[e,n,s])}o(Yn,"useMixedToggleClickHandler");var De=M(me(),1);var Kn=po(o(function(e,n){let{render:s,className:u,style:c,disabled:i=!1,nativeButton:p=!0,id:r,openOnHover:m,delay:f=100,closeDelay:R=0,handle:h,payload:x,...P}=e,S=D(!0),d=Do(h)??S?.store;if(!d)throw new Error(G(85));let g=Z(r),l=d.useState("isTriggerActive",g),V=d.useState("floatingRootContext"),v=d.useState("isOpenedByTrigger",g),C=d.useState("triggerPopupId",g),B=$.useRef(null),b=lr(),z=et(!0),F=go(),N=$.useMemo(()=>F??new at,[F]),a=ct(N),H=ut(),{registerTrigger:Y,isMountedByThisTrigger:T}=No(g,B,d,{payload:x,closeDelay:R,parent:b,floatingTreeRoot:N,floatingNodeId:a,floatingParentNodeId:H,keyboardEventRelay:z?.relayKeyboardEvent}),k=b.type==="menubar",ue=d.useState("disabled"),te=i||ue||k&&b.context.disabled,{getButtonProps:W,buttonRef:ye}=Ge({disabled:te,native:p});$.useEffect(()=>{!v&&b.type===void 0&&(d.context.allowMouseUpTriggerRef.current=!1)},[d,v,b.type]);let w=$.useRef(null),fe=Ne(),ge=Se(L=>{if(!w.current)return;fe.clear(),d.context.allowMouseUpTriggerRef.current=!1;let _=L.target;Lt(w.current,_)||Lt(d.select("positionerElement"),_)||_===w.current||_!=null&&Qt(_)===d.select("rootId")||on(L,w.current)||N.events.emit("close",{domEvent:L,reason:y.cancelOpen})});$.useEffect(()=>{v&&d.select("lastOpenChangeReason")===y.triggerHover&&Ke(w.current).addEventListener("mouseup",ge,{once:!0})},[v,ge,d]);let ce=k&&b.context.hasSubmenuOpen,Re=pt(V,{enabled:(m??ce)&&!te&&(!k||ce&&!T),handleClose:lt({blockPointerEvents:!k}),mouseOnly:!0,move:!1,restMs:b.type===void 0?f:void 0,delay:{close:R},triggerElementRef:B,externalTree:N,isActiveTrigger:l,isClosing:o(()=>d.select("transitionStatus")==="ending","isClosing")}),de=pr(v,d.select("lastOpenChangeReason")),X=dt(V,{enabled:!te,event:v&&k?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:b.type===void 0?de:!1}),oe=Ao(V,{enabled:!te&&ce}),pe=Yn({open:v,enabled:k,mouseDownAction:"open"}),q=$.useMemo(()=>he(oe.reference,X.reference),[oe.reference,X.reference]),ne=d.useState("triggerProps",T),{preFocusGuardRef:le,handlePreFocusGuardFocus:Be,handleFocusTargetFocus:Le}=Go(d,B),xe={disabled:te,open:v},Me=[w,n,ye,Y,B],Pe=[q,Re??ie,ne,{"aria-haspopup":"menu","aria-controls":C,id:g,onMouseDown:o(L=>{if(d.select("open"))return;fe.start(200,()=>{d.context.allowMouseUpTriggerRef.current=!0}),Ke(L.currentTarget).addEventListener("mouseup",ge,{once:!0})},"onMouseDown")},k?{role:"menuitem"}:{},pe,P,W],ve=O("button",e,{enabled:!k,stateAttributesMapping:Ft,state:xe,ref:Me,props:Pe});return k?(0,De.jsx)(zn,{tag:"button",render:s,className:u,style:c,state:xe,refs:Me,props:Pe,stateAttributesMapping:Ft}):v?(0,De.jsxs)($.Fragment,{children:[(0,De.jsx)(Gt,{ref:le,onFocus:Be},`${g}-pre-focus-guard`),(0,De.jsx)($.Fragment,{children:ve},g),(0,De.jsx)(Gt,{ref:d.context.triggerFocusTargetRef,onFocus:Le},`${g}-post-focus-guard`)]}):(0,De.jsx)($.Fragment,{children:ve},g)},"MenuTrigger"));function pr(t,e){let n=Ne(),[s,u]=$.useState(!1);return se(()=>{t&&e===y.triggerHover?(u(!0),n.start(500,()=>{u(!1)})):t||(n.clear(),u(!1))},[t,e,n]),s}o(pr,"useStickIfOpen");function lr(){let t=Tt(!0);return $.useMemo(()=>t?{type:"menubar",context:t}:{type:void 0},[t])}o(lr,"useMenuParent");var $n=M(E(),1);var Wn=$n.forwardRef(o(function(e,n){let{render:s,className:u,style:c,children:i,...p}=e,{store:r}=D(),{side:m}=K(),f=r.useState("instantType"),{children:R,state:h}=Qo({store:r,side:m,children:i}),x={activationDirection:h.activationDirection,transitioning:h.transitioning,instant:f};return O("div",e,{state:x,ref:n,props:[p,{children:R}],stateAttributesMapping:qo})},"MenuViewport"));var Ee=M(E(),1);var mr={"aria-expanded":void 0},Jn=Ee.forwardRef(o(function(e,n){let{render:s,className:u,style:c,label:i,id:p,nativeButton:r=!1,openOnHover:m=!0,delay:f=100,closeDelay:R=0,disabled:h=!1,...x}=e,P=_t();if(!P?.parentMenu)throw new Error(G(37));let S=ae({guess:!0,label:i}),A=K(),{store:d}=D(),g=Z(p),l=d.useState("open"),V=d.useState("floatingRootContext"),v=d.useState("floatingTreeRoot"),C=d.useState("triggerPopupId",g),B=yo(g,d),b=Se(q=>{B(q),q!==null&&d.select("open")&&d.select("activeTriggerId")==null&&d.update({activeTriggerId:g??null,activeTriggerElement:q,closeDelay:R})}),z=Ee.useRef(null),F=Ee.useCallback(q=>{z.current=q,d.set("activeTriggerElement",q)},[d]);se(()=>(b(z.current),()=>b(null)),[b,g,d]),d.useSyncedValue("closeDelay",R);let N=P.parentMenu,a=d.useState("disabled"),H=N.useState("disabled"),Y=h||a||H,T=N.useState("itemProps"),k=N.useState("isActive",S.index),ue=Ee.useMemo(()=>({type:"submenu-trigger",setActive(){N.select("highlightItemOnHover")&&N.set("activeIndex",S.index)}}),[N,S.index]),{getItemProps:te,itemRef:W}=ke({closeOnClick:!1,disabled:Y,highlighted:k,id:g,store:d,typingRef:N.context.typingRef,nativeButton:r,itemMetadata:ue,nodeId:A?.context.nodeId}),ye=d.useState("hoverEnabled"),w=pt(V,{enabled:ye&&m&&!Y,handleClose:lt({blockPointerEvents:!0}),mouseOnly:!0,move:!0,restMs:f,delay:{open:f,close:R},shouldOpen:f>0?()=>N.select("allowMouseEnter"):void 0,triggerElementRef:z,externalTree:v,isClosing:o(()=>d.select("transitionStatus")==="ending","isClosing"),guardStaleOpen:!0}),ge=dt(V,{enabled:!Y,event:"mousedown",toggle:!m,ignoreMouse:m,stickIfOpen:!1}).reference??ie,ce=d.useState("triggerProps",!0);delete ce.id;let Ce={disabled:Y,highlighted:k,open:l},Re=d.useState("openMethod"),X=d.useState("lastOpenChangeReason")===y.listNavigation||Re==="keyboard",oe=l&&X&&ot.screenReader.voiceOver;return O("div",e,{state:Ce,stateAttributesMapping:ao,props:[ge,w,ce,T,oe?mr:void 0,{"aria-controls":C,tabIndex:l||k?0:-1,onBlur(){k&&N.set("activeIndex",null)}},x,te],ref:[n,S.ref,W,b,F]})},"MenuSubmenuTrigger"));var qe=class extends bo{static{o(this,"MenuHandle")}constructor(){super(Bn(),"Menu")}open(e){this.openByTrigger(e)}close(){this.closePopup()}get isOpen(){return this.attachedStore?.select("open")??!1}};function Xn(){return new qe}o(Xn,"createMenuHandle");var J=M(me(),1);function Xc(t){let e=(0,Ve.c)(4),n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let s;return e[2]!==n?(s=(0,J.jsx)(ee.Root,{"data-slot":"dropdown-menu",...n}),e[2]=n,e[3]=s):s=e[3],s}o(Xc,"N");function qc(t){let e=(0,Ve.c)(4),n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let s;return e[2]!==n?(s=(0,J.jsx)(ee.Trigger,{"data-slot":"dropdown-menu-trigger",...n}),e[2]=n,e[3]=s):s=e[3],s}o(qc,"z");function Qc({align:t="start",alignOffset:e=0,side:n="bottom",sideOffset:s=4,className:u,...c}){return(0,J.jsx)(ee.Portal,{children:(0,J.jsx)(ee.Positioner,{className:"isolate z-50 outline-none",align:t,alignOffset:e,side:n,sideOffset:s,children:(0,J.jsx)(ee.Popup,{"data-slot":"dropdown-menu-content",className:Fe("z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-start-2 data-[side=inline-start]:slide-in-from-end-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95 animate-none! relative bg-popover before:pointer-events-none before:absolute before:inset-0 before:-z-1 before:rounded-[inherit] **:data-[slot$=-item]:focus:bg-foreground/10 **:data-[slot$=-item]:data-highlighted:bg-foreground/10 **:data-[slot$=-separator]:bg-foreground/5 **:data-[slot$=-trigger]:focus:bg-foreground/10 **:data-[slot$=-trigger]:aria-expanded:bg-foreground/10! **:data-[variant=destructive]:focus:bg-foreground/10! **:data-[variant=destructive]:text-accent-foreground! **:data-[variant=destructive]:**:text-accent-foreground!",u),...c})})})}o(Qc,"D");function Zc(t){let e=(0,Ve.c)(4),n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let s;return e[2]!==n?(s=(0,J.jsx)(ee.Group,{"data-slot":"dropdown-menu-group",...n}),e[2]=n,e[3]=s):s=e[3],s}o(Zc,"M");function ed(t){let e=(0,Ve.c)(10),n,s,u;e[0]!==t?({className:n,inset:s,...u}=t,e[0]=t,e[1]=n,e[2]=s,e[3]=u):(n=e[1],s=e[2],u=e[3]);let c;e[4]!==n?(c=Fe("px-2 py-2 text-xs text-muted-foreground data-inset:ps-7",n),e[4]=n,e[5]=c):c=e[5];let i;return e[6]!==s||e[7]!==u||e[8]!==c?(i=(0,J.jsx)(ee.GroupLabel,{"data-slot":"dropdown-menu-label","data-inset":s,className:c,...u}),e[6]=s,e[7]=u,e[8]=c,e[9]=i):i=e[9],i}o(ed,"y");function td({className:t,inset:e,variant:n="default",...s}){return(0,J.jsx)(ee.Item,{"data-slot":"dropdown-menu-item","data-inset":e,"data-variant":n,className:Fe("group/dropdown-menu-item relative flex cursor-default items-center gap-2 rounded-md px-2 py-2 text-xs outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:ps-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive",t),...s})}o(td,"I");function od(t){let e=(0,Ve.c)(15),n,s,u,c,i;e[0]!==t?({className:u,children:s,checked:n,inset:c,...i}=t,e[0]=t,e[1]=n,e[2]=s,e[3]=u,e[4]=c,e[5]=i):(n=e[1],s=e[2],u=e[3],c=e[4],i=e[5]);let p;e[6]!==u?(p=Fe("relative flex cursor-default items-center gap-2 rounded-md py-2 pe-8 ps-2 text-xs outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:ps-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",u),e[6]=u,e[7]=p):p=e[7];let r;e[8]===Symbol.for("react.memo_cache_sentinel")?(r=(0,J.jsx)("span",{className:"pointer-events-none absolute end-2 flex items-center justify-center","data-slot":"dropdown-menu-checkbox-item-indicator",children:(0,J.jsx)(ee.CheckboxItemIndicator,{children:(0,J.jsx)(en,{icon:Zo,strokeWidth:2})})}),e[8]=r):r=e[8];let m;return e[9]!==n||e[10]!==s||e[11]!==c||e[12]!==i||e[13]!==p?(m=(0,J.jsxs)(ee.CheckboxItem,{"data-slot":"dropdown-menu-checkbox-item","data-inset":c,className:p,checked:n,...i,children:[r,s]}),e[9]=n,e[10]=s,e[11]=c,e[12]=i,e[13]=p,e[14]=m):m=e[14],m}o(od,"_");function nd(t){let e=(0,Ve.c)(8),n,s;e[0]!==t?({className:n,...s}=t,e[0]=t,e[1]=n,e[2]=s):(n=e[1],s=e[2]);let u;e[3]!==n?(u=Fe("-mx-1 h-px bg-border",n),e[3]=n,e[4]=u):u=e[4];let c;return e[5]!==s||e[6]!==u?(c=(0,J.jsx)(ee.Separator,{"data-slot":"dropdown-menu-separator",className:u,...s}),e[5]=s,e[6]=u,e[7]=c):c=e[7],c}o(nd,"C");export{Xc as a,qc as b,Qc as c,Zc as d,ed as e,td as f,od as g,nd as h};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as we}from"./chunk-SUUBCPUD.js";import{a as ve}from"./chunk-6YBEKVUG.js";import{i as me}from"./chunk-MWYGLPDV.js";import"./chunk-HFBSWKJS.js";import"./chunk-4EPW63HS.js";import{a as q}from"./chunk-KBYFBEG2.js";import"./chunk-JMZT3CEW.js";import"./chunk-VUOEJJUH.js";import{a as ue}from"./chunk-FWOOA2ZR.js";import"./chunk-YUVGMKHG.js";import{a as ae,b as re,c as ne,d as j,e as h,f as p}from"./chunk-VXZAS5VS.js";import{a as X}from"./chunk-6A6AELDJ.js";import{c as Ne}from"./chunk-CLQKKJHL.js";import{a as ee,e as te}from"./chunk-OSHODLMU.js";import{n as ce}from"./chunk-PFPJA2HR.js";import"./chunk-ZPQBVYNN.js";import{B as Y,h as ie,i as de,j as z,p as pe,s as U}from"./chunk-PUK3H4RN.js";import"./chunk-PDBW6GTJ.js";import{a as be}from"./chunk-GWNGVKLG.js";import{a as ke,b as Se}from"./chunk-6G3E4PJ2.js";import{a as s,d as he}from"./chunk-5PEAXTYQ.js";var xe=he(be(),1),i=he(ke(),1);var t=he(Se(),1);var Ce=["queued","running","rollingBack","paused","waiting","complete","errored","terminated"],Oe=["pause","resume","restart","terminate"],Ie=s(l=>{let e=(0,xe.c)(7),{busy:w,id:x,onAct:N}=l,b=Y(),a;e[0]!==w||e[1]!==x||e[2]!==N||e[3]!==b?(a=Oe.map(m=>m==="restart"?(0,t.jsx)(ve,{confirmLabel:b("Restart?"),disabled:w,onConfirm:s(()=>{N(m)},"onConfirm"),testId:`workflow-instance-${m}-${x}`,children:b(m)},m):(0,t.jsx)(q,{"data-testid":`workflow-instance-${m}-${x}`,disabled:w,onClick:s(()=>{N(m)},"onClick"),size:"sm",type:"button",variant:"ghost",children:b(m)},m)),e[0]=w,e[1]=x,e[2]=N,e[3]=b,e[4]=a):a=e[4];let d;return e[5]!==a?(d=(0,t.jsx)(t.Fragment,{children:a}),e[5]=a,e[6]=d):d=e[6],d},"Ce"),$e="WORKFLOWS_NOT_CONFIGURED",We=s(l=>typeof l=="object"&&l!==null&&l.code===$e,"Oe"),Ae=s(l=>{let e=l.error??l.output;if(e===void 0)return"\u2014";try{return JSON.stringify(e,pe)}catch{return"(unserializable)"}},"Ee"),Te=s(({loadDetail:l,loadInstances:e,readOnly:w,runAction:x,workflowName:N})=>{let b=ce(),a=Y(),[d,m]=(0,i.useState)(null),[v,L]=(0,i.useState)(null),[S,B]=(0,i.useState)(""),[C,O]=(0,i.useState)(null),[F,W]=(0,i.useState)(!1),[_,R]=(0,i.useState)(null),g=(0,i.useRef)(0),y=(0,i.useRef)(0),k=(0,i.useRef)(0),A=l??(n=>b.getWorkflowInstance(n)),I=w?void 0:x??(e===void 0?n=>b.setWorkflowInstanceStatus(n):void 0),T=s(async()=>{y.current+=1;let n=y.current;O(null),W(!1);let u=S===""?void 0:S;try{if(e===void 0){let r=await b.listWorkflowInstances({name:N,status:u});if(n!==y.current)return;if(r.configured===!1){m(null),W(!0);return}m(r.instances);return}let f=await e({name:N,status:u});n===y.current&&m(f)}catch(f){if(n!==y.current)return;m(null),We(f)?W(!0):O(z(f))}},"E");(0,i.useEffect)(()=>{g.current+=1,k.current+=1,L(null),U(T())},[N,S]);let P=s(async n=>{k.current+=1;let u=k.current;O(null);try{let f=await A({id:n,name:N});u===k.current&&L(f)}catch(f){u===k.current&&O(z(f))}},"W"),E=s(()=>{k.current+=1,L(null)},"A"),J=s(async(n,u)=>{if(I===void 0)return;let f=g.current;R(n),O(null);try{await I({action:u,id:n,name:N}),f===g.current&&await T()}catch(r){O(z(r))}R(null)},"L");return(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-workflow-instances",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("h3",{className:"text-sm font-medium",children:a("Instance history")}),(0,t.jsxs)("select",{"aria-label":a("Filter by status"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflow-instances-filter",onChange:s(n=>{B(n.target.value)},"onChange"),value:S,children:[(0,t.jsx)("option",{value:"",children:a("All statuses")}),Ce.map(n=>(0,t.jsx)("option",{value:n,children:n},n))]})]}),C!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflow-instances-error",role:"alert",children:C}),F&&(0,t.jsx)(ue,{description:a("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history."),testId:"workflow-instances-unconfigured",title:a("Workflow inspection not configured")}),!F&&d!==null&&d.length===0&&(0,t.jsx)(ue,{description:a("No instances match this filter for the selected workflow."),testId:"workflow-instances-empty",title:a("No instances")}),d!==null&&d.length>0&&(0,t.jsx)(ee,{className:"overflow-hidden py-0",children:(0,t.jsx)(te,{className:"px-0",children:(0,t.jsxs)(ae,{"data-testid":"workflow-instances-table",children:[(0,t.jsx)(re,{children:(0,t.jsxs)(j,{children:[(0,t.jsx)(h,{children:a("Instance id")}),(0,t.jsx)(h,{children:a("Status")}),(0,t.jsx)(h,{children:a("Created")}),(0,t.jsx)(h,{children:a("Ended")}),(0,t.jsx)(h,{"aria-label":a("Actions")})]})}),(0,t.jsx)(ne,{children:d.map(n=>(0,t.jsxs)(j,{"data-testid":`workflow-instance-${n.id}`,children:[(0,t.jsx)(p,{className:"font-mono text-xs",children:n.id}),(0,t.jsx)(p,{className:"font-mono text-xs",children:n.status}),(0,t.jsx)(p,{className:"text-muted-foreground tabular-nums",children:n.createdOn??"\u2014"}),(0,t.jsx)(p,{className:"text-muted-foreground tabular-nums",children:n.endedOn??"\u2014"}),(0,t.jsx)(p,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1.5",children:[(0,t.jsx)(q,{"data-testid":`workflow-instance-steps-${n.id}`,onClick:s(()=>{U(P(n.id))},"onClick"),size:"sm",type:"button",variant:"outline",children:a("Steps")}),I!==void 0&&(0,t.jsx)(Ie,{busy:_===n.id,id:n.id,onAct:s(u=>{U(J(n.id,u))},"onAct")},N)]})})]},n.id))})]})})}),v!==null&&(0,t.jsx)(ee,{className:"overflow-hidden py-0","data-testid":"workflow-instance-detail",children:(0,t.jsxs)(te,{className:"flex flex-col gap-2 px-4 py-3",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("span",{className:"font-mono text-xs",children:[a("Steps")," \xB7 ",v.id]}),(0,t.jsx)(q,{"data-testid":"workflow-instance-detail-close",onClick:E,size:"xs",type:"button",variant:"ghost",children:a("Close")})]}),v.steps.length===0?(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:a("This instance has no recorded steps yet.")}):(0,t.jsxs)(ae,{"data-testid":"workflow-instance-steps",children:[(0,t.jsx)(re,{children:(0,t.jsxs)(j,{children:[(0,t.jsx)(h,{children:a("Step")}),(0,t.jsx)(h,{children:a("Type")}),(0,t.jsx)(h,{children:a("Attempts")}),(0,t.jsx)(h,{children:a("Started")}),(0,t.jsx)(h,{children:a("Output")})]})}),(0,t.jsx)(ne,{children:v.steps.map((n,u)=>(0,t.jsxs)(j,{"data-testid":`workflow-step-${String(u)}`,children:[(0,t.jsx)(p,{className:"font-mono text-xs",children:n.name}),(0,t.jsx)(p,{className:"text-xs text-muted-foreground",children:n.type??"\u2014"}),(0,t.jsx)(p,{className:"tabular-nums",children:n.attempts??"\u2014"}),(0,t.jsx)(p,{className:"text-muted-foreground tabular-nums",children:n.start??"\u2014"}),(0,t.jsx)(p,{className:"font-mono text-xs text-muted-foreground",children:Ae(n)})]},`${n.name}:${String(u)}`))})]})]})})]})},"_e"),_e=ie(X.createWorkflowInstance),Ee=ie(X.getWorkflowInstanceStatus),Je=ie(X.sendWorkflowEvent),De=s(l=>{if(l.error)return`${l.error.name}: ${l.error.message}`;if(l.output===void 0)return"\u2014";try{return JSON.stringify(l.output,pe)}catch{return"(unserializable)"}},"$e"),ge=s(l=>{let e=l.trim();if(e==="")return{value:void 0};try{return{value:JSON.parse(e)}}catch{return null}},"ve"),Fe=s((l,e)=>l.some(w=>w.exportName===e)?e:l[0]?.exportName??"","Fe"),Pe=s(l=>{let e=(0,xe.c)(72),{eventTypes:w,exportName:x,onSent:N}=l,b=ce(),a=Y(),[d,m]=(0,i.useState)(""),[v,L]=(0,i.useState)(""),[S,B]=(0,i.useState)(""),[C,O]=(0,i.useState)(!1),[F,W]=(0,i.useState)(null),_;e[0]!==b||e[1]!==x||e[2]!==N||e[3]!==a||e[4]!==v?(_=s(async(D,oe)=>{try{await b.query(Je,{exportName:x,id:D,payload:oe,type:v},de(""))}catch(fe){W(z(fe));return}try{await N(x,D)}catch(fe){let ye=fe;W(`${a("Event sent, but refreshing the instance failed")}: ${z(ye)}`)}},"_"),e[0]=b,e[1]=x,e[2]=N,e[3]=a,e[4]=v,e[5]=_):_=e[5];let R=_,g;e[6]!==R||e[7]!==d||e[8]!==S||e[9]!==a?(g=s(async()=>{let D=d.trim(),oe=ge(S);if(oe===null){W(a("Payload must be valid JSON"));return}O(!0),W(null),await R(D,oe.value).finally(()=>{O(!1)})},"N"),e[6]=R,e[7]=d,e[8]=S,e[9]=a,e[10]=g):g=e[10];let y=g,k;e[11]!==a?(k=a("Send event"),e[11]=a,e[12]=k):k=e[12];let A;e[13]!==k?(A=(0,t.jsx)("h3",{className:"text-sm font-medium",children:k}),e[13]=k,e[14]=A):A=e[14];let I;e[15]!==F?(I=F!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-event-error",role:"alert",children:F}),e[15]=F,e[16]=I):I=e[16];let T;e[17]!==a?(T=a("Instance id"),e[17]=a,e[18]=T):T=e[18];let P;e[19]===Symbol.for("react.memo_cache_sentinel")?(P=s(D=>{m(D.target.value)},"O"),e[19]=P):P=e[19];let E;e[20]!==a?(E=a("Instance id"),e[20]=a,e[21]=E):E=e[21];let J;e[22]!==d||e[23]!==T||e[24]!==E?(J=(0,t.jsx)(me,{"aria-label":T,className:"max-w-48","data-testid":"workflows-event-id",onChange:P,placeholder:E,value:d}),e[22]=d,e[23]=T,e[24]=E,e[25]=J):J=e[25];let n;e[26]!==a?(n=a("Event type"),e[26]=a,e[27]=n):n=e[27];let u;e[28]===Symbol.for("react.memo_cache_sentinel")?(u=s(D=>{L(D.target.value)},"L"),e[28]=u):u=e[28];let f;e[29]!==a?(f=a("Event type"),e[29]=a,e[30]=f):f=e[30];let r;e[31]!==n||e[32]!==f||e[33]!==v?(r=(0,t.jsx)(me,{"aria-label":n,className:"max-w-48","data-testid":"workflows-event-type",list:"workflows-event-types",onChange:u,placeholder:f,value:v}),e[31]=n,e[32]=f,e[33]=v,e[34]=r):r=e[34];let c;e[35]!==w?(c=w.map(je),e[35]=w,e[36]=c):c=e[36];let o;e[37]!==c?(o=(0,t.jsx)("datalist",{"data-testid":"workflows-event-types",id:"workflows-event-types",children:c}),e[37]=c,e[38]=o):o=e[38];let $;e[39]!==x||e[40]!==d||e[41]!==C||e[42]!==v?($=C||x===""||d.trim()===""||v.trim()==="",e[39]=x,e[40]=d,e[41]=C,e[42]=v,e[43]=$):$=e[43];let K;e[44]!==y?(K=s(()=>{U(y())},"z"),e[44]=y,e[45]=K):K=e[45];let G;e[46]!==C||e[47]!==a?(G=a(C?"Sending\u2026":"Send event"),e[46]=C,e[47]=a,e[48]=G):G=e[48];let M;e[49]!==$||e[50]!==K||e[51]!==G?(M=(0,t.jsx)(q,{"data-testid":"workflows-event-button",disabled:$,onClick:K,children:G}),e[49]=$,e[50]=K,e[51]=G,e[52]=M):M=e[52];let Z;e[53]!==r||e[54]!==o||e[55]!==M||e[56]!==J?(Z=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[J,r,o,M]}),e[53]=r,e[54]=o,e[55]=M,e[56]=J,e[57]=Z):Z=e[57];let H;e[58]!==a?(H=a("Payload (JSON)"),e[58]=a,e[59]=H):H=e[59];let se;e[60]===Symbol.for("react.memo_cache_sentinel")?(se=s(D=>{B(D.target.value)},"Y"),e[60]=se):se=e[60];let Q;e[61]!==a?(Q=a("Payload (JSON, optional)"),e[61]=a,e[62]=Q):Q=e[62];let V;e[63]!==S||e[64]!==H||e[65]!==Q?(V=(0,t.jsx)(we,{"aria-label":H,className:"font-mono","data-testid":"workflows-event-payload",onChange:se,placeholder:Q,value:S}),e[63]=S,e[64]=H,e[65]=Q,e[66]=V):V=e[66];let le;return e[67]!==Z||e[68]!==V||e[69]!==A||e[70]!==I?(le=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-event",children:[A,I,Z,V]}),e[67]=Z,e[68]=V,e[69]=A,e[70]=I,e[71]=le):le=e[71],le},"Pe"),Ve=s(()=>{let l=ce(),e=Y(),{data:w,error:x}=Ne(X.listWorkflows,{}),[N,b]=(0,i.useState)(""),[a,d]=(0,i.useState)(""),[m,v]=(0,i.useState)(""),[L,S]=(0,i.useState)(!1),[B,C]=(0,i.useState)(null),[O,F]=(0,i.useState)([]),[W,_]=(0,i.useState)(null),R=w!==void 0,g=Array.isArray(w?.workflows)?[...w.workflows].toSorted((r,c)=>r.exportName.localeCompare(c.exportName)):[],y=Fe(g,N),k=g.find(r=>r.exportName===y),A=s(r=>{F(c=>{let o=c.filter($=>!($.exportName===r.exportName&&$.id===r.id));return[r,...o]})},"T"),I=s(async()=>{let r=y;if(r==="")return;let c=ge(m);if(c===null){C(e("Params must be valid JSON"));return}S(!0),C(null);try{let o=a.trim(),$=await l.query(_e,{exportName:r,id:o===""?void 0:o,params:c.value},de(""));A({exportName:r,id:$.id,status:$.status}),d("")}catch(o){C(z(o))}S(!1)},"F"),T=s(()=>{U(I())},"P"),P=s(async(r,c)=>{_(c);try{let o=await l.query(Ee,{exportName:r,id:c},de(""));A({error:o.error,exportName:r,id:o.id,output:o.output,status:o.status})}catch(o){throw _(null),o}_(null)},"O"),E=s(async(r,c)=>{try{await P(r,c)}catch(o){C(z(o))}},"E"),J=s(r=>{b(r.target.value)},"W"),n=s(r=>{d(r.target.value)},"A"),u=s(r=>{v(r.target.value)},"L"),f=s(r=>{let{export:c,id:o}=r.currentTarget.dataset;c!==void 0&&o!==void 0&&U(E(c,o))},"n");return(0,t.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-workflows-panel",children:[x!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-error",role:"alert",children:x}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:e("Workflows are declared in code with defineWorkflow and run as durable Cloudflare Workflows. Start an instance and observe its status below.")}),R&&g.length===0?(0,t.jsx)(ue,{description:e("No defineWorkflow is declared in lunora/workflows.ts in this deployment. Add one to run a durable, multi-step workflow."),testId:"workflows-empty",title:e("No workflows defined")}):(0,t.jsx)(ee,{className:"overflow-hidden py-0",children:(0,t.jsx)(te,{className:"px-0",children:(0,t.jsxs)(ae,{"data-testid":"workflows-table",children:[(0,t.jsx)(re,{children:(0,t.jsxs)(j,{children:[(0,t.jsx)(h,{children:e("Export")}),(0,t.jsx)(h,{children:e("Name")}),(0,t.jsx)(h,{children:e("Class")})]})}),(0,t.jsx)(ne,{children:g.map(r=>(0,t.jsxs)(j,{"data-testid":`workflows-row-${r.exportName}`,children:[(0,t.jsx)(p,{className:"font-mono text-xs",children:r.exportName}),(0,t.jsx)(p,{className:"font-mono text-xs text-muted-foreground",children:r.name}),(0,t.jsx)(p,{className:"font-mono text-xs text-muted-foreground",children:r.className})]},r.exportName))})]})})}),g.length>0&&(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-start",children:[(0,t.jsx)("h3",{className:"text-sm font-medium",children:e("Start instance")}),B!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:B}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)("select",{"aria-label":e("Workflow"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflows-start-select",onChange:J,value:y,children:g.map(r=>(0,t.jsx)("option",{value:r.exportName,children:r.exportName},r.exportName))}),(0,t.jsx)(me,{"aria-label":e("Instance id (optional)"),className:"max-w-48","data-testid":"workflows-start-id",onChange:n,placeholder:e("Instance id (optional)"),value:a}),(0,t.jsx)(q,{"data-testid":"workflows-start-button",disabled:L||y==="",onClick:T,children:e(L?"Starting\u2026":"Start instance")})]}),(0,t.jsx)(we,{"aria-label":e("Params (JSON)"),className:"font-mono","data-testid":"workflows-start-params",onChange:u,placeholder:e("Params (JSON, optional)"),value:m})]}),g.length>0&&(0,t.jsx)(Pe,{eventTypes:w?.eventTypes??[],exportName:y,onSent:P},y),O.length>0&&(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-instances",children:[(0,t.jsx)("h3",{className:"text-sm font-medium",children:e("Instances")}),(0,t.jsx)(ee,{className:"overflow-hidden py-0",children:(0,t.jsx)(te,{className:"px-0",children:(0,t.jsxs)(ae,{"data-testid":"workflows-instances-table",children:[(0,t.jsx)(re,{children:(0,t.jsxs)(j,{children:[(0,t.jsx)(h,{children:e("Workflow")}),(0,t.jsx)(h,{children:e("Instance id")}),(0,t.jsx)(h,{children:e("Status")}),(0,t.jsx)(h,{children:e("Output")}),(0,t.jsx)(h,{})]})}),(0,t.jsx)(ne,{children:O.map(r=>(0,t.jsxs)(j,{"data-testid":`workflows-instance-${r.id}`,children:[(0,t.jsx)(p,{className:"font-mono text-xs",children:r.exportName}),(0,t.jsx)(p,{className:"font-mono text-xs text-muted-foreground",children:r.id}),(0,t.jsx)(p,{className:"font-mono text-xs",children:r.status}),(0,t.jsx)(p,{className:"font-mono text-xs text-muted-foreground",children:De(r)}),(0,t.jsx)(p,{children:(0,t.jsx)(q,{"data-export":r.exportName,"data-id":r.id,"data-testid":`workflows-instance-refresh-${r.id}`,disabled:W===r.id,onClick:f,size:"xs",variant:"outline",children:W===r.id?e("Refreshing\u2026"):e("Refresh")})})]},`${r.exportName}:${r.id}`))})]})})})]}),k!==void 0&&(0,t.jsx)(Te,{workflowName:k.name})]})},"Ze");function je(l){return(0,t.jsx)("option",{value:l,children:l},l)}s(je,"De");export{Ve as default};
|
|
1
|
+
import{a as we}from"./chunk-O6HYP4FT.js";import{a as ve}from"./chunk-KMA6JR2E.js";import{i as me}from"./chunk-VB3BKQCE.js";import"./chunk-4SY2N2RS.js";import"./chunk-4AG356VE.js";import{a as q}from"./chunk-553O7ESU.js";import"./chunk-SCTYLLJT.js";import"./chunk-OZID3UYF.js";import{a as ue}from"./chunk-K7Z7UTJJ.js";import"./chunk-L27FKJTG.js";import{a as ae,b as re,c as ne,d as j,e as h,f as p}from"./chunk-VSYZL2WH.js";import{a as X}from"./chunk-LYVYUTQY.js";import{c as Ne}from"./chunk-P37L55FP.js";import{a as ee,e as te}from"./chunk-D76SLSGV.js";import{n as ce}from"./chunk-K24LZAP2.js";import"./chunk-ZPQBVYNN.js";import{B as Y,h as ie,i as de,j as z,p as pe,s as U}from"./chunk-OYCDWIG2.js";import"./chunk-PDBW6GTJ.js";import{a as be}from"./chunk-A6TVTNKO.js";import{a as ke,b as Se}from"./chunk-ADABTCDI.js";import{a as s,d as he}from"./chunk-5PEAXTYQ.js";var xe=he(be(),1),i=he(ke(),1);var t=he(Se(),1);var Ce=["queued","running","rollingBack","paused","waiting","complete","errored","terminated"],Oe=["pause","resume","restart","terminate"],Ie=s(l=>{let e=(0,xe.c)(7),{busy:w,id:x,onAct:N}=l,b=Y(),a;e[0]!==w||e[1]!==x||e[2]!==N||e[3]!==b?(a=Oe.map(m=>m==="restart"?(0,t.jsx)(ve,{confirmLabel:b("Restart?"),disabled:w,onConfirm:s(()=>{N(m)},"onConfirm"),testId:`workflow-instance-${m}-${x}`,children:b(m)},m):(0,t.jsx)(q,{"data-testid":`workflow-instance-${m}-${x}`,disabled:w,onClick:s(()=>{N(m)},"onClick"),size:"sm",type:"button",variant:"ghost",children:b(m)},m)),e[0]=w,e[1]=x,e[2]=N,e[3]=b,e[4]=a):a=e[4];let d;return e[5]!==a?(d=(0,t.jsx)(t.Fragment,{children:a}),e[5]=a,e[6]=d):d=e[6],d},"Ce"),$e="WORKFLOWS_NOT_CONFIGURED",We=s(l=>typeof l=="object"&&l!==null&&l.code===$e,"Oe"),Ae=s(l=>{let e=l.error??l.output;if(e===void 0)return"\u2014";try{return JSON.stringify(e,pe)}catch{return"(unserializable)"}},"Ee"),Te=s(({loadDetail:l,loadInstances:e,readOnly:w,runAction:x,workflowName:N})=>{let b=ce(),a=Y(),[d,m]=(0,i.useState)(null),[v,L]=(0,i.useState)(null),[S,B]=(0,i.useState)(""),[C,O]=(0,i.useState)(null),[F,W]=(0,i.useState)(!1),[_,R]=(0,i.useState)(null),g=(0,i.useRef)(0),y=(0,i.useRef)(0),k=(0,i.useRef)(0),A=l??(n=>b.getWorkflowInstance(n)),I=w?void 0:x??(e===void 0?n=>b.setWorkflowInstanceStatus(n):void 0),T=s(async()=>{y.current+=1;let n=y.current;O(null),W(!1);let u=S===""?void 0:S;try{if(e===void 0){let r=await b.listWorkflowInstances({name:N,status:u});if(n!==y.current)return;if(r.configured===!1){m(null),W(!0);return}m(r.instances);return}let f=await e({name:N,status:u});n===y.current&&m(f)}catch(f){if(n!==y.current)return;m(null),We(f)?W(!0):O(z(f))}},"E");(0,i.useEffect)(()=>{g.current+=1,k.current+=1,L(null),U(T())},[N,S]);let P=s(async n=>{k.current+=1;let u=k.current;O(null);try{let f=await A({id:n,name:N});u===k.current&&L(f)}catch(f){u===k.current&&O(z(f))}},"W"),E=s(()=>{k.current+=1,L(null)},"A"),J=s(async(n,u)=>{if(I===void 0)return;let f=g.current;R(n),O(null);try{await I({action:u,id:n,name:N}),f===g.current&&await T()}catch(r){O(z(r))}R(null)},"L");return(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-workflow-instances",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("h3",{className:"text-sm font-medium",children:a("Instance history")}),(0,t.jsxs)("select",{"aria-label":a("Filter by status"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflow-instances-filter",onChange:s(n=>{B(n.target.value)},"onChange"),value:S,children:[(0,t.jsx)("option",{value:"",children:a("All statuses")}),Ce.map(n=>(0,t.jsx)("option",{value:n,children:n},n))]})]}),C!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflow-instances-error",role:"alert",children:C}),F&&(0,t.jsx)(ue,{description:a("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history."),testId:"workflow-instances-unconfigured",title:a("Workflow inspection not configured")}),!F&&d!==null&&d.length===0&&(0,t.jsx)(ue,{description:a("No instances match this filter for the selected workflow."),testId:"workflow-instances-empty",title:a("No instances")}),d!==null&&d.length>0&&(0,t.jsx)(ee,{className:"overflow-hidden py-0",children:(0,t.jsx)(te,{className:"px-0",children:(0,t.jsxs)(ae,{"data-testid":"workflow-instances-table",children:[(0,t.jsx)(re,{children:(0,t.jsxs)(j,{children:[(0,t.jsx)(h,{children:a("Instance id")}),(0,t.jsx)(h,{children:a("Status")}),(0,t.jsx)(h,{children:a("Created")}),(0,t.jsx)(h,{children:a("Ended")}),(0,t.jsx)(h,{"aria-label":a("Actions")})]})}),(0,t.jsx)(ne,{children:d.map(n=>(0,t.jsxs)(j,{"data-testid":`workflow-instance-${n.id}`,children:[(0,t.jsx)(p,{className:"font-mono text-xs",children:n.id}),(0,t.jsx)(p,{className:"font-mono text-xs",children:n.status}),(0,t.jsx)(p,{className:"text-muted-foreground tabular-nums",children:n.createdOn??"\u2014"}),(0,t.jsx)(p,{className:"text-muted-foreground tabular-nums",children:n.endedOn??"\u2014"}),(0,t.jsx)(p,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1.5",children:[(0,t.jsx)(q,{"data-testid":`workflow-instance-steps-${n.id}`,onClick:s(()=>{U(P(n.id))},"onClick"),size:"sm",type:"button",variant:"outline",children:a("Steps")}),I!==void 0&&(0,t.jsx)(Ie,{busy:_===n.id,id:n.id,onAct:s(u=>{U(J(n.id,u))},"onAct")},N)]})})]},n.id))})]})})}),v!==null&&(0,t.jsx)(ee,{className:"overflow-hidden py-0","data-testid":"workflow-instance-detail",children:(0,t.jsxs)(te,{className:"flex flex-col gap-2 px-4 py-3",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("span",{className:"font-mono text-xs",children:[a("Steps")," \xB7 ",v.id]}),(0,t.jsx)(q,{"data-testid":"workflow-instance-detail-close",onClick:E,size:"xs",type:"button",variant:"ghost",children:a("Close")})]}),v.steps.length===0?(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:a("This instance has no recorded steps yet.")}):(0,t.jsxs)(ae,{"data-testid":"workflow-instance-steps",children:[(0,t.jsx)(re,{children:(0,t.jsxs)(j,{children:[(0,t.jsx)(h,{children:a("Step")}),(0,t.jsx)(h,{children:a("Type")}),(0,t.jsx)(h,{children:a("Attempts")}),(0,t.jsx)(h,{children:a("Started")}),(0,t.jsx)(h,{children:a("Output")})]})}),(0,t.jsx)(ne,{children:v.steps.map((n,u)=>(0,t.jsxs)(j,{"data-testid":`workflow-step-${String(u)}`,children:[(0,t.jsx)(p,{className:"font-mono text-xs",children:n.name}),(0,t.jsx)(p,{className:"text-xs text-muted-foreground",children:n.type??"\u2014"}),(0,t.jsx)(p,{className:"tabular-nums",children:n.attempts??"\u2014"}),(0,t.jsx)(p,{className:"text-muted-foreground tabular-nums",children:n.start??"\u2014"}),(0,t.jsx)(p,{className:"font-mono text-xs text-muted-foreground",children:Ae(n)})]},`${n.name}:${String(u)}`))})]})]})})]})},"_e"),_e=ie(X.createWorkflowInstance),Ee=ie(X.getWorkflowInstanceStatus),Je=ie(X.sendWorkflowEvent),De=s(l=>{if(l.error)return`${l.error.name}: ${l.error.message}`;if(l.output===void 0)return"\u2014";try{return JSON.stringify(l.output,pe)}catch{return"(unserializable)"}},"$e"),ge=s(l=>{let e=l.trim();if(e==="")return{value:void 0};try{return{value:JSON.parse(e)}}catch{return null}},"ve"),Fe=s((l,e)=>l.some(w=>w.exportName===e)?e:l[0]?.exportName??"","Fe"),Pe=s(l=>{let e=(0,xe.c)(72),{eventTypes:w,exportName:x,onSent:N}=l,b=ce(),a=Y(),[d,m]=(0,i.useState)(""),[v,L]=(0,i.useState)(""),[S,B]=(0,i.useState)(""),[C,O]=(0,i.useState)(!1),[F,W]=(0,i.useState)(null),_;e[0]!==b||e[1]!==x||e[2]!==N||e[3]!==a||e[4]!==v?(_=s(async(D,oe)=>{try{await b.query(Je,{exportName:x,id:D,payload:oe,type:v},de(""))}catch(fe){W(z(fe));return}try{await N(x,D)}catch(fe){let ye=fe;W(`${a("Event sent, but refreshing the instance failed")}: ${z(ye)}`)}},"_"),e[0]=b,e[1]=x,e[2]=N,e[3]=a,e[4]=v,e[5]=_):_=e[5];let R=_,g;e[6]!==R||e[7]!==d||e[8]!==S||e[9]!==a?(g=s(async()=>{let D=d.trim(),oe=ge(S);if(oe===null){W(a("Payload must be valid JSON"));return}O(!0),W(null),await R(D,oe.value).finally(()=>{O(!1)})},"N"),e[6]=R,e[7]=d,e[8]=S,e[9]=a,e[10]=g):g=e[10];let y=g,k;e[11]!==a?(k=a("Send event"),e[11]=a,e[12]=k):k=e[12];let A;e[13]!==k?(A=(0,t.jsx)("h3",{className:"text-sm font-medium",children:k}),e[13]=k,e[14]=A):A=e[14];let I;e[15]!==F?(I=F!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-event-error",role:"alert",children:F}),e[15]=F,e[16]=I):I=e[16];let T;e[17]!==a?(T=a("Instance id"),e[17]=a,e[18]=T):T=e[18];let P;e[19]===Symbol.for("react.memo_cache_sentinel")?(P=s(D=>{m(D.target.value)},"O"),e[19]=P):P=e[19];let E;e[20]!==a?(E=a("Instance id"),e[20]=a,e[21]=E):E=e[21];let J;e[22]!==d||e[23]!==T||e[24]!==E?(J=(0,t.jsx)(me,{"aria-label":T,className:"max-w-48","data-testid":"workflows-event-id",onChange:P,placeholder:E,value:d}),e[22]=d,e[23]=T,e[24]=E,e[25]=J):J=e[25];let n;e[26]!==a?(n=a("Event type"),e[26]=a,e[27]=n):n=e[27];let u;e[28]===Symbol.for("react.memo_cache_sentinel")?(u=s(D=>{L(D.target.value)},"L"),e[28]=u):u=e[28];let f;e[29]!==a?(f=a("Event type"),e[29]=a,e[30]=f):f=e[30];let r;e[31]!==n||e[32]!==f||e[33]!==v?(r=(0,t.jsx)(me,{"aria-label":n,className:"max-w-48","data-testid":"workflows-event-type",list:"workflows-event-types",onChange:u,placeholder:f,value:v}),e[31]=n,e[32]=f,e[33]=v,e[34]=r):r=e[34];let c;e[35]!==w?(c=w.map(je),e[35]=w,e[36]=c):c=e[36];let o;e[37]!==c?(o=(0,t.jsx)("datalist",{"data-testid":"workflows-event-types",id:"workflows-event-types",children:c}),e[37]=c,e[38]=o):o=e[38];let $;e[39]!==x||e[40]!==d||e[41]!==C||e[42]!==v?($=C||x===""||d.trim()===""||v.trim()==="",e[39]=x,e[40]=d,e[41]=C,e[42]=v,e[43]=$):$=e[43];let K;e[44]!==y?(K=s(()=>{U(y())},"z"),e[44]=y,e[45]=K):K=e[45];let G;e[46]!==C||e[47]!==a?(G=a(C?"Sending\u2026":"Send event"),e[46]=C,e[47]=a,e[48]=G):G=e[48];let M;e[49]!==$||e[50]!==K||e[51]!==G?(M=(0,t.jsx)(q,{"data-testid":"workflows-event-button",disabled:$,onClick:K,children:G}),e[49]=$,e[50]=K,e[51]=G,e[52]=M):M=e[52];let Z;e[53]!==r||e[54]!==o||e[55]!==M||e[56]!==J?(Z=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[J,r,o,M]}),e[53]=r,e[54]=o,e[55]=M,e[56]=J,e[57]=Z):Z=e[57];let H;e[58]!==a?(H=a("Payload (JSON)"),e[58]=a,e[59]=H):H=e[59];let se;e[60]===Symbol.for("react.memo_cache_sentinel")?(se=s(D=>{B(D.target.value)},"Y"),e[60]=se):se=e[60];let Q;e[61]!==a?(Q=a("Payload (JSON, optional)"),e[61]=a,e[62]=Q):Q=e[62];let V;e[63]!==S||e[64]!==H||e[65]!==Q?(V=(0,t.jsx)(we,{"aria-label":H,className:"font-mono","data-testid":"workflows-event-payload",onChange:se,placeholder:Q,value:S}),e[63]=S,e[64]=H,e[65]=Q,e[66]=V):V=e[66];let le;return e[67]!==Z||e[68]!==V||e[69]!==A||e[70]!==I?(le=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-event",children:[A,I,Z,V]}),e[67]=Z,e[68]=V,e[69]=A,e[70]=I,e[71]=le):le=e[71],le},"Pe"),Ve=s(()=>{let l=ce(),e=Y(),{data:w,error:x}=Ne(X.listWorkflows,{}),[N,b]=(0,i.useState)(""),[a,d]=(0,i.useState)(""),[m,v]=(0,i.useState)(""),[L,S]=(0,i.useState)(!1),[B,C]=(0,i.useState)(null),[O,F]=(0,i.useState)([]),[W,_]=(0,i.useState)(null),R=w!==void 0,g=Array.isArray(w?.workflows)?[...w.workflows].toSorted((r,c)=>r.exportName.localeCompare(c.exportName)):[],y=Fe(g,N),k=g.find(r=>r.exportName===y),A=s(r=>{F(c=>{let o=c.filter($=>!($.exportName===r.exportName&&$.id===r.id));return[r,...o]})},"T"),I=s(async()=>{let r=y;if(r==="")return;let c=ge(m);if(c===null){C(e("Params must be valid JSON"));return}S(!0),C(null);try{let o=a.trim(),$=await l.query(_e,{exportName:r,id:o===""?void 0:o,params:c.value},de(""));A({exportName:r,id:$.id,status:$.status}),d("")}catch(o){C(z(o))}S(!1)},"F"),T=s(()=>{U(I())},"P"),P=s(async(r,c)=>{_(c);try{let o=await l.query(Ee,{exportName:r,id:c},de(""));A({error:o.error,exportName:r,id:o.id,output:o.output,status:o.status})}catch(o){throw _(null),o}_(null)},"O"),E=s(async(r,c)=>{try{await P(r,c)}catch(o){C(z(o))}},"E"),J=s(r=>{b(r.target.value)},"W"),n=s(r=>{d(r.target.value)},"A"),u=s(r=>{v(r.target.value)},"L"),f=s(r=>{let{export:c,id:o}=r.currentTarget.dataset;c!==void 0&&o!==void 0&&U(E(c,o))},"n");return(0,t.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-workflows-panel",children:[x!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-error",role:"alert",children:x}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:e("Workflows are declared in code with defineWorkflow and run as durable Cloudflare Workflows. Start an instance and observe its status below.")}),R&&g.length===0?(0,t.jsx)(ue,{description:e("No defineWorkflow is declared in lunora/workflows.ts in this deployment. Add one to run a durable, multi-step workflow."),testId:"workflows-empty",title:e("No workflows defined")}):(0,t.jsx)(ee,{className:"overflow-hidden py-0",children:(0,t.jsx)(te,{className:"px-0",children:(0,t.jsxs)(ae,{"data-testid":"workflows-table",children:[(0,t.jsx)(re,{children:(0,t.jsxs)(j,{children:[(0,t.jsx)(h,{children:e("Export")}),(0,t.jsx)(h,{children:e("Name")}),(0,t.jsx)(h,{children:e("Class")})]})}),(0,t.jsx)(ne,{children:g.map(r=>(0,t.jsxs)(j,{"data-testid":`workflows-row-${r.exportName}`,children:[(0,t.jsx)(p,{className:"font-mono text-xs",children:r.exportName}),(0,t.jsx)(p,{className:"font-mono text-xs text-muted-foreground",children:r.name}),(0,t.jsx)(p,{className:"font-mono text-xs text-muted-foreground",children:r.className})]},r.exportName))})]})})}),g.length>0&&(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-start",children:[(0,t.jsx)("h3",{className:"text-sm font-medium",children:e("Start instance")}),B!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:B}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)("select",{"aria-label":e("Workflow"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflows-start-select",onChange:J,value:y,children:g.map(r=>(0,t.jsx)("option",{value:r.exportName,children:r.exportName},r.exportName))}),(0,t.jsx)(me,{"aria-label":e("Instance id (optional)"),className:"max-w-48","data-testid":"workflows-start-id",onChange:n,placeholder:e("Instance id (optional)"),value:a}),(0,t.jsx)(q,{"data-testid":"workflows-start-button",disabled:L||y==="",onClick:T,children:e(L?"Starting\u2026":"Start instance")})]}),(0,t.jsx)(we,{"aria-label":e("Params (JSON)"),className:"font-mono","data-testid":"workflows-start-params",onChange:u,placeholder:e("Params (JSON, optional)"),value:m})]}),g.length>0&&(0,t.jsx)(Pe,{eventTypes:w?.eventTypes??[],exportName:y,onSent:P},y),O.length>0&&(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-instances",children:[(0,t.jsx)("h3",{className:"text-sm font-medium",children:e("Instances")}),(0,t.jsx)(ee,{className:"overflow-hidden py-0",children:(0,t.jsx)(te,{className:"px-0",children:(0,t.jsxs)(ae,{"data-testid":"workflows-instances-table",children:[(0,t.jsx)(re,{children:(0,t.jsxs)(j,{children:[(0,t.jsx)(h,{children:e("Workflow")}),(0,t.jsx)(h,{children:e("Instance id")}),(0,t.jsx)(h,{children:e("Status")}),(0,t.jsx)(h,{children:e("Output")}),(0,t.jsx)(h,{})]})}),(0,t.jsx)(ne,{children:O.map(r=>(0,t.jsxs)(j,{"data-testid":`workflows-instance-${r.id}`,children:[(0,t.jsx)(p,{className:"font-mono text-xs",children:r.exportName}),(0,t.jsx)(p,{className:"font-mono text-xs text-muted-foreground",children:r.id}),(0,t.jsx)(p,{className:"font-mono text-xs",children:r.status}),(0,t.jsx)(p,{className:"font-mono text-xs text-muted-foreground",children:De(r)}),(0,t.jsx)(p,{children:(0,t.jsx)(q,{"data-export":r.exportName,"data-id":r.id,"data-testid":`workflows-instance-refresh-${r.id}`,disabled:W===r.id,onClick:f,size:"xs",variant:"outline",children:W===r.id?e("Refreshing\u2026"):e("Refresh")})})]},`${r.exportName}:${r.id}`))})]})})})]}),k!==void 0&&(0,t.jsx)(Te,{workflowName:k.name})]})},"Ze");function je(l){return(0,t.jsx)("option",{value:l,children:l},l)}s(je,"De");export{Ve as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as $e}from"./chunk-4DIRNQHR.js";import{g as Le}from"./chunk-FERYOTLW.js";import"./chunk-GXTSE66Z.js";import"./chunk-SWFSB4QT.js";import"./chunk-CL3JOU6F.js";import{a as ae}from"./chunk-AQ62YJJ5.js";import"./chunk-KTK4NDWQ.js";import"./chunk-XLYFGUEF.js";import"./chunk-D65UVZIA.js";import"./chunk-NGVP66OH.js";import"./chunk-2MZLFQR5.js";import"./chunk-QAOZXPLU.js";import{a as ge}from"./chunk-J45HAKBU.js";import{a as be}from"./chunk-645S7KRU.js";import"./chunk-3D67ZJRW.js";import"./chunk-DA2CAFXI.js";import{a as ue}from"./chunk-6YBEKVUG.js";import"./chunk-ZSWW2UGP.js";import"./chunk-RTS5G3ET.js";import"./chunk-QRA7AKYO.js";import{i as Je}from"./chunk-MWYGLPDV.js";import"./chunk-HFBSWKJS.js";import"./chunk-4EPW63HS.js";import{a as ce}from"./chunk-KBYFBEG2.js";import"./chunk-JMZT3CEW.js";import"./chunk-VUOEJJUH.js";import{a as se}from"./chunk-FWOOA2ZR.js";import{b as oe}from"./chunk-M4TCBPSY.js";import"./chunk-YUVGMKHG.js";import{a as ee,b as te,c as re,d as z,e as L,f as K}from"./chunk-VXZAS5VS.js";import"./chunk-PUU56AIE.js";import"./chunk-4PI2OSSP.js";import{a as me}from"./chunk-6A6AELDJ.js";import{b as ne,c as ve}from"./chunk-CLQKKJHL.js";import{a as Z,e as H}from"./chunk-OSHODLMU.js";import{l as je,n as de}from"./chunk-PFPJA2HR.js";import"./chunk-ZPQBVYNN.js";import{B as V,h as fe,i as Ae,j as ie,k as xe,s as Y,w as le,x as Ie}from"./chunk-PUK3H4RN.js";import"./chunk-PDBW6GTJ.js";import{a as Ce}from"./chunk-GWNGVKLG.js";import{a as we,b as Se}from"./chunk-6G3E4PJ2.js";import{a as y,d as he}from"./chunk-5PEAXTYQ.js";var G=he(Ce(),1),Q=he(we(),1);var t=he(Se(),1);var Fe=he(Ce(),1),pe=he(we(),1);var D=he(Se(),1);var Me=y(r=>Number.isFinite(r)?le(r,"\u2014"):"\u2014","X"),Ke=y(r=>r.toSorted((e,o)=>e.scheduledFor-o.scheduledFor),"F"),Be=y((r,e,o)=>e!==void 0?e:o===void 0?n=>r.cancelScheduledJob(n):void 0,"Y"),Te=y(r=>{let e=(0,Fe.c)(16),{cancelJob:o,loadJobs:n}=r===void 0?{}:r,l=de(),s=V(),a=n===void 0,i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=["lunora-scheduled-jobs"],e[0]=i):i=e[0];let c=ne(i,async()=>{let x=await(n??(()=>l.listScheduledJobs()))();return Ke(x)}),[N,p]=(0,pe.useState)(void 0),[h,m]=(0,pe.useState)(void 0),k,f;e[1]!==l||e[2]!==a?(k=y(()=>{if(a)return l.subscribeScheduledJobs(x=>{m(void 0),p(Ke(x))})},"v"),f=[a,l],e[1]=l,e[2]=a,e[3]=k,e[4]=f):(k=e[3],f=e[4]),(0,pe.useEffect)(k,f);let d;e[5]!==c?(d=y(()=>c.poll(),"y"),e[5]=c,e[6]=d):d=e[6],ae(d,!a);let u=Be(l,o,n),v=N??c.data,b=h??c.error,S=y(async x=>{if(u!==void 0){m(void 0);try{await u(x),a||c.refetch()}catch(A){m(ie(A))}}},"E"),I="flex flex-col gap-3",w="lunora-scheduled-jobs",C;e[7]!==b?(C=b!==null&&(0,D.jsx)("p",{className:"text-sm text-destructive","data-testid":"sj-error",role:"alert",children:b}),e[7]=b,e[8]=C):C=e[8];let J;e[9]!==v?.length||e[10]!==s?(J=v?.length===0&&(0,D.jsx)(se,{description:s("Jobs queued with runAfter / runAt will appear here."),icon:(0,D.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,D.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,D.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"sj-empty",title:s("No scheduled jobs.")}),e[9]=v?.length,e[10]=s,e[11]=J):J=e[11];let $=v!==void 0&&v.length>0&&(0,D.jsx)(Z,{className:"overflow-hidden py-0",children:(0,D.jsx)(H,{className:"px-0",children:(0,D.jsxs)(ee,{"data-testid":"sj-table",children:[(0,D.jsx)(te,{children:(0,D.jsxs)(z,{children:[(0,D.jsx)(L,{children:s("function")}),(0,D.jsx)(L,{children:s("scheduled for")}),(0,D.jsx)(L,{children:s("pool")}),(0,D.jsx)(L,{children:s("attempts")}),(0,D.jsx)(L,{children:s("shard")}),(0,D.jsx)(L,{children:s("id")}),u!==void 0&&(0,D.jsx)(L,{"aria-label":s("Actions")})]})}),(0,D.jsx)(re,{children:v.map(x=>(0,D.jsxs)(z,{"data-testid":`sj-row-${x.id}`,children:[(0,D.jsx)(K,{className:"font-mono text-xs",children:x.workflow??x.functionPath}),(0,D.jsx)(K,{className:"text-muted-foreground tabular-nums",children:Me(x.scheduledFor)}),(0,D.jsx)(K,{className:"font-mono text-xs",children:x.pool??""}),(0,D.jsx)(K,{className:"tabular-nums",children:x.attempts??0}),(0,D.jsx)(K,{children:x.shardKey??""}),(0,D.jsx)(K,{className:"font-mono text-xs",children:x.id}),u!==void 0&&(0,D.jsx)(K,{className:"text-right",children:(0,D.jsx)(ue,{confirmLabel:s("Cancel job?"),onConfirm:y(()=>{Y(S(x.id))},"onConfirm"),testId:`sj-cancel-${x.id}`,children:s("Cancel")})})]},x.id))})]})})}),j;return e[12]!==$||e[13]!==C||e[14]!==J?(j=(0,D.jsxs)("div",{className:I,"data-testid":w,children:[C,J,$]}),e[12]=$,e[13]=C,e[14]=J,e[15]=j):j=e[15],j},"he");var _e={failed:"destructive",skipped:"warning",succeeded:"success"},Re=25,Pe=y(r=>r<1e3?`${String(r)} ms`:`${(r/1e3).toFixed(1)} s`,"Ee"),Oe=y(r=>{let e=(0,G.c)(39),{inFlight:o,last:n}=r,l=V();if(o!==void 0){let u;e[0]!==l?(u=l("running"),e[0]=l,e[1]=u):u=e[1];let v;e[2]!==u?(v=(0,t.jsx)(oe,{variant:"info",children:u}),e[2]=u,e[3]=v):v=e[3];let b;e[4]!==o.startedAt?(b=le(o.startedAt,"\u2014"),e[4]=o.startedAt,e[5]=b):b=e[5];let S;e[6]!==b?(S=(0,t.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums",children:b}),e[6]=b,e[7]=S):S=e[7];let I;e[8]!==o.skipped||e[9]!==l?(I=o.skipped>0&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:l("{count} ticks skipped",{count:o.skipped})}),e[8]=o.skipped,e[9]=l,e[10]=I):I=e[10];let w;return e[11]!==v||e[12]!==S||e[13]!==I?(w=(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[v,S,I]}),e[11]=v,e[12]=S,e[13]=I,e[14]=w):w=e[14],w}if(n===void 0){let u;e[15]!==l?(u=l("never"),e[15]=l,e[16]=u):u=e[16];let v;return e[17]!==u?(v=(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:u}),e[17]=u,e[18]=v):v=e[18],v}let s;e[19]!==l?(s=l("failed"),e[19]=l,e[20]=s):s=e[20];let a;e[21]!==l?(a=l("skipped"),e[21]=l,e[22]=a):a=e[22];let i;e[23]!==l?(i=l("succeeded"),e[23]=l,e[24]=i):i=e[24];let c;e[25]!==s||e[26]!==a||e[27]!==i?(c={failed:s,skipped:a,succeeded:i},e[25]=s,e[26]=a,e[27]=i,e[28]=c):c=e[28];let N=c,p=_e[n.status],h=N[n.status],m;e[29]!==p||e[30]!==h?(m=(0,t.jsx)(oe,{variant:p,children:h}),e[29]=p,e[30]=h,e[31]=m):m=e[31];let k;e[32]!==n.startedAt?(k=le(n.startedAt,"\u2014"),e[32]=n.startedAt,e[33]=k):k=e[33];let f;e[34]!==k?(f=(0,t.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums",children:k}),e[34]=k,e[35]=f):f=e[35];let d;return e[36]!==m||e[37]!==f?(d=(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[m,f]}),e[36]=m,e[37]=f,e[38]=d):d=e[38],d},"Re"),Ee=y(r=>{let e=(0,G.c)(80),{runs:o}=r,n=V();if(o.length===0)return;let l,s,a,i,c,N,p,h,m,k,f;if(e[0]!==o||e[1]!==n){let I=o.toSorted(Ue).slice(0,Re),w;e[13]!==n?(w=n("failed"),e[13]=n,e[14]=w):w=e[14];let C;e[15]!==n?(C=n("skipped"),e[15]=n,e[16]=C):C=e[16];let J;e[17]!==n?(J=n("succeeded"),e[17]=n,e[18]=J):J=e[18];let $;e[19]!==J||e[20]!==w||e[21]!==C?($={failed:w,skipped:C,succeeded:J},e[19]=J,e[20]=w,e[21]=C,e[22]=$):$=e[22];let j=$;m="flex flex-col gap-2",k="cron-run-history";let x;e[23]!==n?(x=n("Recent runs"),e[23]=n,e[24]=x):x=e[24],e[25]!==x?(f=(0,t.jsx)("h3",{className:"text-sm font-medium",children:x}),e[25]=x,e[26]=f):f=e[26],i=Z,h="overflow-hidden py-0",a=H,p="px-0",s=ee;let A;e[27]!==n?(A=n("name"),e[27]=n,e[28]=A):A=e[28];let g;e[29]!==A?(g=(0,t.jsx)(L,{children:A}),e[29]=A,e[30]=g):g=e[30];let F;e[31]!==n?(F=n("status"),e[31]=n,e[32]=F):F=e[32];let _;e[33]!==F?(_=(0,t.jsx)(L,{children:F}),e[33]=F,e[34]=_):_=e[34];let T;e[35]!==n?(T=n("started"),e[35]=n,e[36]=T):T=e[36];let M;e[37]!==T?(M=(0,t.jsx)(L,{children:T}),e[37]=T,e[38]=M):M=e[38];let R;e[39]!==n?(R=n("duration"),e[39]=n,e[40]=R):R=e[40];let W;e[41]!==R?(W=(0,t.jsx)(L,{children:R}),e[41]=R,e[42]=W):W=e[42];let B;e[43]!==n?(B=n("skipped"),e[43]=n,e[44]=B):B=e[44];let E;e[45]!==B?(E=(0,t.jsx)(L,{children:B}),e[45]=B,e[46]=E):E=e[46];let U;e[47]!==n?(U=n("error"),e[47]=n,e[48]=U):U=e[48];let P;e[49]!==U?(P=(0,t.jsx)(L,{children:U}),e[49]=U,e[50]=P):P=e[50],e[51]!==g||e[52]!==_||e[53]!==M||e[54]!==W||e[55]!==E||e[56]!==P?(N=(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[g,_,M,W,E,P]})}),e[51]=g,e[52]=_,e[53]=M,e[54]=W,e[55]=E,e[56]=P,e[57]=N):N=e[57],l=re;let X;e[58]!==j?(X=y(q=>(0,t.jsxs)(z,{"data-testid":`cron-run-row-${q.runId}`,children:[(0,t.jsx)(K,{children:q.name}),(0,t.jsx)(K,{children:(0,t.jsx)(oe,{variant:_e[q.status],children:j[q.status]})}),(0,t.jsx)(K,{className:"text-muted-foreground tabular-nums",children:le(q.startedAt,"\u2014")}),(0,t.jsx)(K,{className:"tabular-nums",children:q.status==="skipped"?"":Pe(q.durationMs)}),(0,t.jsx)(K,{className:"tabular-nums",children:q.skipped>0?q.skipped:""}),(0,t.jsx)(K,{className:"text-xs text-destructive",children:q.error??""})]},q.runId),"W"),e[58]=j,e[59]=X):X=e[59],c=I.map(X),e[0]=o,e[1]=n,e[2]=l,e[3]=s,e[4]=a,e[5]=i,e[6]=c,e[7]=N,e[8]=p,e[9]=h,e[10]=m,e[11]=k,e[12]=f}else l=e[2],s=e[3],a=e[4],i=e[5],c=e[6],N=e[7],p=e[8],h=e[9],m=e[10],k=e[11],f=e[12];let d;e[60]!==l||e[61]!==c?(d=(0,t.jsx)(l,{children:c}),e[60]=l,e[61]=c,e[62]=d):d=e[62];let u;e[63]!==s||e[64]!==N||e[65]!==d?(u=(0,t.jsxs)(s,{children:[N,d]}),e[63]=s,e[64]=N,e[65]=d,e[66]=u):u=e[66];let v;e[67]!==a||e[68]!==p||e[69]!==u?(v=(0,t.jsx)(a,{className:p,children:u}),e[67]=a,e[68]=p,e[69]=u,e[70]=v):v=e[70];let b;e[71]!==i||e[72]!==v||e[73]!==h?(b=(0,t.jsx)(i,{className:h,children:v}),e[71]=i,e[72]=v,e[73]=h,e[74]=b):b=e[74];let S;return e[75]!==b||e[76]!==m||e[77]!==k||e[78]!==f?(S=(0,t.jsxs)("div",{className:m,"data-testid":k,children:[f,b]}),e[75]=b,e[76]=m,e[77]=k,e[78]=f,e[79]=S):S=e[79],S},"Le");function Ue(r,e){return e.startedAt-r.startedAt}y(Ue,"Oe");var We=y(()=>{let r=(0,G.c)(50),e=V(),o=$e(""),[n,l]=(0,Q.useState)(""),[s,a]=(0,Q.useState)(void 0),[i,c]=(0,Q.useState)(!1);if(o.unavailable)return null;let N;r[0]!==o?(N=o.pending("cron"),r[0]=o,r[1]=N):N=r[1];let p=N,h;r[2]!==o?(h=o.reason("cron"),r[2]=o,r[3]=h):h=r[3];let m=h,k;r[4]!==n||r[5]!==o?(k=y(()=>{let T=n.trim();T!==""&&Y((async()=>{let M=await o.suggestCron(T);c(!1),a(M)})())},"y"),r[4]=n,r[5]=o,r[6]=k):k=r[6];let f=k,d;r[7]!==s?(d=y(()=>{let T="navigator"in globalThis?globalThis.navigator.clipboard:void 0;T===void 0||s===void 0||Y((async()=>{try{await T.writeText(s),c(!0)}catch{c(!1)}})())},"d"),r[7]=s,r[8]=d):d=r[8];let u=d,v;r[9]!==e?(v=e("Describe a schedule"),r[9]=e,r[10]=v):v=r[10];let b;r[11]===Symbol.for("react.memo_cache_sentinel")?(b=y(T=>{l(T.target.value)},"b"),r[11]=b):b=r[11];let S;r[12]!==f?(S=y(T=>{T.key==="Enter"&&(T.preventDefault(),f())},"w"),r[12]=f,r[13]=S):S=r[13];let I;r[14]!==e?(I=e("Describe a schedule"),r[14]=e,r[15]=I):I=r[15];let w;r[16]!==p||r[17]!==n||r[18]!==v||r[19]!==S||r[20]!==I?(w=(0,t.jsx)(Je,{"aria-label":v,className:"h-7 flex-1 text-xs","data-testid":"cron-assistant-prompt",disabled:p,onChange:b,onKeyDown:S,placeholder:I,value:n}),r[16]=p,r[17]=n,r[18]=v,r[19]=S,r[20]=I,r[21]=w):w=r[21];let C=p&&"opacity-60",J;r[22]!==C?(J=Ie("rounded-md border border-border px-2 py-1 text-xs outline-none transition-colors hover:bg-accent focus-visible:bg-accent",C),r[22]=C,r[23]=J):J=r[23];let $;r[24]!==p||r[25]!==n?($=p||n.trim()==="",r[24]=p,r[25]=n,r[26]=$):$=r[26];let j;r[27]!==p||r[28]!==e?(j=e(p?"Thinking\u2026":"Suggest schedule"),r[27]=p,r[28]=e,r[29]=j):j=r[29];let x;r[30]!==f||r[31]!==J||r[32]!==$||r[33]!==j?(x=(0,t.jsx)("button",{className:J,"data-testid":"cron-assistant-generate",disabled:$,onClick:f,type:"button",children:j}),r[30]=f,r[31]=J,r[32]=$,r[33]=j,r[34]=x):x=r[34];let A;r[35]!==x||r[36]!==w?(A=(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[w,x]}),r[35]=x,r[36]=w,r[37]=A):A=r[37];let g;r[38]!==i||r[39]!==u||r[40]!==s||r[41]!==e?(g=s!==void 0&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("code",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-xs tabular-nums","data-testid":"cron-assistant-result",children:s}),(0,t.jsx)("button",{className:"rounded-md border border-border px-2 py-0.5 text-[11px] outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"cron-assistant-copy",onClick:u,type:"button",children:e(i?"Copied":"Copy")}),(0,t.jsx)("span",{className:"text-[11px] text-muted-foreground",children:e("Add it to lunora/crons.ts \u2014 triggers are compiled into the worker.")})]}),r[38]=i,r[39]=u,r[40]=s,r[41]=e,r[42]=g):g=r[42];let F;r[43]!==m||r[44]!==e?(F=m!==void 0&&(0,t.jsx)("p",{className:"text-[11px] text-muted-foreground","data-testid":"cron-assistant-reason",role:"status",children:e(m==="ai-error"?"The model could not be reached.":"The model did not return a schedule Cron Triggers accept.")}),r[43]=m,r[44]=e,r[45]=F):F=r[45];let _;return r[46]!==A||r[47]!==g||r[48]!==F?(_=(0,t.jsxs)("div",{className:"flex flex-col gap-1.5","data-testid":"cron-assistant",children:[A,g,F]}),r[46]=A,r[47]=g,r[48]=F,r[49]=_):_=r[49],_},"Ke"),ze={kind:"idle"},qe="SCHEDULER_NOT_CONFIGURED",ye={inFlight:[],runs:[]},Ve=y((r,e,o)=>o!==void 0?o:e===void 0?n=>r.runCronJob(n):void 0,"Fe"),Ge=y(({loadCronJobs:r,loadCronRuns:e,runCronJob:o}={})=>{let n=de(),l=V(),[s,a]=(0,Q.useState)({}),i=ne(["lunora-cron-jobs",r?"custom":"default"],()=>(r??(()=>n.getCronJobs()))()),{data:c,error:N}=i,p=e??(r===void 0?()=>n.listCronRuns():void 0),h=ne(["lunora-cron-runs",e?"custom":"default"],async()=>p===void 0?ye:p().catch(d=>{if(xe(d)===qe)return ye;throw d})),m=h.data??ye;ae(()=>h.poll(),p!==void 0);let k=Ve(n,r,o),f=y(async d=>{if(k!==void 0){a(u=>({...u,[d]:{kind:"running"}}));try{await k(d),a(u=>({...u,[d]:{kind:"ok"}})),i.refetch(),h.refetch()}catch(u){a(v=>({...v,[d]:{kind:"error",message:ie(u)}}))}}},"p");return(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-cron-triggers",children:[(0,t.jsx)(We,{}),N!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"cron-error",role:"alert",children:N}),h.error!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"cron-runs-error",role:"alert",children:h.error}),c?.length===0&&(0,t.jsx)(se,{description:l("Triggers declared with the cronJobs() builder appear here."),icon:(0,t.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,t.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"cron-empty",title:l("No cron triggers.")}),c!==void 0&&c.length>0&&(0,t.jsx)(Z,{className:"overflow-hidden py-0",children:(0,t.jsx)(H,{className:"px-0",children:(0,t.jsxs)(ee,{"data-testid":"cron-table",children:[(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(L,{children:l("name")}),(0,t.jsx)(L,{children:l("schedule")}),(0,t.jsx)(L,{children:l("target")}),(0,t.jsx)(L,{children:l("shard")}),(0,t.jsx)(L,{children:l("last run")}),k!==void 0&&(0,t.jsx)(L,{"aria-label":l("Actions")})]})}),(0,t.jsx)(re,{children:c.map(d=>{let u=s[d.name]??ze;return(0,t.jsxs)(z,{"data-testid":`cron-row-${d.name}`,children:[(0,t.jsx)(K,{children:d.name}),(0,t.jsx)(K,{className:"font-mono text-xs tabular-nums",children:d.cron}),(0,t.jsx)(K,{children:(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[d.workflow===void 0?(0,t.jsx)(oe,{variant:"outline",children:l("function")}):(0,t.jsx)(oe,{variant:"secondary",children:l("workflow")}),(0,t.jsx)("span",{className:"font-mono text-xs",children:d.workflow??d.functionPath})]})}),(0,t.jsx)(K,{children:d.shardKey??""}),(0,t.jsx)(K,{"data-testid":`cron-last-run-${d.name}`,children:(0,t.jsx)(Oe,{inFlight:m.inFlight.find(v=>v.name===d.name),last:m.runs.find(v=>v.name===d.name)})}),k!==void 0&&(0,t.jsx)(K,{className:"text-right",children:(0,t.jsxs)("span",{className:"flex items-center justify-end gap-2",children:[u.kind==="ok"&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":`cron-ran-${d.name}`,children:l("ran")}),u.kind==="error"&&(0,t.jsx)("span",{className:"text-xs text-destructive","data-testid":`cron-run-error-${d.name}`,role:"alert",children:u.message}),(0,t.jsx)(ue,{confirmLabel:l("Run now?"),disabled:u.kind==="running",onConfirm:y(()=>{Y(f(d.name))},"onConfirm"),testId:`cron-run-${d.name}`,children:u.kind==="running"?l("Running\u2026"):l("Run now")})]})})]},`${d.cron}:${d.name}`)})})]})})}),(0,t.jsx)(Ee,{runs:m.runs})]})},"Je"),Qe=y(r=>Number.isFinite(r)?le(r,"\u2014"):"\u2014","Me"),Xe=y(r=>{let e=(0,G.c)(34),o;e[0]!==r?(o=r===void 0?{}:r,e[0]=r,e[1]=o):o=e[1];let{loadJobs:n,removeJob:l,retryJob:s}=o,a=de(),i=V(),c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=["lunora-dead-jobs"],e[2]=c):c=e[2];let N;e[3]!==a||e[4]!==n?(N=y(async()=>(await(n??(()=>a.listDeadJobs()))()).toSorted(Ye),"v"),e[3]=a,e[4]=n,e[5]=N):N=e[5];let p=ne(c,N),h=p.data,[m,k]=(0,Q.useState)(void 0),f=p.error??m,d=n===void 0,u;e[6]!==a||e[7]!==d||e[8]!==s?(u=s??(d?g=>a.retryDeadJob(g):void 0),e[6]=a,e[7]=d,e[8]=s,e[9]=u):u=e[9];let v=u,b;e[10]!==a||e[11]!==d||e[12]!==l?(b=l??(d?g=>a.removeDeadJob(g):void 0),e[10]=a,e[11]=d,e[12]=l,e[13]=b):b=e[13];let S=b,I;e[14]!==p?(I=y(()=>p.poll(),"S"),e[14]=p,e[15]=I):I=e[15],ae(I,!0);let w;e[16]!==p?(w=y(async g=>{k(void 0);try{await g,p.refetch()}catch(F){k(ie(F))}},"N"),e[16]=p,e[17]=w):w=e[17];let C=w,J=v!==void 0||S!==void 0,$;e[18]!==f?($=f!==void 0&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"dlq-error",role:"alert",children:f}),e[18]=f,e[19]=$):$=e[19];let j;e[20]!==h?.length||e[21]!==i?(j=h?.length===0&&(0,t.jsx)(se,{description:i("Jobs that exhaust their retry budget are parked here instead of being dropped."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M3 6h18M8 6V4h8v2M6 6l1 14h10l1-14"})}),testId:"dlq-empty",title:i("No dead-letter jobs.")}),e[20]=h?.length,e[21]=i,e[22]=j):j=e[22];let x;e[23]!==C||e[24]!==J||e[25]!==h||e[26]!==S||e[27]!==v||e[28]!==i?(x=h!==void 0&&h.length>0&&(0,t.jsx)(Z,{className:"overflow-hidden py-0",children:(0,t.jsx)(H,{className:"px-0",children:(0,t.jsxs)(ee,{"data-testid":"dlq-table",children:[(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(L,{children:i("function")}),(0,t.jsx)(L,{children:i("attempts")}),(0,t.jsx)(L,{children:i("last tried")}),(0,t.jsx)(L,{children:i("pool")}),(0,t.jsx)(L,{children:i("shard")}),(0,t.jsx)(L,{children:i("id")}),J&&(0,t.jsx)(L,{"aria-label":i("Actions")})]})}),(0,t.jsx)(re,{children:h.map(g=>(0,t.jsxs)(z,{"data-testid":`dlq-row-${g.id}`,children:[(0,t.jsx)(K,{className:"font-mono text-xs",children:g.workflow??g.functionPath}),(0,t.jsx)(K,{className:"tabular-nums",children:g.attempts??0}),(0,t.jsx)(K,{className:"text-muted-foreground tabular-nums",children:Qe(g.scheduledFor)}),(0,t.jsx)(K,{className:"font-mono text-xs",children:g.pool??""}),(0,t.jsx)(K,{children:g.shardKey??""}),(0,t.jsx)(K,{className:"font-mono text-xs",children:g.id}),J&&(0,t.jsx)(K,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1.5",children:[v!==void 0&&(0,t.jsx)(ce,{"data-testid":`dlq-retry-${g.id}`,onClick:y(()=>{Y(C(v(g.id)))},"onClick"),size:"sm",type:"button",variant:"outline",children:i("Retry")}),S!==void 0&&(0,t.jsx)(ue,{confirmLabel:i("Drop job?"),onConfirm:y(()=>{Y(C(S(g.id)))},"onConfirm"),testId:`dlq-remove-${g.id}`,children:i("Drop")})]})})]},g.id))})]})})}),e[23]=C,e[24]=J,e[25]=h,e[26]=S,e[27]=v,e[28]=i,e[29]=x):x=e[29];let A;return e[30]!==x||e[31]!==$||e[32]!==j?(A=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-dead-letter",children:[$,j,x]}),e[30]=x,e[31]=$,e[32]=j,e[33]=A):A=e[33],A},"Pe");function Ye(r,e){return(e.attempts??0)-(r.attempts??0)}y(Ye,"qe");var Ze={canceled:"secondary",failed:"destructive",pending:"outline",running:"info",succeeded:"success"},He=y(r=>{let e=(0,G.c)(47),o;e[0]!==r?(o=r===void 0?{}:r,e[0]=r,e[1]=o):o=e[1];let{loadJobs:n}=o,l=de(),s=V(),a;e[2]!==l||e[3]!==n?(a=n??(async O=>l.listScheduledHistory(O===void 0?{}:{cursor:O})),e[2]=l,e[3]=n,e[4]=a):a=e[4];let i=a,c=n?"custom":"default",N;e[5]!==c?(N=["lunora-job-history",c],e[5]=c,e[6]=N):N=e[6];let p;e[7]!==i?(p=y(async()=>i(),"f"),e[7]=i,e[8]=p):p=e[8];let h=ne(N,p),[m,k]=(0,Q.useState)(void 0),[f,d]=(0,Q.useState)(!1),[u,v]=(0,Q.useState)(void 0),b=h.data?.records,S;e[9]!==b?(S=new Set(b?.map(et)),e[9]=b,e[10]=S):S=e[10];let I=S,w=b===void 0?void 0:[...b,...(m?.records??[]).filter(O=>!I.has(O.id))],C=m===void 0?h.data?.cursor:m.cursor,J;e[11]!==i||e[12]!==C?(J=y(async()=>{d(!0),v(void 0);try{let O=await i(C);k(De=>({cursor:O.cursor,records:[...De?.records??[],...O.records]})),d(!1)}catch(O){v(ie(O)),d(!1)}},"L"),e[11]=i,e[12]=C,e[13]=J):J=e[13];let $=J,j;e[14]!==s?(j=s("canceled"),e[14]=s,e[15]=j):j=e[15];let x;e[16]!==s?(x=s("failed"),e[16]=s,e[17]=x):x=e[17];let A;e[18]!==s?(A=s("pending"),e[18]=s,e[19]=A):A=e[19];let g;e[20]!==s?(g=s("running"),e[20]=s,e[21]=g):g=e[21];let F;e[22]!==s?(F=s("succeeded"),e[22]=s,e[23]=F):F=e[23];let _;e[24]!==A||e[25]!==g||e[26]!==F||e[27]!==j||e[28]!==x?(_={canceled:j,failed:x,pending:A,running:g,succeeded:F},e[24]=A,e[25]=g,e[26]=F,e[27]=j,e[28]=x,e[29]=_):_=e[29];let T=_,M;e[30]!==h?(M=y(()=>h.poll(),"_"),e[30]=h,e[31]=M):M=e[31],ae(M,m===void 0);let R="flex flex-col gap-3",W="lunora-job-history",B;e[32]!==h.error?(B=h.error!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"job-history-error",role:"alert",children:h.error}),e[32]=h.error,e[33]=B):B=e[33];let E=w?.length===0&&(0,t.jsx)(se,{description:s("Jobs that succeed, fail or are cancelled stay here for seven days."),testId:"job-history-empty",title:s("No finished jobs.")}),U=w!==void 0&&w.length>0&&(0,t.jsx)(Z,{className:"overflow-hidden py-0",children:(0,t.jsx)(H,{className:"px-0",children:(0,t.jsxs)(ee,{"data-testid":"job-history-table",children:[(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(L,{children:s("function")}),(0,t.jsx)(L,{children:s("state")}),(0,t.jsx)(L,{children:s("finished")}),(0,t.jsx)(L,{children:s("error")}),(0,t.jsx)(L,{children:s("id")})]})}),(0,t.jsx)(re,{children:w.map(O=>(0,t.jsxs)(z,{"data-testid":`job-history-row-${O.id}`,children:[(0,t.jsx)(K,{className:"font-mono text-xs",children:O.workflow??O.functionPath}),(0,t.jsx)(K,{children:(0,t.jsx)(oe,{"data-testid":`job-history-state-${O.id}`,variant:Ze[O.state],children:T[O.state]})}),(0,t.jsx)(K,{className:"text-muted-foreground tabular-nums",children:le(O.completedAt,"\u2014")}),(0,t.jsx)(K,{className:"text-xs text-destructive",children:O.error??""}),(0,t.jsx)(K,{className:"font-mono text-xs",children:O.id})]},O.id))})]})})}),P;e[34]!==u?(P=u!==void 0&&(0,t.jsx)("p",{className:"text-sm text-destructive",role:"alert",children:u}),e[34]=u,e[35]=P):P=e[35];let X;e[36]!==f||e[37]!==C||e[38]!==$||e[39]!==s?(X=C!==void 0&&(0,t.jsx)("div",{children:(0,t.jsx)(ce,{"data-testid":"job-history-load-more",disabled:f,onClick:y(()=>{Y($())},"onClick"),variant:"outline",children:s(f?"Loading\u2026":"Load more")})}),e[36]=f,e[37]=C,e[38]=$,e[39]=s,e[40]=X):X=e[40];let q;return e[41]!==B||e[42]!==E||e[43]!==U||e[44]!==P||e[45]!==X?(q=(0,t.jsxs)("div",{className:R,"data-testid":W,children:[B,E,U,P,X]}),e[41]=B,e[42]=E,e[43]=U,e[44]=P,e[45]=X,e[46]=q):q=e[46],q},"Be");function et(r){return r.id}y(et,"He");var tt=fe(me.dropOutboxEntry),rt=fe(me.retryOutboxEntry),lt=y(()=>{let r=(0,G.c)(8),e=V(),o;r[0]!==e?(o=e("Jobs whose mutation committed but that the scheduler has not accepted yet wait here."),r[0]=e,r[1]=o):o=r[1];let n;r[2]===Symbol.for("react.memo_cache_sentinel")?(n=(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M4 4h16v12H4zM4 16l4 4h8l4-4"})}),r[2]=n):n=r[2];let l;r[3]!==e?(l=e("Nothing is waiting for the scheduler."),r[3]=e,r[4]=l):l=r[4];let s;return r[5]!==o||r[6]!==l?(s=(0,t.jsx)(se,{description:o,icon:n,testId:"outbox-empty",title:l}),r[5]=o,r[6]=l,r[7]=s):s=r[7],s},"ze"),at=y(r=>{let e=(0,G.c)(58),{entry:o,onAct:n}=r,l=V(),s=`outbox-row-${o.id}`,a;e[0]!==o.target||e[1]!==l?(a=o.target??l("unreadable"),e[0]=o.target,e[1]=l,e[2]=a):a=e[2];let i;e[3]!==a?(i=(0,t.jsx)(K,{className:"font-mono text-xs",children:a}),e[3]=a,e[4]=i):i=e[4];let c=o.parked?"destructive":"secondary",N;e[5]!==o.parked||e[6]!==l?(N=o.parked?l("parked"):l("retrying"),e[5]=o.parked,e[6]=l,e[7]=N):N=e[7];let p;e[8]!==c||e[9]!==N?(p=(0,t.jsx)(oe,{variant:c,children:N}),e[8]=c,e[9]=N,e[10]=p):p=e[10];let h;e[11]!==o.forever||e[12]!==l?(h=o.forever&&(0,t.jsx)(oe,{variant:"outline",children:l("forever")}),e[11]=o.forever,e[12]=l,e[13]=h):h=e[13];let m;e[14]!==p||e[15]!==h?(m=(0,t.jsx)(K,{children:(0,t.jsxs)("div",{className:"flex gap-1",children:[p,h]})}),e[14]=p,e[15]=h,e[16]=m):m=e[16];let k;e[17]!==o.attempts?(k=(0,t.jsx)(K,{className:"tabular-nums",children:o.attempts}),e[17]=o.attempts,e[18]=k):k=e[18];let f;e[19]!==o.nextAttemptAt||e[20]!==o.parked?(f=o.parked?"\u2014":le(o.nextAttemptAt,"\u2014"),e[19]=o.nextAttemptAt,e[20]=o.parked,e[21]=f):f=e[21];let d;e[22]!==f?(d=(0,t.jsx)(K,{className:"text-muted-foreground tabular-nums",children:f}),e[22]=f,e[23]=d):d=e[23];let u;e[24]!==o.id?(u=(0,t.jsx)(K,{className:"font-mono text-xs",children:o.id}),e[24]=o.id,e[25]=u):u=e[25];let v=`outbox-retry-${o.id}`,b;e[26]!==o.id||e[27]!==n?(b=y(()=>{Y(n(rt,o.id))},"b"),e[26]=o.id,e[27]=n,e[28]=b):b=e[28];let S;e[29]!==l?(S=l("Retry now"),e[29]=l,e[30]=S):S=e[30];let I;e[31]!==v||e[32]!==b||e[33]!==S?(I=(0,t.jsx)(ce,{"data-testid":v,onClick:b,size:"sm",type:"button",variant:"outline",children:S}),e[31]=v,e[32]=b,e[33]=S,e[34]=I):I=e[34];let w;e[35]!==l?(w=l("Drop job?"),e[35]=l,e[36]=w):w=e[36];let C;e[37]!==o.id||e[38]!==n?(C=y(()=>{Y(n(tt,o.id))},"T"),e[37]=o.id,e[38]=n,e[39]=C):C=e[39];let J=`outbox-drop-${o.id}`,$;e[40]!==l?($=l("Drop"),e[40]=l,e[41]=$):$=e[41];let j;e[42]!==w||e[43]!==C||e[44]!==J||e[45]!==$?(j=(0,t.jsx)(ue,{confirmLabel:w,onConfirm:C,testId:J,children:$}),e[42]=w,e[43]=C,e[44]=J,e[45]=$,e[46]=j):j=e[46];let x;e[47]!==I||e[48]!==j?(x=(0,t.jsx)(K,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1.5",children:[I,j]})}),e[47]=I,e[48]=j,e[49]=x):x=e[49];let A;return e[50]!==s||e[51]!==d||e[52]!==u||e[53]!==x||e[54]!==i||e[55]!==m||e[56]!==k?(A=(0,t.jsxs)(z,{"data-testid":s,children:[i,m,k,d,u,x]}),e[50]=s,e[51]=d,e[52]=u,e[53]=x,e[54]=i,e[55]=m,e[56]=k,e[57]=A):A=e[57],A},"We"),ot=y(r=>{let e=(0,G.c)(41),{entries:o,onAct:n}=r,l=V(),s;e[0]!==l?(s=l("function"),e[0]=l,e[1]=s):s=e[1];let a;e[2]!==s?(a=(0,t.jsx)(L,{children:s}),e[2]=s,e[3]=a):a=e[3];let i;e[4]!==l?(i=l("state"),e[4]=l,e[5]=i):i=e[5];let c;e[6]!==i?(c=(0,t.jsx)(L,{children:i}),e[6]=i,e[7]=c):c=e[7];let N;e[8]!==l?(N=l("attempts"),e[8]=l,e[9]=N):N=e[9];let p;e[10]!==N?(p=(0,t.jsx)(L,{children:N}),e[10]=N,e[11]=p):p=e[11];let h;e[12]!==l?(h=l("next attempt"),e[12]=l,e[13]=h):h=e[13];let m;e[14]!==h?(m=(0,t.jsx)(L,{children:h}),e[14]=h,e[15]=m):m=e[15];let k;e[16]!==l?(k=l("id"),e[16]=l,e[17]=k):k=e[17];let f;e[18]!==k?(f=(0,t.jsx)(L,{children:k}),e[18]=k,e[19]=f):f=e[19];let d;e[20]!==l?(d=l("Actions"),e[20]=l,e[21]=d):d=e[21];let u;e[22]!==d?(u=(0,t.jsx)(L,{"aria-label":d}),e[22]=d,e[23]=u):u=e[23];let v;e[24]!==f||e[25]!==u||e[26]!==a||e[27]!==c||e[28]!==p||e[29]!==m?(v=(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[a,c,p,m,f,u]})}),e[24]=f,e[25]=u,e[26]=a,e[27]=c,e[28]=p,e[29]=m,e[30]=v):v=e[30];let b;if(e[31]!==o||e[32]!==n){let w;e[34]!==n?(w=y(C=>(0,t.jsx)(at,{entry:C,onAct:n},C.id),"N"),e[34]=n,e[35]=w):w=e[35],b=o.map(w),e[31]=o,e[32]=n,e[33]=b}else b=e[33];let S;e[36]!==b?(S=(0,t.jsx)(re,{children:b}),e[36]=b,e[37]=S):S=e[37];let I;return e[38]!==v||e[39]!==S?(I=(0,t.jsx)(Z,{className:"overflow-hidden py-0",children:(0,t.jsx)(H,{className:"px-0",children:(0,t.jsxs)(ee,{"data-testid":"outbox-table",children:[v,S]})})}),e[38]=v,e[39]=S,e[40]=I):I=e[40],I},"Ge"),nt=y(r=>{let e=(0,G.c)(11),{cursor:o,nextCursor:n,onFirst:l,onNext:s}=r,a=V();if(o===void 0&&n===void 0)return;let i;e[0]!==o||e[1]!==l||e[2]!==a?(i=o!==void 0&&(0,t.jsx)(ce,{"data-testid":"outbox-first-page",onClick:l,size:"sm",type:"button",variant:"outline",children:a("First page")}),e[0]=o,e[1]=l,e[2]=a,e[3]=i):i=e[3];let c;e[4]!==n||e[5]!==s||e[6]!==a?(c=n!==void 0&&(0,t.jsx)(ce,{"data-testid":"outbox-next-page",onClick:y(()=>{s(n)},"onClick"),size:"sm",type:"button",variant:"outline",children:a("Next page")}),e[4]=n,e[5]=s,e[6]=a,e[7]=c):c=e[7];let N;return e[8]!==i||e[9]!==c?(N=(0,t.jsxs)("div",{className:"flex justify-end gap-1.5",children:[i,c]}),e[8]=i,e[9]=c,e[10]=N):N=e[10],N},"Ye"),st=y(r=>{let e=(0,G.c)(38),o;e[0]!==r?(o=r===void 0?{}:r,e[0]=r,e[1]=o):o=e[1];let{initialShardKey:n}=o,l=je(),s=V(),{queryShardKey:a,setShardKey:i,shardKey:c}=ge(n),N;e[2]!==a?(N={cursor:void 0,shardKey:a},e[2]=a,e[3]=N):N=e[3];let[p,h]=(0,Q.useState)(N);p.shardKey!==a&&h({cursor:void 0,shardKey:a});let m=p.shardKey===a?p.cursor:void 0,k=c.trim()!==a,f;e[4]!==m?(f=m===void 0?{}:{cursor:m},e[4]=m,e[5]=f):f=e[5];let d;e[6]!==a?(d={shardKey:a},e[6]=a,e[7]=d):d=e[7];let{data:u,error:v,poll:b,refetch:S}=ve(me.getScheduleOutbox,f,d),I=k?void 0:u?.entries,w=k?void 0:u?.nextCursor,[C,J]=(0,Q.useState)(void 0),$=v??(C?.shardKey===a?C.message:void 0);ae(b,!0);let j;e[8]!==l||e[9]!==a||e[10]!==S||e[11]!==s?(j=y(async(B,E)=>{J(void 0);try{(await l.query(B,{id:E},Ae(a))).retried===!1&&J({message:s("That job is no longer in the outbox."),shardKey:a}),S()}catch(U){J({message:ie(U),shardKey:a})}},"A"),e[8]=l,e[9]=a,e[10]=S,e[11]=s,e[12]=j):j=e[12];let x=j,A;e[13]!==i||e[14]!==c?(A=(0,t.jsx)(be,{onChange:i,testId:"outbox-shard-input",value:c}),e[13]=i,e[14]=c,e[15]=A):A=e[15];let g;e[16]!==$?(g=$!==void 0&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"outbox-error",role:"alert",children:$}),e[16]=$,e[17]=g):g=e[17];let F;e[18]!==m||e[19]!==I?.length?(F=I?.length===0&&m===void 0&&(0,t.jsx)(lt,{}),e[18]=m,e[19]=I?.length,e[20]=F):F=e[20];let _;e[21]!==x||e[22]!==I?(_=I!==void 0&&I.length>0&&(0,t.jsx)(ot,{entries:I,onAct:x}),e[21]=x,e[22]=I,e[23]=_):_=e[23];let T,M;e[24]!==a?(T=y(()=>{h({cursor:void 0,shardKey:a})},"E"),M=y(B=>{h({cursor:B,shardKey:a})},"_"),e[24]=a,e[25]=T,e[26]=M):(T=e[25],M=e[26]);let R;e[27]!==m||e[28]!==w||e[29]!==T||e[30]!==M?(R=(0,t.jsx)(nt,{cursor:m,nextCursor:w,onFirst:T,onNext:M}),e[27]=m,e[28]=w,e[29]=T,e[30]=M,e[31]=R):R=e[31];let W;return e[32]!==R||e[33]!==A||e[34]!==g||e[35]!==F||e[36]!==_?(W=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-schedule-outbox",children:[A,g,F,_,R]}),e[32]=R,e[33]=A,e[34]=g,e[35]=F,e[36]=_,e[37]=W):W=e[37],W},"je"),it="scheduler.lag_ms",Ne=y(r=>{let e=r.attributes?.function;return typeof e=="string"?e:r.functionPath},"he"),ke=y(r=>{let e=(0,G.c)(8),{label:o,testId:n,value:l}=r,s;e[0]!==o?(s=(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:o}),e[0]=o,e[1]=s):s=e[1];let a;e[2]!==n||e[3]!==l?(a=(0,t.jsx)("span",{className:"text-2xl font-semibold tabular-nums","data-testid":n,children:l}),e[2]=n,e[3]=l,e[4]=a):a=e[4];let i;return e[5]!==s||e[6]!==a?(i=(0,t.jsx)(Z,{className:"flex-1 py-0",children:(0,t.jsxs)(H,{className:"flex flex-col gap-1 p-4",children:[s,a]})}),e[5]=s,e[6]=a,e[7]=i):i=e[7],i},"fe"),dt=y(r=>{let e=(0,G.c)(65),o;e[0]!==r?(o=r===void 0?{}:r,e[0]=r,e[1]=o):o=e[1];let{initialShardKey:n,loadStatus:l}=o,s=de(),a=V(),i=l===void 0,c;e[2]!==i?(c=["lunora-scheduler-status",i],e[2]=i,e[3]=c):c=e[3];let N;e[4]!==s||e[5]!==l?(N=y(async()=>{let B=await(l??(()=>s.schedulerStatus()))();return{...B,pools:B.pools.toSorted(ct)}},"v"),e[4]=s,e[5]=l,e[6]=N):N=e[6];let p=ne(c,N),{data:h,error:m}=p,{queryShardKey:k,setShardKey:f,shardKey:d}=ge(n),u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u={},e[7]=u):u=e[7];let v;e[8]!==k?(v={shardKey:k},e[8]=k,e[9]=v):v=e[9];let b=ve(me.getMetricSeries,u,v),{data:S,errorSource:I}=b,w;e[10]!==I||e[11]!==b.error?(w=xe(I)==="FUNCTION_NOT_FOUND"?null:b.error,e[10]=I,e[11]=b.error,e[12]=w):w=e[12];let C=w,J;e[13]!==p?(J=y(()=>p.poll(),"L"),e[13]=p,e[14]=J):J=e[14],ae(J,!0);let $;e[15]!==b?($=y(()=>b.poll(),"$"),e[15]=b,e[16]=$):$=e[16],ae($,!0);let j,x,A,g,F,_,T,M;if(e[17]!==m||e[18]!==S||e[19]!==C||e[20]!==f||e[21]!==d||e[22]!==h||e[23]!==a){let B=(Array.isArray(S?.series)?S.series:[]).filter(ht).toSorted(ut);j="flex flex-col gap-3",x="lunora-scheduler-pools",e[32]!==m?(A=m!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"pools-error",role:"alert",children:m}),e[32]=m,e[33]=A):A=e[33],e[34]!==h||e[35]!==a?(g=h!==void 0&&(0,t.jsxs)("div",{className:"flex gap-3","data-testid":"pools-totals",children:[(0,t.jsx)(ke,{label:a("backlog"),testId:"pools-backlog",value:h.backlog}),(0,t.jsx)(ke,{label:a("in flight"),testId:"pools-inflight",value:h.inFlight}),(0,t.jsx)(ke,{label:a("pools"),testId:"pools-count",value:h.pools.length})]}),e[34]=h,e[35]=a,e[36]=g):g=e[36],e[37]!==h?.pools.length||e[38]!==a?(F=h?.pools.length===0&&(0,t.jsx)(se,{description:a("Pools created with createWorkpool appear here once they have activity."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M4 7h16M4 12h16M4 17h16"})}),testId:"pools-empty",title:a("No workpools.")}),e[37]=h?.pools.length,e[38]=a,e[39]=F):F=e[39];let E;e[40]!==f||e[41]!==d?(E=(0,t.jsx)(be,{onChange:f,testId:"lag-shard-input",value:d}),e[40]=f,e[41]=d,e[42]=E):E=e[42];let U;e[43]!==a?(U=a("Start lag per job on this shard since it last woke; the series reset when the shard hibernates."),e[43]=a,e[44]=U):U=e[44];let P;e[45]!==U?(P=(0,t.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"lag-scope",children:U}),e[45]=U,e[46]=P):P=e[46],e[47]!==E||e[48]!==P?(_=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[E,P]}),e[47]=E,e[48]=P,e[49]=_):_=e[49],e[50]!==C?(T=C!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"lag-error",role:"alert",children:C}),e[50]=C,e[51]=T):T=e[51],M=C===null&&B.length>0&&(0,t.jsx)(Z,{className:"overflow-hidden py-0",children:(0,t.jsx)(H,{className:"px-0",children:(0,t.jsxs)(ee,{"data-testid":"lag-table",children:[(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(L,{children:a("function")}),(0,t.jsx)(L,{children:a("runs")}),(0,t.jsx)(L,{children:a("mean lag (ms)")}),(0,t.jsx)(L,{children:a("max lag (ms)")}),(0,t.jsx)(L,{children:a("last lag (ms)")})]})}),(0,t.jsx)(re,{children:B.map(mt)})]})})}),e[17]=m,e[18]=S,e[19]=C,e[20]=f,e[21]=d,e[22]=h,e[23]=a,e[24]=j,e[25]=x,e[26]=A,e[27]=g,e[28]=F,e[29]=_,e[30]=T,e[31]=M}else j=e[24],x=e[25],A=e[26],g=e[27],F=e[28],_=e[29],T=e[30],M=e[31];let R;e[52]!==h||e[53]!==a?(R=h!==void 0&&h.pools.length>0&&(0,t.jsx)(Z,{className:"overflow-hidden py-0",children:(0,t.jsx)(H,{className:"px-0",children:(0,t.jsxs)(ee,{"data-testid":"pools-table",children:[(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(L,{children:a("pool")}),(0,t.jsx)(L,{children:a("queued")}),(0,t.jsx)(L,{children:a("in flight")}),(0,t.jsx)(L,{children:a("max concurrency")})]})}),(0,t.jsx)(re,{children:h.pools.map(pt)})]})})}),e[52]=h,e[53]=a,e[54]=R):R=e[54];let W;return e[55]!==j||e[56]!==x||e[57]!==A||e[58]!==g||e[59]!==F||e[60]!==_||e[61]!==T||e[62]!==M||e[63]!==R?(W=(0,t.jsxs)("div",{className:j,"data-testid":x,children:[A,g,F,_,T,M,R]}),e[55]=j,e[56]=x,e[57]=A,e[58]=g,e[59]=F,e[60]=_,e[61]=T,e[62]=M,e[63]=R,e[64]=W):W=e[64],W},"Ze");function ct(r,e){return e.queued-r.queued}y(ct,"et");function ht(r){return r.name===it&&r.kind==="histogram"&&r.count>0}y(ht,"tt");function ut(r,e){return e.max-r.max}y(ut,"st");function mt(r){return(0,t.jsxs)(z,{"data-testid":`lag-row-${Ne(r)}`,children:[(0,t.jsx)(K,{className:"font-mono text-xs",children:Ne(r)}),(0,t.jsx)(K,{className:"tabular-nums",children:r.count}),(0,t.jsx)(K,{className:"tabular-nums",children:Math.round(r.sum/r.count)}),(0,t.jsx)(K,{className:"tabular-nums",children:r.max}),(0,t.jsx)(K,{className:"tabular-nums",children:r.last})]},Ne(r))}y(mt,"lt");function pt(r){return(0,t.jsxs)(z,{"data-testid":`pools-row-${r.name}`,children:[(0,t.jsx)(K,{className:"font-mono text-xs",children:r.name}),(0,t.jsx)(K,{className:"tabular-nums",children:r.queued}),(0,t.jsxs)(K,{className:"tabular-nums",children:[r.inFlight," / ",r.maxConcurrency]}),(0,t.jsx)(K,{className:"tabular-nums",children:r.maxConcurrency})]},r.name)}y(pt,"rt");var ft=["jobs","outbox","history","dead","pools","cron"],Vt=y(r=>{let e=(0,G.c)(55),o;e[0]!==r?(o=r===void 0?{}:r,e[0]=r,e[1]=o):o=e[1];let{initialShardKey:n,loadCronJobs:l,scheduledCancel:s,scheduledLoad:a}=o,i=V(),[c,N]=(0,Q.useState)("jobs"),p;e[2]!==i?(p=i("Cron triggers"),e[2]=i,e[3]=p):p=e[3];let h;e[4]!==i?(h=i("Dead letter"),e[4]=i,e[5]=h):h=e[5];let m;e[6]!==i?(m=i("History"),e[6]=i,e[7]=m):m=e[7];let k;e[8]!==i?(k=i("Scheduled jobs"),e[8]=i,e[9]=k):k=e[9];let f;e[10]!==i?(f=i("Outbox"),e[10]=i,e[11]=f):f=e[11];let d;e[12]!==i?(d=i("Pools"),e[12]=i,e[13]=d):d=e[13];let u;e[14]!==p||e[15]!==h||e[16]!==m||e[17]!==k||e[18]!==f||e[19]!==d?(u={cron:p,dead:h,history:m,jobs:k,outbox:f,pools:d},e[14]=p,e[15]=h,e[16]=m,e[17]=k,e[18]=f,e[19]=d,e[20]=u):u=e[20];let v=u,b;e[21]===Symbol.for("react.memo_cache_sentinel")?(b=y(T=>{N(T.currentTarget.dataset.view)},"b"),e[21]=b):b=e[21];let S=b,I;e[22]===Symbol.for("react.memo_cache_sentinel")?(I=(0,t.jsx)(Le,{}),e[22]=I):I=e[22];let w;e[23]!==i?(w=i("Schedule view"),e[23]=i,e[24]=w):w=e[24];let C;e[25]!==c||e[26]!==v?(C=ft.map(T=>(0,t.jsx)(ce,{"aria-selected":c===T,"data-testid":`schedule-view-${T}`,"data-view":T,onClick:S,role:"tab",size:"sm",type:"button",variant:c===T?"default":"outline",children:v[T]},T)),e[25]=c,e[26]=v,e[27]=C):C=e[27];let J;e[28]!==w||e[29]!==C?(J=(0,t.jsx)("div",{"aria-label":w,className:"flex gap-1.5","data-testid":"schedule-view-toggle",role:"tablist",children:C}),e[28]=w,e[29]=C,e[30]=J):J=e[30];let $;e[31]!==s||e[32]!==a||e[33]!==c?($=c==="jobs"&&(0,t.jsx)(Te,{cancelJob:s,loadJobs:a}),e[31]=s,e[32]=a,e[33]=c,e[34]=$):$=e[34];let j;e[35]!==c?(j=c==="outbox"&&(0,t.jsx)(st,{}),e[35]=c,e[36]=j):j=e[36];let x;e[37]!==c?(x=c==="history"&&(0,t.jsx)(He,{}),e[37]=c,e[38]=x):x=e[38];let A;e[39]!==c?(A=c==="dead"&&(0,t.jsx)(Xe,{}),e[39]=c,e[40]=A):A=e[40];let g;e[41]!==n||e[42]!==c?(g=c==="pools"&&(0,t.jsx)(dt,{initialShardKey:n}),e[41]=n,e[42]=c,e[43]=g):g=e[43];let F;e[44]!==l||e[45]!==c?(F=c==="cron"&&(0,t.jsx)(Ge,{loadCronJobs:l}),e[44]=l,e[45]=c,e[46]=F):F=e[46];let _;return e[47]!==J||e[48]!==$||e[49]!==j||e[50]!==x||e[51]!==A||e[52]!==g||e[53]!==F?(_=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-schedule",children:[I,J,$,j,x,A,g,F]}),e[47]=J,e[48]=$,e[49]=j,e[50]=x,e[51]=A,e[52]=g,e[53]=F,e[54]=_):_=e[54],_},"It");export{Vt as SchedulePanel};
|
|
1
|
+
import{a as $e}from"./chunk-RQFK2LYP.js";import{g as Le}from"./chunk-JQH5M3FB.js";import"./chunk-AFLNQEZ5.js";import"./chunk-TLOLN6RV.js";import"./chunk-CL3JOU6F.js";import{a as ae}from"./chunk-YOUTNV5Y.js";import"./chunk-IQ5CIBXJ.js";import"./chunk-YNCZVYCO.js";import"./chunk-OWRWDDJT.js";import"./chunk-QHVUXMRV.js";import"./chunk-2BUAJRHS.js";import"./chunk-2NUCBQFU.js";import{a as ge}from"./chunk-2KTN53PK.js";import{a as be}from"./chunk-7VZPHPTH.js";import"./chunk-EDL46BPM.js";import"./chunk-DA2CAFXI.js";import{a as ue}from"./chunk-KMA6JR2E.js";import"./chunk-4KPATTV6.js";import"./chunk-7WGZSDRS.js";import"./chunk-N7FOBAV3.js";import{i as Je}from"./chunk-VB3BKQCE.js";import"./chunk-4SY2N2RS.js";import"./chunk-4AG356VE.js";import{a as ce}from"./chunk-553O7ESU.js";import"./chunk-SCTYLLJT.js";import"./chunk-OZID3UYF.js";import{a as se}from"./chunk-K7Z7UTJJ.js";import{b as oe}from"./chunk-XMJB5JOF.js";import"./chunk-L27FKJTG.js";import{a as ee,b as te,c as re,d as z,e as L,f as K}from"./chunk-VSYZL2WH.js";import"./chunk-IAVAD545.js";import"./chunk-EOFWXI3T.js";import{a as me}from"./chunk-LYVYUTQY.js";import{b as ne,c as ve}from"./chunk-P37L55FP.js";import{a as Z,e as H}from"./chunk-D76SLSGV.js";import{l as je,n as de}from"./chunk-K24LZAP2.js";import"./chunk-ZPQBVYNN.js";import{B as V,h as fe,i as Ae,j as ie,k as xe,s as Y,w as le,x as Ie}from"./chunk-OYCDWIG2.js";import"./chunk-PDBW6GTJ.js";import{a as Ce}from"./chunk-A6TVTNKO.js";import{a as we,b as Se}from"./chunk-ADABTCDI.js";import{a as y,d as he}from"./chunk-5PEAXTYQ.js";var G=he(Ce(),1),Q=he(we(),1);var t=he(Se(),1);var Fe=he(Ce(),1),pe=he(we(),1);var D=he(Se(),1);var Me=y(r=>Number.isFinite(r)?le(r,"\u2014"):"\u2014","X"),Ke=y(r=>r.toSorted((e,o)=>e.scheduledFor-o.scheduledFor),"F"),Be=y((r,e,o)=>e!==void 0?e:o===void 0?n=>r.cancelScheduledJob(n):void 0,"Y"),Te=y(r=>{let e=(0,Fe.c)(16),{cancelJob:o,loadJobs:n}=r===void 0?{}:r,l=de(),s=V(),a=n===void 0,i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=["lunora-scheduled-jobs"],e[0]=i):i=e[0];let c=ne(i,async()=>{let x=await(n??(()=>l.listScheduledJobs()))();return Ke(x)}),[N,p]=(0,pe.useState)(void 0),[h,m]=(0,pe.useState)(void 0),k,f;e[1]!==l||e[2]!==a?(k=y(()=>{if(a)return l.subscribeScheduledJobs(x=>{m(void 0),p(Ke(x))})},"v"),f=[a,l],e[1]=l,e[2]=a,e[3]=k,e[4]=f):(k=e[3],f=e[4]),(0,pe.useEffect)(k,f);let d;e[5]!==c?(d=y(()=>c.poll(),"y"),e[5]=c,e[6]=d):d=e[6],ae(d,!a);let u=Be(l,o,n),v=N??c.data,b=h??c.error,S=y(async x=>{if(u!==void 0){m(void 0);try{await u(x),a||c.refetch()}catch(A){m(ie(A))}}},"E"),I="flex flex-col gap-3",w="lunora-scheduled-jobs",C;e[7]!==b?(C=b!==null&&(0,D.jsx)("p",{className:"text-sm text-destructive","data-testid":"sj-error",role:"alert",children:b}),e[7]=b,e[8]=C):C=e[8];let J;e[9]!==v?.length||e[10]!==s?(J=v?.length===0&&(0,D.jsx)(se,{description:s("Jobs queued with runAfter / runAt will appear here."),icon:(0,D.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,D.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,D.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"sj-empty",title:s("No scheduled jobs.")}),e[9]=v?.length,e[10]=s,e[11]=J):J=e[11];let $=v!==void 0&&v.length>0&&(0,D.jsx)(Z,{className:"overflow-hidden py-0",children:(0,D.jsx)(H,{className:"px-0",children:(0,D.jsxs)(ee,{"data-testid":"sj-table",children:[(0,D.jsx)(te,{children:(0,D.jsxs)(z,{children:[(0,D.jsx)(L,{children:s("function")}),(0,D.jsx)(L,{children:s("scheduled for")}),(0,D.jsx)(L,{children:s("pool")}),(0,D.jsx)(L,{children:s("attempts")}),(0,D.jsx)(L,{children:s("shard")}),(0,D.jsx)(L,{children:s("id")}),u!==void 0&&(0,D.jsx)(L,{"aria-label":s("Actions")})]})}),(0,D.jsx)(re,{children:v.map(x=>(0,D.jsxs)(z,{"data-testid":`sj-row-${x.id}`,children:[(0,D.jsx)(K,{className:"font-mono text-xs",children:x.workflow??x.functionPath}),(0,D.jsx)(K,{className:"text-muted-foreground tabular-nums",children:Me(x.scheduledFor)}),(0,D.jsx)(K,{className:"font-mono text-xs",children:x.pool??""}),(0,D.jsx)(K,{className:"tabular-nums",children:x.attempts??0}),(0,D.jsx)(K,{children:x.shardKey??""}),(0,D.jsx)(K,{className:"font-mono text-xs",children:x.id}),u!==void 0&&(0,D.jsx)(K,{className:"text-right",children:(0,D.jsx)(ue,{confirmLabel:s("Cancel job?"),onConfirm:y(()=>{Y(S(x.id))},"onConfirm"),testId:`sj-cancel-${x.id}`,children:s("Cancel")})})]},x.id))})]})})}),j;return e[12]!==$||e[13]!==C||e[14]!==J?(j=(0,D.jsxs)("div",{className:I,"data-testid":w,children:[C,J,$]}),e[12]=$,e[13]=C,e[14]=J,e[15]=j):j=e[15],j},"he");var _e={failed:"destructive",skipped:"warning",succeeded:"success"},Re=25,Pe=y(r=>r<1e3?`${String(r)} ms`:`${(r/1e3).toFixed(1)} s`,"Ee"),Oe=y(r=>{let e=(0,G.c)(39),{inFlight:o,last:n}=r,l=V();if(o!==void 0){let u;e[0]!==l?(u=l("running"),e[0]=l,e[1]=u):u=e[1];let v;e[2]!==u?(v=(0,t.jsx)(oe,{variant:"info",children:u}),e[2]=u,e[3]=v):v=e[3];let b;e[4]!==o.startedAt?(b=le(o.startedAt,"\u2014"),e[4]=o.startedAt,e[5]=b):b=e[5];let S;e[6]!==b?(S=(0,t.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums",children:b}),e[6]=b,e[7]=S):S=e[7];let I;e[8]!==o.skipped||e[9]!==l?(I=o.skipped>0&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:l("{count} ticks skipped",{count:o.skipped})}),e[8]=o.skipped,e[9]=l,e[10]=I):I=e[10];let w;return e[11]!==v||e[12]!==S||e[13]!==I?(w=(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[v,S,I]}),e[11]=v,e[12]=S,e[13]=I,e[14]=w):w=e[14],w}if(n===void 0){let u;e[15]!==l?(u=l("never"),e[15]=l,e[16]=u):u=e[16];let v;return e[17]!==u?(v=(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:u}),e[17]=u,e[18]=v):v=e[18],v}let s;e[19]!==l?(s=l("failed"),e[19]=l,e[20]=s):s=e[20];let a;e[21]!==l?(a=l("skipped"),e[21]=l,e[22]=a):a=e[22];let i;e[23]!==l?(i=l("succeeded"),e[23]=l,e[24]=i):i=e[24];let c;e[25]!==s||e[26]!==a||e[27]!==i?(c={failed:s,skipped:a,succeeded:i},e[25]=s,e[26]=a,e[27]=i,e[28]=c):c=e[28];let N=c,p=_e[n.status],h=N[n.status],m;e[29]!==p||e[30]!==h?(m=(0,t.jsx)(oe,{variant:p,children:h}),e[29]=p,e[30]=h,e[31]=m):m=e[31];let k;e[32]!==n.startedAt?(k=le(n.startedAt,"\u2014"),e[32]=n.startedAt,e[33]=k):k=e[33];let f;e[34]!==k?(f=(0,t.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums",children:k}),e[34]=k,e[35]=f):f=e[35];let d;return e[36]!==m||e[37]!==f?(d=(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[m,f]}),e[36]=m,e[37]=f,e[38]=d):d=e[38],d},"Re"),Ee=y(r=>{let e=(0,G.c)(80),{runs:o}=r,n=V();if(o.length===0)return;let l,s,a,i,c,N,p,h,m,k,f;if(e[0]!==o||e[1]!==n){let I=o.toSorted(Ue).slice(0,Re),w;e[13]!==n?(w=n("failed"),e[13]=n,e[14]=w):w=e[14];let C;e[15]!==n?(C=n("skipped"),e[15]=n,e[16]=C):C=e[16];let J;e[17]!==n?(J=n("succeeded"),e[17]=n,e[18]=J):J=e[18];let $;e[19]!==J||e[20]!==w||e[21]!==C?($={failed:w,skipped:C,succeeded:J},e[19]=J,e[20]=w,e[21]=C,e[22]=$):$=e[22];let j=$;m="flex flex-col gap-2",k="cron-run-history";let x;e[23]!==n?(x=n("Recent runs"),e[23]=n,e[24]=x):x=e[24],e[25]!==x?(f=(0,t.jsx)("h3",{className:"text-sm font-medium",children:x}),e[25]=x,e[26]=f):f=e[26],i=Z,h="overflow-hidden py-0",a=H,p="px-0",s=ee;let A;e[27]!==n?(A=n("name"),e[27]=n,e[28]=A):A=e[28];let g;e[29]!==A?(g=(0,t.jsx)(L,{children:A}),e[29]=A,e[30]=g):g=e[30];let F;e[31]!==n?(F=n("status"),e[31]=n,e[32]=F):F=e[32];let _;e[33]!==F?(_=(0,t.jsx)(L,{children:F}),e[33]=F,e[34]=_):_=e[34];let T;e[35]!==n?(T=n("started"),e[35]=n,e[36]=T):T=e[36];let M;e[37]!==T?(M=(0,t.jsx)(L,{children:T}),e[37]=T,e[38]=M):M=e[38];let R;e[39]!==n?(R=n("duration"),e[39]=n,e[40]=R):R=e[40];let W;e[41]!==R?(W=(0,t.jsx)(L,{children:R}),e[41]=R,e[42]=W):W=e[42];let B;e[43]!==n?(B=n("skipped"),e[43]=n,e[44]=B):B=e[44];let E;e[45]!==B?(E=(0,t.jsx)(L,{children:B}),e[45]=B,e[46]=E):E=e[46];let U;e[47]!==n?(U=n("error"),e[47]=n,e[48]=U):U=e[48];let P;e[49]!==U?(P=(0,t.jsx)(L,{children:U}),e[49]=U,e[50]=P):P=e[50],e[51]!==g||e[52]!==_||e[53]!==M||e[54]!==W||e[55]!==E||e[56]!==P?(N=(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[g,_,M,W,E,P]})}),e[51]=g,e[52]=_,e[53]=M,e[54]=W,e[55]=E,e[56]=P,e[57]=N):N=e[57],l=re;let X;e[58]!==j?(X=y(q=>(0,t.jsxs)(z,{"data-testid":`cron-run-row-${q.runId}`,children:[(0,t.jsx)(K,{children:q.name}),(0,t.jsx)(K,{children:(0,t.jsx)(oe,{variant:_e[q.status],children:j[q.status]})}),(0,t.jsx)(K,{className:"text-muted-foreground tabular-nums",children:le(q.startedAt,"\u2014")}),(0,t.jsx)(K,{className:"tabular-nums",children:q.status==="skipped"?"":Pe(q.durationMs)}),(0,t.jsx)(K,{className:"tabular-nums",children:q.skipped>0?q.skipped:""}),(0,t.jsx)(K,{className:"text-xs text-destructive",children:q.error??""})]},q.runId),"W"),e[58]=j,e[59]=X):X=e[59],c=I.map(X),e[0]=o,e[1]=n,e[2]=l,e[3]=s,e[4]=a,e[5]=i,e[6]=c,e[7]=N,e[8]=p,e[9]=h,e[10]=m,e[11]=k,e[12]=f}else l=e[2],s=e[3],a=e[4],i=e[5],c=e[6],N=e[7],p=e[8],h=e[9],m=e[10],k=e[11],f=e[12];let d;e[60]!==l||e[61]!==c?(d=(0,t.jsx)(l,{children:c}),e[60]=l,e[61]=c,e[62]=d):d=e[62];let u;e[63]!==s||e[64]!==N||e[65]!==d?(u=(0,t.jsxs)(s,{children:[N,d]}),e[63]=s,e[64]=N,e[65]=d,e[66]=u):u=e[66];let v;e[67]!==a||e[68]!==p||e[69]!==u?(v=(0,t.jsx)(a,{className:p,children:u}),e[67]=a,e[68]=p,e[69]=u,e[70]=v):v=e[70];let b;e[71]!==i||e[72]!==v||e[73]!==h?(b=(0,t.jsx)(i,{className:h,children:v}),e[71]=i,e[72]=v,e[73]=h,e[74]=b):b=e[74];let S;return e[75]!==b||e[76]!==m||e[77]!==k||e[78]!==f?(S=(0,t.jsxs)("div",{className:m,"data-testid":k,children:[f,b]}),e[75]=b,e[76]=m,e[77]=k,e[78]=f,e[79]=S):S=e[79],S},"Le");function Ue(r,e){return e.startedAt-r.startedAt}y(Ue,"Oe");var We=y(()=>{let r=(0,G.c)(50),e=V(),o=$e(""),[n,l]=(0,Q.useState)(""),[s,a]=(0,Q.useState)(void 0),[i,c]=(0,Q.useState)(!1);if(o.unavailable)return null;let N;r[0]!==o?(N=o.pending("cron"),r[0]=o,r[1]=N):N=r[1];let p=N,h;r[2]!==o?(h=o.reason("cron"),r[2]=o,r[3]=h):h=r[3];let m=h,k;r[4]!==n||r[5]!==o?(k=y(()=>{let T=n.trim();T!==""&&Y((async()=>{let M=await o.suggestCron(T);c(!1),a(M)})())},"y"),r[4]=n,r[5]=o,r[6]=k):k=r[6];let f=k,d;r[7]!==s?(d=y(()=>{let T="navigator"in globalThis?globalThis.navigator.clipboard:void 0;T===void 0||s===void 0||Y((async()=>{try{await T.writeText(s),c(!0)}catch{c(!1)}})())},"d"),r[7]=s,r[8]=d):d=r[8];let u=d,v;r[9]!==e?(v=e("Describe a schedule"),r[9]=e,r[10]=v):v=r[10];let b;r[11]===Symbol.for("react.memo_cache_sentinel")?(b=y(T=>{l(T.target.value)},"b"),r[11]=b):b=r[11];let S;r[12]!==f?(S=y(T=>{T.key==="Enter"&&(T.preventDefault(),f())},"w"),r[12]=f,r[13]=S):S=r[13];let I;r[14]!==e?(I=e("Describe a schedule"),r[14]=e,r[15]=I):I=r[15];let w;r[16]!==p||r[17]!==n||r[18]!==v||r[19]!==S||r[20]!==I?(w=(0,t.jsx)(Je,{"aria-label":v,className:"h-7 flex-1 text-xs","data-testid":"cron-assistant-prompt",disabled:p,onChange:b,onKeyDown:S,placeholder:I,value:n}),r[16]=p,r[17]=n,r[18]=v,r[19]=S,r[20]=I,r[21]=w):w=r[21];let C=p&&"opacity-60",J;r[22]!==C?(J=Ie("rounded-md border border-border px-2 py-1 text-xs outline-none transition-colors hover:bg-accent focus-visible:bg-accent",C),r[22]=C,r[23]=J):J=r[23];let $;r[24]!==p||r[25]!==n?($=p||n.trim()==="",r[24]=p,r[25]=n,r[26]=$):$=r[26];let j;r[27]!==p||r[28]!==e?(j=e(p?"Thinking\u2026":"Suggest schedule"),r[27]=p,r[28]=e,r[29]=j):j=r[29];let x;r[30]!==f||r[31]!==J||r[32]!==$||r[33]!==j?(x=(0,t.jsx)("button",{className:J,"data-testid":"cron-assistant-generate",disabled:$,onClick:f,type:"button",children:j}),r[30]=f,r[31]=J,r[32]=$,r[33]=j,r[34]=x):x=r[34];let A;r[35]!==x||r[36]!==w?(A=(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[w,x]}),r[35]=x,r[36]=w,r[37]=A):A=r[37];let g;r[38]!==i||r[39]!==u||r[40]!==s||r[41]!==e?(g=s!==void 0&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("code",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-xs tabular-nums","data-testid":"cron-assistant-result",children:s}),(0,t.jsx)("button",{className:"rounded-md border border-border px-2 py-0.5 text-[11px] outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"cron-assistant-copy",onClick:u,type:"button",children:e(i?"Copied":"Copy")}),(0,t.jsx)("span",{className:"text-[11px] text-muted-foreground",children:e("Add it to lunora/crons.ts \u2014 triggers are compiled into the worker.")})]}),r[38]=i,r[39]=u,r[40]=s,r[41]=e,r[42]=g):g=r[42];let F;r[43]!==m||r[44]!==e?(F=m!==void 0&&(0,t.jsx)("p",{className:"text-[11px] text-muted-foreground","data-testid":"cron-assistant-reason",role:"status",children:e(m==="ai-error"?"The model could not be reached.":"The model did not return a schedule Cron Triggers accept.")}),r[43]=m,r[44]=e,r[45]=F):F=r[45];let _;return r[46]!==A||r[47]!==g||r[48]!==F?(_=(0,t.jsxs)("div",{className:"flex flex-col gap-1.5","data-testid":"cron-assistant",children:[A,g,F]}),r[46]=A,r[47]=g,r[48]=F,r[49]=_):_=r[49],_},"Ke"),ze={kind:"idle"},qe="SCHEDULER_NOT_CONFIGURED",ye={inFlight:[],runs:[]},Ve=y((r,e,o)=>o!==void 0?o:e===void 0?n=>r.runCronJob(n):void 0,"Fe"),Ge=y(({loadCronJobs:r,loadCronRuns:e,runCronJob:o}={})=>{let n=de(),l=V(),[s,a]=(0,Q.useState)({}),i=ne(["lunora-cron-jobs",r?"custom":"default"],()=>(r??(()=>n.getCronJobs()))()),{data:c,error:N}=i,p=e??(r===void 0?()=>n.listCronRuns():void 0),h=ne(["lunora-cron-runs",e?"custom":"default"],async()=>p===void 0?ye:p().catch(d=>{if(xe(d)===qe)return ye;throw d})),m=h.data??ye;ae(()=>h.poll(),p!==void 0);let k=Ve(n,r,o),f=y(async d=>{if(k!==void 0){a(u=>({...u,[d]:{kind:"running"}}));try{await k(d),a(u=>({...u,[d]:{kind:"ok"}})),i.refetch(),h.refetch()}catch(u){a(v=>({...v,[d]:{kind:"error",message:ie(u)}}))}}},"p");return(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-cron-triggers",children:[(0,t.jsx)(We,{}),N!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"cron-error",role:"alert",children:N}),h.error!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"cron-runs-error",role:"alert",children:h.error}),c?.length===0&&(0,t.jsx)(se,{description:l("Triggers declared with the cronJobs() builder appear here."),icon:(0,t.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,t.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"cron-empty",title:l("No cron triggers.")}),c!==void 0&&c.length>0&&(0,t.jsx)(Z,{className:"overflow-hidden py-0",children:(0,t.jsx)(H,{className:"px-0",children:(0,t.jsxs)(ee,{"data-testid":"cron-table",children:[(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(L,{children:l("name")}),(0,t.jsx)(L,{children:l("schedule")}),(0,t.jsx)(L,{children:l("target")}),(0,t.jsx)(L,{children:l("shard")}),(0,t.jsx)(L,{children:l("last run")}),k!==void 0&&(0,t.jsx)(L,{"aria-label":l("Actions")})]})}),(0,t.jsx)(re,{children:c.map(d=>{let u=s[d.name]??ze;return(0,t.jsxs)(z,{"data-testid":`cron-row-${d.name}`,children:[(0,t.jsx)(K,{children:d.name}),(0,t.jsx)(K,{className:"font-mono text-xs tabular-nums",children:d.cron}),(0,t.jsx)(K,{children:(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[d.workflow===void 0?(0,t.jsx)(oe,{variant:"outline",children:l("function")}):(0,t.jsx)(oe,{variant:"secondary",children:l("workflow")}),(0,t.jsx)("span",{className:"font-mono text-xs",children:d.workflow??d.functionPath})]})}),(0,t.jsx)(K,{children:d.shardKey??""}),(0,t.jsx)(K,{"data-testid":`cron-last-run-${d.name}`,children:(0,t.jsx)(Oe,{inFlight:m.inFlight.find(v=>v.name===d.name),last:m.runs.find(v=>v.name===d.name)})}),k!==void 0&&(0,t.jsx)(K,{className:"text-right",children:(0,t.jsxs)("span",{className:"flex items-center justify-end gap-2",children:[u.kind==="ok"&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":`cron-ran-${d.name}`,children:l("ran")}),u.kind==="error"&&(0,t.jsx)("span",{className:"text-xs text-destructive","data-testid":`cron-run-error-${d.name}`,role:"alert",children:u.message}),(0,t.jsx)(ue,{confirmLabel:l("Run now?"),disabled:u.kind==="running",onConfirm:y(()=>{Y(f(d.name))},"onConfirm"),testId:`cron-run-${d.name}`,children:u.kind==="running"?l("Running\u2026"):l("Run now")})]})})]},`${d.cron}:${d.name}`)})})]})})}),(0,t.jsx)(Ee,{runs:m.runs})]})},"Je"),Qe=y(r=>Number.isFinite(r)?le(r,"\u2014"):"\u2014","Me"),Xe=y(r=>{let e=(0,G.c)(34),o;e[0]!==r?(o=r===void 0?{}:r,e[0]=r,e[1]=o):o=e[1];let{loadJobs:n,removeJob:l,retryJob:s}=o,a=de(),i=V(),c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=["lunora-dead-jobs"],e[2]=c):c=e[2];let N;e[3]!==a||e[4]!==n?(N=y(async()=>(await(n??(()=>a.listDeadJobs()))()).toSorted(Ye),"v"),e[3]=a,e[4]=n,e[5]=N):N=e[5];let p=ne(c,N),h=p.data,[m,k]=(0,Q.useState)(void 0),f=p.error??m,d=n===void 0,u;e[6]!==a||e[7]!==d||e[8]!==s?(u=s??(d?g=>a.retryDeadJob(g):void 0),e[6]=a,e[7]=d,e[8]=s,e[9]=u):u=e[9];let v=u,b;e[10]!==a||e[11]!==d||e[12]!==l?(b=l??(d?g=>a.removeDeadJob(g):void 0),e[10]=a,e[11]=d,e[12]=l,e[13]=b):b=e[13];let S=b,I;e[14]!==p?(I=y(()=>p.poll(),"S"),e[14]=p,e[15]=I):I=e[15],ae(I,!0);let w;e[16]!==p?(w=y(async g=>{k(void 0);try{await g,p.refetch()}catch(F){k(ie(F))}},"N"),e[16]=p,e[17]=w):w=e[17];let C=w,J=v!==void 0||S!==void 0,$;e[18]!==f?($=f!==void 0&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"dlq-error",role:"alert",children:f}),e[18]=f,e[19]=$):$=e[19];let j;e[20]!==h?.length||e[21]!==i?(j=h?.length===0&&(0,t.jsx)(se,{description:i("Jobs that exhaust their retry budget are parked here instead of being dropped."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M3 6h18M8 6V4h8v2M6 6l1 14h10l1-14"})}),testId:"dlq-empty",title:i("No dead-letter jobs.")}),e[20]=h?.length,e[21]=i,e[22]=j):j=e[22];let x;e[23]!==C||e[24]!==J||e[25]!==h||e[26]!==S||e[27]!==v||e[28]!==i?(x=h!==void 0&&h.length>0&&(0,t.jsx)(Z,{className:"overflow-hidden py-0",children:(0,t.jsx)(H,{className:"px-0",children:(0,t.jsxs)(ee,{"data-testid":"dlq-table",children:[(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(L,{children:i("function")}),(0,t.jsx)(L,{children:i("attempts")}),(0,t.jsx)(L,{children:i("last tried")}),(0,t.jsx)(L,{children:i("pool")}),(0,t.jsx)(L,{children:i("shard")}),(0,t.jsx)(L,{children:i("id")}),J&&(0,t.jsx)(L,{"aria-label":i("Actions")})]})}),(0,t.jsx)(re,{children:h.map(g=>(0,t.jsxs)(z,{"data-testid":`dlq-row-${g.id}`,children:[(0,t.jsx)(K,{className:"font-mono text-xs",children:g.workflow??g.functionPath}),(0,t.jsx)(K,{className:"tabular-nums",children:g.attempts??0}),(0,t.jsx)(K,{className:"text-muted-foreground tabular-nums",children:Qe(g.scheduledFor)}),(0,t.jsx)(K,{className:"font-mono text-xs",children:g.pool??""}),(0,t.jsx)(K,{children:g.shardKey??""}),(0,t.jsx)(K,{className:"font-mono text-xs",children:g.id}),J&&(0,t.jsx)(K,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1.5",children:[v!==void 0&&(0,t.jsx)(ce,{"data-testid":`dlq-retry-${g.id}`,onClick:y(()=>{Y(C(v(g.id)))},"onClick"),size:"sm",type:"button",variant:"outline",children:i("Retry")}),S!==void 0&&(0,t.jsx)(ue,{confirmLabel:i("Drop job?"),onConfirm:y(()=>{Y(C(S(g.id)))},"onConfirm"),testId:`dlq-remove-${g.id}`,children:i("Drop")})]})})]},g.id))})]})})}),e[23]=C,e[24]=J,e[25]=h,e[26]=S,e[27]=v,e[28]=i,e[29]=x):x=e[29];let A;return e[30]!==x||e[31]!==$||e[32]!==j?(A=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-dead-letter",children:[$,j,x]}),e[30]=x,e[31]=$,e[32]=j,e[33]=A):A=e[33],A},"Pe");function Ye(r,e){return(e.attempts??0)-(r.attempts??0)}y(Ye,"qe");var Ze={canceled:"secondary",failed:"destructive",pending:"outline",running:"info",succeeded:"success"},He=y(r=>{let e=(0,G.c)(47),o;e[0]!==r?(o=r===void 0?{}:r,e[0]=r,e[1]=o):o=e[1];let{loadJobs:n}=o,l=de(),s=V(),a;e[2]!==l||e[3]!==n?(a=n??(async O=>l.listScheduledHistory(O===void 0?{}:{cursor:O})),e[2]=l,e[3]=n,e[4]=a):a=e[4];let i=a,c=n?"custom":"default",N;e[5]!==c?(N=["lunora-job-history",c],e[5]=c,e[6]=N):N=e[6];let p;e[7]!==i?(p=y(async()=>i(),"f"),e[7]=i,e[8]=p):p=e[8];let h=ne(N,p),[m,k]=(0,Q.useState)(void 0),[f,d]=(0,Q.useState)(!1),[u,v]=(0,Q.useState)(void 0),b=h.data?.records,S;e[9]!==b?(S=new Set(b?.map(et)),e[9]=b,e[10]=S):S=e[10];let I=S,w=b===void 0?void 0:[...b,...(m?.records??[]).filter(O=>!I.has(O.id))],C=m===void 0?h.data?.cursor:m.cursor,J;e[11]!==i||e[12]!==C?(J=y(async()=>{d(!0),v(void 0);try{let O=await i(C);k(De=>({cursor:O.cursor,records:[...De?.records??[],...O.records]})),d(!1)}catch(O){v(ie(O)),d(!1)}},"L"),e[11]=i,e[12]=C,e[13]=J):J=e[13];let $=J,j;e[14]!==s?(j=s("canceled"),e[14]=s,e[15]=j):j=e[15];let x;e[16]!==s?(x=s("failed"),e[16]=s,e[17]=x):x=e[17];let A;e[18]!==s?(A=s("pending"),e[18]=s,e[19]=A):A=e[19];let g;e[20]!==s?(g=s("running"),e[20]=s,e[21]=g):g=e[21];let F;e[22]!==s?(F=s("succeeded"),e[22]=s,e[23]=F):F=e[23];let _;e[24]!==A||e[25]!==g||e[26]!==F||e[27]!==j||e[28]!==x?(_={canceled:j,failed:x,pending:A,running:g,succeeded:F},e[24]=A,e[25]=g,e[26]=F,e[27]=j,e[28]=x,e[29]=_):_=e[29];let T=_,M;e[30]!==h?(M=y(()=>h.poll(),"_"),e[30]=h,e[31]=M):M=e[31],ae(M,m===void 0);let R="flex flex-col gap-3",W="lunora-job-history",B;e[32]!==h.error?(B=h.error!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"job-history-error",role:"alert",children:h.error}),e[32]=h.error,e[33]=B):B=e[33];let E=w?.length===0&&(0,t.jsx)(se,{description:s("Jobs that succeed, fail or are cancelled stay here for seven days."),testId:"job-history-empty",title:s("No finished jobs.")}),U=w!==void 0&&w.length>0&&(0,t.jsx)(Z,{className:"overflow-hidden py-0",children:(0,t.jsx)(H,{className:"px-0",children:(0,t.jsxs)(ee,{"data-testid":"job-history-table",children:[(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(L,{children:s("function")}),(0,t.jsx)(L,{children:s("state")}),(0,t.jsx)(L,{children:s("finished")}),(0,t.jsx)(L,{children:s("error")}),(0,t.jsx)(L,{children:s("id")})]})}),(0,t.jsx)(re,{children:w.map(O=>(0,t.jsxs)(z,{"data-testid":`job-history-row-${O.id}`,children:[(0,t.jsx)(K,{className:"font-mono text-xs",children:O.workflow??O.functionPath}),(0,t.jsx)(K,{children:(0,t.jsx)(oe,{"data-testid":`job-history-state-${O.id}`,variant:Ze[O.state],children:T[O.state]})}),(0,t.jsx)(K,{className:"text-muted-foreground tabular-nums",children:le(O.completedAt,"\u2014")}),(0,t.jsx)(K,{className:"text-xs text-destructive",children:O.error??""}),(0,t.jsx)(K,{className:"font-mono text-xs",children:O.id})]},O.id))})]})})}),P;e[34]!==u?(P=u!==void 0&&(0,t.jsx)("p",{className:"text-sm text-destructive",role:"alert",children:u}),e[34]=u,e[35]=P):P=e[35];let X;e[36]!==f||e[37]!==C||e[38]!==$||e[39]!==s?(X=C!==void 0&&(0,t.jsx)("div",{children:(0,t.jsx)(ce,{"data-testid":"job-history-load-more",disabled:f,onClick:y(()=>{Y($())},"onClick"),variant:"outline",children:s(f?"Loading\u2026":"Load more")})}),e[36]=f,e[37]=C,e[38]=$,e[39]=s,e[40]=X):X=e[40];let q;return e[41]!==B||e[42]!==E||e[43]!==U||e[44]!==P||e[45]!==X?(q=(0,t.jsxs)("div",{className:R,"data-testid":W,children:[B,E,U,P,X]}),e[41]=B,e[42]=E,e[43]=U,e[44]=P,e[45]=X,e[46]=q):q=e[46],q},"Be");function et(r){return r.id}y(et,"He");var tt=fe(me.dropOutboxEntry),rt=fe(me.retryOutboxEntry),lt=y(()=>{let r=(0,G.c)(8),e=V(),o;r[0]!==e?(o=e("Jobs whose mutation committed but that the scheduler has not accepted yet wait here."),r[0]=e,r[1]=o):o=r[1];let n;r[2]===Symbol.for("react.memo_cache_sentinel")?(n=(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M4 4h16v12H4zM4 16l4 4h8l4-4"})}),r[2]=n):n=r[2];let l;r[3]!==e?(l=e("Nothing is waiting for the scheduler."),r[3]=e,r[4]=l):l=r[4];let s;return r[5]!==o||r[6]!==l?(s=(0,t.jsx)(se,{description:o,icon:n,testId:"outbox-empty",title:l}),r[5]=o,r[6]=l,r[7]=s):s=r[7],s},"ze"),at=y(r=>{let e=(0,G.c)(58),{entry:o,onAct:n}=r,l=V(),s=`outbox-row-${o.id}`,a;e[0]!==o.target||e[1]!==l?(a=o.target??l("unreadable"),e[0]=o.target,e[1]=l,e[2]=a):a=e[2];let i;e[3]!==a?(i=(0,t.jsx)(K,{className:"font-mono text-xs",children:a}),e[3]=a,e[4]=i):i=e[4];let c=o.parked?"destructive":"secondary",N;e[5]!==o.parked||e[6]!==l?(N=o.parked?l("parked"):l("retrying"),e[5]=o.parked,e[6]=l,e[7]=N):N=e[7];let p;e[8]!==c||e[9]!==N?(p=(0,t.jsx)(oe,{variant:c,children:N}),e[8]=c,e[9]=N,e[10]=p):p=e[10];let h;e[11]!==o.forever||e[12]!==l?(h=o.forever&&(0,t.jsx)(oe,{variant:"outline",children:l("forever")}),e[11]=o.forever,e[12]=l,e[13]=h):h=e[13];let m;e[14]!==p||e[15]!==h?(m=(0,t.jsx)(K,{children:(0,t.jsxs)("div",{className:"flex gap-1",children:[p,h]})}),e[14]=p,e[15]=h,e[16]=m):m=e[16];let k;e[17]!==o.attempts?(k=(0,t.jsx)(K,{className:"tabular-nums",children:o.attempts}),e[17]=o.attempts,e[18]=k):k=e[18];let f;e[19]!==o.nextAttemptAt||e[20]!==o.parked?(f=o.parked?"\u2014":le(o.nextAttemptAt,"\u2014"),e[19]=o.nextAttemptAt,e[20]=o.parked,e[21]=f):f=e[21];let d;e[22]!==f?(d=(0,t.jsx)(K,{className:"text-muted-foreground tabular-nums",children:f}),e[22]=f,e[23]=d):d=e[23];let u;e[24]!==o.id?(u=(0,t.jsx)(K,{className:"font-mono text-xs",children:o.id}),e[24]=o.id,e[25]=u):u=e[25];let v=`outbox-retry-${o.id}`,b;e[26]!==o.id||e[27]!==n?(b=y(()=>{Y(n(rt,o.id))},"b"),e[26]=o.id,e[27]=n,e[28]=b):b=e[28];let S;e[29]!==l?(S=l("Retry now"),e[29]=l,e[30]=S):S=e[30];let I;e[31]!==v||e[32]!==b||e[33]!==S?(I=(0,t.jsx)(ce,{"data-testid":v,onClick:b,size:"sm",type:"button",variant:"outline",children:S}),e[31]=v,e[32]=b,e[33]=S,e[34]=I):I=e[34];let w;e[35]!==l?(w=l("Drop job?"),e[35]=l,e[36]=w):w=e[36];let C;e[37]!==o.id||e[38]!==n?(C=y(()=>{Y(n(tt,o.id))},"T"),e[37]=o.id,e[38]=n,e[39]=C):C=e[39];let J=`outbox-drop-${o.id}`,$;e[40]!==l?($=l("Drop"),e[40]=l,e[41]=$):$=e[41];let j;e[42]!==w||e[43]!==C||e[44]!==J||e[45]!==$?(j=(0,t.jsx)(ue,{confirmLabel:w,onConfirm:C,testId:J,children:$}),e[42]=w,e[43]=C,e[44]=J,e[45]=$,e[46]=j):j=e[46];let x;e[47]!==I||e[48]!==j?(x=(0,t.jsx)(K,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1.5",children:[I,j]})}),e[47]=I,e[48]=j,e[49]=x):x=e[49];let A;return e[50]!==s||e[51]!==d||e[52]!==u||e[53]!==x||e[54]!==i||e[55]!==m||e[56]!==k?(A=(0,t.jsxs)(z,{"data-testid":s,children:[i,m,k,d,u,x]}),e[50]=s,e[51]=d,e[52]=u,e[53]=x,e[54]=i,e[55]=m,e[56]=k,e[57]=A):A=e[57],A},"We"),ot=y(r=>{let e=(0,G.c)(41),{entries:o,onAct:n}=r,l=V(),s;e[0]!==l?(s=l("function"),e[0]=l,e[1]=s):s=e[1];let a;e[2]!==s?(a=(0,t.jsx)(L,{children:s}),e[2]=s,e[3]=a):a=e[3];let i;e[4]!==l?(i=l("state"),e[4]=l,e[5]=i):i=e[5];let c;e[6]!==i?(c=(0,t.jsx)(L,{children:i}),e[6]=i,e[7]=c):c=e[7];let N;e[8]!==l?(N=l("attempts"),e[8]=l,e[9]=N):N=e[9];let p;e[10]!==N?(p=(0,t.jsx)(L,{children:N}),e[10]=N,e[11]=p):p=e[11];let h;e[12]!==l?(h=l("next attempt"),e[12]=l,e[13]=h):h=e[13];let m;e[14]!==h?(m=(0,t.jsx)(L,{children:h}),e[14]=h,e[15]=m):m=e[15];let k;e[16]!==l?(k=l("id"),e[16]=l,e[17]=k):k=e[17];let f;e[18]!==k?(f=(0,t.jsx)(L,{children:k}),e[18]=k,e[19]=f):f=e[19];let d;e[20]!==l?(d=l("Actions"),e[20]=l,e[21]=d):d=e[21];let u;e[22]!==d?(u=(0,t.jsx)(L,{"aria-label":d}),e[22]=d,e[23]=u):u=e[23];let v;e[24]!==f||e[25]!==u||e[26]!==a||e[27]!==c||e[28]!==p||e[29]!==m?(v=(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[a,c,p,m,f,u]})}),e[24]=f,e[25]=u,e[26]=a,e[27]=c,e[28]=p,e[29]=m,e[30]=v):v=e[30];let b;if(e[31]!==o||e[32]!==n){let w;e[34]!==n?(w=y(C=>(0,t.jsx)(at,{entry:C,onAct:n},C.id),"N"),e[34]=n,e[35]=w):w=e[35],b=o.map(w),e[31]=o,e[32]=n,e[33]=b}else b=e[33];let S;e[36]!==b?(S=(0,t.jsx)(re,{children:b}),e[36]=b,e[37]=S):S=e[37];let I;return e[38]!==v||e[39]!==S?(I=(0,t.jsx)(Z,{className:"overflow-hidden py-0",children:(0,t.jsx)(H,{className:"px-0",children:(0,t.jsxs)(ee,{"data-testid":"outbox-table",children:[v,S]})})}),e[38]=v,e[39]=S,e[40]=I):I=e[40],I},"Ge"),nt=y(r=>{let e=(0,G.c)(11),{cursor:o,nextCursor:n,onFirst:l,onNext:s}=r,a=V();if(o===void 0&&n===void 0)return;let i;e[0]!==o||e[1]!==l||e[2]!==a?(i=o!==void 0&&(0,t.jsx)(ce,{"data-testid":"outbox-first-page",onClick:l,size:"sm",type:"button",variant:"outline",children:a("First page")}),e[0]=o,e[1]=l,e[2]=a,e[3]=i):i=e[3];let c;e[4]!==n||e[5]!==s||e[6]!==a?(c=n!==void 0&&(0,t.jsx)(ce,{"data-testid":"outbox-next-page",onClick:y(()=>{s(n)},"onClick"),size:"sm",type:"button",variant:"outline",children:a("Next page")}),e[4]=n,e[5]=s,e[6]=a,e[7]=c):c=e[7];let N;return e[8]!==i||e[9]!==c?(N=(0,t.jsxs)("div",{className:"flex justify-end gap-1.5",children:[i,c]}),e[8]=i,e[9]=c,e[10]=N):N=e[10],N},"Ye"),st=y(r=>{let e=(0,G.c)(38),o;e[0]!==r?(o=r===void 0?{}:r,e[0]=r,e[1]=o):o=e[1];let{initialShardKey:n}=o,l=je(),s=V(),{queryShardKey:a,setShardKey:i,shardKey:c}=ge(n),N;e[2]!==a?(N={cursor:void 0,shardKey:a},e[2]=a,e[3]=N):N=e[3];let[p,h]=(0,Q.useState)(N);p.shardKey!==a&&h({cursor:void 0,shardKey:a});let m=p.shardKey===a?p.cursor:void 0,k=c.trim()!==a,f;e[4]!==m?(f=m===void 0?{}:{cursor:m},e[4]=m,e[5]=f):f=e[5];let d;e[6]!==a?(d={shardKey:a},e[6]=a,e[7]=d):d=e[7];let{data:u,error:v,poll:b,refetch:S}=ve(me.getScheduleOutbox,f,d),I=k?void 0:u?.entries,w=k?void 0:u?.nextCursor,[C,J]=(0,Q.useState)(void 0),$=v??(C?.shardKey===a?C.message:void 0);ae(b,!0);let j;e[8]!==l||e[9]!==a||e[10]!==S||e[11]!==s?(j=y(async(B,E)=>{J(void 0);try{(await l.query(B,{id:E},Ae(a))).retried===!1&&J({message:s("That job is no longer in the outbox."),shardKey:a}),S()}catch(U){J({message:ie(U),shardKey:a})}},"A"),e[8]=l,e[9]=a,e[10]=S,e[11]=s,e[12]=j):j=e[12];let x=j,A;e[13]!==i||e[14]!==c?(A=(0,t.jsx)(be,{onChange:i,testId:"outbox-shard-input",value:c}),e[13]=i,e[14]=c,e[15]=A):A=e[15];let g;e[16]!==$?(g=$!==void 0&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"outbox-error",role:"alert",children:$}),e[16]=$,e[17]=g):g=e[17];let F;e[18]!==m||e[19]!==I?.length?(F=I?.length===0&&m===void 0&&(0,t.jsx)(lt,{}),e[18]=m,e[19]=I?.length,e[20]=F):F=e[20];let _;e[21]!==x||e[22]!==I?(_=I!==void 0&&I.length>0&&(0,t.jsx)(ot,{entries:I,onAct:x}),e[21]=x,e[22]=I,e[23]=_):_=e[23];let T,M;e[24]!==a?(T=y(()=>{h({cursor:void 0,shardKey:a})},"E"),M=y(B=>{h({cursor:B,shardKey:a})},"_"),e[24]=a,e[25]=T,e[26]=M):(T=e[25],M=e[26]);let R;e[27]!==m||e[28]!==w||e[29]!==T||e[30]!==M?(R=(0,t.jsx)(nt,{cursor:m,nextCursor:w,onFirst:T,onNext:M}),e[27]=m,e[28]=w,e[29]=T,e[30]=M,e[31]=R):R=e[31];let W;return e[32]!==R||e[33]!==A||e[34]!==g||e[35]!==F||e[36]!==_?(W=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-schedule-outbox",children:[A,g,F,_,R]}),e[32]=R,e[33]=A,e[34]=g,e[35]=F,e[36]=_,e[37]=W):W=e[37],W},"je"),it="scheduler.lag_ms",Ne=y(r=>{let e=r.attributes?.function;return typeof e=="string"?e:r.functionPath},"he"),ke=y(r=>{let e=(0,G.c)(8),{label:o,testId:n,value:l}=r,s;e[0]!==o?(s=(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:o}),e[0]=o,e[1]=s):s=e[1];let a;e[2]!==n||e[3]!==l?(a=(0,t.jsx)("span",{className:"text-2xl font-semibold tabular-nums","data-testid":n,children:l}),e[2]=n,e[3]=l,e[4]=a):a=e[4];let i;return e[5]!==s||e[6]!==a?(i=(0,t.jsx)(Z,{className:"flex-1 py-0",children:(0,t.jsxs)(H,{className:"flex flex-col gap-1 p-4",children:[s,a]})}),e[5]=s,e[6]=a,e[7]=i):i=e[7],i},"fe"),dt=y(r=>{let e=(0,G.c)(65),o;e[0]!==r?(o=r===void 0?{}:r,e[0]=r,e[1]=o):o=e[1];let{initialShardKey:n,loadStatus:l}=o,s=de(),a=V(),i=l===void 0,c;e[2]!==i?(c=["lunora-scheduler-status",i],e[2]=i,e[3]=c):c=e[3];let N;e[4]!==s||e[5]!==l?(N=y(async()=>{let B=await(l??(()=>s.schedulerStatus()))();return{...B,pools:B.pools.toSorted(ct)}},"v"),e[4]=s,e[5]=l,e[6]=N):N=e[6];let p=ne(c,N),{data:h,error:m}=p,{queryShardKey:k,setShardKey:f,shardKey:d}=ge(n),u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u={},e[7]=u):u=e[7];let v;e[8]!==k?(v={shardKey:k},e[8]=k,e[9]=v):v=e[9];let b=ve(me.getMetricSeries,u,v),{data:S,errorSource:I}=b,w;e[10]!==I||e[11]!==b.error?(w=xe(I)==="FUNCTION_NOT_FOUND"?null:b.error,e[10]=I,e[11]=b.error,e[12]=w):w=e[12];let C=w,J;e[13]!==p?(J=y(()=>p.poll(),"L"),e[13]=p,e[14]=J):J=e[14],ae(J,!0);let $;e[15]!==b?($=y(()=>b.poll(),"$"),e[15]=b,e[16]=$):$=e[16],ae($,!0);let j,x,A,g,F,_,T,M;if(e[17]!==m||e[18]!==S||e[19]!==C||e[20]!==f||e[21]!==d||e[22]!==h||e[23]!==a){let B=(Array.isArray(S?.series)?S.series:[]).filter(ht).toSorted(ut);j="flex flex-col gap-3",x="lunora-scheduler-pools",e[32]!==m?(A=m!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"pools-error",role:"alert",children:m}),e[32]=m,e[33]=A):A=e[33],e[34]!==h||e[35]!==a?(g=h!==void 0&&(0,t.jsxs)("div",{className:"flex gap-3","data-testid":"pools-totals",children:[(0,t.jsx)(ke,{label:a("backlog"),testId:"pools-backlog",value:h.backlog}),(0,t.jsx)(ke,{label:a("in flight"),testId:"pools-inflight",value:h.inFlight}),(0,t.jsx)(ke,{label:a("pools"),testId:"pools-count",value:h.pools.length})]}),e[34]=h,e[35]=a,e[36]=g):g=e[36],e[37]!==h?.pools.length||e[38]!==a?(F=h?.pools.length===0&&(0,t.jsx)(se,{description:a("Pools created with createWorkpool appear here once they have activity."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M4 7h16M4 12h16M4 17h16"})}),testId:"pools-empty",title:a("No workpools.")}),e[37]=h?.pools.length,e[38]=a,e[39]=F):F=e[39];let E;e[40]!==f||e[41]!==d?(E=(0,t.jsx)(be,{onChange:f,testId:"lag-shard-input",value:d}),e[40]=f,e[41]=d,e[42]=E):E=e[42];let U;e[43]!==a?(U=a("Start lag per job on this shard since it last woke; the series reset when the shard hibernates."),e[43]=a,e[44]=U):U=e[44];let P;e[45]!==U?(P=(0,t.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"lag-scope",children:U}),e[45]=U,e[46]=P):P=e[46],e[47]!==E||e[48]!==P?(_=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[E,P]}),e[47]=E,e[48]=P,e[49]=_):_=e[49],e[50]!==C?(T=C!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"lag-error",role:"alert",children:C}),e[50]=C,e[51]=T):T=e[51],M=C===null&&B.length>0&&(0,t.jsx)(Z,{className:"overflow-hidden py-0",children:(0,t.jsx)(H,{className:"px-0",children:(0,t.jsxs)(ee,{"data-testid":"lag-table",children:[(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(L,{children:a("function")}),(0,t.jsx)(L,{children:a("runs")}),(0,t.jsx)(L,{children:a("mean lag (ms)")}),(0,t.jsx)(L,{children:a("max lag (ms)")}),(0,t.jsx)(L,{children:a("last lag (ms)")})]})}),(0,t.jsx)(re,{children:B.map(mt)})]})})}),e[17]=m,e[18]=S,e[19]=C,e[20]=f,e[21]=d,e[22]=h,e[23]=a,e[24]=j,e[25]=x,e[26]=A,e[27]=g,e[28]=F,e[29]=_,e[30]=T,e[31]=M}else j=e[24],x=e[25],A=e[26],g=e[27],F=e[28],_=e[29],T=e[30],M=e[31];let R;e[52]!==h||e[53]!==a?(R=h!==void 0&&h.pools.length>0&&(0,t.jsx)(Z,{className:"overflow-hidden py-0",children:(0,t.jsx)(H,{className:"px-0",children:(0,t.jsxs)(ee,{"data-testid":"pools-table",children:[(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(L,{children:a("pool")}),(0,t.jsx)(L,{children:a("queued")}),(0,t.jsx)(L,{children:a("in flight")}),(0,t.jsx)(L,{children:a("max concurrency")})]})}),(0,t.jsx)(re,{children:h.pools.map(pt)})]})})}),e[52]=h,e[53]=a,e[54]=R):R=e[54];let W;return e[55]!==j||e[56]!==x||e[57]!==A||e[58]!==g||e[59]!==F||e[60]!==_||e[61]!==T||e[62]!==M||e[63]!==R?(W=(0,t.jsxs)("div",{className:j,"data-testid":x,children:[A,g,F,_,T,M,R]}),e[55]=j,e[56]=x,e[57]=A,e[58]=g,e[59]=F,e[60]=_,e[61]=T,e[62]=M,e[63]=R,e[64]=W):W=e[64],W},"Ze");function ct(r,e){return e.queued-r.queued}y(ct,"et");function ht(r){return r.name===it&&r.kind==="histogram"&&r.count>0}y(ht,"tt");function ut(r,e){return e.max-r.max}y(ut,"st");function mt(r){return(0,t.jsxs)(z,{"data-testid":`lag-row-${Ne(r)}`,children:[(0,t.jsx)(K,{className:"font-mono text-xs",children:Ne(r)}),(0,t.jsx)(K,{className:"tabular-nums",children:r.count}),(0,t.jsx)(K,{className:"tabular-nums",children:Math.round(r.sum/r.count)}),(0,t.jsx)(K,{className:"tabular-nums",children:r.max}),(0,t.jsx)(K,{className:"tabular-nums",children:r.last})]},Ne(r))}y(mt,"lt");function pt(r){return(0,t.jsxs)(z,{"data-testid":`pools-row-${r.name}`,children:[(0,t.jsx)(K,{className:"font-mono text-xs",children:r.name}),(0,t.jsx)(K,{className:"tabular-nums",children:r.queued}),(0,t.jsxs)(K,{className:"tabular-nums",children:[r.inFlight," / ",r.maxConcurrency]}),(0,t.jsx)(K,{className:"tabular-nums",children:r.maxConcurrency})]},r.name)}y(pt,"rt");var ft=["jobs","outbox","history","dead","pools","cron"],Vt=y(r=>{let e=(0,G.c)(55),o;e[0]!==r?(o=r===void 0?{}:r,e[0]=r,e[1]=o):o=e[1];let{initialShardKey:n,loadCronJobs:l,scheduledCancel:s,scheduledLoad:a}=o,i=V(),[c,N]=(0,Q.useState)("jobs"),p;e[2]!==i?(p=i("Cron triggers"),e[2]=i,e[3]=p):p=e[3];let h;e[4]!==i?(h=i("Dead letter"),e[4]=i,e[5]=h):h=e[5];let m;e[6]!==i?(m=i("History"),e[6]=i,e[7]=m):m=e[7];let k;e[8]!==i?(k=i("Scheduled jobs"),e[8]=i,e[9]=k):k=e[9];let f;e[10]!==i?(f=i("Outbox"),e[10]=i,e[11]=f):f=e[11];let d;e[12]!==i?(d=i("Pools"),e[12]=i,e[13]=d):d=e[13];let u;e[14]!==p||e[15]!==h||e[16]!==m||e[17]!==k||e[18]!==f||e[19]!==d?(u={cron:p,dead:h,history:m,jobs:k,outbox:f,pools:d},e[14]=p,e[15]=h,e[16]=m,e[17]=k,e[18]=f,e[19]=d,e[20]=u):u=e[20];let v=u,b;e[21]===Symbol.for("react.memo_cache_sentinel")?(b=y(T=>{N(T.currentTarget.dataset.view)},"b"),e[21]=b):b=e[21];let S=b,I;e[22]===Symbol.for("react.memo_cache_sentinel")?(I=(0,t.jsx)(Le,{}),e[22]=I):I=e[22];let w;e[23]!==i?(w=i("Schedule view"),e[23]=i,e[24]=w):w=e[24];let C;e[25]!==c||e[26]!==v?(C=ft.map(T=>(0,t.jsx)(ce,{"aria-selected":c===T,"data-testid":`schedule-view-${T}`,"data-view":T,onClick:S,role:"tab",size:"sm",type:"button",variant:c===T?"default":"outline",children:v[T]},T)),e[25]=c,e[26]=v,e[27]=C):C=e[27];let J;e[28]!==w||e[29]!==C?(J=(0,t.jsx)("div",{"aria-label":w,className:"flex gap-1.5","data-testid":"schedule-view-toggle",role:"tablist",children:C}),e[28]=w,e[29]=C,e[30]=J):J=e[30];let $;e[31]!==s||e[32]!==a||e[33]!==c?($=c==="jobs"&&(0,t.jsx)(Te,{cancelJob:s,loadJobs:a}),e[31]=s,e[32]=a,e[33]=c,e[34]=$):$=e[34];let j;e[35]!==c?(j=c==="outbox"&&(0,t.jsx)(st,{}),e[35]=c,e[36]=j):j=e[36];let x;e[37]!==c?(x=c==="history"&&(0,t.jsx)(He,{}),e[37]=c,e[38]=x):x=e[38];let A;e[39]!==c?(A=c==="dead"&&(0,t.jsx)(Xe,{}),e[39]=c,e[40]=A):A=e[40];let g;e[41]!==n||e[42]!==c?(g=c==="pools"&&(0,t.jsx)(dt,{initialShardKey:n}),e[41]=n,e[42]=c,e[43]=g):g=e[43];let F;e[44]!==l||e[45]!==c?(F=c==="cron"&&(0,t.jsx)(Ge,{loadCronJobs:l}),e[44]=l,e[45]=c,e[46]=F):F=e[46];let _;return e[47]!==J||e[48]!==$||e[49]!==j||e[50]!==x||e[51]!==A||e[52]!==g||e[53]!==F?(_=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-schedule",children:[I,J,$,j,x,A,g,F]}),e[47]=J,e[48]=$,e[49]=j,e[50]=x,e[51]=A,e[52]=g,e[53]=F,e[54]=_):_=e[54],_},"It");export{Vt as SchedulePanel};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as fe}from"./chunk-R6NJ4ER6.js";import{i as pe}from"./chunk-
|
|
1
|
+
import{a as fe}from"./chunk-R6NJ4ER6.js";import{i as pe}from"./chunk-VB3BKQCE.js";import"./chunk-4SY2N2RS.js";import"./chunk-4AG356VE.js";import{a as le}from"./chunk-553O7ESU.js";import"./chunk-SCTYLLJT.js";import"./chunk-OZID3UYF.js";import"./chunk-L27FKJTG.js";import{a as ae,e as oe}from"./chunk-D76SLSGV.js";import"./chunk-ZPQBVYNN.js";import{B as re,j as ce,s as me,v as ue}from"./chunk-OYCDWIG2.js";import"./chunk-PDBW6GTJ.js";import{a as ke}from"./chunk-A6TVTNKO.js";import{a as be,b as ve}from"./chunk-ADABTCDI.js";import{a as h,d as se}from"./chunk-5PEAXTYQ.js";var ne=se(ke(),1),X=se(be(),1);var s=se(ve(),1);var we=h(e=>{let t=(0,ne.c)(23),{destination:r}=e,f=re(),x;t[0]!==r.snippet?(x=h(()=>{ue(r.snippet)},"x"),t[0]=r.snippet,t[1]=x):x=t[1];let u=x,l;t[2]!==r.title?(l=(0,s.jsx)("h4",{className:"text-sm font-semibold",children:r.title}),t[2]=r.title,t[3]=l):l=t[3];let a;t[4]!==r.description?(a=(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:r.description}),t[4]=r.description,t[5]=a):a=t[5];let c;t[6]!==l||t[7]!==a?(c=(0,s.jsxs)("div",{children:[l,a]}),t[6]=l,t[7]=a,t[8]=c):c=t[8];let J=`drain-copy-${r.id}`,o;t[9]!==f?(o=f("Copy"),t[9]=f,t[10]=o):o=t[10];let n;t[11]!==u||t[12]!==J||t[13]!==o?(n=(0,s.jsx)(le,{"data-testid":J,onClick:u,size:"sm",variant:"outline",children:o}),t[11]=u,t[12]=J,t[13]=o,t[14]=n):n=t[14];let i;t[15]!==c||t[16]!==n?(i=(0,s.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[c,n]}),t[15]=c,t[16]=n,t[17]=i):i=t[17];let m;t[18]!==r.snippet?(m=(0,s.jsx)("pre",{className:"mt-2 overflow-x-auto rounded bg-muted p-2 font-mono text-xs",children:r.snippet}),t[18]=r.snippet,t[19]=m):m=t[19];let y;return t[20]!==i||t[21]!==m?(y=(0,s.jsx)(ae,{className:"py-0","data-testid":"drain-card",children:(0,s.jsxs)(oe,{className:"p-3",children:[i,m]})}),t[20]=i,t[21]=m,t[22]=y):y=t[22],y},"be"),Me=h(()=>{let e=(0,ne.c)(93),t=re(),r;e[0]!==t?(r=t("Stream every request log to R2, a SIEM, or a third-party log service."),e[0]=t,e[1]=r):r=e[1];let f;e[2]===Symbol.for("react.memo_cache_sentinel")?(f=["{",' "logpush": true',"}"],e[2]=f):f=e[2];let x=f.join(`
|
|
2
2
|
`),u;e[3]!==t?(u=t("Logpush"),e[3]=t,e[4]=u):u=e[4];let l;e[5]!==r||e[6]!==u?(l={description:r,id:"logpush",snippet:x,title:u},e[5]=r,e[6]=u,e[7]=l):l=e[7];let a;e[8]!==t?(a=t("Send logs programmatically to a Worker for custom capture and forwarding."),e[8]=t,e[9]=a):a=e[9];let c;e[10]===Symbol.for("react.memo_cache_sentinel")?(c=["{",' "tail_consumers": [{ "service": "my-log-forwarder" }]',"}"],e[10]=c):c=e[10];let J=c.join(`
|
|
3
3
|
`),o;e[11]!==t?(o=t("Tail Workers"),e[11]=t,e[12]=o):o=e[12];let n;e[13]!==a||e[14]!==o?(n={description:a,id:"tail-worker",snippet:J,title:o},e[13]=a,e[14]=o,e[15]=n):n=e[15];let i;e[16]!==t?(i=t("Retain and query recent request logs directly in Cloudflare's dashboard."),e[16]=t,e[17]=i):i=e[17];let m;e[18]===Symbol.for("react.memo_cache_sentinel")?(m=["{",' "observability": { "enabled": true }',"}"],e[18]=m):m=e[18];let y=m.join(`
|
|
4
4
|
`),b;e[19]!==t?(b=t("Workers Logs"),e[19]=t,e[20]=b):b=e[20];let k;e[21]!==i||e[22]!==b?(k={description:i,id:"workers-logs",snippet:y,title:b},e[21]=i,e[22]=b,e[23]=k):k=e[23];let $;e[24]!==k||e[25]!==l||e[26]!==n?($=[l,n,k],e[24]=k,e[25]=l,e[26]=n,e[27]=$):$=e[27];let Y=$,[d,he]=(0,X.useState)(""),[v,ie]=(0,X.useState)(!1),[A,G]=(0,X.useState)(null),H;e[28]!==t||e[29]!==d?(H=h(async()=>{let g=d.trim();if(g==="")return;let de="fetch"in globalThis?globalThis.fetch:void 0;if(de===void 0){G({kind:"error",message:t("fetch is unavailable in this environment."),url:g});return}let xe={durationMs:12,function:"messages:list",outcome:"ok",shard:"root",source:"lunora",tablesRead:["messages"],tablesWritten:[],ts:new Date().toISOString(),type:"request"};ie(!0),G(null);let ye=performance.now();try{let te=await de(g,{body:JSON.stringify(xe),headers:{"Content-Type":"application/json"},method:"POST"});G({kind:"success",latencyMs:Math.round(performance.now()-ye),status:te.status,url:g})}catch(te){G({kind:"error",message:ce(te),url:g})}ie(!1)},"V"),e[28]=t,e[29]=d,e[30]=H):H=e[30];let Z=H,K;e[31]!==A||e[32]!==d?(K=A?.url===d.trim()?A:null,e[31]=A,e[32]=d,e[33]=K):K=e[33];let p=K,Q;e[34]!==Z?(Q=h(()=>{me(Z())},"G"),e[34]=Z,e[35]=Q):Q=e[35];let ee=Q,U;e[36]===Symbol.for("react.memo_cache_sentinel")?(U=h(g=>{he(g.target.value)},"H"),e[36]=U):U=e[36];let ge=U,w;e[37]!==t?(w=t("Open in Cloudflare"),e[37]=t,e[38]=w):w=e[38];let N;e[39]!==w?(N=(0,s.jsx)("div",{className:"flex flex-wrap items-center gap-3",children:(0,s.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"drain-cf-link",href:fe,rel:"noreferrer",target:"_blank",children:w})}),e[39]=w,e[40]=N):N=e[40];let S;e[41]!==t?(S=t("Lunora does not ship logs itself \u2014 forwarding is handled by Cloudflare. Configure a destination below, then test your collector."),e[41]=t,e[42]=S):S=e[42];let C;e[43]!==S?(C=(0,s.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"drain-readonly-note",children:S}),e[43]=S,e[44]=C):C=e[44];let _;e[45]!==t?(_=t("Cloudflare destinations"),e[45]=t,e[46]=_):_=e[46];let j;e[47]!==_?(j=(0,s.jsx)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:_}),e[47]=_,e[48]=j):j=e[48];let T;e[49]!==Y?(T=Y.map(Ne),e[49]=Y,e[50]=T):T=e[50];let q;e[51]!==j||e[52]!==T?(q=(0,s.jsxs)("section",{className:"flex flex-col gap-3","data-testid":"drain-destinations",children:[j,T]}),e[51]=j,e[52]=T,e[53]=q):q=e[53];let M;e[54]!==t?(M=t("Webhook test"),e[54]=t,e[55]=M):M=e[55];let O;e[56]!==M?(O=(0,s.jsx)("h3",{className:"mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:M}),e[56]=M,e[57]=O):O=e[57];let W;e[58]!==t?(W=t("POST a sample Lunora request-log envelope to your collector to confirm it is reachable."),e[58]=t,e[59]=W):W=e[59];let L;e[60]!==W?(L=(0,s.jsx)("p",{className:"mb-2 text-sm text-muted-foreground",children:W}),e[60]=W,e[61]=L):L=e[61];let I;e[62]!==t?(I=t("https://example.com/logs"),e[62]=t,e[63]=I):I=e[63];let P;e[64]!==I||e[65]!==d?(P=(0,s.jsx)(pe,{className:"min-w-[20rem] flex-1","data-testid":"drain-webhook-url",onChange:ge,placeholder:I,type:"url",value:d}),e[64]=I,e[65]=d,e[66]=P):P=e[66];let R;e[67]!==v||e[68]!==d?(R=v||d.trim()==="",e[67]=v,e[68]=d,e[69]=R):R=e[69];let D;e[70]!==v||e[71]!==t?(D=t(v?"Sending\u2026":"Send test event"),e[70]=v,e[71]=t,e[72]=D):D=e[72];let z;e[73]!==ee||e[74]!==R||e[75]!==D?(z=(0,s.jsx)(le,{"data-testid":"drain-webhook-test",disabled:R,onClick:ee,children:D}),e[73]=ee,e[74]=R,e[75]=D,e[76]=z):z=e[76];let B;e[77]!==P||e[78]!==z?(B=(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[P,z]}),e[77]=P,e[78]=z,e[79]=B):B=e[79];let E;e[80]!==p||e[81]!==t?(E=p!==null&&(0,s.jsx)("p",{className:p.kind==="success"?"mt-2 text-sm text-muted-foreground":"mt-2 text-sm text-destructive","data-testid":"drain-webhook-result",role:p.kind==="error"?"alert":void 0,children:p.kind==="success"?t("Delivered \u2014 status {status} in {latency}ms",{latency:p.latencyMs,status:p.status}):t("Failed: {message}",{message:p.message})}),e[80]=p,e[81]=t,e[82]=E):E=e[82];let F;e[83]!==O||e[84]!==L||e[85]!==B||e[86]!==E?(F=(0,s.jsx)(ae,{className:"py-0",children:(0,s.jsx)(oe,{className:"p-3",children:(0,s.jsxs)("section",{"data-testid":"drain-webhook",children:[O,L,B,E]})})}),e[83]=O,e[84]=L,e[85]=B,e[86]=E,e[87]=F):F=e[87];let V;return e[88]!==N||e[89]!==C||e[90]!==q||e[91]!==F?(V=(0,s.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"log-drains",children:[N,C,q,F]}),e[88]=N,e[89]=C,e[90]=q,e[91]=F,e[92]=V):V=e[92],V},"je");function Ne(e){return(0,s.jsx)(we,{destination:e},e.id)}h(Ne,"ye");export{Me as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as b}from"./chunk-ZPQBVYNN.js";import{x as v}from"./chunk-
|
|
1
|
+
import{a as b}from"./chunk-ZPQBVYNN.js";import{x as v}from"./chunk-OYCDWIG2.js";import{a as x}from"./chunk-A6TVTNKO.js";import{b as g}from"./chunk-ADABTCDI.js";import{a as c,d as l}from"./chunk-5PEAXTYQ.js";var u=l(x(),1);var s=l(g(),1);var p=b("flex items-start gap-2 rounded-md border px-3 py-2 text-sm [&>svg]:mt-0.5 [&>svg]:size-4 [&>svg]:shrink-0",{defaultVariants:{variant:"default"},variants:{variant:{default:"border-border bg-muted/40 text-foreground",destructive:"border-destructive/40 bg-destructive/5 text-destructive",warning:"border-amber-500/40 bg-amber-500/5 text-amber-700 dark:text-amber-400"}}}),j=c(f=>{let t=(0,u.c)(10),{children:d,className:i,icon:m,testId:o,variant:n}=f,e;t[0]!==i||t[1]!==n?(e=v(p({variant:n}),i),t[0]=i,t[1]=n,t[2]=e):e=t[2];let r;t[3]!==d?(r=(0,s.jsx)("div",{className:"min-w-0 flex-1",children:d}),t[3]=d,t[4]=r):r=t[4];let a;return t[5]!==m||t[6]!==e||t[7]!==r||t[8]!==o?(a=(0,s.jsxs)("div",{className:e,"data-testid":o,role:"alert",children:[m,r]}),t[5]=m,t[6]=e,t[7]=r,t[8]=o,t[9]=a):a=t[9],a},"N");export{j as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as B}from"./chunk-
|
|
1
|
+
import{a as B}from"./chunk-TLOLN6RV.js";import{a as j}from"./chunk-YOUTNV5Y.js";import"./chunk-DA2CAFXI.js";import"./chunk-7WGZSDRS.js";import"./chunk-N7FOBAV3.js";import"./chunk-553O7ESU.js";import"./chunk-SCTYLLJT.js";import"./chunk-OZID3UYF.js";import{a as I}from"./chunk-K7Z7UTJJ.js";import{b as w}from"./chunk-XMJB5JOF.js";import"./chunk-L27FKJTG.js";import{a as C}from"./chunk-2BCNWFC5.js";import"./chunk-CTIZP3XO.js";import{a as A,b as D,c as P,d as b,e as l,f as n}from"./chunk-VSYZL2WH.js";import"./chunk-GWRKSV2Q.js";import"./chunk-IAVAD545.js";import"./chunk-EOFWXI3T.js";import{a as u}from"./chunk-LYVYUTQY.js";import{c as p}from"./chunk-P37L55FP.js";import{a as v,e as S}from"./chunk-D76SLSGV.js";import{e as R}from"./chunk-K24LZAP2.js";import"./chunk-ZPQBVYNN.js";import{B as k,w as N}from"./chunk-OYCDWIG2.js";import"./chunk-PDBW6GTJ.js";import"./chunk-A6TVTNKO.js";import{b as Q}from"./chunk-ADABTCDI.js";import{a as m,d as H}from"./chunk-5PEAXTYQ.js";var e=H(Q(),1);var _="payment_subscriptions",O="payment_events",V=[_,O],Y={},E=new Set(["active","trialing"]),z=new Set(["past_due","unpaid"]),s=m((a,t)=>{if(a[t]!==void 0)return a[t];let h=a.__doc__;return typeof h=="string"?R(h)?.[t]:void 0},"a"),o=m(a=>typeof a=="string"?a:typeof a=="number"||typeof a=="bigint"||typeof a=="boolean"?String(a):"","s"),J=m(a=>E.has(a)?"default":z.has(a)?"destructive":"outline","q"),ie=m(({limit:a=100})=>{let t=k(),h=B(),{data:x}=p(u.listTables,Y,{live:!0}),F=x!==void 0,L=Array.isArray(x)&&V.every(r=>x.some(d=>d.name===r)),c=h.payments&&L,i=p(u.readTablePage,{filters:[],limit:a,offset:0,orderBy:{column:"updatedAt",direction:"desc"},search:"",table:_},{enabled:c}),f=p(u.readTablePage,{filters:[],limit:25,offset:0,orderBy:{column:"processedAt",direction:"desc"},search:"",table:O},{enabled:c}),g=p(u.facetColumn,{column:"state",table:_},{enabled:c});j(()=>{if(c)return Promise.all([i.poll(),f.poll(),g.poll()])},!0);let y=i.data?.rows??[],M=f.data?.rows??[],U=i.error??f.error,q=i.error===null?f.errorSource:i.errorSource,G=i.data?.total??y.length,T=g.data?.values===void 0?y.filter(r=>E.has(o(s(r,"state")))).length:g.data.values.reduce((r,d)=>r+(E.has(o(d.value))?d.count:0),0);return F&&!c?(0,e.jsx)("div",{className:"flex flex-col gap-4","data-testid":"payments-panel",children:(0,e.jsx)(I,{description:t("No @lunora/payment tables found in this deployment. Add `.extend(paymentExtension)` to lunora/schema.ts and wire `payment` on createShardDO() to sync customers and subscriptions."),testId:"payments-unconfigured",title:t("No payments configured")})}):(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"payments-panel",children:[(0,e.jsx)("div",{className:"flex items-center gap-2","data-testid":"payments-summary",children:(0,e.jsxs)(v,{className:"justify-between gap-0 py-0",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[(0,e.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:t("Subscriptions")}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:T}),(0,e.jsx)(w,{variant:"default",children:t("{count} active",{count:T})})]})]}),(0,e.jsx)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:t("{total} total",{total:G})})]})}),U===null?void 0:(0,e.jsx)(C,{error:q}),y.length===0&&!i.isLoading?(0,e.jsx)(I,{testId:"payments-empty",title:t("No subscriptions yet")}):(0,e.jsx)(v,{className:"overflow-hidden py-0",children:(0,e.jsx)(S,{className:"px-0",children:(0,e.jsxs)(A,{children:[(0,e.jsx)(D,{children:(0,e.jsxs)(b,{children:[(0,e.jsx)(l,{children:t("Provider")}),(0,e.jsx)(l,{children:t("Reference")}),(0,e.jsx)(l,{children:t("Plan")}),(0,e.jsx)(l,{children:t("State")}),(0,e.jsx)(l,{children:t("Renews")})]})}),(0,e.jsx)(P,{children:y.map(r=>{let d=o(s(r,"state"));return(0,e.jsxs)(b,{"data-testid":"payment-subscription-row",children:[(0,e.jsx)(n,{children:o(s(r,"provider"))}),(0,e.jsx)(n,{children:o(s(r,"referenceId"))}),(0,e.jsx)(n,{children:o(s(r,"priceId"))}),(0,e.jsx)(n,{children:(0,e.jsx)(w,{variant:J(d),children:d})}),(0,e.jsx)(n,{children:N(s(r,"currentPeriodEnd"))})]},o(s(r,"providerSubscriptionId")))})})]})})}),(0,e.jsxs)(v,{className:"overflow-hidden py-0",children:[(0,e.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,e.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:t("Recent webhook events")})}),(0,e.jsx)(S,{className:"px-0",children:(0,e.jsx)(A,{children:(0,e.jsx)(P,{children:M.map(r=>(0,e.jsxs)(b,{"data-testid":"payment-event-row",children:[(0,e.jsx)(n,{children:o(s(r,"provider"))}),(0,e.jsx)(n,{className:"font-medium",children:o(s(r,"type"))}),(0,e.jsx)(n,{className:"text-muted-foreground",children:o(s(r,"providerEventId"))}),(0,e.jsx)(n,{children:N(s(r,"processedAt"))})]},o(s(r,"providerEventId"))))})})})]})]})},"oe");export{ie as PaymentsPanel};
|