cross-seed 6.13.6 → 7.0.0-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -13
- package/dist/Result.d.ts +27 -0
- package/dist/action.d.ts +34 -0
- package/dist/action.js +2 -1
- package/dist/action.js.map +1 -1
- package/dist/arr.d.ts +31 -0
- package/dist/arr.js +107 -39
- package/dist/arr.js.map +1 -1
- package/dist/auth.d.ts +3 -0
- package/dist/auth.js +9 -6
- package/dist/auth.js.map +1 -1
- package/dist/clients/Deluge.d.ts +153 -0
- package/dist/clients/Deluge.js +6 -6
- package/dist/clients/Deluge.js.map +1 -1
- package/dist/clients/QBittorrent.d.ts +218 -0
- package/dist/clients/RTorrent.d.ts +43 -0
- package/dist/clients/RTorrent.js +6 -3
- package/dist/clients/RTorrent.js.map +1 -1
- package/dist/clients/TorrentClient.d.ts +108 -0
- package/dist/clients/TorrentClient.js +136 -67
- package/dist/clients/TorrentClient.js.map +1 -1
- package/dist/clients/Transmission.d.ts +43 -0
- package/dist/clients/Transmission.js +2 -2
- package/dist/clients/Transmission.js.map +1 -1
- package/dist/cmd.d.ts +2 -0
- package/dist/cmd.js +42 -110
- package/dist/cmd.js.map +1 -1
- package/dist/configSchema.d.ts +1 -0
- package/dist/configSchema.js +1 -666
- package/dist/configSchema.js.map +1 -1
- package/dist/configuration.d.ts +63 -0
- package/dist/configuration.js +263 -24
- package/dist/configuration.js.map +1 -1
- package/dist/constants.d.ts +108 -0
- package/dist/constants.js +2 -32
- package/dist/constants.js.map +1 -1
- package/dist/dataFiles.d.ts +8 -0
- package/dist/dataFiles.js +21 -6
- package/dist/dataFiles.js.map +1 -1
- package/dist/db.d.ts +3 -0
- package/dist/dbConfig.d.ts +4 -0
- package/dist/dbConfig.js +67 -0
- package/dist/dbConfig.js.map +1 -0
- package/dist/decide.d.ts +25 -0
- package/dist/decide.js +4 -4
- package/dist/decide.js.map +1 -1
- package/dist/diff.d.ts +1 -0
- package/dist/errors.d.ts +3 -0
- package/dist/errors.js +0 -9
- package/dist/errors.js.map +1 -1
- package/dist/indexers.d.ts +105 -0
- package/dist/indexers.js +82 -14
- package/dist/indexers.js.map +1 -1
- package/dist/inject.d.ts +2 -0
- package/dist/jobs.d.ts +29 -0
- package/dist/jobs.js +14 -9
- package/dist/jobs.js.map +1 -1
- package/dist/logger.d.ts +29 -0
- package/dist/logger.js +18 -4
- package/dist/logger.js.map +1 -1
- package/dist/migrations/00-initialSchema.d.ts +9 -0
- package/dist/migrations/01-jobs.d.ts +9 -0
- package/dist/migrations/02-timestamps.d.ts +9 -0
- package/dist/migrations/03-rateLimits.d.ts +9 -0
- package/dist/migrations/04-auth.d.ts +9 -0
- package/dist/migrations/04-auth.js +1 -1
- package/dist/migrations/04-auth.js.map +1 -1
- package/dist/migrations/05-caps.d.ts +9 -0
- package/dist/migrations/06-uniqueDecisions.d.ts +9 -0
- package/dist/migrations/07-limits.d.ts +9 -0
- package/dist/migrations/08-rss.d.ts +9 -0
- package/dist/migrations/09-clientAndDataSearchees.d.ts +9 -0
- package/dist/migrations/10-indexerNameAudioBookCaps.d.ts +9 -0
- package/dist/migrations/11-trackers.d.ts +9 -0
- package/dist/migrations/12-user-auth.d.ts +9 -0
- package/dist/migrations/12-user-auth.js +22 -0
- package/dist/migrations/12-user-auth.js.map +1 -0
- package/dist/migrations/13-settings.d.ts +9 -0
- package/dist/migrations/13-settings.js +23 -0
- package/dist/migrations/13-settings.js.map +1 -0
- package/dist/migrations/14-indexer-enabled-flag.d.ts +9 -0
- package/dist/migrations/14-indexer-enabled-flag.js +12 -0
- package/dist/migrations/14-indexer-enabled-flag.js.map +1 -0
- package/dist/migrations/15-remove-url-unique-constraint.d.ts +9 -0
- package/dist/migrations/15-remove-url-unique-constraint.js +14 -0
- package/dist/migrations/15-remove-url-unique-constraint.js.map +1 -0
- package/dist/migrations/16-prune-inactive-indexers.d.ts +9 -0
- package/dist/migrations/16-prune-inactive-indexers.js +17 -0
- package/dist/migrations/16-prune-inactive-indexers.js.map +1 -0
- package/dist/migrations/migrations.d.ts +13 -0
- package/dist/migrations/migrations.js +10 -0
- package/dist/migrations/migrations.js.map +1 -1
- package/dist/parseTorrent.d.ts +53 -0
- package/dist/pipeline.d.ts +41 -0
- package/dist/pipeline.js +57 -10
- package/dist/pipeline.js.map +1 -1
- package/dist/preFilter.d.ts +25 -0
- package/dist/preFilter.js +15 -15
- package/dist/preFilter.js.map +1 -1
- package/dist/problems/linking.d.ts +2 -0
- package/dist/problems/linking.js +80 -0
- package/dist/problems/linking.js.map +1 -0
- package/dist/problems/path.d.ts +22 -0
- package/dist/problems/path.js +96 -0
- package/dist/problems/path.js.map +1 -0
- package/dist/problems.d.ts +13 -0
- package/dist/problems.js +48 -0
- package/dist/problems.js.map +1 -0
- package/dist/pushNotifier.d.ts +19 -0
- package/dist/routes/baseApi.d.ts +2 -0
- package/dist/routes/baseApi.js +354 -0
- package/dist/routes/baseApi.js.map +1 -0
- package/dist/routes/indexerApi.d.ts +6 -0
- package/dist/routes/indexerApi.js +165 -0
- package/dist/routes/indexerApi.js.map +1 -0
- package/dist/routes/staticFrontendPlugin.d.ts +4 -0
- package/dist/routes/staticFrontendPlugin.js +61 -0
- package/dist/routes/staticFrontendPlugin.js.map +1 -0
- package/dist/runtimeConfig.d.ts +6 -0
- package/dist/runtimeConfig.js +17 -1
- package/dist/runtimeConfig.js.map +1 -1
- package/dist/searchee.d.ts +108 -0
- package/dist/searchee.js +36 -5
- package/dist/searchee.js.map +1 -1
- package/dist/server.d.ts +4 -0
- package/dist/server.js +38 -429
- package/dist/server.js.map +1 -1
- package/dist/services/indexerService.d.ts +96 -0
- package/dist/services/indexerService.js +287 -0
- package/dist/services/indexerService.js.map +1 -0
- package/dist/sessionCookies.d.ts +5 -0
- package/dist/sessionCookies.js +27 -0
- package/dist/sessionCookies.js.map +1 -0
- package/dist/startup.d.ts +25 -0
- package/dist/startup.js +105 -151
- package/dist/startup.js.map +1 -1
- package/dist/torrent.d.ts +69 -0
- package/dist/torrent.js +17 -13
- package/dist/torrent.js.map +1 -1
- package/dist/torznab.d.ts +60 -0
- package/dist/torznab.js +14 -89
- package/dist/torznab.js.map +1 -1
- package/dist/trpc/fastifyAdapter.d.ts +2 -0
- package/dist/trpc/fastifyAdapter.js +9 -0
- package/dist/trpc/fastifyAdapter.js.map +1 -0
- package/dist/trpc/index.d.ts +49 -0
- package/dist/trpc/index.js +53 -0
- package/dist/trpc/index.js.map +1 -0
- package/dist/trpc/routers/auth.d.ts +43 -0
- package/dist/trpc/routers/auth.js +116 -0
- package/dist/trpc/routers/auth.js.map +1 -0
- package/dist/trpc/routers/clients.d.ts +21 -0
- package/dist/trpc/routers/clients.js +65 -0
- package/dist/trpc/routers/clients.js.map +1 -0
- package/dist/trpc/routers/health.d.ts +14 -0
- package/dist/trpc/routers/health.js +20 -0
- package/dist/trpc/routers/health.js.map +1 -0
- package/dist/trpc/routers/index.d.ts +391 -0
- package/dist/trpc/routers/index.js +23 -0
- package/dist/trpc/routers/index.js.map +1 -0
- package/dist/trpc/routers/indexers.d.ts +75 -0
- package/dist/trpc/routers/indexers.js +79 -0
- package/dist/trpc/routers/indexers.js.map +1 -0
- package/dist/trpc/routers/jobs.d.ts +33 -0
- package/dist/trpc/routers/jobs.js +84 -0
- package/dist/trpc/routers/jobs.js.map +1 -0
- package/dist/trpc/routers/logs.d.ts +27 -0
- package/dist/trpc/routers/logs.js +91 -0
- package/dist/trpc/routers/logs.js.map +1 -0
- package/dist/trpc/routers/searchees.d.ts +51 -0
- package/dist/trpc/routers/searchees.js +156 -0
- package/dist/trpc/routers/searchees.js.map +1 -0
- package/dist/trpc/routers/settings.d.ts +83 -0
- package/dist/trpc/routers/settings.js +92 -0
- package/dist/trpc/routers/settings.js.map +1 -0
- package/dist/trpc/routers/stats.d.ts +42 -0
- package/dist/trpc/routers/stats.js +102 -0
- package/dist/trpc/routers/stats.js.map +1 -0
- package/dist/userAuth.d.ts +21 -0
- package/dist/userAuth.js +86 -0
- package/dist/userAuth.js.map +1 -0
- package/dist/utils/authUtils.d.ts +10 -0
- package/dist/utils/authUtils.js +24 -0
- package/dist/utils/authUtils.js.map +1 -0
- package/dist/utils/logWatcher.d.ts +28 -0
- package/dist/utils/logWatcher.js +218 -0
- package/dist/utils/logWatcher.js.map +1 -0
- package/dist/utils/object.d.ts +1 -0
- package/dist/utils/object.js +4 -0
- package/dist/utils/object.js.map +1 -0
- package/dist/utils.d.ts +175 -0
- package/dist/utils.js +61 -38
- package/dist/utils.js.map +1 -1
- package/dist/webui/assets/FieldInfo-Bxj_j8SJ.js +1 -0
- package/dist/webui/assets/Page-C3rteCZt.js +1 -0
- package/dist/webui/assets/array-field-DVSC6nHP.js +1 -0
- package/dist/webui/assets/badge-DTZMtS0e.js +1 -0
- package/dist/webui/assets/check-Bu3ldi63.js +1 -0
- package/dist/webui/assets/chevron-down-CRy8M0kJ.js +1 -0
- package/dist/webui/assets/clients-CW8oEZoQ.js +1 -0
- package/dist/webui/assets/connect-YBNsnjWT.js +1 -0
- package/dist/webui/assets/debug-mz8-WYZj.js +1 -0
- package/dist/webui/assets/directories-BSK28RgR.js +1 -0
- package/dist/webui/assets/duration-field-C6xoSlJg.js +1 -0
- package/dist/webui/assets/general-lJJxZhH7.js +1 -0
- package/dist/webui/assets/health-CXbsVrie.js +1 -0
- package/dist/webui/assets/index-Bi48hI2z.js +54 -0
- package/dist/webui/assets/index-C-Ul7GNg.css +1 -0
- package/dist/webui/assets/index-C2cH1Gst.js +1 -0
- package/dist/webui/assets/index-Cc5bDmJr.js +1 -0
- package/dist/webui/assets/jobs-CxmNab9w.js +1 -0
- package/dist/webui/assets/library-vaj2W8sE.js +1 -0
- package/dist/webui/assets/loader-circle-M0gu1gZ-.js +1 -0
- package/dist/webui/assets/logs-Cu9RyKS0.js +1 -0
- package/dist/webui/assets/search-2R5sIdT8.js +1 -0
- package/dist/webui/assets/select-field-BCqNLDrJ.js +1 -0
- package/dist/webui/assets/select-zHgqMzLj.js +1 -0
- package/dist/webui/assets/settings-CMYjpTbZ.js +1 -0
- package/dist/webui/assets/submit-button-BtcnyggQ.js +1 -0
- package/dist/webui/assets/switch-G0W3uJVN.js +1 -0
- package/dist/webui/assets/switch-field-IBd9ORNq.js +1 -0
- package/dist/webui/assets/table-DvgJU7Gh.js +1 -0
- package/dist/webui/assets/test-tube-BIwmoM45.js +1 -0
- package/dist/webui/assets/text-field-DruSbGhy.js +1 -0
- package/dist/webui/assets/time-BSMZjmyW.js +1 -0
- package/dist/webui/assets/trackers-D-OpAe63.js +7 -0
- package/dist/webui/assets/use-form-validation-context-BkAfWAh0.js +1 -0
- package/dist/webui/assets/use-settings-form-submit-CDRh-E9U.js +2 -0
- package/dist/webui/assets/useQuery-A4Hv_4uX.js +1 -0
- package/dist/webui/index.html +13 -0
- package/node_modules/@cross-seed/shared/dist/configSchema.d.ts +261 -0
- package/node_modules/@cross-seed/shared/dist/configSchema.d.ts.map +1 -0
- package/node_modules/@cross-seed/shared/dist/configSchema.js +53 -0
- package/node_modules/@cross-seed/shared/dist/configSchema.js.map +1 -0
- package/node_modules/@cross-seed/shared/dist/constants.d.ts +122 -0
- package/node_modules/@cross-seed/shared/dist/constants.d.ts.map +1 -0
- package/node_modules/@cross-seed/shared/dist/constants.js +127 -0
- package/node_modules/@cross-seed/shared/dist/constants.js.map +1 -0
- package/node_modules/@cross-seed/shared/dist/tsconfig.tsbuildinfo +1 -0
- package/node_modules/@cross-seed/shared/dist/utils.d.ts +6 -0
- package/node_modules/@cross-seed/shared/dist/utils.d.ts.map +1 -0
- package/node_modules/@cross-seed/shared/dist/utils.js +9 -0
- package/node_modules/@cross-seed/shared/dist/utils.js.map +1 -0
- package/node_modules/@cross-seed/shared/package.json +22 -0
- package/package.json +35 -11
- package/dist/config.template.cjs +0 -353
- package/dist/config.template.cjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Y as Ct,c as xe,r as s,j as a,Z as re,b as ae,$ as L,f as j,a0 as ve,d as A,g as h,e as Ne,a1 as Me,a2 as Te,a3 as _t,a4 as Rt,P as se,a5 as bt,a6 as It,a7 as yt,a8 as St,a9 as Et,aa as Pt,ab as Dt,ac as Nt,ad as Tt,i as O,ae as jt,B as At,af as Ot,S as kt}from"./index-Bi48hI2z.js";function Ft(e){return Ct({select:t=>t.location})}const Lt=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Gt=xe("ChevronRight",Lt);const Kt=[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]],$t=xe("Moon",Kt);const Bt=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],Ut=xe("Sun",Bt);function Pe(e){const t=Vt(e),n=s.forwardRef((o,r)=>{const{children:c,...i}=o,u=s.Children.toArray(c),p=u.find(Yt);if(p){const f=p.props.children,d=u.map(l=>l===p?s.Children.count(f)>1?s.Children.only(null):s.isValidElement(f)?f.props.children:null:l);return a.jsx(t,{...i,ref:r,children:s.isValidElement(f)?s.cloneElement(f,void 0,d):null})}return a.jsx(t,{...i,ref:r,children:c})});return n.displayName=`${e}.Slot`,n}function Vt(e){const t=s.forwardRef((n,o)=>{const{children:r,...c}=n;if(s.isValidElement(r)){const i=Ht(r),u=zt(c,r.props);return r.type!==s.Fragment&&(u.ref=o?re(o,i):i),s.cloneElement(r,u)}return s.Children.count(r)>1?s.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Wt=Symbol("radix.slottable");function Yt(e){return s.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Wt}function zt(e,t){const n={...t};for(const o in t){const r=e[o],c=t[o];/^on[A-Z]/.test(o)?r&&c?n[o]=(...u)=>{const p=c(...u);return r(...u),p}:r&&(n[o]=r):o==="style"?n[o]={...r,...c}:o==="className"&&(n[o]=[r,c].filter(Boolean).join(" "))}return{...e,...n}}function Ht(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function je(e){const t=e+"CollectionProvider",[n,o]=ae(t),[r,c]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=_=>{const{scope:g,children:M}=_,y=L.useRef(null),w=L.useRef(new Map).current;return a.jsx(r,{scope:g,itemMap:w,collectionRef:y,children:M})};i.displayName=t;const u=e+"CollectionSlot",p=Pe(u),f=L.forwardRef((_,g)=>{const{scope:M,children:y}=_,w=c(u,M),R=j(g,w.collectionRef);return a.jsx(p,{ref:R,children:y})});f.displayName=u;const d=e+"CollectionItemSlot",l="data-radix-collection-item",v=Pe(d),C=L.forwardRef((_,g)=>{const{scope:M,children:y,...w}=_,R=L.useRef(null),T=j(g,R),P=c(d,M);return L.useEffect(()=>(P.itemMap.set(R,{ref:R,...w}),()=>void P.itemMap.delete(R))),a.jsx(v,{[l]:"",ref:T,children:y})});C.displayName=d;function x(_){const g=c(e+"CollectionConsumer",_);return L.useCallback(()=>{const y=g.collectionRef.current;if(!y)return[];const w=Array.from(y.querySelectorAll(`[${l}]`));return Array.from(g.itemMap.values()).sort((P,D)=>w.indexOf(P.ref.current)-w.indexOf(D.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:i,Slot:f,ItemSlot:C},x,o]}var Xt=s.createContext(void 0);function Ae(e){const t=s.useContext(Xt);return e||t||"ltr"}var pe="rovingFocusGroup.onEntryFocus",Zt={bubbles:!1,cancelable:!0},q="RovingFocusGroup",[ge,Oe,qt]=je(q),[Jt,ke]=ae(q,[qt]),[Qt,en]=Jt(q),Fe=s.forwardRef((e,t)=>a.jsx(ge.Provider,{scope:e.__scopeRovingFocusGroup,children:a.jsx(ge.Slot,{scope:e.__scopeRovingFocusGroup,children:a.jsx(tn,{...e,ref:t})})}));Fe.displayName=q;var tn=s.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:o,loop:r=!1,dir:c,currentTabStopId:i,defaultCurrentTabStopId:u,onCurrentTabStopIdChange:p,onEntryFocus:f,preventScrollOnEntryFocus:d=!1,...l}=e,v=s.useRef(null),C=j(t,v),x=Ae(c),[_,g]=Ne({prop:i,defaultProp:u??null,onChange:p,caller:q}),[M,y]=s.useState(!1),w=Me(f),R=Oe(n),T=s.useRef(!1),[P,D]=s.useState(0);return s.useEffect(()=>{const b=v.current;if(b)return b.addEventListener(pe,w),()=>b.removeEventListener(pe,w)},[w]),a.jsx(Qt,{scope:n,orientation:o,dir:x,loop:r,currentTabStopId:_,onItemFocus:s.useCallback(b=>g(b),[g]),onItemShiftTab:s.useCallback(()=>y(!0),[]),onFocusableItemAdd:s.useCallback(()=>D(b=>b+1),[]),onFocusableItemRemove:s.useCallback(()=>D(b=>b-1),[]),children:a.jsx(A.div,{tabIndex:M||P===0?-1:0,"data-orientation":o,...l,ref:C,style:{outline:"none",...e.style},onMouseDown:h(e.onMouseDown,()=>{T.current=!0}),onFocus:h(e.onFocus,b=>{const $=!T.current;if(b.target===b.currentTarget&&$&&!M){const k=new CustomEvent(pe,Zt);if(b.currentTarget.dispatchEvent(k),!k.defaultPrevented){const V=R().filter(N=>N.focusable),W=V.find(N=>N.active),ee=V.find(N=>N.id===_),le=[W,ee,...V].filter(Boolean).map(N=>N.ref.current);Ke(le,d)}}T.current=!1}),onBlur:h(e.onBlur,()=>y(!1))})})}),Le="RovingFocusGroupItem",Ge=s.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:o=!0,active:r=!1,tabStopId:c,children:i,...u}=e,p=ve(),f=c||p,d=en(Le,n),l=d.currentTabStopId===f,v=Oe(n),{onFocusableItemAdd:C,onFocusableItemRemove:x,currentTabStopId:_}=d;return s.useEffect(()=>{if(o)return C(),()=>x()},[o,C,x]),a.jsx(ge.ItemSlot,{scope:n,id:f,focusable:o,active:r,children:a.jsx(A.span,{tabIndex:l?0:-1,"data-orientation":d.orientation,...u,ref:t,onMouseDown:h(e.onMouseDown,g=>{o?d.onItemFocus(f):g.preventDefault()}),onFocus:h(e.onFocus,()=>d.onItemFocus(f)),onKeyDown:h(e.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){d.onItemShiftTab();return}if(g.target!==g.currentTarget)return;const M=rn(g,d.orientation,d.dir);if(M!==void 0){if(g.metaKey||g.ctrlKey||g.altKey||g.shiftKey)return;g.preventDefault();let w=v().filter(R=>R.focusable).map(R=>R.ref.current);if(M==="last")w.reverse();else if(M==="prev"||M==="next"){M==="prev"&&w.reverse();const R=w.indexOf(g.currentTarget);w=d.loop?an(w,R+1):w.slice(R+1)}setTimeout(()=>Ke(w))}}),children:typeof i=="function"?i({isCurrentTabStop:l,hasTabStop:_!=null}):i})})});Ge.displayName=Le;var nn={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function on(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function rn(e,t,n){const o=on(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return nn[o]}function Ke(e,t=!1){const n=document.activeElement;for(const o of e)if(o===n||(o.focus({preventScroll:t}),document.activeElement!==n))return}function an(e,t){return e.map((n,o)=>e[(t+o)%e.length])}var sn=Fe,cn=Ge;function un(e){const t=ln(e),n=s.forwardRef((o,r)=>{const{children:c,...i}=o,u=s.Children.toArray(c),p=u.find(fn);if(p){const f=p.props.children,d=u.map(l=>l===p?s.Children.count(f)>1?s.Children.only(null):s.isValidElement(f)?f.props.children:null:l);return a.jsx(t,{...i,ref:r,children:s.isValidElement(f)?s.cloneElement(f,void 0,d):null})}return a.jsx(t,{...i,ref:r,children:c})});return n.displayName=`${e}.Slot`,n}function ln(e){const t=s.forwardRef((n,o)=>{const{children:r,...c}=n;if(s.isValidElement(r)){const i=mn(r),u=pn(c,r.props);return r.type!==s.Fragment&&(u.ref=o?re(o,i):i),s.cloneElement(r,u)}return s.Children.count(r)>1?s.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var dn=Symbol("radix.slottable");function fn(e){return s.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===dn}function pn(e,t){const n={...t};for(const o in t){const r=e[o],c=t[o];/^on[A-Z]/.test(o)?r&&c?n[o]=(...u)=>{const p=c(...u);return r(...u),p}:r&&(n[o]=r):o==="style"?n[o]={...r,...c}:o==="className"&&(n[o]=[r,c].filter(Boolean).join(" "))}return{...e,...n}}function mn(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var he=["Enter"," "],vn=["ArrowDown","PageUp","Home"],$e=["ArrowUp","PageDown","End"],gn=[...vn,...$e],hn={ltr:[...he,"ArrowRight"],rtl:[...he,"ArrowLeft"]},xn={ltr:["ArrowLeft"],rtl:["ArrowRight"]},J="Menu",[X,Mn,wn]=je(J),[G,Be]=ae(J,[wn,Te,ke]),ce=Te(),Ue=ke(),[Cn,K]=G(J),[_n,Q]=G(J),Ve=e=>{const{__scopeMenu:t,open:n=!1,children:o,dir:r,onOpenChange:c,modal:i=!0}=e,u=ce(t),[p,f]=s.useState(null),d=s.useRef(!1),l=Me(c),v=Ae(r);return s.useEffect(()=>{const C=()=>{d.current=!0,document.addEventListener("pointerdown",x,{capture:!0,once:!0}),document.addEventListener("pointermove",x,{capture:!0,once:!0})},x=()=>d.current=!1;return document.addEventListener("keydown",C,{capture:!0}),()=>{document.removeEventListener("keydown",C,{capture:!0}),document.removeEventListener("pointerdown",x,{capture:!0}),document.removeEventListener("pointermove",x,{capture:!0})}},[]),a.jsx(_t,{...u,children:a.jsx(Cn,{scope:t,open:n,onOpenChange:l,content:p,onContentChange:f,children:a.jsx(_n,{scope:t,onClose:s.useCallback(()=>l(!1),[l]),isUsingKeyboardRef:d,dir:v,modal:i,children:o})})})};Ve.displayName=J;var Rn="MenuAnchor",we=s.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e,r=ce(n);return a.jsx(Rt,{...r,...o,ref:t})});we.displayName=Rn;var Ce="MenuPortal",[bn,We]=G(Ce,{forceMount:void 0}),Ye=e=>{const{__scopeMenu:t,forceMount:n,children:o,container:r}=e,c=K(Ce,t);return a.jsx(bn,{scope:t,forceMount:n,children:a.jsx(se,{present:n||c.open,children:a.jsx(bt,{asChild:!0,container:r,children:o})})})};Ye.displayName=Ce;var E="MenuContent",[In,_e]=G(E),ze=s.forwardRef((e,t)=>{const n=We(E,e.__scopeMenu),{forceMount:o=n.forceMount,...r}=e,c=K(E,e.__scopeMenu),i=Q(E,e.__scopeMenu);return a.jsx(X.Provider,{scope:e.__scopeMenu,children:a.jsx(se,{present:o||c.open,children:a.jsx(X.Slot,{scope:e.__scopeMenu,children:i.modal?a.jsx(yn,{...r,ref:t}):a.jsx(Sn,{...r,ref:t})})})})}),yn=s.forwardRef((e,t)=>{const n=K(E,e.__scopeMenu),o=s.useRef(null),r=j(t,o);return s.useEffect(()=>{const c=o.current;if(c)return It(c)},[]),a.jsx(Re,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:h(e.onFocusOutside,c=>c.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Sn=s.forwardRef((e,t)=>{const n=K(E,e.__scopeMenu);return a.jsx(Re,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),En=un("MenuContent.ScrollLock"),Re=s.forwardRef((e,t)=>{const{__scopeMenu:n,loop:o=!1,trapFocus:r,onOpenAutoFocus:c,onCloseAutoFocus:i,disableOutsidePointerEvents:u,onEntryFocus:p,onEscapeKeyDown:f,onPointerDownOutside:d,onFocusOutside:l,onInteractOutside:v,onDismiss:C,disableOutsideScroll:x,..._}=e,g=K(E,n),M=Q(E,n),y=ce(n),w=Ue(n),R=Mn(n),[T,P]=s.useState(null),D=s.useRef(null),b=j(t,D,g.onContentChange),$=s.useRef(0),k=s.useRef(""),V=s.useRef(0),W=s.useRef(null),ee=s.useRef("right"),te=s.useRef(0),le=x?Et:s.Fragment,N=x?{as:En,allowPinchZoom:!0}:void 0,wt=m=>{const U=k.current+m,F=R().filter(S=>!S.disabled),Y=document.activeElement,de=F.find(S=>S.ref.current===Y)?.textValue,fe=F.map(S=>S.textValue),Se=Kn(fe,U,de),z=F.find(S=>S.textValue===Se)?.ref.current;(function S(Ee){k.current=Ee,window.clearTimeout($.current),Ee!==""&&($.current=window.setTimeout(()=>S(""),1e3))})(U),z&&setTimeout(()=>z.focus())};s.useEffect(()=>()=>window.clearTimeout($.current),[]),St();const B=s.useCallback(m=>ee.current===W.current?.side&&Bn(m,W.current?.area),[]);return a.jsx(In,{scope:n,searchRef:k,onItemEnter:s.useCallback(m=>{B(m)&&m.preventDefault()},[B]),onItemLeave:s.useCallback(m=>{B(m)||(D.current?.focus(),P(null))},[B]),onTriggerLeave:s.useCallback(m=>{B(m)&&m.preventDefault()},[B]),pointerGraceTimerRef:V,onPointerGraceIntentChange:s.useCallback(m=>{W.current=m},[]),children:a.jsx(le,{...N,children:a.jsx(Pt,{asChild:!0,trapped:r,onMountAutoFocus:h(c,m=>{m.preventDefault(),D.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:a.jsx(Dt,{asChild:!0,disableOutsidePointerEvents:u,onEscapeKeyDown:f,onPointerDownOutside:d,onFocusOutside:l,onInteractOutside:v,onDismiss:C,children:a.jsx(sn,{asChild:!0,...w,dir:M.dir,orientation:"vertical",loop:o,currentTabStopId:T,onCurrentTabStopIdChange:P,onEntryFocus:h(p,m=>{M.isUsingKeyboardRef.current||m.preventDefault()}),preventScrollOnEntryFocus:!0,children:a.jsx(Nt,{role:"menu","aria-orientation":"vertical","data-state":ut(g.open),"data-radix-menu-content":"",dir:M.dir,...y,..._,ref:b,style:{outline:"none",..._.style},onKeyDown:h(_.onKeyDown,m=>{const F=m.target.closest("[data-radix-menu-content]")===m.currentTarget,Y=m.ctrlKey||m.altKey||m.metaKey,de=m.key.length===1;F&&(m.key==="Tab"&&m.preventDefault(),!Y&&de&&wt(m.key));const fe=D.current;if(m.target!==fe||!gn.includes(m.key))return;m.preventDefault();const z=R().filter(S=>!S.disabled).map(S=>S.ref.current);$e.includes(m.key)&&z.reverse(),Ln(z)}),onBlur:h(e.onBlur,m=>{m.currentTarget.contains(m.target)||(window.clearTimeout($.current),k.current="")}),onPointerMove:h(e.onPointerMove,Z(m=>{const U=m.target,F=te.current!==m.clientX;if(m.currentTarget.contains(U)&&F){const Y=m.clientX>te.current?"right":"left";ee.current=Y,te.current=m.clientX}}))})})})})})})});ze.displayName=E;var Pn="MenuGroup",be=s.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e;return a.jsx(A.div,{role:"group",...o,ref:t})});be.displayName=Pn;var Dn="MenuLabel",He=s.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e;return a.jsx(A.div,{...o,ref:t})});He.displayName=Dn;var ne="MenuItem",De="menu.itemSelect",ie=s.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:o,...r}=e,c=s.useRef(null),i=Q(ne,e.__scopeMenu),u=_e(ne,e.__scopeMenu),p=j(t,c),f=s.useRef(!1),d=()=>{const l=c.current;if(!n&&l){const v=new CustomEvent(De,{bubbles:!0,cancelable:!0});l.addEventListener(De,C=>o?.(C),{once:!0}),yt(l,v),v.defaultPrevented?f.current=!1:i.onClose()}};return a.jsx(Xe,{...r,ref:p,disabled:n,onClick:h(e.onClick,d),onPointerDown:l=>{e.onPointerDown?.(l),f.current=!0},onPointerUp:h(e.onPointerUp,l=>{f.current||l.currentTarget?.click()}),onKeyDown:h(e.onKeyDown,l=>{const v=u.searchRef.current!=="";n||v&&l.key===" "||he.includes(l.key)&&(l.currentTarget.click(),l.preventDefault())})})});ie.displayName=ne;var Xe=s.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:o=!1,textValue:r,...c}=e,i=_e(ne,n),u=Ue(n),p=s.useRef(null),f=j(t,p),[d,l]=s.useState(!1),[v,C]=s.useState("");return s.useEffect(()=>{const x=p.current;x&&C((x.textContent??"").trim())},[c.children]),a.jsx(X.ItemSlot,{scope:n,disabled:o,textValue:r??v,children:a.jsx(cn,{asChild:!0,...u,focusable:!o,children:a.jsx(A.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":o||void 0,"data-disabled":o?"":void 0,...c,ref:f,onPointerMove:h(e.onPointerMove,Z(x=>{o?i.onItemLeave(x):(i.onItemEnter(x),x.defaultPrevented||x.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:h(e.onPointerLeave,Z(x=>i.onItemLeave(x))),onFocus:h(e.onFocus,()=>l(!0)),onBlur:h(e.onBlur,()=>l(!1))})})})}),Nn="MenuCheckboxItem",Ze=s.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:o,...r}=e;return a.jsx(tt,{scope:e.__scopeMenu,checked:n,children:a.jsx(ie,{role:"menuitemcheckbox","aria-checked":oe(n)?"mixed":n,...r,ref:t,"data-state":ye(n),onSelect:h(r.onSelect,()=>o?.(oe(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Ze.displayName=Nn;var qe="MenuRadioGroup",[Tn,jn]=G(qe,{value:void 0,onValueChange:()=>{}}),Je=s.forwardRef((e,t)=>{const{value:n,onValueChange:o,...r}=e,c=Me(o);return a.jsx(Tn,{scope:e.__scopeMenu,value:n,onValueChange:c,children:a.jsx(be,{...r,ref:t})})});Je.displayName=qe;var Qe="MenuRadioItem",et=s.forwardRef((e,t)=>{const{value:n,...o}=e,r=jn(Qe,e.__scopeMenu),c=n===r.value;return a.jsx(tt,{scope:e.__scopeMenu,checked:c,children:a.jsx(ie,{role:"menuitemradio","aria-checked":c,...o,ref:t,"data-state":ye(c),onSelect:h(o.onSelect,()=>r.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});et.displayName=Qe;var Ie="MenuItemIndicator",[tt,An]=G(Ie,{checked:!1}),nt=s.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:o,...r}=e,c=An(Ie,n);return a.jsx(se,{present:o||oe(c.checked)||c.checked===!0,children:a.jsx(A.span,{...r,ref:t,"data-state":ye(c.checked)})})});nt.displayName=Ie;var On="MenuSeparator",ot=s.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e;return a.jsx(A.div,{role:"separator","aria-orientation":"horizontal",...o,ref:t})});ot.displayName=On;var kn="MenuArrow",rt=s.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e,r=ce(n);return a.jsx(Tt,{...r,...o,ref:t})});rt.displayName=kn;var Fn="MenuSub",[Vo,at]=G(Fn),H="MenuSubTrigger",st=s.forwardRef((e,t)=>{const n=K(H,e.__scopeMenu),o=Q(H,e.__scopeMenu),r=at(H,e.__scopeMenu),c=_e(H,e.__scopeMenu),i=s.useRef(null),{pointerGraceTimerRef:u,onPointerGraceIntentChange:p}=c,f={__scopeMenu:e.__scopeMenu},d=s.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);return s.useEffect(()=>d,[d]),s.useEffect(()=>{const l=u.current;return()=>{window.clearTimeout(l),p(null)}},[u,p]),a.jsx(we,{asChild:!0,...f,children:a.jsx(Xe,{id:r.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":r.contentId,"data-state":ut(n.open),...e,ref:re(t,r.onTriggerChange),onClick:l=>{e.onClick?.(l),!(e.disabled||l.defaultPrevented)&&(l.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:h(e.onPointerMove,Z(l=>{c.onItemEnter(l),!l.defaultPrevented&&!e.disabled&&!n.open&&!i.current&&(c.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:h(e.onPointerLeave,Z(l=>{d();const v=n.content?.getBoundingClientRect();if(v){const C=n.content?.dataset.side,x=C==="right",_=x?-5:5,g=v[x?"left":"right"],M=v[x?"right":"left"];c.onPointerGraceIntentChange({area:[{x:l.clientX+_,y:l.clientY},{x:g,y:v.top},{x:M,y:v.top},{x:M,y:v.bottom},{x:g,y:v.bottom}],side:C}),window.clearTimeout(u.current),u.current=window.setTimeout(()=>c.onPointerGraceIntentChange(null),300)}else{if(c.onTriggerLeave(l),l.defaultPrevented)return;c.onPointerGraceIntentChange(null)}})),onKeyDown:h(e.onKeyDown,l=>{const v=c.searchRef.current!=="";e.disabled||v&&l.key===" "||hn[o.dir].includes(l.key)&&(n.onOpenChange(!0),n.content?.focus(),l.preventDefault())})})})});st.displayName=H;var ct="MenuSubContent",it=s.forwardRef((e,t)=>{const n=We(E,e.__scopeMenu),{forceMount:o=n.forceMount,...r}=e,c=K(E,e.__scopeMenu),i=Q(E,e.__scopeMenu),u=at(ct,e.__scopeMenu),p=s.useRef(null),f=j(t,p);return a.jsx(X.Provider,{scope:e.__scopeMenu,children:a.jsx(se,{present:o||c.open,children:a.jsx(X.Slot,{scope:e.__scopeMenu,children:a.jsx(Re,{id:u.contentId,"aria-labelledby":u.triggerId,...r,ref:f,align:"start",side:i.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{i.isUsingKeyboardRef.current&&p.current?.focus(),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:h(e.onFocusOutside,d=>{d.target!==u.trigger&&c.onOpenChange(!1)}),onEscapeKeyDown:h(e.onEscapeKeyDown,d=>{i.onClose(),d.preventDefault()}),onKeyDown:h(e.onKeyDown,d=>{const l=d.currentTarget.contains(d.target),v=xn[i.dir].includes(d.key);l&&v&&(c.onOpenChange(!1),u.trigger?.focus(),d.preventDefault())})})})})})});it.displayName=ct;function ut(e){return e?"open":"closed"}function oe(e){return e==="indeterminate"}function ye(e){return oe(e)?"indeterminate":e?"checked":"unchecked"}function Ln(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Gn(e,t){return e.map((n,o)=>e[(t+o)%e.length])}function Kn(e,t,n){const r=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,c=n?e.indexOf(n):-1;let i=Gn(e,Math.max(c,0));r.length===1&&(i=i.filter(f=>f!==n));const p=i.find(f=>f.toLowerCase().startsWith(r.toLowerCase()));return p!==n?p:void 0}function $n(e,t){const{x:n,y:o}=e;let r=!1;for(let c=0,i=t.length-1;c<t.length;i=c++){const u=t[c],p=t[i],f=u.x,d=u.y,l=p.x,v=p.y;d>o!=v>o&&n<(l-f)*(o-d)/(v-d)+f&&(r=!r)}return r}function Bn(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return $n(n,t)}function Z(e){return t=>t.pointerType==="mouse"?e(t):void 0}var Un=Ve,Vn=we,Wn=Ye,Yn=ze,zn=be,Hn=He,Xn=ie,Zn=Ze,qn=Je,Jn=et,Qn=nt,eo=ot,to=rt,no=st,oo=it,ue="DropdownMenu",[ro]=ae(ue,[Be]),I=Be(),[ao,lt]=ro(ue),dt=e=>{const{__scopeDropdownMenu:t,children:n,dir:o,open:r,defaultOpen:c,onOpenChange:i,modal:u=!0}=e,p=I(t),f=s.useRef(null),[d,l]=Ne({prop:r,defaultProp:c??!1,onChange:i,caller:ue});return a.jsx(ao,{scope:t,triggerId:ve(),triggerRef:f,contentId:ve(),open:d,onOpenChange:l,onOpenToggle:s.useCallback(()=>l(v=>!v),[l]),modal:u,children:a.jsx(Un,{...p,open:d,onOpenChange:l,dir:o,modal:u,children:n})})};dt.displayName=ue;var ft="DropdownMenuTrigger",pt=s.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:o=!1,...r}=e,c=lt(ft,n),i=I(n);return a.jsx(Vn,{asChild:!0,...i,children:a.jsx(A.button,{type:"button",id:c.triggerId,"aria-haspopup":"menu","aria-expanded":c.open,"aria-controls":c.open?c.contentId:void 0,"data-state":c.open?"open":"closed","data-disabled":o?"":void 0,disabled:o,...r,ref:re(t,c.triggerRef),onPointerDown:h(e.onPointerDown,u=>{!o&&u.button===0&&u.ctrlKey===!1&&(c.onOpenToggle(),c.open||u.preventDefault())}),onKeyDown:h(e.onKeyDown,u=>{o||(["Enter"," "].includes(u.key)&&c.onOpenToggle(),u.key==="ArrowDown"&&c.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(u.key)&&u.preventDefault())})})})});pt.displayName=ft;var so="DropdownMenuPortal",mt=e=>{const{__scopeDropdownMenu:t,...n}=e,o=I(t);return a.jsx(Wn,{...o,...n})};mt.displayName=so;var vt="DropdownMenuContent",gt=s.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=lt(vt,n),c=I(n),i=s.useRef(!1);return a.jsx(Yn,{id:r.contentId,"aria-labelledby":r.triggerId,...c,...o,ref:t,onCloseAutoFocus:h(e.onCloseAutoFocus,u=>{i.current||r.triggerRef.current?.focus(),i.current=!1,u.preventDefault()}),onInteractOutside:h(e.onInteractOutside,u=>{const p=u.detail.originalEvent,f=p.button===0&&p.ctrlKey===!0,d=p.button===2||f;(!r.modal||d)&&(i.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});gt.displayName=vt;var co="DropdownMenuGroup",io=s.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=I(n);return a.jsx(zn,{...r,...o,ref:t})});io.displayName=co;var uo="DropdownMenuLabel",ht=s.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=I(n);return a.jsx(Hn,{...r,...o,ref:t})});ht.displayName=uo;var lo="DropdownMenuItem",xt=s.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=I(n);return a.jsx(Xn,{...r,...o,ref:t})});xt.displayName=lo;var fo="DropdownMenuCheckboxItem",po=s.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=I(n);return a.jsx(Zn,{...r,...o,ref:t})});po.displayName=fo;var mo="DropdownMenuRadioGroup",vo=s.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=I(n);return a.jsx(qn,{...r,...o,ref:t})});vo.displayName=mo;var go="DropdownMenuRadioItem",ho=s.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=I(n);return a.jsx(Jn,{...r,...o,ref:t})});ho.displayName=go;var xo="DropdownMenuItemIndicator",Mo=s.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=I(n);return a.jsx(Qn,{...r,...o,ref:t})});Mo.displayName=xo;var wo="DropdownMenuSeparator",Mt=s.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=I(n);return a.jsx(eo,{...r,...o,ref:t})});Mt.displayName=wo;var Co="DropdownMenuArrow",_o=s.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=I(n);return a.jsx(to,{...r,...o,ref:t})});_o.displayName=Co;var Ro="DropdownMenuSubTrigger",bo=s.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=I(n);return a.jsx(no,{...r,...o,ref:t})});bo.displayName=Ro;var Io="DropdownMenuSubContent",yo=s.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=I(n);return a.jsx(oo,{...r,...o,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});yo.displayName=Io;var So=dt,Eo=pt,Po=mt,Do=gt,No=ht,To=xt,jo=Mt;function Ao({...e}){return a.jsx(So,{"data-slot":"dropdown-menu",...e})}function Oo({...e}){return a.jsx(Eo,{"data-slot":"dropdown-menu-trigger",...e})}function ko({className:e,sideOffset:t=4,...n}){return a.jsx(Po,{children:a.jsx(Do,{"data-slot":"dropdown-menu-content",sideOffset:t,className:O("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",e),...n})})}function me({className:e,inset:t,variant:n="default",...o}){return a.jsx(To,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":n,className:O("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...o})}function Wo({className:e,inset:t,...n}){return a.jsx(No,{"data-slot":"dropdown-menu-label","data-inset":t,className:O("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...n})}function Yo({className:e,...t}){return a.jsx(jo,{"data-slot":"dropdown-menu-separator",className:O("bg-border -mx-1 my-1 h-px",e),...t})}const Fo=({className:e})=>{const{setTheme:t}=jt();return a.jsxs(Ao,{children:[a.jsx(Oo,{asChild:!0,children:a.jsxs(At,{variant:"ghost",size:"icon",className:e,children:[a.jsx(Ut,{className:"h-[1.2rem] w-[1.2rem] scale-100 rotate-0 transition-all dark:scale-0 dark:-rotate-90"}),a.jsx($t,{className:"absolute h-[1.2rem] w-[1.2rem] scale-0 rotate-90 transition-all dark:scale-100 dark:rotate-0"}),a.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}),a.jsxs(ko,{children:[a.jsx(me,{onClick:()=>t("light"),children:"Light"}),a.jsx(me,{onClick:()=>t("dark"),children:"Dark"}),a.jsx(me,{onClick:()=>t("system"),children:"System"})]})]})};function Lo({...e}){return a.jsx("nav",{"aria-label":"breadcrumb","data-slot":"breadcrumb",...e})}function Go({className:e,...t}){return a.jsx("ol",{"data-slot":"breadcrumb-list",className:O("text-muted-foreground flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5",e),...t})}function Ko({className:e,...t}){return a.jsx("li",{"data-slot":"breadcrumb-item",className:O("inline-flex items-center gap-1.5",e),...t})}function $o({className:e,...t}){return a.jsx("span",{"data-slot":"breadcrumb-page",role:"link","aria-disabled":"true","aria-current":"page",className:O("text-foreground font-normal",e),...t})}function Bo({children:e,className:t,...n}){return a.jsx("li",{"data-slot":"breadcrumb-separator",role:"presentation","aria-hidden":"true",className:O("[&>svg]:size-3.5",t),...n,children:e??a.jsx(Gt,{})})}function zo({breadcrumbs:e,actions:t,children:n}){const o=Ft(),r=s.useMemo(()=>e||o.pathname.split("/").filter(Boolean).map(i=>i.charAt(0).toUpperCase()+i.slice(1)),[o.pathname,e]);return a.jsxs(a.Fragment,{children:[a.jsxs("header",{className:"flex h-12 shrink-0 items-center gap-2 border-b px-4",children:[a.jsx(Ot,{className:"-ml-1"}),a.jsx(kt,{orientation:"vertical",className:"mr-2 h-4"}),a.jsx(Lo,{children:a.jsx(Go,{children:r.map((c,i)=>a.jsxs(s.Fragment,{children:[a.jsx(Ko,{children:i===r.length-1?a.jsx($o,{children:c}):c}),i<r.length-1&&a.jsx(Bo,{})]},i))})}),a.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[t,a.jsx(Fo,{})]})]}),a.jsx("div",{className:"flex flex-1 flex-col",children:a.jsx("div",{className:"@container/main",children:a.jsx("div",{className:"flex flex-col gap-4 p-4",children:n})})})]})}export{Gt as C,Ao as D,zo as P,Oo as a,ko as b,me as c,Wo as d,Yo as e,je as f,Ae as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as i,j as t,B as o,i as n,J as c}from"./index-Bi48hI2z.js";import{m as d}from"./use-settings-form-submit-CDRh-E9U.js";const u=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]],x=i("Trash2",u),m=({className:a,onClick:s})=>t.jsxs(o,{type:"button",variant:"destructive",className:n("",a),onClick:s,children:[t.jsx("span",{className:"sr-only",children:"Delete option"}),t.jsx(x,{className:"size-4"})]}),y=({className:a,showDelete:s=!1,onDelete:r})=>{const e=d();return t.jsxs("div",{className:n("flex items-center gap-2",a),children:[t.jsx(c,{type:"text",id:`${e.name}`,className:"form-input",value:e.state.value?String(e.state.value):"","aria-invalid":!!(e.state.meta.isTouched&&e.state.meta.errorMap.onBlur?.length>0),onBlur:e.handleBlur,onChange:l=>e.handleChange(l.target.value)}),s&&t.jsx(m,{onClick:r})]})};export{y as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as n,K as s,i as o,M as d}from"./index-Bi48hI2z.js";const c=d("focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-md border px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] [&>svg]:pointer-events-none [&>svg]:size-3",{variants:{variant:{default:"bg-primary text-primary-foreground [a&]:hover:bg-primary/90 border-transparent",secondary:"bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90 border-transparent",destructive:"bg-destructive [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60 border-transparent text-white",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function u({className:e,variant:r,asChild:t=!1,...a}){const i=t?s:"span";return n.jsx(i,{"data-slot":"badge",className:o(c({variant:r}),e),...a})}export{u as B};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c}from"./index-Bi48hI2z.js";const e=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],t=c("Check",e);export{t as C};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as o}from"./index-Bi48hI2z.js";const n=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],c=o("ChevronDown",n);export{c as C};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as ge,j as e,y as W,z as X,A as Z,E as ee,F as se,L as O,G as te,B as v,H as ne,Q as je,r as g,u as re,t as J}from"./index-Bi48hI2z.js";import{u as le,i as q,j as ie,b as ae,c as z,F as oe,k as B,f as Ce,p as be,a as we,A as Ne}from"./use-settings-form-submit-CDRh-E9U.js";import{u as de}from"./useQuery-A4Hv_4uX.js";import{P as Se,D as ve,a as Fe,b as ye,d as Te,c as I}from"./Page-C3rteCZt.js";import{T as Ae,a as De,b as H,c as V,d as Ue,e as F}from"./table-DvgJU7Gh.js";import{P as ce,T as Le,E as Oe,a as Ve,b as ke}from"./test-tube-BIwmoM45.js";import{L as Pe}from"./loader-circle-M0gu1gZ-.js";const Ee=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}]],Re=ge("Trash",Ee);function Me({open:l,onOpenChange:a,client:r,onEdit:d}){return e.jsx(W,{open:l,onOpenChange:a,children:e.jsxs(X,{className:"sm:max-w-md",children:[e.jsxs(Z,{children:[e.jsx(ee,{children:"View Torrent Client"}),e.jsx(se,{children:"View torrent client details."})]}),e.jsxs("div",{className:"grid flex-1 auto-rows-min gap-6 px-4",children:[e.jsxs("div",{className:"grid gap-3",children:[e.jsx(O,{children:"URL"}),e.jsx("div",{className:"bg-muted/50 rounded-md border px-3 py-2 font-mono text-sm break-all",children:r?.url||"N/A"})]}),e.jsxs("div",{className:"grid gap-3",children:[e.jsx(O,{children:"Username"}),e.jsx("div",{className:"bg-muted/50 rounded-md border px-3 py-2 font-mono text-sm break-all",children:r?.user||"N/A"})]}),e.jsxs("div",{className:"grid gap-3",children:[e.jsx(O,{children:"Password"}),e.jsx("div",{className:"bg-muted/50 rounded-md border px-3 py-2 font-mono text-sm break-all",children:r?.password?"********":"N/A"})]}),e.jsxs("div",{className:"grid gap-3",children:[e.jsx(O,{children:"Read only"}),e.jsx("div",{className:"bg-muted/50 rounded-md border px-3 py-2 font-mono text-sm break-all",children:r?.readOnly?"Yes":"No"})]})]}),e.jsxs(te,{children:[d&&e.jsxs(v,{type:"button",onClick:()=>d(r),className:"flex-1",children:[e.jsx(ce,{className:"mr-2 h-4 w-4"}),"Edit"]}),e.jsx(ne,{asChild:!0,className:"flex-1",children:e.jsx(v,{type:"button",variant:"outline",className:"flex-1",children:"Close"})})]})]})})}function _(l){return new URL(l).protocol}function Q(l){return new URL(l).host}const $e=l=>{try{const a=_(l),r=Q(l);return`${a}//${r}`}catch(a){return console.warn("Unable to strip credentials from client URL",a),l}};function qe({client:l,protocol:a,host:r,username:d="",password:h}){let o="";l!=="deluge"&&d&&(o=d),h&&(o+=`:${h}`),o+="@";const C=ue(l,!1);return`${a}//${o}${r}${C}`}function Be({client:l,protocol:a,host:r,username:d="",password:h="",readonly:o=!1,usePlugin:C=!1}){let m="";d&&(m+=d),h&&(m+=`:${h}`),m+="@";const w=ue(l,C);return`${l.toLowerCase()}:${o?"readonly:":""}${a}//${m}${r}${w}`}function ue(l,a){switch(l.toLowerCase()){case"qbittorrent":return"";case"transmission":return"/transmission/rpc";case"deluge":return"/json";case"rtorrent":return a?"/rutorrent/plugins/httprpc/action.php":"/RPC2";default:return""}}const Ie=async({client:l,url:a,username:r="",password:d,plugin:h=!1})=>{try{return{success:(await je.clients.testConnection.mutate({client:l.toLowerCase(),url:a,username:r,password:d,readonly:!1,plugin:h})).success}}catch(o){return console.error("Error testing connection:",o),{success:!1}}},K={qbittorrent:"qBittorrent",rtorrent:"rTorrent",transmission:"Transmission",deluge:"Deluge"};function He({open:l,onOpenChange:a,mode:r,client:d}){const[h,o]=g.useState(!1),{isFieldRequired:C}=le(q),m=re(),{data:w}=de(m.settings.get.queryOptions(void 0,{select:t=>t.config.torrentClients||[]})),{saveConfig:N,isLoading:k}=ie(),c=ae({...z,defaultValues:d??{},onSubmit:async({value:t})=>{try{const p={...t,readOnly:t?.readOnly??!1},x=q.safeParse(p);if(x.success){const i=x.data,f=_(i.url),S=Q(i.url),j=Be({client:i.client,protocol:f,host:S,username:i.user??"",password:i.password??"",readonly:i.readOnly});let b;r==="edit"&&d&&d.index!==void 0?(b=[...w||[]],b[d.index]=j):b=[...w||[],j],N({torrentClients:b}),a(!1)}else throw console.error("FULL VALIDATION FAILED:",x.error.format()),new Error("Validation failed")}catch(p){return console.error("Exception during full validation:",p),{status:"error",error:{_form:"An unexpected error occurred during validation"}}}},validators:{onSubmit:q}}),P=async()=>{o(!0);const t=String(c.getFieldValue("client")),p=String(c.getFieldValue("url")),x=String(c.getFieldValue("user")||""),i=String(c.getFieldValue("password")||""),f=qe({client:t,protocol:_(p),host:Q(p),username:x,password:i});(await Ie({client:t,url:f,username:x,password:i,plugin:!1})).success?(J.success("Connection successful!",{description:"The torrent client connection was successful."}),o(!1)):(J.error("Connection failed",{description:"Failed to connect to the torrent client."}),o(!1))},y=k||h;return e.jsx(W,{open:l,onOpenChange:a,children:e.jsx(X,{className:"sm:max-w-md",children:e.jsx(oe,{isFieldRequired:C,children:e.jsxs("form",{onSubmit:t=>{t.preventDefault(),t.stopPropagation(),c.handleSubmit()},children:[e.jsxs(Z,{children:[e.jsx(ee,{children:r==="edit"?"Edit Client":"Create Client"}),e.jsx(se,{children:r==="edit"?"Edit the details of the torrent client.":"Create a new torrent client."})]}),e.jsxs("div",{className:"grid flex-1 auto-rows-min gap-6 px-4",children:[e.jsx("div",{className:"grid gap-3",children:e.jsx(c.AppField,{name:"client",children:t=>e.jsxs(e.Fragment,{children:[e.jsx(t.SelectField,{label:"Client",options:K}),t.state.value===K.rtorrent.toLowerCase()&&e.jsx(c.AppField,{name:"plugin",children:p=>e.jsx(p.SwitchField,{label:"Use Plugin URL"})})]})})}),e.jsx("div",{className:"grid gap-3",children:e.jsx(c.AppField,{name:"url",children:t=>e.jsx(t.TextField,{label:"Client URL"})})}),e.jsx("div",{className:"grid gap-3",children:e.jsx(c.AppField,{name:"user",children:t=>e.jsx(t.TextField,{label:"User"})})}),e.jsx("div",{className:"grid gap-3",children:e.jsx(c.AppField,{name:"password",children:t=>e.jsx(t.TextField,{label:"Password",type:"password"})})}),e.jsx("div",{className:"grid gap-3",children:e.jsx(c.AppField,{name:"readOnly",children:t=>e.jsx(t.SwitchField,{label:"Read only"})})}),e.jsx(c.Subscribe,{selector:t=>({urlValue:t.values.url,urlMeta:t.fieldMeta.url,userValue:t.values.user,userMeta:t.fieldMeta.user,passwordValue:t.values.password,passwordMeta:t.fieldMeta.password,clientValue:t.values.client}),children:({urlValue:t,urlMeta:p,userValue:x,userMeta:i,passwordValue:f,passwordMeta:S,clientValue:j})=>{const b=t&&!p?.errors?.length,E=j==="transmission"&&f===void 0?!0:f&&!S?.errors?.length,R=j==="deluge"||j==="transmission"?!0:x&&!i?.errors?.length,T=b&&E&&R;return e.jsxs(e.Fragment,{children:[e.jsx(v,{type:"button",variant:"outline",onClick:P,disabled:!T,className:"w-full",children:h?e.jsxs(e.Fragment,{children:[e.jsx(Pe,{className:"animate-spin"}),"Testing connection..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Le,{className:"mr-2"}),"Test Connection"]})}),j==="qbittorrent"&&e.jsxs("p",{className:"text-muted-foreground -mt-4 px-2 text-sm italic",children:["Note: Testing connections can return false positives if"," ",e.jsx("code",{className:"bg-yellow-100 px-1",children:"Bypass auth on localhost"})," ","is enabled in qBittorrent."]})]})}})]}),e.jsxs(te,{className:"mt-6",children:[e.jsx(c.AppForm,{children:e.jsx(c.SubmitButton,{label:r==="edit"?"Update":"Create",actionLabel:r==="edit"?"Updating...":"Creating..."})}),e.jsx(ne,{asChild:!0,children:e.jsx(v,{type:"button",variant:"outline",disabled:y,children:"Cancel"})})]})]})})})})}function We(){const l=re(),{saveConfig:a}=ie(),[r,d]=g.useState(void 0),[h,o]=g.useState(null),[C,m]=g.useState(null),[w,N]=g.useState(!1),[k,c]=g.useState(!1),[P,y]=g.useState("create"),{isFieldRequired:t}=le(B),{data:p}=de(l.settings.get.queryOptions(void 0,{select:s=>{const n=Ce(s.config);return be(B,n,{includeUndefined:!0})}})),x=we(),i=ae({...z,defaultValues:p??z.defaultValues,onSubmit:x,validators:{onSubmit:B}}),[f,S]=g.useState(null);g.useEffect(()=>{f&&(document.getElementById(f)?.focus(),S(null))},[f]),g.useEffect(()=>{const s=p?.torrentClients??[];if(!s.length){d([]);return}const n=s.map((u,xe)=>{if(!u)return null;let A="",D="",U=!1,M="",$="";if(typeof u=="object")A=u.client,U=u.readOnly||!1,D=u.url,M=u.user||"",$=u.password||"";else if(typeof u=="string"){A=String(u).split(":")[0],U=String(u).includes("readonly");const fe=String(u).indexOf(":"),L=U?String(u).substring(String(u).indexOf(":",fe+1)+1):String(u).substring(String(u).indexOf(":")+1);if(!L)return null;const G=$e(L);if(!G)return null;D=G,M=j(L),$=b(L)}return!A||!D?null:{index:xe,client:A,url:D,user:M,password:$,readOnly:U}}).filter(Boolean);d(n)},[p]);const j=s=>{if(s.includes("@")){const n=s.split("://")[1].split("@")[0];return n.includes(":")?n.split(":")[0]:n.replace(":","")}return""},b=s=>{if(s.includes("@")){const n=s.split("://")[1].split("@")[0];if(n.includes(":"))return n.split(":")[1]}return""},E=s=>{s.preventDefault(),s.stopPropagation(),m(null),y("create"),c(!0)},R=s=>{N(s),s||o(null)},T=(s,n)=>{s.preventDefault(),s.stopPropagation(),o(null),m(n),N(!0)},Y=s=>{o(null),m(s),y("edit"),N(!1),c(!0)},pe=s=>{o(null);const n=r?.filter(u=>u.url!==s.url);d(n),a({torrentClients:n||[]})},he=s=>{c(s),s||o(null)},me=e.jsxs(v,{onClick:E,type:"button",size:"sm",children:[e.jsx(ke,{className:"mr-2 h-4 w-4"}),"Add Torrent Client"]});return e.jsxs(Se,{breadcrumbs:["Settings","Torrent Clients"],actions:me,children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:"Torrent Clients"}),e.jsx("p",{className:"text-muted-foreground",children:"Manage your torrent clients"})]}),r?e.jsx("div",{className:"mt-4 mb-7 overflow-x-auto rounded-lg border",children:e.jsxs(Ae,{children:[e.jsx(De,{className:"bg-muted sticky top-0 z-10",children:e.jsxs(H,{className:"border-b",children:[e.jsx(V,{children:"Client"}),e.jsx(V,{children:"RPC URL"}),e.jsx(V,{children:"Read only"}),e.jsx(V,{className:"text-right",children:"Actions"})]})}),e.jsxs(Ue,{children:[r?.length===0&&e.jsx(H,{children:e.jsx(F,{colSpan:6,className:"text-center",children:e.jsx("p",{className:"text-muted-foreground",children:"No torrent clients configured. Add a client to start downloading."})})}),r?.map(s=>e.jsxs(H,{className:"hover:bg-muted/50 cursor-pointer",onClick:n=>T(n,s),children:[e.jsx(F,{className:"font-medium",children:s.client}),e.jsx(F,{className:"font-mono text-sm",children:s.url}),e.jsx(F,{children:s.readOnly?"Yes":"No"}),e.jsx(F,{className:"text-right",children:e.jsxs(ve,{open:h===s.url,onOpenChange:n=>o(n?s.url:null),children:[e.jsx(Fe,{asChild:!0,children:e.jsxs(v,{variant:"ghost",className:"h-8 w-8 p-0",type:"button",onClick:n=>{n.preventDefault(),n.stopPropagation()},children:[e.jsx("span",{className:"sr-only",children:"Actions"}),e.jsx(Oe,{className:"h-4 w-4"})]})}),e.jsxs(ye,{align:"end",children:[e.jsx(Te,{children:"Actions"}),e.jsxs(I,{onClick:n=>{T(n,s)},children:[e.jsx(Ve,{className:"mr-2 h-4 w-4"}),"View Details"]}),e.jsxs(I,{onClick:n=>{n.stopPropagation(),Y(s)},children:[e.jsx(ce,{className:"mr-2 h-4 w-4"}),"Edit"]}),e.jsxs(I,{variant:"destructive",onClick:n=>{n.stopPropagation(),pe(s)},children:[e.jsx(Re,{className:"mr-2 h-4 w-4"}),"Delete"]})]})]})})]},s.url))]})]})}):e.jsx("p",{className:"mb-4 text-lg",children:"No torrent clients configured. Add a client"}),e.jsx(oe,{isFieldRequired:t,children:e.jsx("form",{className:"form flex flex-col gap-4",onSubmit:s=>{s.preventDefault(),s.stopPropagation(),i.handleSubmit()},noValidate:!0,children:e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx("h2",{className:"text-xl font-bold",children:"Torrent Client Options"}),e.jsxs("fieldset",{className:"form-fieldset w-full gap-6 rounded-md",children:[e.jsx("div",{className:"",children:e.jsx(i.AppField,{name:"action",children:s=>e.jsx(s.SelectField,{label:"Action",options:Ne})})}),e.jsx("div",{className:"",children:e.jsx(i.AppField,{name:"linkCategory",validators:{},children:s=>e.jsx(s.TextField,{label:"Link Category",required:!1})})}),e.jsx("div",{className:"",children:e.jsx(i.AppField,{name:"torrentDir",validators:{},children:s=>e.jsx(s.TextField,{label:"Torrent Directory",required:!1})})}),e.jsx("div",{className:"",children:e.jsx(i.AppField,{name:"outputDir",validators:{},children:s=>e.jsx(s.TextField,{label:"Output Directory",required:!1})})}),e.jsxs("div",{className:"form-field-switches col-span-2 gap-x-12",children:[e.jsx(i.AppField,{name:"skipRecheck",children:s=>e.jsx(s.SwitchField,{label:"Skip Recheck"})}),e.jsx(i.AppField,{name:"useClientTorrents",children:s=>e.jsx(s.SwitchField,{label:"Use Client Torrents"})}),e.jsx(i.AppField,{name:"duplicateCategories",children:s=>e.jsx(s.SwitchField,{label:"Duplicate Categories"})})]})]}),e.jsx(i.AppForm,{children:e.jsx(i.SubmitButton,{})})]})})})]}),e.jsx(Me,{open:w,onOpenChange:R,client:C,onEdit:Y}),e.jsx(He,{open:k,onOpenChange:he,client:C,mode:P})]})}export{We as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{u as g,r as x,j as e,L as d,B as i}from"./index-Bi48hI2z.js";import{F as m}from"./FieldInfo-Bxj_j8SJ.js";import{u as y,h as u,f as N,p as f,a as A,b as $,c as j,F as S,d as h,l as p}from"./use-settings-form-submit-CDRh-E9U.js";import{u as w}from"./useQuery-A4Hv_4uX.js";import{P as D}from"./Page-C3rteCZt.js";function R(){const{isFieldRequired:n}=y(u),v=g(),{data:b}=w(v.settings.get.queryOptions(void 0,{select:a=>{const r=N(a.config);return f(u,r,{includeUndefined:!0})}})),F=A(),l=$({...j,defaultValues:b??j.defaultValues,onSubmit:F,validators:{onSubmit:u}}),[c,o]=x.useState(null);return x.useEffect(()=>{c&&(document.getElementById(c)?.focus(),o(null))},[c]),e.jsx(D,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:"Connected App Settings"}),e.jsx("p",{className:"text-muted-foreground",children:"Manage apps connected to Cross-seed."})]}),e.jsx(S,{isFieldRequired:n,children:e.jsx("form",{className:"form flex flex-col gap-4",onSubmit:a=>{a.preventDefault(),a.stopPropagation(),l.handleSubmit()},noValidate:!0,children:e.jsxs("div",{className:"flex flex-wrap gap-6",children:[e.jsxs("fieldset",{className:"form-fieldset w-full gap-6",children:[e.jsx("div",{children:e.jsx(l.AppField,{name:"host",validators:{},children:a=>e.jsx(a.TextField,{label:"Host"})})}),e.jsx("div",{className:"",children:e.jsx(l.AppField,{name:"port",validators:{},children:a=>e.jsx(a.TextField,{label:"Port",type:"number"})})}),e.jsx("div",{className:"",children:e.jsx(l.AppField,{name:"apiKey",validators:{},children:a=>e.jsx(a.TextField,{label:"API Key"})})})]}),e.jsxs("fieldset",{className:"form-fieldset border-border w-full gap-6 rounded-md border",children:[e.jsx("legend",{children:"Connect to Other Apps"}),e.jsx("div",{className:"",children:e.jsx(l.Field,{name:"sonarr",mode:"array",validators:{},children:a=>e.jsxs("div",{className:"space-y-3",children:[e.jsxs(d,{htmlFor:a.name,className:"block w-full",children:["Sonarr URL(s)",n(a.name)&&e.jsx("span",{className:"pl-1 text-red-500",children:"*"})]}),a.state.value&&a.state.value.map((r,s)=>e.jsxs("div",{className:"gap-y- mb-3 flex flex-col",children:[e.jsx(l.AppField,{name:`sonarr[${s}]`,validators:{onBlur:h().url().or(p(""))},children:t=>e.jsx(t.ArrayField,{showDelete:a.state.value&&a.state.value?.length>1,index:s,onDelete:()=>{a.removeValue(s)}})}),e.jsx(l.Subscribe,{selector:t=>t.fieldMeta[`${a.name}[${s}]`],children:t=>e.jsx(m,{fieldMeta:t})})]},s)),e.jsx(i,{variant:"secondary",type:"button",onClick:()=>{a.pushValue("");const r=`${a.name}-${a.state.value?.length?a.state.value.length-1:0}`;o(r)},title:`Add ${a.name}`,children:"Add"})]})})}),e.jsx("div",{children:e.jsx(l.Field,{name:"radarr",mode:"array",validators:{},children:a=>e.jsxs("div",{className:"space-y-3",children:[e.jsxs(d,{htmlFor:a.name,className:"block w-full",children:["Radarr URL(s)",n(a.name)&&e.jsx("span",{className:"pl-1 text-red-500",children:"*"})]}),a.state.value&&a.state.value.map((r,s)=>e.jsxs("div",{className:"gap-y- mb-3 flex flex-col",children:[e.jsx(l.AppField,{name:`radarr[${s}]`,validators:{onBlur:h().url().or(p(""))},children:t=>e.jsx(t.ArrayField,{showDelete:a.state.value&&a.state.value?.length>1,index:s,onDelete:()=>{a.removeValue(s)}})}),e.jsx(l.Subscribe,{selector:t=>t.fieldMeta[`${a.name}[${s}]`],children:t=>e.jsx(m,{fieldMeta:t})})]},s)),e.jsx(i,{variant:"secondary",type:"button",onClick:()=>{a.pushValue("");const r=`${a.name}-${a.state.value?.length?a.state.value.length-1:0}`;o(r)},title:`Add ${a.name}`,children:"Add"})]})})}),e.jsx("div",{className:"",children:e.jsx(l.Field,{name:"notificationWebhookUrls",mode:"array",validators:{},children:a=>e.jsxs("div",{className:"space-y-3",children:[e.jsxs(d,{htmlFor:a.name,className:"block w-full",children:["Notification Webhook URL(s)",n(a.name)&&e.jsx("span",{className:"pl-1 text-red-500",children:"*"})]}),a.state.value?.map((r,s)=>e.jsxs("div",{className:"gap-y- mb-3 flex flex-col",children:[e.jsx(l.AppField,{name:`notificationWebhookUrls[${s}]`,validators:{onBlur:h().min(3).url().or(p(""))},children:t=>e.jsx(t.ArrayField,{showDelete:a.state.value&&a.state.value?.length>1,index:s,onDelete:()=>{a.removeValue(s)}})}),e.jsx(l.Subscribe,{selector:t=>t.fieldMeta[`${a.name}[${s}]`],children:t=>e.jsx(m,{fieldMeta:t})})]},s)),e.jsx(i,{variant:"secondary",type:"button",onClick:()=>{a.pushValue("");const r=`${a.name}-${a.state.value?.length?a.state.value.length-1:0}`;o(r)},title:`Add ${a.name}`,children:"Add"})]})})})]}),e.jsx(l.AppForm,{children:e.jsx(l.SubmitButton,{})})]})})})]})})}export{R as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,u as O,I as k,l as w,t as o,j as s,B as x}from"./index-Bi48hI2z.js";import{u as C}from"./useQuery-A4Hv_4uX.js";import{P as h}from"./Page-C3rteCZt.js";function P(){const[c,d]=t.useState(""),[n,l]=t.useState(!0),[p,u]=t.useState(""),f=t.useRef(null),m=O(),v=k(),{data:r,isLoading:b}=C(m.settings.get.queryOptions()),a=w(m.settings.replace.mutationOptions({onSuccess:()=>{o.success("Settings saved successfully!",{description:"Your changes will take effect on the next restart."}),v.invalidateQueries({queryKey:["settings.get"]})},onError:e=>{o.error("Failed to save settings",{description:e.message||"An unknown error occurred"})}})),g=()=>{const e=f.current;if(e){const i=window.pageYOffset||document.documentElement.scrollTop;e.style.height="auto",e.style.height=`${e.scrollHeight}px`,requestAnimationFrame(()=>{window.scrollTo(0,i)})}};t.useEffect(()=>{r?.config&&d(JSON.stringify(r.config,null,2))},[r]),t.useEffect(()=>{g()},[c]);const y=e=>{try{return JSON.parse(e),l(!0),u(""),!0}catch(i){return l(!1),u(i instanceof Error?i.message:"Invalid JSON"),!1}},j=e=>{d(e),y(e),setTimeout(g,0)},S=()=>{if(!n){o.error("Cannot save invalid JSON");return}try{const e=JSON.parse(c);a.mutate(e)}catch{o.error("Failed to parse JSON")}},N=()=>{r?.config&&(d(JSON.stringify(r.config,null,2)),l(!0),u(""),setTimeout(g,0))};if(b)return s.jsx(h,{breadcrumbs:["Diagnostics","Debug"],children:s.jsx("div",{className:"flex items-center justify-center p-8",children:s.jsx("div",{children:"Loading settings..."})})});const J=s.jsxs("div",{className:"flex gap-2",children:[s.jsx(x,{variant:"outline",onClick:N,disabled:a.isPending,children:"Reset"}),s.jsx(x,{onClick:S,disabled:!n||a.isPending,children:a.isPending?"Saving...":"Save"})]});return s.jsx(h,{breadcrumbs:["Diagnostics","Debug"],actions:J,children:s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold",children:"Debug Settings"}),s.jsx("p",{className:"text-muted-foreground",children:"Raw JSON editor for debugging configuration issues"})]}),s.jsx("div",{className:"relative",children:s.jsx("textarea",{ref:f,value:c,onChange:e=>j(e.target.value),className:`min-h-96 w-full resize-none overflow-hidden rounded-md border p-3 font-mono text-sm ${n?"border-gray-300 dark:border-gray-600":"border-red-500 dark:border-red-400"} bg-white text-gray-900 dark:bg-gray-900 dark:text-gray-100`,spellCheck:!1,placeholder:"Loading settings..."})}),!n&&s.jsxs("div",{className:"rounded-md bg-red-50 p-3 text-sm text-red-700 dark:bg-red-900/20 dark:text-red-400",children:[s.jsx("strong",{children:"JSON Error:"})," ",p]})]})})}export{P as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{u as f,r as d,j as e,L as m,B as u}from"./index-Bi48hI2z.js";import{u as g,e as c,f as b,p as y,a as D,b as N,c as p,F as S,d as h,L as A}from"./use-settings-form-submit-CDRh-E9U.js";import{F as x}from"./FieldInfo-Bxj_j8SJ.js";import{u as k}from"./useQuery-A4Hv_4uX.js";import{P as $}from"./Page-C3rteCZt.js";function T(){const{isFieldRequired:n}=g(c),j=f(),{data:v}=k(j.settings.get.queryOptions(void 0,{select:a=>{const r=b(a.config);return y(c,r,{includeUndefined:!0})}})),F=D(),s=N({...p,defaultValues:v??p.defaultValues,onSubmit:F,validators:{onSubmit:c}}),[i,o]=d.useState(null);return d.useEffect(()=>{i&&(document.getElementById(i)?.focus(),o(null))},[i]),e.jsx($,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:"Directory & Path Settings"}),e.jsx("p",{className:"text-muted-foreground",children:"Manage the directories and paths used by cross-seed."})]}),e.jsx(S,{isFieldRequired:n,children:e.jsx("form",{className:"form flex flex-col gap-4",onSubmit:a=>{a.preventDefault(),a.stopPropagation(),s.handleSubmit()},noValidate:!0,children:e.jsxs("div",{className:"flex flex-wrap gap-6",children:[e.jsxs("fieldset",{className:"form-fieldset w-full gap-6",children:[e.jsx("div",{className:"",children:e.jsx(s.Field,{name:"dataDirs",mode:"array",validators:{},children:a=>e.jsxs("div",{className:"space-y-3",children:[e.jsxs(m,{htmlFor:a.name,className:"block w-full",children:["Data Directories",n(a.name)&&e.jsx("span",{className:"pl-1 text-red-500",children:"*"})]}),a.state.value&&a.state.value.map((r,t)=>e.jsxs("div",{className:"gap-y- mb-3 flex flex-col",children:[e.jsx(s.AppField,{name:`dataDirs[${t}]`,validators:{onBlur:h()},children:l=>e.jsx(l.ArrayField,{showDelete:a.state.value&&a.state.value?.length>1,index:t,onDelete:()=>{a.removeValue(t)}})}),e.jsx(s.Subscribe,{selector:l=>l.fieldMeta[`${a.name}[${t}]`],children:l=>e.jsx(x,{fieldMeta:l})})]},t)),e.jsx(u,{variant:"secondary",type:"button",onClick:()=>{a.pushValue(""),a.state.value?.length&&o(`${a.name}-${a.state.value.length-1}`)},title:`Add ${a.name}`,children:"Add"})]})})}),e.jsx(s.AppField,{name:"flatLinking",validators:{},children:a=>e.jsx(a.SwitchField,{label:"Flat Linking",className:"form-field__switch flex flex-col items-start gap-5"})}),e.jsx("div",{className:"",children:e.jsx(s.AppField,{name:"linkType",children:a=>e.jsx(a.SelectField,{label:"Link Type",options:A})})}),e.jsx("div",{className:"",children:e.jsx(s.Field,{name:"linkDirs",mode:"array",validators:{},children:a=>e.jsxs("div",{className:"space-y-3",children:[e.jsxs(m,{htmlFor:a.name,className:"block w-full",children:["Link Directories",n(a.name)&&e.jsx("span",{className:"pl-1 text-red-500",children:"*"})]}),a.state.value?.map((r,t)=>e.jsxs("div",{className:"gap-y- mb-3 flex flex-col",children:[e.jsx(s.AppField,{name:`linkDirs[${t}]`,validators:{onBlur:h()},children:l=>e.jsx(l.ArrayField,{showDelete:(a.state.value&&a.state.value?.length>1)??void 0,index:t,onDelete:()=>{a.removeValue(t)}})}),e.jsx(s.Subscribe,{selector:l=>l.fieldMeta[`${a.name}[${t}]`],children:l=>e.jsx(x,{fieldMeta:l})})]},t)),e.jsx(u,{variant:"secondary",type:"button",onClick:()=>{a.pushValue("");const r=`${a.name}-${a.state.value?.length?a.state.value.length-1:0}`;o(r)},title:`Add ${a.name}`,children:"Add"})]})})}),e.jsx("div",{className:"",children:e.jsx(s.AppField,{name:"maxDataDepth",validators:{},children:a=>e.jsx(a.TextField,{label:"Max Data Depth",type:"number"})})})]}),e.jsx(s.AppForm,{children:e.jsx(s.SubmitButton,{})})]})})})]})})}export{T as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as i,j as r,i as S,J as D,L as C}from"./index-Bi48hI2z.js";import{S as L,a as M,b as P,c as y,d as E}from"./select-zHgqMzLj.js";import{m as R}from"./use-settings-form-submit-CDRh-E9U.js";import{u as T,R as k}from"./use-form-validation-context-BkAfWAh0.js";import{F as w}from"./FieldInfo-Bxj_j8SJ.js";import"./Page-C3rteCZt.js";import"./index-C2cH1Gst.js";import"./chevron-down-CRy8M0kJ.js";import"./check-Bu3ldi63.js";const B=[{label:"Millisecond",labelPlural:"Milliseconds",value:"milliseconds",ms:1},{label:"Second",labelPlural:"Seconds",value:"seconds",ms:1e3},{label:"Minute",labelPlural:"Minutes",value:"minutes",ms:60*1e3},{label:"Hour",labelPlural:"Hours",value:"hours",ms:3600*1e3},{label:"Day",labelPlural:"Days",value:"days",ms:1440*60*1e3}];function H({id:e,className:l,value:a,onChange:t,onBlur:d,units:c=B,disabled:p=!1}){const s=i.useMemo(()=>c,[c]),u=i.useMemo(()=>A(a),[a]),[o,h]=i.useState(()=>u!=null?v(u,s).value:s[2]?.value??s[0].value),[x,f]=i.useState(""),[g,U]=i.useState(!1),b=s.find(n=>n.value===o)??s[0],F=N(x),j=_(b,F);i.useEffect(()=>{if(!g&&u!=null){const n=v(u,s);n.value!==o&&h(n.value)}},[g,u,o,s]),i.useEffect(()=>{if(u==null){f("");return}const n=s.find(m=>m.value===o)??s[0];f($(u,n.ms))},[u,o,s]);const I=n=>{U(!0),f(n);const m=N(n);if(m==null){t(null);return}t(m*b.ms)},V=n=>{U(!0),h(n)};return r.jsxs("div",{className:S("flex items-center gap-3",l),children:[r.jsx(D,{id:e,name:e,type:"number",min:0,step:"any",className:"flex-1 shadow-none",value:x,onBlur:d,inputMode:"decimal",disabled:p,onChange:n=>I(n.target.value)}),r.jsxs(L,{value:b.value,onValueChange:V,disabled:p,children:[r.jsx(M,{className:"w-32 shadow-none",children:r.jsx(P,{"aria-label":j,children:j})}),r.jsx(y,{children:s.map(n=>r.jsx(E,{value:n.value,children:n.labelPlural??`${n.label}s`},n.value))})]})]})}function v(e,l){if(!Number.isFinite(e)||e<=0)return l[0];for(let a=l.length-1;a>=0;a-=1){const t=l[a];if(e>=t.ms)return t}return l[0]}function N(e){if(!e||e.trim()==="")return null;const l=Number(e);return!Number.isFinite(l)||l<0?null:l}function $(e,l){if(l===0)return"";const a=e/l;return Number.isInteger(a)?a.toString():z(a.toFixed(6))}function z(e){return e.includes(".")?e.replace(/\.?0+$/,""):e}function A(e){if(e==null)return null;if(typeof e=="number")return Number.isFinite(e)?e:null;const l=Number(e);return Number.isFinite(l)?l:null}function _(e,l){return l==null||l!==1?e.labelPlural??`${e.label}s`:e.label}const Y=({label:e,className:l,hideLabel:a=!1})=>{const t=R(),{isFieldRequired:d}=T();return r.jsxs("div",{className:S("space-y-3",l),children:[!a&&r.jsxs(C,{htmlFor:t.name,className:"block w-full",children:[e,d(t.name)&&r.jsx(k,{})]}),r.jsx(H,{id:t.name,value:t.state.value??null,onBlur:t.handleBlur,onChange:c=>t.handleChange(c)}),r.jsx(w,{fieldMeta:t.state.meta})]})};export{Y as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{u as h,r as c,j as e,L as j,B as F}from"./index-Bi48hI2z.js";import{F as f}from"./FieldInfo-Bxj_j8SJ.js";import{u as v,g as r,f as b,p as g,a as S,b as y,c as m,F as N,d as A}from"./use-settings-form-submit-CDRh-E9U.js";import{u as D}from"./useQuery-A4Hv_4uX.js";import{P as w}from"./Page-C3rteCZt.js";function B(){const{isFieldRequired:o}=v(r),u=h(),{data:p}=D(u.settings.get.queryOptions(void 0,{select:s=>{const n=b(s.config);return g(r,n,{includeUndefined:!0})}})),x=S(),a=y({...m,defaultValues:p??m.defaultValues,onSubmit:x,validators:{onSubmit:r}}),[i,d]=c.useState(null);return c.useEffect(()=>{i&&(document.getElementById(i)?.focus(),d(null))},[i]),e.jsx(w,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{children:e.jsx("h1",{className:"text-2xl font-bold",children:"General Settings"})}),e.jsx(N,{isFieldRequired:o,children:e.jsx("form",{className:"form flex flex-col gap-4",onSubmit:s=>{s.preventDefault(),s.stopPropagation(),a.handleSubmit()},noValidate:!0,children:e.jsxs("div",{className:"flex flex-wrap gap-6",children:[e.jsxs("fieldset",{className:"form-fieldset w-full gap-6",children:[e.jsx(a.AppField,{name:"includeNonVideos",children:s=>e.jsx(s.SwitchField,{label:"Include Non-Videos"})}),e.jsx(a.AppField,{name:"includeSingleEpisodes",children:s=>e.jsx(s.SwitchField,{label:"Include Single Episodes"})}),e.jsx("div",{className:"",children:e.jsx(a.AppField,{name:"snatchTimeout",validators:{},children:s=>e.jsx(s.DurationField,{label:"Snatch Timeout"})})}),e.jsx("div",{className:"",children:e.jsx(a.AppField,{name:"fuzzySizeThreshold",validators:{},children:s=>e.jsx(s.TextField,{label:"Fuzzy Size Threshold",type:"number"})})}),e.jsx("div",{className:"",children:e.jsx(a.AppField,{name:"seasonFromEpisodes",validators:{},children:s=>e.jsx(s.TextField,{label:"Season from Episodes",type:"number"})})}),e.jsx("div",{className:"",children:e.jsx(a.AppField,{name:"autoResumeMaxDownload",validators:{},children:s=>e.jsx(s.TextField,{label:"Auto-resume Max Download",type:"number"})})}),e.jsx("div",{className:"",children:e.jsx(a.Field,{name:"blockList",mode:"array",validators:{},children:s=>e.jsxs("div",{className:"space-y-3",children:[e.jsxs(j,{htmlFor:s.name,className:"block w-full",children:["Block List",o(s.name)&&e.jsx("span",{className:"pl-1 text-red-500",children:"*"})]}),s.state.value&&(s.state.value.length?s.state.value:[""]).map((n,l)=>e.jsxs("div",{className:"gap-y- mb-3 flex flex-col",children:[e.jsx(a.AppField,{name:`blockList[${l}]`,validators:{onBlur:A()},children:t=>e.jsx(t.ArrayField,{showDelete:s.state.value&&s.state.value?.length>1,index:l,onDelete:()=>{s.removeValue(l)}})}),e.jsx(a.Subscribe,{selector:t=>t.fieldMeta[`${s.name}[${l}]`],children:t=>e.jsx(f,{fieldMeta:t})})]},l)),e.jsx(F,{variant:"secondary",type:"button",onClick:()=>{s.pushValue("");const n=`${s.name}-${s.state.value?.length?s.state.value.length-1:0}`;d(n)},title:`Add ${s.name}`,children:"Add"})]})})})]}),e.jsx(a.AppForm,{children:e.jsx(a.SubmitButton,{})})]})})})]})})}export{B as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as t,u as h,k as m,j as e,N as y,i as n,B as x}from"./index-Bi48hI2z.js";import{P as p}from"./Page-C3rteCZt.js";const u=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],g=t("CircleCheck",u);const f=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],v=t("Info",f);const k=[["path",{d:"M12 16h.01",key:"1drbdi"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z",key:"1fd625"}]],N=t("OctagonAlert",k);const j=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],b=t("RefreshCw",j),i={error:0,warning:1,info:2},M={error:"border-red-500/60 bg-red-500/10",warning:"border-amber-500/60 bg-amber-500/10",info:"border-sky-500/60 bg-sky-500/10"},w={error:N,warning:y,info:v};function _(){const d=h(),{data:{problems:o},refetch:l,isFetching:a}=m(d.health.get.queryOptions()),c=[...o].sort((s,r)=>i[s.severity]-i[r.severity]);return e.jsx(p,{breadcrumbs:["Diagnostics","Health"],actions:e.jsxs(x,{variant:"outline",size:"sm",onClick:()=>l(),disabled:a,children:[e.jsx(b,{className:n("mr-2 h-4 w-4",a&&"text-primary animate-spin")}),"Refresh"]}),children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h1",{className:"text-2xl font-semibold",children:"Health"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"A quick snapshot of anything that needs attention. Issues are ordered by severity."})]}),c.length===0?e.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-emerald-500/30 bg-emerald-500/10 p-4 text-sm text-emerald-700",children:[e.jsx(g,{className:"h-5 w-5"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"All clear"}),e.jsx("p",{className:"text-muted-foreground",children:"No health issues detected. Everything looks good."})]})]}):e.jsx("div",{className:"space-y-3",children:c.map(s=>{const r=w[s.severity];return e.jsxs("div",{className:n("flex items-start gap-3 rounded-lg border p-4 text-sm",M[s.severity]),children:[e.jsx(r,{className:"mt-0.5 h-5 w-5 flex-shrink-0"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"font-medium",children:s.summary}),s.details&&e.jsx("p",{className:"text-muted-foreground",children:s.details})]})]},s.id)})})]})})}export{_ as component};
|