@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 we,b as Ge}from"./chunk-
|
|
1
|
+
import{a as we,b as Ge}from"./chunk-QHVUXMRV.js";import{i as je,k as He}from"./chunk-2NUCBQFU.js";import{a as Ee,b as Pe,c as Ne,d as De,e as Be,g as Me,h as Fe}from"./chunk-VB3BKQCE.js";import{I as Se,J as Ve,K as Le,L as Te,M as Oe,N as _e,b as U,l as Ae}from"./chunk-4SY2N2RS.js";import{b as ve,c as Re}from"./chunk-SCTYLLJT.js";import{b as Ce,v as M}from"./chunk-OZID3UYF.js";import{b as ke,d as ge,e as ye,i as Ie,j as H}from"./chunk-L27FKJTG.js";import{x as he}from"./chunk-OYCDWIG2.js";import{a as Et}from"./chunk-A6TVTNKO.js";import{a as A,b as xe}from"./chunk-ADABTCDI.js";import{a as i,c as It,d as C}from"./chunk-5PEAXTYQ.js";var Qe=C(Et(),1);var V={};It(V,{Indicator:()=>$e,Root:()=>Ye});var l=C(A(),1);function Ue(o){if(!o)return null;for(let e of o.elements){let r=e.tagName;if(r==="BUTTON"||r==="INPUT"){let a=e;if(a.type==="submit")return a}}return null}i(Ue,"getDefaultFormSubmitter");var qe="data-checked",We="data-unchecked";function q(o){return{checked(e){return o.indeterminate?{}:e?{[qe]:""}:{[We]:""}},...Ee}}i(q,"getCheckboxStateAttributesMapping");var ze=C(A(),1);function Ke(o,e,r,a=!0,s){let[f,p]=ze.useState(),P=U(s?`${s}-label`:void 0),b=o??e??f;return M(()=>{let x=o||e||!a?void 0:Nt(r.current,P);f!==x&&p(x)}),b}i(Ke,"useAriaLabelledBy");function Nt(o,e){let r=Dt(o);if(r)return!r.id&&e&&(r.id=e),r.id||void 0}i(Nt,"getAriaLabelledBy");function Dt(o){if(!o)return;let e=o.parentElement;if(e&&e.tagName==="LABEL")return e;let r=o.id;if(r){let s=o.nextElementSibling;if(s&&s.htmlFor===r)return s}let a=o.labels;return a&&a[0]}i(Dt,"findAssociatedLabel");var W=C(A(),1);var Bt=W.createContext(void 0);function Je(){return W.useContext(Bt)}i(Je,"useCheckboxGroupContext");var z=C(A(),1);var ie=z.createContext(void 0);function Xe(){let o=z.useContext(ie);if(o===void 0)throw new Error(ge(14));return o}i(Xe,"useCheckboxRootContext");var S=C(xe(),1);var At="data-parent",Ye=l.forwardRef(i(function(e,r){let{checked:a,className:s,defaultChecked:f=!1,"aria-labelledby":p,disabled:P=!1,form:b,id:x,indeterminate:N=!1,inputRef:X,name:L,onCheckedChange:F,parent:u=!1,readOnly:y=!1,render:ae,required:I=!1,uncheckedValue:T,value:O,nativeButton:_=!1,style:Mt,...Ze}=e,{clearErrors:et}=Ne(),{disabled:tt,name:ot,setDirty:rt,setFilled:se,setFocused:de,setTouched:nt,state:ce,validationMode:it,validityData:at,validation:st}=Pe(),dt=Me(),{labelId:ct,registerControlId:ut,getDescriptionProps:ue}=De(),n=Je(),k=n?.allValues===void 0?void 0:n.parent,w=k!==void 0,c=tt||dt.disabled||n?.disabled||P,E=ot??L,d=O??E,le=U(),lt=n?.registerControlId!==ut,Y=Be({id:x||void 0,enabled:lt}),ft=_?Y:le,$={};w&&(u?$=k.getParentProps():d!==void 0&&($=k.getChildProps(d)));let{checked:fe=a,indeterminate:pt=N,onCheckedChange:mt,...bt}=$,Q=n?.value,G=l.useRef(null),{getButtonProps:xt,buttonRef:ht}=Re({disabled:c,native:_}),D=n?.validation??st,[m,Ct]=Le({controlled:d!==void 0&&Q!==void 0&&!u?Q.includes(d):fe,default:f,name:"Checkbox",state:"checked"}),Z=w?!!fe:m,B=w&&pt||N;Fe(G,le,m,void 0,!n&&!c,L);let ee=k?.registerChildId,g=l.useRef(null),pe=D.registerInput,me=n?d:void 0,kt=l.useCallback(t=>pe(t,{controlRef:G,value:me}),[pe,me]),gt=ye(X,g,u?void 0:kt),vt=Ke(p,ct,g,!_,Y);M(()=>{g.current&&(g.current.indeterminate=B),n||se(m)},[m,B,n,se]),Te(m,()=>{n||(et(E),rt(m!==at.initialValue),D.change(m))});let Rt=ke({checked:m,disabled:c,form:b,name:u?void 0:E,id:_?void 0:Y,required:I,ref:gt,style:E?Ge:we,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(t){if(t.nativeEvent.defaultPrevented)return;if(y){t.preventDefault();return}let h=t.currentTarget.checked,v=_e(Oe.none,t.nativeEvent);if(F?.(h,v),!v.isCanceled&&(mt?.(h,v),!v.isCanceled&&(Ct(h),d!==void 0&&n!==void 0&&!u&&!w))){let R=h?[...n.value,d]:n.value.filter(j=>j!==d);n.setValue(R,v)}},onClick(t){t.stopPropagation()},onFocus(){G.current?.focus()}},O!==void 0?{value:(n?m&&O:O)||""}:Ie,ue,t=>D.getValidationProps(c,t));l.useEffect(()=>{if(!k||d===void 0)return;let t=k.disabledStatesRef.current;return t.set(d,c),()=>{t.delete(d)}},[k,c,d]);let te=l.useMemo(()=>({...ce,checked:Z,disabled:c,readOnly:y,required:I,indeterminate:B}),[ce,Z,c,y,I,B]),yt=q(te),be=H("span",e,{state:te,ref:[ht,G,r],props:[{id:ft,role:"checkbox","aria-checked":B?"mixed":Z,"aria-readonly":y||void 0,"aria-required":I||void 0,"aria-labelledby":vt,[At]:u?"":void 0,onFocus(){c||de(!0)},onBlur(){let t=g.current;t&&(nt(!0),de(!1),it==="onBlur"&&D.commit(n?Q:t.checked))},onKeyDown(t){if(t.key!=="Enter"||(t.preventBaseUIHandler(),t.defaultPrevented))return;let h=g.current?.form??null,v=t.currentTarget,R=t.nativeEvent,j=t.preventDefault,re=R.preventDefault,ne=!1;t.preventDefault=()=>{ne=!0,j.call(t)},R.preventDefault=()=>{ne=!0,re.call(R)},re.call(R),Ce(v).queueMicrotask(()=>{t.preventDefault=j,R.preventDefault=re,ne||Ue(h)?.click()})},onClick(t){if(y||c)return;t.preventDefault();let h=g.current;h&&ve(h,t)}},Ze,bt,xt,ue,t=>D.getValidationProps(c,t)],stateAttributesMapping:yt}),oe=be.props.id;return M(()=>{if(!(!ee||u||d===void 0||oe===void 0))return ee(d,oe)},[ee,u,d,oe]),(0,S.jsxs)(ie.Provider,{value:te,children:[be,!m&&!n&&E&&!u&&T!==void 0&&(0,S.jsx)("input",{type:"hidden",form:b,name:E,value:T,disabled:c}),(0,S.jsx)("input",{...Rt,suppressHydrationWarning:!0})]})},"CheckboxRoot"));var K=C(A(),1);var $e=K.forwardRef(i(function(e,r){let{render:a,className:s,style:f,keepMounted:p=!1,...P}=e,b=Xe(),x=b.checked||b.indeterminate,{mounted:N,transitionStatus:X,setMounted:L}=Ve(x),F=K.useRef(null),u={...b,transitionStatus:X};Se({batch:!0,enabled:!x,open:x,ref:F,onComplete(){x||L(!1)}});let ae={...q(b),...Ae},I=p||N,T=H("span",e,{ref:[r,F],state:u,stateAttributesMapping:ae,props:P});return I?T:null},"CheckboxIndicator"));var J=C(xe(),1);function Fo(o){let e=(0,Qe.c)(9),r,a;e[0]!==o?({className:r,...a}=o,e[0]=o,e[1]=r,e[2]=a):(r=e[1],a=e[2]);let s;e[3]!==r?(s=he("peer relative flex size-4 shrink-0 items-center justify-center rounded-md border border-input transition-colors outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary",r),e[3]=r,e[4]=s):s=e[4];let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=(0,J.jsx)(V.Indicator,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none [&>svg]:size-3.5",children:(0,J.jsx)(He,{icon:je,strokeWidth:2})}),e[5]=f):f=e[5];let p;return e[6]!==a||e[7]!==s?(p=(0,J.jsx)(V.Root,{"data-slot":"checkbox",className:s,...a,children:f}),e[6]=a,e[7]=s,e[8]=p):p=e[8],p}i(Fo,"v");export{Fo as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as Fs,b as v,c as Ps,d as Ls}from"./chunk-PUK3H4RN.js";import{a as Ms}from"./chunk-GWNGVKLG.js";import{a as ne,b as Et}from"./chunk-6G3E4PJ2.js";import{a,d as H}from"./chunk-5PEAXTYQ.js";var ue=a(t=>{try{return t(),!0}catch{return!1}},"o"),zn=new Set([Object.prototype,Function.prototype]),Oe=a((t,e,s)=>{let r;for(let i=t;i!==null&&!zn.has(i);i=Object.getPrototypeOf(i)){let n=Object.getOwnPropertyDescriptor(i,e)?.[s];typeof n=="function"&&(r=n)}return r},"y"),V=a((t,e)=>Oe(t,e,"get"),"r"),Qs=Oe(Date.prototype,"getTime","value"),Gn=V(Map.prototype,"size"),Vn=V(Set.prototype,"size"),Jn=V(ArrayBuffer.prototype,"byteLength"),Te=typeof URL=="function"?V(URL.prototype,"href"):void 0,It=typeof URL=="function"?URL.prototype:void 0,Yn=Te!==void 0&&Function.prototype.toString.call(Te).includes("[native code]"),xs=Oe(Error,"isError","value"),_s=Error.prototype,Xn=a((t,e)=>typeof xs=="function"?xs(t):e!==null&&(e===_s||_s.isPrototypeOf(e)),"L"),Zn=Oe(Map.prototype,"forEach","value"),ea=Oe(Set.prototype,"forEach","value"),Rt=Object.getPrototypeOf(Uint8Array.prototype),At={data:{buffer:V(DataView.prototype,"buffer"),byteLength:V(DataView.prototype,"byteLength"),byteOffset:V(DataView.prototype,"byteOffset")},typed:{buffer:V(Rt,"buffer"),byteLength:V(Rt,"byteLength"),byteOffset:V(Rt,"byteOffset")}},Ds=a(t=>Reflect.apply(Qs,t,[]),"S"),Us=a(t=>Reflect.apply(Te,t,[]),"m"),Hs=a(t=>{let e=[];return Reflect.apply(Zn,t,[(s,r)=>e.push([r,s])]),e},"A"),Ns=a(t=>{let e=[];return Reflect.apply(ea,t,[s=>e.push(s)]),e},"w"),Ks=a(t=>{let e=ue(()=>Reflect.apply(At.typed.buffer,t,[]))?At.typed:At.data;return new Uint8Array(Reflect.apply(e.buffer,t,[]),Reflect.apply(e.byteOffset,t,[]),Reflect.apply(e.byteLength,t,[]))},"j"),We=a(t=>{if(Array.isArray(t))return"array";let e=Object.getPrototypeOf(t);return e===null||e===Object.prototype?"plain":ue(()=>Reflect.apply(Qs,t,[]))?"builtin-date":ue(()=>Reflect.apply(Gn,t,[]))?"builtin-map":ue(()=>Reflect.apply(Vn,t,[]))?"builtin-set":ue(()=>Reflect.apply(Jn,t,[]))?"builtin-array-buffer":ArrayBuffer.isView(t)?"builtin-view":Xn(t,e)?"builtin-error":Te!==void 0&&(Yn||It!==void 0&&e!==null&&(e===It||It.isPrototypeOf(e)))&&ue(()=>Reflect.apply(Te,t,[]))?"builtin-url":"other"},"D");var ta=2**32-1,sa=/["\\\u0000-\u001F\uD800-\uDFFF]/,js=a(t=>sa.test(t)?JSON.stringify(t):`"${t}"`,"y"),ra=a(t=>Number.isNaN(t)?"nan":t===1/0?"inf":t===-1/0?"-inf":Object.is(t,-0)?"-0":void 0,"u"),ia=a((t,e)=>{let s=t,r=Object.keys(s).sort(),i="{",n=!0;for(let o of r){let c=s[o];c!==void 0&&(n?n=!1:i+=",",i+=js(o),i+=":",i+=e(c))}return`${i}}`},"g"),na=a(t=>{let{length:e}=t,s=Number.isInteger(e)?e:Math.trunc(e)||0;if(s>ta)throw new RangeError("stable-key: array length exceeds 2**32 - 1");return s},"d"),Ee=a(t=>{if(t===void 0)return"null";if(typeof t=="bigint")throw new TypeError("stableStringify: cannot use a bigint in a stable JSON cache key \u2014 pass it as a string, or use stableWireKey");if(typeof t=="function"||typeof t=="symbol")throw new TypeError(`stableStringify: cannot use a ${typeof t} in a stable JSON cache key \u2014 only plain objects, arrays, and JSON primitives are supported`);if(typeof t=="number"){let s=ra(t);if(s!==void 0)return s}if(typeof t=="string")return js(t);if(t===null||typeof t!="object")return JSON.stringify(t);let e=We(t);if(e==="array"){let s=na(t),r="[";for(let i=0;i<s;i+=1)i>0&&(r+=","),r+=Ee(t[i]);return`${r}]`}if(e!=="plain"){let s=t.constructor?.name??"value";throw new TypeError(`stableStringify: cannot use a ${s} in a stable JSON cache key \u2014 only plain objects, arrays, and JSON primitives are supported (wire-typed values key via stableWireKey)`)}return ia(t,Ee)},"c");var Ft=a(t=>{if(t===null||typeof t!="object")return!1;let e=Object.getPrototypeOf(t);return e===null||e===Object.prototype},"e");var $e=a(t=>{let e="";for(let s=0;s<t.length;s+=32768)e+=String.fromCharCode(...t.subarray(s,s+32768));return btoa(e)},"u"),aa=a(t=>{let e=atob(t),s=new Uint8Array(e.length);for(let r=0;r<e.length;r+=1)s[r]=e.codePointAt(r)??0;return s},"R"),A="$lunora.wire$",ze=64,Ge=1024,oa="__proto__",ca=/^-?\d+$/,qs={BigInt64Array,BigUint64Array,Float32Array,Float64Array,Int8Array,Int16Array,Int32Array,Uint8Array,Uint8ClampedArray,Uint16Array,Uint32Array},Bs={Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError},Pt=a((t,e,s)=>{e===oa?Object.defineProperty(t,e,{configurable:!0,enumerable:!0,value:s,writable:!0}):t[e]=s},"b");var ha=a(t=>{let e=t.toString();if(e.length>Ge)throw new RangeError(`wire-codec: over-long bigint (max ${String(Ge)} digits)`);return[A,"bigint",e]},"B"),da=a(t=>Number.isNaN(t)?[A,"nan"]:t===1/0?[A,"inf"]:t===-1/0?[A,"-inf"]:t,"_"),ua=a((t,e)=>{let s=e(Object.fromEntries(Object.keys(t).map(n=>[n,t[n]]))),r=t,i=[A,"error",String(r.name),String(r.message),s];return t.cause!==void 0&&i.push(e(t.cause)),i},"P"),la=a(t=>{let e=t.constructor.name,s=Ks(t);return e==="Uint8Array"?[A,"bytes",$e(s)]:[A,"bytes",$e(s),e]},"$"),pa=a((t,e,s)=>{switch(e){case"builtin-array-buffer":return[A,"bytes",$e(new Uint8Array(t)),"ArrayBuffer"];case"builtin-date":return[A,"date",s(Ds(t))];case"builtin-error":return ua(t,s);case"builtin-map":return[A,"map",Hs(t).map(([r,i])=>[s(r),s(i)])];case"builtin-set":return[A,"set",Ns(t).map(r=>s(r))];case"builtin-url":return[A,"url",Us(t)];case"builtin-view":return la(t);default:return}},"k"),fa=a((t,e)=>{let s=t.map(r=>N(r,e));return s.length>0&&s[0]===A?[A,"arr",s]:s},"D"),ma=a((t,e)=>{let s={};for(let r of Object.keys(t)){let i=t[r];i!==void 0&&Pt(s,r,N(i,e))}return s},"C"),N=a((t,e=0)=>{if(e>ze)throw new RangeError(`wire-codec: value nesting exceeds the ${String(ze)}-level limit`);if(t===void 0)return[A,"undefined"];if(t===null)return t;if(typeof t=="bigint")return ha(t);if(typeof t=="number")return da(t);if(typeof t!="object")return t;let s=We(t);if(s==="array")return fa(t,e+1);if(s==="plain")return ma(t,e+1);let r=pa(t,s,n=>N(n,e+1));if(r!==void 0)return r;let i=t.constructor?.name??"value";throw new TypeError(`wire-codec: cannot encode a ${i} over the Lunora wire \u2014 only plain objects, arrays, and the supported built-ins (Date, Error, URL, Map, Set, ArrayBuffer/typed arrays, bigint) round-trip`)},"y"),ya=a(t=>{let e=t[2];if(typeof e!="string"||e.length>Ge||!ca.test(e))throw new RangeError(`wire-codec: invalid or over-long bigint (max ${String(Ge)} digits)`);return BigInt(e)},"M"),va=a((t,e)=>{let s=e(t[2]);if(typeof s!="number")throw new TypeError("wire-codec: malformed date \u2014 epoch must be a number");return new Date(s)},"F"),ga=a((t,e)=>{let s=t[2];return new Map(s.map(r=>{if(!Array.isArray(r)||r.length!==2)throw new TypeError("wire-codec: malformed map entry \u2014 expected a [key, value] pair");return[e(r[0]),e(r[1])]}))},"G"),ba=a(t=>{let e=t[2];if(typeof e!="string")throw new TypeError("wire-codec: malformed url \u2014 href must be a string");return new URL(e)},"L"),wa=a((t,e)=>{let s=t[2],r=t[3];if(typeof s!="string"||typeof r!="string")throw new TypeError("wire-codec: malformed error \u2014 name and message must be strings");let i=(Object.hasOwn(Bs,s)?Bs[s]:void 0)??Error,n=new i(r);n.name!==s&&Object.defineProperty(n,"name",{configurable:!0,value:s,writable:!0});let o=e(t[4]);if(o===null||typeof o!="object"||Array.isArray(o))throw new TypeError("wire-codec: malformed error \u2014 props must be an object");for(let[c,h]of Object.entries(o))Pt(n,c,h);return t.length>5&&Object.defineProperty(n,"cause",{configurable:!0,value:e(t[5]),writable:!0}),n},"W"),Sa=a(t=>{let e=t[2];if(typeof e!="string")throw new TypeError("wire-codec: malformed bytes \u2014 payload must be a base64 string");let s=aa(e);if($e(s)!==e)throw new TypeError("wire-codec: malformed bytes \u2014 payload must be canonical padded base64");let r=t[3]??"Uint8Array";if(r==="ArrayBuffer")return s.buffer.byteLength===s.byteLength?s.buffer:new Uint8Array(s).buffer;let i=Object.hasOwn(qs,r)?qs[r]:void 0;return i?new i(new Uint8Array(s).buffer):s},"v"),Ca=a((t,e)=>{switch(t[1]){case"-inf":return-1/0;case"arr":return t[2].map(s=>e(s));case"bigint":return ya(t);case"bytes":return Sa(t);case"date":return va(t,e);case"error":return wa(t,e);case"inf":return 1/0;case"map":return ga(t,e);case"nan":return Number.NaN;case"set":return new Set(t[2].map(s=>e(s)));case"undefined":return;case"url":return ba(t);default:return t.map(s=>e(s))}},"Y"),ka=a((t,e)=>{let s={};for(let r of Object.keys(t))Pt(s,r,T(t[r],e));return s},"H"),T=a((t,e=0)=>{if(e>ze)throw new RangeError(`wire-codec: value nesting exceeds the ${String(ze)}-level limit`);if(t===null||typeof t!="object")return t;if(Array.isArray(t)){let s=t;return s[0]===A?Ca(s,r=>T(r,e+1)):s.map(r=>T(r,e+1))}return ka(t,e+1)},"f"),Ws=a(t=>{let e=JSON.parse(t);return t.includes(A)||t.includes(String.raw`\u`)?T(e):e},"J"),Ta=a(t=>{try{let e=Ws(t);return Ft(e)?e:void 0}catch{return}},"X");var q=a(t=>Ee(N(t)),"a");var le=H(ne(),1),$s=H(Et(),1);var Ie=le.createContext(void 0),Re=a(t=>{let e=le.useContext(Ie);if(t)return t;if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},"useQueryClient"),Lt=a(({client:t,children:e})=>(le.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),(0,$s.jsx)(Ie.Provider,{value:t,children:e})),"QueryClientProvider");var j=class{static{a(this,"Subscribable")}constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}};var Oa=class extends j{static{a(this,"FocusManager")}#e;#t;#s;constructor(){super(),this.#s=t=>{if(typeof window<"u"&&window.addEventListener){let e=a(()=>t(),"listener");return window.addEventListener("visibilitychange",e,!1),()=>{window.removeEventListener("visibilitychange",e)}}}}onSubscribe(){this.#t||this.setEventListener(this.#s)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(t){this.#s=t,this.#t?.(),this.#t=t(e=>{typeof e=="boolean"?this.setFocused(e):this.onFocus()})}setFocused(t){this.#e!==t&&(this.#e=t,this.onFocus())}onFocus(){let t=this.isFocused();this.listeners.forEach(e=>{e(t)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},pe=new Oa;var Ea={setTimeout:a((t,e)=>setTimeout(t,e),"setTimeout"),clearTimeout:a(t=>clearTimeout(t),"clearTimeout"),setInterval:a((t,e)=>setInterval(t,e),"setInterval"),clearInterval:a(t=>clearInterval(t),"clearInterval")},Ia=class{static{a(this,"TimeoutManager")}#e=Ea;#t=!1;setTimeoutProvider(t){this.#e=t}setTimeout(t,e){return this.#e.setTimeout(t,e)}clearTimeout(t){this.#e.clearTimeout(t)}setInterval(t,e){return this.#e.setInterval(t,e)}clearInterval(t){this.#e.clearInterval(t)}},J=new Ia;function zs(t){setTimeout(t,0)}a(zs,"systemSetTimeoutZero");var xt=typeof window>"u"||"Deno"in globalThis;function O(){}a(O,"noop");function Js(t,e){return typeof t=="function"?t(e):t}a(Js,"functionalUpdate");function Ae(t){return typeof t=="number"&&t>=0&&t!==1/0}a(Ae,"isValidTimeout");function Ve(t,e){return Math.max(t+(e||0)-Date.now(),0)}a(Ve,"timeUntilStale");function B(t,e){return typeof t=="function"?t(e):t}a(B,"resolveStaleTime");function x(t,e){return typeof t=="function"?t(e):t}a(x,"resolveQueryBoolean");function Je(t,e){let{type:s="all",exact:r,fetchStatus:i,predicate:n,queryKey:o,stale:c}=t;if(o){if(r){if(e.queryHash!==Fe(o,e.options))return!1}else if(!ae(e.queryKey,o))return!1}if(s!=="all"){let h=e.isActive();if(s==="active"&&!h||s==="inactive"&&h)return!1}return!(typeof c=="boolean"&&e.isStale()!==c||i&&i!==e.state.fetchStatus||n&&!n(e))}a(Je,"matchQuery");function Ye(t,e){let{exact:s,status:r,predicate:i,mutationKey:n}=t;if(n){if(!e.options.mutationKey)return!1;if(s){if(Y(e.options.mutationKey)!==Y(n))return!1}else if(!ae(e.options.mutationKey,n))return!1}return!(r&&e.state.status!==r||i&&!i(e))}a(Ye,"matchMutation");function Fe(t,e){return(e?.queryKeyHashFn||Y)(t)}a(Fe,"hashQueryKeyByOptions");function Y(t){return JSON.stringify(t,(e,s)=>Mt(s)?Object.keys(s).sort().reduce((r,i)=>(r[i]=s[i],r),{}):s)}a(Y,"hashKey");function ae(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(Array.isArray(t)&&Array.isArray(e)){for(let r=0;r<e.length;r++)if(!ae(t[r],e[r]))return!1;return!0}let s=Object.keys(e);for(let r of s)if(!ae(t[r],e[r]))return!1;return!0}return!1}a(ae,"partialMatchKey");var Ra=Object.prototype.hasOwnProperty;function _t(t,e,s=0){if(t===e)return t;if(s>500)return e;let r=Gs(t)&&Gs(e);if(!r&&!(Mt(t)&&Mt(e)))return e;let n=(r?t:Object.keys(t)).length,o=r?e:Object.keys(e),c=o.length,h=r?new Array(c):{},u=0;for(let d=0;d<c;d++){let l=r?d:o[d],p=t[l],f=e[l];if(p===f){h[l]=p,(r?d<n:Ra.call(t,l))&&u++;continue}if(p===null||f===null||typeof p!="object"||typeof f!="object"){h[l]=f;continue}let y=_t(p,f,s+1);h[l]=y,y===p&&u++}return n===c&&u===n?t:h}a(_t,"replaceEqualDeep");function fe(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(let s in t)if(t[s]!==e[s])return!1;return!0}a(fe,"shallowEqualObjects");function Gs(t){return Array.isArray(t)&&t.length===Object.keys(t).length}a(Gs,"isPlainArray");function Mt(t){if(!Vs(t))return!1;let e=t.constructor;if(e===void 0)return!0;let s=e.prototype;return!(!Vs(s)||!s.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}a(Mt,"isPlainObject");function Vs(t){return Object.prototype.toString.call(t)==="[object Object]"}a(Vs,"hasObjectPrototype");function Ys(t){return new Promise(e=>{J.setTimeout(e,t)})}a(Ys,"sleep");function Pe(t,e,s){return typeof s.structuralSharing=="function"?s.structuralSharing(t,e):s.structuralSharing!==!1?_t(t,e):e}a(Pe,"replaceData");function Aa(t){return t}a(Aa,"keepPreviousData");function Xs(t,e,s=0){let r=[...t,e];return s&&r.length>s?r.slice(1):r}a(Xs,"addToEnd");function Zs(t,e,s=0){let r=[e,...t];return s&&r.length>s?r.slice(0,-1):r}a(Zs,"addToStart");var me=Symbol();function Xe(t,e){return!t.queryFn&&e?.initialPromise?()=>e.initialPromise:!t.queryFn||t.queryFn===me?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}a(Xe,"ensureQueryFn");function ye(t,e){return typeof t=="function"?t(...e):!!t}a(ye,"shouldThrowError");function er(t,e,s){let r=!1,i;return Object.defineProperty(t,"signal",{enumerable:!0,get:a(()=>(i??=e(),r||(r=!0,i.aborted?s():i.addEventListener("abort",s,{once:!0})),i),"get")}),t}a(er,"addConsumeAwareSignal");var X=(()=>{let t=a(()=>xt,"isServerFn");return{isServer(){return t()},setIsServer(e){t=e}}})();function Le(){let t,e,s=new Promise((i,n)=>{t=i,e=n});s.status="pending",s.catch(()=>{});function r(i){Object.assign(s,i),delete s.resolve,delete s.reject}return a(r,"finalize"),s.resolve=i=>{r({status:"fulfilled",value:i}),t(i)},s.reject=i=>{r({status:"rejected",reason:i}),e(i)},s}a(Le,"pendingThenable");var tr=zs;function Fa(){let t=[],e=0,s=a(c=>{c()},"notifyFn"),r=a(c=>{c()},"batchNotifyFn"),i=tr,n=a(c=>{e?t.push(c):i(()=>{s(c)})},"schedule"),o=a(()=>{let c=t;t=[],c.length&&i(()=>{r(()=>{c.forEach(h=>{s(h)})})})},"flush");return{batch:a(c=>{let h;e++;try{h=c()}finally{e--,e||o()}return h},"batch"),batchCalls:a(c=>(...h)=>{n(()=>{c(...h)})},"batchCalls"),schedule:n,setNotifyFunction:a(c=>{s=c},"setNotifyFunction"),setBatchNotifyFunction:a(c=>{r=c},"setBatchNotifyFunction"),setScheduler:a(c=>{i=c},"setScheduler")}}a(Fa,"createNotifyManager");var C=Fa();var Pa=class extends j{static{a(this,"OnlineManager")}#e=!0;#t;#s;constructor(){super(),this.#s=t=>{if(typeof window<"u"&&window.addEventListener){let e=a(()=>t(!0),"onlineListener"),s=a(()=>t(!1),"offlineListener");return window.addEventListener("online",e,!1),window.addEventListener("offline",s,!1),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",s)}}}}onSubscribe(){this.#t||this.setEventListener(this.#s)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(t){this.#s=t,this.#t?.(),this.#t=t(this.setOnline.bind(this))}setOnline(t){this.#e!==t&&(this.#e=t,this.listeners.forEach(s=>{s(t)}))}isOnline(){return this.#e}},ve=new Pa;function La(t){return Math.min(1e3*2**t,3e4)}a(La,"defaultRetryDelay");function Qt(t){return(t??"online")==="online"?ve.isOnline():!0}a(Qt,"canFetch");var Ze=class extends Error{static{a(this,"CancelledError")}constructor(t){super("CancelledError"),this.revert=t?.revert,this.silent=t?.silent}};function et(t){let e=!1,s=0,r,i=Le(),n=a(()=>i.status!=="pending","isResolved"),o=a(m=>{if(!n()){let g=new Ze(m);p(g),t.onCancel?.(g)}},"cancel"),c=a(()=>{e=!0},"cancelRetry"),h=a(()=>{e=!1},"continueRetry"),u=a(()=>pe.isFocused()&&(t.networkMode==="always"||ve.isOnline())&&t.canRun(),"canContinue"),d=a(()=>Qt(t.networkMode)&&t.canRun(),"canStart"),l=a(m=>{n()||(r?.(),i.resolve(m))},"resolve"),p=a(m=>{n()||(r?.(),i.reject(m))},"reject"),f=a(()=>new Promise(m=>{r=a(g=>{(n()||u())&&m(g)},"continueFn"),t.onPause?.()}).then(()=>{r=void 0,n()||t.onContinue?.()}),"pause"),y=a(()=>{if(n())return;let m,g=s===0?t.initialPromise:void 0;try{m=g??t.fn()}catch(w){m=Promise.reject(w)}Promise.resolve(m).then(l).catch(w=>{if(n())return;let k=t.retry??(X.isServer()?0:3),E=t.retryDelay??La,S=typeof E=="function"?E(s,w):E,I=k===!0||typeof k=="number"&&s<k||typeof k=="function"&&k(s,w);if(e||!I){p(w);return}s++,t.onFail?.(s,w),Ys(S).then(()=>u()?void 0:f()).then(()=>{e?p(w):y()})})},"run");return{promise:i,status:a(()=>i.status,"status"),cancel:o,continue:a(()=>(r?.(),i),"continue"),cancelRetry:c,continueRetry:h,canStart:d,start:a(()=>(d()?y():f().then(y),i),"start")}}a(et,"createRetryer");var tt=class{static{a(this,"Removable")}#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Ae(this.gcTime)&&(this.#e=J.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(X.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(J.clearTimeout(this.#e),this.#e=void 0)}};function rr(t){return{onFetch:a((e,s)=>{let r=e.options,i=e.fetchOptions?.meta?.fetchMore?.direction,n=e.state.data?.pages||[],o=e.state.data?.pageParams||[],c={pages:[],pageParams:[]},h=0,u=a(async()=>{let d=!1,l=a(y=>{er(y,()=>e.signal,()=>d=!0)},"addSignalProperty"),p=Xe(e.options,e.fetchOptions),f=a(async(y,m,g)=>{if(d)return Promise.reject(e.signal.reason);if(m==null&&y.pages.length)return Promise.resolve(y);let k=a(()=>{let ie={client:e.client,queryKey:e.queryKey,pageParam:m,direction:g?"backward":"forward",meta:e.options.meta};return l(ie),ie},"createQueryFnContext")(),E=await p(k),{maxPages:S}=e.options,I=g?Zs:Xs;return{pages:I(y.pages,E,S),pageParams:I(y.pageParams,m,S)}},"fetchPage");if(i&&n.length){let y=i==="backward",m=y?Ma:sr,g={pages:n,pageParams:o},w=m(r,g);c=await f(g,w,y)}else{let y=t??n.length;do{let m=h===0?o[0]??r.initialPageParam:sr(r,c);if(h>0&&m==null)break;c=await f(c,m),h++}while(h<y)}return c},"fetchFn");e.options.persister?e.fetchFn=()=>e.options.persister?.(u,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},s):e.fetchFn=u},"onFetch")}}a(rr,"infiniteQueryBehavior");function sr(t,{pages:e,pageParams:s}){let r=e.length-1;return e.length>0?t.getNextPageParam(e[r],e,s[r],s):void 0}a(sr,"getNextPageParam");function Ma(t,{pages:e,pageParams:s}){return e.length>0?t.getPreviousPageParam?.(e[0],e,s[0],s):void 0}a(Ma,"getPreviousPageParam");var ar=class extends tt{static{a(this,"Query")}#e;#t;#s;#r;#n;#i;#o;#a;constructor(t){super(),this.#a=!1,this.#o=t.defaultOptions,this.setOptions(t.options),this.observers=[],this.#n=t.client,this.#r=this.#n.getQueryCache(),this.queryKey=t.queryKey,this.queryHash=t.queryHash,this.#t=nr(this.options),this.state=t.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#i?.promise}setOptions(t){if(this.options={...this.#o,...t},t?._type&&(this.#e=t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=nr(this.options);e.data!==void 0&&(this.setState(ir(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#r.remove(this)}setData(t,e){let s=Pe(this.state.data,t,this.options);return this.#c({data:s,type:"success",dataUpdatedAt:e?.updatedAt,manual:e?.manual}),s}setState(t){this.#c({type:"setState",state:t})}cancel(t){let e=this.#i?.promise;return this.#i?.cancel(t),e?e.then(O).catch(O):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>x(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===me||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>B(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!Ve(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#i?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#i?.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(e=>e!==t),this.observers.length||(this.#i&&(this.#a||this.#d()?this.#i.cancel({revert:!0}):this.#i.cancelRetry()),this.scheduleGc()),this.#r.notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}#d(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"}invalidate(){this.state.isInvalidated||this.#c({type:"invalidate"})}async fetch(t,e){if(this.state.fetchStatus!=="idle"&&this.#i?.status()!=="rejected"){if(this.state.data!==void 0&&e?.cancelRefetch)this.cancel({silent:!0});else if(this.#i)return this.#i.continueRetry(),this.#i.promise}if(t&&this.setOptions(t),!this.options.queryFn){let h=this.observers.find(u=>u.options.queryFn);h&&this.setOptions(h.options)}let s=new AbortController,r=a(h=>{Object.defineProperty(h,"signal",{enumerable:!0,get:a(()=>(this.#a=!0,s.signal),"get")})},"addSignalProperty"),i=a(()=>{let h=Xe(this.options,e),d=a(()=>{let l={client:this.#n,queryKey:this.queryKey,meta:this.meta};return r(l),l},"createQueryFnContext")();return this.#a=!1,this.options.persister?this.options.persister(h,d,this):h(d)},"fetchFn"),o=a(()=>{let h={fetchOptions:e,options:this.options,queryKey:this.queryKey,client:this.#n,state:this.state,fetchFn:i};return r(h),h},"createFetchContext")();(this.#e==="infinite"?rr(this.options.pages):this.options.behavior)?.onFetch(o,this),this.#s=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==o.fetchOptions?.meta)&&this.#c({type:"fetch",meta:o.fetchOptions?.meta}),this.#i=et({initialPromise:e?.initialPromise,fn:o.fetchFn,onCancel:a(h=>{h instanceof Ze&&h.revert&&this.setState({...this.#s,fetchStatus:"idle"}),s.abort()},"onCancel"),onFail:a((h,u)=>{this.#c({type:"failed",failureCount:h,error:u})},"onFail"),onPause:a(()=>{this.#c({type:"pause"})},"onPause"),onContinue:a(()=>{this.#c({type:"continue"})},"onContinue"),retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:a(()=>!0,"canRun")});try{let h=await this.#i.start();if(h===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(h),this.#r.config.onSuccess?.(h,this),this.#r.config.onSettled?.(h,this.state.error,this),h}catch(h){if(h instanceof Ze){if(h.silent)return this.#i.promise;if(h.revert){if(this.state.data===void 0)throw h;return this.state.data}}throw this.#c({type:"error",error:h}),this.#r.config.onError?.(h,this),this.#r.config.onSettled?.(this.state.data,h,this),h}finally{this.scheduleGc()}}#c(t){let e=a(s=>{switch(t.type){case"failed":return{...s,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...s,fetchStatus:"paused"};case"continue":return{...s,fetchStatus:"fetching"};case"fetch":return{...s,...Dt(s.data,this.options),fetchMeta:t.meta??null};case"success":let r={...s,...ir(t.data,t.dataUpdatedAt),dataUpdateCount:s.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#s=t.manual?r:void 0,r;case"error":let i=t.error;return{...s,error:i,errorUpdateCount:s.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:s.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...s,isInvalidated:!0};case"setState":return{...s,...t.state}}},"reducer");this.state=e(this.state),C.batch(()=>{this.observers.forEach(s=>{s.onQueryUpdate()}),this.#r.notify({query:this,type:"updated",action:t})})}};function Dt(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Qt(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}a(Dt,"fetchState");function ir(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}a(ir,"successState");function nr(t){let e=typeof t.initialData=="function"?t.initialData():t.initialData,s=e!==void 0,r=s?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:s?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:s?"success":"pending",fetchStatus:"idle"}}a(nr,"getDefaultState");var Ht=class extends j{static{a(this,"QueryObserver")}constructor(t,e){super(),this.options=e,this.#e=t,this.#a=null,this.#o=Le(),this.bindMethods(),this.setOptions(e)}#e;#t=void 0;#s=void 0;#r=void 0;#n;#i;#o;#a;#d;#c;#f;#u;#l;#h;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),or(this.#t,this.options)?this.#p():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Ut(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Ut(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#w(),this.#S(),this.#t.removeObserver(this)}setOptions(t){let e=this.options,s=this.#t;if(this.options=this.#e.defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof x(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#C(),this.#t.setOptions(this.options),e._defaulted&&!fe(this.options,e)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});let r=this.hasListeners();r&&cr(this.#t,s,this.options,e)&&this.#p(),this.updateResult(),r&&(this.#t!==s||x(this.options.enabled,this.#t)!==x(e.enabled,this.#t)||B(this.options.staleTime,this.#t)!==B(e.staleTime,this.#t))&&this.#y();let i=this.#v();r&&(this.#t!==s||x(this.options.enabled,this.#t)!==x(e.enabled,this.#t)||i!==this.#h)&&this.#g(i)}getOptimisticResult(t){let e=this.#e.getQueryCache().build(this.#e,t),s=this.createResult(e,t);return _a(this,s)&&(this.#r=s,this.#i=this.options,this.#n=this.#t.state),s}getCurrentResult(){return this.#r}trackResult(t,e){return new Proxy(t,{get:a((s,r)=>(this.trackProp(r),e?.(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#o.status==="pending"&&this.#o.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(s,r)),"get")})}trackProp(t){this.#m.add(t)}getCurrentQuery(){return this.#t}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){let e=this.#e.defaultQueryOptions(t),s=this.#e.getQueryCache().build(this.#e,e);return s.fetch().then(()=>this.createResult(s,e))}fetch(t){return this.#p({...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#p(t){this.#C();let e=this.#t.fetch(this.options,t);return t?.throwOnError||(e=e.catch(O)),e}#y(){this.#w();let t=B(this.options.staleTime,this.#t);if(X.isServer()||this.#r.isStale||!Ae(t))return;let s=Ve(this.#r.dataUpdatedAt,t)+1;this.#u=J.setTimeout(()=>{this.#r.isStale||this.updateResult()},s)}#v(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#g(t){this.#S(),this.#h=t,!(X.isServer()||x(this.options.enabled,this.#t)===!1||!Ae(this.#h)||this.#h===0)&&(this.#l=J.setInterval(()=>{(this.options.refetchIntervalInBackground||pe.isFocused())&&this.#p()},this.#h))}#b(){this.#y(),this.#g(this.#v())}#w(){this.#u!==void 0&&(J.clearTimeout(this.#u),this.#u=void 0)}#S(){this.#l!==void 0&&(J.clearInterval(this.#l),this.#l=void 0)}createResult(t,e){let s=this.#t,r=this.options,i=this.#r,n=this.#n,o=this.#i,h=t!==s?t.state:this.#s,{state:u}=t,d={...u},l=!1,p;if(e._optimisticResults){let F=this.hasListeners(),R=!F&&or(t,e),Z=F&&cr(t,s,e,r);(R||Z)&&(d={...d,...Dt(u.data,t.options)}),e._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:f,errorUpdatedAt:y,status:m}=d;p=d.data;let g=!1;if(e.placeholderData!==void 0&&p===void 0&&m==="pending"){let F;i?.isPlaceholderData&&e.placeholderData===o?.placeholderData?(F=i.data,g=!0):F=typeof e.placeholderData=="function"?e.placeholderData(this.#f?.state.data,this.#f):e.placeholderData,F!==void 0&&(m="success",p=Pe(i?.data,F,e),l=!0)}if(e.select&&p!==void 0&&!g)if(i&&p===n?.data&&e.select===this.#d)p=this.#c;else try{this.#d=e.select,p=e.select(p),p=Pe(i?.data,p,e),this.#c=p,this.#a=null}catch(F){this.#a=F}this.#a&&(f=this.#a,p=this.#c,y=Date.now(),m="error");let w=d.fetchStatus==="fetching",k=m==="pending",E=m==="error",S=k&&w,I=p!==void 0,M={status:m,fetchStatus:d.fetchStatus,isPending:k,isSuccess:m==="success",isError:E,isInitialLoading:S,isLoading:S,data:p,dataUpdatedAt:d.dataUpdatedAt,error:f,errorUpdatedAt:y,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:d.dataUpdateCount>h.dataUpdateCount||d.errorUpdateCount>h.errorUpdateCount,isFetching:w,isRefetching:w&&!k,isLoadingError:E&&!I,isPaused:d.fetchStatus==="paused",isPlaceholderData:l,isRefetchError:E&&I,isStale:Nt(t,e),refetch:this.refetch,promise:this.#o,isEnabled:x(e.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){let F=M.data!==void 0,R=M.status==="error"&&!F,Z=a(Be=>{R?Be.reject(M.error):F&&Be.resolve(M.data)},"finalizeThenableIfPossible"),As=a(()=>{let Be=this.#o=M.promise=Le();Z(Be)},"recreateThenable"),qe=this.#o;switch(qe.status){case"pending":t.queryHash===s.queryHash&&Z(qe);break;case"fulfilled":(R||M.data!==qe.value)&&As();break;case"rejected":(!R||M.error!==qe.reason)&&As();break}}return M}updateResult(){let t=this.#r,e=this.createResult(this.#t,this.options);if(this.#n=this.#t.state,this.#i=this.options,this.#n.data!==void 0&&(this.#f=this.#t),fe(e,t))return;this.#r=e;let s=a(()=>{if(!t)return!0;let{notifyOnChangeProps:r}=this.options,i=typeof r=="function"?r():r;if(i==="all"||!i&&!this.#m.size)return!0;let n=new Set(i??this.#m);return this.options.throwOnError&&n.add("error"),Object.keys(this.#r).some(o=>{let c=o;return this.#r[c]!==t[c]&&n.has(c)})},"shouldNotifyListeners");this.#k({listeners:s()})}#C(){let t=this.#e.getQueryCache().build(this.#e,this.options);if(t===this.#t)return;let e=this.#t;this.#t=t,this.#s=t.state,this.hasListeners()&&(e?.removeObserver(this),t.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#b()}#k(t){C.batch(()=>{t.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function xa(t,e){return x(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&x(e.retryOnMount,t)===!1)}a(xa,"shouldLoadOnMount");function or(t,e){return xa(t,e)||t.state.data!==void 0&&Ut(t,e,e.refetchOnMount)}a(or,"shouldFetchOnMount");function Ut(t,e,s){if(x(e.enabled,t)!==!1&&B(e.staleTime,t)!=="static"){let r=typeof s=="function"?s(t):s;return r==="always"||r!==!1&&Nt(t,e)}return!1}a(Ut,"shouldFetchOn");function cr(t,e,s,r){return(t!==e||x(r.enabled,t)===!1)&&(!s.suspense||t.state.status!=="error")&&Nt(t,s)}a(cr,"shouldFetchOptionally");function Nt(t,e){return x(e.enabled,t)!==!1&&t.isStaleByTime(B(e.staleTime,t))}a(Nt,"isStale");function _a(t,e){return!fe(t.getCurrentResult(),e)}a(_a,"shouldAssignObserverCurrentProperties");var hr=class extends tt{static{a(this,"Mutation")}#e;#t;#s;#r;constructor(t){super(),this.#e=t.client,this.mutationId=t.mutationId,this.#s=t.mutationCache,this.#t=[],this.state=t.state||Kt(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){this.#t.includes(t)||(this.#t.push(t),this.clearGcTimeout(),this.#s.notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){this.#t=this.#t.filter(e=>e!==t),this.scheduleGc(),this.#s.notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#s.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(t){let e=a(()=>{this.#n({type:"continue"})},"onContinue"),s={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=et({fn:a(()=>this.options.mutationFn?this.options.mutationFn(t,s):Promise.reject(new Error("No mutationFn found")),"fn"),onFail:a((n,o)=>{this.#n({type:"failed",failureCount:n,error:o})},"onFail"),onPause:a(()=>{this.#n({type:"pause"})},"onPause"),onContinue:e,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:a(()=>this.#s.canRun(this),"canRun")});let r=this.state.status==="pending",i=!this.#r.canStart();try{if(r)e();else{this.#n({type:"pending",variables:t,isPaused:i}),this.#s.config.onMutate&&await this.#s.config.onMutate(t,this,s);let o=await this.options.onMutate?.(t,s);o!==this.state.context&&this.#n({type:"pending",context:o,variables:t,isPaused:i})}let n=await this.#r.start();return await this.#s.config.onSuccess?.(n,t,this.state.context,this,s),await this.options.onSuccess?.(n,t,this.state.context,s),await this.#s.config.onSettled?.(n,null,this.state.variables,this.state.context,this,s),await this.options.onSettled?.(n,null,t,this.state.context,s),this.#n({type:"success",data:n}),n}catch(n){try{await this.#s.config.onError?.(n,t,this.state.context,this,s)}catch(o){Promise.reject(o)}try{await this.options.onError?.(n,t,this.state.context,s)}catch(o){Promise.reject(o)}try{await this.#s.config.onSettled?.(void 0,n,this.state.variables,this.state.context,this,s)}catch(o){Promise.reject(o)}try{await this.options.onSettled?.(void 0,n,t,this.state.context,s)}catch(o){Promise.reject(o)}throw this.#n({type:"error",error:n}),n}finally{this.#s.runNext(this)}}#n(t){let e=a(s=>{switch(t.type){case"failed":return{...s,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...s,isPaused:!0};case"continue":return{...s,isPaused:!1};case"pending":return{...s,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...s,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...s,data:void 0,error:t.error,failureCount:s.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}},"reducer");this.state=e(this.state),C.batch(()=>{this.#t.forEach(s=>{s.onMutationUpdate(t)}),this.#s.notify({mutation:this,type:"updated",action:t})})}};function Kt(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}a(Kt,"getDefaultState");var dr=class extends j{static{a(this,"MutationCache")}constructor(t={}){super(),this.config=t,this.#e=new Set,this.#t=new Map,this.#s=0}#e;#t;#s;build(t,e,s){let r=new hr({client:t,mutationCache:this,mutationId:++this.#s,options:t.defaultMutationOptions(e),state:s});return this.add(r),r}add(t){this.#e.add(t);let e=st(t);if(typeof e=="string"){let s=this.#t.get(e);s?s.push(t):this.#t.set(e,[t])}this.notify({type:"added",mutation:t})}remove(t){if(this.#e.delete(t)){let e=st(t);if(typeof e=="string"){let s=this.#t.get(e);if(s)if(s.length>1){let r=s.indexOf(t);r!==-1&&s.splice(r,1)}else s[0]===t&&this.#t.delete(e)}}this.notify({type:"removed",mutation:t})}canRun(t){let e=st(t);if(typeof e=="string"){let r=this.#t.get(e)?.find(i=>i.state.status==="pending");return!r||r===t}else return!0}runNext(t){let e=st(t);return typeof e=="string"?this.#t.get(e)?.find(r=>r!==t&&r.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){C.batch(()=>{this.#e.forEach(t=>{this.notify({type:"removed",mutation:t})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(t){let e={exact:!0,...t};return this.getAll().find(s=>Ye(e,s))}findAll(t={}){return this.getAll().filter(e=>Ye(t,e))}notify(t){C.batch(()=>{this.listeners.forEach(e=>{e(t)})})}resumePausedMutations(){let t=this.getAll().filter(e=>e.state.isPaused);return C.batch(()=>Promise.all(t.map(e=>e.continue().catch(O))))}};function st(t){return t.options.scope?.id}a(st,"scopeFor");var jt=class extends j{static{a(this,"MutationObserver")}#e;#t=void 0;#s;#r;constructor(t,e){super(),this.#e=t,this.setOptions(e),this.bindMethods(),this.#n()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){let e=this.options;this.options=this.#e.defaultMutationOptions(t),fe(this.options,e)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#s,observer:this}),e?.mutationKey&&this.options.mutationKey&&Y(e.mutationKey)!==Y(this.options.mutationKey)?this.reset():this.#s?.state.status==="pending"&&this.#s.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#s?.removeObserver(this)}onMutationUpdate(t){this.#n(),this.#i(t)}getCurrentResult(){return this.#t}reset(){this.#s?.removeObserver(this),this.#s=void 0,this.#n(),this.#i()}mutate(t,e){return this.#r=e,this.#s?.removeObserver(this),this.#s=this.#e.getMutationCache().build(this.#e,this.options),this.#s.addObserver(this),this.#s.execute(t)}#n(){let t=this.#s?.state??Kt();this.#t={...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset}}#i(t){C.batch(()=>{if(this.#r&&this.hasListeners()){let e=this.#t.variables,s=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(t?.type==="success"){try{this.#r.onSuccess?.(t.data,e,s,r)}catch(i){Promise.reject(i)}try{this.#r.onSettled?.(t.data,null,e,s,r)}catch(i){Promise.reject(i)}}else if(t?.type==="error"){try{this.#r.onError?.(t.error,e,s,r)}catch(i){Promise.reject(i)}try{this.#r.onSettled?.(void 0,t.error,e,s,r)}catch(i){Promise.reject(i)}}}this.listeners.forEach(e=>{e(this.#t)})})}};var ur=class extends j{static{a(this,"QueryCache")}constructor(t={}){super(),this.config=t,this.#e=new Map}#e;build(t,e,s){let r=e.queryKey,i=e.queryHash??Fe(r,e),n=this.get(i);return n||(n=new ar({client:t,queryKey:r,queryHash:i,options:t.defaultQueryOptions(e),state:s,defaultOptions:t.getQueryDefaults(r)}),this.add(n)),n}add(t){this.#e.has(t.queryHash)||(this.#e.set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){let e=this.#e.get(t.queryHash);e&&(t.destroy(),e===t&&this.#e.delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){C.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return this.#e.get(t)}getAll(){return[...this.#e.values()]}find(t){let e={exact:!0,...t};return this.getAll().find(s=>Je(e,s))}findAll(t={}){let e=this.getAll();return Object.keys(t).length>0?e.filter(s=>Je(t,s)):e}notify(t){C.batch(()=>{this.listeners.forEach(e=>{e(t)})})}onFocus(){C.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){C.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}};var qt=class{static{a(this,"QueryClient")}#e;#t;#s;#r;#n;#i;#o;#a;constructor(t={}){this.#e=t.queryCache||new ur,this.#t=t.mutationCache||new dr,this.#s=t.defaultOptions||{},this.#r=new Map,this.#n=new Map,this.#i=0}mount(){this.#i++,this.#i===1&&(this.#o=pe.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#a=ve.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#i--,this.#i===0&&(this.#o?.(),this.#o=void 0,this.#a?.(),this.#a=void 0)}isFetching(t){return this.#e.findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return this.#t.findAll({...t,status:"pending"}).length}getQueryData(t){let e=this.defaultQueryOptions({queryKey:t});return this.#e.get(e.queryHash)?.state.data}ensureQueryData(t){let e=this.defaultQueryOptions(t),s=this.#e.build(this,e),r=s.state.data;return r===void 0?this.fetchQuery(t):(t.revalidateIfStale&&s.isStaleByTime(B(e.staleTime,s))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return this.#e.findAll(t).map(({queryKey:e,state:s})=>{let r=s.data;return[e,r]})}setQueryData(t,e,s){let r=this.defaultQueryOptions({queryKey:t}),n=this.#e.get(r.queryHash)?.state.data,o=Js(e,n);if(o!==void 0)return this.#e.build(this,r).setData(o,{...s,manual:!0})}setQueriesData(t,e,s){return C.batch(()=>this.#e.findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,s)]))}getQueryState(t){let e=this.defaultQueryOptions({queryKey:t});return this.#e.get(e.queryHash)?.state}removeQueries(t){let e=this.#e;C.batch(()=>{e.findAll(t).forEach(s=>{e.remove(s)})})}resetQueries(t,e){let s=this.#e;return C.batch(()=>(s.findAll(t).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){let s={revert:!0,...e},r=C.batch(()=>this.#e.findAll(t).map(i=>i.cancel(s)));return Promise.all(r).then(O).catch(O)}invalidateQueries(t,e={}){return C.batch(()=>(this.#e.findAll(t).forEach(s=>{s.invalidate()}),t?.refetchType==="none"?Promise.resolve():this.refetchQueries({...t,type:t?.refetchType??t?.type??"active"},e)))}refetchQueries(t,e={}){let s={...e,cancelRefetch:e.cancelRefetch??!0},r=C.batch(()=>this.#e.findAll(t).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let n=i.fetch(void 0,s);return s.throwOnError||(n=n.catch(O)),i.state.fetchStatus==="paused"?Promise.resolve():n}));return Promise.all(r).then(O)}fetchQuery(t){let e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);let s=this.#e.build(this,e);return s.isStaleByTime(B(e.staleTime,s))?s.fetch(e):Promise.resolve(s.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(O).catch(O)}fetchInfiniteQuery(t){return t._type="infinite",this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(O).catch(O)}ensureInfiniteQueryData(t){return t._type="infinite",this.ensureQueryData(t)}resumePausedMutations(){return ve.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#s}setDefaultOptions(t){this.#s=t}setQueryDefaults(t,e){this.#r.set(Y(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){let e=[...this.#r.values()],s={};return e.forEach(r=>{ae(t,r.queryKey)&&Object.assign(s,r.defaultOptions)}),s}setMutationDefaults(t,e){this.#n.set(Y(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){let e=[...this.#n.values()],s={};return e.forEach(r=>{ae(t,r.mutationKey)&&Object.assign(s,r.defaultOptions)}),s}defaultQueryOptions(t){if(t._defaulted)return t;let e={...this.#s.queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=Fe(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===me&&(e.enabled=!1),e}defaultMutationOptions(t){return t?._defaulted?t:{...this.#s.mutations,...t?.mutationKey&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}};var oe=H(ne(),1);var Me=H(ne(),1),Qa=H(Et(),1);function Da(){let t=!1;return{clearReset:a(()=>{t=!1},"clearReset"),reset:a(()=>{t=!0},"reset"),isReset:a(()=>t,"isReset")}}a(Da,"createValue");var Ua=Me.createContext(Da()),lr=a(()=>Me.useContext(Ua),"useQueryErrorResetBoundary");var pr=H(ne(),1);var fr=a((t,e,s)=>{let r=s?.state.error&&typeof t.throwOnError=="function"?ye(t.throwOnError,[s.state.error,s]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||r)&&(e.isReset()||(t.retryOnMount=!1))},"ensurePreventErrorBoundaryRetry"),mr=a(t=>{pr.useEffect(()=>{t.clearReset()},[t])},"useClearResetErrorBoundary"),yr=a(({result:t,errorResetBoundary:e,throwOnError:s,query:r,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(i&&t.data===void 0||ye(s,[t.error,r])),"getHasError");var rt=H(ne(),1);var vr=rt.createContext(!1),gr=a(()=>rt.useContext(vr),"useIsRestoring"),nl=vr.Provider;var br=a(t=>{if(t.suspense){let s=a(i=>i==="static"?i:Math.max(i??1e3,1e3),"clamp"),r=t.staleTime;t.staleTime=typeof r=="function"?(...i)=>s(r(...i)):s(r),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},"ensureSuspenseTimers"),wr=a((t,e)=>t.isLoading&&t.isFetching&&!e,"willFetch"),Sr=a((t,e)=>t?.suspense&&e.isPending,"shouldSuspend"),Bt=a((t,e,s)=>e.fetchOptimistic(t).catch(()=>{s.clearReset()}),"fetchOptimistic");function Cr(t,e,s){let r=gr(),i=lr(),n=Re(s),o=n.defaultQueryOptions(t);n.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let c=n.getQueryCache().get(o.queryHash),h=t.subscribed!==!1;o._optimisticResults=r?"isRestoring":h?"optimistic":void 0,br(o),fr(o,i,c),mr(i);let u=!n.getQueryCache().get(o.queryHash),[d]=oe.useState(()=>new e(n,o)),l=d.getOptimisticResult(o),p=!r&&h;if(oe.useSyncExternalStore(oe.useCallback(f=>{let y=p?d.subscribe(C.batchCalls(f)):O;return d.updateResult(),y},[d,p]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),oe.useEffect(()=>{d.setOptions(o)},[o,d]),Sr(o,l))throw Bt(o,d,i);if(yr({result:l,errorResetBoundary:i,throwOnError:o.throwOnError,query:c,suspense:o.suspense}))throw l.error;return n.getDefaultOptions().queries?._experimental_afterQuery?.(o,l),o.experimental_prefetchInRender&&!X.isServer()&&wr(l,r)&&(u?Bt(o,d,i):c?.promise)?.catch(O).finally(()=>{d.updateResult()}),o.notifyOnChangeProps?l:d.trackResult(l)}a(Cr,"useBaseQuery");function Ha(t,e){return Cr(t,Ht,e)}a(Ha,"useQuery");var ee=H(ne(),1);function Na(t,e){let s=Re(e),[r]=ee.useState(()=>new jt(s,t));ee.useEffect(()=>{r.setOptions(t)},[r,t]);let i=ee.useSyncExternalStore(ee.useCallback(o=>r.subscribe(C.batchCalls(o)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),n=ee.useCallback((o,c)=>{r.mutate(o,c).catch(O)},[r]);if(i.error&&ye(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:n,mutateAsync:i.mutate}}a(Na,"useMutation");var Er=H(Ms(),1);var _=H(ne(),1);var it=H(Et(),1);var Wt=a(t=>q(t),"b");var kr=a(t=>{t!==void 0&&(t.cancel({silent:!0}),t.setState({...t.state,data:void 0,dataUpdatedAt:0,error:null,fetchStatus:"idle",status:"pending"}))},"E"),$t={status:"idle"},Tr=a((t,e)=>{for(let s of t.waiters)s(e);t.waiters.clear()},"F"),Ka=1e4,ja=a(async(t,e,s)=>new Promise((r,i)=>{if(e.aborted){i(e.reason);return}let n,o,c=a(()=>{clearTimeout(n),o?.(),t.waiters.delete(u),e.removeEventListener("abort",h)},"l"),h=a(()=>{c(),i(e.reason)},"t"),u=a(d=>{c(),r(d)},"n");n=setTimeout(()=>{u(!1)},Ka),t.waiters.add(u),e.addEventListener("abort",h,{once:!0}),o=s(()=>{u(!1)}),t.waiters.has(u)||o()}),"U"),Gt=class{static{a(this,"V")}constructor(e){this.client=e}client;entries=new Map;live=new Map;identityWatched=new Set;listening=!1;hasConsumers(e){return this.entries.has(Wt(e))}async liveValue(e,s,r,i){let{fetch:n,shardKey:o,waitForPush:c=!0}=i;if(!("window"in globalThis)||this.client.getWebSocketImpl()===void 0)return n();let h=Wt(s),u=this.liveFor(h),d=u.state.status==="pushed"?e.getQueryData(s)??u.state.value:void 0;if(d!==void 0)return d;if(c&&u.state.status!=="errored"&&!this.client.isCrossTabFollower()&&this.client.expectsPush({shardKey:o})){let f;try{f=await ja(u,r,y=>this.client.onConnectionStatus(()=>{this.client.expectsPush({shardKey:o})||y()}))}finally{this.forgetIdleLive(h)}if(f)return this.liveValue(e,s,r,i)}let l=u.state,p;try{p=await n()}finally{this.forgetIdleLive(h)}if(u.state!==l&&u.state.status==="pushed"){let f=e.getQueryData(s);return f!==void 0?f:u.state.value}return p}clearOnIdentityChange(e){this.listenForIdentityChange(),this.identityWatched.add(e)}stopClearingOnIdentityChange(e){this.identityWatched.delete(e)}subscribeIdentityEpoch=a(e=>(this.listenForIdentityChange(),this.client.onIdentityChange(e)),"subscribeIdentityEpoch");listenForIdentityChange(){this.listening||(this.listening=!0,this.client.onIdentityChange(()=>{for(let e of this.identityWatched)this.clearQueries(e)}))}clearQueries(e){let s=e.getQueryCache();for(let r of s.findAll({queryKey:["lunora"]}))kr(r),r.getObserversCount()===0&&!this.hasConsumers(r.queryKey)&&s.remove(r)}attach(e,s,r,i,n,o={}){let c=Wt(s),h=this.entries.get(c);if(!h){h={clients:new Map([[e,0]]),errorCallbacks:new Set,unsubscribe:void 0},this.entries.set(c,h);let p=h;try{h.unsubscribe=this.client.subscribe(r,i,f=>{let y=this.liveFor(c);if(f===void 0){y.state=$t;for(let m of p.clients.keys())kr(m.getQueryCache().find({exact:!0,queryKey:s}));return}for(let m of p.clients.keys())m.setQueryData(s,f);y.state={status:"pushed",value:f},Tr(y,!0)},{onError:a(f=>{let y=this.liveFor(c);y.state.status!=="pushed"&&(y.state={status:"errored"},Tr(y,!1));for(let m of p.errorCallbacks)m(f)},"onError"),shardKey:n})}catch(f){throw this.entries.delete(c),this.dropLive(c),f}}h.clients.set(e,(h.clients.get(e)??0)+1);let u=this.live.get(c);u?.state.status==="pushed"&&e.setQueryData(s,u.state.value);let{onError:d}=o;d&&h.errorCallbacks.add(d);let l=!1;return()=>{if(l)return;l=!0;let p=this.entries.get(c);if(!p)return;let f=(p.clients.get(e)??1)-1;f>0?p.clients.set(e,f):p.clients.delete(e),d&&p.errorCallbacks.delete(d),p.clients.size===0&&(p.unsubscribe?.(),this.entries.delete(c),this.dropLive(c))}}liveFor(e){let s=this.live.get(e);return s||(s={state:$t,waiters:new Set},this.live.set(e,s)),s}forgetIdleLive(e){!this.entries.has(e)&&this.live.get(e)?.waiters.size===0&&this.live.delete(e)}dropLive(e){let s=this.live.get(e);s!==void 0&&(s.waiters.size===0?this.live.delete(e):s.state=$t)}},Or=new WeakMap,zt=a(t=>{let e=Or.get(t);return e||(e=new Gt(t),Or.set(t,e)),e},"L"),Ir=(0,_.createContext)(null),qa=(0,_.createContext)(!1),Ba=a(()=>new qt({defaultOptions:{mutations:{retry:0},queries:{gcTime:5*6e4,retry:0,staleTime:Number.POSITIVE_INFINITY}}}),"B"),Wa=a(t=>{let e=(0,Er.c)(20),{children:s,client:r,queryClient:i}=t,n=(0,_.use)(Ie),o;e[0]!==n||e[1]!==i?(o=a(()=>i??n??Ba(),"h"),e[0]=n,e[1]=i,e[2]=o):o=e[2];let[c]=(0,_.useState)(o),h=i??n??c,u,d;e[3]!==r||e[4]!==h?(u=a(()=>{zt(r).clearOnIdentityChange(h)},"n"),d=[r,h],e[3]=r,e[4]=h,e[5]=u,e[6]=d):(u=e[5],d=e[6]),(0,_.useEffect)(u,d);let l=(0,_.useRef)(r),p,f;e[7]!==r||e[8]!==h?(p=a(()=>{l.current!==r&&(zt(l.current).stopClearingOnIdentityChange(h),l.current=r,zt(r).clearQueries(h),h.invalidateQueries({queryKey:["lunora"]}))},"a"),f=[r,h],e[7]=r,e[8]=h,e[9]=p,e[10]=f):(p=e[9],f=e[10]),(0,_.useEffect)(p,f);let[y]=(0,_.useState)(r),m=r!==y,g;e[11]!==s||e[12]!==m?(g=(0,it.jsx)(qa,{value:m,children:s}),e[11]=s,e[12]=m,e[13]=g):g=e[13];let w;e[14]!==r||e[15]!==g?(w=(0,it.jsx)(Ir,{value:r,children:g}),e[14]=r,e[15]=g,e[16]=w):w=e[16];let k=w;if(n===h)return k;let E;return e[17]!==k||e[18]!==h?(E=(0,it.jsx)(Lt,{client:h,children:k}),e[17]=k,e[18]=h,e[19]=E):E=e[19],E},"X");var xe=a(()=>{let t=(0,_.use)(Ir);if(!t)throw new v("INTERNAL","useLunora must be used inside <LunoraProvider />");return t},"q");var Q=a(t=>new Promise((e,s)=>{t.addEventListener("success",()=>{e(t.result)}),t.addEventListener("error",()=>{s(t.error??new Error("IndexedDB request failed"))})}),"c"),nt=a((t,e,s,r)=>{let i;return()=>{if(i)return i;let n=new Promise((o,c)=>{let h=t.open(e,s);h.addEventListener("upgradeneeded",()=>{r(h.result)}),h.addEventListener("success",()=>{o(h.result)}),h.addEventListener("error",()=>{c(h.error??new Error("IndexedDB open failed"))})});return i=n,n.catch(()=>{i===n&&(i=void 0)}),n}},"E"),at=a((t,e)=>async(s,r)=>{let i=(await t()).transaction(e,s),n=await r(i.objectStore(e));return await new Promise((o,c)=>{i.addEventListener("complete",()=>{o()}),i.addEventListener("error",()=>{c(i.error??new Error("IndexedDB transaction failed"))}),i.addEventListener("abort",()=>{c(i.error??new Error("IndexedDB transaction aborted"))})}),n},"u");var he=a((t,e,s)=>`${t}::${e}::${s??""}`,"T"),$a=500,za=a((t,e)=>{if(!Number.isInteger(t)||t<1)throw new v("INTERNAL",`${e}: maxEntries must be a positive integer, got ${String(t)}`);return t},"E");var Ga="lunora-query-cache",Va="query-cache",Rr="by_ts",Ja=1,Ya=a((t={})=>{let e=t.indexedDB??(typeof indexedDB>"u"?void 0:indexedDB);if(!e)throw new v("INTERNAL","createIndexedDbQueryCache: no IndexedDB available \u2014 pass `indexedDB` or use createInMemoryQueryCache()");let s=t.databaseName??Ga,r=t.storeName??Va,i=za(t.maxEntries??$a,"createIndexedDbQueryCache"),n=nt(e,s,Ja,h=>{h.objectStoreNames.contains(r)||h.createObjectStore(r,{keyPath:"key"}).createIndex(Rr,"ts",{unique:!1})}),o=at(n,r),c=a(async h=>{let u=await Q(h.count())-i;u<=0||await new Promise((d,l)=>{let p=h.index(Rr).openCursor();p.addEventListener("success",()=>{let f=p.result;if(!f||u<=0){d();return}f.delete(),u-=1,f.continue()}),p.addEventListener("error",()=>{l(p.error??new Error("IndexedDB eviction failed"))})})},"y");return{clear:a(async()=>{await o("readwrite",h=>Q(h.clear()))},"clear"),load:a(async()=>o("readonly",h=>Q(h.getAll())),"load"),put:a(async(h,u)=>{await o("readwrite",async d=>{await Q(d.put({...u,key:h})),await c(d)})},"put"),remove:a(async h=>{await o("readwrite",u=>Q(u.delete(h)))},"remove")}},"N"),Ar=a(t=>{if(t!==!1){if(t)return t;if(!(typeof indexedDB>"u"))return Ya()}},"L");var te="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",Vt=a(t=>{let e="",s=0,r=t.length-2;for(;s<r;s+=3){let n=t[s]<<16|t[s+1]<<8|t[s+2];e+=te.charAt(n>>18&63)+te.charAt(n>>12&63)+te.charAt(n>>6&63)+te.charAt(n&63)}let i=t.length-s;if(i===1){let n=t[s]<<16;e+=te.charAt(n>>18&63)+te.charAt(n>>12&63)}else if(i===2){let n=t[s]<<16|t[s+1]<<8;e+=te.charAt(n>>18&63)+te.charAt(n>>12&63)+te.charAt(n>>6&63)}return e},"A");var Fr=a(()=>{let t=null;return{get:a(()=>t,"get"),set:a(e=>{t=e},"set")}},"r");var ot=class{static{a(this,"u")}values=new Map;subscribers=new Map;get(e){return this.values.has(e.key)?this.values.get(e.key):e.defaultValue}set(e,s){if(s===void 0){this.reset(e);return}this.values.set(e.key,s),this.notify(e.key,s)}reset(e){this.values.delete(e.key),this.notify(e.key,e.defaultValue)}clear(){this.values.clear(),this.subscribers.clear()}subscribe(e,s){let r=this.subscribers.get(e.key);return r||(r=new Set,this.subscribers.set(e.key,r)),r.add(s),()=>{r.delete(s),r.size===0&&this.subscribers.delete(e.key)}}notify(e,s){let r=this.subscribers.get(e);if(r)for(let i of r)try{i(s)}catch{}}};var Jt=0,ge,Pr=a((t,e)=>{for(let s of t)try{s(e)}catch{}},"f"),Xa=a(t=>{let e=[...t.callbacks],s=t.lastValue;return()=>{for(let r of e){if(t.lastValue!==s)return;t.callbacks.has(r)&&Pr([r],s)}}},"p"),Lr=a(t=>{ge===void 0?t():ge.add(t)},"k"),Mr=a(()=>Jt,"L"),Za=a((t,e)=>{let s=t;for(let r of e)try{s=r.transform(s)}catch{}return s},"y"),xr=a((t,e)=>{e!==t.lastValue&&(t.lastValue=e,ge===void 0?Pr(t.callbacks,e):ge.add(t))},"d"),ct=a((t,e=()=>!0)=>{let s=new Set;ge=s;try{t()}finally{ge=void 0;let r=[...s].map(i=>typeof i=="function"?i:Xa(i));for(let i of r){if(!e())break;try{i()}catch{}}}},"v"),W=a((t,e)=>{xr(t,Za(e,t.optimisticLayers))},"m"),ht=a((t,e)=>{let s;try{s=e(t.lastValue)}catch{return}let r={id:Symbol("optimistic"),transform:e},i=!1;t.optimisticLayers.push(r),xr(t,s);let n=a(()=>{let c=t.optimisticLayers.findIndex(h=>h.id===r.id);return c===-1?!1:(t.optimisticLayers.splice(c,1),!0)},"s"),o=a(()=>{W(t,t.serverBase)},"a");return{confirm:a(c=>{if(c===void 0){n();return}r.commitCursor=c,Jt+=1,r.acknowledgedAt=Jt,t.serverCursor!==void 0&&t.serverCursor>=c&&n()&&o()},"confirm"),rollback:a(()=>{i||(i=!0,n(),o())},"rollback")}},"b"),dt=a((t,e)=>{if(e===void 0||t.optimisticLayers.length===0)return!1;let s=t.optimisticLayers.length;return t.optimisticLayers=t.optimisticLayers.filter(r=>r.commitCursor===void 0||r.commitCursor>e),t.optimisticLayers.length!==s},"h"),_r=a((t,e)=>{t.optimisticLayers.length!==0&&(t.optimisticLayers=t.optimisticLayers.filter(s=>s.acknowledgedAt===void 0||s.acknowledgedAt>e))},"g"),de=a(t=>{for(let e=t.length-1;e>=0;e-=1)t[e]?.()},"w");var Qr=0,eo="lunora-bridge",to=1e3,so=3e3,ut=class{static{a(this,"p")}bc;tabId;heartbeatInterval;leaderTimeout;knownLeader=void 0;leader=!1;running=!1;promotionPending=!1;lastHeartbeat=0;pendingData=new Map;heldData=new Map;heartbeatTimer=void 0;leaderCheckTimer=void 0;onBecomeLeader;onStopBeingLeader;onConnectionStatus;onSubscriptionData;onLeaderClaimAnswered;onSubscriptionError;onSubscriptionSettled;constructor(e={}){if(Qr+=1,this.tabId=`tab_${String(Qr)}_${crypto.randomUUID()}`,this.heartbeatInterval=e.heartbeatInterval??to,this.leaderTimeout=e.leaderTimeout??so,this.onBecomeLeader=e.onBecomeLeader,this.onStopBeingLeader=e.onStopBeingLeader,this.onConnectionStatus=e.onConnectionStatus,this.onSubscriptionData=e.onSubscriptionData,this.onLeaderClaimAnswered=e.onLeaderClaimAnswered,this.onSubscriptionError=e.onSubscriptionError,this.onSubscriptionSettled=e.onSubscriptionSettled,typeof BroadcastChannel>"u"){this.bc=void 0;return}this.bc=new BroadcastChannel(e.channelName??eo),this.bc.addEventListener("message",s=>{this.handleMessage(s.data)})}start(){if(!this.running){if(this.running=!0,this.bc===void 0){this.becomeLeader();return}this.broadcast({type:"claim-leadership",tabId:this.tabId,ts:Date.now()}),setTimeout(()=>{this.running&&this.knownLeader===void 0&&this.becomeLeader()},this.leaderTimeout),this.leaderCheckTimer=setInterval(()=>{this.checkLeaderHealth()},this.leaderTimeout),this.heartbeatTimer=setInterval(()=>{this.sendHeartbeat()},this.heartbeatInterval)}}stop(){this.running=!1,this.leader&&(this.broadcast({type:"yield-leadership",tabId:this.tabId}),this.leader=!1,this.knownLeader=void 0,this.onStopBeingLeader?.()),this.heartbeatTimer!==void 0&&(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0),this.leaderCheckTimer!==void 0&&(clearInterval(this.leaderCheckTimer),this.leaderCheckTimer=void 0),this.bc?.close()}isLeader(){return this.leader}promoteImmediately(){this.running&&this.becomeLeader()}get leaderTabId(){return this.knownLeader}get id(){return this.tabId}get isRunning(){return this.running}broadcastSubscriptionData(e,s,r,i,n,o){this.leader&&(this.pendingData.size===0&&queueMicrotask(()=>{this.flushPendingData()}),this.pendingData.set(e,{type:"subscription-data",tabId:this.tabId,key:e,data:s,...r===void 0?{}:{cursor:r},...i===void 0?{}:{epoch:i},...n===void 0?{}:{identity:n},...o===void 0?{}:{claims:o}}))}broadcastSubscriptionError(e,s,r,i){this.leader&&this.broadcast({type:"subscription-error",tabId:this.tabId,key:e,error:s,...r===void 0?{}:{identity:r},...i===void 0?{}:{claims:i}})}broadcastSubscriptionSettled(e,s,r,i,n,o,c){this.leader&&this.broadcast({type:"subscription-settled",tabId:this.tabId,key:e,...s===void 0?{}:{cursor:s},...r===void 0?{}:{epoch:r},...i===void 0?{}:{lastMutationId:i},...n===void 0?{}:{clientId:n},...o===void 0?{}:{identity:o},...c===void 0?{}:{claims:c}})}broadcastConnectionStatus(e,s){this.leader&&this.broadcast({type:"connection-status",tabId:this.tabId,status:e,...s===void 0?{}:{identity:s}})}broadcast(e){this.flushPendingData(),this.bc?.postMessage(e)}flushPendingData(){if(this.pendingData.size===0)return;let e=[...this.pendingData.values()];if(this.pendingData.clear(),!this.leader)return;let s,r=!0;for(let[i,n]of e.entries()){let o=i<e.length-1;try{this.bc?.postMessage(o?{...n,more:!0}:n),s=n,r=!o}catch{}}!r&&s!==void 0&&this.bc?.postMessage(s)}applySubscriptionData(e){let s=this.heldData.get(e.tabId)??[];if(s.push(e),e.more===!0){this.heldData.set(e.tabId,s);return}this.heldData.delete(e.tabId),ct(()=>{for(let r of s)this.onSubscriptionData?.(r.key,r.data,r.cursor,r.epoch,r.identity,r.claims)},()=>this.running)}handleMessage(e){switch(e.type){case"claim-leadership":{this.handleClaimLeadership(e);break}case"connection-status":{if(this.leader||e.tabId===this.tabId)break;this.onConnectionStatus?.(e.status,e.identity);break}case"heartbeat":{this.handleHeartbeat(e);break}case"subscription-data":{if(this.leader||e.tabId===this.tabId)break;this.applySubscriptionData(e);break}case"subscription-error":{if(this.leader||e.tabId===this.tabId)break;this.onSubscriptionError?.(e.key,e.error,e.identity,e.claims);break}case"subscription-settled":{if(this.leader||e.tabId===this.tabId)break;this.onSubscriptionSettled?.(e.key,e.cursor,e.epoch,e.lastMutationId,e.clientId,e.identity,e.claims);break}case"yield-leadership":{this.heldData.delete(e.tabId),this.knownLeader===e.tabId&&(this.knownLeader=void 0,this.running&&!this.leader&&this.claimAndPromote());break}}}handleClaimLeadership(e){if(e.tabId!==this.tabId){if(this.leader){this.broadcast({type:"heartbeat",tabId:this.tabId,ts:Date.now()}),this.onLeaderClaimAnswered?.();return}this.knownLeader===void 0&&e.tabId<this.tabId&&(this.knownLeader=e.tabId,this.lastHeartbeat=e.ts)}}handleHeartbeat(e){if(e.tabId!==this.tabId){if(this.leader){this.resolveLeaderVsLeaderTieBreak(e);return}this.lastHeartbeat=e.ts,this.knownLeader=e.tabId}}resolveLeaderVsLeaderTieBreak(e){e.tabId<this.tabId?(this.leader=!1,this.knownLeader=e.tabId,this.lastHeartbeat=e.ts,this.onStopBeingLeader?.()):this.broadcast({type:"heartbeat",tabId:this.tabId,ts:Date.now()})}becomeLeader(){this.leader||(this.leader=!0,this.knownLeader=this.tabId,this.lastHeartbeat=Date.now(),this.onBecomeLeader?.(),this.broadcast({type:"heartbeat",tabId:this.tabId,ts:Date.now()}))}sendHeartbeat(){this.leader&&this.broadcast({type:"heartbeat",tabId:this.tabId,ts:Date.now()})}checkLeaderHealth(){if(!(!this.running||this.leader)){if(this.knownLeader===void 0){this.claimAndPromote();return}Date.now()-this.lastHeartbeat>this.leaderTimeout&&(this.heldData.delete(this.knownLeader),this.knownLeader=void 0,this.claimAndPromote())}}claimAndPromote(){this.promotionPending||(this.promotionPending=!0,this.broadcast({type:"claim-leadership",tabId:this.tabId,ts:Date.now()}),setTimeout(()=>{this.promotionPending=!1,this.running&&this.knownLeader===void 0&&this.becomeLeader()},this.leaderTimeout))}};var ro=a(t=>{if(t===null||typeof t!="object")return!1;let e=Object.getPrototypeOf(t);return e===null||e===Object.prototype},"l"),io="_id",Yt="_creationTime",Xt="page",Dr="pageDelta",no=a(t=>{if(Array.isArray(t))return t;if(ro(t)&&Array.isArray(t[Xt]))return t[Xt]},"y"),ao=a(t=>{let e;for(let s of t){let r=s[Yt];if(typeof r=="number"){if(e!==void 0){if(r<e)return!0;if(r>e)return!1}e=r}}return!1},"g"),oo=a((t,e)=>{let s=e[Yt];if(typeof s!="number")return t.length;let r=ao(t);for(let[i,n]of t.entries()){let o=n[Yt];if(typeof o=="number"&&(r?o<s:o>s))return i}return t.length},"A"),co=a(t=>{if(typeof t!="object"||t===null)return;let e=t[io];return typeof e=="string"?e:void 0},"b"),ho=a(t=>{if(typeof t!="object"||t===null)return!1;let e=t;return typeof e.key=="string"&&typeof e.table=="string"&&(e.op==="insert"||e.op==="update"||e.op==="delete")},"D"),uo=a((t,e)=>{let{key:s,op:r,row:i}=e,n=[],o=-1;for(let c of t){let h=co(c);if(h===void 0)return;if(h===s){if(r==="delete")continue;o===-1&&(o=n.length)}n.push(c)}if(r==="delete")return n;if(i!==void 0)return o===-1?n.splice(oo(n,i),0,i):n[o]=i,n},"x"),lo=a((t,e)=>{let s=no(t);if(s===void 0)return;let r=uo(s,e);return r===void 0||Array.isArray(t)?r:{...t,[Xt]:r}},"E"),Zt=Symbol("lunora.unmergeableDelta"),Ur=a((t,e)=>{if("data"in t&&t.data!==void 0)return T(t.data);let s=T(t.delta);return ho(s)?e===void 0?s:lo(e,s)??Zt:s},"m");var ip=new Set(Object.keys(Fs)),D=class extends v{static{a(this,"R")}constructor(e,s){super("INTERNAL",e,{data:s})}};var lt=a(t=>{let e=t?.data?.retryAfterMs;return typeof e=="number"&&Number.isFinite(e)?e:void 0},"f"),es=new Set(["TOKEN_EXPIRED","UNAUTHENTICATED"]),_e=a(t=>es.has(t?.code??""),"u");var Qe=a(t=>typeof t=="string"||Array.isArray(t)&&t.every(e=>typeof e=="string")?{hint:t}:{},"n");var De=a((t={},e=Math.random)=>{let s=t.initialDelayMs??250,r=t.maxDelayMs??3e4,i=t.jitter??!0,n=0;return{next(){let o=Math.min(r,s*2**n);if(n+=1,!i)return o;let c=o/2;return Math.floor(c+e()*(o-c))},reset(){n=0}}},"s");var po=1024,pt=a(t=>{let e=t.maxBuffer??po,s=[],r=[],i=!1,n,o=!1,c=a(()=>{let d=r.shift();if(!d)return!1;if(n)return d.reject(n),!0;if(s.length>0){let l=s.shift();return d.resolve({done:!1,value:l}),!0}return i?(d.resolve({done:!0,value:void 0}),!0):(r.unshift(d),!1)},"u"),h={complete(){if(!(i||n))for(i=!0;c(););},fail(d){if(!(i||n)){for(n=d,s.length=0;c(););t.onFail?.()}},push(d){if(!(i||n||o)){if(s.length>=e){h.fail(new v("STREAM_BACKPRESSURE",`stream buffer overflow (max=${e.toString()}); the consumer cannot keep up with the producer`));return}s.push(d),c()}}},u=a(()=>{if(!o){o=!0,i=!0,s.length=0;try{t.onCancel()}catch{}for(;c(););}},"c");return{handle:h,iterable:{cancel:u,[Symbol.asyncIterator](){return{next(){if(n)return Promise.reject(n);if(s.length>0){let d=s.shift();return Promise.resolve({done:!1,value:d})}return i?Promise.resolve({done:!0,value:void 0}):new Promise((d,l)=>{r.push({reject:l,resolve:d})})},return(){return u(),Promise.resolve({done:!0,value:void 0})}}}}}},"p");var be=a(t=>t.reason??Object.assign(new Error("The operation was aborted"),{name:"AbortError"}),"c"),ce=a(async(t,e,s,r=()=>new D(`LunoraClient: request timed out after ${t.toString()}ms`))=>{if(e?.aborted)throw be(e);let i=new AbortController,n=[],o=new Promise((h,u)=>{if(t>0){let d=setTimeout(()=>{u(r()),i.abort()},t);n.push(()=>{clearTimeout(d)})}if(e){let d=a(()=>{i.abort(),u(be(e))},"a");e.addEventListener("abort",d,{once:!0}),n.push(()=>{e.removeEventListener("abort",d)})}}),c=s(i.signal);c.catch(()=>{});try{return await Promise.race([c,o])}finally{for(let h of n)h()}},"m"),ts=a(async(t,e)=>{if(e===void 0)return t;if(e.aborted)throw t.catch(()=>{}),be(e);let s=a(()=>{},"o"),r=new Promise((i,n)=>{s=a(()=>{n(be(e))},"o"),e.addEventListener("abort",s,{once:!0})});t.catch(()=>{});try{return await Promise.race([t,r])}finally{e.removeEventListener("abort",s)}},"E"),Hr=a(async(t,e)=>!Number.isFinite(e)||e<=0?t.read():ce(e,void 0,async()=>t.read(),()=>new v("STREAM_IDLE",`stream received nothing for ${e.toString()}ms`)),"y");var ft=/^ /u,fo=/^\d+$/u,mo=2147483647,yo=10,vo=1e3,Nr=a(t=>typeof t=="object"&&t!==null?JSON.stringify(t):String(t),"O"),go=a(t=>{let e="",s,r,i=[];for(let n of t.split(`
|
|
1
|
+
import{a as Fs,b as v,c as Ps,d as Ls}from"./chunk-OYCDWIG2.js";import{a as Ms}from"./chunk-A6TVTNKO.js";import{a as ne,b as Et}from"./chunk-ADABTCDI.js";import{a,d as H}from"./chunk-5PEAXTYQ.js";var ue=a(t=>{try{return t(),!0}catch{return!1}},"o"),zn=new Set([Object.prototype,Function.prototype]),Oe=a((t,e,s)=>{let r;for(let i=t;i!==null&&!zn.has(i);i=Object.getPrototypeOf(i)){let n=Object.getOwnPropertyDescriptor(i,e)?.[s];typeof n=="function"&&(r=n)}return r},"y"),V=a((t,e)=>Oe(t,e,"get"),"r"),Qs=Oe(Date.prototype,"getTime","value"),Gn=V(Map.prototype,"size"),Vn=V(Set.prototype,"size"),Jn=V(ArrayBuffer.prototype,"byteLength"),Te=typeof URL=="function"?V(URL.prototype,"href"):void 0,It=typeof URL=="function"?URL.prototype:void 0,Yn=Te!==void 0&&Function.prototype.toString.call(Te).includes("[native code]"),xs=Oe(Error,"isError","value"),_s=Error.prototype,Xn=a((t,e)=>typeof xs=="function"?xs(t):e!==null&&(e===_s||_s.isPrototypeOf(e)),"L"),Zn=Oe(Map.prototype,"forEach","value"),ea=Oe(Set.prototype,"forEach","value"),Rt=Object.getPrototypeOf(Uint8Array.prototype),At={data:{buffer:V(DataView.prototype,"buffer"),byteLength:V(DataView.prototype,"byteLength"),byteOffset:V(DataView.prototype,"byteOffset")},typed:{buffer:V(Rt,"buffer"),byteLength:V(Rt,"byteLength"),byteOffset:V(Rt,"byteOffset")}},Ds=a(t=>Reflect.apply(Qs,t,[]),"S"),Us=a(t=>Reflect.apply(Te,t,[]),"m"),Hs=a(t=>{let e=[];return Reflect.apply(Zn,t,[(s,r)=>e.push([r,s])]),e},"A"),Ns=a(t=>{let e=[];return Reflect.apply(ea,t,[s=>e.push(s)]),e},"w"),Ks=a(t=>{let e=ue(()=>Reflect.apply(At.typed.buffer,t,[]))?At.typed:At.data;return new Uint8Array(Reflect.apply(e.buffer,t,[]),Reflect.apply(e.byteOffset,t,[]),Reflect.apply(e.byteLength,t,[]))},"j"),We=a(t=>{if(Array.isArray(t))return"array";let e=Object.getPrototypeOf(t);return e===null||e===Object.prototype?"plain":ue(()=>Reflect.apply(Qs,t,[]))?"builtin-date":ue(()=>Reflect.apply(Gn,t,[]))?"builtin-map":ue(()=>Reflect.apply(Vn,t,[]))?"builtin-set":ue(()=>Reflect.apply(Jn,t,[]))?"builtin-array-buffer":ArrayBuffer.isView(t)?"builtin-view":Xn(t,e)?"builtin-error":Te!==void 0&&(Yn||It!==void 0&&e!==null&&(e===It||It.isPrototypeOf(e)))&&ue(()=>Reflect.apply(Te,t,[]))?"builtin-url":"other"},"D");var ta=2**32-1,sa=/["\\\u0000-\u001F\uD800-\uDFFF]/,js=a(t=>sa.test(t)?JSON.stringify(t):`"${t}"`,"y"),ra=a(t=>Number.isNaN(t)?"nan":t===1/0?"inf":t===-1/0?"-inf":Object.is(t,-0)?"-0":void 0,"u"),ia=a((t,e)=>{let s=t,r=Object.keys(s).sort(),i="{",n=!0;for(let o of r){let c=s[o];c!==void 0&&(n?n=!1:i+=",",i+=js(o),i+=":",i+=e(c))}return`${i}}`},"g"),na=a(t=>{let{length:e}=t,s=Number.isInteger(e)?e:Math.trunc(e)||0;if(s>ta)throw new RangeError("stable-key: array length exceeds 2**32 - 1");return s},"d"),Ee=a(t=>{if(t===void 0)return"null";if(typeof t=="bigint")throw new TypeError("stableStringify: cannot use a bigint in a stable JSON cache key \u2014 pass it as a string, or use stableWireKey");if(typeof t=="function"||typeof t=="symbol")throw new TypeError(`stableStringify: cannot use a ${typeof t} in a stable JSON cache key \u2014 only plain objects, arrays, and JSON primitives are supported`);if(typeof t=="number"){let s=ra(t);if(s!==void 0)return s}if(typeof t=="string")return js(t);if(t===null||typeof t!="object")return JSON.stringify(t);let e=We(t);if(e==="array"){let s=na(t),r="[";for(let i=0;i<s;i+=1)i>0&&(r+=","),r+=Ee(t[i]);return`${r}]`}if(e!=="plain"){let s=t.constructor?.name??"value";throw new TypeError(`stableStringify: cannot use a ${s} in a stable JSON cache key \u2014 only plain objects, arrays, and JSON primitives are supported (wire-typed values key via stableWireKey)`)}return ia(t,Ee)},"c");var Ft=a(t=>{if(t===null||typeof t!="object")return!1;let e=Object.getPrototypeOf(t);return e===null||e===Object.prototype},"e");var $e=a(t=>{let e="";for(let s=0;s<t.length;s+=32768)e+=String.fromCharCode(...t.subarray(s,s+32768));return btoa(e)},"u"),aa=a(t=>{let e=atob(t),s=new Uint8Array(e.length);for(let r=0;r<e.length;r+=1)s[r]=e.codePointAt(r)??0;return s},"R"),A="$lunora.wire$",ze=64,Ge=1024,oa="__proto__",ca=/^-?\d+$/,qs={BigInt64Array,BigUint64Array,Float32Array,Float64Array,Int8Array,Int16Array,Int32Array,Uint8Array,Uint8ClampedArray,Uint16Array,Uint32Array},Bs={Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError},Pt=a((t,e,s)=>{e===oa?Object.defineProperty(t,e,{configurable:!0,enumerable:!0,value:s,writable:!0}):t[e]=s},"b");var ha=a(t=>{let e=t.toString();if(e.length>Ge)throw new RangeError(`wire-codec: over-long bigint (max ${String(Ge)} digits)`);return[A,"bigint",e]},"B"),da=a(t=>Number.isNaN(t)?[A,"nan"]:t===1/0?[A,"inf"]:t===-1/0?[A,"-inf"]:t,"_"),ua=a((t,e)=>{let s=e(Object.fromEntries(Object.keys(t).map(n=>[n,t[n]]))),r=t,i=[A,"error",String(r.name),String(r.message),s];return t.cause!==void 0&&i.push(e(t.cause)),i},"P"),la=a(t=>{let e=t.constructor.name,s=Ks(t);return e==="Uint8Array"?[A,"bytes",$e(s)]:[A,"bytes",$e(s),e]},"$"),pa=a((t,e,s)=>{switch(e){case"builtin-array-buffer":return[A,"bytes",$e(new Uint8Array(t)),"ArrayBuffer"];case"builtin-date":return[A,"date",s(Ds(t))];case"builtin-error":return ua(t,s);case"builtin-map":return[A,"map",Hs(t).map(([r,i])=>[s(r),s(i)])];case"builtin-set":return[A,"set",Ns(t).map(r=>s(r))];case"builtin-url":return[A,"url",Us(t)];case"builtin-view":return la(t);default:return}},"k"),fa=a((t,e)=>{let s=t.map(r=>N(r,e));return s.length>0&&s[0]===A?[A,"arr",s]:s},"D"),ma=a((t,e)=>{let s={};for(let r of Object.keys(t)){let i=t[r];i!==void 0&&Pt(s,r,N(i,e))}return s},"C"),N=a((t,e=0)=>{if(e>ze)throw new RangeError(`wire-codec: value nesting exceeds the ${String(ze)}-level limit`);if(t===void 0)return[A,"undefined"];if(t===null)return t;if(typeof t=="bigint")return ha(t);if(typeof t=="number")return da(t);if(typeof t!="object")return t;let s=We(t);if(s==="array")return fa(t,e+1);if(s==="plain")return ma(t,e+1);let r=pa(t,s,n=>N(n,e+1));if(r!==void 0)return r;let i=t.constructor?.name??"value";throw new TypeError(`wire-codec: cannot encode a ${i} over the Lunora wire \u2014 only plain objects, arrays, and the supported built-ins (Date, Error, URL, Map, Set, ArrayBuffer/typed arrays, bigint) round-trip`)},"y"),ya=a(t=>{let e=t[2];if(typeof e!="string"||e.length>Ge||!ca.test(e))throw new RangeError(`wire-codec: invalid or over-long bigint (max ${String(Ge)} digits)`);return BigInt(e)},"M"),va=a((t,e)=>{let s=e(t[2]);if(typeof s!="number")throw new TypeError("wire-codec: malformed date \u2014 epoch must be a number");return new Date(s)},"F"),ga=a((t,e)=>{let s=t[2];return new Map(s.map(r=>{if(!Array.isArray(r)||r.length!==2)throw new TypeError("wire-codec: malformed map entry \u2014 expected a [key, value] pair");return[e(r[0]),e(r[1])]}))},"G"),ba=a(t=>{let e=t[2];if(typeof e!="string")throw new TypeError("wire-codec: malformed url \u2014 href must be a string");return new URL(e)},"L"),wa=a((t,e)=>{let s=t[2],r=t[3];if(typeof s!="string"||typeof r!="string")throw new TypeError("wire-codec: malformed error \u2014 name and message must be strings");let i=(Object.hasOwn(Bs,s)?Bs[s]:void 0)??Error,n=new i(r);n.name!==s&&Object.defineProperty(n,"name",{configurable:!0,value:s,writable:!0});let o=e(t[4]);if(o===null||typeof o!="object"||Array.isArray(o))throw new TypeError("wire-codec: malformed error \u2014 props must be an object");for(let[c,h]of Object.entries(o))Pt(n,c,h);return t.length>5&&Object.defineProperty(n,"cause",{configurable:!0,value:e(t[5]),writable:!0}),n},"W"),Sa=a(t=>{let e=t[2];if(typeof e!="string")throw new TypeError("wire-codec: malformed bytes \u2014 payload must be a base64 string");let s=aa(e);if($e(s)!==e)throw new TypeError("wire-codec: malformed bytes \u2014 payload must be canonical padded base64");let r=t[3]??"Uint8Array";if(r==="ArrayBuffer")return s.buffer.byteLength===s.byteLength?s.buffer:new Uint8Array(s).buffer;let i=Object.hasOwn(qs,r)?qs[r]:void 0;return i?new i(new Uint8Array(s).buffer):s},"v"),Ca=a((t,e)=>{switch(t[1]){case"-inf":return-1/0;case"arr":return t[2].map(s=>e(s));case"bigint":return ya(t);case"bytes":return Sa(t);case"date":return va(t,e);case"error":return wa(t,e);case"inf":return 1/0;case"map":return ga(t,e);case"nan":return Number.NaN;case"set":return new Set(t[2].map(s=>e(s)));case"undefined":return;case"url":return ba(t);default:return t.map(s=>e(s))}},"Y"),ka=a((t,e)=>{let s={};for(let r of Object.keys(t))Pt(s,r,T(t[r],e));return s},"H"),T=a((t,e=0)=>{if(e>ze)throw new RangeError(`wire-codec: value nesting exceeds the ${String(ze)}-level limit`);if(t===null||typeof t!="object")return t;if(Array.isArray(t)){let s=t;return s[0]===A?Ca(s,r=>T(r,e+1)):s.map(r=>T(r,e+1))}return ka(t,e+1)},"f"),Ws=a(t=>{let e=JSON.parse(t);return t.includes(A)||t.includes(String.raw`\u`)?T(e):e},"J"),Ta=a(t=>{try{let e=Ws(t);return Ft(e)?e:void 0}catch{return}},"X");var q=a(t=>Ee(N(t)),"a");var le=H(ne(),1),$s=H(Et(),1);var Ie=le.createContext(void 0),Re=a(t=>{let e=le.useContext(Ie);if(t)return t;if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},"useQueryClient"),Lt=a(({client:t,children:e})=>(le.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),(0,$s.jsx)(Ie.Provider,{value:t,children:e})),"QueryClientProvider");var j=class{static{a(this,"Subscribable")}constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}};var Oa=class extends j{static{a(this,"FocusManager")}#e;#t;#s;constructor(){super(),this.#s=t=>{if(typeof window<"u"&&window.addEventListener){let e=a(()=>t(),"listener");return window.addEventListener("visibilitychange",e,!1),()=>{window.removeEventListener("visibilitychange",e)}}}}onSubscribe(){this.#t||this.setEventListener(this.#s)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(t){this.#s=t,this.#t?.(),this.#t=t(e=>{typeof e=="boolean"?this.setFocused(e):this.onFocus()})}setFocused(t){this.#e!==t&&(this.#e=t,this.onFocus())}onFocus(){let t=this.isFocused();this.listeners.forEach(e=>{e(t)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},pe=new Oa;var Ea={setTimeout:a((t,e)=>setTimeout(t,e),"setTimeout"),clearTimeout:a(t=>clearTimeout(t),"clearTimeout"),setInterval:a((t,e)=>setInterval(t,e),"setInterval"),clearInterval:a(t=>clearInterval(t),"clearInterval")},Ia=class{static{a(this,"TimeoutManager")}#e=Ea;#t=!1;setTimeoutProvider(t){this.#e=t}setTimeout(t,e){return this.#e.setTimeout(t,e)}clearTimeout(t){this.#e.clearTimeout(t)}setInterval(t,e){return this.#e.setInterval(t,e)}clearInterval(t){this.#e.clearInterval(t)}},J=new Ia;function zs(t){setTimeout(t,0)}a(zs,"systemSetTimeoutZero");var xt=typeof window>"u"||"Deno"in globalThis;function O(){}a(O,"noop");function Js(t,e){return typeof t=="function"?t(e):t}a(Js,"functionalUpdate");function Ae(t){return typeof t=="number"&&t>=0&&t!==1/0}a(Ae,"isValidTimeout");function Ve(t,e){return Math.max(t+(e||0)-Date.now(),0)}a(Ve,"timeUntilStale");function B(t,e){return typeof t=="function"?t(e):t}a(B,"resolveStaleTime");function x(t,e){return typeof t=="function"?t(e):t}a(x,"resolveQueryBoolean");function Je(t,e){let{type:s="all",exact:r,fetchStatus:i,predicate:n,queryKey:o,stale:c}=t;if(o){if(r){if(e.queryHash!==Fe(o,e.options))return!1}else if(!ae(e.queryKey,o))return!1}if(s!=="all"){let h=e.isActive();if(s==="active"&&!h||s==="inactive"&&h)return!1}return!(typeof c=="boolean"&&e.isStale()!==c||i&&i!==e.state.fetchStatus||n&&!n(e))}a(Je,"matchQuery");function Ye(t,e){let{exact:s,status:r,predicate:i,mutationKey:n}=t;if(n){if(!e.options.mutationKey)return!1;if(s){if(Y(e.options.mutationKey)!==Y(n))return!1}else if(!ae(e.options.mutationKey,n))return!1}return!(r&&e.state.status!==r||i&&!i(e))}a(Ye,"matchMutation");function Fe(t,e){return(e?.queryKeyHashFn||Y)(t)}a(Fe,"hashQueryKeyByOptions");function Y(t){return JSON.stringify(t,(e,s)=>Mt(s)?Object.keys(s).sort().reduce((r,i)=>(r[i]=s[i],r),{}):s)}a(Y,"hashKey");function ae(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(Array.isArray(t)&&Array.isArray(e)){for(let r=0;r<e.length;r++)if(!ae(t[r],e[r]))return!1;return!0}let s=Object.keys(e);for(let r of s)if(!ae(t[r],e[r]))return!1;return!0}return!1}a(ae,"partialMatchKey");var Ra=Object.prototype.hasOwnProperty;function _t(t,e,s=0){if(t===e)return t;if(s>500)return e;let r=Gs(t)&&Gs(e);if(!r&&!(Mt(t)&&Mt(e)))return e;let n=(r?t:Object.keys(t)).length,o=r?e:Object.keys(e),c=o.length,h=r?new Array(c):{},u=0;for(let d=0;d<c;d++){let l=r?d:o[d],p=t[l],f=e[l];if(p===f){h[l]=p,(r?d<n:Ra.call(t,l))&&u++;continue}if(p===null||f===null||typeof p!="object"||typeof f!="object"){h[l]=f;continue}let y=_t(p,f,s+1);h[l]=y,y===p&&u++}return n===c&&u===n?t:h}a(_t,"replaceEqualDeep");function fe(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(let s in t)if(t[s]!==e[s])return!1;return!0}a(fe,"shallowEqualObjects");function Gs(t){return Array.isArray(t)&&t.length===Object.keys(t).length}a(Gs,"isPlainArray");function Mt(t){if(!Vs(t))return!1;let e=t.constructor;if(e===void 0)return!0;let s=e.prototype;return!(!Vs(s)||!s.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}a(Mt,"isPlainObject");function Vs(t){return Object.prototype.toString.call(t)==="[object Object]"}a(Vs,"hasObjectPrototype");function Ys(t){return new Promise(e=>{J.setTimeout(e,t)})}a(Ys,"sleep");function Pe(t,e,s){return typeof s.structuralSharing=="function"?s.structuralSharing(t,e):s.structuralSharing!==!1?_t(t,e):e}a(Pe,"replaceData");function Aa(t){return t}a(Aa,"keepPreviousData");function Xs(t,e,s=0){let r=[...t,e];return s&&r.length>s?r.slice(1):r}a(Xs,"addToEnd");function Zs(t,e,s=0){let r=[e,...t];return s&&r.length>s?r.slice(0,-1):r}a(Zs,"addToStart");var me=Symbol();function Xe(t,e){return!t.queryFn&&e?.initialPromise?()=>e.initialPromise:!t.queryFn||t.queryFn===me?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}a(Xe,"ensureQueryFn");function ye(t,e){return typeof t=="function"?t(...e):!!t}a(ye,"shouldThrowError");function er(t,e,s){let r=!1,i;return Object.defineProperty(t,"signal",{enumerable:!0,get:a(()=>(i??=e(),r||(r=!0,i.aborted?s():i.addEventListener("abort",s,{once:!0})),i),"get")}),t}a(er,"addConsumeAwareSignal");var X=(()=>{let t=a(()=>xt,"isServerFn");return{isServer(){return t()},setIsServer(e){t=e}}})();function Le(){let t,e,s=new Promise((i,n)=>{t=i,e=n});s.status="pending",s.catch(()=>{});function r(i){Object.assign(s,i),delete s.resolve,delete s.reject}return a(r,"finalize"),s.resolve=i=>{r({status:"fulfilled",value:i}),t(i)},s.reject=i=>{r({status:"rejected",reason:i}),e(i)},s}a(Le,"pendingThenable");var tr=zs;function Fa(){let t=[],e=0,s=a(c=>{c()},"notifyFn"),r=a(c=>{c()},"batchNotifyFn"),i=tr,n=a(c=>{e?t.push(c):i(()=>{s(c)})},"schedule"),o=a(()=>{let c=t;t=[],c.length&&i(()=>{r(()=>{c.forEach(h=>{s(h)})})})},"flush");return{batch:a(c=>{let h;e++;try{h=c()}finally{e--,e||o()}return h},"batch"),batchCalls:a(c=>(...h)=>{n(()=>{c(...h)})},"batchCalls"),schedule:n,setNotifyFunction:a(c=>{s=c},"setNotifyFunction"),setBatchNotifyFunction:a(c=>{r=c},"setBatchNotifyFunction"),setScheduler:a(c=>{i=c},"setScheduler")}}a(Fa,"createNotifyManager");var C=Fa();var Pa=class extends j{static{a(this,"OnlineManager")}#e=!0;#t;#s;constructor(){super(),this.#s=t=>{if(typeof window<"u"&&window.addEventListener){let e=a(()=>t(!0),"onlineListener"),s=a(()=>t(!1),"offlineListener");return window.addEventListener("online",e,!1),window.addEventListener("offline",s,!1),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",s)}}}}onSubscribe(){this.#t||this.setEventListener(this.#s)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(t){this.#s=t,this.#t?.(),this.#t=t(this.setOnline.bind(this))}setOnline(t){this.#e!==t&&(this.#e=t,this.listeners.forEach(s=>{s(t)}))}isOnline(){return this.#e}},ve=new Pa;function La(t){return Math.min(1e3*2**t,3e4)}a(La,"defaultRetryDelay");function Qt(t){return(t??"online")==="online"?ve.isOnline():!0}a(Qt,"canFetch");var Ze=class extends Error{static{a(this,"CancelledError")}constructor(t){super("CancelledError"),this.revert=t?.revert,this.silent=t?.silent}};function et(t){let e=!1,s=0,r,i=Le(),n=a(()=>i.status!=="pending","isResolved"),o=a(m=>{if(!n()){let g=new Ze(m);p(g),t.onCancel?.(g)}},"cancel"),c=a(()=>{e=!0},"cancelRetry"),h=a(()=>{e=!1},"continueRetry"),u=a(()=>pe.isFocused()&&(t.networkMode==="always"||ve.isOnline())&&t.canRun(),"canContinue"),d=a(()=>Qt(t.networkMode)&&t.canRun(),"canStart"),l=a(m=>{n()||(r?.(),i.resolve(m))},"resolve"),p=a(m=>{n()||(r?.(),i.reject(m))},"reject"),f=a(()=>new Promise(m=>{r=a(g=>{(n()||u())&&m(g)},"continueFn"),t.onPause?.()}).then(()=>{r=void 0,n()||t.onContinue?.()}),"pause"),y=a(()=>{if(n())return;let m,g=s===0?t.initialPromise:void 0;try{m=g??t.fn()}catch(w){m=Promise.reject(w)}Promise.resolve(m).then(l).catch(w=>{if(n())return;let k=t.retry??(X.isServer()?0:3),E=t.retryDelay??La,S=typeof E=="function"?E(s,w):E,I=k===!0||typeof k=="number"&&s<k||typeof k=="function"&&k(s,w);if(e||!I){p(w);return}s++,t.onFail?.(s,w),Ys(S).then(()=>u()?void 0:f()).then(()=>{e?p(w):y()})})},"run");return{promise:i,status:a(()=>i.status,"status"),cancel:o,continue:a(()=>(r?.(),i),"continue"),cancelRetry:c,continueRetry:h,canStart:d,start:a(()=>(d()?y():f().then(y),i),"start")}}a(et,"createRetryer");var tt=class{static{a(this,"Removable")}#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Ae(this.gcTime)&&(this.#e=J.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(X.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(J.clearTimeout(this.#e),this.#e=void 0)}};function rr(t){return{onFetch:a((e,s)=>{let r=e.options,i=e.fetchOptions?.meta?.fetchMore?.direction,n=e.state.data?.pages||[],o=e.state.data?.pageParams||[],c={pages:[],pageParams:[]},h=0,u=a(async()=>{let d=!1,l=a(y=>{er(y,()=>e.signal,()=>d=!0)},"addSignalProperty"),p=Xe(e.options,e.fetchOptions),f=a(async(y,m,g)=>{if(d)return Promise.reject(e.signal.reason);if(m==null&&y.pages.length)return Promise.resolve(y);let k=a(()=>{let ie={client:e.client,queryKey:e.queryKey,pageParam:m,direction:g?"backward":"forward",meta:e.options.meta};return l(ie),ie},"createQueryFnContext")(),E=await p(k),{maxPages:S}=e.options,I=g?Zs:Xs;return{pages:I(y.pages,E,S),pageParams:I(y.pageParams,m,S)}},"fetchPage");if(i&&n.length){let y=i==="backward",m=y?Ma:sr,g={pages:n,pageParams:o},w=m(r,g);c=await f(g,w,y)}else{let y=t??n.length;do{let m=h===0?o[0]??r.initialPageParam:sr(r,c);if(h>0&&m==null)break;c=await f(c,m),h++}while(h<y)}return c},"fetchFn");e.options.persister?e.fetchFn=()=>e.options.persister?.(u,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},s):e.fetchFn=u},"onFetch")}}a(rr,"infiniteQueryBehavior");function sr(t,{pages:e,pageParams:s}){let r=e.length-1;return e.length>0?t.getNextPageParam(e[r],e,s[r],s):void 0}a(sr,"getNextPageParam");function Ma(t,{pages:e,pageParams:s}){return e.length>0?t.getPreviousPageParam?.(e[0],e,s[0],s):void 0}a(Ma,"getPreviousPageParam");var ar=class extends tt{static{a(this,"Query")}#e;#t;#s;#r;#n;#i;#o;#a;constructor(t){super(),this.#a=!1,this.#o=t.defaultOptions,this.setOptions(t.options),this.observers=[],this.#n=t.client,this.#r=this.#n.getQueryCache(),this.queryKey=t.queryKey,this.queryHash=t.queryHash,this.#t=nr(this.options),this.state=t.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#i?.promise}setOptions(t){if(this.options={...this.#o,...t},t?._type&&(this.#e=t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=nr(this.options);e.data!==void 0&&(this.setState(ir(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#r.remove(this)}setData(t,e){let s=Pe(this.state.data,t,this.options);return this.#c({data:s,type:"success",dataUpdatedAt:e?.updatedAt,manual:e?.manual}),s}setState(t){this.#c({type:"setState",state:t})}cancel(t){let e=this.#i?.promise;return this.#i?.cancel(t),e?e.then(O).catch(O):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>x(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===me||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>B(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!Ve(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#i?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#i?.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(e=>e!==t),this.observers.length||(this.#i&&(this.#a||this.#d()?this.#i.cancel({revert:!0}):this.#i.cancelRetry()),this.scheduleGc()),this.#r.notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}#d(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"}invalidate(){this.state.isInvalidated||this.#c({type:"invalidate"})}async fetch(t,e){if(this.state.fetchStatus!=="idle"&&this.#i?.status()!=="rejected"){if(this.state.data!==void 0&&e?.cancelRefetch)this.cancel({silent:!0});else if(this.#i)return this.#i.continueRetry(),this.#i.promise}if(t&&this.setOptions(t),!this.options.queryFn){let h=this.observers.find(u=>u.options.queryFn);h&&this.setOptions(h.options)}let s=new AbortController,r=a(h=>{Object.defineProperty(h,"signal",{enumerable:!0,get:a(()=>(this.#a=!0,s.signal),"get")})},"addSignalProperty"),i=a(()=>{let h=Xe(this.options,e),d=a(()=>{let l={client:this.#n,queryKey:this.queryKey,meta:this.meta};return r(l),l},"createQueryFnContext")();return this.#a=!1,this.options.persister?this.options.persister(h,d,this):h(d)},"fetchFn"),o=a(()=>{let h={fetchOptions:e,options:this.options,queryKey:this.queryKey,client:this.#n,state:this.state,fetchFn:i};return r(h),h},"createFetchContext")();(this.#e==="infinite"?rr(this.options.pages):this.options.behavior)?.onFetch(o,this),this.#s=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==o.fetchOptions?.meta)&&this.#c({type:"fetch",meta:o.fetchOptions?.meta}),this.#i=et({initialPromise:e?.initialPromise,fn:o.fetchFn,onCancel:a(h=>{h instanceof Ze&&h.revert&&this.setState({...this.#s,fetchStatus:"idle"}),s.abort()},"onCancel"),onFail:a((h,u)=>{this.#c({type:"failed",failureCount:h,error:u})},"onFail"),onPause:a(()=>{this.#c({type:"pause"})},"onPause"),onContinue:a(()=>{this.#c({type:"continue"})},"onContinue"),retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:a(()=>!0,"canRun")});try{let h=await this.#i.start();if(h===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(h),this.#r.config.onSuccess?.(h,this),this.#r.config.onSettled?.(h,this.state.error,this),h}catch(h){if(h instanceof Ze){if(h.silent)return this.#i.promise;if(h.revert){if(this.state.data===void 0)throw h;return this.state.data}}throw this.#c({type:"error",error:h}),this.#r.config.onError?.(h,this),this.#r.config.onSettled?.(this.state.data,h,this),h}finally{this.scheduleGc()}}#c(t){let e=a(s=>{switch(t.type){case"failed":return{...s,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...s,fetchStatus:"paused"};case"continue":return{...s,fetchStatus:"fetching"};case"fetch":return{...s,...Dt(s.data,this.options),fetchMeta:t.meta??null};case"success":let r={...s,...ir(t.data,t.dataUpdatedAt),dataUpdateCount:s.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#s=t.manual?r:void 0,r;case"error":let i=t.error;return{...s,error:i,errorUpdateCount:s.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:s.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...s,isInvalidated:!0};case"setState":return{...s,...t.state}}},"reducer");this.state=e(this.state),C.batch(()=>{this.observers.forEach(s=>{s.onQueryUpdate()}),this.#r.notify({query:this,type:"updated",action:t})})}};function Dt(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Qt(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}a(Dt,"fetchState");function ir(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}a(ir,"successState");function nr(t){let e=typeof t.initialData=="function"?t.initialData():t.initialData,s=e!==void 0,r=s?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:s?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:s?"success":"pending",fetchStatus:"idle"}}a(nr,"getDefaultState");var Ht=class extends j{static{a(this,"QueryObserver")}constructor(t,e){super(),this.options=e,this.#e=t,this.#a=null,this.#o=Le(),this.bindMethods(),this.setOptions(e)}#e;#t=void 0;#s=void 0;#r=void 0;#n;#i;#o;#a;#d;#c;#f;#u;#l;#h;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),or(this.#t,this.options)?this.#p():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Ut(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Ut(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#w(),this.#S(),this.#t.removeObserver(this)}setOptions(t){let e=this.options,s=this.#t;if(this.options=this.#e.defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof x(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#C(),this.#t.setOptions(this.options),e._defaulted&&!fe(this.options,e)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});let r=this.hasListeners();r&&cr(this.#t,s,this.options,e)&&this.#p(),this.updateResult(),r&&(this.#t!==s||x(this.options.enabled,this.#t)!==x(e.enabled,this.#t)||B(this.options.staleTime,this.#t)!==B(e.staleTime,this.#t))&&this.#y();let i=this.#v();r&&(this.#t!==s||x(this.options.enabled,this.#t)!==x(e.enabled,this.#t)||i!==this.#h)&&this.#g(i)}getOptimisticResult(t){let e=this.#e.getQueryCache().build(this.#e,t),s=this.createResult(e,t);return _a(this,s)&&(this.#r=s,this.#i=this.options,this.#n=this.#t.state),s}getCurrentResult(){return this.#r}trackResult(t,e){return new Proxy(t,{get:a((s,r)=>(this.trackProp(r),e?.(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#o.status==="pending"&&this.#o.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(s,r)),"get")})}trackProp(t){this.#m.add(t)}getCurrentQuery(){return this.#t}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){let e=this.#e.defaultQueryOptions(t),s=this.#e.getQueryCache().build(this.#e,e);return s.fetch().then(()=>this.createResult(s,e))}fetch(t){return this.#p({...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#p(t){this.#C();let e=this.#t.fetch(this.options,t);return t?.throwOnError||(e=e.catch(O)),e}#y(){this.#w();let t=B(this.options.staleTime,this.#t);if(X.isServer()||this.#r.isStale||!Ae(t))return;let s=Ve(this.#r.dataUpdatedAt,t)+1;this.#u=J.setTimeout(()=>{this.#r.isStale||this.updateResult()},s)}#v(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#g(t){this.#S(),this.#h=t,!(X.isServer()||x(this.options.enabled,this.#t)===!1||!Ae(this.#h)||this.#h===0)&&(this.#l=J.setInterval(()=>{(this.options.refetchIntervalInBackground||pe.isFocused())&&this.#p()},this.#h))}#b(){this.#y(),this.#g(this.#v())}#w(){this.#u!==void 0&&(J.clearTimeout(this.#u),this.#u=void 0)}#S(){this.#l!==void 0&&(J.clearInterval(this.#l),this.#l=void 0)}createResult(t,e){let s=this.#t,r=this.options,i=this.#r,n=this.#n,o=this.#i,h=t!==s?t.state:this.#s,{state:u}=t,d={...u},l=!1,p;if(e._optimisticResults){let F=this.hasListeners(),R=!F&&or(t,e),Z=F&&cr(t,s,e,r);(R||Z)&&(d={...d,...Dt(u.data,t.options)}),e._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:f,errorUpdatedAt:y,status:m}=d;p=d.data;let g=!1;if(e.placeholderData!==void 0&&p===void 0&&m==="pending"){let F;i?.isPlaceholderData&&e.placeholderData===o?.placeholderData?(F=i.data,g=!0):F=typeof e.placeholderData=="function"?e.placeholderData(this.#f?.state.data,this.#f):e.placeholderData,F!==void 0&&(m="success",p=Pe(i?.data,F,e),l=!0)}if(e.select&&p!==void 0&&!g)if(i&&p===n?.data&&e.select===this.#d)p=this.#c;else try{this.#d=e.select,p=e.select(p),p=Pe(i?.data,p,e),this.#c=p,this.#a=null}catch(F){this.#a=F}this.#a&&(f=this.#a,p=this.#c,y=Date.now(),m="error");let w=d.fetchStatus==="fetching",k=m==="pending",E=m==="error",S=k&&w,I=p!==void 0,M={status:m,fetchStatus:d.fetchStatus,isPending:k,isSuccess:m==="success",isError:E,isInitialLoading:S,isLoading:S,data:p,dataUpdatedAt:d.dataUpdatedAt,error:f,errorUpdatedAt:y,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:d.dataUpdateCount>h.dataUpdateCount||d.errorUpdateCount>h.errorUpdateCount,isFetching:w,isRefetching:w&&!k,isLoadingError:E&&!I,isPaused:d.fetchStatus==="paused",isPlaceholderData:l,isRefetchError:E&&I,isStale:Nt(t,e),refetch:this.refetch,promise:this.#o,isEnabled:x(e.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){let F=M.data!==void 0,R=M.status==="error"&&!F,Z=a(Be=>{R?Be.reject(M.error):F&&Be.resolve(M.data)},"finalizeThenableIfPossible"),As=a(()=>{let Be=this.#o=M.promise=Le();Z(Be)},"recreateThenable"),qe=this.#o;switch(qe.status){case"pending":t.queryHash===s.queryHash&&Z(qe);break;case"fulfilled":(R||M.data!==qe.value)&&As();break;case"rejected":(!R||M.error!==qe.reason)&&As();break}}return M}updateResult(){let t=this.#r,e=this.createResult(this.#t,this.options);if(this.#n=this.#t.state,this.#i=this.options,this.#n.data!==void 0&&(this.#f=this.#t),fe(e,t))return;this.#r=e;let s=a(()=>{if(!t)return!0;let{notifyOnChangeProps:r}=this.options,i=typeof r=="function"?r():r;if(i==="all"||!i&&!this.#m.size)return!0;let n=new Set(i??this.#m);return this.options.throwOnError&&n.add("error"),Object.keys(this.#r).some(o=>{let c=o;return this.#r[c]!==t[c]&&n.has(c)})},"shouldNotifyListeners");this.#k({listeners:s()})}#C(){let t=this.#e.getQueryCache().build(this.#e,this.options);if(t===this.#t)return;let e=this.#t;this.#t=t,this.#s=t.state,this.hasListeners()&&(e?.removeObserver(this),t.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#b()}#k(t){C.batch(()=>{t.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function xa(t,e){return x(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&x(e.retryOnMount,t)===!1)}a(xa,"shouldLoadOnMount");function or(t,e){return xa(t,e)||t.state.data!==void 0&&Ut(t,e,e.refetchOnMount)}a(or,"shouldFetchOnMount");function Ut(t,e,s){if(x(e.enabled,t)!==!1&&B(e.staleTime,t)!=="static"){let r=typeof s=="function"?s(t):s;return r==="always"||r!==!1&&Nt(t,e)}return!1}a(Ut,"shouldFetchOn");function cr(t,e,s,r){return(t!==e||x(r.enabled,t)===!1)&&(!s.suspense||t.state.status!=="error")&&Nt(t,s)}a(cr,"shouldFetchOptionally");function Nt(t,e){return x(e.enabled,t)!==!1&&t.isStaleByTime(B(e.staleTime,t))}a(Nt,"isStale");function _a(t,e){return!fe(t.getCurrentResult(),e)}a(_a,"shouldAssignObserverCurrentProperties");var hr=class extends tt{static{a(this,"Mutation")}#e;#t;#s;#r;constructor(t){super(),this.#e=t.client,this.mutationId=t.mutationId,this.#s=t.mutationCache,this.#t=[],this.state=t.state||Kt(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){this.#t.includes(t)||(this.#t.push(t),this.clearGcTimeout(),this.#s.notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){this.#t=this.#t.filter(e=>e!==t),this.scheduleGc(),this.#s.notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#s.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(t){let e=a(()=>{this.#n({type:"continue"})},"onContinue"),s={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=et({fn:a(()=>this.options.mutationFn?this.options.mutationFn(t,s):Promise.reject(new Error("No mutationFn found")),"fn"),onFail:a((n,o)=>{this.#n({type:"failed",failureCount:n,error:o})},"onFail"),onPause:a(()=>{this.#n({type:"pause"})},"onPause"),onContinue:e,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:a(()=>this.#s.canRun(this),"canRun")});let r=this.state.status==="pending",i=!this.#r.canStart();try{if(r)e();else{this.#n({type:"pending",variables:t,isPaused:i}),this.#s.config.onMutate&&await this.#s.config.onMutate(t,this,s);let o=await this.options.onMutate?.(t,s);o!==this.state.context&&this.#n({type:"pending",context:o,variables:t,isPaused:i})}let n=await this.#r.start();return await this.#s.config.onSuccess?.(n,t,this.state.context,this,s),await this.options.onSuccess?.(n,t,this.state.context,s),await this.#s.config.onSettled?.(n,null,this.state.variables,this.state.context,this,s),await this.options.onSettled?.(n,null,t,this.state.context,s),this.#n({type:"success",data:n}),n}catch(n){try{await this.#s.config.onError?.(n,t,this.state.context,this,s)}catch(o){Promise.reject(o)}try{await this.options.onError?.(n,t,this.state.context,s)}catch(o){Promise.reject(o)}try{await this.#s.config.onSettled?.(void 0,n,this.state.variables,this.state.context,this,s)}catch(o){Promise.reject(o)}try{await this.options.onSettled?.(void 0,n,t,this.state.context,s)}catch(o){Promise.reject(o)}throw this.#n({type:"error",error:n}),n}finally{this.#s.runNext(this)}}#n(t){let e=a(s=>{switch(t.type){case"failed":return{...s,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...s,isPaused:!0};case"continue":return{...s,isPaused:!1};case"pending":return{...s,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...s,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...s,data:void 0,error:t.error,failureCount:s.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}},"reducer");this.state=e(this.state),C.batch(()=>{this.#t.forEach(s=>{s.onMutationUpdate(t)}),this.#s.notify({mutation:this,type:"updated",action:t})})}};function Kt(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}a(Kt,"getDefaultState");var dr=class extends j{static{a(this,"MutationCache")}constructor(t={}){super(),this.config=t,this.#e=new Set,this.#t=new Map,this.#s=0}#e;#t;#s;build(t,e,s){let r=new hr({client:t,mutationCache:this,mutationId:++this.#s,options:t.defaultMutationOptions(e),state:s});return this.add(r),r}add(t){this.#e.add(t);let e=st(t);if(typeof e=="string"){let s=this.#t.get(e);s?s.push(t):this.#t.set(e,[t])}this.notify({type:"added",mutation:t})}remove(t){if(this.#e.delete(t)){let e=st(t);if(typeof e=="string"){let s=this.#t.get(e);if(s)if(s.length>1){let r=s.indexOf(t);r!==-1&&s.splice(r,1)}else s[0]===t&&this.#t.delete(e)}}this.notify({type:"removed",mutation:t})}canRun(t){let e=st(t);if(typeof e=="string"){let r=this.#t.get(e)?.find(i=>i.state.status==="pending");return!r||r===t}else return!0}runNext(t){let e=st(t);return typeof e=="string"?this.#t.get(e)?.find(r=>r!==t&&r.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){C.batch(()=>{this.#e.forEach(t=>{this.notify({type:"removed",mutation:t})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(t){let e={exact:!0,...t};return this.getAll().find(s=>Ye(e,s))}findAll(t={}){return this.getAll().filter(e=>Ye(t,e))}notify(t){C.batch(()=>{this.listeners.forEach(e=>{e(t)})})}resumePausedMutations(){let t=this.getAll().filter(e=>e.state.isPaused);return C.batch(()=>Promise.all(t.map(e=>e.continue().catch(O))))}};function st(t){return t.options.scope?.id}a(st,"scopeFor");var jt=class extends j{static{a(this,"MutationObserver")}#e;#t=void 0;#s;#r;constructor(t,e){super(),this.#e=t,this.setOptions(e),this.bindMethods(),this.#n()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){let e=this.options;this.options=this.#e.defaultMutationOptions(t),fe(this.options,e)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#s,observer:this}),e?.mutationKey&&this.options.mutationKey&&Y(e.mutationKey)!==Y(this.options.mutationKey)?this.reset():this.#s?.state.status==="pending"&&this.#s.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#s?.removeObserver(this)}onMutationUpdate(t){this.#n(),this.#i(t)}getCurrentResult(){return this.#t}reset(){this.#s?.removeObserver(this),this.#s=void 0,this.#n(),this.#i()}mutate(t,e){return this.#r=e,this.#s?.removeObserver(this),this.#s=this.#e.getMutationCache().build(this.#e,this.options),this.#s.addObserver(this),this.#s.execute(t)}#n(){let t=this.#s?.state??Kt();this.#t={...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset}}#i(t){C.batch(()=>{if(this.#r&&this.hasListeners()){let e=this.#t.variables,s=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(t?.type==="success"){try{this.#r.onSuccess?.(t.data,e,s,r)}catch(i){Promise.reject(i)}try{this.#r.onSettled?.(t.data,null,e,s,r)}catch(i){Promise.reject(i)}}else if(t?.type==="error"){try{this.#r.onError?.(t.error,e,s,r)}catch(i){Promise.reject(i)}try{this.#r.onSettled?.(void 0,t.error,e,s,r)}catch(i){Promise.reject(i)}}}this.listeners.forEach(e=>{e(this.#t)})})}};var ur=class extends j{static{a(this,"QueryCache")}constructor(t={}){super(),this.config=t,this.#e=new Map}#e;build(t,e,s){let r=e.queryKey,i=e.queryHash??Fe(r,e),n=this.get(i);return n||(n=new ar({client:t,queryKey:r,queryHash:i,options:t.defaultQueryOptions(e),state:s,defaultOptions:t.getQueryDefaults(r)}),this.add(n)),n}add(t){this.#e.has(t.queryHash)||(this.#e.set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){let e=this.#e.get(t.queryHash);e&&(t.destroy(),e===t&&this.#e.delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){C.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return this.#e.get(t)}getAll(){return[...this.#e.values()]}find(t){let e={exact:!0,...t};return this.getAll().find(s=>Je(e,s))}findAll(t={}){let e=this.getAll();return Object.keys(t).length>0?e.filter(s=>Je(t,s)):e}notify(t){C.batch(()=>{this.listeners.forEach(e=>{e(t)})})}onFocus(){C.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){C.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}};var qt=class{static{a(this,"QueryClient")}#e;#t;#s;#r;#n;#i;#o;#a;constructor(t={}){this.#e=t.queryCache||new ur,this.#t=t.mutationCache||new dr,this.#s=t.defaultOptions||{},this.#r=new Map,this.#n=new Map,this.#i=0}mount(){this.#i++,this.#i===1&&(this.#o=pe.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#a=ve.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#i--,this.#i===0&&(this.#o?.(),this.#o=void 0,this.#a?.(),this.#a=void 0)}isFetching(t){return this.#e.findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return this.#t.findAll({...t,status:"pending"}).length}getQueryData(t){let e=this.defaultQueryOptions({queryKey:t});return this.#e.get(e.queryHash)?.state.data}ensureQueryData(t){let e=this.defaultQueryOptions(t),s=this.#e.build(this,e),r=s.state.data;return r===void 0?this.fetchQuery(t):(t.revalidateIfStale&&s.isStaleByTime(B(e.staleTime,s))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return this.#e.findAll(t).map(({queryKey:e,state:s})=>{let r=s.data;return[e,r]})}setQueryData(t,e,s){let r=this.defaultQueryOptions({queryKey:t}),n=this.#e.get(r.queryHash)?.state.data,o=Js(e,n);if(o!==void 0)return this.#e.build(this,r).setData(o,{...s,manual:!0})}setQueriesData(t,e,s){return C.batch(()=>this.#e.findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,s)]))}getQueryState(t){let e=this.defaultQueryOptions({queryKey:t});return this.#e.get(e.queryHash)?.state}removeQueries(t){let e=this.#e;C.batch(()=>{e.findAll(t).forEach(s=>{e.remove(s)})})}resetQueries(t,e){let s=this.#e;return C.batch(()=>(s.findAll(t).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){let s={revert:!0,...e},r=C.batch(()=>this.#e.findAll(t).map(i=>i.cancel(s)));return Promise.all(r).then(O).catch(O)}invalidateQueries(t,e={}){return C.batch(()=>(this.#e.findAll(t).forEach(s=>{s.invalidate()}),t?.refetchType==="none"?Promise.resolve():this.refetchQueries({...t,type:t?.refetchType??t?.type??"active"},e)))}refetchQueries(t,e={}){let s={...e,cancelRefetch:e.cancelRefetch??!0},r=C.batch(()=>this.#e.findAll(t).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let n=i.fetch(void 0,s);return s.throwOnError||(n=n.catch(O)),i.state.fetchStatus==="paused"?Promise.resolve():n}));return Promise.all(r).then(O)}fetchQuery(t){let e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);let s=this.#e.build(this,e);return s.isStaleByTime(B(e.staleTime,s))?s.fetch(e):Promise.resolve(s.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(O).catch(O)}fetchInfiniteQuery(t){return t._type="infinite",this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(O).catch(O)}ensureInfiniteQueryData(t){return t._type="infinite",this.ensureQueryData(t)}resumePausedMutations(){return ve.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#s}setDefaultOptions(t){this.#s=t}setQueryDefaults(t,e){this.#r.set(Y(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){let e=[...this.#r.values()],s={};return e.forEach(r=>{ae(t,r.queryKey)&&Object.assign(s,r.defaultOptions)}),s}setMutationDefaults(t,e){this.#n.set(Y(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){let e=[...this.#n.values()],s={};return e.forEach(r=>{ae(t,r.mutationKey)&&Object.assign(s,r.defaultOptions)}),s}defaultQueryOptions(t){if(t._defaulted)return t;let e={...this.#s.queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=Fe(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===me&&(e.enabled=!1),e}defaultMutationOptions(t){return t?._defaulted?t:{...this.#s.mutations,...t?.mutationKey&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}};var oe=H(ne(),1);var Me=H(ne(),1),Qa=H(Et(),1);function Da(){let t=!1;return{clearReset:a(()=>{t=!1},"clearReset"),reset:a(()=>{t=!0},"reset"),isReset:a(()=>t,"isReset")}}a(Da,"createValue");var Ua=Me.createContext(Da()),lr=a(()=>Me.useContext(Ua),"useQueryErrorResetBoundary");var pr=H(ne(),1);var fr=a((t,e,s)=>{let r=s?.state.error&&typeof t.throwOnError=="function"?ye(t.throwOnError,[s.state.error,s]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||r)&&(e.isReset()||(t.retryOnMount=!1))},"ensurePreventErrorBoundaryRetry"),mr=a(t=>{pr.useEffect(()=>{t.clearReset()},[t])},"useClearResetErrorBoundary"),yr=a(({result:t,errorResetBoundary:e,throwOnError:s,query:r,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(i&&t.data===void 0||ye(s,[t.error,r])),"getHasError");var rt=H(ne(),1);var vr=rt.createContext(!1),gr=a(()=>rt.useContext(vr),"useIsRestoring"),nl=vr.Provider;var br=a(t=>{if(t.suspense){let s=a(i=>i==="static"?i:Math.max(i??1e3,1e3),"clamp"),r=t.staleTime;t.staleTime=typeof r=="function"?(...i)=>s(r(...i)):s(r),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},"ensureSuspenseTimers"),wr=a((t,e)=>t.isLoading&&t.isFetching&&!e,"willFetch"),Sr=a((t,e)=>t?.suspense&&e.isPending,"shouldSuspend"),Bt=a((t,e,s)=>e.fetchOptimistic(t).catch(()=>{s.clearReset()}),"fetchOptimistic");function Cr(t,e,s){let r=gr(),i=lr(),n=Re(s),o=n.defaultQueryOptions(t);n.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let c=n.getQueryCache().get(o.queryHash),h=t.subscribed!==!1;o._optimisticResults=r?"isRestoring":h?"optimistic":void 0,br(o),fr(o,i,c),mr(i);let u=!n.getQueryCache().get(o.queryHash),[d]=oe.useState(()=>new e(n,o)),l=d.getOptimisticResult(o),p=!r&&h;if(oe.useSyncExternalStore(oe.useCallback(f=>{let y=p?d.subscribe(C.batchCalls(f)):O;return d.updateResult(),y},[d,p]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),oe.useEffect(()=>{d.setOptions(o)},[o,d]),Sr(o,l))throw Bt(o,d,i);if(yr({result:l,errorResetBoundary:i,throwOnError:o.throwOnError,query:c,suspense:o.suspense}))throw l.error;return n.getDefaultOptions().queries?._experimental_afterQuery?.(o,l),o.experimental_prefetchInRender&&!X.isServer()&&wr(l,r)&&(u?Bt(o,d,i):c?.promise)?.catch(O).finally(()=>{d.updateResult()}),o.notifyOnChangeProps?l:d.trackResult(l)}a(Cr,"useBaseQuery");function Ha(t,e){return Cr(t,Ht,e)}a(Ha,"useQuery");var ee=H(ne(),1);function Na(t,e){let s=Re(e),[r]=ee.useState(()=>new jt(s,t));ee.useEffect(()=>{r.setOptions(t)},[r,t]);let i=ee.useSyncExternalStore(ee.useCallback(o=>r.subscribe(C.batchCalls(o)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),n=ee.useCallback((o,c)=>{r.mutate(o,c).catch(O)},[r]);if(i.error&&ye(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:n,mutateAsync:i.mutate}}a(Na,"useMutation");var Er=H(Ms(),1);var _=H(ne(),1);var it=H(Et(),1);var Wt=a(t=>q(t),"b");var kr=a(t=>{t!==void 0&&(t.cancel({silent:!0}),t.setState({...t.state,data:void 0,dataUpdatedAt:0,error:null,fetchStatus:"idle",status:"pending"}))},"E"),$t={status:"idle"},Tr=a((t,e)=>{for(let s of t.waiters)s(e);t.waiters.clear()},"F"),Ka=1e4,ja=a(async(t,e,s)=>new Promise((r,i)=>{if(e.aborted){i(e.reason);return}let n,o,c=a(()=>{clearTimeout(n),o?.(),t.waiters.delete(u),e.removeEventListener("abort",h)},"l"),h=a(()=>{c(),i(e.reason)},"t"),u=a(d=>{c(),r(d)},"n");n=setTimeout(()=>{u(!1)},Ka),t.waiters.add(u),e.addEventListener("abort",h,{once:!0}),o=s(()=>{u(!1)}),t.waiters.has(u)||o()}),"U"),Gt=class{static{a(this,"V")}constructor(e){this.client=e}client;entries=new Map;live=new Map;identityWatched=new Set;listening=!1;hasConsumers(e){return this.entries.has(Wt(e))}async liveValue(e,s,r,i){let{fetch:n,shardKey:o,waitForPush:c=!0}=i;if(!("window"in globalThis)||this.client.getWebSocketImpl()===void 0)return n();let h=Wt(s),u=this.liveFor(h),d=u.state.status==="pushed"?e.getQueryData(s)??u.state.value:void 0;if(d!==void 0)return d;if(c&&u.state.status!=="errored"&&!this.client.isCrossTabFollower()&&this.client.expectsPush({shardKey:o})){let f;try{f=await ja(u,r,y=>this.client.onConnectionStatus(()=>{this.client.expectsPush({shardKey:o})||y()}))}finally{this.forgetIdleLive(h)}if(f)return this.liveValue(e,s,r,i)}let l=u.state,p;try{p=await n()}finally{this.forgetIdleLive(h)}if(u.state!==l&&u.state.status==="pushed"){let f=e.getQueryData(s);return f!==void 0?f:u.state.value}return p}clearOnIdentityChange(e){this.listenForIdentityChange(),this.identityWatched.add(e)}stopClearingOnIdentityChange(e){this.identityWatched.delete(e)}subscribeIdentityEpoch=a(e=>(this.listenForIdentityChange(),this.client.onIdentityChange(e)),"subscribeIdentityEpoch");listenForIdentityChange(){this.listening||(this.listening=!0,this.client.onIdentityChange(()=>{for(let e of this.identityWatched)this.clearQueries(e)}))}clearQueries(e){let s=e.getQueryCache();for(let r of s.findAll({queryKey:["lunora"]}))kr(r),r.getObserversCount()===0&&!this.hasConsumers(r.queryKey)&&s.remove(r)}attach(e,s,r,i,n,o={}){let c=Wt(s),h=this.entries.get(c);if(!h){h={clients:new Map([[e,0]]),errorCallbacks:new Set,unsubscribe:void 0},this.entries.set(c,h);let p=h;try{h.unsubscribe=this.client.subscribe(r,i,f=>{let y=this.liveFor(c);if(f===void 0){y.state=$t;for(let m of p.clients.keys())kr(m.getQueryCache().find({exact:!0,queryKey:s}));return}for(let m of p.clients.keys())m.setQueryData(s,f);y.state={status:"pushed",value:f},Tr(y,!0)},{onError:a(f=>{let y=this.liveFor(c);y.state.status!=="pushed"&&(y.state={status:"errored"},Tr(y,!1));for(let m of p.errorCallbacks)m(f)},"onError"),shardKey:n})}catch(f){throw this.entries.delete(c),this.dropLive(c),f}}h.clients.set(e,(h.clients.get(e)??0)+1);let u=this.live.get(c);u?.state.status==="pushed"&&e.setQueryData(s,u.state.value);let{onError:d}=o;d&&h.errorCallbacks.add(d);let l=!1;return()=>{if(l)return;l=!0;let p=this.entries.get(c);if(!p)return;let f=(p.clients.get(e)??1)-1;f>0?p.clients.set(e,f):p.clients.delete(e),d&&p.errorCallbacks.delete(d),p.clients.size===0&&(p.unsubscribe?.(),this.entries.delete(c),this.dropLive(c))}}liveFor(e){let s=this.live.get(e);return s||(s={state:$t,waiters:new Set},this.live.set(e,s)),s}forgetIdleLive(e){!this.entries.has(e)&&this.live.get(e)?.waiters.size===0&&this.live.delete(e)}dropLive(e){let s=this.live.get(e);s!==void 0&&(s.waiters.size===0?this.live.delete(e):s.state=$t)}},Or=new WeakMap,zt=a(t=>{let e=Or.get(t);return e||(e=new Gt(t),Or.set(t,e)),e},"L"),Ir=(0,_.createContext)(null),qa=(0,_.createContext)(!1),Ba=a(()=>new qt({defaultOptions:{mutations:{retry:0},queries:{gcTime:5*6e4,retry:0,staleTime:Number.POSITIVE_INFINITY}}}),"B"),Wa=a(t=>{let e=(0,Er.c)(20),{children:s,client:r,queryClient:i}=t,n=(0,_.use)(Ie),o;e[0]!==n||e[1]!==i?(o=a(()=>i??n??Ba(),"h"),e[0]=n,e[1]=i,e[2]=o):o=e[2];let[c]=(0,_.useState)(o),h=i??n??c,u,d;e[3]!==r||e[4]!==h?(u=a(()=>{zt(r).clearOnIdentityChange(h)},"n"),d=[r,h],e[3]=r,e[4]=h,e[5]=u,e[6]=d):(u=e[5],d=e[6]),(0,_.useEffect)(u,d);let l=(0,_.useRef)(r),p,f;e[7]!==r||e[8]!==h?(p=a(()=>{l.current!==r&&(zt(l.current).stopClearingOnIdentityChange(h),l.current=r,zt(r).clearQueries(h),h.invalidateQueries({queryKey:["lunora"]}))},"a"),f=[r,h],e[7]=r,e[8]=h,e[9]=p,e[10]=f):(p=e[9],f=e[10]),(0,_.useEffect)(p,f);let[y]=(0,_.useState)(r),m=r!==y,g;e[11]!==s||e[12]!==m?(g=(0,it.jsx)(qa,{value:m,children:s}),e[11]=s,e[12]=m,e[13]=g):g=e[13];let w;e[14]!==r||e[15]!==g?(w=(0,it.jsx)(Ir,{value:r,children:g}),e[14]=r,e[15]=g,e[16]=w):w=e[16];let k=w;if(n===h)return k;let E;return e[17]!==k||e[18]!==h?(E=(0,it.jsx)(Lt,{client:h,children:k}),e[17]=k,e[18]=h,e[19]=E):E=e[19],E},"X");var xe=a(()=>{let t=(0,_.use)(Ir);if(!t)throw new v("INTERNAL","useLunora must be used inside <LunoraProvider />");return t},"q");var Q=a(t=>new Promise((e,s)=>{t.addEventListener("success",()=>{e(t.result)}),t.addEventListener("error",()=>{s(t.error??new Error("IndexedDB request failed"))})}),"c"),nt=a((t,e,s,r)=>{let i;return()=>{if(i)return i;let n=new Promise((o,c)=>{let h=t.open(e,s);h.addEventListener("upgradeneeded",()=>{r(h.result)}),h.addEventListener("success",()=>{o(h.result)}),h.addEventListener("error",()=>{c(h.error??new Error("IndexedDB open failed"))})});return i=n,n.catch(()=>{i===n&&(i=void 0)}),n}},"E"),at=a((t,e)=>async(s,r)=>{let i=(await t()).transaction(e,s),n=await r(i.objectStore(e));return await new Promise((o,c)=>{i.addEventListener("complete",()=>{o()}),i.addEventListener("error",()=>{c(i.error??new Error("IndexedDB transaction failed"))}),i.addEventListener("abort",()=>{c(i.error??new Error("IndexedDB transaction aborted"))})}),n},"u");var he=a((t,e,s)=>`${t}::${e}::${s??""}`,"T"),$a=500,za=a((t,e)=>{if(!Number.isInteger(t)||t<1)throw new v("INTERNAL",`${e}: maxEntries must be a positive integer, got ${String(t)}`);return t},"E");var Ga="lunora-query-cache",Va="query-cache",Rr="by_ts",Ja=1,Ya=a((t={})=>{let e=t.indexedDB??(typeof indexedDB>"u"?void 0:indexedDB);if(!e)throw new v("INTERNAL","createIndexedDbQueryCache: no IndexedDB available \u2014 pass `indexedDB` or use createInMemoryQueryCache()");let s=t.databaseName??Ga,r=t.storeName??Va,i=za(t.maxEntries??$a,"createIndexedDbQueryCache"),n=nt(e,s,Ja,h=>{h.objectStoreNames.contains(r)||h.createObjectStore(r,{keyPath:"key"}).createIndex(Rr,"ts",{unique:!1})}),o=at(n,r),c=a(async h=>{let u=await Q(h.count())-i;u<=0||await new Promise((d,l)=>{let p=h.index(Rr).openCursor();p.addEventListener("success",()=>{let f=p.result;if(!f||u<=0){d();return}f.delete(),u-=1,f.continue()}),p.addEventListener("error",()=>{l(p.error??new Error("IndexedDB eviction failed"))})})},"y");return{clear:a(async()=>{await o("readwrite",h=>Q(h.clear()))},"clear"),load:a(async()=>o("readonly",h=>Q(h.getAll())),"load"),put:a(async(h,u)=>{await o("readwrite",async d=>{await Q(d.put({...u,key:h})),await c(d)})},"put"),remove:a(async h=>{await o("readwrite",u=>Q(u.delete(h)))},"remove")}},"N"),Ar=a(t=>{if(t!==!1){if(t)return t;if(!(typeof indexedDB>"u"))return Ya()}},"L");var te="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",Vt=a(t=>{let e="",s=0,r=t.length-2;for(;s<r;s+=3){let n=t[s]<<16|t[s+1]<<8|t[s+2];e+=te.charAt(n>>18&63)+te.charAt(n>>12&63)+te.charAt(n>>6&63)+te.charAt(n&63)}let i=t.length-s;if(i===1){let n=t[s]<<16;e+=te.charAt(n>>18&63)+te.charAt(n>>12&63)}else if(i===2){let n=t[s]<<16|t[s+1]<<8;e+=te.charAt(n>>18&63)+te.charAt(n>>12&63)+te.charAt(n>>6&63)}return e},"A");var Fr=a(()=>{let t=null;return{get:a(()=>t,"get"),set:a(e=>{t=e},"set")}},"r");var ot=class{static{a(this,"u")}values=new Map;subscribers=new Map;get(e){return this.values.has(e.key)?this.values.get(e.key):e.defaultValue}set(e,s){if(s===void 0){this.reset(e);return}this.values.set(e.key,s),this.notify(e.key,s)}reset(e){this.values.delete(e.key),this.notify(e.key,e.defaultValue)}clear(){this.values.clear(),this.subscribers.clear()}subscribe(e,s){let r=this.subscribers.get(e.key);return r||(r=new Set,this.subscribers.set(e.key,r)),r.add(s),()=>{r.delete(s),r.size===0&&this.subscribers.delete(e.key)}}notify(e,s){let r=this.subscribers.get(e);if(r)for(let i of r)try{i(s)}catch{}}};var Jt=0,ge,Pr=a((t,e)=>{for(let s of t)try{s(e)}catch{}},"f"),Xa=a(t=>{let e=[...t.callbacks],s=t.lastValue;return()=>{for(let r of e){if(t.lastValue!==s)return;t.callbacks.has(r)&&Pr([r],s)}}},"p"),Lr=a(t=>{ge===void 0?t():ge.add(t)},"k"),Mr=a(()=>Jt,"L"),Za=a((t,e)=>{let s=t;for(let r of e)try{s=r.transform(s)}catch{}return s},"y"),xr=a((t,e)=>{e!==t.lastValue&&(t.lastValue=e,ge===void 0?Pr(t.callbacks,e):ge.add(t))},"d"),ct=a((t,e=()=>!0)=>{let s=new Set;ge=s;try{t()}finally{ge=void 0;let r=[...s].map(i=>typeof i=="function"?i:Xa(i));for(let i of r){if(!e())break;try{i()}catch{}}}},"v"),W=a((t,e)=>{xr(t,Za(e,t.optimisticLayers))},"m"),ht=a((t,e)=>{let s;try{s=e(t.lastValue)}catch{return}let r={id:Symbol("optimistic"),transform:e},i=!1;t.optimisticLayers.push(r),xr(t,s);let n=a(()=>{let c=t.optimisticLayers.findIndex(h=>h.id===r.id);return c===-1?!1:(t.optimisticLayers.splice(c,1),!0)},"s"),o=a(()=>{W(t,t.serverBase)},"a");return{confirm:a(c=>{if(c===void 0){n();return}r.commitCursor=c,Jt+=1,r.acknowledgedAt=Jt,t.serverCursor!==void 0&&t.serverCursor>=c&&n()&&o()},"confirm"),rollback:a(()=>{i||(i=!0,n(),o())},"rollback")}},"b"),dt=a((t,e)=>{if(e===void 0||t.optimisticLayers.length===0)return!1;let s=t.optimisticLayers.length;return t.optimisticLayers=t.optimisticLayers.filter(r=>r.commitCursor===void 0||r.commitCursor>e),t.optimisticLayers.length!==s},"h"),_r=a((t,e)=>{t.optimisticLayers.length!==0&&(t.optimisticLayers=t.optimisticLayers.filter(s=>s.acknowledgedAt===void 0||s.acknowledgedAt>e))},"g"),de=a(t=>{for(let e=t.length-1;e>=0;e-=1)t[e]?.()},"w");var Qr=0,eo="lunora-bridge",to=1e3,so=3e3,ut=class{static{a(this,"p")}bc;tabId;heartbeatInterval;leaderTimeout;knownLeader=void 0;leader=!1;running=!1;promotionPending=!1;lastHeartbeat=0;pendingData=new Map;heldData=new Map;heartbeatTimer=void 0;leaderCheckTimer=void 0;onBecomeLeader;onStopBeingLeader;onConnectionStatus;onSubscriptionData;onLeaderClaimAnswered;onSubscriptionError;onSubscriptionSettled;constructor(e={}){if(Qr+=1,this.tabId=`tab_${String(Qr)}_${crypto.randomUUID()}`,this.heartbeatInterval=e.heartbeatInterval??to,this.leaderTimeout=e.leaderTimeout??so,this.onBecomeLeader=e.onBecomeLeader,this.onStopBeingLeader=e.onStopBeingLeader,this.onConnectionStatus=e.onConnectionStatus,this.onSubscriptionData=e.onSubscriptionData,this.onLeaderClaimAnswered=e.onLeaderClaimAnswered,this.onSubscriptionError=e.onSubscriptionError,this.onSubscriptionSettled=e.onSubscriptionSettled,typeof BroadcastChannel>"u"){this.bc=void 0;return}this.bc=new BroadcastChannel(e.channelName??eo),this.bc.addEventListener("message",s=>{this.handleMessage(s.data)})}start(){if(!this.running){if(this.running=!0,this.bc===void 0){this.becomeLeader();return}this.broadcast({type:"claim-leadership",tabId:this.tabId,ts:Date.now()}),setTimeout(()=>{this.running&&this.knownLeader===void 0&&this.becomeLeader()},this.leaderTimeout),this.leaderCheckTimer=setInterval(()=>{this.checkLeaderHealth()},this.leaderTimeout),this.heartbeatTimer=setInterval(()=>{this.sendHeartbeat()},this.heartbeatInterval)}}stop(){this.running=!1,this.leader&&(this.broadcast({type:"yield-leadership",tabId:this.tabId}),this.leader=!1,this.knownLeader=void 0,this.onStopBeingLeader?.()),this.heartbeatTimer!==void 0&&(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0),this.leaderCheckTimer!==void 0&&(clearInterval(this.leaderCheckTimer),this.leaderCheckTimer=void 0),this.bc?.close()}isLeader(){return this.leader}promoteImmediately(){this.running&&this.becomeLeader()}get leaderTabId(){return this.knownLeader}get id(){return this.tabId}get isRunning(){return this.running}broadcastSubscriptionData(e,s,r,i,n,o){this.leader&&(this.pendingData.size===0&&queueMicrotask(()=>{this.flushPendingData()}),this.pendingData.set(e,{type:"subscription-data",tabId:this.tabId,key:e,data:s,...r===void 0?{}:{cursor:r},...i===void 0?{}:{epoch:i},...n===void 0?{}:{identity:n},...o===void 0?{}:{claims:o}}))}broadcastSubscriptionError(e,s,r,i){this.leader&&this.broadcast({type:"subscription-error",tabId:this.tabId,key:e,error:s,...r===void 0?{}:{identity:r},...i===void 0?{}:{claims:i}})}broadcastSubscriptionSettled(e,s,r,i,n,o,c){this.leader&&this.broadcast({type:"subscription-settled",tabId:this.tabId,key:e,...s===void 0?{}:{cursor:s},...r===void 0?{}:{epoch:r},...i===void 0?{}:{lastMutationId:i},...n===void 0?{}:{clientId:n},...o===void 0?{}:{identity:o},...c===void 0?{}:{claims:c}})}broadcastConnectionStatus(e,s){this.leader&&this.broadcast({type:"connection-status",tabId:this.tabId,status:e,...s===void 0?{}:{identity:s}})}broadcast(e){this.flushPendingData(),this.bc?.postMessage(e)}flushPendingData(){if(this.pendingData.size===0)return;let e=[...this.pendingData.values()];if(this.pendingData.clear(),!this.leader)return;let s,r=!0;for(let[i,n]of e.entries()){let o=i<e.length-1;try{this.bc?.postMessage(o?{...n,more:!0}:n),s=n,r=!o}catch{}}!r&&s!==void 0&&this.bc?.postMessage(s)}applySubscriptionData(e){let s=this.heldData.get(e.tabId)??[];if(s.push(e),e.more===!0){this.heldData.set(e.tabId,s);return}this.heldData.delete(e.tabId),ct(()=>{for(let r of s)this.onSubscriptionData?.(r.key,r.data,r.cursor,r.epoch,r.identity,r.claims)},()=>this.running)}handleMessage(e){switch(e.type){case"claim-leadership":{this.handleClaimLeadership(e);break}case"connection-status":{if(this.leader||e.tabId===this.tabId)break;this.onConnectionStatus?.(e.status,e.identity);break}case"heartbeat":{this.handleHeartbeat(e);break}case"subscription-data":{if(this.leader||e.tabId===this.tabId)break;this.applySubscriptionData(e);break}case"subscription-error":{if(this.leader||e.tabId===this.tabId)break;this.onSubscriptionError?.(e.key,e.error,e.identity,e.claims);break}case"subscription-settled":{if(this.leader||e.tabId===this.tabId)break;this.onSubscriptionSettled?.(e.key,e.cursor,e.epoch,e.lastMutationId,e.clientId,e.identity,e.claims);break}case"yield-leadership":{this.heldData.delete(e.tabId),this.knownLeader===e.tabId&&(this.knownLeader=void 0,this.running&&!this.leader&&this.claimAndPromote());break}}}handleClaimLeadership(e){if(e.tabId!==this.tabId){if(this.leader){this.broadcast({type:"heartbeat",tabId:this.tabId,ts:Date.now()}),this.onLeaderClaimAnswered?.();return}this.knownLeader===void 0&&e.tabId<this.tabId&&(this.knownLeader=e.tabId,this.lastHeartbeat=e.ts)}}handleHeartbeat(e){if(e.tabId!==this.tabId){if(this.leader){this.resolveLeaderVsLeaderTieBreak(e);return}this.lastHeartbeat=e.ts,this.knownLeader=e.tabId}}resolveLeaderVsLeaderTieBreak(e){e.tabId<this.tabId?(this.leader=!1,this.knownLeader=e.tabId,this.lastHeartbeat=e.ts,this.onStopBeingLeader?.()):this.broadcast({type:"heartbeat",tabId:this.tabId,ts:Date.now()})}becomeLeader(){this.leader||(this.leader=!0,this.knownLeader=this.tabId,this.lastHeartbeat=Date.now(),this.onBecomeLeader?.(),this.broadcast({type:"heartbeat",tabId:this.tabId,ts:Date.now()}))}sendHeartbeat(){this.leader&&this.broadcast({type:"heartbeat",tabId:this.tabId,ts:Date.now()})}checkLeaderHealth(){if(!(!this.running||this.leader)){if(this.knownLeader===void 0){this.claimAndPromote();return}Date.now()-this.lastHeartbeat>this.leaderTimeout&&(this.heldData.delete(this.knownLeader),this.knownLeader=void 0,this.claimAndPromote())}}claimAndPromote(){this.promotionPending||(this.promotionPending=!0,this.broadcast({type:"claim-leadership",tabId:this.tabId,ts:Date.now()}),setTimeout(()=>{this.promotionPending=!1,this.running&&this.knownLeader===void 0&&this.becomeLeader()},this.leaderTimeout))}};var ro=a(t=>{if(t===null||typeof t!="object")return!1;let e=Object.getPrototypeOf(t);return e===null||e===Object.prototype},"l"),io="_id",Yt="_creationTime",Xt="page",Dr="pageDelta",no=a(t=>{if(Array.isArray(t))return t;if(ro(t)&&Array.isArray(t[Xt]))return t[Xt]},"y"),ao=a(t=>{let e;for(let s of t){let r=s[Yt];if(typeof r=="number"){if(e!==void 0){if(r<e)return!0;if(r>e)return!1}e=r}}return!1},"g"),oo=a((t,e)=>{let s=e[Yt];if(typeof s!="number")return t.length;let r=ao(t);for(let[i,n]of t.entries()){let o=n[Yt];if(typeof o=="number"&&(r?o<s:o>s))return i}return t.length},"A"),co=a(t=>{if(typeof t!="object"||t===null)return;let e=t[io];return typeof e=="string"?e:void 0},"b"),ho=a(t=>{if(typeof t!="object"||t===null)return!1;let e=t;return typeof e.key=="string"&&typeof e.table=="string"&&(e.op==="insert"||e.op==="update"||e.op==="delete")},"D"),uo=a((t,e)=>{let{key:s,op:r,row:i}=e,n=[],o=-1;for(let c of t){let h=co(c);if(h===void 0)return;if(h===s){if(r==="delete")continue;o===-1&&(o=n.length)}n.push(c)}if(r==="delete")return n;if(i!==void 0)return o===-1?n.splice(oo(n,i),0,i):n[o]=i,n},"x"),lo=a((t,e)=>{let s=no(t);if(s===void 0)return;let r=uo(s,e);return r===void 0||Array.isArray(t)?r:{...t,[Xt]:r}},"E"),Zt=Symbol("lunora.unmergeableDelta"),Ur=a((t,e)=>{if("data"in t&&t.data!==void 0)return T(t.data);let s=T(t.delta);return ho(s)?e===void 0?s:lo(e,s)??Zt:s},"m");var ip=new Set(Object.keys(Fs)),D=class extends v{static{a(this,"R")}constructor(e,s){super("INTERNAL",e,{data:s})}};var lt=a(t=>{let e=t?.data?.retryAfterMs;return typeof e=="number"&&Number.isFinite(e)?e:void 0},"f"),es=new Set(["TOKEN_EXPIRED","UNAUTHENTICATED"]),_e=a(t=>es.has(t?.code??""),"u");var Qe=a(t=>typeof t=="string"||Array.isArray(t)&&t.every(e=>typeof e=="string")?{hint:t}:{},"n");var De=a((t={},e=Math.random)=>{let s=t.initialDelayMs??250,r=t.maxDelayMs??3e4,i=t.jitter??!0,n=0;return{next(){let o=Math.min(r,s*2**n);if(n+=1,!i)return o;let c=o/2;return Math.floor(c+e()*(o-c))},reset(){n=0}}},"s");var po=1024,pt=a(t=>{let e=t.maxBuffer??po,s=[],r=[],i=!1,n,o=!1,c=a(()=>{let d=r.shift();if(!d)return!1;if(n)return d.reject(n),!0;if(s.length>0){let l=s.shift();return d.resolve({done:!1,value:l}),!0}return i?(d.resolve({done:!0,value:void 0}),!0):(r.unshift(d),!1)},"u"),h={complete(){if(!(i||n))for(i=!0;c(););},fail(d){if(!(i||n)){for(n=d,s.length=0;c(););t.onFail?.()}},push(d){if(!(i||n||o)){if(s.length>=e){h.fail(new v("STREAM_BACKPRESSURE",`stream buffer overflow (max=${e.toString()}); the consumer cannot keep up with the producer`));return}s.push(d),c()}}},u=a(()=>{if(!o){o=!0,i=!0,s.length=0;try{t.onCancel()}catch{}for(;c(););}},"c");return{handle:h,iterable:{cancel:u,[Symbol.asyncIterator](){return{next(){if(n)return Promise.reject(n);if(s.length>0){let d=s.shift();return Promise.resolve({done:!1,value:d})}return i?Promise.resolve({done:!0,value:void 0}):new Promise((d,l)=>{r.push({reject:l,resolve:d})})},return(){return u(),Promise.resolve({done:!0,value:void 0})}}}}}},"p");var be=a(t=>t.reason??Object.assign(new Error("The operation was aborted"),{name:"AbortError"}),"c"),ce=a(async(t,e,s,r=()=>new D(`LunoraClient: request timed out after ${t.toString()}ms`))=>{if(e?.aborted)throw be(e);let i=new AbortController,n=[],o=new Promise((h,u)=>{if(t>0){let d=setTimeout(()=>{u(r()),i.abort()},t);n.push(()=>{clearTimeout(d)})}if(e){let d=a(()=>{i.abort(),u(be(e))},"a");e.addEventListener("abort",d,{once:!0}),n.push(()=>{e.removeEventListener("abort",d)})}}),c=s(i.signal);c.catch(()=>{});try{return await Promise.race([c,o])}finally{for(let h of n)h()}},"m"),ts=a(async(t,e)=>{if(e===void 0)return t;if(e.aborted)throw t.catch(()=>{}),be(e);let s=a(()=>{},"o"),r=new Promise((i,n)=>{s=a(()=>{n(be(e))},"o"),e.addEventListener("abort",s,{once:!0})});t.catch(()=>{});try{return await Promise.race([t,r])}finally{e.removeEventListener("abort",s)}},"E"),Hr=a(async(t,e)=>!Number.isFinite(e)||e<=0?t.read():ce(e,void 0,async()=>t.read(),()=>new v("STREAM_IDLE",`stream received nothing for ${e.toString()}ms`)),"y");var ft=/^ /u,fo=/^\d+$/u,mo=2147483647,yo=10,vo=1e3,Nr=a(t=>typeof t=="object"&&t!==null?JSON.stringify(t):String(t),"O"),go=a(t=>{let e="",s,r,i=[];for(let n of t.split(`
|
|
2
2
|
`))if(n.startsWith("event:"))e=n.slice(6).replace(ft,"");else if(n.startsWith("data:"))i.push(n.slice(5).replace(ft,""));else if(n.startsWith("id:")){let o=n.slice(3).replace(ft,"");o.includes("\0")||(s=o)}else if(n.startsWith("retry:")){let o=n.slice(6).replace(ft,"");fo.test(o)&&Number.isSafeInteger(Number(o))&&(r=Math.min(Number(o),mo))}return{data:i.join(`
|
|
3
3
|
`),event:e,id:s,retry:r}},"U"),bo=a((t,e,s)=>{let r=e.params??{},i=t.path.split("/").map(c=>{if(!c.startsWith(":"))return c;let h=c.slice(1),u=r[h];if(u===void 0)throw new v("HTTP_STREAM_MISSING_PARAM",`httpStream: missing path param ":${h}" for route ${t.path}`);return encodeURIComponent(Nr(u))}).join("/"),n=new URLSearchParams;for(let[c,h]of Object.entries(e.searchParams??{}))h!==void 0&&n.set(c,Nr(h));let o=n.toString();return`${s.endsWith("/")?s.slice(0,-1):s}${i}${o===""?"":`?${o}`}`},"Y"),wo=a((t,e)=>{if(t.event==="complete")return e.complete(t.data),!0;if(t.event==="error"){let s={};try{s=JSON.parse(t.data)}catch{}let r=typeof s.message=="string"?s.message:"stream error",i=typeof s.code=="string"?s.code:"HTTP_STREAM_ERROR",n=new v(i,r,Qe(s.hint));return typeof s.why=="string"&&(n.why=s.why),e.fail(n),!0}if((t.event===""||t.event==="message")&&t.data!=="")try{e.push(T(JSON.parse(t.data)))}catch{return e.fail(new v("HTTP_STREAM_BAD_CHUNK","httpStream: malformed SSE chunk (invalid JSON)")),!0}return!1},"J"),jr=a((t,e)=>{let s="",r=!1,i=a(o=>{let c=r?`\r${o}`:o;r=c.endsWith("\r"),r&&(c=c.slice(0,-1)),s+=c.replaceAll(`\r
|
|
4
4
|
`,`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{x as h}from"./chunk-
|
|
1
|
+
import{x as h}from"./chunk-OYCDWIG2.js";import{a as b}from"./chunk-A6TVTNKO.js";import{b as j}from"./chunk-ADABTCDI.js";import{a as u,d as g}from"./chunk-5PEAXTYQ.js";var v=g(b(),1);var t=g(j(),1);var z=u(N=>{let e=(0,v.c)(19),{action:a,className:x,description:c,icon:m,testId:f,title:p}=N,s;e[0]!==x?(s=h("flex flex-col items-center justify-center gap-3 rounded-lg border border-dashed border-border px-6 py-14 text-center",x),e[0]=x,e[1]=s):s=e[1];let r;e[2]!==m?(r=m!==void 0&&(0,t.jsx)("span",{className:"flex size-10 items-center justify-center rounded-lg bg-muted text-muted-foreground [&_svg]:size-5",children:m}),e[2]=m,e[3]=r):r=e[3];let d;e[4]!==p?(d=(0,t.jsx)("p",{className:"text-sm font-medium text-foreground",children:p}),e[4]=p,e[5]=d):d=e[5];let l;e[6]!==c?(l=c!==void 0&&(0,t.jsx)("p",{className:"max-w-sm text-sm text-muted-foreground",children:c}),e[6]=c,e[7]=l):l=e[7];let o;e[8]!==d||e[9]!==l?(o=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[d,l]}),e[8]=d,e[9]=l,e[10]=o):o=e[10];let i;e[11]!==a?(i=a!==void 0&&(0,t.jsx)("div",{className:"mt-1 flex items-center gap-2",children:a}),e[11]=a,e[12]=i):i=e[12];let n;return e[13]!==s||e[14]!==r||e[15]!==o||e[16]!==i||e[17]!==f?(n=(0,t.jsxs)("div",{className:s,"data-testid":f,children:[r,o,i]}),e[13]=s,e[14]=r,e[15]=o,e[16]=i,e[17]=f,e[18]=n):n=e[18],n},"y");export{z as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as s}from"./chunk-
|
|
1
|
+
import{a as s}from"./chunk-553O7ESU.js";import{B as d}from"./chunk-OYCDWIG2.js";import{a as h,b as k}from"./chunk-ADABTCDI.js";import{a as e,d as r}from"./chunk-5PEAXTYQ.js";var l=r(h(),1);var t=r(k(),1);var g=e(({children:m,confirmLabel:c,disabled:a=!1,onConfirm:p,testId:i})=>{let o=d(),[f,n]=(0,l.useState)(!1),u=e(()=>{n(!0)},"f"),C=e(()=>{n(!1)},"l"),b=e(()=>{n(!1),p()},"p");return f?(0,t.jsxs)("span",{className:"inline-flex items-center gap-1","data-testid":`${i}-prompt`,role:"group",children:[(0,t.jsx)(s,{"data-testid":`${i}-confirm`,disabled:a,onClick:b,size:"sm",type:"button",variant:"destructive",children:c??o("Confirm")}),(0,t.jsx)(s,{"data-testid":`${i}-cancel`,onClick:C,size:"sm",type:"button",variant:"ghost",children:o("Cancel")})]}):(0,t.jsx)(s,{"data-testid":i,disabled:a,onClick:u,size:"sm",type:"button",variant:"outline",children:m})},"k");export{g as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as m}from"./chunk-
|
|
1
|
+
import{a as m}from"./chunk-ADABTCDI.js";import{a as r,d as p}from"./chunk-5PEAXTYQ.js";function d(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}r(d,"mergeObjects");var y={};function h(e,t,n,o,i){if(!n&&!o&&!i&&!e)return R(t);let c=R(e);return t&&(c=E(c,t)),n&&(c=E(c,n)),o&&(c=E(c,o)),i&&(c=E(c,i)),c}r(h,"mergeProps");function x(e){if(e.length===0)return y;if(e.length===1)return R(e[0]);let t=R(e[0]);for(let n=1;n<e.length;n+=1)t=E(t,e[n]);return t}r(x,"mergePropsN");function R(e){return b(e)?{...T(e,y)}:J(e)}r(R,"createInitialMergedProps");function E(e,t){return b(t)?T(t,e):q(e,t)}r(E,"mergeInto");function J(e){let t={...e};for(let n in t){let o=t[n];O(n,o)&&(t[n]=k(o))}return t}r(J,"copyInitialProps");function q(e,t){if(!t)return e;for(let n in t){let o=t[n];switch(n){case"style":{e[n]=d(e.style,o);break}case"className":{e[n]=g(e.className,o);break}default:O(n,o)?e[n]=K(e[n],o):e[n]=o}}return e}r(q,"mutablyMergeInto");function O(e,t){let n=e.charCodeAt(0),o=e.charCodeAt(1),i=e.charCodeAt(2);return n===111&&o===110&&i>=65&&i<=90&&(typeof t=="function"||typeof t>"u")}r(O,"isEventHandler");function b(e){return typeof e=="function"}r(b,"isPropsGetter");function T(e,t){return b(e)?e(t):e??y}r(T,"resolvePropsGetter");function K(e,t){return t?e?(...n)=>{let o=n[0];if(_(o)){let c=o;M(c);let s=t(...n);return c.baseUIHandlerPrevented||e?.(...n),s}let i=t(...n);return e?.(...n),i}:k(t):e}r(K,"mergeEventHandlers");function k(e){return e&&((...t)=>{let n=t[0];return _(n)&&M(n),e(...t)})}r(k,"wrapEventHandler");function M(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}r(M,"makeEventPreventable");function g(e,t){return t?e?t+" "+e:t:e}r(g,"mergeClassNames");function _(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}r(_,"isSyntheticEvent");function Q(e,t){return r(function(o,...i){let c=new URL(e);return c.searchParams.set("code",o.toString()),i.forEach(s=>c.searchParams.append("args[]",s)),`${t} error #${o}; visit ${c} for the full message.`},"formatErrorMessage")}r(Q,"createFormatErrorMessage");var X=Q("https://base-ui.com/production-error","Base UI"),L=X;var a=p(m(),1);var j=p(m(),1);var V={};function v(e,t){let n=j.useRef(V);return n.current===V&&(n.current=e(t)),n}r(v,"useRefWithInit");function A(e,t,n,o){let i=v(S).current;return ee(i,e,t,n,o)&&$(i,[e,t,n,o]),i.callback}r(A,"useMergedRefs");function U(e){let t=v(S).current;return te(t,e)&&$(t,e),t.callback}r(U,"useMergedRefsN");function S(){return{callback:null,cleanup:null,refs:[]}}r(S,"createForkRef");function ee(e,t,n,o,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==o||e.refs[3]!==i}r(ee,"didChange");function te(e,t){return e.refs.length!==t.length||e.refs.some((n,o)=>n!==t[o])}r(te,"didChangeN");function $(e,t){if(e.refs=t,t.every(n=>n==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),n!=null){let o=Array(t.length).fill(null);for(let i=0;i<t.length;i+=1){let c=t[i];if(c!=null)switch(typeof c){case"function":{let s=c(n);typeof s=="function"&&(o[i]=s);break}case"object":{c.current=n;break}default:}}e.cleanup=()=>{for(let i=0;i<t.length;i+=1){let c=t[i];if(c!=null)switch(typeof c){case"function":{let s=o[i];typeof s=="function"?s():c(null);break}case"object":{c.current=null;break}default:}}}}}}r($,"update");var z=p(m(),1);var B=p(m(),1);var ne=parseInt(B.version,10);function Y(e){return ne>=e}r(Y,"isReactVersionAtLeast");function N(e){if(!z.isValidElement(e))return null;let t=e,n=t.props;return(Y(19)?n?.ref:t.ref)??null}r(N,"getReactElementRef");function we(){}r(we,"NOOP");var Ce=Object.freeze([]),l=Object.freeze({});function D(e,t){let n={};for(let o in e){let i=e[o];if(t?.hasOwnProperty(o)){let c=t[o](i);c!=null&&Object.assign(n,c);continue}i===!0?n[`data-${o.toLowerCase()}`]="":i&&(n[`data-${o.toLowerCase()}`]=i.toString())}return n}r(D,"getStateAttributesProps");function F(e,t){return typeof e=="function"?e(t):e}r(F,"resolveClassName");function W(e,t){return typeof e=="function"?e(t):e}r(W,"resolveStyle");var P=p(m(),1);function We(e,t,n={}){let o=t.render;n.enabled!==!1&&(o=ce(o));let i=re(t,n,o);if(n.enabled===!1)return null;let c=n.state??l;return se(e,o,i,c)}r(We,"useRenderElement");function re(e,t,n){let{className:o,style:i}=e,{state:c=l,ref:s,props:I,stateAttributesMapping:Z,enabled:f=!0}=t,w=f?F(o,c):void 0,C=f?W(i,c):void 0,G=f?D(c,Z):l,H=f&&I?oe(I):void 0,u=f?d(G,H)??{}:l;return typeof document<"u"&&(f?Array.isArray(s)?u.ref=U([u.ref,N(n),...s]):u.ref=A(u.ref,N(n),s):A(null,null)),f?(w!==void 0&&(u.className=g(u.className,w)),C!==void 0&&(u.style=d(u.style,C)),u):l}r(re,"useRenderElementProps");function oe(e){return Array.isArray(e)?x(e):h(void 0,e)}r(oe,"resolveRenderFunctionProps");var ie=Symbol.for("react.lazy");function ce(e){if(e?.$$typeof!==ie)return e;let t=a.Children.toArray(e)[0];return a.isValidElement(t)?t:e}r(ce,"unwrapLazyRenderProp");function se(e,t,n,o){if(t){if(typeof t=="function")return t(n,o);let i=h(n,t.props);return i.ref=n.ref,a.cloneElement(t,i)}if(e&&typeof e=="string")return ue(e,n);throw new Error(L(8))}r(se,"evaluateRenderProp");function ue(e,t){return e==="button"?(0,P.createElement)("button",{type:"button",...t,key:t.key}):e==="img"?(0,P.createElement)("img",{alt:"",...t,key:t.key}):a.createElement(e,t)}r(ue,"renderTag");export{v as a,h as b,M as c,L as d,A as e,Y as f,we as g,Ce as h,l as i,We as j};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as O,c as D}from"./chunk-
|
|
1
|
+
import{a as O,c as D}from"./chunk-MHZNDDGI.js";import{a as F}from"./chunk-BS77NGL6.js";import{a as j}from"./chunk-2KTN53PK.js";import{a as V}from"./chunk-7VZPHPTH.js";import"./chunk-EDL46BPM.js";import"./chunk-4KPATTV6.js";import{i as K}from"./chunk-VB3BKQCE.js";import"./chunk-4SY2N2RS.js";import"./chunk-4AG356VE.js";import"./chunk-OZID3UYF.js";import{a as T}from"./chunk-K7Z7UTJJ.js";import{b as k}from"./chunk-XMJB5JOF.js";import"./chunk-L27FKJTG.js";import{a as z}from"./chunk-2BCNWFC5.js";import"./chunk-CTIZP3XO.js";import{a as A,b as q,c as B,d as p,e as d,f as l}from"./chunk-VSYZL2WH.js";import"./chunk-GWRKSV2Q.js";import"./chunk-IAVAD545.js";import"./chunk-EOFWXI3T.js";import{a as I}from"./chunk-LYVYUTQY.js";import{c as L}from"./chunk-P37L55FP.js";import{a as M,e as R}from"./chunk-D76SLSGV.js";import"./chunk-K24LZAP2.js";import"./chunk-ZPQBVYNN.js";import{B as E,p as b,w as C}from"./chunk-OYCDWIG2.js";import"./chunk-PDBW6GTJ.js";import"./chunk-A6TVTNKO.js";import{a as ee,b as te}from"./chunk-ADABTCDI.js";import{a as i,d as y}from"./chunk-5PEAXTYQ.js";var s=y(ee(),1);var e=y(te(),1);var re=i(o=>o===void 0?"":JSON.stringify(o,b),"te"),ae=41,J=480,H=5,ie=i((o,t)=>O(o,n=>{t(n.height>0?n:{height:J,width:n.width})}),"ae"),Ne=i(({initialShardKey:o})=>{let t=E(),{queryShardKey:n,setShardKey:P,shardKey:U}=j(o),[m,W]=(0,s.useState)(""),{data:f,error:g,errorSource:Z,isLoading:_,liveError:G}=L(I.getAuditLog,{},{live:!0,shardKey:n}),c=(0,s.useMemo)(()=>f?.entries??[],[f]),h=(0,s.useMemo)(()=>{let a=m.trim().toLowerCase();return a===""?c:c.filter(r=>r.op.toLowerCase().includes(a)||(r.table??"").toLowerCase().includes(a)||(r.id??"").toLowerCase().includes(a))},[c,m]),x=(0,s.useRef)(null),v=D({count:h.length,estimateSize:i(()=>ae,"estimateSize"),getScrollElement:i(()=>x.current,"getScrollElement"),initialRect:{height:J,width:800},observeElementRect:ie,overscan:8}),u=v.getVirtualItems(),Q=v.getTotalSize(),N=u[0]?.start??0,w=Q-(u.at(-1)?.end??0),X={height:N},Y={height:w},$=i(a=>{W(a.target.value)},"k");return(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-audit",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(V,{onChange:P,testId:"au-shard-input",value:U}),(0,e.jsx)(F,{message:G,prefix:"au"}),(0,e.jsx)(K,{"aria-label":t("Filter audit log"),className:"h-8 w-48","data-testid":"au-search",onChange:$,placeholder:t("filter op, table, id"),value:m})]}),g!==null&&(0,e.jsx)(z,{error:Z,shardKey:n,testId:"au-error"}),g===null&&!_&&h.length===0&&(0,e.jsx)(T,{description:t("State-changing admin operations are recorded here."),icon:(0,e.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,e.jsx)("path",{d:"M8 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2h-2M9 3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1V3Zm-1 9h8m-8 4h5"})}),testId:"au-empty",title:t("No audit entries.")}),h.length>0&&(0,e.jsx)(M,{className:"overflow-hidden py-0",children:(0,e.jsx)(R,{className:"max-h-[30rem] overflow-auto px-0",ref:x,children:(0,e.jsxs)(A,{"data-testid":"au-table",children:[(0,e.jsx)(q,{children:(0,e.jsxs)(p,{children:[(0,e.jsx)(d,{children:t("time")}),(0,e.jsx)(d,{children:t("op")}),(0,e.jsx)(d,{children:t("table")}),(0,e.jsx)(d,{children:t("id")}),(0,e.jsx)(d,{children:t("detail")})]})}),(0,e.jsxs)(B,{children:[N>0&&(0,e.jsx)("tr",{"aria-hidden":"true",children:(0,e.jsx)("td",{colSpan:H,style:X})}),u.map(a=>{let r=h[a.index],S=re(r.detail);return(0,e.jsxs)(p,{"data-testid":"au-row",children:[(0,e.jsx)(l,{className:"text-muted-foreground tabular-nums",children:C(r.ts,"\u2014")}),(0,e.jsx)(l,{children:(0,e.jsx)(k,{variant:"secondary",children:r.op})}),(0,e.jsx)(l,{className:"font-medium",children:r.table??(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})}),(0,e.jsx)(l,{className:"max-w-[20ch] truncate font-mono text-xs",children:r.id??(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})}),(0,e.jsx)(l,{className:"max-w-[32ch] truncate font-mono text-xs text-muted-foreground",title:S||void 0,children:S||(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]},r.seq)}),w>0&&(0,e.jsx)("tr",{"aria-hidden":"true",children:(0,e.jsx)("td",{colSpan:H,style:Y})})]})]})})})]})},"we");export{Ne as AuditPanel};
|