@dhzh/foundry 1.3.0 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/app/index.html +1 -1
- package/dist/app/static/css/index.608f829ba2.css +2 -0
- package/dist/app/static/js/index.37bf97044c.js +1 -0
- package/dist/cli.mjs +4 -4
- package/dist/index.mjs +1 -1
- package/dist/package-sD3q513f.mjs +2 -0
- package/package.json +1 -1
- package/dist/app/static/css/index.b67a70b0c1.css +0 -2
- package/dist/app/static/js/index.d282086870.js +0 -1
- package/dist/package-Cr1rC-Jd.mjs +0 -2
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(()=>{"use strict";var e,t,a,r,n,i,s={3861(e,t,a){var r=a(5511),n=a(6255),i=a(9366),s=a(4021),d=a(6653),o=a(4466),l=a(2150);let c=(0,o.F)("group/alert relative grid w-full gap-0.5 rounded-lg border px-2 py-1.5 text-start text-xs/relaxed has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pe-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-1.5 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-3.5",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current"}},defaultVariants:{variant:"default"}});function u(e){let{className:t,variant:a,...n}=e;return(0,r.jsx)("div",{"data-slot":"alert",role:"alert",className:(0,l.cn)(c({variant:a}),t),...n})}function m(e){let{className:t,...a}=e;return(0,r.jsx)("div",{"data-slot":"alert-title",className:(0,l.cn)("font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground",t),...a})}function p(e){let{className:t,...a}=e;return(0,r.jsx)("div",{"data-slot":"alert-description",className:(0,l.cn)("text-xs/relaxed text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4",t),...a})}var x=a(9757);let h=(0,o.F)("group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-xs/relaxed font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",outline:"border-border hover:bg-input/50 hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:bg-input/30",secondary:"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-7 gap-1 px-2 text-xs/relaxed has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 [&_svg:not([class*='size-'])]:size-3.5",xs:"h-5 gap-1 rounded-sm px-2 text-[0.625rem] has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 [&_svg:not([class*='size-'])]:size-2.5",sm:"h-6 gap-1 px-2 text-xs/relaxed has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 [&_svg:not([class*='size-'])]:size-3",lg:"h-8 gap-1 px-2.5 text-xs/relaxed has-data-[icon=inline-end]:pe-2 has-data-[icon=inline-start]:ps-2 [&_svg:not([class*='size-'])]:size-4",icon:"size-7 [&_svg:not([class*='size-'])]:size-3.5","icon-xs":"size-5 rounded-sm [&_svg:not([class*='size-'])]:size-2.5","icon-sm":"size-6 [&_svg:not([class*='size-'])]:size-3","icon-lg":"size-8 [&_svg:not([class*='size-'])]:size-4"}},defaultVariants:{variant:"default",size:"default"}});function f(e){let{className:t,variant:a="default",size:n="default",...i}=e;return(0,r.jsx)(x.$,{"data-slot":"button",className:(0,l.cn)(h({variant:a,size:n,className:t})),...i})}var g=a(7616),v=a(9356);function b(e){let{className:t,...a}=e;return(0,r.jsx)(g.n,{icon:v.A,strokeWidth:2,"data-slot":"spinner",role:"status","aria-label":"Loading",className:(0,l.cn)("size-4 animate-spin",t),...a})}var j=a(3479),y=a(1085);let w=["settings"];async function N(e){if(!e.ok)throw Error("The Foundry Server could not load Application Settings.");return(await e.json()).data}async function k(){return N(await fetch("/api/settings",{cache:"no-store"}))}async function C(e){return N(await fetch("/api/settings",{body:JSON.stringify(e),headers:{"content-type":"application/json"},method:"PATCH"}))}let _="(prefers-color-scheme: dark)",z=n.createContext(void 0);function E(){return window.matchMedia(_).matches?"dark":"light"}function P(e,t){let a,r="system"===e?E():e,n=t?((a=document.createElement("style")).appendChild(document.createTextNode("*,*::before,*::after{-webkit-transition:none!important;transition:none!important}")),document.head.appendChild(a),()=>{window.getComputedStyle(document.body),requestAnimationFrame(()=>{requestAnimationFrame(()=>{a.remove()})})}):null;return document.documentElement.classList.remove("light","dark"),document.documentElement.classList.add(r),n?.(),r}var A=a(1402),S=a(3735),O=a(7958),T=a(3966),F=a(2918),M=a(9310),L=a(8288);function D(e){let{...t}=e;return(0,r.jsx)(S.s,{"data-slot":"tooltip",...t})}function I(e){let{...t}=e;return(0,r.jsx)(O.k,{"data-slot":"tooltip-trigger",...t})}function R(e){let{className:t,side:a="top",sideOffset:n=4,align:i="center",alignOffset:s=0,children:d,...o}=e;return(0,r.jsx)(T.K,{children:(0,r.jsx)(F.o,{align:i,alignOffset:s,side:a,sideOffset:n,className:"isolate z-50",children:(0,r.jsxs)(M.o,{"data-slot":"tooltip-content",className:(0,l.cn)("z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pe-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-start-2 data-[side=inline-start]:slide-in-from-end-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",t),...o,children:[d,(0,r.jsx)(L.P,{className:"z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-xs bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-inset-s-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-inset-e-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5"})]})})})}let U=new(a(7632)).E;var W=a(8071),$=a(6551);let K=["health"],H={pending:"Foundry · Checking…",success:"Foundry · Healthy",error:"Foundry · Unhealthy"};var q=a(3676),B=a(8517),V=a(2802),J=a(3138),Y=a(4344),X=a(6280),G=a(4038),Q=a(4930),Z=a(7886),ee=a(4890),et=a(2817),ea=a(3586),er=a(1585),en=a(3227),ei=a(3373),es=a(9544);let ed=q.V();function eo(e){let{...t}=e;return(0,r.jsx)(B.t,{...t})}function el(e){let{...t}=e;return(0,r.jsx)(V.S,{"data-slot":"toast-portal",...t})}function ec(e){let{className:t,...a}=e;return(0,r.jsx)(J.U,{"data-slot":"toast-viewport",className:(0,l.cn)("pointer-events-none fixed inset-x-4 top-4 z-50 mx-auto w-auto max-w-sm outline-none sm:w-full",t),...a})}function eu(e){let{className:t,...a}=e;return(0,r.jsx)(Y.m,{"data-slot":"toast",className:(0,l.cn)("group/toast pointer-events-auto absolute end-0 top-0 z-[calc(1000-var(--toast-index))] w-full origin-top rounded-md border bg-popover text-popover-foreground shadow-lg will-change-transform outline-none select-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50","[--gap:0.75rem] [--height:var(--toast-frontmost-height,var(--toast-height))] [--offset-y:calc(var(--toast-offset-y)+calc(var(--toast-index)*var(--gap))+var(--toast-swipe-movement-y))] [--peek:0.75rem] [--scale:calc(max(0,1-(var(--toast-index)*0.1)))] [--shrink:calc(1-var(--scale))]","h-(--height) [transform:translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-swipe-movement-y)+(var(--toast-index)*var(--peek))+(var(--shrink)*var(--height))))_scale(var(--scale))] [transition:transform_500ms_cubic-bezier(0.22,1,0.36,1),opacity_500ms,height_150ms]","after:absolute after:top-full after:start-0 after:h-[calc(var(--gap)+1px)] after:w-full after:content-['']","data-expanded:h-(--toast-height) data-expanded:[transform:translateX(var(--toast-swipe-movement-x))_translateY(var(--offset-y))]","data-limited:opacity-0 data-starting-style:[transform:translateY(-150%)]","[&[data-ending-style]:not([data-limited]):not([data-swipe-direction])]:[transform:translateY(-150%)]","data-ending-style:data-[swipe-direction=down]:[transform:translateY(calc(var(--toast-swipe-movement-y)+150%))]","data-ending-style:data-[swipe-direction=left]:[transform:translateX(calc(var(--toast-swipe-movement-x)-150%))_translateY(var(--offset-y))]","data-ending-style:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))]","data-ending-style:data-[swipe-direction=up]:[transform:translateY(calc(var(--toast-swipe-movement-y)-150%))]","data-expanded:data-ending-style:data-[swipe-direction=down]:[transform:translateY(calc(var(--toast-swipe-movement-y)+150%))]","data-expanded:data-ending-style:data-[swipe-direction=left]:[transform:translateX(calc(var(--toast-swipe-movement-x)-150%))_translateY(var(--offset-y))]","data-expanded:data-ending-style:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))]","data-expanded:data-ending-style:data-[swipe-direction=up]:[transform:translateY(calc(var(--toast-swipe-movement-y)-150%))]",t),...a})}function em(e){let{className:t,...a}=e;return(0,r.jsx)(X.p,{"data-slot":"toast-content",className:(0,l.cn)("flex h-full items-center gap-3 overflow-hidden p-4 transition-opacity duration-250 ease-[cubic-bezier(0.22,1,0.36,1)] data-behind:opacity-0 data-expanded:opacity-100",t),...a})}function ep(e){let{className:t,...a}=e;return(0,r.jsx)(G.S,{"data-slot":"toast-title",className:(0,l.cn)("text-sm font-medium",t),...a})}function ex(e){let{className:t,...a}=e;return(0,r.jsx)(Q.a,{"data-slot":"toast-description",className:(0,l.cn)("text-sm text-muted-foreground",t),...a})}function eh(e){let{className:t,render:a=(0,r.jsx)(f,{variant:"outline",size:"sm"}),...n}=e;return(0,r.jsx)(Z.Q,{"data-slot":"toast-action",render:a,className:(0,l.cn)("shrink-0",t),...n})}function ef(e){let{className:t,children:a,render:n=(0,r.jsx)(f,{variant:"ghost",size:"icon-sm"}),...i}=e;return(0,r.jsx)(ee.e,{"data-slot":"toast-close","aria-label":"Close toast",render:n,className:(0,l.cn)("relative shrink-0 text-muted-foreground after:absolute after:-inset-2 after:content-[''] hover:text-foreground",t),...i,children:a??(0,r.jsx)(g.n,{icon:ea.A,strokeWidth:2,"aria-hidden":"true"})})}function eg(e){let{type:t}=e,a=null;return("success"===t&&(a=(0,r.jsx)(g.n,{icon:er.A,strokeWidth:2,"aria-hidden":"true"})),"info"===t&&(a=(0,r.jsx)(g.n,{icon:en.A,strokeWidth:2,"aria-hidden":"true"})),"warning"===t&&(a=(0,r.jsx)(g.n,{icon:ei.A,strokeWidth:2,"aria-hidden":"true"})),"error"===t&&(a=(0,r.jsx)(g.n,{icon:es.A,strokeWidth:2,className:"text-destructive","aria-hidden":"true"})),"loading"===t&&(a=(0,r.jsx)(g.n,{icon:v.A,strokeWidth:2,className:"animate-spin","aria-hidden":"true"})),a)?(0,r.jsx)("span",{"data-slot":"toast-icon",className:"shrink-0 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",children:a}):null}function ev(){let{toasts:e}=et.I();return e.map(e=>(0,r.jsx)(eu,{toast:e,children:(0,r.jsxs)(em,{children:[(0,r.jsx)(eg,{type:e.type}),(0,r.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[(0,r.jsx)(ep,{}),(0,r.jsx)(ex,{})]}),(0,r.jsx)(eh,{}),(0,r.jsx)(ef,{})]})},e.id))}function eb(e){let{children:t,toastManager:a=ed,...n}=e;return(0,r.jsxs)(eo,{toastManager:a,...n,children:[t,(0,r.jsx)(el,{children:(0,r.jsx)(ec,{children:(0,r.jsx)(ev,{})})})]})}q.V,et.I;var ej=a(4709),ey=a(8189),ew=a(1204),eN=a(9512),ek=a(8337);function eC(e){let{className:t,type:a,...n}=e;return(0,r.jsx)(ek.p,{type:a,"data-slot":"input",className:(0,l.cn)("h-7 w-full min-w-0 rounded-md border border-input bg-input/20 px-2 py-0.5 text-sm transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-xs/relaxed file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 md:text-xs/relaxed dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",t),...n})}var e_=a(8695);function ez(e){let{className:t,orientation:a="horizontal",...n}=e;return(0,r.jsx)(e_.w,{"data-slot":"separator",orientation:a,className:(0,l.cn)("shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",t),...n})}var eE=a(1372),eP=a(3708),eA=a(3596),eS=a(6695),eO=a(6746),eT=a(5470),eF=a(94);function eM(e){let{...t}=e;return(0,r.jsx)(eE.D,{"data-slot":"sheet",...t})}function eL(e){let{...t}=e;return(0,r.jsx)(eP.Z,{"data-slot":"sheet-portal",...t})}function eD(e){let{className:t,...a}=e;return(0,r.jsx)(eA.X,{"data-slot":"sheet-overlay",className:(0,l.cn)("fixed inset-0 z-50 bg-black/80 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs",t),...a})}function eI(e){let{className:t,children:a,side:n="right",showCloseButton:i=!0,...s}=e;return(0,r.jsxs)(eL,{children:[(0,r.jsx)(eD,{}),(0,r.jsxs)(eS.h,{"data-slot":"sheet-content","data-side":n,className:(0,l.cn)("fixed z-50 flex flex-col bg-popover bg-clip-padding text-xs/relaxed text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-10 data-[side=bottom]:data-starting-style:translate-y-10 data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-e data-[side=left]:data-ending-style:-translate-x-10 rtl:data-[side=left]:data-ending-style:translate-x-10 data-[side=left]:data-starting-style:-translate-x-10 rtl:data-[side=left]:data-starting-style:translate-x-10 data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-s data-[side=right]:data-ending-style:translate-x-10 rtl:data-[side=right]:data-ending-style:-translate-x-10 data-[side=right]:data-starting-style:translate-x-10 rtl:data-[side=right]:data-starting-style:-translate-x-10 data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:-translate-y-10 data-[side=top]:data-starting-style:-translate-y-10 data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm",t),...s,children:[a,i&&(0,r.jsxs)(eO.H,{"data-slot":"sheet-close",render:(0,r.jsx)(f,{variant:"ghost",className:"absolute inset-e-4 top-4",size:"icon-sm"}),children:[(0,r.jsx)(g.n,{icon:ea.A,strokeWidth:2}),(0,r.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function eR(e){let{className:t,...a}=e;return(0,r.jsx)("div",{"data-slot":"sheet-header",className:(0,l.cn)("flex flex-col gap-1.5 p-6",t),...a})}function eU(e){let{className:t,...a}=e;return(0,r.jsx)(eT.L,{"data-slot":"sheet-title",className:(0,l.cn)("font-heading text-sm font-medium text-foreground",t),...a})}function eW(e){let{className:t,...a}=e;return(0,r.jsx)(eF.r,{"data-slot":"sheet-description",className:(0,l.cn)("text-xs/relaxed text-muted-foreground",t),...a})}function e$(e){let{className:t,...a}=e;return(0,r.jsx)("div",{"data-slot":"skeleton",className:(0,l.cn)("animate-pulse rounded-md bg-muted",t),...a})}var eK=a(8472);let eH=n.createContext(null);function eq(){let e=n.useContext(eH);if(!e)throw Error("useSidebar must be used within a SidebarProvider.");return e}function eB(e){let{defaultOpen:t=!0,open:a,onOpenChange:i,className:s,style:d,children:o,...c}=e,u=function(){let[e,t]=n.useState(()=>matchMedia("(max-width: 767px)").matches);return n.useEffect(()=>{let e=matchMedia("(max-width: 767px)"),a=()=>{t(e.matches)};return e.addEventListener("change",a),()=>e.removeEventListener("change",a)},[]),e}(),[m,p]=n.useState(!1),[x,h]=n.useState(t),f=a??x,g=n.useCallback(e=>{let t="function"==typeof e?e(f):e;i?i(t):h(t),document.cookie=`sidebar_state=${t}; path=/; max-age=604800`},[i,f]),v=n.useCallback(()=>u?p(e=>!e):g(e=>!e),[u,g,p]);n.useEffect(()=>{let e=e=>{"b"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),v())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[v]);let b=f?"expanded":"collapsed",j=n.useMemo(()=>({state:b,open:f,setOpen:g,isMobile:u,openMobile:m,setOpenMobile:p,toggleSidebar:v}),[b,f,g,u,m,p,v]);return(0,r.jsx)(eH.Provider,{value:j,children:(0,r.jsx)("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":"13rem","--sidebar-width-icon":"3rem",...d},className:(0,l.cn)("group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar",s),...c,children:o})})}function eV(e){let{side:t="left",variant:a="sidebar",collapsible:n="offcanvas",className:i,children:s,dir:d,...o}=e,{isMobile:c,state:u,openMobile:m,setOpenMobile:p}=eq();return"none"===n?(0,r.jsx)("div",{"data-slot":"sidebar",className:(0,l.cn)("flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground",i),...o,children:s}):c?(0,r.jsx)(eM,{open:m,onOpenChange:p,...o,children:(0,r.jsxs)(eI,{dir:d,"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",style:{"--sidebar-width":"16rem"},side:t,children:[(0,r.jsxs)(eR,{className:"sr-only",children:[(0,r.jsx)(eU,{children:"Sidebar"}),(0,r.jsx)(eW,{children:"Displays the mobile sidebar."})]}),(0,r.jsx)("div",{className:"flex size-full flex-col",children:s})]})}):(0,r.jsxs)("div",{className:"group peer hidden text-sidebar-foreground md:block","data-state":u,"data-collapsible":"collapsed"===u?n:"","data-variant":a,"data-side":t,"data-slot":"sidebar",children:[(0,r.jsx)("div",{"data-slot":"sidebar-gap",className:(0,l.cn)("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180","floating"===a||"inset"===a?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),(0,r.jsx)("div",{"data-slot":"sidebar-container","data-side":t,className:(0,l.cn)("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:-left-(--sidebar-width) data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:-right-(--sidebar-width) md:flex","floating"===a||"inset"===a?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-e group-data-[side=right]:border-s",i),...o,children:(0,r.jsx)("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border",children:s})})]})}function eJ(e){let{className:t,onClick:a,...n}=e,{toggleSidebar:i}=eq();return(0,r.jsxs)(f,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon-sm",className:(0,l.cn)(t),onClick:e=>{a?.(e),i()},...n,children:[(0,r.jsx)(g.n,{icon:eK.A,strokeWidth:2,className:"rtl:rotate-180"}),(0,r.jsx)("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function eY(e){let{className:t,...a}=e;return(0,r.jsx)("main",{"data-slot":"sidebar-inset",className:(0,l.cn)("relative flex w-full flex-1 flex-col bg-background md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ms-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ms-2",t),...a})}function eX(e){let{className:t,...a}=e;return(0,r.jsx)("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:(0,l.cn)("no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden",t),...a})}function eG(e){let{className:t,...a}=e;return(0,r.jsx)("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:(0,l.cn)("relative flex w-full min-w-0 flex-col px-2 py-1",t),...a})}function eQ(e){let{className:t,render:a,...r}=e;return(0,eN.C)({defaultTagName:"div",props:(0,ew.v6)({className:(0,l.cn)("flex h-8 shrink-0 items-center rounded-md px-2 text-xs text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:pointer-events-none group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",t)},r),render:a,state:{slot:"sidebar-group-label",sidebar:"group-label"}})}function eZ(e){let{className:t,...a}=e;return(0,r.jsx)("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:(0,l.cn)("w-full text-xs",t),...a})}function e0(e){let{className:t,...a}=e;return(0,r.jsx)("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:(0,l.cn)("flex w-full min-w-0 flex-col gap-px",t),...a})}function e1(e){let{className:t,...a}=e;return(0,r.jsx)("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:(0,l.cn)("group/menu-item relative",t),...a})}let e2=(0,o.F)("peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-[calc(var(--radius-sm)+2px)] p-2 text-start text-xs ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pe-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_var(--sidebar-border)] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_var(--sidebar-accent)]"},size:{default:"h-8 text-xs",sm:"h-7 text-xs",lg:"h-12 text-xs group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function e5(e){let{render:t,isActive:a=!1,variant:n="default",size:i="default",tooltip:s,className:d,...o}=e,{isMobile:c,state:u}=eq(),m=(0,eN.C)({defaultTagName:"button",props:(0,ew.v6)({className:(0,l.cn)(e2({variant:n,size:i}),d)},o),render:s?(0,r.jsx)(I,{render:t}):t,state:{slot:"sidebar-menu-button",sidebar:"menu-button",size:i,active:a}});return s?("string"==typeof s&&(s={children:s}),(0,r.jsxs)(D,{children:[m,(0,r.jsx)(R,{side:"right",align:"center",hidden:"collapsed"!==u||c,...s})]})):m}var e4=a(9611),e3=a(1274),e6=a(3106),e8=a(2739),e7=a(24),e9=a(2443);let te=[{title:null,items:[{title:"Dashboard",href:"/dashboard",icon:e4.A}]},{title:"Capabilities",items:[{title:"Skills",href:"/skills",icon:e3.A},{title:"MCPs",href:"/mcps",icon:e6.A},{title:"Prompts",href:"/prompts",icon:e8.A}]},{title:"Execution",items:[{title:"Runtimes",href:"/runtimes",icon:e7.A},{title:"Providers",href:"/providers",icon:e9.A,description:"Saved model-service connections for each Runtime."}]}];function tt(){let e=(0,ey.zy)(),{isMobile:t,setOpenMobile:a}=eq(),n=()=>{t&&a(!1)};return(0,r.jsx)(eV,{collapsible:"icon","data-testid":"app-sidebar",children:(0,r.jsx)(eX,{children:te.map(t=>(0,r.jsxs)(eG,{children:[t.title&&(0,r.jsx)(eQ,{children:t.title}),(0,r.jsx)(eZ,{children:(0,r.jsx)(e0,{children:t.items.map(t=>(0,r.jsx)(e1,{children:(0,r.jsxs)(e5,{isActive:e.pathname===t.href,tooltip:t.title,render:(0,r.jsx)($.k2,{to:t.href,onClick:n}),children:[(0,r.jsx)(g.n,{icon:t.icon,strokeWidth:2}),(0,r.jsx)("span",{children:t.title})]})},t.href))})})]},t.title??"overview"))})})}var ta=a(6442);function tr(e){let{className:t,...a}=e;return(0,r.jsx)("div",{"data-slot":"empty",className:(0,l.cn)("flex w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 rounded-xl border-dashed p-6 text-center text-balance",t),...a})}function tn(e){let{className:t,...a}=e;return(0,r.jsx)("div",{"data-slot":"empty-header",className:(0,l.cn)("flex max-w-sm flex-col items-center gap-1",t),...a})}function ti(e){let{className:t,...a}=e;return(0,r.jsx)("div",{"data-slot":"empty-title",className:(0,l.cn)("font-heading text-sm font-medium tracking-tight",t),...a})}function ts(e){let{className:t,...a}=e;return(0,r.jsx)("div",{"data-slot":"empty-description",className:(0,l.cn)("text-xs/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",t),...a})}function td(e){let{className:t,...a}=e;return(0,r.jsx)("div",{"data-slot":"empty-content",className:(0,l.cn)("flex w-full max-w-sm min-w-0 flex-col items-center gap-2 text-xs/relaxed text-balance",t),...a})}function to(e){let{title:t,description:a,action:n}=e;return(0,r.jsxs)(tr,{children:[(0,r.jsxs)(tn,{children:[(0,r.jsx)(ti,{children:t}),(0,r.jsx)(ts,{children:a})]}),n?(0,r.jsx)(td,{children:n}):null]})}let tl=["system","light","dark"],tc=["codex","claude-code"],tu={"claude-code":"Claude Code",codex:"Codex"},tm={"claude-code":["env.ANTHROPIC_BASE_URL","env.ANTHROPIC_AUTH_TOKEN","env.ANTHROPIC_API_KEY","env.ANTHROPIC_MODEL","env.ANTHROPIC_DEFAULT_OPUS_MODEL","env.ANTHROPIC_DEFAULT_OPUS_MODEL_NAME","env.ANTHROPIC_DEFAULT_OPUS_MODEL_DESCRIPTION","env.ANTHROPIC_DEFAULT_OPUS_MODEL_SUPPORTED_CAPABILITIES","env.ANTHROPIC_DEFAULT_SONNET_MODEL","env.ANTHROPIC_DEFAULT_SONNET_MODEL_NAME","env.ANTHROPIC_DEFAULT_SONNET_MODEL_DESCRIPTION","env.ANTHROPIC_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES","env.ANTHROPIC_DEFAULT_HAIKU_MODEL","env.ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME","env.ANTHROPIC_DEFAULT_HAIKU_MODEL_DESCRIPTION","env.ANTHROPIC_DEFAULT_HAIKU_MODEL_SUPPORTED_CAPABILITIES","env.ANTHROPIC_DEFAULT_FABLE_MODEL","env.ANTHROPIC_DEFAULT_FABLE_MODEL_NAME","env.ANTHROPIC_DEFAULT_FABLE_MODEL_DESCRIPTION","env.ANTHROPIC_DEFAULT_FABLE_MODEL_SUPPORTED_CAPABILITIES","env.CLAUDE_CODE_SUBAGENT_MODEL","env.CLAUDE_CODE_SUBAGENT_MODEL_FORCE","env.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS","env.ENABLE_TOOL_SEARCH","env.CLAUDE_CODE_EFFORT_LEVEL","env.DISABLE_AUTOUPDATER","attribution.commit","attribution.pr","attribution.sessionUrl"],codex:["model","review_model","model_provider","[model_providers.<key>].name","[model_providers.<key>].base_url","[model_providers.<key>].wire_api","[model_providers.<key>].experimental_bearer_token"]},tp=["image/png","image/jpeg","image/webp","image/svg+xml"],tx=["effort","xhigh_effort","max_effort","thinking","adaptive_thinking","interleaved_thinking"];var th=a(1993),tf=a(3384),tg=a(2529),tv=a(7908);function tb(e){let{className:t,size:a="default",...n}=e;return(0,r.jsx)(tf.C,{"data-slot":"avatar","data-size":a,className:(0,l.cn)("group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:border-border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten",t),...n})}function tj(e){let{className:t,...a}=e;return(0,r.jsx)(tg.B,{"data-slot":"avatar-image",className:(0,l.cn)("aspect-square size-full rounded-full object-cover",t),...a})}function ty(e){let{className:t,...a}=e;return(0,r.jsx)(tv.q,{"data-slot":"avatar-fallback",className:(0,l.cn)("flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs",t),...a})}function tw(e){let{alt:t="",avatar:a,className:n,name:i,size:s}=e;return(0,r.jsxs)(tb,{className:n,size:s,children:[a&&(0,r.jsx)(tj,{alt:t,src:`data:${a.mimeType};base64,${a.data}`}),(0,r.jsx)(ty,{children:i.trim().charAt(0)||"P"})]})}let tN={"claude-code":a(3367),codex:a(2351)};function tk(e){let{runtime:t,size:a=16}=e;return(0,r.jsx)("img",{alt:"","aria-hidden":"true","data-icon":"inline-start","data-runtime-icon":t,height:a,src:tN[t],width:a})}function tC(e){let{runtime:t}=e;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(tk,{runtime:t}),tu[t]]})}var t_=a(324),tz=a(5596);function tE(e){let{className:t,...a}=e;return(0,r.jsx)("textarea",{"data-slot":"textarea",className:(0,l.cn)("flex field-sizing-content min-h-16 w-full resize-none rounded-md border border-input bg-input/20 px-2 py-2 text-sm transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 md:text-xs/relaxed dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",t),...a})}function tP(e){let{className:t,...a}=e;return(0,r.jsx)("div",{"data-slot":"input-group",role:"group",className:(0,l.cn)("group/input-group relative flex h-7 w-full min-w-0 items-center rounded-md border border-input bg-input/20 transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-data-[align=block-end]:rounded-md has-data-[align=block-start]:rounded-md has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-2 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/30 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-2 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[textarea]:rounded-md has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pe-1.5 has-[>[data-align=inline-start]]:[&>input]:ps-1.5",t),...a})}let tA=(0,o.F)("flex h-auto cursor-text items-center justify-center gap-1 py-2 text-xs/relaxed font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 **:data-[slot=kbd]:rounded-[calc(var(--radius-sm)-2px)] **:data-[slot=kbd]:bg-muted-foreground/10 **:data-[slot=kbd]:px-1 **:data-[slot=kbd]:text-[0.625rem] [&>svg:not([class*='size-'])]:size-3.5",{variants:{align:{"inline-start":"order-first ps-2 has-[>button]:ms-[-0.275rem] has-[>kbd]:ms-[-0.275rem]","inline-end":"order-last pe-2 has-[>button]:me-[-0.275rem] has-[>kbd]:me-[-0.275rem]","block-start":"order-first w-full justify-start px-2 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2","block-end":"order-last w-full justify-start px-2 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2"}},defaultVariants:{align:"inline-start"}});function tS(e){let{className:t,align:a="inline-start",...n}=e;return(0,r.jsx)("div",{role:"group","data-slot":"input-group-addon","data-align":a,className:(0,l.cn)(tA({align:a}),t),onClick:e=>{e.target.closest("button")||e.currentTarget.parentElement?.querySelector("input")?.focus()},...n})}let tO=(0,o.F)("flex items-center gap-2 rounded-md text-xs/relaxed shadow-none",{variants:{size:{xs:"h-5 gap-1 rounded-[calc(var(--radius-sm)-2px)] px-1 [&>svg:not([class*='size-'])]:size-3",sm:"gap-1","icon-xs":"size-6 p-0 has-[>svg]:p-0","icon-sm":"size-7 p-0 has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});function tT(e){let{className:t,type:a="button",variant:n="ghost",size:i="xs",...s}=e;return(0,r.jsx)(f,{type:a,"data-size":i,variant:n,className:(0,l.cn)(tO({size:i}),t),...s})}function tF(e){let{className:t,...a}=e;return(0,r.jsx)(eC,{"data-slot":"input-group-control",className:(0,l.cn)("flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent",t),...a})}function tM(e){let{value:t,...a}=e,[i,s]=(0,n.useState)(!1);return(0,r.jsxs)(tP,{children:[(0,r.jsx)(tF,{...a,type:i?"text":"password",value:t}),(0,r.jsx)(tS,{align:"inline-end",children:(0,r.jsx)(tT,{"aria-label":i?"Hide API Key":"Show API Key",size:"icon-xs",onClick:()=>s(e=>!e),children:(0,r.jsx)(g.n,{icon:i?t_.A:tz.A,strokeWidth:2})})})]})}var tL=a(6091);function tD(e){let{...t}=e;return(0,r.jsx)(tL.V,{"data-slot":"alert-dialog",...t})}function tI(e){let{...t}=e;return(0,r.jsx)(eP.Z,{"data-slot":"alert-dialog-portal",...t})}function tR(e){let{className:t,...a}=e;return(0,r.jsx)(eA.X,{"data-slot":"alert-dialog-overlay",className:(0,l.cn)("fixed inset-0 isolate z-50 bg-black/80 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",t),...a})}function tU(e){let{className:t,size:a="default",...n}=e;return(0,r.jsxs)(tI,{children:[(0,r.jsx)(tR,{}),(0,r.jsx)(eS.h,{"data-slot":"alert-dialog-content","data-size":a,className:(0,l.cn)("group/alert-dialog-content fixed top-1/2 start-1/2 z-50 grid w-full -translate-x-1/2 rtl:translate-x-1/2 -translate-y-1/2 gap-3 rounded-xl bg-popover p-4 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-64 data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",t),...n})]})}function tW(e){let{className:t,...a}=e;return(0,r.jsx)("div",{"data-slot":"alert-dialog-header",className:(0,l.cn)("grid grid-rows-[auto_1fr] place-items-center gap-1 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-start sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",t),...a})}function t$(e){let{className:t,...a}=e;return(0,r.jsx)("div",{"data-slot":"alert-dialog-footer",className:(0,l.cn)("flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",t),...a})}function tK(e){let{className:t,...a}=e;return(0,r.jsx)(eT.L,{"data-slot":"alert-dialog-title",className:(0,l.cn)("font-heading text-sm font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",t),...a})}function tH(e){let{className:t,...a}=e;return(0,r.jsx)(eF.r,{"data-slot":"alert-dialog-description",className:(0,l.cn)("text-xs/relaxed text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",t),...a})}function tq(e){let{className:t,...a}=e;return(0,r.jsx)(f,{"data-slot":"alert-dialog-action",className:(0,l.cn)(t),...a})}function tB(e){let{className:t,variant:a="outline",size:n="default",...i}=e;return(0,r.jsx)(eO.H,{"data-slot":"alert-dialog-cancel",className:(0,l.cn)(t),render:(0,r.jsx)(f,{variant:a,size:n}),...i})}var tV=a(8978),tJ=a(7612),tY=a(8716);function tX(e){let{className:t,...a}=e;return(0,r.jsx)(tV.y,{"data-slot":"checkbox",className:(0,l.cn)("peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-shadow outline-none group-has-disabled/field:opacity-50 group-has-[:focus-visible]/field-label:ring-0 group-has-[:focus-visible]/field-label:not-data-checked:border-input after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary",t),...a,children:(0,r.jsx)(tJ.P,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none [&>svg]:size-3.5",children:(0,r.jsx)(g.n,{icon:tY.A,strokeWidth:2})})})}var tG=a(7904),tQ=a(8893),tZ=a(2874);function t0(e){let{...t}=e;return(0,r.jsx)(tG.N,{"data-slot":"collapsible",...t})}function t1(e){let{...t}=e;return(0,r.jsx)(tQ.R,{"data-slot":"collapsible-trigger",...t})}function t2(e){let{...t}=e;return(0,r.jsx)(tZ.j,{"data-slot":"collapsible-content",...t})}function t5(e){let{className:t,...a}=e;return(0,r.jsx)("label",{"data-slot":"label",className:(0,l.cn)("flex items-center gap-2 text-xs/relaxed leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),...a})}function t4(e){let{className:t,...a}=e;return(0,r.jsx)("fieldset",{"data-slot":"field-set",className:(0,l.cn)("flex flex-col gap-4 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3",t),...a})}function t3(e){let{className:t,variant:a="legend",...n}=e;return(0,r.jsx)("legend",{"data-slot":"field-legend","data-variant":a,className:(0,l.cn)("mb-2 font-medium data-[variant=label]:text-xs/relaxed data-[variant=legend]:text-sm",t),...n})}function t6(e){let{className:t,...a}=e;return(0,r.jsx)("div",{"data-slot":"field-group",className:(0,l.cn)("group/field-group @container/field-group flex w-full flex-col gap-4 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4",t),...a})}let t8=(0,o.F)("group/field flex w-full gap-2 data-[invalid=true]:text-destructive",{variants:{orientation:{vertical:"flex-col *:w-full [&>.sr-only]:w-auto",horizontal:"flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",responsive:"flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"}},defaultVariants:{orientation:"vertical"}});function t7(e){let{className:t,orientation:a="vertical",...n}=e;return(0,r.jsx)("div",{role:"group","data-slot":"field","data-orientation":a,className:(0,l.cn)(t8({orientation:a}),t),...n})}function t9(e){let{className:t,...a}=e;return(0,r.jsx)("div",{"data-slot":"field-content",className:(0,l.cn)("group/field-content flex flex-1 flex-col gap-0.5 leading-snug",t),...a})}function ae(e){let{children:t,className:a,required:n=!1,...i}=e;return(0,r.jsx)(t5,{"data-slot":"field-label",className:(0,l.cn)("group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border has-[>[data-slot=field]]:not-has-[:disabled,[data-disabled]]:hover:bg-input/40 has-[>[data-slot=field]]:has-[:focus-visible]:border-ring has-[>[data-slot=field]]:has-[:focus-visible]:ring-2 has-[>[data-slot=field]]:has-[:focus-visible]:ring-ring/30 *:data-[slot=field]:p-2 dark:has-data-checked:bg-primary/10","has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col",n&&"after:text-destructive after:content-['*']",a),...i,children:t})}function at(e){let{className:t,...a}=e;return(0,r.jsx)("p",{"data-slot":"field-description",className:(0,l.cn)("text-start text-xs/relaxed leading-normal font-normal text-muted-foreground group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5","last:mt-0 nth-last-2:-mt-1","[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",t),...a})}function aa(e){let{children:t,className:a,...n}=e;return(0,r.jsxs)("div",{"data-slot":"field-separator","data-content":!!t,className:(0,l.cn)("relative -my-2 h-5 text-xs/relaxed group-data-[variant=outline]/field-group:-mb-2",a),...n,children:[(0,r.jsx)(ez,{className:"absolute inset-0 top-1/2"}),t&&(0,r.jsx)("span",{className:"relative mx-auto block w-fit bg-background px-2 text-muted-foreground","data-slot":"field-separator-content",children:t})]})}function ar(e){let{className:t,children:a,errors:i,...s}=e,d=(0,n.useMemo)(()=>{if(a)return a;if(!i?.length)return null;let e=[...new Map(i.map(e=>[e?.message,e])).values()];return e?.length==1?e[0]?.message:(0,r.jsx)("ul",{className:"ms-4 flex list-disc flex-col gap-1",children:e.map((e,t)=>e?.message&&(0,r.jsx)("li",{children:e.message},t))})},[a,i]);return d?(0,r.jsx)("div",{role:"alert","data-slot":"field-error",className:(0,l.cn)("text-xs/relaxed font-normal text-destructive",t),...s,children:d}):null}var an=a(6549),ai=a(3574),as=a(614),ad=a(2120),ao=a(7914),al=a(860),ac=a(7004),au=a(8402),am=a(5696),ap=a(4334),ax=a(7631),ah=a(9025),af=a(850),ag=a(6960),av=a(5174),ab=a(5514),aj=a(6539);let ay=an.H;function aw(e){let{className:t,...a}=e;return(0,r.jsx)(ai.s,{"data-slot":"select-group",className:(0,l.cn)("scroll-my-1 p-1",t),...a})}function aN(e){let{className:t,...a}=e;return(0,r.jsx)(as.y,{"data-slot":"select-value",className:(0,l.cn)("flex flex-1 text-start",t),...a})}function ak(e){let{className:t,size:a="default",children:n,...i}=e;return(0,r.jsxs)(ad.b,{"data-slot":"select-trigger","data-size":a,className:(0,l.cn)("flex w-fit items-center justify-between gap-1.5 rounded-md border border-input bg-input/20 px-2 py-1.5 text-xs/relaxed whitespace-nowrap transition-colors outline-none focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-7 data-[size=sm]:h-6 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5",t),...i,children:[n,(0,r.jsx)(ao.w,{render:(0,r.jsx)(g.n,{icon:av.A,strokeWidth:2,className:"pointer-events-none size-3.5 text-muted-foreground"})})]})}function aC(e){let{className:t,children:a,side:n="bottom",sideOffset:i=4,align:s="center",alignOffset:d=0,alignItemWithTrigger:o=!0,...c}=e;return(0,r.jsx)(al.V,{children:(0,r.jsx)(ac.l,{side:n,sideOffset:i,align:s,alignOffset:d,alignItemWithTrigger:o,className:"isolate z-50",children:(0,r.jsxs)(au.t,{"data-slot":"select-content","data-align-trigger":o,className:(0,l.cn)("relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-start-2 data-[side=inline-start]:slide-in-from-end-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",t),...c,children:[(0,r.jsx)(az,{}),(0,r.jsx)(am.B,{children:a}),(0,r.jsx)(aE,{})]})})})}function a_(e){let{className:t,children:a,...n}=e;return(0,r.jsxs)(ap.e,{"data-slot":"select-item",className:(0,l.cn)("relative flex min-h-7 w-full cursor-default items-center gap-2 rounded-md px-2 py-1 text-xs/relaxed outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",t),...n,children:[(0,r.jsx)(ax.h,{"data-slot":"select-item-text",className:"flex flex-1 shrink-0 items-center gap-2 whitespace-nowrap",children:a}),(0,r.jsx)(ah.h,{render:(0,r.jsx)("span",{className:"pointer-events-none absolute end-2 flex items-center justify-center"}),children:(0,r.jsx)(g.n,{icon:tY.A,strokeWidth:2,className:"pointer-events-none"})})]})}function az(e){let{className:t,...a}=e;return(0,r.jsx)(af.w,{"data-slot":"select-scroll-up-button",className:(0,l.cn)("top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-3.5",t),...a,children:(0,r.jsx)(g.n,{icon:ab.A,strokeWidth:2})})}function aE(e){let{className:t,...a}=e;return(0,r.jsx)(ag.d,{"data-slot":"select-scroll-down-button",className:(0,l.cn)("bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-3.5",t),...a,children:(0,r.jsx)(g.n,{icon:aj.A,strokeWidth:2})})}var aP=a(3859),aA=a(712);let aS=(0,o.F)("group/toggle inline-flex items-center justify-center gap-1 rounded-md text-xs font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent hover:bg-muted"},size:{default:"h-7 min-w-7 px-2 has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5",sm:"h-6 min-w-6 rounded-[min(var(--radius-md),8px)] px-2 text-[0.625rem] has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 [&_svg:not([class*='size-'])]:size-3",lg:"h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pe-2 has-data-[icon=inline-start]:ps-2"}},defaultVariants:{variant:"default",size:"default"}}),aO=n.createContext({size:"default",variant:"default",spacing:2,orientation:"horizontal"});function aT(e){let{className:t,variant:a,size:n,spacing:i=2,orientation:s="horizontal",children:d,...o}=e;return(0,r.jsx)(aA.O,{"data-slot":"toggle-group","data-variant":a,"data-size":n,"data-spacing":i,"data-orientation":s,style:{"--gap":i},className:(0,l.cn)("group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-md data-[size=sm]:rounded-[min(var(--radius-md),8px)] data-vertical:flex-col data-vertical:items-stretch",t),...o,children:(0,r.jsx)(aO.Provider,{value:{variant:a,size:n,spacing:i,orientation:s},children:d})})}function aF(e){let{className:t,children:a,variant:i="default",size:s="default",...d}=e,o=n.useContext(aO);return(0,r.jsx)(aP.l,{"data-slot":"toggle-group-item","data-variant":o.variant||i,"data-size":o.size||s,"data-spacing":o.spacing,className:(0,l.cn)("shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pe-1.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:ps-1.5 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-s-md group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-md group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-e-md group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-md group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-s-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-s group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t",aS({variant:o.variant||i,size:o.size||s}),t),...d,children:a})}function aM(e){return["providers",e]}function aL(e){return["provider",e]}async function aD(e){if(!e.ok)throw Error("The Foundry Server could not load the Provider.");let t=await e.json();if("SUCCESS"!==t.status||null===t.data)throw Error(t.message??"The Provider could not be found.");return t.data}async function aI(e){if(!e.ok)throw Error("The Foundry Server could not load Providers.");return(await e.json()).data}async function aR(e){return aI(await fetch(`/api/providers?runtime=${encodeURIComponent(e)}`,{cache:"no-store"}))}async function aU(e){return aD(await fetch(`/api/providers/${encodeURIComponent(e)}`,{cache:"no-store"}))}async function aW(e){let t=await fetch("/api/providers",{body:JSON.stringify(e),headers:{"content-type":"application/json"},method:"POST"});if(!t.ok)throw Error("The Foundry Server could not create the Provider.");return(await t.json()).data}async function a$(e,t){let a=await fetch(`/api/providers/${encodeURIComponent(e)}`,{body:JSON.stringify(t),headers:{"content-type":"application/json"},method:"PUT"});if(!a.ok)throw Error("The Foundry Server could not update the Provider.");let r=await a.json();if("SUCCESS"!==r.status||null===r.data)throw Error(r.message??"The Provider could not be updated.");return r.data}async function aK(e,t){let a=await fetch(`/api/providers/${encodeURIComponent(e)}/copy`,{body:JSON.stringify(t),headers:{"content-type":"application/json"},method:"POST"});if(!a.ok)throw Error("The Foundry Server could not copy the Provider.");let r=await a.json();if("SUCCESS"!==r.status||null===r.data)throw Error(r.message??"The Provider could not be copied.");return r.data}async function aH(e){let t=await fetch(`/api/providers/${encodeURIComponent(e)}`,{method:"DELETE"});if(!t.ok)throw Error("The Foundry Server could not delete the Provider.");let a=await t.json();if("SUCCESS"!==a.status||!a.data)throw Error(a.message??"The Provider could not be deleted.")}async function aq(e){let t=await fetch(`/api/providers/${encodeURIComponent(e)}/test-connection`,{method:"POST"});if(!t.ok)throw Error("The Foundry Server could not test the Provider connection.");let a=await t.json();if("SUCCESS"!==a.status||!a.data)throw Error(a.message??"The Provider connection test failed.")}function aB(e){return(0,j.I)({queryKey:aM(e),queryFn:()=>aR(e),refetchOnWindowFocus:!1,retry:!1})}let aV={adaptive_thinking:"Adaptive thinking",effort:"Effort",interleaved_thinking:"Interleaved thinking",max_effort:"Max effort",thinking:"Thinking",xhigh_effort:"XHigh effort"},aJ=[{description:"Remove Claude Code attribution from commits, pull requests, and session links.",key:"hideAiAttribution",label:"Hide AI attribution"},{description:"Enable experimental agent teams for interactive sessions.",key:"teammatesMode",label:"Teammates mode"},{description:"Discover MCP tools on demand. The configured endpoint must support tool references.",key:"enableToolSearch",label:"Enable tool search"},{description:"Force Claude Code sessions to use the maximum available reasoning effort.",key:"maxEffortThinking",label:"Max effort thinking"},{description:"Disable background update checks while keeping manual updates available.",key:"disableAutoUpdater",label:"Disable auto-updater"}];function aY(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return{avatar:e?.avatar??null,name:e?`${e.name}${t?" Copy":""}`:"",officialWebsite:e?.officialWebsite??"",remark:e?.remark??""}}function aX(e){return{apiKey:e?.configuration.apiKey??"",baseUrl:e?.configuration.baseUrl??"",defaultModel:e?.configuration.defaultModel??"",reviewModel:e?.configuration.reviewModel??""}}function aG(e){return{description:e?.description??"",displayName:e?.displayName??"",model:e?.model??"",supportedCapabilities:e?.supportedCapabilities??[]}}function aQ(e){let t=e?.configuration;return{apiKey:t?.apiKey??"",apiKeyHeader:t?.apiKeyHeader??"authorization",baseUrl:t?.baseUrl??"",fableModel:aG(t?.fableModel),haikuModel:aG(t?.haikuModel),opusModel:aG(t?.opusModel),defaultModel:t?.defaultModel??"",sonnetModel:aG(t?.sonnetModel),subagentModel:t?.subagentModel??"",subagentModelForce:t?.subagentModelForce??!1,hideAiAttribution:t?.hideAiAttribution??!1,teammatesMode:t?.teammatesMode??!1,enableToolSearch:t?.enableToolSearch??!1,maxEffortThinking:t?.maxEffortThinking??!1,disableAutoUpdater:t?.disableAutoUpdater??!1}}function aZ(e){return e.trim()||null}function a0(e){let t=e.model.trim();return""===t?null:{description:aZ(e.description),displayName:aZ(e.displayName),model:t,supportedCapabilities:e.supportedCapabilities}}function a1(e){let{id:t,label:a,value:n,onChange:i}=e,s=""!==n.model.trim();return(0,r.jsxs)(t4,{children:[(0,r.jsx)(t3,{children:a}),(0,r.jsxs)(t6,{children:[(0,r.jsxs)("div",{className:"grid gap-4 sm:grid-cols-2",children:[(0,r.jsxs)(t7,{children:[(0,r.jsx)(ae,{htmlFor:`${t}-model`,children:"Model ID"}),(0,r.jsx)(eC,{id:`${t}-model`,maxLength:200,value:n.model,onChange:e=>i({...n,model:e.target.value})})]}),(0,r.jsxs)(t7,{children:[(0,r.jsx)(ae,{htmlFor:`${t}-display-name`,children:"Display name"}),(0,r.jsx)(eC,{disabled:!s,id:`${t}-display-name`,maxLength:100,value:n.displayName,onChange:e=>i({...n,displayName:e.target.value})})]})]}),(0,r.jsxs)(t0,{children:[(0,r.jsxs)(t1,{className:"group flex w-fit items-center gap-1 rounded-sm py-1 text-xs/relaxed font-medium text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/30 disabled:pointer-events-none disabled:opacity-50",children:[(0,r.jsx)(g.n,{className:"size-3 transition-transform group-data-panel-open:rotate-90",icon:th.A,strokeWidth:2}),(0,r.jsx)("span",{children:"Advanced model options"})]}),(0,r.jsx)(t2,{className:"h-(--collapsible-panel-height) overflow-hidden transition-[height] duration-150 data-ending-style:h-0 data-starting-style:h-0",children:(0,r.jsx)("div",{className:"ms-3 min-w-0 border-s border-border py-2 ps-4",children:(0,r.jsxs)(t6,{children:[(0,r.jsxs)(t7,{children:[(0,r.jsx)(ae,{htmlFor:`${t}-description`,children:"Description"}),(0,r.jsx)(tE,{disabled:!s,id:`${t}-description`,maxLength:2e3,value:n.description,onChange:e=>i({...n,description:e.target.value})})]}),(0,r.jsxs)(t7,{children:[(0,r.jsx)(ae,{htmlFor:`${t}-capabilities`,children:"Supported capabilities"}),(0,r.jsxs)(ay,{disabled:!s,id:`${t}-capabilities`,multiple:!0,value:n.supportedCapabilities,onValueChange:e=>i({...n,supportedCapabilities:tx.filter(t=>e.includes(t))}),children:[(0,r.jsx)(ak,{className:"w-full",children:(0,r.jsx)(aN,{children:()=>0===n.supportedCapabilities.length?"Select capabilities":n.supportedCapabilities.map(e=>aV[e]).join(", ")})}),(0,r.jsx)(aC,{align:"start",children:(0,r.jsx)(aw,{children:tx.map(e=>(0,r.jsx)(a_,{value:e,children:aV[e]},e))})})]})]})]})})})]})]})]})}function a2(e){var t,a;let i,d,o,{mode:l,provider:c}=e,x=(0,ey.zy)(),h=(0,ey.Zp)(),g=(i=(0,s.jE)(),(0,y.n)({mutationFn:aW,onSuccess:e=>{i.setQueryData(aM(e.runtime),t=>[e,...t??[]])}})),v=(t=c?.id??"",d=(0,s.jE)(),(0,y.n)({mutationFn:e=>aK(t,e),onSuccess:e=>{d.setQueryData(aM(e.runtime),t=>t?[e,...t]:[e])}})),j=(a=c?.id??"",o=(0,s.jE)(),(0,y.n)({mutationFn:e=>a$(a,e),onSuccess:e=>{o.removeQueries({exact:!0,queryKey:aL(e.id)}),o.setQueryData(aM(e.runtime),t=>t?.map(t=>t.id===e.id?e:t))}})),w="copy"===l,N="edit"===l,k=c?.runtime==="codex"?c:void 0,C=c?.runtime==="claude-code"?c:void 0,[_,z]=(0,n.useState)(c?.runtime??null),[E,P]=(0,n.useState)(null),[A,S]=(0,n.useState)(()=>aY(c,w)),[O,T]=(0,n.useState)(()=>aX(k)),[F,M]=(0,n.useState)(()=>aQ(C)),[L,U]=(0,n.useState)(null),W=(0,n.useRef)(null),K="claude-code"===_&&"authorization"===F.apiKeyHeader?"Auth Token":"API Key",H=""!==F.subagentModel.trim(),q="claude-code"===_,B="string"==typeof x.state?.returnTo?x.state.returnTo:`/providers?runtime=${c?.runtime??"codex"}`,V=JSON.stringify(A)!==JSON.stringify(aY(c,w))||"codex"===_&&JSON.stringify(O)!==JSON.stringify(aX(k))||"claude-code"===_&&JSON.stringify(F)!==JSON.stringify(aQ(C)),J=g.isError||v.isError||j.isError,Y=g.isPending||v.isPending||j.isPending,X="Add Provider",G="Choose the Runtime this Provider can be applied to.",Q="Add Provider";N?(X="Edit Provider",G="A Provider Runtime cannot be changed after creation.",Q="Save Changes"):w&&(X="Create from Provider",G="A copy keeps the source Provider Runtime.",Q="Create Provider");let Z=e=>{S(aY()),T(aX()),M(aQ()),U(null),g.reset(),v.reset(),j.reset(),z(e),P(null)},ee=async e=>{if(!e){S(e=>({...e,avatar:null})),U(null);return}if(!tp.includes(e.type)||e.size>2097152){S(e=>({...e,avatar:null})),U("Choose a PNG, JPEG, WebP, or SVG image no larger than 2 MB.");return}try{let t=await new Promise((t,a)=>{let r=new FileReader;r.addEventListener("error",()=>a(Error("Avatar could not be read."))),r.addEventListener("load",()=>{if("string"!=typeof r.result)return void a(Error("Avatar could not be read."));let n=r.result.indexOf(",");-1===n?a(Error("Avatar could not be read.")):t({data:r.result.slice(n+1),mimeType:e.type})}),r.readAsDataURL(e)});S(e=>({...e,avatar:t})),U(null)}catch{S(e=>({...e,avatar:null})),U("The avatar could not be read.")}};return(0,r.jsxs)("main",{className:"w-full pb-12",children:[(0,r.jsx)("header",{className:"pb-5",children:(0,r.jsx)("h1",{className:"text-xl font-semibold",children:X})}),(0,r.jsx)("form",{onSubmit:e=>{let t;if(e.preventDefault(),null===_||null!==L)return;if("codex"===_)t={avatar:A.avatar,configuration:{apiKey:O.apiKey||null,baseUrl:O.baseUrl,defaultModel:O.defaultModel,protocol:"responses",reviewModel:aZ(O.reviewModel)},name:A.name,officialWebsite:aZ(A.officialWebsite),remark:aZ(A.remark),runtime:_};else{let e=F.defaultModel.trim();if(""===e)return;t={avatar:A.avatar,configuration:{apiKey:F.apiKey,apiKeyHeader:F.apiKeyHeader,baseUrl:F.baseUrl,fableModel:a0(F.fableModel),haikuModel:a0(F.haikuModel),opusModel:a0(F.opusModel),defaultModel:e,protocol:"messages",sonnetModel:a0(F.sonnetModel),subagentModel:aZ(F.subagentModel),subagentModelForce:F.subagentModelForce,hideAiAttribution:F.hideAiAttribution,teammatesMode:F.teammatesMode,enableToolSearch:F.enableToolSearch,maxEffortThinking:F.maxEffortThinking,disableAutoUpdater:F.disableAutoUpdater},name:A.name,officialWebsite:aZ(A.officialWebsite),remark:aZ(A.remark),runtime:_}}let a=e=>{N?ed.add({title:"Provider updated",type:"success"}):ed.add({title:"Provider created",type:"success"}),h("add"===l?`/providers?runtime=${e.runtime}`:B,{replace:!0})};"add"===l?g.mutate(t,{onSuccess:a}):w?v.mutate(t,{onSuccess:a}):j.mutate(t,{onSuccess:a})},children:(0,r.jsxs)(t6,{children:[(0,r.jsxs)(t7,{children:[(0,r.jsx)(ae,{required:!0,children:"Runtime"}),(0,r.jsx)(aT,{"aria-label":"Runtime",disabled:"add"!==l,spacing:0,value:_?[_]:[],variant:"outline",onValueChange:e=>{let[t]=e.slice(-1);tc.includes(t)&&(e=>{if("add"===l&&e!==_){if(null!==_&&V)return P(e);Z(e)}})(t)},children:tc.map(e=>(0,r.jsx)(aF,{value:e,children:(0,r.jsx)(tC,{runtime:e})},e))}),(0,r.jsx)(at,{children:G})]}),null===_?(0,r.jsxs)(u,{children:[(0,r.jsx)(m,{children:"Choose a Runtime"}),(0,r.jsx)(p,{children:"Provider fields appear after a Runtime is selected."})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(aa,{children:"Provider"}),(0,r.jsxs)(t7,{children:[(0,r.jsx)(ae,{htmlFor:"provider-name",required:!0,children:"Name"}),(0,r.jsx)(eC,{id:"provider-name",maxLength:100,required:!0,value:A.name,onChange:e=>S({...A,name:e.target.value})})]}),(0,r.jsxs)(t7,{"data-invalid":null!==L||void 0,children:[(0,r.jsx)(ae,{htmlFor:"provider-avatar",children:"Avatar"}),(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("button",{"aria-label":"Choose provider avatar",className:"size-10 cursor-pointer rounded-full outline-none focus-visible:ring-2 focus-visible:ring-ring/30",type:"button",onClick:()=>W.current?.click(),children:(0,r.jsx)(tw,{alt:"Provider avatar preview",avatar:A.avatar,name:A.name,size:"lg"})}),(0,r.jsx)(f,{disabled:null===A.avatar,type:"button",variant:"outline",onClick:()=>{S(e=>({...e,avatar:null})),U(null),W.current&&(W.current.value="")},children:"Remove avatar"}),(0,r.jsx)(eC,{accept:tp.join(","),"aria-invalid":null!==L||void 0,className:"sr-only size-px",id:"provider-avatar",ref:W,type:"file",onChange:e=>{ee(e.target.files?.[0])}})]}),(0,r.jsx)(at,{children:"Click the avatar to choose a PNG, JPEG, WebP, or SVG up to 2 MB."}),(0,r.jsx)(ar,{children:L})]}),(0,r.jsxs)(t7,{children:[(0,r.jsx)(ae,{htmlFor:"provider-website",children:"Official website"}),(0,r.jsx)(eC,{id:"provider-website",maxLength:2048,placeholder:"https://example.com",type:"url",value:A.officialWebsite,onChange:e=>S({...A,officialWebsite:e.target.value})})]}),(0,r.jsxs)(t7,{children:[(0,r.jsx)(ae,{htmlFor:"provider-remark",children:"Remark"}),(0,r.jsx)(tE,{id:"provider-remark",maxLength:2e3,value:A.remark,onChange:e=>S({...A,remark:e.target.value})})]}),(0,r.jsx)(aa,{children:"Connection"}),(0,r.jsxs)(t7,{children:[(0,r.jsx)(ae,{htmlFor:"provider-protocol",children:"Protocol"}),(0,r.jsx)(eC,{id:"provider-protocol",readOnly:!0,value:"codex"===_?"Responses API":"Anthropic Messages API"})]}),(0,r.jsxs)(t7,{children:[(0,r.jsx)(ae,{htmlFor:"provider-base-url",required:!0,children:"Base URL"}),(0,r.jsx)(eC,{id:"provider-base-url",maxLength:2048,placeholder:"codex"===_?"https://example.com/v1":"https://example.com",required:!0,type:"url",value:"codex"===_?O.baseUrl:F.baseUrl,onChange:e=>{"codex"===_?T({...O,baseUrl:e.target.value}):M({...F,baseUrl:e.target.value})}})]}),"claude-code"===_?(0,r.jsxs)(t7,{children:[(0,r.jsx)(ae,{required:!0,children:"Authentication method"}),(0,r.jsxs)(aT,{"aria-label":"Authentication method",spacing:0,value:[F.apiKeyHeader],variant:"outline",onValueChange:e=>{let[t]=e.slice(-1);("authorization"===t||"x-api-key"===t)&&M({...F,apiKeyHeader:t})},children:[(0,r.jsxs)(D,{children:[(0,r.jsx)(I,{render:(0,r.jsx)(aF,{value:"authorization"}),children:"Auth Token"}),(0,r.jsx)(R,{children:(0,r.jsx)("code",{className:"font-mono",children:"Authorization: Bearer <xxx>"})})]}),(0,r.jsxs)(D,{children:[(0,r.jsx)(I,{render:(0,r.jsx)(aF,{value:"x-api-key"}),children:"API Key"}),(0,r.jsx)(R,{children:(0,r.jsx)("code",{className:"font-mono",children:"X-Api-Key: <xxx>"})})]})]})]}):null,(0,r.jsxs)(t7,{children:[(0,r.jsx)(ae,{htmlFor:"provider-api-key",required:q,children:K}),(0,r.jsx)(tM,{autoComplete:"off",id:"provider-api-key",maxLength:16384,required:q,value:"codex"===_?O.apiKey:F.apiKey,onChange:e=>{"codex"===_?T({...O,apiKey:e.target.value}):M({...F,apiKey:e.target.value})}}),"codex"===_&&(0,r.jsx)(at,{children:"Leave blank only when the endpoint accepts requests without credentials."})]}),"codex"===_?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(aa,{children:"Models"}),(0,r.jsxs)(t7,{children:[(0,r.jsx)(ae,{htmlFor:"codex-default-model",required:!0,children:"Default model"}),(0,r.jsx)(eC,{id:"codex-default-model",maxLength:200,required:!0,value:O.defaultModel,onChange:e=>T({...O,defaultModel:e.target.value})})]}),(0,r.jsxs)(t7,{children:[(0,r.jsx)(ae,{htmlFor:"codex-review-model",children:"Review model"}),(0,r.jsx)(eC,{id:"codex-review-model",maxLength:200,value:O.reviewModel,onChange:e=>T({...O,reviewModel:e.target.value})})]})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(aa,{children:"Models"}),(0,r.jsxs)(t7,{children:[(0,r.jsx)(ae,{htmlFor:"claude-default-model",required:!0,children:"Default model"}),(0,r.jsx)(eC,{id:"claude-default-model",maxLength:200,required:!0,value:F.defaultModel,onChange:e=>M({...F,defaultModel:e.target.value})})]}),[["opusModel","Opus model"],["sonnetModel","Sonnet model"],["haikuModel","Haiku model"],["fableModel","Fable model"]].map(e=>{let[t,a]=e;return(0,r.jsx)(a1,{id:`claude-${t}`,label:a,value:F[t],onChange:e=>M({...F,[t]:e})},t)}),(0,r.jsxs)(t7,{children:[(0,r.jsx)(ae,{htmlFor:"claude-subagent-model",children:"Subagent model"}),(0,r.jsx)(eC,{id:"claude-subagent-model",maxLength:200,value:F.subagentModel,onChange:e=>{let t=e.target.value;M({...F,subagentModel:t,subagentModelForce:""!==t.trim()&&F.subagentModelForce})}})]}),(0,r.jsxs)(t7,{"data-disabled":!H,orientation:"horizontal",children:[(0,r.jsx)(tX,{checked:F.subagentModelForce,disabled:!H,id:"claude-subagent-model-force",onCheckedChange:e=>M({...F,subagentModelForce:e})}),(0,r.jsxs)(t9,{children:[(0,r.jsx)(ae,{htmlFor:"claude-subagent-model-force",children:"Force subagent model"}),(0,r.jsx)(at,{children:"Force Claude Code to use the configured subagent model."})]})]}),(0,r.jsx)(aa,{children:"Others"}),(0,r.jsxs)(t4,{children:[(0,r.jsx)(t3,{className:"sr-only",children:"Other Claude Code options"}),(0,r.jsx)(t6,{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:aJ.map(e=>{let t=`claude-${e.key}`;return(0,r.jsxs)(t7,{className:"min-w-0",orientation:"horizontal",children:[(0,r.jsx)(tX,{checked:F[e.key],id:t,onCheckedChange:t=>M({...F,[e.key]:t})}),(0,r.jsxs)(t9,{className:"min-w-0",children:[(0,r.jsx)(ae,{htmlFor:t,children:e.label}),(0,r.jsx)(at,{children:e.description})]})]},e.key)})})]})]}),J?(0,r.jsxs)(u,{variant:"destructive",children:[(0,r.jsx)(m,{children:"Provider was not saved"}),(0,r.jsx)(p,{children:"Check the fields and Foundry Server, then try again."})]}):null,(0,r.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,r.jsx)(f,{nativeButton:!1,render:(0,r.jsx)($.N_,{to:B,replace:!0}),variant:"outline",children:"Cancel"}),(0,r.jsxs)(f,{disabled:Y||null!==L,type:"submit",children:[Y?(0,r.jsx)(b,{"data-icon":"inline-start"}):null,(0,r.jsx)("span",{children:Q})]})]})]})]})},_??"unselected"),(0,r.jsx)(tD,{open:null!==E,onOpenChange:e=>{e||P(null)},children:(0,r.jsxs)(tU,{children:[(0,r.jsxs)(tW,{children:[(0,r.jsx)(tK,{children:"Change Runtime?"}),(0,r.jsx)(tH,{children:"Changing the Runtime will clear the information you've entered."})]}),(0,r.jsxs)(t$,{children:[(0,r.jsx)(tB,{children:"Cancel"}),(0,r.jsx)(tq,{onClick:()=>{E&&Z(E)},children:"Change Runtime"})]})]})})]})}function a5(e){let{mode:t}=e,{providerId:a=""}=(0,ey.g)(),n=(0,j.I)({queryKey:aL(a),queryFn:()=>aU(a),refetchOnWindowFocus:!1,retry:!1});return n.isPending?(0,r.jsx)("main",{className:"w-full","aria-label":"Loading Provider",role:"status",children:(0,r.jsx)(e$,{className:"h-96 w-full"})}):n.isError?(0,r.jsxs)(u,{variant:"destructive",children:[(0,r.jsx)(m,{children:"Provider could not be loaded"}),(0,r.jsx)(p,{children:n.error.message})]}):(0,r.jsx)(a2,{mode:t,provider:n.data})}var a4=a(348),a3=a(6989),a6=a(5817),a8=a(8727),a7=a(7414),a9=a(1721);let re=(0,o.F)("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-[0.625rem] font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-2.5!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border bg-input/20 text-foreground dark:bg-input/30 [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function rt(e){let{className:t,variant:a="default",render:r,...n}=e;return(0,eN.C)({defaultTagName:"span",props:(0,ew.v6)({className:(0,l.cn)(re({variant:a}),t)},n),render:r,state:{slot:"badge",variant:a}})}function ra(e){let{className:t,size:a="default",...n}=e;return(0,r.jsx)("div",{"data-slot":"card","data-size":a,className:(0,l.cn)("group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-lg bg-card py-(--card-spacing) text-xs/relaxed text-card-foreground ring-1 ring-foreground/10 [--card-spacing:--spacing(4)] has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] *:[img:first-child]:rounded-t-lg *:[img:last-child]:rounded-b-lg",t),...n})}function rr(e){let{className:t,...a}=e;return(0,r.jsx)("div",{"data-slot":"card-header",className:(0,l.cn)("group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-lg px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)",t),...a})}function rn(e){let{className:t,...a}=e;return(0,r.jsx)("div",{"data-slot":"card-title",className:(0,l.cn)("font-heading text-sm font-medium",t),...a})}function ri(e){let{className:t,...a}=e;return(0,r.jsx)("div",{"data-slot":"card-description",className:(0,l.cn)("text-xs/relaxed text-muted-foreground",t),...a})}function rs(e){let{className:t,...a}=e;return(0,r.jsx)("div",{"data-slot":"card-action",className:(0,l.cn)("col-start-2 row-span-2 row-start-1 self-start justify-self-end",t),...a})}function rd(e){let{className:t,...a}=e;return(0,r.jsx)("div",{"data-slot":"card-content",className:(0,l.cn)("px-(--card-spacing)",t),...a})}function ro(e){let{className:t,...a}=e;return(0,r.jsx)("div",{"data-slot":"card-footer",className:(0,l.cn)("flex items-center rounded-b-lg px-(--card-spacing) [.border-t]:pt-(--card-spacing)",t),...a})}var rl=a(9603),rc=a(1343),ru=a(1374),rm=a(554),rp=a(5921),rx=a(4310),rh=a(9150);function rf(e){let{...t}=e;return(0,r.jsx)(rl.y,{"data-slot":"popover",...t})}function rg(e){let{...t}=e;return(0,r.jsx)(rc.W,{"data-slot":"popover-trigger",...t})}function rv(e){let{className:t,align:a="center",alignOffset:n=0,side:i="bottom",sideOffset:s=4,...d}=e;return(0,r.jsx)(ru.i,{children:(0,r.jsx)(rm.U,{align:a,alignOffset:n,side:i,sideOffset:s,className:"isolate z-50",children:(0,r.jsx)(rp.i,{"data-slot":"popover-content",className:(0,l.cn)("z-50 flex w-72 origin-(--transform-origin) flex-col gap-4 rounded-lg bg-popover p-2.5 text-xs text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-start-2 data-[side=inline-start]:slide-in-from-end-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",t),...d})})})}function rb(e){let{className:t,...a}=e;return(0,r.jsx)("div",{"data-slot":"popover-header",className:(0,l.cn)("flex flex-col gap-1 text-xs",t),...a})}function rj(e){let{className:t,...a}=e;return(0,r.jsx)(rx.e,{"data-slot":"popover-title",className:(0,l.cn)("text-sm font-medium",t),...a})}function ry(e){let{className:t,...a}=e;return(0,r.jsx)(rh.u,{"data-slot":"popover-description",className:(0,l.cn)("text-muted-foreground",t),...a})}let rw=["runtimes"];class rN extends Error{}async function rk(e,t){if(!e.ok)throw new rN(t);let a=await e.json();if("SUCCESS"!==a.status||null===a.data)throw new rN(a.message??t);return a.data}async function rC(){return rk(await fetch("/api/runtimes",{cache:"no-store"}),"The Foundry Server could not load Runtimes.")}async function r_(e,t){return rk(await fetch(`/api/runtimes/${e}/preview`,{body:JSON.stringify(t),headers:{"content-type":"application/json"},method:"POST"}),"The Runtime configuration could not be previewed.")}async function rz(e,t){return rk(await fetch(`/api/runtimes/${e}/apply`,{body:JSON.stringify(t),headers:{"content-type":"application/json"},method:"POST"}),"The Runtime configuration could not be applied.")}function rE(){return(0,j.I)({queryKey:rw,queryFn:rC,refetchOnWindowFocus:!1,retry:!1})}function rP(e){let{...t}=e;return(0,r.jsx)(eE.D,{"data-slot":"dialog",...t})}function rA(e){let{...t}=e;return(0,r.jsx)(eP.Z,{"data-slot":"dialog-portal",...t})}function rS(e){let{className:t,...a}=e;return(0,r.jsx)(eA.X,{"data-slot":"dialog-overlay",className:(0,l.cn)("fixed inset-0 isolate z-50 bg-black/80 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",t),...a})}function rO(e){let{className:t,children:a,showCloseButton:n=!0,...i}=e;return(0,r.jsxs)(rA,{children:[(0,r.jsx)(rS,{}),(0,r.jsxs)(eS.h,{"data-slot":"dialog-content",className:(0,l.cn)("fixed top-1/2 start-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 rtl:translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-xs/relaxed text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",t),...i,children:[a,n&&(0,r.jsxs)(eO.H,{"data-slot":"dialog-close",render:(0,r.jsx)(f,{variant:"ghost",className:"absolute top-2 end-2",size:"icon-sm"}),children:[(0,r.jsx)(g.n,{icon:ea.A,strokeWidth:2}),(0,r.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function rT(e){let{className:t,...a}=e;return(0,r.jsx)("div",{"data-slot":"dialog-header",className:(0,l.cn)("flex flex-col gap-1",t),...a})}function rF(e){let{className:t,showCloseButton:a=!1,children:n,...i}=e;return(0,r.jsxs)("div",{"data-slot":"dialog-footer",className:(0,l.cn)("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...i,children:[n,a&&(0,r.jsx)(eO.H,{render:(0,r.jsx)(f,{variant:"outline"}),children:"Close"})]})}function rM(e){let{className:t,...a}=e;return(0,r.jsx)(eT.L,{"data-slot":"dialog-title",className:(0,l.cn)("font-heading text-sm font-medium",t),...a})}function rL(e){let{className:t,...a}=e;return(0,r.jsx)(eF.r,{"data-slot":"dialog-description",className:(0,l.cn)("text-xs/relaxed text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",t),...a})}let rD="official-default";function rI(e){let{value:t}=e,a=(0,n.useRef)(null),[i,s]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{let e=a.current;if(!e)return;let t=()=>{s(e.scrollWidth>e.clientWidth)},r=requestAnimationFrame(t),n=new ResizeObserver(t);return n.observe(e),()=>{cancelAnimationFrame(r),n.disconnect()}},[t]),(0,r.jsx)("dd",{className:"min-w-0",children:(0,r.jsxs)(D,{disabled:!i,children:[(0,r.jsx)(I,{render:(0,r.jsx)("span",{ref:a,className:"block truncate font-mono text-foreground",tabIndex:i?0:void 0}),children:t}),(0,r.jsx)(R,{className:"max-w-sm break-all",children:(0,r.jsx)("code",{className:"font-mono",children:t})})]})})}function rR(e){let{runtime:t}=e;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(tk,{runtime:t,size:24}),(0,r.jsx)("span",{className:"truncate",children:"Official Default"})]})}function rU(e){let{provider:t}=e;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(tw,{avatar:t.avatar,name:t.name,size:"sm"}),(0,r.jsx)("span",{className:"truncate",children:t.name})]})}function rW(e){let{isPending:t,provider:a,runtime:n,selection:i}=e;return i===rD?(0,r.jsx)(rR,{runtime:n}):a?(0,r.jsx)(rU,{provider:a}):t?"Loading Providers...":"Provider unavailable"}function r$(e,t){ed.add({description:e instanceof rN?e.message:"An unexpected error occurred.",priority:"high",title:t,type:"error"})}function rK(e){let{value:t}=e,[a,i]=(0,n.useState)(!1);return"absent"===t.kind?(0,r.jsx)("code",{className:"text-muted-foreground",children:"null"}):"plain"===t.kind?(0,r.jsx)("code",{className:"break-all",children:JSON.stringify(t.value)}):(0,r.jsxs)("span",{className:"inline-flex min-w-0 items-center gap-1",children:[(0,r.jsx)("code",{className:"break-all",children:a?JSON.stringify(t.value):"••••••••"}),(0,r.jsx)(f,{"aria-label":a?"Hide API Key":"Show API Key",size:"icon-xs",variant:"ghost",onClick:()=>i(e=>!e),children:(0,r.jsx)(g.n,{icon:a?t_.A:tz.A,strokeWidth:2})})]})}function rH(e){let{field:t}=e;return(0,r.jsxs)("div",{className:"grid gap-2 rounded-md border bg-muted/30 p-3 sm:grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] sm:items-center",children:[(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsx)("code",{className:"mb-1 block break-all text-[0.6875rem] text-muted-foreground",children:t.key}),(0,r.jsx)(rK,{value:t.current})]}),(0,r.jsx)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"→"}),(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsx)("span",{className:"mb-1 block text-[0.6875rem] uppercase tracking-wide text-muted-foreground",children:t.operation}),(0,r.jsx)(rK,{value:t.proposed})]})]})}function rq(e){let{fields:t}=e;return 0===t.length?(0,r.jsx)("p",{className:"text-muted-foreground",children:"No fields in this section."}):(0,r.jsx)("div",{className:"flex flex-col gap-2",children:t.map(e=>(0,r.jsx)(rH,{field:e},e.key))})}function rB(e){let{isOpen:t,runtime:a,onOpenChange:n}=e,i=tm[a];return(0,r.jsx)(rP,{open:t,onOpenChange:n,children:(0,r.jsxs)(rO,{className:"sm:max-w-lg",children:[(0,r.jsxs)(rT,{children:[(0,r.jsxs)(rM,{className:"flex items-center gap-2",children:[(0,r.jsx)(tk,{runtime:a}),(0,r.jsxs)("span",{children:[tu[a]," fields managed by Foundry"]})]}),(0,r.jsxs)(rL,{children:[i.length," ","configuration fields"]})]}),(0,r.jsx)("ul",{className:"flex max-h-80 flex-col gap-1 overflow-y-auto",children:i.map(e=>(0,r.jsx)("li",{children:(0,r.jsx)("code",{className:"block break-all rounded bg-muted px-2 py-1 text-[0.6875rem]",children:e})},e))}),(0,r.jsx)(rF,{showCloseButton:!0})]})})}function rV(e){let t,{isOpen:a,runtime:i,target:d,onOpenChange:o}=e,l=(0,y.n)({mutationFn:e=>r_(i,e)}),c=(t=(0,s.jE)(),(0,y.n)({mutationFn:e=>rz(i,e),onSuccess:e=>{t.setQueryData(rw,t=>t?.map(t=>t.runtime===e.runtime?e:t))}})),u=l.mutate,[m,p]=(0,n.useState)([]),[x,h]=(0,n.useState)(),g=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:x;u({providerKey:e,target:d},{onError:e=>r$(e,"Preview failed"),onSuccess:e=>{"provider-key-selection"===e.kind&&p(e.providerKeys)}})},v=l.data,j=v?.kind==="ready"?v:null;return(0,n.useEffect)(()=>{u({target:d},{onError:e=>r$(e,"Preview failed"),onSuccess:e=>{"provider-key-selection"===e.kind&&p(e.providerKeys)}})},[u,d]),(0,r.jsx)(rP,{open:a,onOpenChange:o,children:(0,r.jsxs)(rO,{className:"max-h-[85vh] overflow-y-auto sm:max-w-3xl",children:[(0,r.jsxs)(rT,{children:[(0,r.jsx)(rM,{children:"Preview Changes"}),(0,r.jsx)(rL,{children:"Review every field Foundry manages before applying this Runtime configuration."})]}),l.isPending&&(0,r.jsxs)("div",{className:"flex items-center gap-2 py-8 text-muted-foreground",role:"status",children:[(0,r.jsx)(b,{}),"Reading Runtime configuration…"]}),v&&(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsxs)("div",{className:"rounded-md border bg-muted/30 p-3",children:[(0,r.jsx)("span",{className:"block text-muted-foreground",children:"Configuration file"}),(0,r.jsx)("code",{className:"break-all",children:v.file.path})]}),m.length>1&&(0,r.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,r.jsx)("label",{className:"font-medium",htmlFor:`${i}-provider-key`,children:"Codex Provider key"}),(0,r.jsxs)(ay,{id:`${i}-provider-key`,value:x,onValueChange:e=>{e&&(h(e),g(e))},children:[(0,r.jsx)(ak,{className:"w-full",children:(0,r.jsx)(aN,{placeholder:"Select a Provider key"})}),(0,r.jsx)(aC,{align:"start",children:(0,r.jsx)(aw,{children:m.map(e=>(0,r.jsx)(a_,{value:e,children:(0,r.jsx)("code",{children:e})},e))})})]})]}),j&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("section",{className:"flex flex-col gap-2",children:[(0,r.jsx)("h3",{className:"font-medium",children:"Changes"}),(0,r.jsx)(rq,{fields:j.changes})]}),(0,r.jsxs)(t0,{children:[(0,r.jsxs)(t1,{render:(0,r.jsx)(f,{className:"w-full justify-between",variant:"outline"}),children:["Unchanged managed fields",(0,r.jsx)("span",{children:j.unchanged.length})]}),(0,r.jsx)(t2,{className:"pt-2",children:(0,r.jsx)(rq,{fields:j.unchanged})})]})]})]}),(0,r.jsxs)(rF,{children:[(0,r.jsx)(f,{disabled:l.isPending||c.isPending,variant:"outline",onClick:()=>g(),children:"Refresh"}),(0,r.jsxs)(f,{disabled:!j||l.isPending||c.isPending,onClick:()=>{j&&c.mutate({expectedFileHash:j.file.hash,providerKey:j.providerKey??void 0,target:d},{onError:e=>r$(e,"Apply failed"),onSuccess:()=>{ed.add({description:`${tu[i]} now uses the selected configuration.`,title:"Runtime saved",type:"success"}),o(!1)}})},children:[c.isPending&&(0,r.jsx)(b,{"data-icon":"inline-start"}),(0,r.jsx)("span",{children:"Apply"})]})]})]})})}function rJ(e){let{summary:t,onDetect:a}=e,i=aB(t.runtime),s=t.managed&&t.providerId?t.providerId:rD,[d,o]=(0,n.useState)(s),[l,c]=(0,n.useState)(!1),[x,h]=(0,n.useState)(!1),g=(0,n.useMemo)(()=>d===rD?{kind:"official-default"}:{kind:"provider",providerId:d},[d]),v=t.detection,b="detected"===v.status,j=i.data?.find(e=>e.id===d);return(0,r.jsxs)(ra,{children:[(0,r.jsxs)(rr,{children:[(0,r.jsx)(rn,{className:"flex items-center gap-2",children:(0,r.jsx)(tC,{runtime:t.runtime})}),(0,r.jsx)(rs,{children:(0,r.jsx)(rt,{variant:b?"secondary":"destructive",children:b?"Detected":"Not detected"})})]}),(0,r.jsxs)(rd,{className:"flex flex-col gap-4",children:[(0,r.jsxs)("dl",{className:"grid min-w-0 gap-2 text-muted-foreground sm:grid-cols-2",children:[(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsx)("dt",{children:"Version"}),(0,r.jsx)(rI,{value:v.version??"Unavailable"})]}),(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsx)("dt",{children:"Configuration"}),(0,r.jsx)(rI,{value:v.configurationPath})]})]}),v.message&&(0,r.jsxs)(u,{variant:"destructive",children:[(0,r.jsx)(m,{children:"Runtime unavailable"}),(0,r.jsx)(p,{children:v.message})]}),(0,r.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,r.jsx)("label",{className:"font-medium",htmlFor:`${t.runtime}-provider`,children:"Provider"}),(0,r.jsxs)(ay,{id:`${t.runtime}-provider`,value:d,onValueChange:e=>e&&o(e),children:[(0,r.jsx)(ak,{className:"w-full",children:(0,r.jsx)(aN,{children:(0,r.jsx)(rW,{isPending:i.isPending,provider:j,runtime:t.runtime,selection:d})})}),(0,r.jsx)(aC,{align:"start",children:(0,r.jsxs)(aw,{children:[(0,r.jsx)(a_,{value:rD,children:(0,r.jsx)(rR,{runtime:t.runtime})}),i.data?.map(e=>(0,r.jsx)(a_,{value:e.id,children:(0,r.jsx)(rU,{provider:e})},e.id))]})})]})]})]}),(0,r.jsxs)(ro,{className:"justify-end gap-2",children:[(0,r.jsx)(f,{size:"sm",variant:"outline",onClick:()=>c(!0),children:"Managed fields"}),(0,r.jsx)(f,{size:"sm",variant:"outline",onClick:a,children:"Detect Again"}),(0,r.jsx)(f,{disabled:i.isPending,size:"sm",onClick:()=>h(!0),children:"Save"})]}),l&&(0,r.jsx)(rB,{isOpen:!0,runtime:t.runtime,onOpenChange:c}),x&&(0,r.jsx)(rV,{isOpen:!0,runtime:t.runtime,target:g,onOpenChange:h})]})}function rY(e){return null!==e&&tc.includes(e)}function rX(e){var t;let a,{isEnabled:i,provider:d,returnTo:o}=e,[l,c]=(0,n.useState)(!1),[u,m]=(0,n.useState)(null),[p,x]=(0,n.useState)(!1),v=(a=(0,s.jE)(),(0,y.n)({mutationFn:()=>aH(d.id),onSuccess:()=>{a.removeQueries({exact:!0,queryKey:aL(d.id)}),a.setQueryData(aM(d.runtime),e=>e?.filter(e=>e.id!==d.id))}})),j=(t=d.id,(0,y.n)({mutationFn:()=>aq(t)})),w=(0,n.useMemo)(()=>({kind:"provider",providerId:d.id}),[d.id]);return(0,r.jsxs)(ra,{"data-testid":`provider-${d.id}`,size:"sm",children:[(0,r.jsxs)(rr,{className:"has-data-[slot=card-action]:grid-cols-1 @sm/card-header:has-data-[slot=card-action]:grid-cols-[1fr_auto]",children:[(0,r.jsxs)("div",{className:"flex min-w-0 items-center gap-3 @sm/card-header:row-span-2",children:[(0,r.jsx)(tw,{avatar:d.avatar,name:d.name,size:"lg"}),(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,r.jsx)(rn,{className:"truncate",children:d.name}),i&&(0,r.jsx)(rt,{variant:"secondary",children:"In Use"})]}),(0,r.jsx)(ri,{className:"min-w-0",children:(0,r.jsxs)("a",{className:"inline-flex max-w-full items-center gap-1 underline-offset-3 hover:text-foreground hover:underline focus-visible:text-foreground focus-visible:outline-none focus-visible:underline",href:d.baseUrl,rel:"noreferrer",target:"_blank",children:[(0,r.jsx)("span",{className:"truncate",children:d.baseUrl}),(0,r.jsx)(g.n,{"aria-hidden":"true",className:"size-3 shrink-0",icon:a4.A,strokeWidth:2})]})})]})]}),(0,r.jsxs)(rs,{className:"col-start-1 row-start-2 mt-2 flex flex-wrap items-center gap-1 justify-self-start @sm/card-header:col-start-2 @sm/card-header:row-span-2 @sm/card-header:row-start-1 @sm/card-header:mt-0 @sm/card-header:self-center @sm/card-header:justify-self-end",children:[(0,r.jsx)(f,{"aria-label":i?`Reapply ${d.name}`:`Apply ${d.name}`,type:"button",onClick:()=>x(!0),children:i?"Reapply":"Apply"}),(0,r.jsxs)(D,{children:[(0,r.jsx)(I,{render:(0,r.jsx)($.N_,{"aria-label":`Edit ${d.name}`,className:h({size:"icon",variant:"ghost"}),to:`/providers/${d.id}/edit`,state:{returnTo:o}}),children:(0,r.jsx)(g.n,{icon:a3.A,strokeWidth:2})}),(0,r.jsx)(R,{children:"Edit"})]}),(0,r.jsxs)(D,{children:[(0,r.jsx)(I,{render:(0,r.jsx)($.N_,{"aria-label":`Copy ${d.name}`,className:h({size:"icon",variant:"ghost"}),to:`/providers/${d.id}/copy`,state:{returnTo:o}}),children:(0,r.jsx)(g.n,{icon:a6.A,strokeWidth:2})}),(0,r.jsx)(R,{children:"Copy"})]}),(0,r.jsxs)(rf,{open:null!==u,onOpenChange:e=>{e||m(null)},children:[(0,r.jsxs)(D,{children:[(0,r.jsx)(rg,{render:(0,r.jsx)(I,{render:(0,r.jsx)(f,{"aria-label":`Test ${d.name} connection`,disabled:j.isPending,size:"icon",type:"button",variant:"ghost",onClick:()=>{m(null),j.mutate(void 0,{onError:e=>{m(e.message)},onSuccess:()=>{ed.add({title:"Connection successful",type:"success"})}})}})}),children:j.isPending?(0,r.jsx)(b,{}):(0,r.jsx)(g.n,{icon:a8.A,strokeWidth:2})}),(0,r.jsx)(R,{children:"Test connection"})]}),(0,r.jsxs)(rv,{align:"end",children:[(0,r.jsxs)(rb,{children:[(0,r.jsx)(rj,{children:"Connection failed"}),(0,r.jsx)(ry,{className:"wrap-break-word",children:u})]}),(0,r.jsx)("div",{className:"flex justify-end",children:(0,r.jsx)(f,{type:"button",variant:"outline",onClick:()=>m(null),children:"Close"})})]})]}),i?(0,r.jsxs)(D,{children:[(0,r.jsx)(I,{render:(0,r.jsx)(f,{"aria-label":`Delete ${d.name}`,disabled:!0,size:"icon",type:"button",variant:"destructive"}),children:(0,r.jsx)(g.n,{icon:a7.A,strokeWidth:2})}),(0,r.jsx)(R,{children:"Provider is in use"})]}):(0,r.jsxs)(rf,{open:l,onOpenChange:c,children:[(0,r.jsx)(rg,{render:(0,r.jsx)(f,{"aria-label":`Delete ${d.name}`,size:"icon",type:"button",variant:"destructive"}),children:(0,r.jsx)(g.n,{icon:a7.A,strokeWidth:2})}),(0,r.jsxs)(rv,{align:"end",children:[(0,r.jsxs)(rb,{children:[(0,r.jsx)(rj,{children:"Delete Provider?"}),(0,r.jsx)(ry,{children:"This action cannot be undone."})]}),(0,r.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,r.jsx)(f,{disabled:v.isPending,type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),(0,r.jsxs)(f,{disabled:v.isPending,type:"button",variant:"destructive",onClick:()=>v.mutate(void 0,{onError:()=>{ed.add({title:"Provider could not be deleted",type:"error"})},onSuccess:()=>{c(!1),ed.add({title:"Provider deleted",type:"success"})}}),children:[v.isPending&&(0,r.jsx)(b,{"data-icon":"inline-start"}),(0,r.jsx)("span",{children:"Delete"})]})]})]})]})]})]}),p&&(0,r.jsx)(rV,{isOpen:!0,runtime:d.runtime,target:w,onOpenChange:x})]})}var rG=a(1656),rQ=a(2498),rZ=a(8474),r0=a(6447),r1=a(4976);async function r2(){let e,t,a=await fetch("/api/data/export",{cache:"no-store"});if(!a.ok)throw Error("The Foundry Server could not export data.");return{content:await a.blob(),filename:(e=a.headers.get("content-disposition"),t=e?.match(/filename="([^"]+\.foundry)"/u),t?.[1]??"foundry-export.foundry")}}async function r5(e){let t=await fetch("/api/data/import",{body:e,headers:{"content-type":"application/octet-stream"},method:"POST"});if(!t.ok)throw Error("The Foundry Server could not import data.");let a=await t.json();if("SUCCESS"!==a.status)throw Error(a.message??"The Foundry Server could not import data.");return a.data}let r4={dark:{icon:rG.A,label:"Dark"},light:{icon:rQ.A,label:"Light"},system:{icon:rZ.A,label:"System"}},r3=[{Component:function(){let e;return e=(0,j.I)({queryKey:K,queryFn:async()=>{if(200!==(await fetch("/api/health",{cache:"no-store"})).status)throw Error("Health check failed");return!0},networkMode:"always",staleTime:"static",gcTime:1/0,retry:!1,retryOnMount:!1,refetchOnMount:!1,refetchOnWindowFocus:!1,refetchOnReconnect:!1,refetchInterval:!1}),(0,n.useEffect)(()=>{document.title=H[e.status]},[e.status]),(0,r.jsx)(eb,{children:(0,r.jsx)(W.sv,{})})},children:[{index:!0,element:(0,r.jsx)(W.C5,{to:"/dashboard",replace:!0})},{Component:function(){let e=(0,ey.zy)(),t=(0,ey.Zp)(),a=function(e){for(let t of te)for(let a of t.items)if(a.href===e)return a.title;return"Foundry"}(e.pathname),n=function(e){for(let t of te)for(let a of t.items)if(a.href===e)return"description"in a?a.description:null;return null}(e.pathname),i=`${e.pathname}${e.search}${e.hash}`;return(0,r.jsxs)(eB,{children:[(0,r.jsx)(tt,{}),(0,r.jsxs)(eY,{children:[(0,r.jsxs)("header",{className:"flex h-10 shrink-0 items-center gap-2 px-3",children:[(0,r.jsx)(eJ,{"data-testid":"sidebar-trigger"}),(0,r.jsx)(ez,{orientation:"vertical",className:"h-4"}),(0,r.jsx)("span",{className:"text-xs font-medium","data-testid":"page-title",children:a}),n&&(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:n}),(0,r.jsx)(f,{variant:"ghost",size:"icon-sm",className:"ms-auto","aria-label":"Settings","data-testid":"settings-button",onClick:()=>t("/settings",{state:{returnTo:i}}),children:(0,r.jsx)(g.n,{icon:ej.A,strokeWidth:2})})]}),(0,r.jsx)(ez,{}),(0,r.jsx)("div",{className:"flex flex-1 p-4",children:(0,r.jsx)(W.sv,{})})]})]})},children:[{path:"dashboard",Component:function(){return(0,r.jsx)(to,{title:"Dashboard",description:"Dashboard content will be added here."})}},{path:"prompts",Component:function(){return(0,r.jsx)(to,{title:"Prompts",description:"Prompt management will be added here."})}},{path:"skills",Component:function(){return(0,r.jsx)(to,{title:"Skills",description:"Local skill management will be added here."})}},{path:"mcps",Component:function(){return(0,r.jsx)(to,{title:"MCPs",description:"MCP server management will be added here."})}},{path:"providers",Component:function(){let[e,t]=(0,$.ok)(),a=e.get("runtime"),i=rY(a)?a:"codex",s=aB(i),d=rE(),o=d.data?.find(e=>e.runtime===i&&e.managed)?.providerId,l=`/providers?runtime=${i}`;return(0,n.useEffect)(()=>{rY(a)||t({runtime:i},{replace:!0})},[a,i,t]),(0,r.jsxs)("main",{className:"flex w-full flex-col gap-5 pb-12",children:[(0,r.jsxs)("header",{className:"flex flex-wrap items-center justify-between gap-4",children:[(0,r.jsx)(aT,{"aria-label":"Provider Runtime",spacing:0,value:[i],variant:"outline",children:tc.map(e=>(0,r.jsx)(aF,{nativeButton:!1,render:(0,r.jsx)($.N_,{to:`/providers?runtime=${e}`}),value:e,children:(0,r.jsx)(tC,{runtime:e})},e))}),(0,r.jsxs)(f,{className:"ms-auto",nativeButton:!1,render:(0,r.jsx)($.N_,{to:"/providers/new",state:{returnTo:l}}),children:[(0,r.jsx)(g.n,{icon:a9.A,strokeWidth:2,"data-icon":"inline-start"}),"Add Provider"]})]}),s.isPending?(0,r.jsxs)("div",{className:"flex flex-col gap-4","aria-label":"Loading Providers",role:"status",children:[(0,r.jsx)(e$,{className:"h-20 w-full"}),(0,r.jsx)(e$,{className:"h-20 w-full"})]}):null,s.isError?(0,r.jsxs)(u,{variant:"destructive",children:[(0,r.jsx)(m,{children:"Providers could not be loaded"}),(0,r.jsx)(p,{children:"Check the Foundry Server and try again."})]}):null,s.data?.length===0?(0,r.jsx)(tr,{children:(0,r.jsxs)(tn,{children:[(0,r.jsxs)(ti,{children:["No"," ",tu[i]," ","Providers"]}),(0,r.jsx)(ts,{children:"Add a Provider to verify the creation and listing flow."})]})}):null,s.data&&s.data.length>0&&(0,r.jsx)("div",{className:"flex flex-col gap-4",children:s.data.map(e=>(0,r.jsx)(rX,{isEnabled:e.id===o,provider:e,returnTo:l},e.id))})]})}},{path:"runtimes",Component:function(){let e=rE();return e.isPending?(0,r.jsxs)("main",{className:"grid w-full self-start gap-4 md:grid-cols-2","aria-label":"Loading Runtimes",role:"status",children:[(0,r.jsx)(e$,{className:"h-80"}),(0,r.jsx)(e$,{className:"h-80"})]}):e.isError?(0,r.jsxs)(u,{variant:"destructive",children:[(0,r.jsx)(m,{children:"Runtimes could not be loaded"}),(0,r.jsx)(p,{children:"Check the Foundry Server and try again."})]}):(0,r.jsx)("main",{className:"grid w-full self-start items-start gap-4 pb-12 md:grid-cols-2","data-testid":"runtime-grid",children:e.data.map(t=>(0,r.jsx)(rJ,{summary:t,onDetect:()=>void e.refetch()},t.runtime))})}}]},{Component:function(){let e=(0,ey.zy)(),t="string"==typeof e.state?.returnTo?e.state.returnTo:"/dashboard";return(0,r.jsx)("div",{className:"min-h-svh p-4",children:(0,r.jsxs)("div",{className:"mx-auto flex min-h-[calc(100svh-2rem)] w-full max-w-2xl flex-col gap-4",children:[(0,r.jsxs)($.N_,{to:t,replace:!0,className:h({variant:"link",size:"sm",className:"-ms-2 self-start"}),"data-testid":"standalone-back",children:[(0,r.jsx)(g.n,{icon:ta.A,strokeWidth:2,"data-icon":"inline-start"}),"Back"]}),(0,r.jsx)("div",{className:"flex flex-1",children:(0,r.jsx)(W.sv,{})})]})})},children:[{path:"providers/new",Component:function(){return(0,r.jsx)(a2,{mode:"add"})}},{path:"providers/:providerId/edit",Component:function(){return(0,r.jsx)(a5,{mode:"edit"})}},{path:"providers/:providerId/copy",Component:function(){return(0,r.jsx)(a5,{mode:"copy"})}},{path:"settings",Component:function(){let e,t,[a,i]=(0,n.useState)(!1),[d,o]=(0,n.useState)(null),l=(0,n.useRef)(null),{theme:c}=function(){let e=n.useContext(z);if(!e)throw Error("useTheme must be used within a ThemeProvider");return e}(),x=(0,y.n)({mutationFn:r2}),h=(e=(0,s.jE)(),(0,y.n)({mutationFn:r5,onSuccess:async()=>{await Promise.all([e.invalidateQueries({queryKey:["providers"]}),e.invalidateQueries({queryKey:["settings"]})])}})),v=(t=(0,s.jE)(),(0,y.n)({mutationFn:C,onSuccess:e=>{t.setQueryData(w,e)}}));return(0,r.jsxs)("main",{className:"w-full pb-12",children:[(0,r.jsx)("header",{className:"pb-5",children:(0,r.jsx)("h1",{className:"text-xl font-semibold",children:"Settings"})}),(0,r.jsxs)("section",{"aria-labelledby":"color-mode-heading",className:"grid gap-4 border-y py-5 sm:grid-cols-[minmax(0,1fr)_auto] sm:items-center",children:[(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsx)("h2",{id:"color-mode-heading",className:"text-sm font-medium",children:"Color mode"}),(0,r.jsx)("p",{className:"text-xs/relaxed text-muted-foreground",children:"Match your system, or use light or dark mode."})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2 sm:flex-row-reverse",children:[(0,r.jsx)(aT,{"aria-label":"Color mode",disabled:v.isPending,spacing:0,value:[c],variant:"outline",onValueChange:e=>{var t;let a=e[0];a!==c&&void 0!==(t=a)&&tl.includes(t)&&v.mutate({colorMode:a})},children:tl.map(e=>{let t=r4[e];return(0,r.jsxs)(aF,{value:e,children:[(0,r.jsx)(g.n,{icon:t.icon,strokeWidth:2,"data-icon":"inline-start"}),t.label]},e)})}),(0,r.jsx)("span",{className:"grid size-4 place-items-center",children:v.isPending?(0,r.jsx)(b,{"aria-label":"Saving Color Mode"}):null})]}),v.isError?(0,r.jsxs)(u,{className:"sm:col-span-2",variant:"destructive",children:[(0,r.jsx)(m,{children:"Color Mode was not saved"}),(0,r.jsx)(p,{children:"Check the Foundry Server and try again."})]}):null]}),(0,r.jsxs)("section",{"aria-labelledby":"data-heading",className:"grid gap-4 border-b py-5 sm:grid-cols-[minmax(0,1fr)_auto] sm:items-center",children:[(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsx)("h2",{id:"data-heading",className:"text-sm font-medium",children:"Data"}),(0,r.jsx)("p",{className:"text-xs/relaxed text-muted-foreground",children:"Application Settings and all active Providers."})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("input",{ref:l,accept:".foundry,application/octet-stream",className:"hidden",type:"file",onChange:e=>{o(e.currentTarget.files?.[0]??null),e.currentTarget.value=""}}),(0,r.jsxs)(f,{disabled:h.isPending||x.isPending,type:"button",variant:"outline",onClick:()=>l.current?.click(),children:[(0,r.jsx)(g.n,{"data-icon":"inline-start",icon:r0.A,strokeWidth:2}),"Import Data"]}),(0,r.jsxs)(f,{disabled:h.isPending||x.isPending,type:"button",variant:"outline",onClick:()=>i(!0),children:[(0,r.jsx)(g.n,{"data-icon":"inline-start",icon:r1.A,strokeWidth:2}),"Export Data"]})]})]}),(0,r.jsx)(tD,{open:null!==d,onOpenChange:e=>{e||h.isPending||o(null)},children:(0,r.jsxs)(tU,{children:[(0,r.jsxs)(tW,{children:[(0,r.jsx)(tK,{children:"Import Foundry data?"}),(0,r.jsx)(tH,{children:"Application Settings will be replaced. Providers will be added, including duplicates."})]}),(0,r.jsxs)(t$,{children:[(0,r.jsx)(tB,{disabled:h.isPending,children:"Cancel"}),(0,r.jsxs)(tq,{disabled:h.isPending,onClick:()=>{d&&h.mutate(d,{onError:()=>{ed.add({title:"Data could not be imported",type:"error"})},onSuccess:e=>{let{modules:t}=e,a=t.some(e=>"imported"===e.status),r=t.some(e=>"imported"!==e.status);o(null),ed.add({description:t.map(e=>{let t=e.id;return("settings"===e.id?t="Settings":"providers"===e.id&&(t="Providers"),"unsupported"===e.status)?`${t} skipped`:"failed"===e.status?`${t} failed`:"providers"===e.id?`${e.importedItems} Providers added`:`${t} imported`}).join(". "),...r?a?{title:"Data imported with issues",type:"warning"}:{title:"Data could not be imported",type:"error"}:{title:"Data imported",type:"success"}})}})},children:[h.isPending&&(0,r.jsx)(b,{"data-icon":"inline-start"}),(0,r.jsx)("span",{children:"Import"})]})]})]})}),(0,r.jsx)(tD,{open:a,onOpenChange:e=>{x.isPending||i(e)},children:(0,r.jsxs)(tU,{children:[(0,r.jsxs)(tW,{children:[(0,r.jsx)(tK,{children:"Export Foundry data?"}),(0,r.jsx)(tH,{children:"The exported file includes Provider API keys. Keep it private and store it securely."})]}),(0,r.jsxs)(t$,{children:[(0,r.jsx)(tB,{disabled:x.isPending,children:"Cancel"}),(0,r.jsxs)(tq,{disabled:x.isPending,onClick:()=>{x.mutate(void 0,{onError:()=>{ed.add({title:"Data could not be exported",type:"error"})},onSuccess:e=>{let{content:t,filename:a}=e,r=URL.createObjectURL(t),n=document.createElement("a");n.download=a,n.href=r,document.body.append(n),n.click(),n.remove(),URL.revokeObjectURL(r),i(!1),ed.add({title:"Data exported",type:"success"})}})},children:[x.isPending&&(0,r.jsx)(b,{"data-icon":"inline-start"}),(0,r.jsx)("span",{children:"Export"})]})]})]})})]})}},{path:"*",Component:function(){let e=(0,ey.zy)();return(0,r.jsxs)(tr,{children:[(0,r.jsxs)(tn,{className:"max-w-md gap-3",children:[(0,r.jsx)("p",{"aria-hidden":"true",className:"font-mono text-7xl font-semibold tracking-tighter text-muted-foreground/20",children:"404"}),(0,r.jsx)("h1",{className:"font-heading text-xl font-semibold tracking-tight",children:"This page doesn't exist"}),(0,r.jsx)(ts,{children:"The address may be incorrect, or the page may have moved."})]}),(0,r.jsxs)(td,{className:"gap-4",children:[(0,r.jsxs)("p",{className:"flex max-w-full items-center gap-2 text-muted-foreground",children:[(0,r.jsx)("span",{children:"Requested path"}),(0,r.jsx)("code",{className:"max-w-64 truncate rounded-md bg-muted px-2 py-1 font-mono text-foreground",children:e.pathname})]}),(0,r.jsxs)(f,{nativeButton:!1,render:(0,r.jsx)($.N_,{to:"/dashboard","data-testid":"not-found-dashboard"}),children:[(0,r.jsx)(g.n,{icon:e4.A,strokeWidth:2,"data-icon":"inline-start"}),"Go to dashboard"]})]})]})}}]}]}],r6=(0,$.Ge)(r3),r8=document.getElementById("root");r8&&i.createRoot(r8).render((0,r.jsx)(n.StrictMode,{children:(0,r.jsx)(s.Ht,{client:U,children:(0,r.jsx)(function(e){let{children:t,disableTransitionOnChange:a=!0}=e,i=(0,j.I)({queryKey:w,queryFn:k,refetchOnWindowFocus:!1,retry:!1,staleTime:1/0}),s=i.data?.colorMode??"system",[d,o]=n.useState(E);return(n.useLayoutEffect(()=>{if(localStorage.removeItem("theme"),o(P(s,a)),"system"!==s)return;let e=window.matchMedia(_),t=()=>{o(P("system",a))};return e.addEventListener("change",t),()=>{e.removeEventListener("change",t)}},[a,s]),i.isPending)?(0,r.jsx)("div",{className:"grid min-h-svh place-items-center",children:(0,r.jsx)(b,{"aria-label":"Loading Foundry"})}):i.isError?(0,r.jsx)("main",{className:"grid min-h-svh place-items-center p-4",children:(0,r.jsxs)(u,{variant:"destructive",className:"max-w-sm",children:[(0,r.jsx)(m,{children:"Unable to load Foundry"}),(0,r.jsx)(p,{children:"Application Settings could not be loaded."}),(0,r.jsx)(f,{className:"mt-2 justify-self-start",size:"sm",variant:"outline",onClick:()=>i.refetch(),children:"Retry"})]})}):(0,r.jsx)(z.Provider,{value:{resolvedTheme:d,theme:s},children:t})},{children:(0,r.jsx)(function(e){let{delay:t=0,...a}=e;return(0,r.jsx)(A.B,{"data-slot":"tooltip-provider",delay:t,...a})},{children:(0,r.jsx)(d.p,{router:r6})})})})}))}},d={};function o(e){var t=d[e];if(void 0!==t)return t.exports;var a=d[e]={exports:{}};return s[e](a,a.exports,o),a.exports}o.m=s,t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,o.t=function(a,r){if(1&r&&(a=this(a)),8&r||"object"==typeof a&&a&&(4&r&&a.__esModule||16&r&&"function"==typeof a.then))return a;var n=Object.create(null);o.r(n);var i={};e=e||[null,t({}),t([]),t(t)];for(var s=2&r&&a;("object"==typeof s||"function"==typeof s)&&!~e.indexOf(s);s=t(s))Object.getOwnPropertyNames(s).forEach(e=>{i[e]=()=>a[e]});return i.default=()=>a,o.d(n,i),n},o.d=(e,t,a)=>{var r=(t,a)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,[a]:t[r]})};r(t,"get"),r(a,"value")},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a=[],o.O=(e,t,r,n)=>{if(t){n=n||0;for(var i=a.length;i>0&&a[i-1][2]>n;i--)a[i]=a[i-1];a[i]=[t,r,n];return}for(var s=1/0,i=0;i<a.length;i++){for(var[t,r,n]=a[i],d=!0,l=0;l<t.length;l++)(!1&n||s>=n)&&Object.keys(o.O).every(e=>o.O[e](t[l]))?t.splice(l--,1):(d=!1,n<s&&(s=n));if(d){a.splice(i--,1);var c=r();void 0!==c&&(e=c)}}return e},r={410:0},o.O.j=e=>0===r[e],n=(e,t)=>{var a,n,[i,s,d]=t,l=0;if(i.some(e=>0!==r[e])){for(a in s)o.o(s,a)&&(o.m[a]=s[a]);if(d)var c=d(o)}for(e&&e(t);l<i.length;l++)n=i[l],o.o(r,n)&&r[n]&&r[n][0](),r[n]=0;return o.O(c)},(i=self.rspackChunk_dhzh_foundry_app=self.rspackChunk_dhzh_foundry_app||[]).forEach(n.bind(null,0)),i.push=n.bind(null,i.push.bind(i));var l=o.O(void 0,["783","535","293"],()=>o(3861));l=o.O(l)})();
|