@dhzh/foundry 1.2.0 → 1.3.0
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 +176 -40
- package/dist/app/index.html +1 -1
- package/dist/app/static/css/index.b67a70b0c1.css +2 -0
- package/dist/app/static/js/293.20c8fa0618.js +2 -0
- package/dist/app/static/js/index.d282086870.js +1 -0
- package/dist/cli.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/package-Cr1rC-Jd.mjs +2 -0
- package/package.json +1 -1
- package/dist/app/static/css/index.65504d078c.css +0 -2
- package/dist/app/static/js/549.5972d30ce0.js +0 -2
- package/dist/app/static/js/index.bea5fb0f2b.js +0 -1
- package/dist/package-DreCfN5H.mjs +0 -2
- /package/dist/app/static/js/{549.5972d30ce0.js.LICENSE.txt → 293.20c8fa0618.js.LICENSE.txt} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(()=>{"use strict";var e,t,a,r,n,i,s={560(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 p(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 m(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 P(){return window.matchMedia(_).matches?"dark":"light"}function A(e,t){let a,r="system"===e?P():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 E=a(1402),S=a(3735),O=a(7958),T=a(3966),F=a(2918),M=a(9310),D=a(8288);function I(e){let{...t}=e;return(0,r.jsx)(S.s,{"data-slot":"tooltip",...t})}function L(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)(D.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 $=a(8071),K=a(6551);let W=["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),Q=a(6280),X=a(4038),G=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 ep(e){let{className:t,...a}=e;return(0,r.jsx)(Q.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 em(e){let{className:t,...a}=e;return(0,r.jsx)(X.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)(G.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)(ep,{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)(em,{}),(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 eP=a(1372),eA=a(3708),eE=a(3596),eS=a(6695),eO=a(6746),eT=a(5470),eF=a(94);function eM(e){let{...t}=e;return(0,r.jsx)(eP.D,{"data-slot":"sheet",...t})}function eD(e){let{...t}=e;return(0,r.jsx)(eA.Z,{"data-slot":"sheet-portal",...t})}function eI(e){let{className:t,...a}=e;return(0,r.jsx)(eE.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 eL(e){let{className:t,children:a,side:n="right",showCloseButton:i=!0,...s}=e;return(0,r.jsxs)(eD,{children:[(0,r.jsx)(eI,{}),(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 e$(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 eK(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 eW=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}(),[p,m]=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?m(e=>!e):g(e=>!e),[u,g,m]);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:p,setOpenMobile:m,toggleSidebar:v}),[b,f,g,u,p,m,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:p,setOpenMobile:m}=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:p,onOpenChange:m,...o,children:(0,r.jsxs)(eL,{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)(e$,{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:eW.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 eQ(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 eX(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 eG(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(),p=(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)(L,{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)(I,{children:[p,(0,r.jsx)(R,{side:"right",align:"center",hidden:"collapsed"!==u||c,...s})]})):p}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)(eQ,{children:te.map(t=>(0,r.jsxs)(eX,{children:[t.title&&(0,r.jsx)(eG,{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)(K.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=["image/png","image/jpeg","image/webp","image/svg+xml"],tp=["effort","xhigh_effort","max_effort","thinking","adaptive_thinking","interleaved_thinking"];var tm=a(1993),tx=a(324),th=a(5596);function tf(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 tg(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 tv=(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 tb(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)(tv({align:a}),t),onClick:e=>{e.target.closest("button")||e.currentTarget.parentElement?.querySelector("input")?.focus()},...n})}let tj=(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 ty(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)(tj({size:i}),t),...s})}function tw(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 tN(e){let{value:t,...a}=e,[i,s]=(0,n.useState)(!1);return(0,r.jsxs)(tg,{children:[(0,r.jsx)(tw,{...a,type:i?"text":"password",value:t}),(0,r.jsx)(tb,{align:"inline-end",children:(0,r.jsx)(ty,{"aria-label":i?"Hide API Key":"Show API Key",size:"icon-xs",onClick:()=>s(e=>!e),children:(0,r.jsx)(g.n,{icon:i?tx.A:th.A,strokeWidth:2})})})]})}var tk=a(6091);function tC(e){let{...t}=e;return(0,r.jsx)(tk.V,{"data-slot":"alert-dialog",...t})}function t_(e){let{...t}=e;return(0,r.jsx)(eA.Z,{"data-slot":"alert-dialog-portal",...t})}function tz(e){let{className:t,...a}=e;return(0,r.jsx)(eE.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 tP(e){let{className:t,size:a="default",...n}=e;return(0,r.jsxs)(t_,{children:[(0,r.jsx)(tz,{}),(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 tA(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 tE(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 tS(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 tO(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 tT(e){let{className:t,...a}=e;return(0,r.jsx)(f,{"data-slot":"alert-dialog-action",className:(0,l.cn)(t),...a})}function tF(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 tM=a(3384),tD=a(2529),tI=a(7908);function tL(e){let{className:t,size:a="default",...n}=e;return(0,r.jsx)(tM.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 tR(e){let{className:t,...a}=e;return(0,r.jsx)(tD.B,{"data-slot":"avatar-image",className:(0,l.cn)("aspect-square size-full rounded-full object-cover",t),...a})}function tU(e){let{className:t,...a}=e;return(0,r.jsx)(tI.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})}var t$=a(8978),tK=a(7612),tW=a(8716);function tH(e){let{className:t,...a}=e;return(0,r.jsx)(t$.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)(tK.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:tW.A,strokeWidth:2})})})}var tq=a(7904),tB=a(8893),tV=a(2874);function tJ(e){let{...t}=e;return(0,r.jsx)(tq.N,{"data-slot":"collapsible",...t})}function tY(e){let{...t}=e;return(0,r.jsx)(tB.R,{"data-slot":"collapsible-trigger",...t})}function tQ(e){let{...t}=e;return(0,r.jsx)(tV.j,{"data-slot":"collapsible-content",...t})}function tX(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 tG(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 tZ(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 t0(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 t1=(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 t2(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)(t1({orientation:a}),t),...n})}function t5(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 t4(e){let{children:t,className:a,required:n=!1,...i}=e;return(0,r.jsx)(tX,{"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 t3(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 t6(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 t8(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 t7=a(6549),t9=a(3574),ae=a(614),at=a(2120),aa=a(7914),ar=a(860),an=a(7004),ai=a(8402),as=a(5696),ad=a(4334),ao=a(7631),al=a(9025),ac=a(850),au=a(6960),ap=a(5174),am=a(5514),ax=a(6539);let ah=t7.H;function af(e){let{className:t,...a}=e;return(0,r.jsx)(t9.s,{"data-slot":"select-group",className:(0,l.cn)("scroll-my-1 p-1",t),...a})}function ag(e){let{className:t,...a}=e;return(0,r.jsx)(ae.y,{"data-slot":"select-value",className:(0,l.cn)("flex flex-1 text-start",t),...a})}function av(e){let{className:t,size:a="default",children:n,...i}=e;return(0,r.jsxs)(at.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)(aa.w,{render:(0,r.jsx)(g.n,{icon:ap.A,strokeWidth:2,className:"pointer-events-none size-3.5 text-muted-foreground"})})]})}function ab(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)(ar.V,{children:(0,r.jsx)(an.l,{side:n,sideOffset:i,align:s,alignOffset:d,alignItemWithTrigger:o,className:"isolate z-50",children:(0,r.jsxs)(ai.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)(ay,{}),(0,r.jsx)(as.B,{children:a}),(0,r.jsx)(aw,{})]})})})}function aj(e){let{className:t,children:a,...n}=e;return(0,r.jsxs)(ad.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)(ao.h,{className:"flex flex-1 shrink-0 gap-2 whitespace-nowrap",children:a}),(0,r.jsx)(al.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:tW.A,strokeWidth:2,className:"pointer-events-none"})})]})}function ay(e){let{className:t,...a}=e;return(0,r.jsx)(ac.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:am.A,strokeWidth:2})})}function aw(e){let{className:t,...a}=e;return(0,r.jsx)(au.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:ax.A,strokeWidth:2})})}var aN=a(3859),ak=a(712);let aC=(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"}}),a_=n.createContext({size:"default",variant:"default",spacing:2,orientation:"horizontal"});function az(e){let{className:t,variant:a,size:n,spacing:i=2,orientation:s="horizontal",children:d,...o}=e;return(0,r.jsx)(ak.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)(a_.Provider,{value:{variant:a,size:n,spacing:i,orientation:s},children:d})})}function aP(e){let{className:t,children:a,variant:i="default",size:s="default",...d}=e,o=n.useContext(a_);return(0,r.jsx)(aN.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",aC({variant:o.variant||i,size:o.size||s}),t),...d,children:a})}function aA(e){return["providers",e]}function aE(e){return["provider",e]}async function aS(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 aO(e){if(!e.ok)throw Error("The Foundry Server could not load Providers.");return(await e.json()).data}async function aT(e){return aO(await fetch(`/api/providers?runtime=${encodeURIComponent(e)}`,{cache:"no-store"}))}async function aF(e){return aS(await fetch(`/api/providers/${encodeURIComponent(e)}`,{cache:"no-store"}))}async function aM(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 aD(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 aI(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 aL(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 aR(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 aU(e){return(0,j.I)({queryKey:aA(e),queryFn:()=>aT(e),refetchOnWindowFocus:!1,retry:!1})}let a$={"claude-code":"Claude Code",codex:"Codex"},aK={adaptive_thinking:"Adaptive thinking",effort:"Effort",interleaved_thinking:"Interleaved thinking",max_effort:"Max effort",thinking:"Thinking",xhigh_effort:"XHigh effort"},aW=[{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 aH(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 aq(e){return{apiKey:e?.configuration.apiKey??"",baseUrl:e?.configuration.baseUrl??"",defaultModel:e?.configuration.defaultModel??"",reviewModel:e?.configuration.reviewModel??""}}function aB(e){return{description:e?.description??"",displayName:e?.displayName??"",model:e?.model??"",supportedCapabilities:e?.supportedCapabilities??[]}}function aV(e){let t=e?.configuration;return{apiKey:t?.apiKey??"",apiKeyHeader:t?.apiKeyHeader??"authorization",baseUrl:t?.baseUrl??"",fableModel:aB(t?.fableModel),haikuModel:aB(t?.haikuModel),opusModel:aB(t?.opusModel),defaultModel:t?.defaultModel??"",sonnetModel:aB(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 aJ(e){return e.trim()||null}function aY(e){let t=e.model.trim();return""===t?null:{description:aJ(e.description),displayName:aJ(e.displayName),model:t,supportedCapabilities:e.supportedCapabilities}}function aQ(e){let{id:t,label:a,value:n,onChange:i}=e,s=""!==n.model.trim();return(0,r.jsxs)(tG,{children:[(0,r.jsx)(tZ,{children:a}),(0,r.jsxs)(t0,{children:[(0,r.jsxs)("div",{className:"grid gap-4 sm:grid-cols-2",children:[(0,r.jsxs)(t2,{children:[(0,r.jsx)(t4,{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)(t2,{children:[(0,r.jsx)(t4,{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)(tJ,{children:[(0,r.jsxs)(tY,{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:tm.A,strokeWidth:2}),(0,r.jsx)("span",{children:"Advanced model options"})]}),(0,r.jsx)(tQ,{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)(t0,{children:[(0,r.jsxs)(t2,{children:[(0,r.jsx)(t4,{htmlFor:`${t}-description`,children:"Description"}),(0,r.jsx)(tf,{disabled:!s,id:`${t}-description`,maxLength:2e3,value:n.description,onChange:e=>i({...n,description:e.target.value})})]}),(0,r.jsxs)(t2,{children:[(0,r.jsx)(t4,{htmlFor:`${t}-capabilities`,children:"Supported capabilities"}),(0,r.jsxs)(ah,{disabled:!s,id:`${t}-capabilities`,multiple:!0,value:n.supportedCapabilities,onValueChange:e=>i({...n,supportedCapabilities:tp.filter(t=>e.includes(t))}),children:[(0,r.jsx)(av,{className:"w-full",children:(0,r.jsx)(ag,{children:()=>0===n.supportedCapabilities.length?"Select capabilities":n.supportedCapabilities.map(e=>aK[e]).join(", ")})}),(0,r.jsx)(ab,{align:"start",children:(0,r.jsx)(af,{children:tp.map(e=>(0,r.jsx)(aj,{value:e,children:aK[e]},e))})})]})]})]})})})]})]})]})}function aX(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:aM,onSuccess:e=>{i.setQueryData(aA(e.runtime),t=>[e,...t??[]])}})),v=(t=c?.id??"",d=(0,s.jE)(),(0,y.n)({mutationFn:e=>aI(t,e),onSuccess:e=>{d.setQueryData(aA(e.runtime),t=>t?[e,...t]:[e])}})),j=(a=c?.id??"",o=(0,s.jE)(),(0,y.n)({mutationFn:e=>aD(a,e),onSuccess:e=>{o.removeQueries({exact:!0,queryKey:aE(e.id)}),o.setQueryData(aA(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),[P,A]=(0,n.useState)(null),[E,S]=(0,n.useState)(()=>aH(c,w)),[O,T]=(0,n.useState)(()=>aq(k)),[F,M]=(0,n.useState)(()=>aV(C)),[D,U]=(0,n.useState)(null),$=(0,n.useRef)(null),W="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(E)!==JSON.stringify(aH(c,w))||"codex"===_&&JSON.stringify(O)!==JSON.stringify(aq(k))||"claude-code"===_&&JSON.stringify(F)!==JSON.stringify(aV(C)),J=g.isError||v.isError||j.isError,Y=g.isPending||v.isPending||j.isPending,Q="Add Provider",X="Choose the Runtime this Provider can be applied to.",G="Add Provider";N?(Q="Edit Provider",X="A Provider Runtime cannot be changed after creation.",G="Save Changes"):w&&(Q="Create from Provider",X="A copy keeps the source Provider Runtime.",G="Create Provider");let Z=e=>{S(aH()),T(aq()),M(aV()),U(null),g.reset(),v.reset(),j.reset(),z(e),A(null)},ee=async e=>{if(!e){S(e=>({...e,avatar:null})),U(null);return}if(!tu.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:Q})}),(0,r.jsx)("form",{onSubmit:e=>{let t;if(e.preventDefault(),null===_||null!==D)return;if("codex"===_)t={avatar:E.avatar,configuration:{apiKey:O.apiKey||null,baseUrl:O.baseUrl,defaultModel:O.defaultModel,protocol:"responses",reviewModel:aJ(O.reviewModel)},name:E.name,officialWebsite:aJ(E.officialWebsite),remark:aJ(E.remark),runtime:_};else{let e=F.defaultModel.trim();if(""===e)return;t={avatar:E.avatar,configuration:{apiKey:F.apiKey,apiKeyHeader:F.apiKeyHeader,baseUrl:F.baseUrl,fableModel:aY(F.fableModel),haikuModel:aY(F.haikuModel),opusModel:aY(F.opusModel),defaultModel:e,protocol:"messages",sonnetModel:aY(F.sonnetModel),subagentModel:aJ(F.subagentModel),subagentModelForce:F.subagentModelForce,hideAiAttribution:F.hideAiAttribution,teammatesMode:F.teammatesMode,enableToolSearch:F.enableToolSearch,maxEffortThinking:F.maxEffortThinking,disableAutoUpdater:F.disableAutoUpdater},name:E.name,officialWebsite:aJ(E.officialWebsite),remark:aJ(E.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)(t0,{children:[(0,r.jsxs)(t2,{children:[(0,r.jsx)(t4,{required:!0,children:"Runtime"}),(0,r.jsx)(az,{"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 A(e);Z(e)}})(t)},children:tc.map(e=>(0,r.jsx)(aP,{value:e,children:a$[e]},e))}),(0,r.jsx)(t3,{children:X})]}),null===_?(0,r.jsxs)(u,{children:[(0,r.jsx)(p,{children:"Choose a Runtime"}),(0,r.jsx)(m,{children:"Provider fields appear after a Runtime is selected."})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t6,{children:"Provider"}),(0,r.jsxs)(t2,{children:[(0,r.jsx)(t4,{htmlFor:"provider-name",required:!0,children:"Name"}),(0,r.jsx)(eC,{id:"provider-name",maxLength:100,required:!0,value:E.name,onChange:e=>S({...E,name:e.target.value})})]}),(0,r.jsxs)(t2,{"data-invalid":null!==D||void 0,children:[(0,r.jsx)(t4,{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:()=>$.current?.click(),children:(0,r.jsxs)(tL,{size:"lg",children:[E.avatar?(0,r.jsx)(tR,{alt:"Provider avatar preview",src:`data:${E.avatar.mimeType};base64,${E.avatar.data}`}):null,(0,r.jsx)(tU,{children:E.name.trim().charAt(0)||"P"})]})}),(0,r.jsx)(f,{disabled:null===E.avatar,type:"button",variant:"outline",onClick:()=>{S(e=>({...e,avatar:null})),U(null),$.current&&($.current.value="")},children:"Remove avatar"}),(0,r.jsx)(eC,{accept:tu.join(","),"aria-invalid":null!==D||void 0,className:"sr-only size-px",id:"provider-avatar",ref:$,type:"file",onChange:e=>{ee(e.target.files?.[0])}})]}),(0,r.jsx)(t3,{children:"Click the avatar to choose a PNG, JPEG, WebP, or SVG up to 2 MB."}),(0,r.jsx)(t8,{children:D})]}),(0,r.jsxs)(t2,{children:[(0,r.jsx)(t4,{htmlFor:"provider-website",children:"Official website"}),(0,r.jsx)(eC,{id:"provider-website",maxLength:2048,placeholder:"https://example.com",type:"url",value:E.officialWebsite,onChange:e=>S({...E,officialWebsite:e.target.value})})]}),(0,r.jsxs)(t2,{children:[(0,r.jsx)(t4,{htmlFor:"provider-remark",children:"Remark"}),(0,r.jsx)(tf,{id:"provider-remark",maxLength:2e3,value:E.remark,onChange:e=>S({...E,remark:e.target.value})})]}),(0,r.jsx)(t6,{children:"Connection"}),(0,r.jsxs)(t2,{children:[(0,r.jsx)(t4,{htmlFor:"provider-protocol",children:"Protocol"}),(0,r.jsx)(eC,{id:"provider-protocol",readOnly:!0,value:"codex"===_?"Responses API":"Anthropic Messages API"})]}),(0,r.jsxs)(t2,{children:[(0,r.jsx)(t4,{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)(t2,{children:[(0,r.jsx)(t4,{required:!0,children:"Authentication method"}),(0,r.jsxs)(az,{"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)(I,{children:[(0,r.jsx)(L,{render:(0,r.jsx)(aP,{value:"authorization"}),children:"Auth Token"}),(0,r.jsx)(R,{children:(0,r.jsx)("code",{className:"font-mono",children:"Authorization: Bearer <xxx>"})})]}),(0,r.jsxs)(I,{children:[(0,r.jsx)(L,{render:(0,r.jsx)(aP,{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)(t2,{children:[(0,r.jsx)(t4,{htmlFor:"provider-api-key",required:q,children:W}),(0,r.jsx)(tN,{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)(t3,{children:"Leave blank only when the endpoint accepts requests without credentials."})]}),"codex"===_?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t6,{children:"Models"}),(0,r.jsxs)(t2,{children:[(0,r.jsx)(t4,{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)(t2,{children:[(0,r.jsx)(t4,{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)(t6,{children:"Models"}),(0,r.jsxs)(t2,{children:[(0,r.jsx)(t4,{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)(aQ,{id:`claude-${t}`,label:a,value:F[t],onChange:e=>M({...F,[t]:e})},t)}),(0,r.jsxs)(t2,{children:[(0,r.jsx)(t4,{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)(t2,{"data-disabled":!H,orientation:"horizontal",children:[(0,r.jsx)(tH,{checked:F.subagentModelForce,disabled:!H,id:"claude-subagent-model-force",onCheckedChange:e=>M({...F,subagentModelForce:e})}),(0,r.jsxs)(t5,{children:[(0,r.jsx)(t4,{htmlFor:"claude-subagent-model-force",children:"Force subagent model"}),(0,r.jsx)(t3,{children:"Force Claude Code to use the configured subagent model."})]})]}),(0,r.jsx)(t6,{children:"Others"}),(0,r.jsxs)(tG,{children:[(0,r.jsx)(tZ,{className:"sr-only",children:"Other Claude Code options"}),(0,r.jsx)(t0,{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:aW.map(e=>{let t=`claude-${e.key}`;return(0,r.jsxs)(t2,{className:"min-w-0",orientation:"horizontal",children:[(0,r.jsx)(tH,{checked:F[e.key],id:t,onCheckedChange:t=>M({...F,[e.key]:t})}),(0,r.jsxs)(t5,{className:"min-w-0",children:[(0,r.jsx)(t4,{htmlFor:t,children:e.label}),(0,r.jsx)(t3,{children:e.description})]})]},e.key)})})]})]}),J?(0,r.jsxs)(u,{variant:"destructive",children:[(0,r.jsx)(p,{children:"Provider was not saved"}),(0,r.jsx)(m,{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)(K.N_,{to:B,replace:!0}),variant:"outline",children:"Cancel"}),(0,r.jsxs)(f,{disabled:Y||null!==D,type:"submit",children:[Y?(0,r.jsx)(b,{"data-icon":"inline-start"}):null,(0,r.jsx)("span",{children:G})]})]})]})]})},_??"unselected"),(0,r.jsx)(tC,{open:null!==P,onOpenChange:e=>{e||A(null)},children:(0,r.jsxs)(tP,{children:[(0,r.jsxs)(tA,{children:[(0,r.jsx)(tS,{children:"Change Runtime?"}),(0,r.jsx)(tO,{children:"Changing the Runtime will clear the information you've entered."})]}),(0,r.jsxs)(tE,{children:[(0,r.jsx)(tF,{children:"Cancel"}),(0,r.jsx)(tT,{onClick:()=>{P&&Z(P)},children:"Change Runtime"})]})]})})]})}function aG(e){let{mode:t}=e,{providerId:a=""}=(0,ey.g)(),n=(0,j.I)({queryKey:aE(a),queryFn:()=>aF(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)(eK,{className:"h-96 w-full"})}):n.isError?(0,r.jsxs)(u,{variant:"destructive",children:[(0,r.jsx)(p,{children:"Provider could not be loaded"}),(0,r.jsx)(m,{children:n.error.message})]}):(0,r.jsx)(aX,{mode:t,provider:n.data})}var aZ=a(348),a0=a(6989),a1=a(5817),a2=a(8727),a5=a(7414),a4=a(1721);let a3=(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 a6(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)(a3({variant:a}),t)},n),render:r,state:{slot:"badge",variant:a}})}function a8(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 a7(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 a9(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 re(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 rt(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 ra(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 rr(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 rn=a(9603),ri=a(1343),rs=a(1374),rd=a(554),ro=a(5921),rl=a(4310),rc=a(9150);function ru(e){let{...t}=e;return(0,r.jsx)(rn.y,{"data-slot":"popover",...t})}function rp(e){let{...t}=e;return(0,r.jsx)(ri.W,{"data-slot":"popover-trigger",...t})}function rm(e){let{className:t,align:a="center",alignOffset:n=0,side:i="bottom",sideOffset:s=4,...d}=e;return(0,r.jsx)(rs.i,{children:(0,r.jsx)(rd.U,{align:a,alignOffset:n,side:i,sideOffset:s,className:"isolate z-50",children:(0,r.jsx)(ro.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 rx(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 rh(e){let{className:t,...a}=e;return(0,r.jsx)(rl.e,{"data-slot":"popover-title",className:(0,l.cn)("text-sm font-medium",t),...a})}function rf(e){let{className:t,...a}=e;return(0,r.jsx)(rc.u,{"data-slot":"popover-description",className:(0,l.cn)("text-muted-foreground",t),...a})}let rg=["runtimes"];class rv extends Error{}async function rb(e,t){if(!e.ok)throw new rv(t);let a=await e.json();if("SUCCESS"!==a.status||null===a.data)throw new rv(a.message??t);return a.data}async function rj(){return rb(await fetch("/api/runtimes",{cache:"no-store"}),"The Foundry Server could not load Runtimes.")}async function ry(e,t){return rb(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 rw(e,t){return rb(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 rN(){return(0,j.I)({queryKey:rg,queryFn:rj,refetchOnWindowFocus:!1,retry:!1})}function rk(e){let{...t}=e;return(0,r.jsx)(eP.D,{"data-slot":"dialog",...t})}function rC(e){let{...t}=e;return(0,r.jsx)(eA.Z,{"data-slot":"dialog-portal",...t})}function r_(e){let{className:t,...a}=e;return(0,r.jsx)(eE.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 rz(e){let{className:t,children:a,showCloseButton:n=!0,...i}=e;return(0,r.jsxs)(rC,{children:[(0,r.jsx)(r_,{}),(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 rP(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 rA(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 rE(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 rS(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 rO="official-default",rT={"claude-code":"Claude Code",codex:"Codex"},rF={"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"],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"]};function rM(e,t){ed.add({description:e instanceof rv?e.message:"An unexpected error occurred.",priority:"high",title:t,type:"error"})}function rD(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?tx.A:th.A,strokeWidth:2})})]})}function rI(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)(rD,{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)(rD,{value:t.proposed})]})]})}function rL(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)(rI,{field:e},e.key))})}function rR(e){let{runtime:t}=e,a=rF[t];return(0,r.jsx)(tJ,{children:(0,r.jsxs)("div",{className:"rounded-md border bg-muted/20",children:[(0,r.jsxs)(tY,{render:(0,r.jsx)(f,{className:"h-auto w-full justify-between px-3 py-2",variant:"ghost"}),children:[(0,r.jsxs)("span",{className:"text-start",children:[(0,r.jsx)("span",{className:"block font-medium",children:"Foundry managed fields"}),(0,r.jsx)("span",{className:"block font-normal text-muted-foreground",children:"Static display reference only"})]}),(0,r.jsx)("span",{className:"text-muted-foreground",children:a.length})]}),(0,r.jsx)(tQ,{className:"border-t px-3 py-3",children:(0,r.jsx)("div",{className:"flex max-h-64 flex-col gap-1 overflow-y-auto",children:a.map(e=>(0,r.jsx)("code",{className:"break-all rounded bg-muted px-2 py-1 text-[0.6875rem]",children:e},e))})})]})})}function rU(e){let t,{isOpen:a,runtime:i,target:d,onOpenChange:o}=e,l=(0,y.n)({mutationFn:e=>ry(i,e)}),c=(t=(0,s.jE)(),(0,y.n)({mutationFn:e=>rw(i,e),onSuccess:e=>{t.setQueryData(rg,t=>t?.map(t=>t.runtime===e.runtime?e:t))}})),u=l.mutate,[p,m]=(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=>rM(e,"Preview failed"),onSuccess:e=>{"provider-key-selection"===e.kind&&m(e.providerKeys)}})},v=l.data,j=v?.kind==="ready"?v:null;return(0,n.useEffect)(()=>{u({target:d},{onError:e=>rM(e,"Preview failed"),onSuccess:e=>{"provider-key-selection"===e.kind&&m(e.providerKeys)}})},[u,d]),(0,r.jsx)(rk,{open:a,onOpenChange:o,children:(0,r.jsxs)(rz,{className:"max-h-[85vh] overflow-y-auto sm:max-w-3xl",children:[(0,r.jsxs)(rP,{children:[(0,r.jsx)(rE,{children:"Preview Changes"}),(0,r.jsx)(rS,{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})]}),p.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)(ah,{id:`${i}-provider-key`,value:x,onValueChange:e=>{e&&(h(e),g(e))},children:[(0,r.jsx)(av,{className:"w-full",children:(0,r.jsx)(ag,{placeholder:"Select a Provider key"})}),(0,r.jsx)(ab,{align:"start",children:(0,r.jsx)(af,{children:p.map(e=>(0,r.jsx)(aj,{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)(rL,{fields:j.changes})]}),(0,r.jsxs)(tJ,{children:[(0,r.jsxs)(tY,{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)(tQ,{className:"pt-2",children:(0,r.jsx)(rL,{fields:j.unchanged})})]})]})]}),(0,r.jsxs)(rA,{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=>rM(e,"Apply failed"),onSuccess:()=>{ed.add({description:`${rT[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 r$(e){let{summary:t,onDetect:a}=e,i=aU(t.runtime),s=t.managed&&t.providerId?t.providerId:rO,[d,o]=(0,n.useState)(s),[l,c]=(0,n.useState)(!1),x=(0,n.useMemo)(()=>d===rO?{kind:"official-default"}:{kind:"provider",providerId:d},[d]),h=t.detection,g="detected"===h.status;return(0,r.jsxs)(a8,{children:[(0,r.jsxs)(a7,{children:[(0,r.jsx)(a9,{children:rT[t.runtime]}),(0,r.jsx)(re,{children:t.managed?null===t.providerId?"Managed by Foundry · Official Default":"Managed by Foundry":"Not managed by Foundry"}),(0,r.jsx)(rt,{children:(0,r.jsx)("span",{className:g?"text-emerald-600":"text-destructive",children:g?"Detected":"Not detected"})})]}),(0,r.jsxs)(ra,{className:"flex flex-col gap-4",children:[(0,r.jsxs)("dl",{className:"grid gap-2 text-muted-foreground sm:grid-cols-2",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("dt",{children:"Version"}),(0,r.jsx)("dd",{className:"font-mono text-foreground",children:h.version??"Unavailable"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("dt",{children:"Configuration"}),(0,r.jsx)("dd",{className:"break-all font-mono text-foreground",children:h.configurationPath})]})]}),h.message&&(0,r.jsxs)(u,{variant:"destructive",children:[(0,r.jsx)(p,{children:"Runtime unavailable"}),(0,r.jsx)(m,{children:h.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)(ah,{id:`${t.runtime}-provider`,value:d,onValueChange:e=>e&&o(e),children:[(0,r.jsx)(av,{className:"w-full",children:(0,r.jsx)(ag,{})}),(0,r.jsx)(ab,{align:"start",children:(0,r.jsxs)(af,{children:[(0,r.jsx)(aj,{value:rO,children:"Official Default"}),i.data?.map(e=>(0,r.jsx)(aj,{value:e.id,children:e.name},e.id))]})})]})]}),(0,r.jsx)(rR,{runtime:t.runtime})]}),(0,r.jsxs)(rr,{className:"justify-end gap-2",children:[(0,r.jsx)(f,{variant:"outline",onClick:a,children:"Detect Again"}),(0,r.jsx)(f,{disabled:!g||i.isPending,onClick:()=>c(!0),children:"Save"})]}),l&&(0,r.jsx)(rU,{isOpen:!0,runtime:t.runtime,target:x,onOpenChange:c})]})}let rK={"claude-code":"Claude Code",codex:"Codex"};function rW(e){return null!==e&&tc.includes(e)}function rH(e){var t;let a,{isEnabled:i,provider:d,returnTo:o}=e,[l,c]=(0,n.useState)(!1),[u,p]=(0,n.useState)(null),[m,x]=(0,n.useState)(!1),v=(a=(0,s.jE)(),(0,y.n)({mutationFn:()=>aL(d.id),onSuccess:()=>{a.removeQueries({exact:!0,queryKey:aE(d.id)}),a.setQueryData(aA(d.runtime),e=>e?.filter(e=>e.id!==d.id))}})),j=(t=d.id,(0,y.n)({mutationFn:()=>aR(t)})),w=(0,n.useMemo)(()=>({kind:"provider",providerId:d.id}),[d.id]);return(0,r.jsxs)(a8,{"data-testid":`provider-${d.id}`,size:"sm",children:[(0,r.jsxs)(a7,{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.jsxs)(tL,{size:"lg",children:[d.avatar?(0,r.jsx)(tR,{alt:"",src:`data:${d.avatar.mimeType};base64,${d.avatar.data}`}):null,(0,r.jsx)(tU,{children:d.name.charAt(0)||"P"})]}),(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)(a9,{className:"truncate",children:d.name}),i&&(0,r.jsx)(a6,{variant:"secondary",children:"In Use"})]}),(0,r.jsx)(re,{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:aZ.A,strokeWidth:2})]})})]})]}),(0,r.jsxs)(rt,{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)(I,{children:[(0,r.jsx)(L,{render:(0,r.jsx)(K.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:a0.A,strokeWidth:2})}),(0,r.jsx)(R,{children:"Edit"})]}),(0,r.jsxs)(I,{children:[(0,r.jsx)(L,{render:(0,r.jsx)(K.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:a1.A,strokeWidth:2})}),(0,r.jsx)(R,{children:"Copy"})]}),(0,r.jsxs)(ru,{open:null!==u,onOpenChange:e=>{e||p(null)},children:[(0,r.jsxs)(I,{children:[(0,r.jsx)(rp,{render:(0,r.jsx)(L,{render:(0,r.jsx)(f,{"aria-label":`Test ${d.name} connection`,disabled:j.isPending,size:"icon",type:"button",variant:"ghost",onClick:()=>{p(null),j.mutate(void 0,{onError:e=>{p(e.message)},onSuccess:()=>{ed.add({title:"Connection successful",type:"success"})}})}})}),children:j.isPending?(0,r.jsx)(b,{}):(0,r.jsx)(g.n,{icon:a2.A,strokeWidth:2})}),(0,r.jsx)(R,{children:"Test connection"})]}),(0,r.jsxs)(rm,{align:"end",children:[(0,r.jsxs)(rx,{children:[(0,r.jsx)(rh,{children:"Connection failed"}),(0,r.jsx)(rf,{className:"wrap-break-word",children:u})]}),(0,r.jsx)("div",{className:"flex justify-end",children:(0,r.jsx)(f,{type:"button",variant:"outline",onClick:()=>p(null),children:"Close"})})]})]}),i?(0,r.jsxs)(I,{children:[(0,r.jsx)(L,{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:a5.A,strokeWidth:2})}),(0,r.jsx)(R,{children:"Provider is in use"})]}):(0,r.jsxs)(ru,{open:l,onOpenChange:c,children:[(0,r.jsx)(rp,{render:(0,r.jsx)(f,{"aria-label":`Delete ${d.name}`,size:"icon",type:"button",variant:"destructive"}),children:(0,r.jsx)(g.n,{icon:a5.A,strokeWidth:2})}),(0,r.jsxs)(rm,{align:"end",children:[(0,r.jsxs)(rx,{children:[(0,r.jsx)(rh,{children:"Delete Provider?"}),(0,r.jsx)(rf,{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"})]})]})]})]})]})]}),m&&(0,r.jsx)(rU,{isOpen:!0,runtime:d.runtime,target:w,onOpenChange:x})]})}var rq=a(1656),rB=a(2498),rV=a(8474),rJ=a(6447),rY=a(4976);async function rQ(){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 rX(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 rG={dark:{icon:rq.A,label:"Dark"},light:{icon:rB.A,label:"Light"},system:{icon:rV.A,label:"System"}},rZ=[{Component:function(){let e;return e=(0,j.I)({queryKey:W,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)($.sv,{})})},children:[{index:!0,element:(0,r.jsx)($.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)($.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,K.ok)(),a=e.get("runtime"),i=rW(a)?a:"codex",s=aU(i),d=rN(),o=d.data?.find(e=>e.runtime===i&&e.managed)?.providerId,l=`/providers?runtime=${i}`;return(0,n.useEffect)(()=>{rW(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)(az,{"aria-label":"Provider Runtime",spacing:0,value:[i],variant:"outline",children:tc.map(e=>(0,r.jsx)(aP,{nativeButton:!1,render:(0,r.jsx)(K.N_,{to:`/providers?runtime=${e}`}),value:e,children:rK[e]},e))}),(0,r.jsxs)(f,{className:"ms-auto",nativeButton:!1,render:(0,r.jsx)(K.N_,{to:"/providers/new",state:{returnTo:l}}),children:[(0,r.jsx)(g.n,{icon:a4.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)(eK,{className:"h-20 w-full"}),(0,r.jsx)(eK,{className:"h-20 w-full"})]}):null,s.isError?(0,r.jsxs)(u,{variant:"destructive",children:[(0,r.jsx)(p,{children:"Providers could not be loaded"}),(0,r.jsx)(m,{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"," ",rK[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)(rH,{isEnabled:e.id===o,provider:e,returnTo:l},e.id))})]})}},{path:"runtimes",Component:function(){let e=rN();return e.isPending?(0,r.jsxs)("main",{className:"grid gap-4 md:grid-cols-2","aria-label":"Loading Runtimes",role:"status",children:[(0,r.jsx)(eK,{className:"h-80"}),(0,r.jsx)(eK,{className:"h-80"})]}):e.isError?(0,r.jsxs)(u,{variant:"destructive",children:[(0,r.jsx)(p,{children:"Runtimes could not be loaded"}),(0,r.jsx)(m,{children:"Check the Foundry Server and try again."})]}):(0,r.jsx)("main",{className:"grid gap-4 pb-12 md:grid-cols-2",children:e.data.map(t=>(0,r.jsx)(r$,{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)(K.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)($.sv,{})})]})})},children:[{path:"providers/new",Component:function(){return(0,r.jsx)(aX,{mode:"add"})}},{path:"providers/:providerId/edit",Component:function(){return(0,r.jsx)(aG,{mode:"edit"})}},{path:"providers/:providerId/copy",Component:function(){return(0,r.jsx)(aG,{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:rQ}),h=(e=(0,s.jE)(),(0,y.n)({mutationFn:rX,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)(az,{"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=rG[e];return(0,r.jsxs)(aP,{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)(p,{children:"Color Mode was not saved"}),(0,r.jsx)(m,{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:rJ.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:rY.A,strokeWidth:2}),"Export Data"]})]})]}),(0,r.jsx)(tC,{open:null!==d,onOpenChange:e=>{e||h.isPending||o(null)},children:(0,r.jsxs)(tP,{children:[(0,r.jsxs)(tA,{children:[(0,r.jsx)(tS,{children:"Import Foundry data?"}),(0,r.jsx)(tO,{children:"Application Settings will be replaced. Providers will be added, including duplicates."})]}),(0,r.jsxs)(tE,{children:[(0,r.jsx)(tF,{disabled:h.isPending,children:"Cancel"}),(0,r.jsxs)(tT,{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)(tC,{open:a,onOpenChange:e=>{x.isPending||i(e)},children:(0,r.jsxs)(tP,{children:[(0,r.jsxs)(tA,{children:[(0,r.jsx)(tS,{children:"Export Foundry data?"}),(0,r.jsx)(tO,{children:"The exported file includes Provider API keys. Keep it private and store it securely."})]}),(0,r.jsxs)(tE,{children:[(0,r.jsx)(tF,{disabled:x.isPending,children:"Cancel"}),(0,r.jsxs)(tT,{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)(K.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"]})]})]})}}]}]}],r0=(0,K.Ge)(rZ),r1=document.getElementById("root");r1&&i.createRoot(r1).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(P);return(n.useLayoutEffect(()=>{if(localStorage.removeItem("theme"),o(A(s,a)),"system"!==s)return;let e=window.matchMedia(_),t=()=>{o(A("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)(p,{children:"Unable to load Foundry"}),(0,r.jsx)(m,{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)(E.B,{"data-slot":"tooltip-provider",delay:t,...a})},{children:(0,r.jsx)(d.p,{router:r0})})})})}))}},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","549"],()=>o(560));l=o.O(l)})();
|
|
File without changes
|