cross-seed 6.13.6 → 7.0.0-10
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/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 +8 -7
- package/dist/clients/Deluge.js.map +1 -1
- package/dist/clients/QBittorrent.d.ts +218 -0
- package/dist/clients/QBittorrent.js +3 -2
- package/dist/clients/QBittorrent.js.map +1 -1
- package/dist/clients/RTorrent.d.ts +43 -0
- package/dist/clients/RTorrent.js +8 -4
- package/dist/clients/RTorrent.js.map +1 -1
- package/dist/clients/TorrentClient.d.ts +108 -0
- package/dist/clients/TorrentClient.js +137 -67
- package/dist/clients/TorrentClient.js.map +1 -1
- package/dist/clients/Transmission.d.ts +43 -0
- package/dist/clients/Transmission.js +4 -3
- 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 +14 -0
- package/dist/db.js +76 -5
- package/dist/db.js.map +1 -1
- 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/diagnostics/db.d.ts +21 -0
- package/dist/diagnostics/db.js +107 -0
- package/dist/diagnostics/db.js.map +1 -0
- 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 +64 -13
- 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 +38 -6
- 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 +17 -0
- package/dist/trpc/routers/health.js +24 -0
- package/dist/trpc/routers/health.js.map +1 -0
- package/dist/trpc/routers/index.d.ts +394 -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 +229 -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 +172 -0
- package/dist/utils.js +61 -50
- package/dist/utils.js.map +1 -1
- package/dist/webui/assets/FieldInfo-sRlPRNSK.js +1 -0
- package/dist/webui/assets/Page-B68mlTwU.js +1 -0
- package/dist/webui/assets/array-field-BCFMrvoU.js +1 -0
- package/dist/webui/assets/badge-C5YCxEzP.js +1 -0
- package/dist/webui/assets/check-NQsw6yBl.js +1 -0
- package/dist/webui/assets/chevron-down-8PGvFYxV.js +1 -0
- package/dist/webui/assets/clients-DnVpwApe.js +1 -0
- package/dist/webui/assets/connect-wMg2zyz6.js +1 -0
- package/dist/webui/assets/debug-BrjwiEi2.js +1 -0
- package/dist/webui/assets/directories-CHpJCWNR.js +1 -0
- package/dist/webui/assets/duration-field-DIkKt3iw.js +1 -0
- package/dist/webui/assets/general-uZrUIxbI.js +1 -0
- package/dist/webui/assets/health-_MuvAyjo.js +1 -0
- package/dist/webui/assets/index-B41DM2T5.css +1 -0
- package/dist/webui/assets/index-BBzHsn7u.js +1 -0
- package/dist/webui/assets/index-Ncy0-Qo7.js +54 -0
- package/dist/webui/assets/index-pKWy6v1P.js +1 -0
- package/dist/webui/assets/jobs-B8eat0YU.js +1 -0
- package/dist/webui/assets/library-BB0jQ8zn.js +1 -0
- package/dist/webui/assets/loader-circle-Bz67bJa3.js +1 -0
- package/dist/webui/assets/logs-CeP28848.js +1 -0
- package/dist/webui/assets/search-BRBIrqaX.js +1 -0
- package/dist/webui/assets/select-GZr6C6eZ.js +1 -0
- package/dist/webui/assets/select-field-CvT0SYk8.js +1 -0
- package/dist/webui/assets/settings-0ZdYY8g_.js +1 -0
- package/dist/webui/assets/submit-button-D7DKHqAq.js +1 -0
- package/dist/webui/assets/switch-BeMrf8sh.js +1 -0
- package/dist/webui/assets/switch-field-qMXHRKhx.js +1 -0
- package/dist/webui/assets/table-qEFWauuw.js +1 -0
- package/dist/webui/assets/test-tube-DhD6uWdp.js +1 -0
- package/dist/webui/assets/text-field-ZnKHDUks.js +1 -0
- package/dist/webui/assets/time-BM9K_Fbp.js +1 -0
- package/dist/webui/assets/trackers-BjJuAdX3.js +7 -0
- package/dist/webui/assets/use-form-validation-context-D2oA54L_.js +1 -0
- package/dist/webui/assets/use-settings-form-submit-CXwtE1sI.js +2 -0
- package/dist/webui/assets/useQuery-DD10sbzn.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 +9 -0
- package/node_modules/@cross-seed/shared/dist/utils.d.ts.map +1 -0
- package/node_modules/@cross-seed/shared/dist/utils.js +20 -0
- package/node_modules/@cross-seed/shared/dist/utils.js.map +1 -0
- package/node_modules/@cross-seed/shared/package.json +24 -0
- package/package.json +25 -42
- package/LICENSE +0 -201
- package/README.md +0 -34
- package/dist/config.template.cjs +0 -353
- package/dist/config.template.cjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e,i as o,u as x,k as u,r as m}from"./index-Ncy0-Qo7.js";import{P as g}from"./Page-B68mlTwU.js";function s({title:n,value:t,description:r,className:i,trend:a}){return e.jsxs("div",{className:o("bg-card text-card-foreground rounded-lg border p-6 shadow-sm",i),children:[e.jsx("div",{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:e.jsx("h3",{className:"text-sm font-medium tracking-tight",children:n})}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("div",{className:"text-2xl font-bold",children:t}),a&&e.jsxs("div",{className:"text-muted-foreground text-xs",children:[e.jsxs("span",{className:o("font-medium",a.value>0?"text-green-600":"text-red-600"),children:[a.value>0?"+":"",a.value]})," ",a.label]})]}),r&&e.jsx("p",{className:"text-muted-foreground text-xs",children:r})]})}function v(){const n=x(),{data:t}=u(n.stats.getOverview.queryOptions()),r=m.useMemo(()=>t.queryCount!==t.totalSearchees,[t.queryCount,t.totalSearchees]),i=r,a=r?"lg:grid-cols-5":"lg:grid-cols-4",c=i?"lg:grid-cols-4":"lg:grid-cols-3",l=t.allIndexersHealthy?"Indexer Health":"Unhealthy Indexers",d=t.allIndexersHealthy?`All ${t.totalIndexers.toLocaleString()}`:t.unhealthyIndexers.toLocaleString(),h=t.allIndexersHealthy?"Indexers are all reporting healthy":`${t.unhealthyIndexers.toLocaleString()} of ${t.totalIndexers.toLocaleString()} indexers need attention`;return e.jsx(g,{breadcrumbs:["Dashboard"],children:e.jsx("div",{className:"main space-y-8",children:e.jsxs("section",{className:"space-y-4",children:[e.jsxs("div",{className:`grid gap-4 md:grid-cols-2 ${a}`,children:[e.jsx(s,{title:"Total Searchees",value:t.totalSearchees.toLocaleString(),description:"Torrents being monitored"}),r&&e.jsx(s,{title:"Total Search Queries",value:t.queryCount.toLocaleString(),description:"Distinct estimated searches"}),e.jsx(s,{title:"Total Query-Indexer Pairs",value:t.queryIndexerCount.toLocaleString(),description:"Unique indexer searches"}),e.jsx(s,{title:"Total Snatches",value:t.snatchCount.toLocaleString(),description:"Unique infohash attempts"}),e.jsx(s,{title:"Total Matches",value:t.totalMatches.toLocaleString(),description:"Unique cross-seeds found"})]}),e.jsxs("div",{className:`grid gap-4 md:grid-cols-2 ${c}`,children:[e.jsx(s,{title:"Matches per Searchee",value:t.matchRate.toFixed(2),description:"Average matches per monitored torrent"}),i&&e.jsx(s,{title:"Matches per Query",value:t.matchesPerQuery.toFixed(2),description:"Matches per search estimate"}),e.jsx(s,{title:"Match Rate",value:`${(t.matchesPerQueryIndexer*100).toFixed(1)}%`,description:"of indexer searches find a match"}),e.jsx(s,{title:"Wasted Snatches",value:`${(t.wastedSnatchRate*100).toFixed(1)}%`,description:`${t.wastedSnatchCount.toLocaleString()} snatched but mismatched`})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(s,{title:l,value:d,description:h}),e.jsx(s,{title:"Recent Activity",value:t.recentMatches.toLocaleString(),description:"Matches in last 24h"})]})]})})})}export{v as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as j,u as f,r as N,k as v,l as b,j as e,B as S}from"./index-Ncy0-Qo7.js";import{B as i}from"./badge-C5YCxEzP.js";import{T,a as w,b as d,c as t,d as y,e as a}from"./table-qEFWauuw.js";import{f as m}from"./time-BM9K_Fbp.js";import{P as E}from"./Page-B68mlTwU.js";import{C as R}from"./check-NQsw6yBl.js";const C=[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]],B=j("Play",C);function _(){const o=f(),[u,c]=N.useState(new Set),{data:x}=v(o.jobs.getJobStatuses.queryOptions(void 0,{refetchInterval:5e3})),{mutate:h}=b(o.jobs.triggerJob.mutationOptions({onSuccess:(s,{name:n})=>{c(r=>new Set(r).add(n)),setTimeout(()=>{c(r=>{const l=new Set(r);return l.delete(n),l})},3e3)},onError:s=>{console.error("Failed to trigger job:",s.message)}})),g=s=>s.isActive?e.jsx(i,{variant:"default",className:"bg-blue-500",children:"Running"}):s.nextExecution==="now"?e.jsx(i,{variant:"secondary",children:"Ready"}):e.jsx(i,{variant:"outline",children:"Scheduled"}),p=s=>s.split(/(?=[A-Z])/).map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" ");return e.jsx(E,{children:e.jsx("div",{className:"overflow-x-auto rounded-lg border",children:e.jsxs(T,{children:[e.jsx(w,{className:"bg-muted sticky top-0 z-10",children:e.jsxs(d,{className:"border-b",children:[e.jsx(t,{children:"Name"}),e.jsx(t,{children:"Interval"}),e.jsx(t,{children:"Last Execution"}),e.jsx(t,{children:"Next Execution"}),e.jsx(t,{children:"Status"}),e.jsx(t,{className:"text-right",children:"Actions"})]})}),e.jsx(y,{children:x?.map(s=>e.jsxs(d,{children:[e.jsx(a,{className:"font-medium",children:p(s.name)}),e.jsx(a,{children:s.interval}),e.jsx(a,{children:s.lastExecution?m(s.lastExecution):"Never"}),e.jsx(a,{children:s.nextExecution==="now"?"Now":m(s.nextExecution)}),e.jsx(a,{children:g(s)}),e.jsx(a,{className:"text-right",children:e.jsx(S,{variant:"outline",size:"sm",disabled:s.isActive||!s.canRunNow,onClick:()=>h({name:s.name}),children:u.has(s.name)?e.jsxs(e.Fragment,{children:[e.jsx(R,{className:"mr-1 h-4 w-4 text-green-600"}),"Started"]}):e.jsxs(e.Fragment,{children:[e.jsx(B,{className:"mr-1 h-4 w-4"}),"Run"]})})})]},s.name))})]})})})}export{_ as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as D,r as m,j as e,b as te,P as ae,d as q,e as ne,f as X,g as O,h as re,i as oe,u as ce,k as ie,l as de,t as T,B as E,m as le,n as he}from"./index-Ncy0-Qo7.js";import{T as ue,a as me,b as A,c as z,d as pe,e as _}from"./table-qEFWauuw.js";import{P as xe,D as fe,a as be,b as ge,c as H,C as ke}from"./Page-B68mlTwU.js";import{f as Ce}from"./time-BM9K_Fbp.js";import{u as je}from"./index-BBzHsn7u.js";import{C as ve}from"./check-NQsw6yBl.js";import{L as Ne}from"./loader-circle-Bz67bJa3.js";import{C as ye}from"./chevron-down-8PGvFYxV.js";const Se=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],we=D("ChevronLeft",Se);const Pe=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],Ee=D("ChevronsLeft",Pe);const _e=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],Ie=D("ChevronsRight",_e);var L="Checkbox",[Re]=te(L),[Me,F]=Re(L);function ze(t){const{__scopeCheckbox:n,checked:c,children:l,defaultChecked:d,disabled:r,form:g,name:o,onCheckedChange:h,required:k,value:C="on",internal_do_not_use_render:x}=t,[i,w]=ne({prop:c,defaultProp:d??!1,onChange:h,caller:L}),[j,v]=m.useState(null),[P,a]=m.useState(null),p=m.useRef(!1),I=j?!!g||!!j.closest("form"):!0,R={checked:i,disabled:r,setChecked:w,control:j,setControl:v,name:o,form:g,value:C,hasConsumerStoppedPropagationRef:p,required:k,defaultChecked:S(d)?!1:d,isFormControl:I,bubbleInput:P,setBubbleInput:a};return e.jsx(Me,{scope:n,...R,children:Be(x)?x(R):l})}var Q="CheckboxTrigger",Z=m.forwardRef(({__scopeCheckbox:t,onKeyDown:n,onClick:c,...l},d)=>{const{control:r,value:g,disabled:o,checked:h,required:k,setControl:C,setChecked:x,hasConsumerStoppedPropagationRef:i,isFormControl:w,bubbleInput:j}=F(Q,t),v=X(d,C),P=m.useRef(h);return m.useEffect(()=>{const a=r?.form;if(a){const p=()=>x(P.current);return a.addEventListener("reset",p),()=>a.removeEventListener("reset",p)}},[r,x]),e.jsx(q.button,{type:"button",role:"checkbox","aria-checked":S(h)?"mixed":h,"aria-required":k,"data-state":se(h),"data-disabled":o?"":void 0,disabled:o,value:g,...l,ref:v,onKeyDown:O(n,a=>{a.key==="Enter"&&a.preventDefault()}),onClick:O(c,a=>{x(p=>S(p)?!0:!p),j&&w&&(i.current=a.isPropagationStopped(),i.current||a.stopPropagation())})})});Z.displayName=Q;var J=m.forwardRef((t,n)=>{const{__scopeCheckbox:c,name:l,checked:d,defaultChecked:r,required:g,disabled:o,value:h,onCheckedChange:k,form:C,...x}=t;return e.jsx(ze,{__scopeCheckbox:c,checked:d,defaultChecked:r,disabled:o,required:g,onCheckedChange:k,name:l,form:C,value:h,internal_do_not_use_render:({isFormControl:i})=>e.jsxs(e.Fragment,{children:[e.jsx(Z,{...x,ref:n,__scopeCheckbox:c}),i&&e.jsx(ee,{__scopeCheckbox:c})]})})});J.displayName=L;var V="CheckboxIndicator",W=m.forwardRef((t,n)=>{const{__scopeCheckbox:c,forceMount:l,...d}=t,r=F(V,c);return e.jsx(ae,{present:l||S(r.checked)||r.checked===!0,children:e.jsx(q.span,{"data-state":se(r.checked),"data-disabled":r.disabled?"":void 0,...d,ref:n,style:{pointerEvents:"none",...t.style}})})});W.displayName=V;var Y="CheckboxBubbleInput",ee=m.forwardRef(({__scopeCheckbox:t,...n},c)=>{const{control:l,hasConsumerStoppedPropagationRef:d,checked:r,defaultChecked:g,required:o,disabled:h,name:k,value:C,form:x,bubbleInput:i,setBubbleInput:w}=F(Y,t),j=X(c,w),v=je(r),P=re(l);m.useEffect(()=>{const p=i;if(!p)return;const I=window.HTMLInputElement.prototype,N=Object.getOwnPropertyDescriptor(I,"checked").set,$=!d.current;if(v!==r&&N){const M=new Event("click",{bubbles:$});p.indeterminate=S(r),N.call(p,S(r)?!1:r),p.dispatchEvent(M)}},[i,v,r,d]);const a=m.useRef(S(r)?!1:r);return e.jsx(q.input,{type:"checkbox","aria-hidden":!0,defaultChecked:g??a.current,required:o,disabled:h,name:k,value:C,form:x,...n,tabIndex:-1,ref:j,style:{...n.style,...P,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});ee.displayName=Y;function Be(t){return typeof t=="function"}function S(t){return t==="indeterminate"}function se(t){return S(t)?"indeterminate":t?"checked":"unchecked"}function K({className:t,...n}){return e.jsx(J,{"data-slot":"checkbox",className:oe("peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",t),...n,children:e.jsx(W,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none",children:e.jsx(ve,{className:"size-3.5"})})})}function U(t){return t===!0}const y=25,B=20;function Oe(){const t=ce(),[n,c]=m.useState(0),[l,d]=m.useState(()=>new Map),r=m.useMemo(()=>({limit:y,offset:n*y}),[n]),g=ie(t.searchees.list.queryOptions(r)),{data:o,isFetching:h}=g;m.useEffect(()=>{if(n*y<o.total)return;if(o.total===0){c(0);return}const s=Math.max(0,Math.ceil(o.total/y)-1);s!==n&&c(s)},[o.total,n]);const k=Math.max(1,Math.ceil(o.total/y)),C=n>0,x=(n+1)*y<o.total,i=o.items,w=o.total===0?0:n*y+1,j=o.total===0?0:n*y+i.length,v=i.length>0&&i.every(s=>l.has(s.id)),P=i.some(s=>l.has(s.id)),a=l.size,p=s=>{d(f=>{const b=new Map(f);return s?i.forEach(u=>b.set(u.id,{id:u.id,name:u.name})):i.forEach(u=>b.delete(u.id)),b})},I=(s,f)=>{d(b=>{const u=new Map(b);return f?u.set(s.id,s):u.delete(s.id),u})},R=()=>d(new Map),N=de(t.searchees.bulkSearch.mutationOptions({onSuccess:s=>{const{attempted:f,totalFound:b,skipped:u}=s;f===0?T.info("No eligible items to search",{description:u>0?`${u} item${u===1?"":"s"} were skipped by filters.`:void 0}):T.success("Bulk search complete",{description:`${f} item${f===1?"":"s"} searched${u?` (${u} skipped)`:""}. Found ${b} match${b===1?"":"es"}.`}),R(),g.refetch()},onError:s=>{T.error("Bulk search failed",{description:s.message})}})),$=a===0||a>B||N.isPending,M=s=>{if(a===0)return;if(a>B){T.error(`Bulk search supports up to ${B} items at a time.`);return}const f=Array.from(l.values()).map(b=>b.name);N.mutate({names:f,force:s})},G=s=>s?Ce(s):"Never";return e.jsxs(xe,{children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-semibold",children:"Library"}),e.jsxs("p",{className:"text-muted-foreground text-sm",children:["Showing ",w,"-",j," of ",o.total," items"]})]}),e.jsxs("div",{className:"bg-muted/30 text-muted-foreground flex flex-col gap-2 rounded-lg border px-3 py-2 text-sm lg:flex-row lg:items-center lg:gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{children:a>0?`${a} item${a===1?"":"s"} selected`:"No items selected"}),e.jsxs(fe,{children:[e.jsx(be,{asChild:!0,children:e.jsxs(E,{variant:"outline",size:"sm",disabled:$,onClick:()=>M(!1),children:[N.isPending?e.jsx(Ne,{className:"mr-2 size-4 animate-spin"}):e.jsx(le,{className:"mr-2 size-4"}),"Search",e.jsx(ye,{className:"ml-1 size-4"})]})}),e.jsxs(ge,{align:"start",className:"w-40",children:[e.jsx(H,{disabled:N.isPending||a===0,onSelect:s=>{s.preventDefault(),M(!1)},children:"Search"}),e.jsx(H,{disabled:N.isPending||a===0,onSelect:s=>{s.preventDefault(),M(!0)},children:"Force search"})]})]})]}),e.jsx("div",{className:"bg-border hidden h-4 w-px lg:block"}),e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[e.jsxs("span",{children:["Page ",Math.min(n+1,k)," of ",k]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxs(E,{variant:"outline",size:"icon",className:"hidden h-7 w-7 p-0 lg:flex",onClick:()=>c(0),disabled:!C||h,children:[e.jsx("span",{className:"sr-only",children:"Go to first page"}),e.jsx(Ee,{className:"size-4"})]}),e.jsxs(E,{variant:"outline",size:"icon",className:"h-7 w-7",onClick:()=>c(s=>Math.max(0,s-1)),disabled:!C||h,children:[e.jsx("span",{className:"sr-only",children:"Go to previous page"}),e.jsx(we,{className:"size-4"})]}),e.jsxs(E,{variant:"outline",size:"icon",className:"h-7 w-7",onClick:()=>c(s=>s+1),disabled:!x||h,children:[e.jsx("span",{className:"sr-only",children:"Go to next page"}),e.jsx(ke,{className:"size-4"})]}),e.jsxs(E,{variant:"outline",size:"icon",className:"hidden h-7 w-7 p-0 lg:flex",onClick:()=>c(k-1),disabled:!x||h,children:[e.jsx("span",{className:"sr-only",children:"Go to last page"}),e.jsx(Ie,{className:"size-4"})]})]})]}),a>B&&e.jsxs("span",{className:"text-destructive text-xs",children:["Bulk search is limited to ",B," items at a time."]})]})]}),e.jsx("div",{className:"overflow-x-auto rounded-lg border",children:e.jsxs(ue,{children:[e.jsx(me,{className:"bg-muted sticky top-0 z-10",children:e.jsxs(A,{className:"border-b",children:[e.jsx(z,{className:"w-10",children:e.jsx(K,{"aria-label":"Select all items on this page",checked:v?!0:P?"indeterminate":!1,onCheckedChange:s=>p(U(s))})}),e.jsx(z,{children:"Name"}),e.jsx(z,{children:"Indexers Searched"}),e.jsx(z,{children:"First Searched"}),e.jsx(z,{children:"Last Searched"})]})}),e.jsx(pe,{children:i.length===0?e.jsx(A,{children:e.jsx(_,{colSpan:5,className:"py-10 text-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx("span",{className:"text-muted-foreground text-sm",children:"No items indexed yet."}),e.jsx("span",{className:"text-muted-foreground text-xs",children:"Add a torrent client to start building your library."}),e.jsx(E,{asChild:!0,size:"sm",children:e.jsx(he,{to:"/settings/clients",children:"Add torrent client"})})]})})}):i.map(s=>{const f=l.has(s.id);return e.jsxs(A,{"data-state":f?"selected":void 0,className:f?"bg-muted/60":void 0,children:[e.jsx(_,{children:e.jsx(K,{"aria-label":`Select ${s.name}`,checked:f,onCheckedChange:b=>I(s,U(b))})}),e.jsx(_,{className:"font-medium",children:s.name}),e.jsx(_,{children:s.indexerCount}),e.jsx(_,{children:G(s.firstSearchedAt)}),e.jsx(_,{children:G(s.lastSearchedAt)})]},s.id)})})]})})]})}export{Oe as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as e}from"./index-Ncy0-Qo7.js";const o=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],a=e("LoaderCircle",o);export{a as L};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as a,u as S,a as L,j as s,S as E,L as T}from"./index-Ncy0-Qo7.js";import{B as i}from"./badge-C5YCxEzP.js";import{S as R}from"./switch-BeMrf8sh.js";import{T as F,a as B,b as p,c,d as C,e as d}from"./table-qEFWauuw.js";import{f as k}from"./time-BM9K_Fbp.js";import{P as H}from"./Page-B68mlTwU.js";import"./index-BBzHsn7u.js";function M(){const[n,w]=a.useState([]),[b,g]=a.useState(!0),[o,v]=a.useState(new Set(["error","warn","info","verbose","debug"])),[l,j]=a.useState(()=>typeof window>"u"?!1:window.localStorage.getItem("logs:newest-first")==="true"),[m,f]=a.useState(new Set),N=S(),y=a.useRef(null);L(N.logs.subscribe.subscriptionOptions({limit:100},{enabled:!0,onData:e=>{w((t=[])=>[...t,e].slice(-500))},onError:e=>{console.error("Log subscription error:",e)}})),a.useEffect(()=>{const e=()=>{const t=window.innerHeight+window.scrollY,r=document.documentElement.scrollHeight,h=t>=r&&window.scrollY>0;g(h)};return window.addEventListener("scroll",e),e(),()=>window.removeEventListener("scroll",e)},[]),a.useLayoutEffect(()=>{b&&n.length>0&&window.scrollTo({top:document.documentElement.scrollHeight,behavior:"instant"})},[n,b]),a.useEffect(()=>{window.localStorage.setItem("logs:newest-first",String(l))},[l]);const u=a.useMemo(()=>{const e=new Set;return n.forEach(t=>{t.label&&e.add(t.label)}),Array.from(e).sort()},[n]);a.useEffect(()=>{f(e=>{const t=new Set(e);return u.forEach(r=>t.add(r)),t})},[u]);const x=a.useMemo(()=>{const e=n.filter(t=>{const r=o.has(t.level),h=!t.label||m.has(t.label);return r&&h});return l&&e.reverse(),e},[n,l,o,m]);return s.jsxs("div",{className:"w-full space-y-6",children:[s.jsxs("div",{className:"flex flex-wrap items-stretch justify-between gap-4",children:[s.jsx("div",{className:"flex flex-wrap items-center gap-2",children:["error","warn","info","verbose","debug"].map(e=>s.jsx(i,{variant:o.has(e)?"default":"outline",className:`hover:bg-muted cursor-pointer select-none ${e==="error"?o.has(e)?"bg-red-500 hover:bg-red-600":"border-red-200 text-red-500":e==="warn"?o.has(e)?"bg-yellow-500 hover:bg-yellow-600":"border-yellow-200 text-yellow-500":e==="info"?o.has(e)?"bg-blue-500 hover:bg-blue-600":"border-blue-200 text-blue-500":e==="verbose"?o.has(e)?"bg-gray-500 hover:bg-gray-600":"border-gray-200 text-gray-500":e==="debug"?o.has(e)?"bg-purple-500 hover:bg-purple-600":"border-purple-200 text-purple-500":""}`,onClick:()=>{v(t=>{const r=new Set(t);return r.has(e)?r.delete(e):r.add(e),r})},children:e},e))}),s.jsx("div",{children:s.jsx(E,{orientation:"vertical",className:"h-6"})}),s.jsx("div",{className:"flex flex-wrap items-center gap-2",children:u.map(e=>s.jsx(i,{variant:m.has(e)?"default":"outline",className:"hover:bg-muted cursor-pointer font-mono text-xs select-none",onClick:()=>{f(t=>{const r=new Set(t);return r.has(e)?r.delete(e):r.add(e),r})},children:e},e))}),s.jsxs(T,{className:"ml-auto",children:[s.jsx("span",{className:"text-sm font-medium",children:"Show newest first"}),s.jsx(R,{checked:l,onCheckedChange:j})]})]}),x.length>0?s.jsx("div",{className:"overflow-x-auto rounded-lg border",children:s.jsxs(F,{ref:y,children:[s.jsx(B,{className:"bg-muted sticky top-0 z-10",children:s.jsxs(p,{className:"border-b",children:[s.jsx(c,{className:"w-32",children:"Time"}),s.jsx(c,{className:"w-24",children:"Level"}),s.jsx(c,{className:"w-32",children:"Label"}),s.jsx(c,{children:"Message"})]})}),s.jsx(C,{children:x.map((e,t)=>s.jsxs(p,{className:"hover:bg-muted/50 h-8",children:[s.jsx(d,{className:"font-mono text-xs",title:new Date(e.timestamp).toLocaleString(),children:k(e.timestamp)}),s.jsx(d,{className:"py-1",children:s.jsx(i,{variant:e.level==="error"?"destructive":e.level==="warn"?"secondary":e.level==="info"?"default":e.level==="debug"?"outline":"secondary",className:e.level==="warn"?"bg-yellow-100 text-yellow-800 hover:bg-yellow-100":e.level==="info"?"bg-blue-500 text-white hover:bg-blue-600":e.level==="verbose"?"bg-gray-500 text-white hover:bg-gray-600":e.level==="debug"?"bg-purple-500 text-white hover:bg-purple-600":"",children:e.level})}),s.jsx(d,{className:"py-1 font-medium",children:e.label&&s.jsx(i,{variant:"outline",className:"py-1 font-mono text-xs",children:e.label})}),s.jsx(d,{className:"py-1 font-mono text-xs",children:s.jsx("div",{className:"whitespace-pre-wrap",title:e.message,children:e.message})})]},`${e.timestamp}-${t}`))})]})}):s.jsxs("div",{className:"text-muted-foreground items-center justify-center py-16",children:[s.jsxs("div",{className:"mb-2 flex items-center gap-2",children:[s.jsx("div",{className:"h-2 w-2 animate-pulse rounded-full bg-green-500"}),s.jsx("span",{className:"text-sm font-medium",children:n.length===0?"Waiting for logs...":"No logs match current filters"})]}),n.length===0&&s.jsx("p",{className:"text-xs",children:"Real-time streaming from server logs"})]})]})}function q(){return s.jsx(H,{breadcrumbs:["Diagnostics","Logs"],children:s.jsx(M,{})})}export{q as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{u as o,j as e}from"./index-Ncy0-Qo7.js";import{u as m,f as u,p,a as x,b as h,s as l,c as i,F as f,M as j}from"./use-settings-form-submit-CXwtE1sI.js";import{u as F}from"./useQuery-DD10sbzn.js";import{P as S}from"./Page-B68mlTwU.js";function v(){const t=o(),{isFieldRequired:r}=m(l),{data:n}=F(t.settings.get.queryOptions(void 0,{select:a=>{const c=u(a.config);return p(l,c,{includeUndefined:!0})}})),d=x(),s=h({...i,defaultValues:n??i.defaultValues,onSubmit:d,validators:{onSubmit:l}});return e.jsx(S,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:"Search & RSS Settings"}),e.jsx("p",{className:"text-muted-foreground",children:"Manage search and RSS options."})]}),e.jsx(f,{isFieldRequired:r,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(s.AppField,{name:"delay",children:a=>e.jsx(a.TextField,{label:"Delay",type:"number"})}),e.jsx(s.AppField,{name:"matchMode",children:a=>e.jsx(a.SelectField,{label:"Match Mode",options:j})}),e.jsx(s.AppField,{name:"rssCadence",children:a=>e.jsx(a.DurationField,{label:"RSS Cadence"})}),e.jsx(s.AppField,{name:"searchCadence",children:a=>e.jsx(a.DurationField,{label:"Search Cadence"})}),e.jsx(s.AppField,{name:"searchTimeout",children:a=>e.jsx(a.DurationField,{label:"Search Timeout"})}),e.jsx(s.AppField,{name:"searchLimit",children:a=>e.jsx(a.TextField,{label:"Search Limit",type:"number"})}),e.jsx(s.AppField,{name:"excludeOlder",children:a=>e.jsx(a.DurationField,{label:"Exclude Older"})}),e.jsx(s.AppField,{name:"excludeRecentSearch",children:a=>e.jsx(a.DurationField,{label:"Exclude Recent Search"})})]}),e.jsx(s.AppForm,{children:e.jsx(s.SubmitButton,{})})]})})})]})})}export{v as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as ot,r as n,j as a,Z as nt,a2 as Ee,e as Te,a3 as rt,b as st,a0 as Ie,f as L,a4 as at,d as j,g as P,ag as $,a5 as lt,ah as _e,ai as it,a1 as ct,a6 as dt,a8 as ut,a9 as pt,aa as ft,ab as mt,ac as ht,ad as gt,i as te}from"./index-Ncy0-Qo7.js";import{u as vt,f as xt}from"./Page-B68mlTwU.js";import{u as St}from"./index-BBzHsn7u.js";import{C as Ne}from"./chevron-down-8PGvFYxV.js";import{C as wt}from"./check-NQsw6yBl.js";const Ct=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],yt=ot("ChevronUp",Ct);function Pe(t,[o,e]){return Math.min(e,Math.max(o,t))}function It(t){const o=bt(t),e=n.forwardRef((s,r)=>{const{children:d,...l}=s,i=n.Children.toArray(d),c=i.find(Pt);if(c){const p=c.props.children,g=i.map(x=>x===c?n.Children.count(p)>1?n.Children.only(null):n.isValidElement(p)?p.props.children:null:x);return a.jsx(o,{...l,ref:r,children:n.isValidElement(p)?n.cloneElement(p,void 0,g):null})}return a.jsx(o,{...l,ref:r,children:d})});return e.displayName=`${t}.Slot`,e}function bt(t){const o=n.forwardRef((e,s)=>{const{children:r,...d}=e;if(n.isValidElement(r)){const l=_t(r),i=Et(d,r.props);return r.type!==n.Fragment&&(i.ref=s?nt(s,l):l),n.cloneElement(r,i)}return n.Children.count(r)>1?n.Children.only(null):null});return o.displayName=`${t}.SlotClone`,o}var Tt=Symbol("radix.slottable");function Pt(t){return n.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Tt}function Et(t,o){const e={...o};for(const s in o){const r=t[s],d=o[s];/^on[A-Z]/.test(s)?r&&d?e[s]=(...i)=>{const c=d(...i);return r(...i),c}:r&&(e[s]=r):s==="style"?e[s]={...r,...d}:s==="className"&&(e[s]=[r,d].filter(Boolean).join(" "))}return{...t,...e}}function _t(t){let o=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,e=o&&"isReactWarning"in o&&o.isReactWarning;return e?t.ref:(o=Object.getOwnPropertyDescriptor(t,"ref")?.get,e=o&&"isReactWarning"in o&&o.isReactWarning,e?t.props.ref:t.props.ref||t.ref)}var Nt=[" ","Enter","ArrowUp","ArrowDown"],Rt=[" ","Enter"],J="Select",[ce,de,jt]=xt(J),[oe]=st(J,[jt,Ee]),ue=Ee(),[Mt,G]=oe(J),[At,Ot]=oe(J),Re=t=>{const{__scopeSelect:o,children:e,open:s,defaultOpen:r,onOpenChange:d,value:l,defaultValue:i,onValueChange:c,dir:p,name:g,autoComplete:x,disabled:E,required:b,form:y}=t,u=ue(o),[h,S]=n.useState(null),[m,v]=n.useState(null),[F,M]=n.useState(!1),ne=vt(p),[_,O]=Te({prop:s,defaultProp:r??!1,onChange:d,caller:J}),[U,Z]=Te({prop:l,defaultProp:i,onChange:c,caller:J}),k=n.useRef(null),V=h?y||!!h.closest("form"):!0,[z,B]=n.useState(new Set),H=Array.from(z).map(N=>N.props.value).join(";");return a.jsx(rt,{...u,children:a.jsxs(Mt,{required:b,scope:o,trigger:h,onTriggerChange:S,valueNode:m,onValueNodeChange:v,valueNodeHasChildren:F,onValueNodeHasChildrenChange:M,contentId:Ie(),value:U,onValueChange:Z,open:_,onOpenChange:O,dir:ne,triggerPointerDownPosRef:k,disabled:E,children:[a.jsx(ce.Provider,{scope:o,children:a.jsx(At,{scope:t.__scopeSelect,onNativeOptionAdd:n.useCallback(N=>{B(D=>new Set(D).add(N))},[]),onNativeOptionRemove:n.useCallback(N=>{B(D=>{const W=new Set(D);return W.delete(N),W})},[]),children:e})}),V?a.jsxs(Je,{"aria-hidden":!0,required:b,tabIndex:-1,name:g,autoComplete:x,value:U,onChange:N=>Z(N.target.value),disabled:E,form:y,children:[U===void 0?a.jsx("option",{value:""}):null,Array.from(z)]},H):null]})})};Re.displayName=J;var je="SelectTrigger",Me=n.forwardRef((t,o)=>{const{__scopeSelect:e,disabled:s=!1,...r}=t,d=ue(e),l=G(je,e),i=l.disabled||s,c=L(o,l.onTriggerChange),p=de(e),g=n.useRef("touch"),[x,E,b]=et(u=>{const h=p().filter(v=>!v.disabled),S=h.find(v=>v.value===l.value),m=tt(h,u,S);m!==void 0&&l.onValueChange(m.value)}),y=u=>{i||(l.onOpenChange(!0),b()),u&&(l.triggerPointerDownPosRef.current={x:Math.round(u.pageX),y:Math.round(u.pageY)})};return a.jsx(at,{asChild:!0,...d,children:a.jsx(j.button,{type:"button",role:"combobox","aria-controls":l.contentId,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:i,"data-disabled":i?"":void 0,"data-placeholder":Qe(l.value)?"":void 0,...r,ref:c,onClick:P(r.onClick,u=>{u.currentTarget.focus(),g.current!=="mouse"&&y(u)}),onPointerDown:P(r.onPointerDown,u=>{g.current=u.pointerType;const h=u.target;h.hasPointerCapture(u.pointerId)&&h.releasePointerCapture(u.pointerId),u.button===0&&u.ctrlKey===!1&&u.pointerType==="mouse"&&(y(u),u.preventDefault())}),onKeyDown:P(r.onKeyDown,u=>{const h=x.current!=="";!(u.ctrlKey||u.altKey||u.metaKey)&&u.key.length===1&&E(u.key),!(h&&u.key===" ")&&Nt.includes(u.key)&&(y(),u.preventDefault())})})})});Me.displayName=je;var Ae="SelectValue",Oe=n.forwardRef((t,o)=>{const{__scopeSelect:e,className:s,style:r,children:d,placeholder:l="",...i}=t,c=G(Ae,e),{onValueNodeHasChildrenChange:p}=c,g=d!==void 0,x=L(o,c.onValueNodeChange);return $(()=>{p(g)},[p,g]),a.jsx(j.span,{...i,ref:x,style:{pointerEvents:"none"},children:Qe(c.value)?a.jsx(a.Fragment,{children:l}):d})});Oe.displayName=Ae;var Dt="SelectIcon",De=n.forwardRef((t,o)=>{const{__scopeSelect:e,children:s,...r}=t;return a.jsx(j.span,{"aria-hidden":!0,...r,ref:o,children:s||"▼"})});De.displayName=Dt;var Lt="SelectPortal",Le=t=>a.jsx(lt,{asChild:!0,...t});Le.displayName=Lt;var Q="SelectContent",ke=n.forwardRef((t,o)=>{const e=G(Q,t.__scopeSelect),[s,r]=n.useState();if($(()=>{r(new DocumentFragment)},[]),!e.open){const d=s;return d?_e.createPortal(a.jsx(Ve,{scope:t.__scopeSelect,children:a.jsx(ce.Slot,{scope:t.__scopeSelect,children:a.jsx("div",{children:t.children})})}),d):null}return a.jsx(Be,{...t,ref:o})});ke.displayName=Q;var A=10,[Ve,Y]=oe(Q),kt="SelectContentImpl",Vt=It("SelectContent.RemoveScroll"),Be=n.forwardRef((t,o)=>{const{__scopeSelect:e,position:s="item-aligned",onCloseAutoFocus:r,onEscapeKeyDown:d,onPointerDownOutside:l,side:i,sideOffset:c,align:p,alignOffset:g,arrowPadding:x,collisionBoundary:E,collisionPadding:b,sticky:y,hideWhenDetached:u,avoidCollisions:h,...S}=t,m=G(Q,e),[v,F]=n.useState(null),[M,ne]=n.useState(null),_=L(o,f=>F(f)),[O,U]=n.useState(null),[Z,k]=n.useState(null),V=de(e),[z,B]=n.useState(!1),H=n.useRef(!1);n.useEffect(()=>{if(v)return dt(v)},[v]),ut();const N=n.useCallback(f=>{const[I,...R]=V().map(T=>T.ref.current),[w]=R.slice(-1),C=document.activeElement;for(const T of f)if(T===C||(T?.scrollIntoView({block:"nearest"}),T===I&&M&&(M.scrollTop=0),T===w&&M&&(M.scrollTop=M.scrollHeight),T?.focus(),document.activeElement!==C))return},[V,M]),D=n.useCallback(()=>N([O,v]),[N,O,v]);n.useEffect(()=>{z&&D()},[z,D]);const{onOpenChange:W,triggerPointerDownPosRef:K}=m;n.useEffect(()=>{if(v){let f={x:0,y:0};const I=w=>{f={x:Math.abs(Math.round(w.pageX)-(K.current?.x??0)),y:Math.abs(Math.round(w.pageY)-(K.current?.y??0))}},R=w=>{f.x<=10&&f.y<=10?w.preventDefault():v.contains(w.target)||W(!1),document.removeEventListener("pointermove",I),K.current=null};return K.current!==null&&(document.addEventListener("pointermove",I),document.addEventListener("pointerup",R,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",I),document.removeEventListener("pointerup",R,{capture:!0})}}},[v,W,K]),n.useEffect(()=>{const f=()=>W(!1);return window.addEventListener("blur",f),window.addEventListener("resize",f),()=>{window.removeEventListener("blur",f),window.removeEventListener("resize",f)}},[W]);const[pe,ae]=et(f=>{const I=V().filter(C=>!C.disabled),R=I.find(C=>C.ref.current===document.activeElement),w=tt(I,f,R);w&&setTimeout(()=>w.ref.current.focus())}),fe=n.useCallback((f,I,R)=>{const w=!H.current&&!R;(m.value!==void 0&&m.value===I||w)&&(U(f),w&&(H.current=!0))},[m.value]),me=n.useCallback(()=>v?.focus(),[v]),ee=n.useCallback((f,I,R)=>{const w=!H.current&&!R;(m.value!==void 0&&m.value===I||w)&&k(f)},[m.value]),le=s==="popper"?xe:He,re=le===xe?{side:i,sideOffset:c,align:p,alignOffset:g,arrowPadding:x,collisionBoundary:E,collisionPadding:b,sticky:y,hideWhenDetached:u,avoidCollisions:h}:{};return a.jsx(Ve,{scope:e,content:v,viewport:M,onViewportChange:ne,itemRefCallback:fe,selectedItem:O,onItemLeave:me,itemTextRefCallback:ee,focusSelectedItem:D,selectedItemText:Z,position:s,isPositioned:z,searchRef:pe,children:a.jsx(pt,{as:Vt,allowPinchZoom:!0,children:a.jsx(ft,{asChild:!0,trapped:m.open,onMountAutoFocus:f=>{f.preventDefault()},onUnmountAutoFocus:P(r,f=>{m.trigger?.focus({preventScroll:!0}),f.preventDefault()}),children:a.jsx(mt,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:d,onPointerDownOutside:l,onFocusOutside:f=>f.preventDefault(),onDismiss:()=>m.onOpenChange(!1),children:a.jsx(le,{role:"listbox",id:m.contentId,"data-state":m.open?"open":"closed",dir:m.dir,onContextMenu:f=>f.preventDefault(),...S,...re,onPlaced:()=>B(!0),ref:_,style:{display:"flex",flexDirection:"column",outline:"none",...S.style},onKeyDown:P(S.onKeyDown,f=>{const I=f.ctrlKey||f.altKey||f.metaKey;if(f.key==="Tab"&&f.preventDefault(),!I&&f.key.length===1&&ae(f.key),["ArrowUp","ArrowDown","Home","End"].includes(f.key)){let w=V().filter(C=>!C.disabled).map(C=>C.ref.current);if(["ArrowUp","End"].includes(f.key)&&(w=w.slice().reverse()),["ArrowUp","ArrowDown"].includes(f.key)){const C=f.target,T=w.indexOf(C);w=w.slice(T+1)}setTimeout(()=>N(w)),f.preventDefault()}})})})})})})});Be.displayName=kt;var Bt="SelectItemAlignedPosition",He=n.forwardRef((t,o)=>{const{__scopeSelect:e,onPlaced:s,...r}=t,d=G(Q,e),l=Y(Q,e),[i,c]=n.useState(null),[p,g]=n.useState(null),x=L(o,_=>g(_)),E=de(e),b=n.useRef(!1),y=n.useRef(!0),{viewport:u,selectedItem:h,selectedItemText:S,focusSelectedItem:m}=l,v=n.useCallback(()=>{if(d.trigger&&d.valueNode&&i&&p&&u&&h&&S){const _=d.trigger.getBoundingClientRect(),O=p.getBoundingClientRect(),U=d.valueNode.getBoundingClientRect(),Z=S.getBoundingClientRect();if(d.dir!=="rtl"){const C=Z.left-O.left,T=U.left-C,q=_.left-T,X=_.width+q,he=Math.max(X,O.width),ge=window.innerWidth-A,ve=Pe(T,[A,Math.max(A,ge-he)]);i.style.minWidth=X+"px",i.style.left=ve+"px"}else{const C=O.right-Z.right,T=window.innerWidth-U.right-C,q=window.innerWidth-_.right-T,X=_.width+q,he=Math.max(X,O.width),ge=window.innerWidth-A,ve=Pe(T,[A,Math.max(A,ge-he)]);i.style.minWidth=X+"px",i.style.right=ve+"px"}const k=E(),V=window.innerHeight-A*2,z=u.scrollHeight,B=window.getComputedStyle(p),H=parseInt(B.borderTopWidth,10),N=parseInt(B.paddingTop,10),D=parseInt(B.borderBottomWidth,10),W=parseInt(B.paddingBottom,10),K=H+N+z+W+D,pe=Math.min(h.offsetHeight*5,K),ae=window.getComputedStyle(u),fe=parseInt(ae.paddingTop,10),me=parseInt(ae.paddingBottom,10),ee=_.top+_.height/2-A,le=V-ee,re=h.offsetHeight/2,f=h.offsetTop+re,I=H+N+f,R=K-I;if(I<=ee){const C=k.length>0&&h===k[k.length-1].ref.current;i.style.bottom="0px";const T=p.clientHeight-u.offsetTop-u.offsetHeight,q=Math.max(le,re+(C?me:0)+T+D),X=I+q;i.style.height=X+"px"}else{const C=k.length>0&&h===k[0].ref.current;i.style.top="0px";const q=Math.max(ee,H+u.offsetTop+(C?fe:0)+re)+R;i.style.height=q+"px",u.scrollTop=I-ee+u.offsetTop}i.style.margin=`${A}px 0`,i.style.minHeight=pe+"px",i.style.maxHeight=V+"px",s?.(),requestAnimationFrame(()=>b.current=!0)}},[E,d.trigger,d.valueNode,i,p,u,h,S,d.dir,s]);$(()=>v(),[v]);const[F,M]=n.useState();$(()=>{p&&M(window.getComputedStyle(p).zIndex)},[p]);const ne=n.useCallback(_=>{_&&y.current===!0&&(v(),m?.(),y.current=!1)},[v,m]);return a.jsx(Wt,{scope:e,contentWrapper:i,shouldExpandOnScrollRef:b,onScrollButtonChange:ne,children:a.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:F},children:a.jsx(j.div,{...r,ref:x,style:{boxSizing:"border-box",maxHeight:"100%",...r.style}})})})});He.displayName=Bt;var Ht="SelectPopperPosition",xe=n.forwardRef((t,o)=>{const{__scopeSelect:e,align:s="start",collisionPadding:r=A,...d}=t,l=ue(e);return a.jsx(ht,{...l,...d,ref:o,align:s,collisionPadding:r,style:{boxSizing:"border-box",...d.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});xe.displayName=Ht;var[Wt,be]=oe(Q,{}),Se="SelectViewport",We=n.forwardRef((t,o)=>{const{__scopeSelect:e,nonce:s,...r}=t,d=Y(Se,e),l=be(Se,e),i=L(o,d.onViewportChange),c=n.useRef(0);return a.jsxs(a.Fragment,{children:[a.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),a.jsx(ce.Slot,{scope:e,children:a.jsx(j.div,{"data-radix-select-viewport":"",role:"presentation",...r,ref:i,style:{position:"relative",flex:1,overflow:"hidden auto",...r.style},onScroll:P(r.onScroll,p=>{const g=p.currentTarget,{contentWrapper:x,shouldExpandOnScrollRef:E}=l;if(E?.current&&x){const b=Math.abs(c.current-g.scrollTop);if(b>0){const y=window.innerHeight-A*2,u=parseFloat(x.style.minHeight),h=parseFloat(x.style.height),S=Math.max(u,h);if(S<y){const m=S+b,v=Math.min(y,m),F=m-v;x.style.height=v+"px",x.style.bottom==="0px"&&(g.scrollTop=F>0?F:0,x.style.justifyContent="flex-end")}}}c.current=g.scrollTop})})})]})});We.displayName=Se;var Fe="SelectGroup",[Ft,Ut]=oe(Fe),zt=n.forwardRef((t,o)=>{const{__scopeSelect:e,...s}=t,r=Ie();return a.jsx(Ft,{scope:e,id:r,children:a.jsx(j.div,{role:"group","aria-labelledby":r,...s,ref:o})})});zt.displayName=Fe;var Ue="SelectLabel",Kt=n.forwardRef((t,o)=>{const{__scopeSelect:e,...s}=t,r=Ut(Ue,e);return a.jsx(j.div,{id:r.id,...s,ref:o})});Kt.displayName=Ue;var ie="SelectItem",[$t,ze]=oe(ie),Ke=n.forwardRef((t,o)=>{const{__scopeSelect:e,value:s,disabled:r=!1,textValue:d,...l}=t,i=G(ie,e),c=Y(ie,e),p=i.value===s,[g,x]=n.useState(d??""),[E,b]=n.useState(!1),y=L(o,m=>c.itemRefCallback?.(m,s,r)),u=Ie(),h=n.useRef("touch"),S=()=>{r||(i.onValueChange(s),i.onOpenChange(!1))};if(s==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return a.jsx($t,{scope:e,value:s,disabled:r,textId:u,isSelected:p,onItemTextChange:n.useCallback(m=>{x(v=>v||(m?.textContent??"").trim())},[]),children:a.jsx(ce.ItemSlot,{scope:e,value:s,disabled:r,textValue:g,children:a.jsx(j.div,{role:"option","aria-labelledby":u,"data-highlighted":E?"":void 0,"aria-selected":p&&E,"data-state":p?"checked":"unchecked","aria-disabled":r||void 0,"data-disabled":r?"":void 0,tabIndex:r?void 0:-1,...l,ref:y,onFocus:P(l.onFocus,()=>b(!0)),onBlur:P(l.onBlur,()=>b(!1)),onClick:P(l.onClick,()=>{h.current!=="mouse"&&S()}),onPointerUp:P(l.onPointerUp,()=>{h.current==="mouse"&&S()}),onPointerDown:P(l.onPointerDown,m=>{h.current=m.pointerType}),onPointerMove:P(l.onPointerMove,m=>{h.current=m.pointerType,r?c.onItemLeave?.():h.current==="mouse"&&m.currentTarget.focus({preventScroll:!0})}),onPointerLeave:P(l.onPointerLeave,m=>{m.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:P(l.onKeyDown,m=>{c.searchRef?.current!==""&&m.key===" "||(Rt.includes(m.key)&&S(),m.key===" "&&m.preventDefault())})})})})});Ke.displayName=ie;var se="SelectItemText",$e=n.forwardRef((t,o)=>{const{__scopeSelect:e,className:s,style:r,...d}=t,l=G(se,e),i=Y(se,e),c=ze(se,e),p=Ot(se,e),[g,x]=n.useState(null),E=L(o,S=>x(S),c.onItemTextChange,S=>i.itemTextRefCallback?.(S,c.value,c.disabled)),b=g?.textContent,y=n.useMemo(()=>a.jsx("option",{value:c.value,disabled:c.disabled,children:b},c.value),[c.disabled,c.value,b]),{onNativeOptionAdd:u,onNativeOptionRemove:h}=p;return $(()=>(u(y),()=>h(y)),[u,h,y]),a.jsxs(a.Fragment,{children:[a.jsx(j.span,{id:c.textId,...d,ref:E}),c.isSelected&&l.valueNode&&!l.valueNodeHasChildren?_e.createPortal(d.children,l.valueNode):null]})});$e.displayName=se;var Ge="SelectItemIndicator",Ye=n.forwardRef((t,o)=>{const{__scopeSelect:e,...s}=t;return ze(Ge,e).isSelected?a.jsx(j.span,{"aria-hidden":!0,...s,ref:o}):null});Ye.displayName=Ge;var we="SelectScrollUpButton",Ze=n.forwardRef((t,o)=>{const e=Y(we,t.__scopeSelect),s=be(we,t.__scopeSelect),[r,d]=n.useState(!1),l=L(o,s.onScrollButtonChange);return $(()=>{if(e.viewport&&e.isPositioned){let i=function(){const p=c.scrollTop>0;d(p)};const c=e.viewport;return i(),c.addEventListener("scroll",i),()=>c.removeEventListener("scroll",i)}},[e.viewport,e.isPositioned]),r?a.jsx(Xe,{...t,ref:l,onAutoScroll:()=>{const{viewport:i,selectedItem:c}=e;i&&c&&(i.scrollTop=i.scrollTop-c.offsetHeight)}}):null});Ze.displayName=we;var Ce="SelectScrollDownButton",qe=n.forwardRef((t,o)=>{const e=Y(Ce,t.__scopeSelect),s=be(Ce,t.__scopeSelect),[r,d]=n.useState(!1),l=L(o,s.onScrollButtonChange);return $(()=>{if(e.viewport&&e.isPositioned){let i=function(){const p=c.scrollHeight-c.clientHeight,g=Math.ceil(c.scrollTop)<p;d(g)};const c=e.viewport;return i(),c.addEventListener("scroll",i),()=>c.removeEventListener("scroll",i)}},[e.viewport,e.isPositioned]),r?a.jsx(Xe,{...t,ref:l,onAutoScroll:()=>{const{viewport:i,selectedItem:c}=e;i&&c&&(i.scrollTop=i.scrollTop+c.offsetHeight)}}):null});qe.displayName=Ce;var Xe=n.forwardRef((t,o)=>{const{__scopeSelect:e,onAutoScroll:s,...r}=t,d=Y("SelectScrollButton",e),l=n.useRef(null),i=de(e),c=n.useCallback(()=>{l.current!==null&&(window.clearInterval(l.current),l.current=null)},[]);return n.useEffect(()=>()=>c(),[c]),$(()=>{i().find(g=>g.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[i]),a.jsx(j.div,{"aria-hidden":!0,...r,ref:o,style:{flexShrink:0,...r.style},onPointerDown:P(r.onPointerDown,()=>{l.current===null&&(l.current=window.setInterval(s,50))}),onPointerMove:P(r.onPointerMove,()=>{d.onItemLeave?.(),l.current===null&&(l.current=window.setInterval(s,50))}),onPointerLeave:P(r.onPointerLeave,()=>{c()})})}),Gt="SelectSeparator",Yt=n.forwardRef((t,o)=>{const{__scopeSelect:e,...s}=t;return a.jsx(j.div,{"aria-hidden":!0,...s,ref:o})});Yt.displayName=Gt;var ye="SelectArrow",Zt=n.forwardRef((t,o)=>{const{__scopeSelect:e,...s}=t,r=ue(e),d=G(ye,e),l=Y(ye,e);return d.open&&l.position==="popper"?a.jsx(gt,{...r,...s,ref:o}):null});Zt.displayName=ye;var qt="SelectBubbleInput",Je=n.forwardRef(({__scopeSelect:t,value:o,...e},s)=>{const r=n.useRef(null),d=L(s,r),l=St(o);return n.useEffect(()=>{const i=r.current;if(!i)return;const c=window.HTMLSelectElement.prototype,g=Object.getOwnPropertyDescriptor(c,"value").set;if(l!==o&&g){const x=new Event("change",{bubbles:!0});g.call(i,o),i.dispatchEvent(x)}},[l,o]),a.jsx(j.select,{...e,style:{...it,...e.style},ref:d,defaultValue:o})});Je.displayName=qt;function Qe(t){return t===""||t===void 0}function et(t){const o=ct(t),e=n.useRef(""),s=n.useRef(0),r=n.useCallback(l=>{const i=e.current+l;o(i),(function c(p){e.current=p,window.clearTimeout(s.current),p!==""&&(s.current=window.setTimeout(()=>c(""),1e3))})(i)},[o]),d=n.useCallback(()=>{e.current="",window.clearTimeout(s.current)},[]);return n.useEffect(()=>()=>window.clearTimeout(s.current),[]),[e,r,d]}function tt(t,o,e){const r=o.length>1&&Array.from(o).every(p=>p===o[0])?o[0]:o,d=e?t.indexOf(e):-1;let l=Xt(t,Math.max(d,0));r.length===1&&(l=l.filter(p=>p!==e));const c=l.find(p=>p.textValue.toLowerCase().startsWith(r.toLowerCase()));return c!==e?c:void 0}function Xt(t,o){return t.map((e,s)=>t[(o+s)%t.length])}var Jt=Re,Qt=Me,eo=Oe,to=De,oo=Le,no=ke,ro=We,so=Ke,ao=$e,lo=Ye,io=Ze,co=qe;function xo({...t}){return a.jsx(Jt,{"data-slot":"select",...t})}function So({...t}){return a.jsx(eo,{"data-slot":"select-value",...t})}function wo({className:t,size:o="default",children:e,...s}){return a.jsxs(Qt,{"data-slot":"select-trigger","data-size":o,className:te("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...s,children:[e,a.jsx(to,{asChild:!0,children:a.jsx(Ne,{className:"size-4 opacity-50"})})]})}function Co({className:t,children:o,position:e="popper",...s}){return a.jsx(oo,{children:a.jsxs(no,{"data-slot":"select-content",className:te("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 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",e==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:e,...s,children:[a.jsx(uo,{}),a.jsx(ro,{className:te("p-1",e==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:o}),a.jsx(po,{})]})})}function yo({className:t,children:o,...e}){return a.jsxs(so,{"data-slot":"select-item",className:te("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",t),...e,children:[a.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:a.jsx(lo,{children:a.jsx(wt,{className:"size-4"})})}),a.jsx(ao,{children:o})]})}function uo({className:t,...o}){return a.jsx(io,{"data-slot":"select-scroll-up-button",className:te("flex cursor-default items-center justify-center py-1",t),...o,children:a.jsx(yt,{className:"size-4"})})}function po({className:t,...o}){return a.jsx(co,{"data-slot":"select-scroll-down-button",className:te("flex cursor-default items-center justify-center py-1",t),...o,children:a.jsx(Ne,{className:"size-4"})})}export{xo as S,wo as a,So as b,Co as c,yo as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e,i,L as m}from"./index-Ncy0-Qo7.js";import{m as n}from"./use-settings-form-submit-CXwtE1sI.js";import{F as c}from"./FieldInfo-sRlPRNSK.js";import{S as d,a as u,b as f,c as h,d as p}from"./select-GZr6C6eZ.js";import{u as x,R as j}from"./use-form-validation-context-D2oA54L_.js";import"./Page-B68mlTwU.js";import"./index-BBzHsn7u.js";import"./chevron-down-8PGvFYxV.js";import"./check-NQsw6yBl.js";function R({className:t,label:l,options:r}){const a=n(),{isFieldRequired:o}=x();return e.jsxs("div",{className:i("space-y-3",t),children:[e.jsxs(m,{htmlFor:a.name,className:"block w-full",children:[l,o(a.name)&&e.jsx(j,{})]}),e.jsxs(d,{name:a.name,defaultValue:a.state.value,onValueChange:s=>a.handleChange(s),children:[e.jsx(u,{className:"w-full shadow-none",children:e.jsx(f,{placeholder:"Select a link type"})}),e.jsx(h,{children:Object.values(r).map(s=>e.jsx(p,{value:s.toLowerCase(),className:"hover:bg-accent/50",children:s.toLowerCase()},s.toLowerCase()))})]},`${a.name}-${a.state.value}`),e.jsx(c,{fieldMeta:a.state.meta})]})}export{R as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as t,O as o}from"./index-Ncy0-Qo7.js";function e(){return t.jsx(o,{})}export{e as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as s,B as d,i as x}from"./index-Ncy0-Qo7.js";import{o as p}from"./use-settings-form-submit-CXwtE1sI.js";import{L as u}from"./loader-circle-Bz67bJa3.js";function g({label:m,actionLabel:a,size:t="md"}){const o=p();return s.jsx(s.Fragment,{children:s.jsx(o.Subscribe,{selector:e=>[e.canSubmit,e.isSubmitting,e.errors,e.fieldMeta],children:([e,i,n,c])=>s.jsxs("div",{className:"form__submit bg-background sticky right-0 bottom-0 left-0 w-full pt-4",children:[s.jsx(d,{type:"submit",className:x("w-full rounded-md transition-colors duration-150",{"opacity-70":i,"px-4 py-6":t==="lg","px-4 py-2":t==="md","px-2 py-1":t==="sm"}),disabled:!e||i,children:i?s.jsxs(s.Fragment,{children:[s.jsx(u,{className:"size-4 animate-spin"})," ",a??"Saving..."]}):s.jsx(s.Fragment,{children:m??"Save"})}),Object.keys(n).length>0&&s.jsxs("div",{className:"mt-4 rounded-md bg-red-50 p-4 text-sm text-red-700",children:[s.jsx("h4",{className:"font-medium",children:"Please fix the following errors:"}),s.jsxs("ul",{className:"mt-2 list-disc pl-5",children:[JSON.stringify(c),Object.entries(n).map(([l,r])=>s.jsxs("li",{children:[l,":"," ",typeof r=="string"?r:JSON.stringify(r)]},l))]})]})]})})})}export{g as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as s,f as C,e as T,j as o,b as I,d as y,g as M,h as H,i as S}from"./index-Ncy0-Qo7.js";import{u as z}from"./index-BBzHsn7u.js";var b="Switch",[A]=I(b),[U,q]=A(b),P=s.forwardRef((e,r)=>{const{__scopeSwitch:t,name:n,checked:a,defaultChecked:m,required:d,disabled:c,value:u="on",onCheckedChange:k,form:i,...w}=e,[l,p]=s.useState(null),v=C(r,f=>p(f)),g=s.useRef(!1),x=l?i||!!l.closest("form"):!0,[h,N]=T({prop:a,defaultProp:m??!1,onChange:k,caller:b});return o.jsxs(U,{scope:t,checked:h,disabled:c,children:[o.jsx(y.button,{type:"button",role:"switch","aria-checked":h,"aria-required":d,"data-state":_(h),"data-disabled":c?"":void 0,disabled:c,value:u,...w,ref:v,onClick:M(e.onClick,f=>{N(B=>!B),x&&(g.current=f.isPropagationStopped(),g.current||f.stopPropagation())})}),x&&o.jsx(j,{control:l,bubbles:!g.current,name:n,value:u,checked:h,required:d,disabled:c,form:i,style:{transform:"translateX(-100%)"}})]})});P.displayName=b;var E="SwitchThumb",R=s.forwardRef((e,r)=>{const{__scopeSwitch:t,...n}=e,a=q(E,t);return o.jsx(y.span,{"data-state":_(a.checked),"data-disabled":a.disabled?"":void 0,...n,ref:r})});R.displayName=E;var L="SwitchBubbleInput",j=s.forwardRef(({__scopeSwitch:e,control:r,checked:t,bubbles:n=!0,...a},m)=>{const d=s.useRef(null),c=C(d,m),u=z(t),k=H(r);return s.useEffect(()=>{const i=d.current;if(!i)return;const w=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(w,"checked").set;if(u!==t&&p){const v=new Event("click",{bubbles:n});p.call(i,t),i.dispatchEvent(v)}},[u,t,n]),o.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:t,...a,tabIndex:-1,ref:c,style:{...a.style,...k,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});j.displayName=L;function _(e){return e?"checked":"unchecked"}var O=P,D=R;function X({className:e,...r}){return o.jsx(O,{"data-slot":"switch",className:S("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...r,children:o.jsx(D,{"data-slot":"switch-thumb",className:S("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}export{X as S};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as s,i,L as m}from"./index-Ncy0-Qo7.js";import{m as r}from"./use-settings-form-submit-CXwtE1sI.js";import{S as n}from"./switch-BeMrf8sh.js";import"./index-BBzHsn7u.js";const h=({className:t,label:a})=>{const e=r();return s.jsxs("div",{className:i("form-field__switch flex items-center",t),children:[s.jsx(m,{htmlFor:e.name,className:"mr-3",children:a}),s.jsx(n,{id:e.name,checked:e.state.value,onCheckedChange:e.handleChange})]})};export{h as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as t,i as l}from"./index-Ncy0-Qo7.js";function o({className:a,...e}){return t.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:t.jsx("table",{"data-slot":"table",className:l("w-full caption-bottom text-sm",a),...e})})}function r({className:a,...e}){return t.jsx("thead",{"data-slot":"table-header",className:l("[&_tr]:border-b",a),...e})}function n({className:a,...e}){return t.jsx("tbody",{"data-slot":"table-body",className:l("[&_tr:last-child]:border-0",a),...e})}function d({className:a,...e}){return t.jsx("tr",{"data-slot":"table-row",className:l("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",a),...e})}function c({className:a,...e}){return t.jsx("th",{"data-slot":"table-head",className:l("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",a),...e})}function b({className:a,...e}){return t.jsx("td",{"data-slot":"table-cell",className:l("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",a),...e})}export{o as T,r as a,d as b,c,n as d,b as e};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c}from"./index-Ncy0-Qo7.js";const e=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],l=c("Ellipsis",e);const s=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],i=c("Eye",s);const o=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],y=c("Pencil",o);const a=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],d=c("Plus",a);const t=[["path",{d:"M14.5 2v17.5c0 1.4-1.1 2.5-2.5 2.5c-1.4 0-2.5-1.1-2.5-2.5V2",key:"125lnx"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M14.5 16h-5",key:"1ox875"}]],h=c("TestTube",t);export{l as E,y as P,h as T,i as a,d as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as a,i as o,L as m,J as d}from"./index-Ncy0-Qo7.js";import{m as u}from"./use-settings-form-submit-CXwtE1sI.js";import{F as c}from"./FieldInfo-sRlPRNSK.js";import{u as f,R as x}from"./use-form-validation-context-D2oA54L_.js";const v=({className:s,label:t,hideLabel:l=!1,...i})=>{const e=u(),{isFieldRequired:n}=f();return a.jsxs("div",{className:o("space-y-3",s),children:[!l&&a.jsxs(m,{htmlFor:e.name,className:"block w-full",children:[t,n(e.name)&&a.jsx(x,{})]}),a.jsx(d,{type:"text",className:"form-input",name:e.name,id:e.name,value:e.state.value??"","aria-invalid":e.state.meta.isTouched&&e.state.meta.errors?.length>0,onBlur:e.handleBlur,onChange:r=>e.handleChange(r.target.value),...i}),a.jsx(c,{fieldMeta:e.state.meta})]})};export{v as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as v}from"./index-Ncy0-Qo7.js";var h,l;function M(){if(l)return h;l=1;var t=1e3,a=t*60,i=a*60,s=i*24,f=s*7,m=s*365.25;h=function(e,r){r=r||{};var n=typeof e;if(n==="string"&&e.length>0)return c(e);if(n==="number"&&isFinite(e))return r.long?g(e):u(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function c(e){if(e=String(e),!(e.length>100)){var r=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(r){var n=parseFloat(r[1]),d=(r[2]||"ms").toLowerCase();switch(d){case"years":case"year":case"yrs":case"yr":case"y":return n*m;case"weeks":case"week":case"w":return n*f;case"days":case"day":case"d":return n*s;case"hours":case"hour":case"hrs":case"hr":case"h":return n*i;case"minutes":case"minute":case"mins":case"min":case"m":return n*a;case"seconds":case"second":case"secs":case"sec":case"s":return n*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function u(e){var r=Math.abs(e);return r>=s?Math.round(e/s)+"d":r>=i?Math.round(e/i)+"h":r>=a?Math.round(e/a)+"m":r>=t?Math.round(e/t)+"s":e+"ms"}function g(e){var r=Math.abs(e);return r>=s?o(e,r,s,"day"):r>=i?o(e,r,i,"hour"):r>=a?o(e,r,a,"minute"):r>=t?o(e,r,t,"second"):e+" ms"}function o(e,r,n,d){var w=r>=n*1.5;return Math.round(e/n)+" "+d+(w?"s":"")}return h}var p=M();const y=v(p);function D(t){const a=typeof t=="string"?new Date(t):new Date(t),s=new Date().getTime()-a.getTime();if(Math.abs(s)>y("7d"))return a.toLocaleDateString("en",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"});const f=y(Math.ceil(s/1e3)*1e3,{long:!0}),[m,c]=f.split(" "),u=new Intl.RelativeTimeFormat("en",{numeric:"auto"});return c==="ms"?u.format(0,"second"):u.format(-parseInt(m),c)}export{D as f};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{c as z,j as e,r as o,p as Y,R as Re,f as J,W as Me,b as Pe,C as _e,g as Ie,T as $e,D as Le,q as X,s as Fe,v as Ue,w as qe,i as y,x as Z,u as G,l as C,t as d,y as ee,z as se,A as te,E as ae,F as re,L as j,B as b,G as ne,H as le,I as ie,J as V,k as Ve}from"./index-Ncy0-Qo7.js";import{S as Be,a as Ke,b as ze,c as Ge,d as He}from"./select-GZr6C6eZ.js";import{B as h}from"./badge-C5YCxEzP.js";import{T as Qe,a as We,b as B,c as I,d as Ye,e as k}from"./table-qEFWauuw.js";import{P as Je,D as Xe,a as Ze,b as es,d as ss,c as $,e as ts}from"./Page-B68mlTwU.js";import{L as K}from"./loader-circle-Bz67bJa3.js";import{T as H,P as oe,E as as,a as rs,b as ns}from"./test-tube-DhD6uWdp.js";import{S as ls}from"./switch-BeMrf8sh.js";import"./index-BBzHsn7u.js";import"./chevron-down-8PGvFYxV.js";import"./check-NQsw6yBl.js";const is=[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]],os=z("GitMerge",is);const cs=[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"6",ry:"6",key:"f2vt7d"}],["circle",{cx:"8",cy:"12",r:"2",key:"1nvbw3"}]],ds=z("ToggleLeft",cs);const us=[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"6",ry:"6",key:"f2vt7d"}],["circle",{cx:"16",cy:"12",r:"2",key:"4ma0v8"}]],ms=z("ToggleRight",us);var gs=Symbol("radix.slottable");function hs(t){const r=({children:a})=>e.jsx(e.Fragment,{children:a});return r.displayName=`${t}.Slottable`,r.__radixId=gs,r}var ce="AlertDialog",[ps]=Pe(ce,[Y]),v=Y(),de=t=>{const{__scopeAlertDialog:r,...a}=t,n=v(r);return e.jsx(Re,{...n,...a,modal:!0})};de.displayName=ce;var xs="AlertDialogTrigger",fs=o.forwardRef((t,r)=>{const{__scopeAlertDialog:a,...n}=t,l=v(a);return e.jsx(qe,{...l,...n,ref:r})});fs.displayName=xs;var js="AlertDialogPortal",ue=t=>{const{__scopeAlertDialog:r,...a}=t,n=v(r);return e.jsx(Fe,{...n,...a})};ue.displayName=js;var vs="AlertDialogOverlay",me=o.forwardRef((t,r)=>{const{__scopeAlertDialog:a,...n}=t,l=v(a);return e.jsx(Ue,{...l,...n,ref:r})});me.displayName=vs;var E="AlertDialogContent",[Ns,bs]=ps(E),ys=hs("AlertDialogContent"),ge=o.forwardRef((t,r)=>{const{__scopeAlertDialog:a,children:n,...l}=t,p=v(a),u=o.useRef(null),x=J(r,u),m=o.useRef(null);return e.jsx(Me,{contentName:E,titleName:he,docsSlug:"alert-dialog",children:e.jsx(Ns,{scope:a,cancelRef:m,children:e.jsxs(_e,{role:"alertdialog",...p,...l,ref:x,onOpenAutoFocus:Ie(l.onOpenAutoFocus,c=>{c.preventDefault(),m.current?.focus({preventScroll:!0})}),onPointerDownOutside:c=>c.preventDefault(),onInteractOutside:c=>c.preventDefault(),children:[e.jsx(ys,{children:n}),e.jsx(Cs,{contentRef:u})]})})})});ge.displayName=E;var he="AlertDialogTitle",pe=o.forwardRef((t,r)=>{const{__scopeAlertDialog:a,...n}=t,l=v(a);return e.jsx($e,{...l,...n,ref:r})});pe.displayName=he;var xe="AlertDialogDescription",fe=o.forwardRef((t,r)=>{const{__scopeAlertDialog:a,...n}=t,l=v(a);return e.jsx(Le,{...l,...n,ref:r})});fe.displayName=xe;var Ss="AlertDialogAction",je=o.forwardRef((t,r)=>{const{__scopeAlertDialog:a,...n}=t,l=v(a);return e.jsx(X,{...l,...n,ref:r})});je.displayName=Ss;var ve="AlertDialogCancel",Ne=o.forwardRef((t,r)=>{const{__scopeAlertDialog:a,...n}=t,{cancelRef:l}=bs(ve,a),p=v(a),u=J(r,l);return e.jsx(X,{...p,...n,ref:u})});Ne.displayName=ve;var Cs=({contentRef:t})=>{const r=`\`${E}\` requires a description for the component to be accessible for screen reader users.
|
|
2
|
+
|
|
3
|
+
You can add a description to the \`${E}\` by passing a \`${xe}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
|
|
4
|
+
|
|
5
|
+
Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${E}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
|
|
6
|
+
|
|
7
|
+
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return o.useEffect(()=>{document.getElementById(t.current?.getAttribute("aria-describedby"))||console.warn(r)},[r,t]),null},Ts=de,As=ue,ws=me,Ds=ge,ks=je,Es=Ne,Os=pe,Rs=fe;function Ms({...t}){return e.jsx(Ts,{"data-slot":"alert-dialog",...t})}function Ps({...t}){return e.jsx(As,{"data-slot":"alert-dialog-portal",...t})}function _s({className:t,...r}){return e.jsx(ws,{"data-slot":"alert-dialog-overlay",className:y("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...r})}function Is({className:t,...r}){return e.jsxs(Ps,{children:[e.jsx(_s,{}),e.jsx(Ds,{"data-slot":"alert-dialog-content",className:y("bg-background 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 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",t),...r})]})}function $s({className:t,...r}){return e.jsx("div",{"data-slot":"alert-dialog-header",className:y("flex flex-col gap-2 text-center sm:text-left",t),...r})}function Ls({className:t,...r}){return e.jsx("div",{"data-slot":"alert-dialog-footer",className:y("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...r})}function Fs({className:t,...r}){return e.jsx(Os,{"data-slot":"alert-dialog-title",className:y("text-lg font-semibold",t),...r})}function Us({className:t,...r}){return e.jsx(Rs,{"data-slot":"alert-dialog-description",className:y("text-muted-foreground text-sm",t),...r})}function qs({className:t,...r}){return e.jsx(ks,{className:y(Z(),t),...r})}function Vs({className:t,...r}){return e.jsx(Es,{className:y(Z({variant:"outline"}),t),...r})}function Bs({open:t,onOpenChange:r,sourceTracker:a,targetId:n,onTargetChange:l,onConfirm:p,isMerging:u,availableTargets:x}){const m=c=>{l(Number(c))};return e.jsx(Ms,{open:t,onOpenChange:r,children:e.jsxs(Is,{children:[e.jsxs($s,{children:[e.jsx(Fs,{children:"Merge Disabled Tracker"}),e.jsxs(Us,{children:["Move timestamp history from"," ",e.jsx("span",{className:"font-medium",children:a?.name||a?.url||""})," ","into another tracker before permanently deleting it."]})]}),e.jsx("div",{className:"space-y-3",children:e.jsxs("div",{children:[e.jsx("span",{className:"text-sm font-medium",children:"Merge into"}),e.jsxs(Be,{value:n?.toString(),onValueChange:m,disabled:u,children:[e.jsx(Ke,{className:"mt-1 min-h-[3rem] items-center justify-between",children:e.jsx(ze,{placeholder:"Select a tracker"})}),e.jsx(Ge,{children:x.map(c=>e.jsx(He,{value:c.id.toString(),children:e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{children:c.name||c.url}),e.jsx("span",{className:"text-muted-foreground text-xs break-all",children:c.url})]})},c.id))})]})]})}),e.jsxs(Ls,{children:[e.jsx(Vs,{disabled:u,children:"Cancel"}),e.jsx(qs,{onClick:p,disabled:u||!n,children:u?"Merging…":"Merge"})]})]})})}function Ks({tvIdCaps:t,movieIdCaps:r}){const a=new Set([...t?Object.keys(t):[],...r?Object.keys(r):[]]),n=[];return a.forEach(l=>{t?.[l]&&r?.[l]&&n.push(e.jsx(h,{variant:"outline",className:"text-xs",children:l},l))}),a.forEach(l=>{t?.[l]&&!r?.[l]&&n.push(e.jsxs(h,{variant:"outline",className:"text-xs",children:[l," (TV)"]},`${l}-tv`))}),a.forEach(l=>{!t?.[l]&&r?.[l]&&n.push(e.jsxs(h,{variant:"outline",className:"text-xs",children:[l," (Movies)"]},`${l}-movie`))}),n.length>0?e.jsx(e.Fragment,{children:n}):e.jsx("span",{className:"text-muted-foreground text-sm",children:"No external ID support detected"})}function zs({open:t,onOpenChange:r,tracker:a,onEdit:n}){const l=G(),[p,u]=o.useState(!1),{mutate:x}=C(l.indexers.testExisting.mutationOptions({onSuccess:c=>{u(!1),c.success?d.success("Connection test successful!"):d.error(`Connection test failed: ${c.message}`)},onError:c=>{u(!1),d.error(`Test failed: ${c.message}`)}})),m=()=>{a&&(u(!0),x({id:a.id}))};return a?e.jsx(ee,{open:t,onOpenChange:r,children:e.jsxs(se,{className:"sm:max-w-md",children:[e.jsxs(te,{children:[e.jsx(ae,{children:"View Tracker"}),e.jsx(re,{children:"View tracker details and capabilities."})]}),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(j,{children:"Tracker Name"}),e.jsx("div",{className:"bg-muted/50 rounded-md border px-3 py-2 text-sm",children:a.name||"Unnamed"})]}),e.jsxs("div",{className:"grid gap-3",children:[e.jsx(j,{children:"Status"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:e.jsx(h,{variant:a.enabled?"default":"secondary",children:a.enabled?"Enabled":"Disabled"})})]}),e.jsxs("div",{className:"grid gap-3",children:[e.jsx(j,{children:"URL"}),e.jsx("div",{className:"bg-muted/50 rounded-md border px-3 py-2 font-mono text-sm break-all",children:a.url})]}),e.jsxs("div",{className:"grid gap-3",children:[e.jsx(j,{children:"Search Capabilities"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[a.searchCap&&e.jsx(h,{variant:"outline",className:"text-xs",children:"Search"}),a.tvSearchCap&&e.jsx(h,{variant:"outline",className:"text-xs",children:"TV"}),a.movieSearchCap&&e.jsx(h,{variant:"outline",className:"text-xs",children:"Movies"}),a.musicSearchCap&&e.jsx(h,{variant:"outline",className:"text-xs",children:"Music"}),a.audioSearchCap&&e.jsx(h,{variant:"outline",className:"text-xs",children:"Audio"}),a.bookSearchCap&&e.jsx(h,{variant:"outline",className:"text-xs",children:"Books"}),!a.searchCap&&!a.tvSearchCap&&!a.movieSearchCap&&!a.musicSearchCap&&!a.audioSearchCap&&!a.bookSearchCap&&e.jsx("span",{className:"text-muted-foreground text-sm",children:"No search capabilities detected"})]})]}),e.jsxs("div",{className:"grid gap-3",children:[e.jsx(j,{children:"Supported External IDs"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:e.jsx(Ks,{tvIdCaps:a.tvIdCaps,movieIdCaps:a.movieIdCaps})})]}),e.jsx(b,{type:"button",variant:"outline",onClick:m,disabled:p,className:"w-full",children:p?e.jsxs(e.Fragment,{children:[e.jsx(K,{className:"mr-2 h-4 w-4 animate-spin"}),"Testing Connection..."]}):e.jsxs(e.Fragment,{children:[e.jsx(H,{className:"mr-2 h-4 w-4"}),"Test Connection"]})})]}),e.jsxs(ne,{children:[n&&e.jsxs(b,{type:"button",onClick:()=>n(a),className:"flex-1",children:[e.jsx(oe,{className:"mr-2 h-4 w-4"}),"Edit"]}),e.jsx(le,{asChild:!0,children:e.jsx(b,{type:"button",variant:"outline",className:"flex-1",children:"Close"})})]})]})}):null}function Gs({open:t,onOpenChange:r,mode:a,tracker:n}){const l=G(),p=ie(),[u,x]=o.useState(n?.name||""),[m,c]=o.useState(n?.url||""),[f,T]=o.useState(""),[O,N]=o.useState(n?.enabled??!0),[L,S]=o.useState(!1);o.useEffect(()=>{t&&(x(n?.name||""),c(n?.url||""),T(""),N(n?.enabled??!0))},[t,n]);const{mutate:A,isPending:R}=C(l.indexers.create.mutationOptions({onSuccess:async()=>{d.success("Tracker created successfully"),await p.invalidateQueries({queryKey:l.indexers.getAll.queryKey()}),r(!1)},onError:g=>{d.error(`Failed to create tracker: ${g.message}`)}})),{mutate:M,isPending:w}=C(l.indexers.update.mutationOptions({onSuccess:async()=>{d.success("Tracker updated successfully"),await p.invalidateQueries({queryKey:l.indexers.getAll.queryKey()}),r(!1)},onError:g=>{d.error(`Failed to update tracker: ${g.message}`)}})),{mutate:D}=C(l.indexers.testNew.mutationOptions({onSuccess:g=>{S(!1),g.success?d.success("Connection test successful!"):d.error(`Connection test failed: ${g.message}`)},onError:g=>{S(!1),d.error(`Test failed: ${g.message}`)}})),U=g=>{if(g.preventDefault(),!m.trim()){d.error("URL is required");return}const F=m.trim();if(!F.endsWith("/api")){d.error("URL must end with /api");return}try{new URL(F)}catch{d.error("Invalid URL format");return}if(!f.trim()){d.error("API key is required");return}a==="edit"&&n?M({id:n.id,name:u.trim()||null,url:m.trim(),apikey:f.trim(),enabled:O}):a==="create"&&A({name:u.trim()||void 0,url:m.trim(),apikey:f.trim(),enabled:O})},q=()=>{if(!m.trim()||!f.trim()){d.error("URL and API key are required for testing");return}S(!0),D({url:m.trim(),apikey:f.trim()})},P=R||w;return e.jsx(ee,{open:t,onOpenChange:r,children:e.jsx(se,{className:"sm:max-w-md",children:e.jsxs("form",{onSubmit:U,children:[e.jsxs(te,{children:[e.jsx(ae,{children:a==="edit"?"Edit Tracker":"Add Tracker"}),e.jsx(re,{children:a==="edit"?"Update the tracker details below.":"Add a new torznab indexer or tracker."})]}),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(j,{htmlFor:"name",children:"Tracker Name"}),e.jsx(V,{id:"name",value:u,onChange:g=>x(g.target.value),placeholder:"My Indexer",autoComplete:"off"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(j,{htmlFor:"tracker-enabled",className:"text-sm font-medium",children:"Enable Search and RSS"}),e.jsx(ls,{id:"tracker-enabled",checked:O,onCheckedChange:N})]}),e.jsxs("div",{className:"grid gap-3",children:[e.jsx(j,{htmlFor:"url",children:"URL"}),e.jsx(V,{id:"url",type:"url",value:m,onChange:g=>c(g.target.value),placeholder:"https://indexer.example.com/api",autoComplete:"url",required:!0})]}),e.jsxs("div",{className:"grid gap-3",children:[e.jsx(j,{htmlFor:"apikey",children:"API Key"}),e.jsx(V,{id:"apikey",type:"password",value:f,onChange:g=>T(g.target.value),placeholder:"Enter API key",autoComplete:"off",required:!0})]}),e.jsx(b,{type:"button",variant:"outline",onClick:q,disabled:L||!m.trim()||!f.trim(),className:"w-full",children:L?e.jsxs(e.Fragment,{children:[e.jsx(K,{className:"mr-2 h-4 w-4 animate-spin"}),"Testing Connection..."]}):e.jsxs(e.Fragment,{children:[e.jsx(H,{className:"mr-2 h-4 w-4"}),"Test Connection"]})})]}),e.jsxs(ne,{children:[e.jsx(b,{type:"submit",disabled:P,children:P?e.jsxs(e.Fragment,{children:[e.jsx(K,{className:"mr-2 h-4 w-4 animate-spin"}),a==="edit"?"Updating...":"Creating..."]}):a==="edit"?"Update":"Create"}),e.jsx(le,{asChild:!0,children:e.jsx(b,{type:"button",variant:"outline",disabled:P,children:"Cancel"})})]})]})})})}function rt(){const t=G(),r=ie(),[a,n]=o.useState(!1),[l,p]=o.useState(!1),[u,x]=o.useState("create"),[m,c]=o.useState(null),[f,T]=o.useState(null),[O,N]=o.useState(null),[L,S]=o.useState(!1),[A,R]=o.useState(null),[M,w]=o.useState(null),{data:D}=Ve(t.indexers.getAll.queryOptions()),{mutate:U}=C(t.indexers.update.mutationOptions({onSuccess:async()=>{d.success("Tracker updated successfully"),await r.invalidateQueries({queryKey:t.indexers.getAll.queryKey()})},onError:s=>{d.error(`Failed to update tracker: ${s.message}`)}})),{mutate:q}=C(t.indexers.testExisting.mutationOptions({onSuccess:s=>{T(null),s.success?d.success(s.message):d.error(s.message)},onError:s=>{T(null),d.error(`Test failed: ${s.message}`)}})),{mutate:P,isPending:g}=C(t.indexers.mergeDisabled.mutationOptions({onSuccess:async s=>{d.success(s.mergedCount?`Merged ${s.mergedCount.toLocaleString()} timestamp entries`:"No timestamps needed merging."),await r.invalidateQueries({queryKey:t.indexers.getAll.queryKey()}),S(!1),R(null),w(null)},onError:s=>{d.error(`Failed to merge tracker data: ${s.message}`)}})),F=s=>new Date(s).toLocaleString(),be=s=>s.enabled?s.status==="RATE_LIMITED"?s.retryAfter&&Date.now()<s.retryAfter?e.jsx(h,{variant:"destructive",className:"bg-red-700",title:`Rate limited until ${F(s.retryAfter)}`,children:"Rate Limited"}):e.jsx(h,{variant:"default",className:"bg-green-700",children:"OK"}):s.status==="UNKNOWN_ERROR"?e.jsx(h,{variant:"destructive",className:"bg-red-700",children:"Error"}):s.searchCap===null?e.jsx(h,{variant:"outline",children:"Unknown"}):s.status===null||s.status==="OK"?e.jsx(h,{variant:"default",className:"bg-green-700",children:"OK"}):e.jsx(h,{variant:"outline",children:s.status}):e.jsx(h,{variant:"secondary",children:"Disabled"}),ye=s=>{const i=[];return s.searchCap&&i.push("Search"),s.tvSearchCap&&i.push("TV"),s.movieSearchCap&&i.push("Movies"),s.musicSearchCap&&i.push("Music"),s.audioSearchCap&&i.push("Audio"),s.bookSearchCap&&i.push("Books"),i.length===0?e.jsx("span",{className:"text-muted-foreground text-sm",children:"Unknown"}):e.jsx("div",{className:"grid auto-cols-max grid-flow-col gap-1",children:i.map(_=>e.jsx(h,{variant:"outline",className:"text-xs",children:_},_))})},Se=()=>{c(null),x("create"),p(!0)},Ce=s=>{n(s),s||N(null)},Te=s=>{p(s),s||N(null)},Q=s=>{N(null),c(s),n(!0)},W=s=>{N(null),c(s),x("edit"),n(!1),p(!0)},Ae=s=>{U({id:s.id,enabled:!s.enabled})},we=s=>{T(s.id),q({id:s.id})},De=s=>{const i=D?.filter(_=>_.enabled&&_.id!==s.id)??[];if(!i.length){d.error("No enabled trackers available to merge into.");return}R(s),w(i[0]?.id??null),S(!0)},ke=s=>{S(s),s||(R(null),w(null))},Ee=()=>{if(!A||!M){d.error("Select a destination tracker to merge into.");return}P({sourceId:A.id,targetId:M})},Oe=e.jsxs(b,{onClick:Se,size:"sm",children:[e.jsx(ns,{className:"mr-2 h-4 w-4"}),"Add Tracker"]});return e.jsxs(Je,{breadcrumbs:["Settings","Trackers"],actions:Oe,children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:"Trackers"}),e.jsx("p",{className:"text-muted-foreground",children:"Manage your torznab indexers and trackers"})]}),e.jsx("div",{className:"overflow-x-auto rounded-lg border",children:e.jsxs(Qe,{children:[e.jsx(We,{className:"bg-muted sticky top-0 z-10",children:e.jsxs(B,{className:"border-b",children:[e.jsx(I,{children:"Name"}),e.jsx(I,{children:"URL"}),e.jsx(I,{children:"Status"}),e.jsx(I,{children:"Capabilities"}),e.jsx(I,{className:"text-right",children:"Actions"})]})}),e.jsxs(Ye,{children:[D?.map(s=>e.jsxs(B,{className:"hover:bg-muted/50 cursor-pointer",onClick:()=>Q(s),children:[e.jsx(k,{className:"font-medium",children:s.name||"Unnamed"}),e.jsx(k,{className:"font-mono text-sm",children:s.url}),e.jsx(k,{children:be(s)}),e.jsx(k,{children:ye(s)}),e.jsx(k,{className:"text-right",children:e.jsxs(Xe,{open:O===s.id,onOpenChange:i=>N(i?s.id:null),children:[e.jsx(Ze,{asChild:!0,children:e.jsxs(b,{variant:"ghost",className:"h-8 w-8 p-0",onClick:i=>i.stopPropagation(),children:[e.jsx("span",{className:"sr-only",children:"Open menu"}),e.jsx(as,{className:"h-4 w-4"})]})}),e.jsxs(es,{align:"end",children:[e.jsx(ss,{children:"Actions"}),e.jsxs($,{onClick:i=>{i.stopPropagation(),Q(s)},children:[e.jsx(rs,{className:"mr-2 h-4 w-4"}),"View Details"]}),e.jsxs($,{onClick:i=>{i.stopPropagation(),W(s)},children:[e.jsx(oe,{className:"mr-2 h-4 w-4"}),"Edit"]}),e.jsx(ts,{}),e.jsxs($,{onClick:i=>{i.stopPropagation(),we(s)},disabled:f===s.id,children:[e.jsx(H,{className:"mr-2 h-4 w-4"}),f===s.id?"Testing...":"Test Connection"]}),e.jsx($,{onClick:i=>{i.stopPropagation(),Ae(s)},children:s.enabled?e.jsxs(e.Fragment,{children:[e.jsx(ds,{className:"mr-2 h-4 w-4"}),"Disable"]}):e.jsxs(e.Fragment,{children:[e.jsx(ms,{className:"mr-2 h-4 w-4"}),"Enable"]})}),!s.enabled&&e.jsxs($,{onClick:i=>{i.stopPropagation(),De(s)},children:[e.jsx(os,{className:"mr-2 h-4 w-4"}),"Merge"]})]})]})})]},s.id)),D?.length===0&&e.jsx(B,{children:e.jsx(k,{colSpan:5,className:"py-8 text-center",children:e.jsx("div",{className:"text-muted-foreground",children:"No trackers configured. Add your first tracker to get started."})})})]})]})})]}),e.jsx(zs,{open:a,onOpenChange:Ce,tracker:m,onEdit:m?W:void 0}),e.jsx(Gs,{open:l,onOpenChange:Te,mode:u,tracker:m}),e.jsx(Bs,{open:L,onOpenChange:ke,sourceTracker:A,targetId:M,onTargetChange:w,onConfirm:Ee,isMerging:g,availableTargets:(D??[]).filter(s=>s.enabled&&s.id!==A?.id).map(s=>({id:s.id,name:s.name,url:s.url}))})]})}export{rt as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as r,r as o}from"./index-Ncy0-Qo7.js";import{n as e}from"./use-settings-form-submit-CXwtE1sI.js";function a(){return r.jsx("span",{className:"text-red-500",title:"Required",children:"*"})}const s=()=>{const t=o.useContext(e);if(!t)throw new Error("useFormValidation must be used within a FormValidationProvider");return t};export{a as R,s as u};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/text-field-ZnKHDUks.js","assets/index-Ncy0-Qo7.js","assets/index-B41DM2T5.css","assets/FieldInfo-sRlPRNSK.js","assets/use-form-validation-context-D2oA54L_.js","assets/switch-field-qMXHRKhx.js","assets/switch-BeMrf8sh.js","assets/index-BBzHsn7u.js","assets/select-field-CvT0SYk8.js","assets/select-GZr6C6eZ.js","assets/Page-B68mlTwU.js","assets/chevron-down-8PGvFYxV.js","assets/check-NQsw6yBl.js","assets/array-field-BCFMrvoU.js","assets/duration-field-DIkKt3iw.js","assets/submit-button-D7DKHqAq.js","assets/loader-circle-Bz67bJa3.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as A,j as N,U as q,_ as de,u as zt,k as rs,I as is,t as yt,l as ns}from"./index-Ncy0-Qo7.js";function _t(r,e){return e.sort&&r.sort((t,s)=>t.localeCompare(s)),new Intl.ListFormat("en",{style:e.style??"long",type:e.type??"conjunction"}).format(r)}var mt=(r=>(r.SAVE="save",r.INJECT="inject",r))(mt||{}),pt=(r=>(r.STRICT="strict",r.FLEXIBLE="flexible",r.PARTIAL="partial",r))(pt||{}),gt=(r=>(r.SYMLINK="symlink",r.HARDLINK="hardlink",r.REFLINK="reflink",r.REFLINK_OR_COPY="reflinkOrCopy",r))(gt||{}),Ut=(r=>(r.NAME="name",r.NAME_REGEX="nameRegex",r.FOLDER="folder",r.FOLDER_REGEX="folderRegex",r.CATEGORY="category",r.TAG="tag",r.TRACKER="tracker",r.INFOHASH="infoHash",r.SIZE_BELOW="sizeBelow",r.SIZE_ABOVE="sizeAbove",r.LEGACY="legacy",r))(Ut||{});const Wt={blocklistType:`Blocklist item does not start with a valid prefix. Must be of ${_t(Object.values(Ut),{sort:!1,style:"narrow",type:"unit"})}`,emptyString:"cannot have an empty string. If you want to unset it, use null or undefined.",matchModeInvalid:`matchMode must be one of: ${_t(Object.values(pt).map(r=>`"${r}"`),{sort:!1,style:"narrow",type:"unit"})}`},as={delay:30,torznab:[""],useClientTorrents:!1,torrentClients:[],dataDirs:[""],matchMode:"strict",skipRecheck:!0,autoResumeMaxDownload:52428800,linkCategory:null,linkDir:null,linkDirs:[""],linkType:"hardlink",flatLinking:!1,maxDataDepth:2,torrentDir:null,outputDir:"",injectDir:"",includeSingleEpisodes:!1,includeNonVideos:!1,fuzzySizeThreshold:1,seasonFromEpisodes:null,excludeOlder:null,excludeRecentSearch:null,action:"inject",qbittorrentUrl:null,rtorrentRpcUrl:null,transmissionRpcUrl:null,delugeRpcUrl:null,duplicateCategories:!1,notificationWebhookUrls:[""],port:null,host:null,rssCadence:null,searchCadence:null,snatchTimeout:null,searchTimeout:null,searchLimit:null,verbose:!1,torrents:[""],blockList:[""],apiKey:null,radarr:[""],sonarr:[""]},me=new WeakMap,Ne=new WeakMap,$e={current:[]};let Je=!1,Me=0;const xe=new Set,Ce=new Map;function qt(r){const e=Array.from(r).sort((t,s)=>t instanceof G&&t.options.deps.includes(s)?1:s instanceof G&&s.options.deps.includes(t)?-1:0);for(const t of e){if($e.current.includes(t))continue;$e.current.push(t),t.recompute();const s=Ne.get(t);if(s)for(const i of s){const n=me.get(i);n&&qt(n)}}}function os(r){const e={prevVal:r.prevState,currentVal:r.state};for(const t of r.listeners)t(e)}function ls(r){const e={prevVal:r.prevState,currentVal:r.state};for(const t of r.listeners)t(e)}function Gt(r){if(Me>0&&!Ce.has(r)&&Ce.set(r,r.prevState),xe.add(r),!(Me>0)&&!Je)try{for(Je=!0;xe.size>0;){const e=Array.from(xe);xe.clear();for(const t of e){const s=Ce.get(t)??t.prevState;t.prevState=s,os(t)}for(const t of e){const s=me.get(t);s&&($e.current.push(t),qt(s))}for(const t of e){const s=me.get(t);if(s)for(const i of s)ls(i)}}}finally{Je=!1,$e.current=[],Ce.clear()}}function W(r){Me++;try{r()}finally{if(Me--,Me===0){const e=xe.values().next().value;e&&Gt(e)}}}function us(r){return typeof r=="function"}class Ze{constructor(e,t){this.listeners=new Set,this.subscribe=s=>{var i,n;this.listeners.add(s);const a=(n=(i=this.options)==null?void 0:i.onSubscribe)==null?void 0:n.call(i,s,this);return()=>{this.listeners.delete(s),a?.()}},this.prevState=e,this.state=e,this.options=t}setState(e){var t,s,i;this.prevState=this.state,(t=this.options)!=null&&t.updateFn?this.state=this.options.updateFn(this.prevState)(e):us(e)?this.state=e(this.prevState):this.state=e,(i=(s=this.options)==null?void 0:s.onUpdate)==null||i.call(s),Gt(this)}}class G{constructor(e){this.listeners=new Set,this._subscriptions=[],this.lastSeenDepValues=[],this.getDepVals=()=>{const t=this.options.deps.length,s=new Array(t),i=new Array(t);for(let n=0;n<t;n++){const a=this.options.deps[n];s[n]=a.prevState,i[n]=a.state}return this.lastSeenDepValues=i,{prevDepVals:s,currDepVals:i,prevVal:this.prevState??void 0}},this.recompute=()=>{var t,s;this.prevState=this.state;const i=this.getDepVals();this.state=this.options.fn(i),(s=(t=this.options).onUpdate)==null||s.call(t)},this.checkIfRecalculationNeededDeeply=()=>{for(const n of this.options.deps)n instanceof G&&n.checkIfRecalculationNeededDeeply();let t=!1;const s=this.lastSeenDepValues,{currDepVals:i}=this.getDepVals();for(let n=0;n<i.length;n++)if(i[n]!==s[n]){t=!0;break}t&&this.recompute()},this.mount=()=>(this.registerOnGraph(),this.checkIfRecalculationNeededDeeply(),()=>{this.unregisterFromGraph();for(const t of this._subscriptions)t()}),this.subscribe=t=>{var s,i;this.listeners.add(t);const n=(i=(s=this.options).onSubscribe)==null?void 0:i.call(s,t,this);return()=>{this.listeners.delete(t),n?.()}},this.options=e,this.state=e.fn({prevDepVals:void 0,prevVal:void 0,currDepVals:this.getDepVals().currDepVals})}registerOnGraph(e=this.options.deps){for(const t of e)if(t instanceof G)t.registerOnGraph(),this.registerOnGraph(t.options.deps);else if(t instanceof Ze){let s=me.get(t);s||(s=new Set,me.set(t,s)),s.add(this);let i=Ne.get(this);i||(i=new Set,Ne.set(this,i)),i.add(t)}}unregisterFromGraph(e=this.options.deps){for(const t of e)if(t instanceof G)this.unregisterFromGraph(t.options.deps);else if(t instanceof Ze){const s=me.get(t);s&&s.delete(this);const i=Ne.get(this);i&&i.delete(t)}}}function ds(r){return typeof r=="function"}function bt(r,...e){return ds(r)?r(...e):r}function cs(r){return r||(typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"")}class Kt{#s=!0;#e;#t;#n;#r;#i;#a;#l;#d=0;#h=5;#o=!1;#c=()=>{this.debugLog("Connected to event bus"),this.#i=!0,this.#o=!1,this.debugLog("Emitting queued events",this.#r),this.#r.forEach(e=>this.emitEventToBus(e)),this.#r=[],this.stopConnectLoop(),this.#t().removeEventListener("tanstack-connect-success",this.#c)};#u=()=>{if(this.#d<this.#h){this.#d++,this.dispatchCustomEvent("tanstack-connect",{});return}this.#t().removeEventListener("tanstack-connect",this.#u),this.debugLog("Max retries reached, giving up on connection"),this.stopConnectLoop()};#f=()=>{this.#o||(this.#o=!0,this.#t().addEventListener("tanstack-connect-success",this.#c),this.#u())};constructor({pluginId:e,debug:t=!1,enabled:s=!0,reconnectEveryMs:i=300}){this.#e=e,this.#s=s,this.#t=this.getGlobalTarget,this.#n=t,this.debugLog(" Initializing event subscription for plugin",this.#e),this.#r=[],this.#i=!1,this.#a=null,this.#l=i}startConnectLoop(){this.#a!==null||this.#i||(this.debugLog(`Starting connect loop (every ${this.#l}ms)`),this.#a=setInterval(this.#u,this.#l))}stopConnectLoop(){this.#o=!1,this.#a!==null&&(clearInterval(this.#a),this.#a=null,this.debugLog("Stopped connect loop"))}debugLog(...e){this.#n&&console.log(`🌴 [tanstack-devtools:${this.#e}-plugin]`,...e)}getGlobalTarget(){if(typeof globalThis<"u"&&globalThis.__TANSTACK_EVENT_TARGET__)return this.debugLog("Using global event target"),globalThis.__TANSTACK_EVENT_TARGET__;if(typeof window<"u"&&typeof window.addEventListener<"u")return this.debugLog("Using window as event target"),window;const e=typeof EventTarget<"u"?new EventTarget:void 0;return typeof e>"u"||typeof e.addEventListener>"u"?(this.debugLog("No event mechanism available, running in non-web environment"),{addEventListener:()=>{},removeEventListener:()=>{},dispatchEvent:()=>!1}):(this.debugLog("Using new EventTarget as fallback"),e)}getPluginId(){return this.#e}dispatchCustomEventShim(e,t){try{const s=new Event(e,{detail:t});this.#t().dispatchEvent(s)}catch{this.debugLog("Failed to dispatch shim event")}}dispatchCustomEvent(e,t){try{this.#t().dispatchEvent(new CustomEvent(e,{detail:t}))}catch{this.dispatchCustomEventShim(e,t)}}emitEventToBus(e){this.debugLog("Emitting event to client bus",e),this.dispatchCustomEvent("tanstack-dispatch-event",e)}emit(e,t){if(!this.#s){this.debugLog("Event bus client is disabled, not emitting event",e,t);return}if(!this.#i){this.debugLog("Bus not available, will be pushed as soon as connected"),this.#r.push({type:`${this.#e}:${e}`,payload:t,pluginId:this.#e}),typeof CustomEvent<"u"&&!this.#o&&(this.#f(),this.startConnectLoop());return}return this.emitEventToBus({type:`${this.#e}:${e}`,payload:t,pluginId:this.#e})}on(e,t){const s=`${this.#e}:${e}`;if(!this.#s)return this.debugLog("Event bus client is disabled, not registering event",s),()=>{};const i=n=>{this.debugLog("Received event from bus",n.detail),t(n.detail)};return this.#t().addEventListener(s,i),this.debugLog("Registered event to bus",s),()=>{this.#t().removeEventListener(s,i)}}onAll(e){if(!this.#s)return this.debugLog("Event bus client is disabled, not registering event"),()=>{};const t=s=>{const i=s.detail;e(i)};return this.#t().addEventListener("tanstack-devtools-global",t),()=>this.#t().removeEventListener("tanstack-devtools-global",t)}onAllPluginEvents(e){if(!this.#s)return this.debugLog("Event bus client is disabled, not registering event"),()=>{};const t=s=>{const i=s.detail;this.#e&&i.pluginId!==this.#e||e(i)};return this.#t().addEventListener("tanstack-devtools-global",t),()=>this.#t().removeEventListener("tanstack-devtools-global",t)}}class hs extends Kt{constructor(e){super({pluginId:"pacer",debug:e?.debug})}}const fs=(r,e)=>{Ht.emit(r,e)},Ht=new hs;function kt(){return{executionCount:0,isPending:!1,lastArgs:void 0,lastExecutionTime:0,nextExecutionTime:0,status:"idle",maybeExecuteCount:0}}const ms={enabled:!0,leading:!0,trailing:!0,wait:0};class ps{constructor(e,t){this.fn=e,this.store=new Ze(kt()),this.setOptions=s=>{this.options={...this.options,...s},this.#t()||this.cancel()},this.#e=s=>{this.store.setState(i=>{const n={...i,...s},{isPending:a}=n;return{...n,status:this.#t()?a?"pending":"idle":"disabled"}}),fs("Throttler",this)},this.#t=()=>!!bt(this.options.enabled,this),this.#n=()=>bt(this.options.wait,this),this.maybeExecute=(...s)=>{this.#e({maybeExecuteCount:this.store.state.maybeExecuteCount+1});const i=Date.now(),n=i-this.store.state.lastExecutionTime,a=this.#n();if(this.options.leading&&n>=a)this.#r(...s);else if(this.#e({lastArgs:s}),!this.#s&&this.options.trailing){const o=this.store.state.lastExecutionTime?i-this.store.state.lastExecutionTime:0,l=a-o;this.#e({isPending:!0}),this.#s=setTimeout(()=>{const{lastArgs:u}=this.store.state;u!==void 0&&this.#r(...u)},l)}},this.#r=(...s)=>{if(!this.#t())return;this.fn(...s);const i=Date.now(),n=i+this.#n();this.#i(),this.#e({executionCount:this.store.state.executionCount+1,lastExecutionTime:i,nextExecutionTime:n,isPending:!1,lastArgs:void 0}),this.options.onExecute?.(s,this),setTimeout(()=>{this.store.state.isPending||this.#e({nextExecutionTime:void 0})},this.#n())},this.flush=()=>{this.store.state.isPending&&this.store.state.lastArgs&&this.#r(...this.store.state.lastArgs)},this.#i=()=>{this.#s&&(clearTimeout(this.#s),this.#s=void 0)},this.cancel=()=>{this.#i(),this.#e({lastArgs:void 0,isPending:!1})},this.reset=()=>{this.#e(kt())},this.key=cs(t.key),this.options={...ms,...t},this.#e(this.options.initialState??{}),Ht.on("d-Throttler",s=>{s.payload.key===this.key&&(this.#e(s.payload.store.state),this.setOptions(s.payload.options))})}#s;#e;#t;#n;#r;#i}function gs(r,e){return new ps(r,e).maybeExecute}function Ae(r,e){return typeof r=="function"?r(e):r}function he(r,e){return Ke(e).reduce((s,i)=>{if(s===null)return null;if(typeof s<"u")return s[i]},r)}function Te(r,e,t){const s=Ke(e);function i(n){if(!s.length)return Ae(t,n);const a=s.shift();if(typeof a=="string"||typeof a=="number"&&!Array.isArray(n))return typeof n=="object"?(n===null&&(n={}),{...n,[a]:i(n[a])}):{[a]:i()};if(Array.isArray(n)&&typeof a=="number"){const o=n.slice(0,a);return[...o.length?o:new Array(a),i(n[a]),...n.slice(a+1)]}return[...new Array(a),i()]}return i(r)}function vs(r,e){const t=Ke(e);function s(i){if(!i)return;if(t.length===1){const a=t[0];if(Array.isArray(i)&&typeof a=="number")return i.filter((u,d)=>d!==a);const{[a]:o,...l}=i;return l}const n=t.shift();if((typeof n=="string"||typeof n=="number"&&!Array.isArray(i))&&typeof i=="object")return{...i,[n]:s(i[n])};if(typeof n=="number"&&Array.isArray(i)){if(n>=i.length)return i;const a=i.slice(0,n);return[...a.length?a:new Array(n),s(i[n]),...i.slice(n+1)]}throw new Error("It seems we have created an infinite loop in deleteBy. ")}return s(r)}const ys=/^(\d+)$/gm,_s=/\.(\d+)(?=\.)/gm,bs=/^(\d+)\./gm,ks=/\.(\d+$)/gm,xs=/\.{2,}/gm,tt="__int__",Oe=`${tt}$1`;function Ke(r){if(Array.isArray(r))return[...r];if(typeof r!="string")throw new Error("Path must be a string.");return r.replace(/(^\[)|]/gm,"").replace(/\[/g,".").replace(ys,Oe).replace(_s,`.${Oe}.`).replace(bs,`${Oe}.`).replace(ks,`.${Oe}`).replace(xs,".").split(".").map(e=>{if(e.startsWith(tt)){const t=e.substring(tt.length),s=parseInt(t,10);return String(s)===t?s:t}return e})}function xt(r,e){return r.length===0?e:e.length===0?r:e.startsWith("[")||e.startsWith(".")?r+e:`${r}.${e}`}function Ss(r){return!(Array.isArray(r)&&r.length===0)}function st(r,e){const t=s=>s.validators.filter(Boolean).map(i=>({cause:i.cause,validate:i.fn}));return e.validationLogic({form:e.form,validators:e.validators,event:{type:r,async:!1},runValidation:t})}function rt(r,e){const{asyncDebounceMs:t}=e,{onBlurAsyncDebounceMs:s,onChangeAsyncDebounceMs:i,onDynamicAsyncDebounceMs:n}=e.validators||{},a=t??0,o=l=>l.validators.filter(Boolean).map(u=>{const d=u?.cause||r;let h=a;switch(d){case"change":h=i??a;break;case"blur":h=s??a;break;case"dynamic":h=n??a;break;case"submit":h=0;break}return r==="submit"&&(h=0),{cause:d,validate:u.fn,debounceMs:h}});return e.validationLogic({form:e.form,validators:e.validators,event:{type:r,async:!0},runValidation:o})}const it=r=>!!r&&typeof r=="object"&&"fields"in r;function te(r,e){if(Object.is(r,e))return!0;if(typeof r!="object"||r===null||typeof e!="object"||e===null)return!1;if(r instanceof Date&&e instanceof Date)return r.getTime()===e.getTime();if(r instanceof Map&&e instanceof Map){if(r.size!==e.size)return!1;for(const[i,n]of r)if(!e.has(i)||!Object.is(n,e.get(i)))return!1;return!0}if(r instanceof Set&&e instanceof Set){if(r.size!==e.size)return!1;for(const i of r)if(!e.has(i))return!1;return!0}const t=Object.keys(r),s=Object.keys(e);if(t.length!==s.length)return!1;for(const i of t)if(!s.includes(i)||!te(r[i],e[i]))return!1;return!0}const St=({newFormValidatorError:r,isPreviousErrorFromFormValidator:e,previousErrorValue:t})=>r?{newErrorValue:r,newSource:"form"}:e?{newErrorValue:void 0,newSource:void 0}:t?{newErrorValue:t,newSource:"field"}:{newErrorValue:void 0,newSource:void 0},Mt=({formLevelError:r,fieldLevelError:e})=>e?{newErrorValue:e,newSource:"field"}:r?{newErrorValue:r,newSource:"form"}:{newErrorValue:void 0,newSource:void 0};function Z(r,e){return r==null?e:{...r,...e}}let oe=256;const De=[];let Ie;for(;oe--;)De[oe]=(oe+256).toString(16).substring(1);function Yt(){let r=0,e,t="";if(!Ie||oe+16>256){for(Ie=new Array(256),r=256;r--;)Ie[r]=256*Math.random()|0;r=0,oe=0}for(;r<16;r++)e=Ie[oe+r],r===6?t+=De[e&15|64]:r===8?t+=De[e&63|128]:t+=De[e],r&1&&r>1&&r<11&&(t+="-");return oe++,t}const fe=r=>{if(!r.validators)return r.runValidation({validators:[],form:r.form});const e=r.event.async,t=e?void 0:{fn:r.validators.onMount,cause:"mount"},s={fn:e?r.validators.onChangeAsync:r.validators.onChange,cause:"change"},i={fn:e?r.validators.onBlurAsync:r.validators.onBlur,cause:"blur"},n={fn:e?r.validators.onSubmitAsync:r.validators.onSubmit,cause:"submit"},a=e?void 0:{fn:()=>{},cause:"server"};switch(r.event.type){case"mount":return r.runValidation({validators:[t],form:r.form});case"submit":return r.runValidation({validators:[s,i,n,a],form:r.form});case"server":return r.runValidation({validators:[],form:r.form});case"blur":return r.runValidation({validators:[i,a],form:r.form});case"change":return r.runValidation({validators:[s,a],form:r.form});default:throw new Error(`Unknown validation event type: ${r.event.type}`)}};function Ms(r,e){const t=new Map;for(const s of r){const i=s.path??[];let n=e,a="";for(let o=0;o<i.length;o++){const l=i[o];if(l===void 0)continue;const u=typeof l=="object"?l.key:l,d=Number(u);Array.isArray(n)&&!Number.isNaN(d)?a+=`[${d}]`:a+=(o>0?".":"")+String(u),typeof n=="object"&&n!==null?n=n[u]:n=void 0}t.set(a,(t.get(a)??[]).concat(s))}return Object.fromEntries(t)}const wt=(r,e)=>{const t=Ms(r,e);return{form:t,fields:t}},pe={validate({value:r,validationSource:e},t){const s=t["~standard"].validate(r);if(s instanceof Promise)throw new Error("async function passed to sync validator");if(s.issues)return e==="field"?s.issues:wt(s.issues,r)},async validateAsync({value:r,validationSource:e},t){const s=await t["~standard"].validate(r);if(s.issues)return e==="field"?s.issues:wt(s.issues,r)}},Jt=r=>!!r&&"~standard"in r,Pe={isValidating:!1,isTouched:!1,isBlurred:!1,isDirty:!1,isPristine:!0,isValid:!0,isDefaultValue:!0,errors:[],errorMap:{},errorSourceMap:{}};function Le(r){function e(d,h,f){const m=a(d,h,"move",f),y=Math.min(h,f),x=Math.max(h,f);for(let _=y;_<=x;_++)m.push(n(d,_));const E=Object.keys(r.fieldInfo).reduce((_,V)=>(V.startsWith(n(d,h))&&_.set(V,r.getFieldMeta(V)),_),new Map);l(m,h<f?"up":"down"),Object.keys(r.fieldInfo).filter(_=>_.startsWith(n(d,f))).forEach(_=>{const V=_.replace(n(d,f),n(d,h)),I=E.get(V);I&&r.setFieldMeta(_,I)})}function t(d,h){const f=a(d,h,"remove");l(f,"up")}function s(d,h,f){a(d,h,"swap",f).forEach(y=>{if(!y.toString().startsWith(n(d,h)))return;const x=y.toString().replace(n(d,h),n(d,f)),[E,_]=[r.getFieldMeta(y),r.getFieldMeta(x)];E&&r.setFieldMeta(x,E),_&&r.setFieldMeta(y,_)})}function i(d,h){const f=a(d,h,"insert");l(f,"down"),f.forEach(m=>{m.toString().startsWith(n(d,h))&&r.setFieldMeta(m,u())})}function n(d,h){return`${d}[${h}]`}function a(d,h,f,m){const y=[n(d,h)];switch(f){case"swap":y.push(n(d,m));break;case"move":{const[x,E]=[Math.min(h,m),Math.max(h,m)];for(let _=x;_<=E;_++)y.push(n(d,_));break}default:{const x=r.getFieldValue(d),E=Array.isArray(x)?x.length:0;for(let _=h+1;_<E;_++)y.push(n(d,_));break}}return Object.keys(r.fieldInfo).filter(x=>y.some(E=>x.startsWith(E)))}function o(d,h){return d.replace(/\[(\d+)\]/,(f,m)=>{const y=parseInt(m,10);return`[${h==="up"?y+1:Math.max(0,y-1)}]`})}function l(d,h){(h==="up"?d:[...d].reverse()).forEach(m=>{const y=o(m.toString(),h),x=r.getFieldMeta(y);x?r.setFieldMeta(m,x):r.setFieldMeta(m,u())})}const u=()=>Pe;return{handleArrayMove:e,handleArrayRemove:t,handleArraySwap:s,handleArrayInsert:i}}class ws extends Kt{constructor(){super({pluginId:"form-devtools",reconnectEveryMs:1e3})}}const z=new ws;function Xe(r){return{values:r.values??{},errorMap:r.errorMap??{},fieldMetaBase:r.fieldMetaBase??{},isSubmitted:r.isSubmitted??!1,isSubmitting:r.isSubmitting??!1,isValidating:r.isValidating??!1,submissionAttempts:r.submissionAttempts??0,isSubmitSuccessful:r.isSubmitSuccessful??!1,validationMetaMap:r.validationMetaMap??{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}}}class Ft{constructor(e){this.options={},this.fieldInfo={},this.prevTransformArray=[],this.mount=()=>{const s=this.fieldMetaDerived.mount(),i=this.store.mount(),n=()=>{s(),i(),z.emit("form-unmounted",{id:this._formId})};this.options.listeners?.onMount?.({formApi:this});const{onMount:a}=this.options.validators||{};return z.emit("form-api",{id:this._formId,state:this.store.state,options:this.options}),a&&this.validateSync("mount"),n},this.update=s=>{if(!s)return;const i=this.options;this.options=s;const n=!!s.transform?.deps?.some((l,u)=>l!==this.prevTransformArray[u]),a=s.defaultValues&&!te(s.defaultValues,i.defaultValues)&&!this.state.isTouched,o=!te(s.defaultState,i.defaultState)&&!this.state.isTouched;!a&&!o&&!n||(W(()=>{this.baseStore.setState(()=>Xe(Object.assign({},this.state,o?s.defaultState:{},a?{values:s.defaultValues}:{},n?{_force_re_eval:!this.state._force_re_eval}:{})))}),z.emit("form-api",{id:this._formId,state:this.store.state,options:this.options}))},this.reset=(s,i)=>{const{fieldMeta:n}=this.state,a=this.resetFieldMeta(n);s&&!i?.keepDefaultValues&&(this.options={...this.options,defaultValues:s}),this.baseStore.setState(()=>Xe({...this.options.defaultState,values:s??this.options.defaultValues??this.options.defaultState?.values,fieldMetaBase:a}))},this.validateAllFields=async s=>{const i=[];return W(()=>{Object.values(this.fieldInfo).forEach(a=>{if(!a.instance)return;const o=a.instance;i.push(Promise.resolve().then(()=>o.validate(s,{skipFormValidation:!0}))),a.instance.state.meta.isTouched||a.instance.setMeta(l=>({...l,isTouched:!0}))})}),(await Promise.all(i)).flat()},this.validateArrayFieldsStartingFrom=async(s,i,n)=>{const a=this.getFieldValue(s),o=Array.isArray(a)?Math.max(a.length-1,0):null,l=[`${s}[${i}]`];for(let f=i+1;f<=(o??0);f++)l.push(`${s}[${f}]`);const u=Object.keys(this.fieldInfo).filter(f=>l.some(m=>f.startsWith(m))),d=[];return W(()=>{u.forEach(f=>{d.push(Promise.resolve().then(()=>this.validateField(f,n)))})}),(await Promise.all(d)).flat()},this.validateField=(s,i)=>{const n=this.fieldInfo[s]?.instance;return n?(n.state.meta.isTouched||n.setMeta(a=>({...a,isTouched:!0})),n.validate(i)):[]},this.validateSync=s=>{const i=st(s,{...this.options,form:this,validationLogic:this.options.validationLogic||fe});let n=!1;const a={};return W(()=>{for(const u of i){if(!u.validate)continue;const d=this.runValidator({validate:u.validate,value:{value:this.state.values,formApi:this,validationSource:"form"},type:"validate"}),{formError:h,fieldErrors:f}=je(d),m=ke(u.cause);for(const y of Object.keys(this.state.fieldMeta)){if(this.baseStore.state.fieldMetaBase[y]===void 0)continue;const x=this.getFieldMeta(y);if(!x)continue;const{errorMap:E,errorSourceMap:_}=x,V=f?.[y],{newErrorValue:I,newSource:j}=St({newFormValidatorError:V,isPreviousErrorFromFormValidator:_?.[m]==="form",previousErrorValue:E?.[m]});j==="form"&&(a[y]={...a[y],[m]:V}),E?.[m]!==I&&this.setFieldMeta(y,L=>({...L,errorMap:{...L.errorMap,[m]:I},errorSourceMap:{...L.errorSourceMap,[m]:j}}))}this.state.errorMap?.[m]!==h&&this.baseStore.setState(y=>({...y,errorMap:{...y.errorMap,[m]:h}})),(h||f)&&(n=!0)}const o=ke("submit");this.state.errorMap?.[o]&&s!=="submit"&&!n&&this.baseStore.setState(u=>({...u,errorMap:{...u.errorMap,[o]:void 0}}));const l=ke("server");this.state.errorMap?.[l]&&s!=="server"&&!n&&this.baseStore.setState(u=>({...u,errorMap:{...u.errorMap,[l]:void 0}}))}),{hasErrored:n,fieldsErrorMap:a}},this.validateAsync=async s=>{const i=rt(s,{...this.options,form:this,validationLogic:this.options.validationLogic||fe});this.state.isFormValidating||this.baseStore.setState(u=>({...u,isFormValidating:!0}));const n=[];let a;for(const u of i){if(!u.validate)continue;const d=ke(u.cause);this.state.validationMetaMap[d]?.lastAbortController.abort();const f=new AbortController;this.state.validationMetaMap[d]={lastAbortController:f},n.push(new Promise(async m=>{let y;try{y=await new Promise((V,I)=>{setTimeout(async()=>{if(f.signal.aborted)return V(void 0);try{V(await this.runValidator({validate:u.validate,value:{value:this.state.values,formApi:this,validationSource:"form",signal:f.signal},type:"validateAsync"}))}catch(j){I(j)}},u.debounceMs)})}catch(V){y=V}const{formError:x,fieldErrors:E}=je(y);E&&(a=a?{...a,...E}:E);const _=ke(u.cause);for(const V of Object.keys(this.state.fieldMeta)){if(this.baseStore.state.fieldMetaBase[V]===void 0)continue;const I=this.getFieldMeta(V);if(!I)continue;const{errorMap:j,errorSourceMap:L}=I,J=a?.[V],{newErrorValue:X,newSource:B}=St({newFormValidatorError:J,isPreviousErrorFromFormValidator:L?.[_]==="form",previousErrorValue:j?.[_]});j?.[_]!==X&&this.setFieldMeta(V,Q=>({...Q,errorMap:{...Q.errorMap,[_]:X},errorSourceMap:{...Q.errorSourceMap,[_]:B}}))}this.baseStore.setState(V=>({...V,errorMap:{...V.errorMap,[_]:x}})),m(a?{fieldErrors:a,errorMapKey:_}:void 0)}))}let o=[];const l={};if(n.length){o=await Promise.all(n);for(const u of o)if(u?.fieldErrors){const{errorMapKey:d}=u;for(const[h,f]of Object.entries(u.fieldErrors)){const y={...l[h]||{},[d]:f};l[h]=y}}}return this.baseStore.setState(u=>({...u,isFormValidating:!1})),l},this.validate=s=>{const{hasErrored:i,fieldsErrorMap:n}=this.validateSync(s);return i&&!this.options.asyncAlways?n:this.validateAsync(s)},this.getFieldValue=s=>he(this.state.values,s),this.getFieldMeta=s=>this.state.fieldMeta[s],this.getFieldInfo=s=>this.fieldInfo[s]||={instance:null,validationMetaMap:{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}},this.setFieldMeta=(s,i)=>{this.baseStore.setState(n=>({...n,fieldMetaBase:{...n.fieldMetaBase,[s]:Ae(i,n.fieldMetaBase[s])}}))},this.resetFieldMeta=s=>Object.keys(s).reduce((i,n)=>{const a=n;return i[a]=Pe,i},{}),this.setFieldValue=(s,i,n)=>{const a=n?.dontUpdateMeta??!1,o=n?.dontRunListeners??!1,l=n?.dontValidate??!1;W(()=>{a||this.setFieldMeta(s,u=>({...u,isTouched:!0,isDirty:!0,errorMap:{...u?.errorMap,onMount:void 0}})),this.baseStore.setState(u=>({...u,values:Te(u.values,s,i)}))}),o||this.getFieldInfo(s).instance?.triggerOnChangeListener(),l||this.validateField(s,"change")},this.deleteField=s=>{const n=[...Object.keys(this.fieldInfo).filter(a=>{const o=s.toString();return a!==o&&a.startsWith(o)}),s];this.baseStore.setState(a=>{const o={...a};return n.forEach(l=>{o.values=vs(o.values,l),delete this.fieldInfo[l],delete o.fieldMetaBase[l]}),o})},this.pushFieldValue=(s,i,n)=>{this.setFieldValue(s,a=>[...Array.isArray(a)?a:[],i],n)},this.insertFieldValue=async(s,i,n,a)=>{this.setFieldValue(s,l=>[...l.slice(0,i),n,...l.slice(i)],Z(a,{dontValidate:!0}));const o=a?.dontValidate??!1;o||await this.validateField(s,"change"),Le(this).handleArrayInsert(s,i),o||await this.validateArrayFieldsStartingFrom(s,i,"change")},this.replaceFieldValue=async(s,i,n,a)=>{this.setFieldValue(s,l=>l.map((u,d)=>d===i?n:u),Z(a,{dontValidate:!0})),(a?.dontValidate??!1)||(await this.validateField(s,"change"),await this.validateArrayFieldsStartingFrom(s,i,"change"))},this.removeFieldValue=async(s,i,n)=>{const a=this.getFieldValue(s),o=Array.isArray(a)?Math.max(a.length-1,0):null;if(this.setFieldValue(s,u=>u.filter((d,h)=>h!==i),Z(n,{dontValidate:!0})),Le(this).handleArrayRemove(s,i),o!==null){const u=`${s}[${o}]`;this.deleteField(u)}(n?.dontValidate??!1)||(await this.validateField(s,"change"),await this.validateArrayFieldsStartingFrom(s,i,"change"))},this.swapFieldValues=(s,i,n,a)=>{this.setFieldValue(s,l=>{const u=l[i],d=l[n];return Te(Te(l,`${i}`,d),`${n}`,u)},Z(a,{dontValidate:!0})),Le(this).handleArraySwap(s,i,n),(a?.dontValidate??!1)||(this.validateField(s,"change"),this.validateField(`${s}[${i}]`,"change"),this.validateField(`${s}[${n}]`,"change"))},this.moveFieldValues=(s,i,n,a)=>{this.setFieldValue(s,l=>{const u=[...l];return u.splice(n,0,u.splice(i,1)[0]),u},Z(a,{dontValidate:!0})),Le(this).handleArrayMove(s,i,n),(a?.dontValidate??!1)||(this.validateField(s,"change"),this.validateField(`${s}[${i}]`,"change"),this.validateField(`${s}[${n}]`,"change"))},this.clearFieldValues=(s,i)=>{const n=this.getFieldValue(s),a=Array.isArray(n)?Math.max(n.length-1,0):null;if(this.setFieldValue(s,[],Z(i,{dontValidate:!0})),a!==null)for(let l=0;l<=a;l++){const u=`${s}[${l}]`;this.deleteField(u)}(i?.dontValidate??!1)||this.validateField(s,"change")},this.resetField=s=>{this.baseStore.setState(i=>({...i,fieldMetaBase:{...i.fieldMetaBase,[s]:Pe},values:this.options.defaultValues?Te(i.values,s,he(this.options.defaultValues,s)):i.values}))},this.getAllErrors=()=>({form:{errors:this.state.errors,errorMap:this.state.errorMap},fields:Object.entries(this.state.fieldMeta).reduce((s,[i,n])=>(Object.keys(n).length&&n.errors.length&&(s[i]={errors:n.errors,errorMap:n.errorMap}),s),{})}),this.parseValuesWithSchema=s=>pe.validate({value:this.state.values,validationSource:"form"},s),this.parseValuesWithSchemaAsync=s=>pe.validateAsync({value:this.state.values,validationSource:"form"},s),this.timeoutIds={validations:{},listeners:{},formListeners:{}},this._formId=e?.formId??Yt(),this._devtoolsSubmissionOverride=!1,this.baseStore=new Ze(Xe({...e?.defaultState,values:e?.defaultValues??e?.defaultState?.values})),this.fieldMetaDerived=new G({deps:[this.baseStore],fn:({prevDepVals:s,currDepVals:i,prevVal:n})=>{const a=n,o=s?.[0],l=i[0];let u=0;const d={};for(const h of Object.keys(l.fieldMetaBase)){const f=l.fieldMetaBase[h],m=o?.fieldMetaBase[h],y=a?.[h],x=he(l.values,h);let E=y?.errors;if(!m||f.errorMap!==m.errorMap){E=Object.values(f.errorMap??{}).filter(L=>L!==void 0);const j=this.getFieldInfo(h)?.instance;j&&!j.options.disableErrorFlat&&(E=E.flat(1))}const _=!Ss(E),V=!f.isDirty,I=te(x,he(this.options.defaultValues,h))||te(x,this.getFieldInfo(h)?.instance?.options.defaultValue);if(y&&y.isPristine===V&&y.isValid===_&&y.isDefaultValue===I&&y.errors===E&&f===m){d[h]=y,u++;continue}d[h]={...f,errors:E??[],isPristine:V,isValid:_,isDefaultValue:I}}return Object.keys(l.fieldMetaBase).length&&a&&u===Object.keys(l.fieldMetaBase).length?a:d}}),this.store=new G({deps:[this.baseStore,this.fieldMetaDerived],fn:({prevDepVals:s,currDepVals:i,prevVal:n})=>{const a=n,o=s?.[0],l=i[0],u=i[1],d=Object.values(u).filter(Boolean),h=d.some(C=>C.isValidating),f=d.every(C=>C.isValid),m=d.some(C=>C.isTouched),y=d.some(C=>C.isBlurred),x=d.every(C=>C.isDefaultValue),E=m&&l.errorMap?.onMount,_=d.some(C=>C.isDirty),V=!_,I=!!(l.errorMap?.onMount||d.some(C=>C?.errorMap?.onMount)),j=!!h;let L=a?.errors??[];(!o||l.errorMap!==o.errorMap)&&(L=Object.values(l.errorMap).reduce((C,ae)=>ae===void 0?C:ae&&it(ae)?(C.push(ae.form),C):(C.push(ae),C),[]));const J=L.length===0,X=f&&J,B=this.options.canSubmitWhenInvalid??!1,Q=l.submissionAttempts===0&&!m&&!I||!j&&!l.isSubmitting&&X||B;let ue=l.errorMap;if(E&&(L=L.filter(C=>C!==l.errorMap.onMount),ue=Object.assign(ue,{onMount:void 0})),a&&o&&a.errorMap===ue&&a.fieldMeta===this.fieldMetaDerived.state&&a.errors===L&&a.isFieldsValidating===h&&a.isFieldsValid===f&&a.isFormValid===J&&a.isValid===X&&a.canSubmit===Q&&a.isTouched===m&&a.isBlurred===y&&a.isPristine===V&&a.isDefaultValue===x&&a.isDirty===_&&te(o,l))return a;let He={...l,errorMap:ue,fieldMeta:this.fieldMetaDerived.state,errors:L,isFieldsValidating:h,isFieldsValid:f,isFormValid:J,isValid:X,canSubmit:Q,isTouched:m,isBlurred:y,isPristine:V,isDefaultValue:x,isDirty:_};const Ye=this.options.transform?.deps??[];if(Ye.length!==this.prevTransformArray.length||Ye.some((C,ae)=>C!==this.prevTransformArray[ae])){const C=Object.assign({},this,{state:He});this.options.transform?.fn(C),He=C.state,this.prevTransformArray=Ye}return He}}),this.handleSubmit=this.handleSubmit.bind(this),this.update(e||{});const t=gs(s=>z.emit("form-state",{id:this._formId,state:s}),{wait:300});this.store.subscribe(()=>{t(this.store.state)}),z.on("request-form-state",s=>{s.payload.id===this._formId&&z.emit("form-api",{id:this._formId,state:this.store.state,options:this.options})}),z.on("request-form-reset",s=>{s.payload.id===this._formId&&this.reset()}),z.on("request-form-force-submit",s=>{s.payload.id===this._formId&&(this._devtoolsSubmissionOverride=!0,this.handleSubmit(),this._devtoolsSubmissionOverride=!1)})}get state(){return this.store.state}get formId(){return this._formId}runValidator(e){return Jt(e.validate)?pe[e.type](e.value,e.validate):e.validate(e.value)}async handleSubmit(e){this.baseStore.setState(i=>({...i,isSubmitted:!1,submissionAttempts:i.submissionAttempts+1,isSubmitSuccessful:!1})),W(()=>{Object.values(this.fieldInfo).forEach(i=>{i.instance&&(i.instance.state.meta.isTouched||i.instance.setMeta(n=>({...n,isTouched:!0})))})});const t=e??this.options.onSubmitMeta;if(!this.state.canSubmit&&!this._devtoolsSubmissionOverride){this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t});return}this.baseStore.setState(i=>({...i,isSubmitting:!0}));const s=()=>{this.baseStore.setState(i=>({...i,isSubmitting:!1}))};if(await this.validateAllFields("submit"),!this.state.isFieldsValid){s(),this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t}),z.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:"validateAllFields",errors:Object.values(this.state.fieldMeta).map(i=>i.errors).flat()});return}if(await this.validate("submit"),!this.state.isValid){s(),this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t}),z.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:"validate",errors:this.state.errors});return}W(()=>{Object.values(this.fieldInfo).forEach(i=>{i.instance?.options.listeners?.onSubmit?.({value:i.instance.state.value,fieldApi:i.instance})})}),this.options.listeners?.onSubmit?.({formApi:this,meta:t});try{await this.options.onSubmit?.({value:this.state.values,formApi:this,meta:t}),W(()=>{this.baseStore.setState(i=>({...i,isSubmitted:!0,isSubmitSuccessful:!0})),z.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!0}),s()})}catch(i){throw this.baseStore.setState(n=>({...n,isSubmitSuccessful:!1})),z.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:"inflight",onError:i}),s(),i}}setErrorMap(e){W(()=>{Object.entries(e).forEach(([t,s])=>{const i=t;if(it(s)){const{formError:n,fieldErrors:a}=je(s);for(const o of Object.keys(this.fieldInfo))this.getFieldMeta(o)&&this.setFieldMeta(o,u=>({...u,errorMap:{...u.errorMap,[i]:a?.[o]},errorSourceMap:{...u.errorSourceMap,[i]:"form"}}));this.baseStore.setState(o=>({...o,errorMap:{...o.errorMap,[i]:n}}))}else this.baseStore.setState(n=>({...n,errorMap:{...n.errorMap,[i]:s}}))})})}}function je(r){if(r){if(it(r)){const e=je(r.form).formError,t=r.fields;return{formError:e,fieldErrors:t}}return{formError:r}}return{formError:void 0}}function ke(r){switch(r){case"submit":return"onSubmit";case"blur":return"onBlur";case"mount":return"onMount";case"server":return"onServer";case"dynamic":return"onDynamic";case"change":default:return"onChange"}}class Vt{constructor(e){this.options={},this.mount=()=>{const t=this.store.mount();this.options.defaultValue!==void 0&&!this.getMeta().isTouched&&this.form.setFieldValue(this.name,this.options.defaultValue,{dontUpdateMeta:!0});const s=this.getInfo();s.instance=this,this.update(this.options);const{onMount:i}=this.options.validators||{};if(i){const n=this.runValidator({validate:i,value:{value:this.state.value,fieldApi:this,validationSource:"field"},type:"validate"});n&&this.setMeta(a=>({...a,errorMap:{...a?.errorMap,onMount:n},errorSourceMap:{...a?.errorSourceMap,onMount:"field"}}))}return this.options.listeners?.onMount?.({value:this.state.value,fieldApi:this}),t},this.update=t=>{if(this.options=t,this.name=t.name,!this.state.meta.isTouched&&this.options.defaultValue!==void 0){const s=this.form.getFieldValue(this.name);te(s,t.defaultValue)||this.form.setFieldValue(this.name,t.defaultValue,{dontUpdateMeta:!0,dontValidate:!0,dontRunListeners:!0})}this.form.getFieldMeta(this.name)||this.form.setFieldMeta(this.name,this.state.meta)},this.getValue=()=>this.form.getFieldValue(this.name),this.setValue=(t,s)=>{this.form.setFieldValue(this.name,t,Z(s,{dontRunListeners:!0,dontValidate:!0})),s?.dontRunListeners||this.triggerOnChangeListener(),s?.dontValidate||this.validate("change")},this.getMeta=()=>this.store.state.meta,this.setMeta=t=>this.form.setFieldMeta(this.name,t),this.getInfo=()=>this.form.getFieldInfo(this.name),this.pushValue=(t,s)=>{this.form.pushFieldValue(this.name,t,Z(s,{dontRunListeners:!0})),s?.dontRunListeners||this.triggerOnChangeListener()},this.insertValue=(t,s,i)=>{this.form.insertFieldValue(this.name,t,s,Z(i,{dontRunListeners:!0})),i?.dontRunListeners||this.triggerOnChangeListener()},this.replaceValue=(t,s,i)=>{this.form.replaceFieldValue(this.name,t,s,Z(i,{dontRunListeners:!0})),i?.dontRunListeners||this.triggerOnChangeListener()},this.removeValue=(t,s)=>{this.form.removeFieldValue(this.name,t,Z(s,{dontRunListeners:!0})),s?.dontRunListeners||this.triggerOnChangeListener()},this.swapValues=(t,s,i)=>{this.form.swapFieldValues(this.name,t,s,Z(i,{dontRunListeners:!0})),i?.dontRunListeners||this.triggerOnChangeListener()},this.moveValue=(t,s,i)=>{this.form.moveFieldValues(this.name,t,s,Z(i,{dontRunListeners:!0})),i?.dontRunListeners||this.triggerOnChangeListener()},this.clearValues=t=>{this.form.clearFieldValues(this.name,Z(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.getLinkedFields=t=>{const s=Object.values(this.form.fieldInfo),i=[];for(const n of s){if(!n.instance)continue;const{onChangeListenTo:a,onBlurListenTo:o}=n.instance.options.validators||{};t==="change"&&a?.includes(this.name)&&i.push(n.instance),t==="blur"&&o?.includes(this.name)&&i.push(n.instance)}return i},this.validateSync=(t,s)=>{const i=st(t,{...this.options,form:this.form,validationLogic:this.form.options.validationLogic||fe}),a=this.getLinkedFields(t).reduce((u,d)=>{const h=st(t,{...d.options,form:d.form,validationLogic:d.form.options.validationLogic||fe});return h.forEach(f=>{f.field=d}),u.concat(h)},[]);let o=!1;W(()=>{const u=(d,h)=>{const f=Re(h.cause),m=h.validate?Et(d.runValidator({validate:h.validate,value:{value:d.store.state.value,validationSource:"field",fieldApi:d},type:"validate"})):void 0,y=s[f],{newErrorValue:x,newSource:E}=Mt({formLevelError:y,fieldLevelError:m});d.state.meta.errorMap?.[f]!==x&&d.setMeta(_=>({..._,errorMap:{..._.errorMap,[f]:x},errorSourceMap:{..._.errorSourceMap,[f]:E}})),x&&(o=!0)};for(const d of i)u(this,d);for(const d of a)d.validate&&u(d.field,d)});const l=Re("submit");return this.state.meta.errorMap?.[l]&&t!=="submit"&&!o&&this.setMeta(u=>({...u,errorMap:{...u.errorMap,[l]:void 0},errorSourceMap:{...u.errorSourceMap,[l]:void 0}})),{hasErrored:o}},this.validateAsync=async(t,s)=>{const i=rt(t,{...this.options,form:this.form,validationLogic:this.form.options.validationLogic||fe}),n=await s,a=this.getLinkedFields(t),o=a.reduce((f,m)=>{const y=rt(t,{...m.options,form:m.form,validationLogic:m.form.options.validationLogic||fe});return y.forEach(x=>{x.field=m}),f.concat(y)},[]);this.state.meta.isValidating||this.setMeta(f=>({...f,isValidating:!0}));for(const f of a)f.setMeta(m=>({...m,isValidating:!0}));const l=[],u=[],d=(f,m,y)=>{const x=Re(m.cause);f.getInfo().validationMetaMap[x]?.lastAbortController.abort();const _=new AbortController;this.getInfo().validationMetaMap[x]={lastAbortController:_},y.push(new Promise(async V=>{let I;try{I=await new Promise((B,Q)=>{this.timeoutIds.validations[m.cause]&&clearTimeout(this.timeoutIds.validations[m.cause]),this.timeoutIds.validations[m.cause]=setTimeout(async()=>{if(_.signal.aborted)return B(void 0);try{B(await this.runValidator({validate:m.validate,value:{value:f.store.state.value,fieldApi:f,signal:_.signal,validationSource:"field"},type:"validateAsync"}))}catch(ue){Q(ue)}},m.debounceMs)})}catch(B){I=B}if(_.signal.aborted)return V(void 0);const j=Et(I),L=n[this.name]?.[x],{newErrorValue:J,newSource:X}=Mt({formLevelError:L,fieldLevelError:j});f.setMeta(B=>({...B,errorMap:{...B?.errorMap,[x]:J},errorSourceMap:{...B.errorSourceMap,[x]:X}})),V(J)}))};for(const f of i)f.validate&&d(this,f,l);for(const f of o)f.validate&&d(f.field,f,u);let h=[];(l.length||u.length)&&(h=await Promise.all(l),await Promise.all(u)),this.setMeta(f=>({...f,isValidating:!1}));for(const f of a)f.setMeta(m=>({...m,isValidating:!1}));return h.filter(Boolean)},this.validate=(t,s)=>{if(!this.state.meta.isTouched)return[];const{fieldsErrorMap:i}=s?.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(t),{hasErrored:n}=this.validateSync(t,i[this.name]??{});if(n&&!this.options.asyncAlways)return this.getInfo().validationMetaMap[Re(t)]?.lastAbortController.abort(),this.state.meta.errors;const a=s?.skipFormValidation?Promise.resolve({}):this.form.validateAsync(t);return this.validateAsync(t,a)},this.handleChange=t=>{this.setValue(t)},this.handleBlur=()=>{this.state.meta.isTouched||this.setMeta(s=>({...s,isTouched:!0})),this.state.meta.isBlurred||this.setMeta(s=>({...s,isBlurred:!0})),this.validate("blur"),this.triggerOnBlurListener()},this.parseValueWithSchema=t=>pe.validate({value:this.state.value,validationSource:"field"},t),this.parseValueWithSchemaAsync=t=>pe.validateAsync({value:this.state.value,validationSource:"field"},t),this.form=e.form,this.name=e.name,this.options=e,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.store=new G({deps:[this.form.store],fn:()=>{const t=this.form.getFieldMeta(this.name)??{...Pe,...e.defaultMeta};let s=this.form.getFieldValue(this.name);return!t.isTouched&&s===void 0&&this.options.defaultValue!==void 0&&!te(s,this.options.defaultValue)&&(s=this.options.defaultValue),{value:s,meta:t}}})}get state(){return this.store.state}runValidator(e){return Jt(e.validate)?pe[e.type](e.value,e.validate):e.validate(e.value)}setErrorMap(e){this.setMeta(t=>({...t,errorMap:{...t.errorMap,...e}}))}triggerOnBlurListener(){const e=this.form.options.listeners?.onBlurDebounceMs;e&&e>0?(this.timeoutIds.formListeners.blur&&clearTimeout(this.timeoutIds.formListeners.blur),this.timeoutIds.formListeners.blur=setTimeout(()=>{this.form.options.listeners?.onBlur?.({formApi:this.form,fieldApi:this})},e)):this.form.options.listeners?.onBlur?.({formApi:this.form,fieldApi:this});const t=this.options.listeners?.onBlurDebounceMs;t&&t>0?(this.timeoutIds.listeners.blur&&clearTimeout(this.timeoutIds.listeners.blur),this.timeoutIds.listeners.blur=setTimeout(()=>{this.options.listeners?.onBlur?.({value:this.state.value,fieldApi:this})},t)):this.options.listeners?.onBlur?.({value:this.state.value,fieldApi:this})}triggerOnChangeListener(){const e=this.form.options.listeners?.onChangeDebounceMs;e&&e>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{this.form.options.listeners?.onChange?.({formApi:this.form,fieldApi:this})},e)):this.form.options.listeners?.onChange?.({formApi:this.form,fieldApi:this});const t=this.options.listeners?.onChangeDebounceMs;t&&t>0?(this.timeoutIds.listeners.change&&clearTimeout(this.timeoutIds.listeners.change),this.timeoutIds.listeners.change=setTimeout(()=>{this.options.listeners?.onChange?.({value:this.state.value,fieldApi:this})},t)):this.options.listeners?.onChange?.({value:this.state.value,fieldApi:this})}}function Et(r){if(r)return r}function Re(r){switch(r){case"submit":return"onSubmit";case"blur":return"onBlur";case"mount":return"onMount";case"server":return"onServer";case"dynamic":return"onDynamic";case"change":default:return"onChange"}}class Be{constructor(e){if(this.getFormFieldName=t=>{if(typeof this.fieldsMap=="string")return xt(this.fieldsMap,t);const s=Ke(t)[0];if(typeof s!="string")return"";const i=t.slice(s.length),n=this.fieldsMap[s];return xt(n,i)},this.getFormFieldOptions=t=>{const s={...t},i=s.validators;if(s.name=this.getFormFieldName(t.name),i&&(i.onChangeListenTo||i.onBlurListenTo)){const n={...i},a=o=>{if(o)return o.map(l=>this.getFormFieldName(l))};n.onChangeListenTo=a(i.onChangeListenTo),n.onBlurListenTo=a(i.onBlurListenTo),s.validators=n}return s},this.mount=()=>this.store.mount(),this.validateArrayFieldsStartingFrom=async(t,s,i)=>this.form.validateArrayFieldsStartingFrom(this.getFormFieldName(t),s,i),this.validateField=(t,s)=>this.form.validateField(this.getFormFieldName(t),s),this.getFieldValue=t=>this.form.getFieldValue(this.getFormFieldName(t)),this.getFieldMeta=t=>this.form.getFieldMeta(this.getFormFieldName(t)),this.setFieldMeta=(t,s)=>this.form.setFieldMeta(this.getFormFieldName(t),s),this.setFieldValue=(t,s,i)=>this.form.setFieldValue(this.getFormFieldName(t),s,i),this.deleteField=t=>this.form.deleteField(this.getFormFieldName(t)),this.pushFieldValue=(t,s,i)=>this.form.pushFieldValue(this.getFormFieldName(t),s,i),this.insertFieldValue=async(t,s,i,n)=>this.form.insertFieldValue(this.getFormFieldName(t),s,i,n),this.replaceFieldValue=async(t,s,i,n)=>this.form.replaceFieldValue(this.getFormFieldName(t),s,i,n),this.removeFieldValue=async(t,s,i)=>this.form.removeFieldValue(this.getFormFieldName(t),s,i),this.swapFieldValues=(t,s,i,n)=>this.form.swapFieldValues(this.getFormFieldName(t),s,i,n),this.moveFieldValues=(t,s,i,n)=>this.form.moveFieldValues(this.getFormFieldName(t),s,i,n),this.clearFieldValues=(t,s)=>this.form.clearFieldValues(this.getFormFieldName(t),s),this.resetField=t=>this.form.resetField(this.getFormFieldName(t)),this.validateAllFields=t=>this.form.validateAllFields(t),e.form instanceof Be){const t=e.form;if(this.form=t.form,typeof e.fields=="string")this.fieldsMap=t.getFormFieldName(e.fields);else{const s={...e.fields};for(const i in s)s[i]=t.getFormFieldName(s[i]);this.fieldsMap=s}}else this.form=e.form,this.fieldsMap=e.fields;this.store=new G({deps:[this.form.store],fn:({currDepVals:t})=>{const s=t[0];let i;if(typeof this.fieldsMap=="string")i=he(s.values,this.fieldsMap);else{i={};const n=this.fieldsMap;for(const a in n)i[a]=he(s.values,n[a])}return{values:i}}})}get state(){return this.store.state}async handleSubmit(e){return this.form.handleSubmit(e)}}const Fe=typeof window<"u"?A.useLayoutEffect:A.useEffect;function Fs(r){const[e,t]=A.useState(()=>({form:r.form,name:r.name})),[s,i]=A.useState(()=>new Vt({...r}));(e.form!==r.form||e.name!==r.name)&&(i(new Vt({...r})),t({form:r.form,name:r.name}));const n=q(s.store,m=>m.value),a=q(s.store,m=>m.meta.isTouched),o=q(s.store,m=>m.meta.isBlurred),l=q(s.store,m=>m.meta.isDirty),u=q(s.store,m=>m.meta.errorMap),d=q(s.store,m=>m.meta.errorSourceMap),h=q(s.store,m=>m.meta.isValidating),f=A.useMemo(()=>{const y={...s,get state(){return{value:n,get meta(){return{...s.state.meta,isTouched:a,isBlurred:o,isDirty:l,errorMap:u,errorSourceMap:d,isValidating:h}}}}};return y.Field=Xt,y},[s,n,a,o,l,u,d,h]);return Fe(s.mount,[s]),Fe(()=>{s.update(r)}),q(s.store,r.mode==="array"?m=>[m.meta,Object.keys(m.value??[]).length]:void 0),f}const Xt=(({children:r,...e})=>{const t=Fs(e),s=A.useMemo(()=>Ae(r,t),[r,t]);return N.jsx(N.Fragment,{children:s})});function Vs({form:r,selector:e,children:t}){const s=q(r.store,e);return N.jsx(N.Fragment,{children:Ae(t,s)})}function Es(r){const e=A.useState(()=>Yt())[0],[t,s]=A.useState(r?.formId),[i,n]=A.useState(()=>new Ft({...r,formId:r?.formId??e}));if(t!==r?.formId){const o=r?.formId??e;n(new Ft({...r,formId:o})),s(o)}const a=A.useMemo(()=>{const o={...i,get formId(){return i._formId},get state(){return i.store.state}};return o.Field=function(u){return N.jsx(Xt,{...u,form:i})},o.Subscribe=function(u){return N.jsx(Vs,{form:i,selector:u.selector,children:u.children})},o},[i]);return Fe(i.mount,[]),Fe(()=>{i.update(r)}),a}function As({lens:r,selector:e,children:t}){const s=q(r.store,e);return N.jsx(N.Fragment,{children:Ae(t,s)})}function Cs(r){const[e]=A.useState(()=>{const t=new Be(r),s=r.form instanceof Be?r.form.form:r.form,i=t;return i.AppForm=function(a){return N.jsx(s.AppForm,{...a})},i.AppField=function(a){return N.jsx(s.AppField,{...e.getFormFieldOptions(a)})},i.Field=function(a){return N.jsx(s.Field,{...e.getFormFieldOptions(a)})},i.Subscribe=function(a){return N.jsx(As,{lens:e,selector:a.selector,children:a.children})},Object.assign(i,{...r.formComponents})});return Fe(e.mount,[e]),e}const At=A.createContext(null),Ct=A.createContext(null);function Ts(){function r(){const t=A.useContext(At);if(!t)throw new Error("`fieldContext` only works when within a `fieldComponent` passed to `createFormHook`");return t}function e(){const t=A.useContext(Ct);if(!t)throw new Error("`formContext` only works when within a `formComponent` passed to `createFormHook`");return t}return{fieldContext:At,useFieldContext:r,useFormContext:e,formContext:Ct}}function Os({fieldComponents:r,fieldContext:e,formContext:t,formComponents:s}){function i(o){const l=Es(o),u=A.useMemo(()=>({children:f})=>N.jsx(t.Provider,{value:l,children:f}),[l]),d=A.useMemo(()=>(({children:m,...y})=>N.jsx(l.Field,{...y,children:x=>N.jsx(e.Provider,{value:x,children:m(Object.assign(x,r))})})),[l]);return A.useMemo(()=>Object.assign(l,{AppField:d,AppForm:u,...s}),[l,d,u])}function n({render:o,props:l}){return u=>o({...l,...u})}function a({render:o,props:l,defaultValues:u}){return function(h){const f=A.useMemo(()=>({form:h.form,fields:h.fields,defaultValues:u,formComponents:s}),[h.form,h.fields]),m=Cs(f);return o({...l,...h,group:m})}}return{useAppForm:i,withForm:n,withFieldGroup:a}}const vr={defaultValues:as},{fieldContext:Is,useFieldContext:yr,formContext:Ls,useFormContext:_r}=Ts(),{useAppForm:br}=Os({fieldContext:Is,formContext:Ls,fieldComponents:{TextField:A.lazy(()=>de(()=>import("./text-field-ZnKHDUks.js"),__vite__mapDeps([0,1,2,3,4]))),SwitchField:A.lazy(()=>de(()=>import("./switch-field-qMXHRKhx.js"),__vite__mapDeps([5,1,2,6,7]))),SelectField:A.lazy(()=>de(()=>import("./select-field-CvT0SYk8.js"),__vite__mapDeps([8,1,2,3,9,10,7,11,12,4]))),ArrayField:A.lazy(()=>de(()=>import("./array-field-BCFMrvoU.js"),__vite__mapDeps([13,1,2]))),DurationField:A.lazy(()=>de(()=>import("./duration-field-DIkKt3iw.js"),__vite__mapDeps([14,1,2,9,10,7,11,12,4,3])))},formComponents:{SubmitButton:A.lazy(()=>de(()=>import("./submit-button-D7DKHqAq.js"),__vite__mapDeps([15,1,2,16])))}});function kr(r){return r}var w;(function(r){r.assertEqual=i=>{};function e(i){}r.assertIs=e;function t(i){throw new Error}r.assertNever=t,r.arrayToEnum=i=>{const n={};for(const a of i)n[a]=a;return n},r.getValidEnumValues=i=>{const n=r.objectKeys(i).filter(o=>typeof i[i[o]]!="number"),a={};for(const o of n)a[o]=i[o];return r.objectValues(a)},r.objectValues=i=>r.objectKeys(i).map(function(n){return i[n]}),r.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const n=[];for(const a in i)Object.prototype.hasOwnProperty.call(i,a)&&n.push(a);return n},r.find=(i,n)=>{for(const a of i)if(n(a))return a},r.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function s(i,n=" | "){return i.map(a=>typeof a=="string"?`'${a}'`:a).join(n)}r.joinValues=s,r.jsonStringifyReplacer=(i,n)=>typeof n=="bigint"?n.toString():n})(w||(w={}));var Tt;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Tt||(Tt={}));const g=w.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ee=r=>{switch(typeof r){case"undefined":return g.undefined;case"string":return g.string;case"number":return Number.isNaN(r)?g.nan:g.number;case"boolean":return g.boolean;case"function":return g.function;case"bigint":return g.bigint;case"symbol":return g.symbol;case"object":return Array.isArray(r)?g.array:r===null?g.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?g.promise:typeof Map<"u"&&r instanceof Map?g.map:typeof Set<"u"&&r instanceof Set?g.set:typeof Date<"u"&&r instanceof Date?g.date:g.object;default:return g.unknown}},c=w.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class H extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(n){return n.message},s={_errors:[]},i=n=>{for(const a of n.issues)if(a.code==="invalid_union")a.unionErrors.map(i);else if(a.code==="invalid_return_type")i(a.returnTypeError);else if(a.code==="invalid_arguments")i(a.argumentsError);else if(a.path.length===0)s._errors.push(t(a));else{let o=s,l=0;for(;l<a.path.length;){const u=a.path[l];l===a.path.length-1?(o[u]=o[u]||{_errors:[]},o[u]._errors.push(t(a))):o[u]=o[u]||{_errors:[]},o=o[u],l++}}};return i(this),s}static assert(e){if(!(e instanceof H))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,w.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},s=[];for(const i of this.issues)if(i.path.length>0){const n=i.path[0];t[n]=t[n]||[],t[n].push(e(i))}else s.push(e(i));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}}H.create=r=>new H(r);const nt=(r,e)=>{let t;switch(r.code){case c.invalid_type:r.received===g.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case c.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,w.jsonStringifyReplacer)}`;break;case c.unrecognized_keys:t=`Unrecognized key(s) in object: ${w.joinValues(r.keys,", ")}`;break;case c.invalid_union:t="Invalid input";break;case c.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${w.joinValues(r.options)}`;break;case c.invalid_enum_value:t=`Invalid enum value. Expected ${w.joinValues(r.options)}, received '${r.received}'`;break;case c.invalid_arguments:t="Invalid function arguments";break;case c.invalid_return_type:t="Invalid function return type";break;case c.invalid_date:t="Invalid date";break;case c.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:w.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case c.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="bigint"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case c.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case c.custom:t="Invalid input";break;case c.invalid_intersection_types:t="Intersection results could not be merged";break;case c.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case c.not_finite:t="Number must be finite";break;default:t=e.defaultError,w.assertNever(r)}return{message:t}};let Rs=nt;function Ns(){return Rs}const Ds=r=>{const{data:e,path:t,errorMaps:s,issueData:i}=r,n=[...t,...i.path||[]],a={...i,path:n};if(i.message!==void 0)return{...i,path:n,message:i.message};let o="";const l=s.filter(u=>!!u).slice().reverse();for(const u of l)o=u(a,{data:e,defaultError:o}).message;return{...i,path:n,message:o}};function p(r,e){const t=Ns(),s=Ds({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===nt?void 0:nt].filter(i=>!!i)});r.common.issues.push(s)}class P{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const s=[];for(const i of t){if(i.status==="aborted")return b;i.status==="dirty"&&e.dirty(),s.push(i.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){const s=[];for(const i of t){const n=await i.key,a=await i.value;s.push({key:n,value:a})}return P.mergeObjectSync(e,s)}static mergeObjectSync(e,t){const s={};for(const i of t){const{key:n,value:a}=i;if(n.status==="aborted"||a.status==="aborted")return b;n.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),n.value!=="__proto__"&&(typeof a.value<"u"||i.alwaysSet)&&(s[n.value]=a.value)}return{status:e.value,value:s}}}const b=Object.freeze({status:"aborted"}),Se=r=>({status:"dirty",value:r}),U=r=>({status:"valid",value:r}),Ot=r=>r.status==="aborted",It=r=>r.status==="dirty",ge=r=>r.status==="valid",ze=r=>typeof Promise<"u"&&r instanceof Promise;var v;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(v||(v={}));class ie{constructor(e,t,s,i){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Lt=(r,e)=>{if(ge(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new H(r.common.issues);return this._error=t,this._error}}};function S(r){if(!r)return{};const{errorMap:e,invalid_type_error:t,required_error:s,description:i}=r;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(a,o)=>{const{message:l}=r;return a.code==="invalid_enum_value"?{message:l??o.defaultError}:typeof o.data>"u"?{message:l??s??o.defaultError}:a.code!=="invalid_type"?{message:o.defaultError}:{message:l??t??o.defaultError}},description:i}}class M{get description(){return this._def.description}_getType(e){return ee(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ee(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new P,ctx:{common:e.parent.common,data:e.data,parsedType:ee(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(ze(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){const s={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ee(e)},i=this._parseSync({data:e,path:s.path,parent:s});return Lt(s,i)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ee(e)};if(!this["~standard"].async)try{const s=this._parseSync({data:e,path:[],parent:t});return ge(s)?{value:s.value}:{issues:t.common.issues}}catch(s){s?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(s=>ge(s)?{value:s.value}:{issues:t.common.issues})}async parseAsync(e,t){const s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){const s={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ee(e)},i=this._parse({data:e,path:s.path,parent:s}),n=await(ze(i)?i:Promise.resolve(i));return Lt(s,n)}refine(e,t){const s=i=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(i):t;return this._refinement((i,n)=>{const a=e(i),o=()=>n.addIssue({code:c.custom,...s(i)});return typeof Promise<"u"&&a instanceof Promise?a.then(l=>l?!0:(o(),!1)):a?!0:(o(),!1)})}refinement(e,t){return this._refinement((s,i)=>e(s)?!0:(i.addIssue(typeof t=="function"?t(s,i):t),!1))}_refinement(e){return new _e({schema:this,typeName:k.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return re.create(this,this._def)}nullable(){return be.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return K.create(this)}promise(){return Ge.create(this,this._def)}or(e){return We.create([this,e],this._def)}and(e){return qe.create(this,e,this._def)}transform(e){return new _e({...S(this._def),schema:this,typeName:k.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new ct({...S(this._def),innerType:this,defaultValue:t,typeName:k.ZodDefault})}brand(){return new ar({typeName:k.ZodBranded,type:this,...S(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new ht({...S(this._def),innerType:this,catchValue:t,typeName:k.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return vt.create(this,e)}readonly(){return ft.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const js=/^c[^\s-]{8,}$/i,$s=/^[0-9a-z]+$/,Zs=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ps=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Bs=/^[a-z0-9_-]{21}$/i,zs=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Us=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Ws=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,qs="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Qe;const Gs=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ks=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Hs=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Ys=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Js=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Xs=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Qt="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Qs=new RegExp(`^${Qt}$`);function es(r){let e="[0-5]\\d";r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`);const t=r.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function er(r){return new RegExp(`^${es(r)}$`)}function tr(r){let e=`${Qt}T${es(r)}`;const t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function sr(r,e){return!!((e==="v4"||!e)&&Gs.test(r)||(e==="v6"||!e)&&Hs.test(r))}function rr(r,e){if(!zs.test(r))return!1;try{const[t]=r.split(".");if(!t)return!1;const s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),i=JSON.parse(atob(s));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function ir(r,e){return!!((e==="v4"||!e)&&Ks.test(r)||(e==="v6"||!e)&&Ys.test(r))}class se extends M{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==g.string){const n=this._getOrReturnCtx(e);return p(n,{code:c.invalid_type,expected:g.string,received:n.parsedType}),b}const s=new P;let i;for(const n of this._def.checks)if(n.kind==="min")e.data.length<n.value&&(i=this._getOrReturnCtx(e,i),p(i,{code:c.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),s.dirty());else if(n.kind==="max")e.data.length>n.value&&(i=this._getOrReturnCtx(e,i),p(i,{code:c.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),s.dirty());else if(n.kind==="length"){const a=e.data.length>n.value,o=e.data.length<n.value;(a||o)&&(i=this._getOrReturnCtx(e,i),a?p(i,{code:c.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):o&&p(i,{code:c.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),s.dirty())}else if(n.kind==="email")Ws.test(e.data)||(i=this._getOrReturnCtx(e,i),p(i,{validation:"email",code:c.invalid_string,message:n.message}),s.dirty());else if(n.kind==="emoji")Qe||(Qe=new RegExp(qs,"u")),Qe.test(e.data)||(i=this._getOrReturnCtx(e,i),p(i,{validation:"emoji",code:c.invalid_string,message:n.message}),s.dirty());else if(n.kind==="uuid")Ps.test(e.data)||(i=this._getOrReturnCtx(e,i),p(i,{validation:"uuid",code:c.invalid_string,message:n.message}),s.dirty());else if(n.kind==="nanoid")Bs.test(e.data)||(i=this._getOrReturnCtx(e,i),p(i,{validation:"nanoid",code:c.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid")js.test(e.data)||(i=this._getOrReturnCtx(e,i),p(i,{validation:"cuid",code:c.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid2")$s.test(e.data)||(i=this._getOrReturnCtx(e,i),p(i,{validation:"cuid2",code:c.invalid_string,message:n.message}),s.dirty());else if(n.kind==="ulid")Zs.test(e.data)||(i=this._getOrReturnCtx(e,i),p(i,{validation:"ulid",code:c.invalid_string,message:n.message}),s.dirty());else if(n.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),p(i,{validation:"url",code:c.invalid_string,message:n.message}),s.dirty()}else n.kind==="regex"?(n.regex.lastIndex=0,n.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),p(i,{validation:"regex",code:c.invalid_string,message:n.message}),s.dirty())):n.kind==="trim"?e.data=e.data.trim():n.kind==="includes"?e.data.includes(n.value,n.position)||(i=this._getOrReturnCtx(e,i),p(i,{code:c.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),s.dirty()):n.kind==="toLowerCase"?e.data=e.data.toLowerCase():n.kind==="toUpperCase"?e.data=e.data.toUpperCase():n.kind==="startsWith"?e.data.startsWith(n.value)||(i=this._getOrReturnCtx(e,i),p(i,{code:c.invalid_string,validation:{startsWith:n.value},message:n.message}),s.dirty()):n.kind==="endsWith"?e.data.endsWith(n.value)||(i=this._getOrReturnCtx(e,i),p(i,{code:c.invalid_string,validation:{endsWith:n.value},message:n.message}),s.dirty()):n.kind==="datetime"?tr(n).test(e.data)||(i=this._getOrReturnCtx(e,i),p(i,{code:c.invalid_string,validation:"datetime",message:n.message}),s.dirty()):n.kind==="date"?Qs.test(e.data)||(i=this._getOrReturnCtx(e,i),p(i,{code:c.invalid_string,validation:"date",message:n.message}),s.dirty()):n.kind==="time"?er(n).test(e.data)||(i=this._getOrReturnCtx(e,i),p(i,{code:c.invalid_string,validation:"time",message:n.message}),s.dirty()):n.kind==="duration"?Us.test(e.data)||(i=this._getOrReturnCtx(e,i),p(i,{validation:"duration",code:c.invalid_string,message:n.message}),s.dirty()):n.kind==="ip"?sr(e.data,n.version)||(i=this._getOrReturnCtx(e,i),p(i,{validation:"ip",code:c.invalid_string,message:n.message}),s.dirty()):n.kind==="jwt"?rr(e.data,n.alg)||(i=this._getOrReturnCtx(e,i),p(i,{validation:"jwt",code:c.invalid_string,message:n.message}),s.dirty()):n.kind==="cidr"?ir(e.data,n.version)||(i=this._getOrReturnCtx(e,i),p(i,{validation:"cidr",code:c.invalid_string,message:n.message}),s.dirty()):n.kind==="base64"?Js.test(e.data)||(i=this._getOrReturnCtx(e,i),p(i,{validation:"base64",code:c.invalid_string,message:n.message}),s.dirty()):n.kind==="base64url"?Xs.test(e.data)||(i=this._getOrReturnCtx(e,i),p(i,{validation:"base64url",code:c.invalid_string,message:n.message}),s.dirty()):w.assertNever(n);return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(i=>e.test(i),{validation:t,code:c.invalid_string,...v.errToObj(s)})}_addCheck(e){return new se({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...v.errToObj(e)})}url(e){return this._addCheck({kind:"url",...v.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...v.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...v.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...v.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...v.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...v.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...v.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...v.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...v.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...v.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...v.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...v.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...v.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...v.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...v.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...v.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...v.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...v.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...v.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...v.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...v.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...v.errToObj(t)})}nonempty(e){return this.min(1,v.errToObj(e))}trim(){return new se({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new se({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new se({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}se.create=r=>new se({checks:[],typeName:k.ZodString,coerce:r?.coerce??!1,...S(r)});function nr(r,e){const t=(r.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,i=t>s?t:s,n=Number.parseInt(r.toFixed(i).replace(".","")),a=Number.parseInt(e.toFixed(i).replace(".",""));return n%a/10**i}class ve extends M{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==g.number){const n=this._getOrReturnCtx(e);return p(n,{code:c.invalid_type,expected:g.number,received:n.parsedType}),b}let s;const i=new P;for(const n of this._def.checks)n.kind==="int"?w.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),p(s,{code:c.invalid_type,expected:"integer",received:"float",message:n.message}),i.dirty()):n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(s=this._getOrReturnCtx(e,s),p(s,{code:c.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),i.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(s=this._getOrReturnCtx(e,s),p(s,{code:c.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),i.dirty()):n.kind==="multipleOf"?nr(e.data,n.value)!==0&&(s=this._getOrReturnCtx(e,s),p(s,{code:c.not_multiple_of,multipleOf:n.value,message:n.message}),i.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),p(s,{code:c.not_finite,message:n.message}),i.dirty()):w.assertNever(n);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,v.toString(t))}gt(e,t){return this.setLimit("min",e,!1,v.toString(t))}lte(e,t){return this.setLimit("max",e,!0,v.toString(t))}lt(e,t){return this.setLimit("max",e,!1,v.toString(t))}setLimit(e,t,s,i){return new ve({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:v.toString(i)}]})}_addCheck(e){return new ve({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:v.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:v.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:v.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:v.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:v.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:v.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:v.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:v.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:v.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&w.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}}ve.create=r=>new ve({checks:[],typeName:k.ZodNumber,coerce:r?.coerce||!1,...S(r)});class Ve extends M{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==g.bigint)return this._getInvalidInput(e);let s;const i=new P;for(const n of this._def.checks)n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(s=this._getOrReturnCtx(e,s),p(s,{code:c.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),i.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(s=this._getOrReturnCtx(e,s),p(s,{code:c.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),i.dirty()):n.kind==="multipleOf"?e.data%n.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),p(s,{code:c.not_multiple_of,multipleOf:n.value,message:n.message}),i.dirty()):w.assertNever(n);return{status:i.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return p(t,{code:c.invalid_type,expected:g.bigint,received:t.parsedType}),b}gte(e,t){return this.setLimit("min",e,!0,v.toString(t))}gt(e,t){return this.setLimit("min",e,!1,v.toString(t))}lte(e,t){return this.setLimit("max",e,!0,v.toString(t))}lt(e,t){return this.setLimit("max",e,!1,v.toString(t))}setLimit(e,t,s,i){return new Ve({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:v.toString(i)}]})}_addCheck(e){return new Ve({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:v.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:v.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:v.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:v.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:v.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}Ve.create=r=>new Ve({checks:[],typeName:k.ZodBigInt,coerce:r?.coerce??!1,...S(r)});class at extends M{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==g.boolean){const s=this._getOrReturnCtx(e);return p(s,{code:c.invalid_type,expected:g.boolean,received:s.parsedType}),b}return U(e.data)}}at.create=r=>new at({typeName:k.ZodBoolean,coerce:r?.coerce||!1,...S(r)});class Ue extends M{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==g.date){const n=this._getOrReturnCtx(e);return p(n,{code:c.invalid_type,expected:g.date,received:n.parsedType}),b}if(Number.isNaN(e.data.getTime())){const n=this._getOrReturnCtx(e);return p(n,{code:c.invalid_date}),b}const s=new P;let i;for(const n of this._def.checks)n.kind==="min"?e.data.getTime()<n.value&&(i=this._getOrReturnCtx(e,i),p(i,{code:c.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),s.dirty()):n.kind==="max"?e.data.getTime()>n.value&&(i=this._getOrReturnCtx(e,i),p(i,{code:c.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),s.dirty()):w.assertNever(n);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Ue({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:v.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:v.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}Ue.create=r=>new Ue({checks:[],coerce:r?.coerce||!1,typeName:k.ZodDate,...S(r)});class Rt extends M{_parse(e){if(this._getType(e)!==g.symbol){const s=this._getOrReturnCtx(e);return p(s,{code:c.invalid_type,expected:g.symbol,received:s.parsedType}),b}return U(e.data)}}Rt.create=r=>new Rt({typeName:k.ZodSymbol,...S(r)});class Nt extends M{_parse(e){if(this._getType(e)!==g.undefined){const s=this._getOrReturnCtx(e);return p(s,{code:c.invalid_type,expected:g.undefined,received:s.parsedType}),b}return U(e.data)}}Nt.create=r=>new Nt({typeName:k.ZodUndefined,...S(r)});class ot extends M{_parse(e){if(this._getType(e)!==g.null){const s=this._getOrReturnCtx(e);return p(s,{code:c.invalid_type,expected:g.null,received:s.parsedType}),b}return U(e.data)}}ot.create=r=>new ot({typeName:k.ZodNull,...S(r)});class Dt extends M{constructor(){super(...arguments),this._any=!0}_parse(e){return U(e.data)}}Dt.create=r=>new Dt({typeName:k.ZodAny,...S(r)});class jt extends M{constructor(){super(...arguments),this._unknown=!0}_parse(e){return U(e.data)}}jt.create=r=>new jt({typeName:k.ZodUnknown,...S(r)});class ne extends M{_parse(e){const t=this._getOrReturnCtx(e);return p(t,{code:c.invalid_type,expected:g.never,received:t.parsedType}),b}}ne.create=r=>new ne({typeName:k.ZodNever,...S(r)});class $t extends M{_parse(e){if(this._getType(e)!==g.undefined){const s=this._getOrReturnCtx(e);return p(s,{code:c.invalid_type,expected:g.void,received:s.parsedType}),b}return U(e.data)}}$t.create=r=>new $t({typeName:k.ZodVoid,...S(r)});class K extends M{_parse(e){const{ctx:t,status:s}=this._processInputParams(e),i=this._def;if(t.parsedType!==g.array)return p(t,{code:c.invalid_type,expected:g.array,received:t.parsedType}),b;if(i.exactLength!==null){const a=t.data.length>i.exactLength.value,o=t.data.length<i.exactLength.value;(a||o)&&(p(t,{code:a?c.too_big:c.too_small,minimum:o?i.exactLength.value:void 0,maximum:a?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),s.dirty())}if(i.minLength!==null&&t.data.length<i.minLength.value&&(p(t,{code:c.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),s.dirty()),i.maxLength!==null&&t.data.length>i.maxLength.value&&(p(t,{code:c.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((a,o)=>i.type._parseAsync(new ie(t,a,t.path,o)))).then(a=>P.mergeArray(s,a));const n=[...t.data].map((a,o)=>i.type._parseSync(new ie(t,a,t.path,o)));return P.mergeArray(s,n)}get element(){return this._def.type}min(e,t){return new K({...this._def,minLength:{value:e,message:v.toString(t)}})}max(e,t){return new K({...this._def,maxLength:{value:e,message:v.toString(t)}})}length(e,t){return new K({...this._def,exactLength:{value:e,message:v.toString(t)}})}nonempty(e){return this.min(1,e)}}K.create=(r,e)=>new K({type:r,minLength:null,maxLength:null,exactLength:null,typeName:k.ZodArray,...S(e)});function ce(r){if(r instanceof T){const e={};for(const t in r.shape){const s=r.shape[t];e[t]=re.create(ce(s))}return new T({...r._def,shape:()=>e})}else return r instanceof K?new K({...r._def,type:ce(r.element)}):r instanceof re?re.create(ce(r.unwrap())):r instanceof be?be.create(ce(r.unwrap())):r instanceof le?le.create(r.items.map(e=>ce(e))):r}class T extends M{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=w.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==g.object){const u=this._getOrReturnCtx(e);return p(u,{code:c.invalid_type,expected:g.object,received:u.parsedType}),b}const{status:s,ctx:i}=this._processInputParams(e),{shape:n,keys:a}=this._getCached(),o=[];if(!(this._def.catchall instanceof ne&&this._def.unknownKeys==="strip"))for(const u in i.data)a.includes(u)||o.push(u);const l=[];for(const u of a){const d=n[u],h=i.data[u];l.push({key:{status:"valid",value:u},value:d._parse(new ie(i,h,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof ne){const u=this._def.unknownKeys;if(u==="passthrough")for(const d of o)l.push({key:{status:"valid",value:d},value:{status:"valid",value:i.data[d]}});else if(u==="strict")o.length>0&&(p(i,{code:c.unrecognized_keys,keys:o}),s.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const d of o){const h=i.data[d];l.push({key:{status:"valid",value:d},value:u._parse(new ie(i,h,i.path,d)),alwaysSet:d in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const u=[];for(const d of l){const h=await d.key,f=await d.value;u.push({key:h,value:f,alwaysSet:d.alwaysSet})}return u}).then(u=>P.mergeObjectSync(s,u)):P.mergeObjectSync(s,l)}get shape(){return this._def.shape()}strict(e){return v.errToObj,new T({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{const i=this._def.errorMap?.(t,s).message??s.defaultError;return t.code==="unrecognized_keys"?{message:v.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new T({...this._def,unknownKeys:"strip"})}passthrough(){return new T({...this._def,unknownKeys:"passthrough"})}extend(e){return new T({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new T({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:k.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new T({...this._def,catchall:e})}pick(e){const t={};for(const s of w.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new T({...this._def,shape:()=>t})}omit(e){const t={};for(const s of w.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new T({...this._def,shape:()=>t})}deepPartial(){return ce(this)}partial(e){const t={};for(const s of w.objectKeys(this.shape)){const i=this.shape[s];e&&!e[s]?t[s]=i:t[s]=i.optional()}return new T({...this._def,shape:()=>t})}required(e){const t={};for(const s of w.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let n=this.shape[s];for(;n instanceof re;)n=n._def.innerType;t[s]=n}return new T({...this._def,shape:()=>t})}keyof(){return ts(w.objectKeys(this.shape))}}T.create=(r,e)=>new T({shape:()=>r,unknownKeys:"strip",catchall:ne.create(),typeName:k.ZodObject,...S(e)});T.strictCreate=(r,e)=>new T({shape:()=>r,unknownKeys:"strict",catchall:ne.create(),typeName:k.ZodObject,...S(e)});T.lazycreate=(r,e)=>new T({shape:r,unknownKeys:"strip",catchall:ne.create(),typeName:k.ZodObject,...S(e)});class We extends M{_parse(e){const{ctx:t}=this._processInputParams(e),s=this._def.options;function i(n){for(const o of n)if(o.result.status==="valid")return o.result;for(const o of n)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const a=n.map(o=>new H(o.ctx.common.issues));return p(t,{code:c.invalid_union,unionErrors:a}),b}if(t.common.async)return Promise.all(s.map(async n=>{const a={...t,common:{...t.common,issues:[]},parent:null};return{result:await n._parseAsync({data:t.data,path:t.path,parent:a}),ctx:a}})).then(i);{let n;const a=[];for(const l of s){const u={...t,common:{...t.common,issues:[]},parent:null},d=l._parseSync({data:t.data,path:t.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!n&&(n={result:d,ctx:u}),u.common.issues.length&&a.push(u.common.issues)}if(n)return t.common.issues.push(...n.ctx.common.issues),n.result;const o=a.map(l=>new H(l));return p(t,{code:c.invalid_union,unionErrors:o}),b}}get options(){return this._def.options}}We.create=(r,e)=>new We({options:r,typeName:k.ZodUnion,...S(e)});function lt(r,e){const t=ee(r),s=ee(e);if(r===e)return{valid:!0,data:r};if(t===g.object&&s===g.object){const i=w.objectKeys(e),n=w.objectKeys(r).filter(o=>i.indexOf(o)!==-1),a={...r,...e};for(const o of n){const l=lt(r[o],e[o]);if(!l.valid)return{valid:!1};a[o]=l.data}return{valid:!0,data:a}}else if(t===g.array&&s===g.array){if(r.length!==e.length)return{valid:!1};const i=[];for(let n=0;n<r.length;n++){const a=r[n],o=e[n],l=lt(a,o);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return t===g.date&&s===g.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class qe extends M{_parse(e){const{status:t,ctx:s}=this._processInputParams(e),i=(n,a)=>{if(Ot(n)||Ot(a))return b;const o=lt(n.value,a.value);return o.valid?((It(n)||It(a))&&t.dirty(),{status:t.value,value:o.data}):(p(s,{code:c.invalid_intersection_types}),b)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([n,a])=>i(n,a)):i(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}qe.create=(r,e,t)=>new qe({left:r,right:e,typeName:k.ZodIntersection,...S(t)});class le extends M{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==g.array)return p(s,{code:c.invalid_type,expected:g.array,received:s.parsedType}),b;if(s.data.length<this._def.items.length)return p(s,{code:c.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),b;!this._def.rest&&s.data.length>this._def.items.length&&(p(s,{code:c.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...s.data].map((a,o)=>{const l=this._def.items[o]||this._def.rest;return l?l._parse(new ie(s,a,s.path,o)):null}).filter(a=>!!a);return s.common.async?Promise.all(n).then(a=>P.mergeArray(t,a)):P.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new le({...this._def,rest:e})}}le.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new le({items:r,typeName:k.ZodTuple,rest:null,...S(e)})};class Zt extends M{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==g.map)return p(s,{code:c.invalid_type,expected:g.map,received:s.parsedType}),b;const i=this._def.keyType,n=this._def.valueType,a=[...s.data.entries()].map(([o,l],u)=>({key:i._parse(new ie(s,o,s.path,[u,"key"])),value:n._parse(new ie(s,l,s.path,[u,"value"]))}));if(s.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const l of a){const u=await l.key,d=await l.value;if(u.status==="aborted"||d.status==="aborted")return b;(u.status==="dirty"||d.status==="dirty")&&t.dirty(),o.set(u.value,d.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const l of a){const u=l.key,d=l.value;if(u.status==="aborted"||d.status==="aborted")return b;(u.status==="dirty"||d.status==="dirty")&&t.dirty(),o.set(u.value,d.value)}return{status:t.value,value:o}}}}Zt.create=(r,e,t)=>new Zt({valueType:e,keyType:r,typeName:k.ZodMap,...S(t)});class Ee extends M{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==g.set)return p(s,{code:c.invalid_type,expected:g.set,received:s.parsedType}),b;const i=this._def;i.minSize!==null&&s.data.size<i.minSize.value&&(p(s,{code:c.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),t.dirty()),i.maxSize!==null&&s.data.size>i.maxSize.value&&(p(s,{code:c.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),t.dirty());const n=this._def.valueType;function a(l){const u=new Set;for(const d of l){if(d.status==="aborted")return b;d.status==="dirty"&&t.dirty(),u.add(d.value)}return{status:t.value,value:u}}const o=[...s.data.values()].map((l,u)=>n._parse(new ie(s,l,s.path,u)));return s.common.async?Promise.all(o).then(l=>a(l)):a(o)}min(e,t){return new Ee({...this._def,minSize:{value:e,message:v.toString(t)}})}max(e,t){return new Ee({...this._def,maxSize:{value:e,message:v.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Ee.create=(r,e)=>new Ee({valueType:r,minSize:null,maxSize:null,typeName:k.ZodSet,...S(e)});class Pt extends M{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Pt.create=(r,e)=>new Pt({getter:r,typeName:k.ZodLazy,...S(e)});class ut extends M{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return p(t,{received:t.data,code:c.invalid_literal,expected:this._def.value}),b}return{status:"valid",value:e.data}}get value(){return this._def.value}}ut.create=(r,e)=>new ut({value:r,typeName:k.ZodLiteral,...S(e)});function ts(r,e){return new ye({values:r,typeName:k.ZodEnum,...S(e)})}class ye extends M{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),s=this._def.values;return p(t,{expected:w.joinValues(s),received:t.parsedType,code:c.invalid_type}),b}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),s=this._def.values;return p(t,{received:t.data,code:c.invalid_enum_value,options:s}),b}return U(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return ye.create(e,{...this._def,...t})}exclude(e,t=this._def){return ye.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}}ye.create=ts;class dt extends M{_parse(e){const t=w.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==g.string&&s.parsedType!==g.number){const i=w.objectValues(t);return p(s,{expected:w.joinValues(i),received:s.parsedType,code:c.invalid_type}),b}if(this._cache||(this._cache=new Set(w.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const i=w.objectValues(t);return p(s,{received:s.data,code:c.invalid_enum_value,options:i}),b}return U(e.data)}get enum(){return this._def.values}}dt.create=(r,e)=>new dt({values:r,typeName:k.ZodNativeEnum,...S(e)});class Ge extends M{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==g.promise&&t.common.async===!1)return p(t,{code:c.invalid_type,expected:g.promise,received:t.parsedType}),b;const s=t.parsedType===g.promise?t.data:Promise.resolve(t.data);return U(s.then(i=>this._def.type.parseAsync(i,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Ge.create=(r,e)=>new Ge({type:r,typeName:k.ZodPromise,...S(e)});class _e extends M{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===k.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:s}=this._processInputParams(e),i=this._def.effect||null,n={addIssue:a=>{p(s,a),a.fatal?t.abort():t.dirty()},get path(){return s.path}};if(n.addIssue=n.addIssue.bind(n),i.type==="preprocess"){const a=i.transform(s.data,n);if(s.common.async)return Promise.resolve(a).then(async o=>{if(t.value==="aborted")return b;const l=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return l.status==="aborted"?b:l.status==="dirty"||t.value==="dirty"?Se(l.value):l});{if(t.value==="aborted")return b;const o=this._def.schema._parseSync({data:a,path:s.path,parent:s});return o.status==="aborted"?b:o.status==="dirty"||t.value==="dirty"?Se(o.value):o}}if(i.type==="refinement"){const a=o=>{const l=i.refinement(o,n);if(s.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(s.common.async===!1){const o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?b:(o.status==="dirty"&&t.dirty(),a(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>o.status==="aborted"?b:(o.status==="dirty"&&t.dirty(),a(o.value).then(()=>({status:t.value,value:o.value}))))}if(i.type==="transform")if(s.common.async===!1){const a=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!ge(a))return b;const o=i.transform(a.value,n);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(a=>ge(a)?Promise.resolve(i.transform(a.value,n)).then(o=>({status:t.value,value:o})):b);w.assertNever(i)}}_e.create=(r,e,t)=>new _e({schema:r,typeName:k.ZodEffects,effect:e,...S(t)});_e.createWithPreprocess=(r,e,t)=>new _e({schema:e,effect:{type:"preprocess",transform:r},typeName:k.ZodEffects,...S(t)});class re extends M{_parse(e){return this._getType(e)===g.undefined?U(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}re.create=(r,e)=>new re({innerType:r,typeName:k.ZodOptional,...S(e)});class be extends M{_parse(e){return this._getType(e)===g.null?U(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}be.create=(r,e)=>new be({innerType:r,typeName:k.ZodNullable,...S(e)});class ct extends M{_parse(e){const{ctx:t}=this._processInputParams(e);let s=t.data;return t.parsedType===g.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ct.create=(r,e)=>new ct({innerType:r,typeName:k.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...S(e)});class ht extends M{_parse(e){const{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},i=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return ze(i)?i.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new H(s.common.issues)},input:s.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new H(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}ht.create=(r,e)=>new ht({innerType:r,typeName:k.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...S(e)});class Bt extends M{_parse(e){if(this._getType(e)!==g.nan){const s=this._getOrReturnCtx(e);return p(s,{code:c.invalid_type,expected:g.nan,received:s.parsedType}),b}return{status:"valid",value:e.data}}}Bt.create=r=>new Bt({typeName:k.ZodNaN,...S(r)});class ar extends M{_parse(e){const{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}}class vt extends M{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{const n=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?b:n.status==="dirty"?(t.dirty(),Se(n.value)):this._def.out._parseAsync({data:n.value,path:s.path,parent:s})})();{const i=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?b:i.status==="dirty"?(t.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:s.path,parent:s})}}static create(e,t){return new vt({in:e,out:t,typeName:k.ZodPipeline})}}class ft extends M{_parse(e){const t=this._def.innerType._parse(e),s=i=>(ge(i)&&(i.value=Object.freeze(i.value)),i);return ze(t)?t.then(i=>s(i)):s(t)}unwrap(){return this._def.innerType}}ft.create=(r,e)=>new ft({innerType:r,typeName:k.ZodReadonly,...S(e)});var k;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(k||(k={}));const F=se.create,$=ve.create,D=at.create,or=ot.create;ne.create;const R=K.create,Y=T.create;We.create;qe.create;le.create;const et=ut.create;ye.create;const we=dt.create;Ge.create;re.create;be.create;const ss=Y({delay:$().int().min(30).max(3600),torznab:R(F()),useClientTorrents:D(),dataDirs:R(F()),matchMode:we(pt),skipRecheck:D(),autoResumeMaxDownload:$().int().min(0).max(52428800),ignoreNonRelevantFilesToResume:D(),linkDirs:R(F()),linkType:we(gt),flatLinking:D(),maxDataDepth:$().int().min(1),linkCategory:F().optional(),torrentDir:F().optional(),outputDir:F(),injectDir:F().optional(),ignoreTitles:D().optional(),includeSingleEpisodes:D(),verbose:D(),includeNonVideos:D(),seasonFromEpisodes:$().min(0).max(1).optional(),fuzzySizeThreshold:$().gt(0).lte(1),excludeOlder:$().optional(),excludeRecentSearch:$().optional(),action:we(mt),torrentClients:R(F()),duplicateCategories:D(),notificationWebhookUrls:R(F()),torrents:R(F()),port:$().int().min(1).max(65535).optional(),host:F().optional(),basePath:F().optional(),searchCadence:$().optional(),rssCadence:$().optional(),snatchTimeout:$().optional(),searchTimeout:$().optional(),searchLimit:$().int().min(0).optional(),blockList:R(F()),apiKey:F().min(24).optional(),sonarr:R(F()),radarr:R(F())});ss.partial();const O=ss.shape,xr=Y({includeSingleEpisodes:O.includeSingleEpisodes,includeNonVideos:O.includeNonVideos,blockList:O.blockList.nullish(),snatchTimeout:O.snatchTimeout.nullish(),autoResumeMaxDownload:O.autoResumeMaxDownload,fuzzySizeThreshold:O.fuzzySizeThreshold,seasonFromEpisodes:O.seasonFromEpisodes.nullish()});Y({torznab:R(F().url())});const lr=Y({client:F().min(1,Wt.emptyString),url:F().url(),user:F().nullish(),password:F().nullish(),readOnly:D().optional().default(!1).or(or().transform(()=>!1)),plugin:D().nullish().default(!1)}),Sr=Y({torrentClients:R(lr).nullish(),action:we(mt),duplicateCategories:D(),useClientTorrents:D(),linkCategory:F().nullish(),skipRecheck:D(),torrentDir:F().nullable().transform(r=>r??null),outputDir:F().min(1,Wt.emptyString),injectDir:F().optional()}),Mr=Y({delay:O.delay,matchMode:O.matchMode,rssCadence:O.rssCadence.nullish(),searchCadence:O.searchCadence.nullish(),searchTimeout:O.searchTimeout.nullish(),searchLimit:O.searchLimit.nullish(),excludeOlder:O.excludeOlder.nullish(),excludeRecentSearch:O.excludeRecentSearch.nullish()}),wr=Y({host:O.host.nullish(),port:O.port.nullish(),apiKey:O.apiKey.nullish(),radarr:R(F().url().or(et(""))).transform(r=>r??[]).nullable(),sonarr:R(F().url().or(et(""))).transform(r=>r??[]).nullable(),notificationWebhookUrls:R(F().url().or(et(""))).optional()}),Fr=Y({dataDirs:R(F()).transform(r=>r??[]).nullable(),flatLinking:D().transform(r=>typeof r=="boolean"?r:!1),linkDir:F().nullish(),linkDirs:R(F()).nullable(),linkType:we(gt),maxDataDepth:$().gte(1).refine(r=>(r>3&&console.error("Your maxDataDepth is most likely incorrect, please read: https://www.cross-seed.org/docs/tutorials/data-based-matching#setting-up-data-based-matching"),!0))}),ur=Y({verbose:O.verbose,torrents:O.torrents.optional()}),Vr=r=>{const e=zt(),{data:t}=rs(e.settings.get.queryOptions(void 0,{select:i=>i.config}));return{config:t,validationSchema:ur,isFieldRequired:i=>{const n=r.shape[i];return n?!n.isOptional()&&!n.isNullable():(console.warn(`Field "${i}" not found in schema.`),!1)}}},dr=A.createContext(null),Er=({isFieldRequired:r,children:e})=>N.jsx(dr.Provider,{value:{isFieldRequired:r},children:e});function cr(r,e,t={}){const{includeUndefined:s=!1,preserveArrays:i=!0}=t,n=Object.keys(r.shape),a={};for(const o of n){const l=e[o];if(s||o in e)if(i&&Array.isArray(l))a[o]=l;else if(l&&typeof l=="object"&&!Array.isArray(l)){const u=r.shape[o];u instanceof T?a[o]=cr(u,l,t):a[o]=l}else a[o]=l}return a}const hr=()=>{const r=zt(),e=is(),t=r.settings.save.mutationOptions({onSuccess:async()=>{await e.invalidateQueries({queryKey:r.settings.get.queryKey(),exact:!1}),yt.success("Settings saved successfully!",{description:"Your changes will take effect on the next restart."})},onError:i=>{yt.error("Failed to save settings",{description:i.message||"An unknown error occurred"})}}),s=ns(t);return{saveConfig:s.mutate,saveConfigAsync:s.mutateAsync,isLoading:s.isPending,isError:s.isError,isSuccess:s.isSuccess,error:s.error,data:s.data,reset:s.reset}};function fr(r){return r.filter(e=>e!=="")}function mr(r){return Object.keys(r).forEach(e=>{const t=e;r[t]===null&&delete r[t]}),r}function Ar(){const{saveConfig:r}=hr();return A.useCallback(async({value:e})=>{try{return Object.keys(e).forEach(t=>{const s=t,i=e[s];i&&Array.isArray(i)&&(e[s]=fr(i))}),mr(e),await r(e),{value:e}}catch(t){return console.error("Exception:",t),{status:"error",error:{_form:"An unexpected error occurred"}}}},[r])}export{mt as A,Er as F,gt as L,pt as M,Ar as a,br as b,vr as c,F as d,Fr as e,kr as f,xr as g,wr as h,lr as i,hr as j,Sr as k,et as l,yr as m,dr as n,_r as o,cr as p,Mr as s,Vr as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{V as r,X as u}from"./index-Ncy0-Qo7.js";function a(e,s){return r(e,u)}export{a as u};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>Cross Seed</title>
|
|
7
|
+
<script type="module" crossorigin src="/__CROSS_SEED_BASE_PATH__/assets/index-Ncy0-Qo7.js"></script>
|
|
8
|
+
<link rel="stylesheet" crossorigin href="/__CROSS_SEED_BASE_PATH__/assets/index-B41DM2T5.css">
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
<div id="root"></div>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|