@miravo/cli-linux-arm64-musl 0.7.5 → 0.7.7
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/console-dist/assets/{api-D8oAzcVE.js → api-CrYvIV3A.js} +1 -1
- package/console-dist/assets/catalog-CMdsHJtX.js +1 -0
- package/console-dist/assets/catalog-DCLloXKb.js +1 -0
- package/console-dist/assets/catalog-source-B3vWR4vX.js +1 -0
- package/console-dist/assets/control-6TWF0ywx.js +1 -0
- package/console-dist/assets/control-C_0G31vu.js +1 -0
- package/console-dist/assets/{events-CeR9wTII.js → events--facGImw.js} +1 -1
- package/console-dist/assets/events-D7PCqbvy.js +1 -0
- package/console-dist/assets/fleet-DmMO3ebD.js +1 -0
- package/console-dist/assets/{fleet-CH141gbg.js → fleet-anqPXBbM.js} +1 -1
- package/console-dist/assets/get-error-message-BgE2BpPG.js +1 -0
- package/console-dist/assets/index-BNGYKshE.css +2 -0
- package/console-dist/assets/{index-ClSUHPGP.js → index-Dmyw65xM.js} +3 -3
- package/console-dist/assets/{instance-detail-DWELGCE1.js → instance-detail-CDK2JYdW.js} +1 -1
- package/console-dist/assets/{login-C5dQKX2Y.js → login-H82N0S2O.js} +1 -1
- package/console-dist/assets/models-B7FNHSvb.js +1 -0
- package/console-dist/assets/models-Bmif9sIG.js +1 -0
- package/console-dist/assets/platforms-DGpl5tPh.js +1 -0
- package/console-dist/assets/platforms-Djfu2pyM.js +1 -0
- package/console-dist/assets/query-fetch-error-BWenDoLQ.js +1 -0
- package/console-dist/assets/route-preload-CLRbqehb.js +2 -0
- package/console-dist/assets/tags-dBHY56Fz.js +1 -0
- package/console-dist/assets/tags-zenGXuzO.js +4 -0
- package/console-dist/assets/{transition-nav-link-Ct6VIy2S.js → transition-nav-link-BWSxzHUf.js} +1 -1
- package/console-dist/assets/{use-engine-command-mutation-CcfqRB7j.js → use-engine-command-mutation-CT_3rCP3.js} +1 -1
- package/console-dist/assets/use-platform-stream-QBU2PAD2.js +2 -0
- package/console-dist/assets/{use-transition-navigate-jTHkLHMS.js → use-transition-navigate-Br9xwrqi.js} +1 -1
- package/console-dist/assets/{validation-DRj8OKvB.js → validation-pFKbjwNg.js} +1 -1
- package/console-dist/index.html +19 -19
- package/miravo +0 -0
- package/package.json +1 -1
- package/console-dist/assets/catalog-B70TugE6.js +0 -1
- package/console-dist/assets/catalog-B_wh8kje.js +0 -1
- package/console-dist/assets/catalog-source-BU77f8QO.js +0 -1
- package/console-dist/assets/control-CaFfl-Mp.js +0 -1
- package/console-dist/assets/control-DCNd1A3U.js +0 -1
- package/console-dist/assets/events-BjMeLN1K.js +0 -1
- package/console-dist/assets/fleet-C9wGf070.js +0 -1
- package/console-dist/assets/get-error-message-Dk8elqEP.js +0 -1
- package/console-dist/assets/index-D1lU9Fg9.css +0 -2
- package/console-dist/assets/models-CFdqSxB3.js +0 -1
- package/console-dist/assets/models-hAhKpuYB.js +0 -1
- package/console-dist/assets/platforms-Bh63oQIi.js +0 -1
- package/console-dist/assets/platforms-BwYPf2Sg.js +0 -1
- package/console-dist/assets/query-fetch-error-NbPqVPRR.js +0 -1
- package/console-dist/assets/route-preload-DQgHHtBj.js +0 -2
- package/console-dist/assets/tags-BI93Dvh2.js +0 -4
- package/console-dist/assets/tags-_ufsHpn5.js +0 -1
- package/console-dist/assets/use-platform-stream-DBZo6HMM.js +0 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{at as n}from"./vendor-ui-CWUk2ulb.js";import{S as r,b as i,o as a}from"./api-CrYvIV3A.js";import{i as o,t as s}from"./query-fetch-error-BWenDoLQ.js";import{t as c}from"./proxy-Be4WzmcS.js";import{t as l}from"./AnimatePresence-CPmH1DMY.js";import{a as u,i as d,l as f,n as p,o as m,r as h,s as g,t as _}from"./copy-button-BvU3RDZa.js";import{S as v,c as y,h as b,s as x,u as S,x as ee}from"./format-CshN6yEB.js";import{n as C,t as w}from"./utils-XFKvwlFT.js";import{F as T,M as te,N as ne,n as E,t as D}from"./use-platform-stream-QBU2PAD2.js";import{t as O}from"./catalog-template-icons-3S8RvUxD.js";import{l as k}from"./select-CmlY1M1a.js";import{a as A}from"./platform-targets-BIQ1lKOg.js";import{i as j,n as M,r as N,t as P}from"./tabs-4SeH2unv.js";import{r as re}from"./checkbox-C_4HRnS_.js";import{a as F,c as I,d as L,i as R,l as z,n as B,o as V,r as H,s as U,t as W,u as ie}from"./catalog-source-B3vWR4vX.js";import{c as ae,i as oe,n as se,r as G,t as ce}from"./use-engine-command-mutation-CT_3rCP3.js";import{t as K}from"./badge-eIn_7YrK.js";import{n as q}from"./get-error-message-BgE2BpPG.js";var le=C(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),ue=C(`layout-grid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),de=C(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),J=e(t(),1),Y=n(),X=20,fe=14,Z=`flex w-3.5 shrink-0 items-center justify-center`;function pe({instance:e,depth:t,area:n,line:r,detail:i}){let[a,o]=(0,J.useState)(!1),[s,c]=(0,J.useState)(!1),l=a?e.tags:e.tags.slice(0,10),u=e.tags.length-10;return(0,Y.jsxs)(Y.Fragment,{children:[l.map(a=>(0,Y.jsx)(Q,{member:a,depth:t,area:n,line:r,instanceId:e.id,detail:i},a.name)),!a&&u>0&&(0,Y.jsxs)(`button`,{type:`button`,className:`flex min-h-11 w-full items-center gap-1.5 border-t border-border/30 py-2 text-left font-mono text-xs text-muted-foreground hover:bg-muted/40 touch-manipulation sm:min-h-0 sm:py-1.5`,style:{paddingLeft:`${t*14+X}px`},onClick:()=>o(!0),children:[(0,Y.jsx)(`span`,{className:Z,"aria-hidden":!0}),(0,Y.jsxs)(`span`,{children:[`+`,u,` more tags`]})]}),e.properties.length>0&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`button`,{type:`button`,className:`flex min-h-11 w-full items-center gap-1.5 border-t border-border/30 py-2 text-left font-mono text-xs text-muted-foreground hover:bg-muted/40 touch-manipulation sm:min-h-0 sm:py-1.5`,style:{paddingLeft:`${t*14+X}px`},onClick:()=>c(e=>!e),children:[(0,Y.jsx)(`span`,{className:Z,"aria-hidden":!0,children:s?(0,Y.jsx)(k,{className:`size-3.5 opacity-60`,"aria-hidden":!0}):(0,Y.jsx)(A,{className:`size-3.5 opacity-60`,"aria-hidden":!0})}),(0,Y.jsxs)(`span`,{children:[e.properties.length,` properties`]})]}),s&&e.properties.map(a=>(0,Y.jsx)(Q,{member:a,depth:t,area:n,line:r,instanceId:e.id,detail:i},a.name))]})]})}function Q({member:e,depth:t,area:n,line:r,instanceId:i,detail:a}){let o=e.kind===`property`,s=t*14+X+(o?fe:0),c=a.namespace,l=[c?.enterprise?`${c.enterprise}/${c.site??``}`:c?.prefix??``,n,r,i,e.name].filter(Boolean).join(`/`);return(0,Y.jsx)(_,{value:l,label:`Copy UNS path`,successMessage:`UNS path copied`,successDescription:l,tooltipSide:`top`,render:()=>(0,Y.jsxs)(`button`,{type:`button`,className:w(`flex w-full cursor-pointer flex-col gap-1 border-t border-border/25 py-2 text-left font-mono text-xs hover:bg-muted/35 touch-manipulation sm:min-h-0 sm:flex-row sm:items-center sm:gap-1.5 sm:py-1.5`,o&&`opacity-65`),style:{paddingLeft:`${s}px`},children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Y.jsx)(`span`,{className:Z,"aria-hidden":!0,children:(0,Y.jsx)(`span`,{className:w(`size-1 rounded-full ring-1 ring-border/50`,o?`bg-muted-foreground/25`:`bg-primary/50`)})}),(0,Y.jsx)(`span`,{title:e.name,className:w(`min-w-0 truncate`,o?`text-muted-foreground`:`text-foreground`),children:x(e.name)}),o&&(0,Y.jsx)(`span`,{className:`shrink-0 rounded-[var(--miravo-radius-tight)] bg-muted/60 px-1 py-px text-[10px] text-muted-foreground`,children:`PROP`})]}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 pl-0 sm:ml-auto sm:flex-1 sm:justify-end sm:pl-0 sm:pr-1`,children:[(0,Y.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e.dataType}),e.unit&&(0,Y.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e.unit}),e.euRange&&(0,Y.jsxs)(`span`,{className:`ml-auto shrink-0 tabular-nums text-muted-foreground`,children:[`[`,e.euRange[0],`–`,e.euRange[1],`]`]})]})]})})}function $({depth:e,label:t,labelTitle:n,tag:r,tagKind:i,subtitle:a,subtitleTitle:o,count:s,expanded:c,onToggle:l,hasChildren:u}){let d=c?k:A,f=i===`area`?`text-primary`:`text-foreground`;return(0,Y.jsxs)(`button`,{type:`button`,className:`flex min-h-11 w-full flex-col gap-1 border-t border-border/35 py-2 pr-2 text-left text-xs transition-colors touch-manipulation first:border-t-0 hover:bg-muted/40 sm:min-h-0 sm:flex-row sm:flex-wrap sm:items-center sm:gap-1.5 sm:gap-y-0 sm:py-1.5`,style:{paddingLeft:`${12+e*14}px`},onClick:l,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 w-full items-center gap-1.5 sm:w-auto sm:flex-1 sm:flex-wrap sm:items-center`,children:[u?(0,Y.jsx)(d,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":!0}):(0,Y.jsx)(`span`,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{title:n??void 0,className:w(`min-w-0 flex-1 truncate font-medium`,f),children:t}),(0,Y.jsx)(`span`,{className:`shrink-0 text-[10px] tracking-wide text-muted-foreground uppercase`,children:r}),a&&(0,Y.jsx)(`span`,{title:o??void 0,className:`hidden min-w-0 max-w-[min(11rem,38vw)] shrink truncate font-mono text-xs text-muted-foreground sm:inline`,children:a}),s!==void 0&&(0,Y.jsx)(`span`,{className:`ml-auto shrink-0 tabular-nums text-xs text-muted-foreground`,children:s})]}),a&&(0,Y.jsx)(`span`,{title:o??void 0,className:`min-w-0 truncate pl-7 font-mono text-xs text-muted-foreground sm:hidden`,children:a})]})}function me(e){let t=e.split(/[-_]/).filter(e=>e.length>0);return t[t.length-1]??e}function he(e,t,n){let r=[];for(let i of e){let e=me(i.model),a=t.get(i.model),o=[],s=[];if(a)for(let[e,t]of Object.entries(a.members)){let n={name:e,kind:t.kind,dataType:t.dataType,unit:t.unit,euRange:t.euRange};t.kind===`property`?s.push(n):o.push(n)}for(let t=0;t<i.count;t++){let t=(n.get(i.model)??0)+1;n.set(i.model,t),r.push({id:`${e}-${String(t).padStart(3,`0`)}`,model:i.model,tags:o,properties:s})}}return r}function ge({detail:e}){let[t,n]=(0,J.useState)(new Set),c=(0,J.useRef)(null),l=(0,J.useMemo)(()=>[...new Set(e.models)],[e.models]),u=l.join(`,`),d=o({queryKey:i.catalog.modelSchemasBatch(u),queryFn:async()=>Promise.all(l.map(e=>a(`/catalog/models/${e}`,r.catalogModelDetail)))}),f=d.isPending&&!d.data,p=(0,J.useMemo)(()=>{let e=new Map;if(!d.data)return e;for(let[t,n]of d.data.entries())e.set(l[t],n);return e},[d.data,l]),m=(0,J.useMemo)(()=>{let t=new Map,n=new Map;for(let r of e.topology)for(let e of r.lines)n.set(`${r.name}/${e.name}`,he(e.twins,p,t));return n},[e.topology,p]);(0,J.useEffect)(()=>{if(f)return;let t=e.name;if(c.current===t)return;let r=new Set;for(let t of e.topology){r.add(`area:${t.name}`);for(let e of t.lines)r.add(`line:${t.name}/${e.name}`)}outer:for(let t of e.topology)for(let e of t.lines){let n=(m.get(`${t.name}/${e.name}`)??[])[0];if(n){r.add(`inst:${t.name}/${e.name}/${n.id}`);break outer}}n(r),c.current=t},[f,e.name,e.topology,m]);let h=(0,J.useCallback)(e=>{n(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]);return f?null:d.isError&&!d.data?(0,Y.jsx)(s,{message:q(d.error,`Failed to load model schemas.`),onRetry:()=>void d.refetch(),isRetrying:d.isFetching&&!d.isPending}):(0,Y.jsx)(`div`,{className:`overflow-hidden rounded-[var(--miravo-radius-stadium-sm)] border border-border/50 py-2 pl-1 pr-2 touch-manipulation sm:py-2.5 sm:pl-1.5 sm:pr-2.5`,children:e.topology.map(n=>{let r=`area:${n.name}`,i=t.has(r);return(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)($,{depth:0,label:b(n.name),labelTitle:n.name,tag:`AREA`,tagKind:`area`,expanded:i,onToggle:()=>h(r),hasChildren:!0}),i&&n.lines.map(r=>{let i=`line:${n.name}/${r.name}`,a=t.has(i),o=m.get(`${n.name}/${r.name}`)??[];return(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)($,{depth:1,label:b(r.name),labelTitle:r.name,tag:`LINE`,tagKind:`line`,count:o.length,expanded:a,onToggle:()=>h(i),hasChildren:!0}),a&&o.map(i=>{let a=`inst:${n.name}/${r.name}/${i.id}`,o=t.has(a);return(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)($,{depth:2,label:y(i.id),labelTitle:i.id,tag:`INST`,tagKind:`inst`,subtitle:b(i.model),subtitleTitle:i.model,count:i.tags.length+i.properties.length,expanded:o,onToggle:()=>h(a),hasChildren:i.tags.length+i.properties.length>0}),o&&(0,Y.jsx)(pe,{instance:i,depth:3,area:n.name,line:r.name,detail:e})]},i.id)})]},r.name)})]},n.name)})})}function _e(e){return e.lines.reduce((e,t)=>e+t.twins.reduce((e,t)=>e+t.count,0),0)}function ve(e){return Object.values(e.members).filter(e=>e.kind!==`property`).length}function ye(e,t){let n=0;for(let r of e.topology)for(let e of r.lines)for(let r of e.twins){let e=t.get(r.model),i=e?ve(e):0;n+=r.count*i}return n}function be({template:e,onClose:t}){let[n,l]=(0,J.useState)(new Set),u=o({queryKey:i.catalog.templateDetail(e?.id??``),queryFn:()=>a(`/catalog/templates/${e?.id}`,r.catalogTemplateDetail),enabled:e!==null}),d=u.data,p=u.isPending&&!d,m=u.isError,h=q(u.error,`Failed to load environment.`),g=d?.models?.join(`,`)??``,_=o({queryKey:i.catalog.modelSchemasBatch(g),queryFn:async()=>{let e=d?.models??[];return e.length===0?[]:Promise.all(e.map(e=>a(`/catalog/models/${e}`,r.catalogModelDetail)))},enabled:d!==null}),v=(0,J.useMemo)(()=>{if(!d||!_.data)return null;let e=new Map;for(let[t,n]of _.data.entries())e.set(d.models[t],n);return ye(d,e)},[d,_.data]);(0,J.useEffect)(()=>{e&&d&&l(new Set(d.topology.map(e=>e.name)))},[e,d]);let y=(0,J.useCallback)(e=>{l(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),b=D(),x=b.status===`running`;return(0,Y.jsx)(F,{open:e!==null,onOpenChange:e=>{if(!e){if(x){f.message(`Deploy still running. Cancel it or wait before closing.`);return}b.reset(),t()}},children:(0,Y.jsx)(V,{side:`right`,showCloseButton:!x,className:`flex w-full flex-col gap-4 touch-manipulation`,children:p?null:m&&!d?(0,Y.jsx)(`div`,{className:`flex flex-1 flex-col justify-center px-2`,children:(0,Y.jsx)(s,{message:h,onRetry:()=>void u.refetch(),isRetrying:u.isFetching})}):d?(0,Y.jsxs)(c.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.18},className:`flex min-h-0 flex-1 flex-col gap-4`,children:[(0,Y.jsxs)(I,{className:`gap-1 pb-0 pe-12`,children:[(0,Y.jsx)(z,{className:`font-heading text-base uppercase tracking-wide`,children:d.name}),d.description&&(0,Y.jsx)(U,{className:`text-xs leading-relaxed text-foreground/88`,children:d.description})]}),(0,Y.jsxs)(P,{defaultValue:`overview`,className:`flex min-h-0 flex-1 flex-col gap-1 pt-0`,children:[(0,Y.jsxs)(N,{variant:`line`,className:`h-8! shrink-0 gap-0.5 border-b-border/60 px-2 py-0.5`,children:[(0,Y.jsx)(j,{value:`overview`,className:`min-h-10 px-2 py-1 text-xs text-foreground/82 after:bottom-[-3px] data-active:text-foreground sm:min-h-0 sm:px-2.5 sm:py-1`,children:`Overview`}),(0,Y.jsx)(j,{value:`uns`,className:`min-h-10 px-2 py-1 text-xs text-foreground/82 after:bottom-[-3px] data-active:text-foreground sm:min-h-0 sm:px-2.5 sm:py-1`,children:`UNS`}),(0,Y.jsx)(j,{value:`deploy`,className:`min-h-10 px-2 py-1 text-xs text-foreground/82 after:bottom-[-3px] data-active:text-foreground sm:min-h-0 sm:px-2.5 sm:py-1`,children:`Deploy`})]}),(0,Y.jsx)(M,{value:`overview`,keepMounted:!0,className:`flex min-h-0 flex-1 flex-col`,children:(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col px-3 pt-0`,children:(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto pr-2`,children:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2 pb-1 pt-0.5`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsxs)(K,{variant:`outline`,className:`font-mono text-xs`,children:[d.topology.length,` areas`]}),(0,Y.jsxs)(K,{variant:`outline`,className:`font-mono text-xs`,children:[d.instanceCount,` twins`]}),(0,Y.jsxs)(K,{variant:`outline`,className:`font-mono text-xs`,children:[d.models.length,` models`]}),v!==null&&(0,Y.jsxs)(K,{variant:`outline`,className:`font-mono text-xs`,children:[v,` tags`]}),d.settings?.tickIntervalMs&&(0,Y.jsxs)(K,{variant:`outline`,className:`font-mono text-xs`,children:[`tick `,d.settings.tickIntervalMs,`ms`]}),d.settings?.timeMultiplier&&d.settings.timeMultiplier!==1&&(0,Y.jsxs)(K,{variant:`outline`,className:`font-mono text-xs`,children:[d.settings.timeMultiplier,`× speed`]}),(0,Y.jsx)(E,{stream:b})]}),d.namespace&&(d.namespace.enterprise||d.namespace.site||d.namespace.prefix)&&(0,Y.jsxs)(`div`,{className:`min-w-0 overflow-hidden rounded-[var(--miravo-radius-tight)] border border-border/60 px-2.5 py-2`,children:[(0,Y.jsx)(`h3`,{className:`font-heading text-xs font-semibold uppercase tracking-[0.12em] text-primary`,children:`Namespace`}),(0,Y.jsxs)(`dl`,{className:`mt-1 grid grid-cols-1 gap-x-4 gap-y-1.5 sm:grid-cols-2`,children:[d.namespace.enterprise&&(0,Y.jsxs)(`div`,{className:`min-w-0 sm:max-w-[min(100%,16rem)]`,children:[(0,Y.jsx)(`dt`,{className:`font-heading text-xs font-medium uppercase tracking-[0.12em] text-muted-foreground`,children:`Enterprise`}),(0,Y.jsx)(`dd`,{className:`mt-1 font-mono text-xs leading-snug text-foreground [overflow-wrap:anywhere] break-words`,children:d.namespace.enterprise})]}),d.namespace.site&&(0,Y.jsxs)(`div`,{className:`min-w-0 sm:max-w-[min(100%,16rem)]`,children:[(0,Y.jsx)(`dt`,{className:`font-heading text-xs font-medium uppercase tracking-[0.12em] text-muted-foreground`,children:`Site`}),(0,Y.jsx)(`dd`,{className:`mt-1 font-mono text-xs leading-snug text-foreground [overflow-wrap:anywhere] break-words`,children:d.namespace.site})]}),d.namespace.prefix&&(0,Y.jsxs)(`div`,{className:`min-w-0 sm:col-span-2`,children:[(0,Y.jsx)(`dt`,{className:`font-heading text-xs font-medium uppercase tracking-[0.12em] text-muted-foreground`,children:`Prefix`}),(0,Y.jsx)(`dd`,{className:`mt-1 font-mono text-xs leading-snug text-foreground [overflow-wrap:anywhere] break-words`,children:d.namespace.prefix})]})]})]}),d.topology.map(e=>(0,Y.jsx)(xe,{area:e,expanded:n.has(e.name),onToggle:()=>y(e.name)},e.name)),d.settings&&(0,Y.jsxs)(`div`,{className:`rounded-[var(--miravo-radius-tight)] border border-border/50 p-2`,children:[(0,Y.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 font-heading text-xs font-semibold uppercase tracking-[0.12em] text-warning`,children:[(0,Y.jsx)(ie,{className:`size-3.5`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{children:`Settings`})]}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-1 gap-1.5 font-mono text-xs sm:grid-cols-2`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-col`,children:[(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`tick interval`}),(0,Y.jsxs)(`span`,{className:`text-foreground`,children:[d.settings.tickIntervalMs??1e3,`ms`]})]}),(0,Y.jsxs)(`div`,{className:`flex flex-col`,children:[(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`time multiplier`}),(0,Y.jsxs)(`span`,{className:`text-foreground`,children:[d.settings.timeMultiplier??1,`×`]})]})]})]})]})})})}),(0,Y.jsx)(M,{value:`uns`,keepMounted:!0,className:`flex min-h-0 flex-1 flex-col`,children:(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col px-3 pt-0`,children:(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto pr-2`,children:(0,Y.jsx)(`div`,{className:`pb-1 pt-0.5`,children:(0,Y.jsx)(ge,{detail:d})})})})}),(0,Y.jsx)(M,{value:`deploy`,keepMounted:!0,className:`flex min-h-0 flex-1 flex-col`,children:(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col px-3 pt-0`,children:(0,Y.jsx)(R,{kind:`template`,id:d.id,displayName:d.name,yamlPath:`/catalog/templates/${d.id}/yaml`,yamlFilename:`${d.id}.miravo.yaml`,stream:b})})})]})]},d.id):(0,Y.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-sm text-muted-foreground`,children:`Environment not found`})})})}function xe({area:e,expanded:t,onToggle:n}){let r=_e(e);return(0,Y.jsxs)(`div`,{className:G,children:[(0,Y.jsxs)(`button`,{type:`button`,className:`flex min-h-11 w-full items-center gap-1.5 px-2.5 py-2 text-left text-xs font-medium transition-colors hover:bg-muted/30 touch-manipulation sm:min-h-0 sm:py-1.5`,onClick:n,children:[(0,Y.jsx)(le,{className:`size-3.5 text-primary`}),(0,Y.jsx)(`span`,{className:`uppercase tracking-wider text-primary`,children:b(e.name)}),(0,Y.jsxs)(`div`,{className:`ml-auto flex items-center gap-1.5`,children:[(0,Y.jsxs)(K,{variant:`secondary`,className:`text-xs`,children:[r,` twins`]}),(0,Y.jsxs)(K,{variant:`secondary`,className:`text-xs`,children:[e.lines.length,` lines`]}),(0,Y.jsx)(k,{className:`size-3 text-muted-foreground transition-transform ${t?`rotate-180`:``}`})]})]}),(0,Y.jsx)(l,{initial:!1,children:t&&(0,Y.jsx)(c.div,{initial:{height:0,opacity:0},animate:{height:`auto`,opacity:1},exit:{height:0,opacity:0},transition:{duration:.2,ease:`easeOut`},className:`overflow-hidden`,children:(0,Y.jsx)(`div`,{className:`flex flex-col gap-1.5 border-t border-border p-2`,children:e.lines.map(e=>(0,Y.jsx)(Se,{line:e},e.name))})},`content`)})]})}function Se({line:e}){return(0,Y.jsxs)(`div`,{className:`rounded-[var(--miravo-radius-tight)] border border-border/60 bg-muted/10 p-2`,children:[(0,Y.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 text-xs font-medium text-muted-foreground`,children:[(0,Y.jsx)(de,{className:`size-3.5`}),(0,Y.jsx)(`span`,{title:e.name,children:b(e.name)}),(0,Y.jsx)(ue,{className:`ml-auto size-3.5 text-muted-foreground`}),(0,Y.jsxs)(`span`,{className:`text-muted-foreground`,children:[e.twins.reduce((e,t)=>e+t.count,0),` twins`]})]}),(0,Y.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:e.twins.map(e=>(0,Y.jsx)(Ce,{twin:e},`${e.model}-${e.count}`))})]})}function Ce({twin:e}){let t=e.parameters&&Object.keys(e.parameters).length>0;return(0,Y.jsxs)(`div`,{className:`rounded-[var(--miravo-radius-tight)] border border-border/30 bg-background/50 px-2.5 py-1.5`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs`,children:[(0,Y.jsx)(`span`,{className:`font-mono font-medium text-primary`,title:e.model,children:b(e.model)}),(0,Y.jsxs)(K,{variant:`secondary`,className:`shrink-0 px-1 py-0 text-xs`,children:[`×`,e.count]}),e.variation>0&&(0,Y.jsxs)(`span`,{className:`text-muted-foreground`,children:[`±`,(e.variation*100).toFixed(0),`% variation`]})]}),t&&e.parameters&&(0,Y.jsx)(`div`,{className:`mt-1.5 flex flex-wrap gap-x-4 gap-y-1 border-t border-border/20 pt-1.5 font-mono text-xs`,children:Object.entries(e.parameters).map(([e,t])=>(0,Y.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:e}),(0,Y.jsx)(`span`,{className:`text-foreground`,children:t})]},e))})]})}var we=[`builtin`,`personal`];function Te(){let[e,t]=(0,J.useState)(``),[n,f]=(0,J.useState)(`all`),[_,y]=(0,J.useState)({}),[b,x]=(0,J.useState)(null),[C,T]=(0,J.useState)(null),[ne,E]=(0,J.useState)(null),D=(0,J.useRef)(null),O=ce();(0,J.useEffect)(()=>{let e=e=>{if(e.key!==`/`||e.metaKey||e.ctrlKey||e.altKey)return;let t=e.target.tagName;t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||(e.preventDefault(),D.current?.focus())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let k=o({queryKey:i.catalog.templates(),queryFn:()=>a(`/catalog/templates`,r.catalogTemplates)}),A=k.data??[],j=C===null?null:A.find(e=>e.id===C)??null,M=k.isPending&&!k.data,N=k.isError&&!k.data,P=k.isError&&!!k.data,F=q(k.error,`Failed to load environments.`),I=e=>_[e]??1,L=(0,J.useCallback)((e,t)=>{y(n=>({...n,[e]:Math.max(1,Math.min(10,t))}))},[]),R=(0,J.useCallback)(e=>{E(e)},[]),z=(0,J.useCallback)(e=>{T(e)},[]),B=async e=>{x(e);try{return await O.mutateAsync({type:`loadTemplate`,templatePath:e,count:I(e)}),!0}catch{return!1}finally{x(null)}},V=(0,J.useMemo)(()=>{let e={all:A.length};for(let t of we)e[t]=0;for(let t of A){let n=H(t.source);e[n]=(e[n]??0)+1}return e},[A]),U=e.toLowerCase(),W=A.filter(e=>n===`all`||H(e.source)===n).filter(e=>U?e.name.toLowerCase().includes(U)||e.id.toLowerCase().includes(U)||(e.description?.toLowerCase().includes(U)??!1):!0);return(0,Y.jsxs)(`div`,{className:`@container/templates mx-auto flex w-full max-w-screen-2xl flex-col gap-5 p-4 sm:gap-6 sm:p-6`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(`h1`,{className:`font-heading text-2xl font-semibold tracking-tight`,children:`Environment Catalog`}),(0,Y.jsx)(K,{variant:`outline`,className:`text-xs`,children:N?(0,Y.jsx)(`span`,{className:`text-destructive`,children:`Unavailable`}):M&&A.length===0?(0,Y.jsx)(Y.Fragment,{children:`Loading...`}):(0,Y.jsxs)(Y.Fragment,{children:[new Set(A.map(e=>e.id)).size,` environments`]})})]}),(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Choose an environment to launch a realistic industrial system. Each environment includes pre-configured asset models with realistic physics, lifecycle degradation, and fault modes.`})]}),N&&(0,Y.jsx)(s,{message:F,onRetry:()=>void k.refetch(),isRetrying:k.isFetching}),P&&(0,Y.jsx)(s,{message:`${F} Showing cached environments.`,onRetry:()=>void k.refetch(),isRetrying:k.isFetching}),!N&&(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,Y.jsxs)(`div`,{className:`relative max-w-xs flex-1 min-w-[14rem]`,children:[(0,Y.jsx)(te,{className:`absolute left-2.5 top-2.5 size-4 text-muted-foreground`}),(0,Y.jsx)(ee,{ref:D,placeholder:`Filter environments...`,value:e,onChange:e=>t(e.target.value),className:`pl-9 pr-7`}),!e&&(0,Y.jsx)(`kbd`,{className:`pointer-events-none absolute top-1/2 right-2 -translate-y-1/2 rounded-[var(--miravo-radius-tight)] border border-border bg-muted px-1 font-mono text-[10px] text-muted-foreground`,children:`/`})]}),(0,Y.jsx)(Oe,{value:n,counts:V,onChange:f})]}),(0,Y.jsx)(`div`,{className:`grid grid-cols-1 gap-4 @[720px]/templates:grid-cols-2`,"aria-busy":M&&!N,children:N?null:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(l,{children:W.map((e,t)=>(0,Y.jsx)(c.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,scale:.96,transition:{duration:.15}},transition:{type:`spring`,stiffness:380,damping:30,delay:t*.04},className:`grid`,children:(0,Y.jsx)(Ee,{template:e,count:I(e.id),launching:b===e.id,onCountChange:L,onInspect:R,onLaunch:z})},`${e.source}:${e.id}`))}),W.length===0&&A.length>0&&(0,Y.jsx)(`p`,{className:`col-span-full py-8 text-center text-sm text-muted-foreground`,children:`No environments match the current filters.`})]})}),A.length>0&&(0,Y.jsx)(`div`,{className:w(G,`p-0`),children:(0,Y.jsx)(`div`,{className:`community-teaser relative overflow-hidden rounded-[inherit]`,children:(0,Y.jsx)(`div`,{className:`relative z-10 mx-auto max-w-3xl px-5 py-10 sm:px-10 sm:py-12`,children:(0,Y.jsxs)(`div`,{className:`grid items-center gap-10 lg:grid-cols-[minmax(0,1fr)_minmax(0,17rem)]`,children:[(0,Y.jsxs)(`div`,{className:`order-2 flex min-w-0 flex-col gap-4 lg:order-1`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-3 gap-y-1`,children:[(0,Y.jsx)(`p`,{className:`blueprint-title text-primary`,children:`Future channel`}),(0,Y.jsx)(`span`,{className:`blueprint-stat text-[10px] text-muted-foreground`,children:`MIRAVO_REGISTRY · NOT_CONNECTED`})]}),(0,Y.jsx)(`h2`,{className:`font-heading text-xl font-semibold tracking-tight sm:text-2xl`,children:`Community Environments`}),(0,Y.jsx)(`p`,{className:`max-w-xl text-sm leading-relaxed text-muted-foreground`,children:`Share your industrial environments with the Miravo community. Publish custom environments, discover configurations from other engineers, and fork them as your starting point.`}),(0,Y.jsx)(`div`,{children:(0,Y.jsx)(K,{variant:`outline`,className:`community-teaser-soon border-primary/35 bg-primary/5 text-[10px] text-primary`,children:`Coming Soon`})})]}),(0,Y.jsx)(`div`,{className:`order-1 flex justify-center lg:order-2 lg:justify-end`,children:(0,Y.jsxs)(`div`,{className:`community-teaser-module relative flex w-full max-w-[14rem] flex-col items-center justify-center gap-3 border border-primary/15 bg-muted/15 py-8 sm:max-w-[15.5rem] sm:py-10`,"aria-hidden":!0,children:[(0,Y.jsx)(`div`,{className:`community-teaser-icon-ring relative z-[1] flex size-[4.25rem] items-center justify-center rounded-[var(--miravo-radius-tight)] border border-primary/35 bg-gradient-to-br from-primary/18 to-primary/5`,children:(0,Y.jsx)(re,{className:`size-9 text-primary`,"aria-hidden":!0})}),(0,Y.jsx)(`span`,{className:`blueprint-stat relative z-[1] text-[9px] tracking-[0.18em] text-muted-foreground`,children:`AWAITING SIGNAL`}),(0,Y.jsx)(`span`,{className:`blueprint-stat relative z-[1] text-[9px] text-muted-foreground`,children:`Uplink idle`})]})})]})})})}),(0,Y.jsx)(p,{open:C!==null,onOpenChange:e=>{e||T(null)},children:(0,Y.jsxs)(h,{children:[(0,Y.jsxs)(m,{children:[(0,Y.jsx)(g,{children:`Launch environment?`}),(0,Y.jsx)(d,{children:j!==null&&(0,Y.jsxs)(Y.Fragment,{children:[`This adds `,I(j.id),` instance`,I(j.id)===1?``:`s`,` of`,` `,(0,Y.jsx)(`span`,{className:`font-medium text-foreground`,children:S(j.name)}),` `,`to the running environment.`]})})]}),(0,Y.jsxs)(u,{children:[(0,Y.jsx)(v,{variant:`outline`,disabled:b!==null,onClick:()=>T(null),children:`Cancel`}),(0,Y.jsx)(v,{disabled:b!==null||j===null,onClick:async()=>{j!==null&&await B(j.id)&&T(null)},children:b===j?.id?`Launching...`:`Launch`})]})]})}),(0,Y.jsx)(be,{template:ne,onClose:()=>E(null)})]})}var Ee=(0,J.memo)(function({template:e,count:t,launching:n,onCountChange:r,onInspect:i,onLaunch:a}){return(0,Y.jsxs)(`div`,{className:w(oe,`flex flex-col gap-4 p-5`),children:[(0,Y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Y.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-[var(--miravo-radius-stadium-sm)] bg-primary/10 text-primary`,children:(0,Y.jsx)(O,{id:e.id,className:`size-5`})}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex flex-col gap-1`,children:[(0,Y.jsx)(`span`,{className:`font-heading text-sm font-semibold uppercase tracking-wide`,children:S(e.name)}),(0,Y.jsx)(`p`,{className:`line-clamp-3 text-xs leading-relaxed text-foreground/75`,children:e.description??`Industrial environment.`}),(0,Y.jsx)(`span`,{className:`font-mono text-[10px] text-muted-foreground`,children:e.id})]})]}),(0,Y.jsx)(`div`,{className:`px-3 py-2`,children:(0,Y.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.models.map(e=>(0,Y.jsx)(K,{variant:`outline`,className:`h-auto min-h-5 rounded-[var(--miravo-radius-tight)] px-1.5 py-0 font-mono text-[10px] font-normal text-primary`,children:e},e))})}),(0,Y.jsxs)(`div`,{className:`mt-auto flex flex-wrap items-center gap-4 font-mono text-[11px] text-muted-foreground`,children:[(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`span`,{className:`text-foreground`,children:e.instanceCount}),` instances`]}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`span`,{className:`text-foreground`,children:e.models.length}),` models`]}),e.memberCount>0&&(0,Y.jsxs)(`span`,{children:[`~`,(0,Y.jsx)(`span`,{className:`text-foreground`,children:De(e.memberCount)}),` tags/cycle`]}),(0,Y.jsx)(K,{variant:`outline`,className:w(`ml-auto shrink-0 font-sans text-[10px] font-medium uppercase tracking-wide`,W(e.source)),children:B(e.source)})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 border-t border-border/30 pt-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center rounded-[var(--miravo-radius-tight)] border bg-muted/30`,children:[(0,Y.jsx)(v,{variant:`ghost`,size:`icon`,className:`size-7 rounded-none rounded-l-md`,disabled:t<=1,"aria-label":`Decrease count`,onClick:n=>{n.stopPropagation(),r(e.id,t-1)},children:(0,Y.jsx)(L,{className:`size-3`})}),(0,Y.jsx)(`span`,{className:`flex size-7 items-center justify-center border-x font-mono text-xs`,children:t}),(0,Y.jsx)(v,{variant:`ghost`,size:`icon`,className:`size-7 rounded-none rounded-r-md`,disabled:t>=10,"aria-label":`Increase count`,onClick:n=>{n.stopPropagation(),r(e.id,t+1)},children:(0,Y.jsx)(ne,{className:`size-3`})})]}),(0,Y.jsxs)(v,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>i(e),className:se,children:[(0,Y.jsx)(T,{className:`size-3.5`,"aria-hidden":!0}),`Inspect`]}),(0,Y.jsxs)(v,{size:`sm`,className:`ml-auto`,disabled:n,onClick:()=>a(e.id),children:[(0,Y.jsx)(ae,{className:`mr-1 size-3`}),n?`...`:`Launch`]})]})]})});function De(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function Oe({value:e,counts:t,onChange:n}){return(0,Y.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,role:`radiogroup`,"aria-label":`Filter by source`,children:[{id:`all`,label:`All`},...we.map(e=>({id:e,label:B(e)}))].map(r=>{let i=e===r.id,a=t[r.id]??0,o=r.id!==`all`&&a===0;return(0,Y.jsxs)(`label`,{className:w(`inline-flex h-7 items-center gap-1.5 rounded-[var(--miravo-radius-pill)] border px-3 text-xs font-medium transition-colors`,i?`border-primary/60 bg-primary/15 text-primary`:`border-border/60 bg-card/30 text-muted-foreground hover:border-border hover:bg-muted/40 hover:text-foreground`,o?`cursor-not-allowed opacity-40 hover:border-border/60 hover:bg-card/30 hover:text-muted-foreground`:`cursor-pointer`),children:[(0,Y.jsx)(`input`,{type:`radio`,name:`catalog-source-filter`,value:r.id,checked:i,disabled:o,onChange:()=>n(r.id),className:`sr-only`}),(0,Y.jsx)(`span`,{children:r.label}),(0,Y.jsx)(`span`,{className:`font-mono text-[10px] opacity-70`,children:a})]},r.id)})})}export{Te as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./catalog-CMdsHJtX.js";export{e as CatalogPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{$ as n,J as r,Q as i,X as a,Y as o,Z as s,at as c,q as l}from"./vendor-ui-CWUk2ulb.js";import{S as u,a as ee,b as d,o as f,s as te}from"./api-CrYvIV3A.js";import{i as ne,s as re,t as ie}from"./query-fetch-error-BWenDoLQ.js";import{t as p}from"./proxy-Be4WzmcS.js";import{t as ae}from"./AnimatePresence-CPmH1DMY.js";import{a as oe,i as se,l as m,n as ce,o as le,r as ue,s as de}from"./copy-button-BvU3RDZa.js";import{S as h,w as g,x as fe}from"./format-CshN6yEB.js";import{n as _,t as v}from"./utils-XFKvwlFT.js";import{A as pe,C as me,D as he,E as ge,P as _e,S as ve,T as ye,a as be,f as xe,g as Se,h as Ce,i as we,k as Te,m as Ee,o as De,r as Oe,s as ke,u as Ae,v as je,w as Me,y as Ne}from"./use-platform-stream-QBU2PAD2.js";import{a as Pe,c as Fe,i as y,n as Ie,o as Le,r as Re,s as ze,t as Be}from"./select-CmlY1M1a.js";import{a as Ve,i as He,n as Ue,r as b,t as We}from"./platform-targets-BIQ1lKOg.js";import{a as x,o as S}from"./tabs-4SeH2unv.js";import{t as Ge}from"./download-DmUZKo9N.js";import{r as Ke}from"./checkbox-C_4HRnS_.js";import{t as qe}from"./badge-eIn_7YrK.js";import{t as C}from"./label-CMBWxUhA.js";import{n as w}from"./get-error-message-BgE2BpPG.js";var Je=_(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),Ye=_(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),T=c();function E({...e}){return(0,T.jsx)(r,{"data-slot":`sheet`,...e})}function D({...e}){return(0,T.jsx)(o,{"data-slot":`sheet-portal`,...e})}function O({className:e,...t}){return(0,T.jsx)(n,{"data-slot":`sheet-overlay`,className:v(`fixed inset-0 z-50 bg-black/10 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs`,e),...t})}function k({className:e,children:t,side:n=`right`,showCloseButton:r=!0,...o}){return(0,T.jsxs)(D,{children:[(0,T.jsx)(O,{}),(0,T.jsxs)(a,{"data-slot":`sheet-content`,"data-side":n,className:v(`fixed z-50 flex flex-col gap-4 bg-background bg-clip-padding text-sm 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-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-[calc(100vw-1rem)] data-[side=left]:max-w-md data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-[calc(100vw-1rem)] data-[side=right]:max-w-xl data-[side=right]:border-l data-[side=right]:pl-1 data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] 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-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem]`,e),...o,children:[t,r&&(0,T.jsxs)(i,{"data-slot":`sheet-close`,render:(0,T.jsx)(h,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`}),children:[(0,T.jsx)(g,{}),(0,T.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function A({className:e,...t}){return(0,T.jsx)(`div`,{"data-slot":`sheet-header`,className:v(`flex flex-col gap-0.5 p-2`,e),...t})}function j({className:e,...t}){return(0,T.jsx)(l,{"data-slot":`sheet-title`,className:v(`text-base font-medium text-foreground`,e),...t})}function M({className:e,...t}){return(0,T.jsx)(s,{"data-slot":`sheet-description`,className:v(`text-sm text-muted-foreground`,e),...t})}var N=e(t(),1),Xe=[{value:`opcua`,label:`OPC UA`},{value:`mqtt`,label:`MQTT`},{value:`modbus`,label:`Modbus`}];function Ze({value:e,onValueChange:t,labelledBy:n}){return(0,T.jsx)(`fieldset`,{"aria-labelledby":n,className:`min-w-0 border-0 p-0`,children:(0,T.jsx)(`div`,{className:`flex gap-1.5`,children:Xe.map(n=>{let r=e===n.value;return(0,T.jsx)(`button`,{type:`button`,"aria-pressed":r,onClick:()=>t(n.value),className:v(`flex flex-1 items-center justify-center rounded-[var(--miravo-radius-pill)] border py-1.5 text-center transition-[background-color,border-color,color,box-shadow] duration-200`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/80 focus-visible:ring-offset-2 focus-visible:ring-offset-background`,r?`border-primary/45 bg-primary/10 text-primary shadow-[inset_0_1px_0_0_rgba(255,255,255,0.06),0_0_0_1px_color-mix(in_srgb,var(--primary)_25%,transparent)]`:`border-border/75 bg-background/55 text-foreground/82 hover:border-border/90 hover:bg-background/70 hover:text-foreground/92`),children:(0,T.jsxs)(`span`,{className:`inline-flex items-center justify-center gap-1.5 font-mono text-[11px] font-medium leading-none tracking-wide`,children:[(0,T.jsx)(x,{className:`size-2.5 shrink-0 -translate-y-px opacity-80`,"aria-hidden":!0}),(0,T.jsx)(`span`,{children:n.label})]})},n.value)})})})}var P=`172.17.0.1`;async function Qe(e){let t=await f(`/catalog/models/${encodeURIComponent(e)}/le-dt.json`,u.catalogModelLeDt);return JSON.stringify(t,null,2)}async function $e(e,t={host:P}){let n=u.catalogTemplateLeTemplateJson.query;if(!n)throw Error(`Missing query schema for ${u.catalogTemplateLeTemplateJson.method} ${u.catalogTemplateLeTemplateJson.path}`);let r=n.safeParse(t);if(!r.success)throw Error(`Invalid request for ${u.catalogTemplateLeTemplateJson.method} ${u.catalogTemplateLeTemplateJson.path}: ${r.error.message}`);return ee(F(e,r.data),u.catalogTemplateLeTemplateJson)}function F(e,t){return`/catalog/templates/${encodeURIComponent(e)}/le-template.json${et(t)}`}function et(e){let t=new URLSearchParams;return e.host&&t.set(`host`,e.host),e.protocol&&t.set(`protocol`,e.protocol),t.size>0?`?${t.toString()}`:``}function I(e){let t=e.split(/[-_]/).filter(e=>e.length>0);return t[t.length-1]??e}function tt(e){return`${I(e)}-001`}function nt(e,t){return[t,...e?.filter(e=>e.id!==t.id)??[]]}async function rt(e){let t=await e.create();e.onCreated(t);try{await e.refresh()}catch(t){e.onRefreshFailed(t)}}function it(e){return He.find(t=>t.id===e)?.label??e}function at(e){return e===`template`?`Litmus Edge Template`:`Litmus Edge`}function ot({kind:e,id:t,displayName:n,yamlPath:r,yamlFilename:i,stream:a}){let o=re(),s=ne({queryKey:d.platforms.targets(),queryFn:()=>Ae()}),c=s.data??[],[l,ee]=(0,N.useState)(``),[f,_]=(0,N.useState)(`opcua`),[x,Je]=(0,N.useState)(`litmus-edge`),[Ye,E]=(0,N.useState)(!1),[D,O]=(0,N.useState)(!1),[k,A]=(0,N.useState)(b.id),[j,M]=(0,N.useState)({label:``,hostname:``,apiToken:``,sourceHostname:``}),[Xe,F]=(0,N.useState)(!1),[et,I]=(0,N.useState)(!1),{testing:ot,runTest:L,cancelInFlight:R}=De(),[st,z]=(0,N.useState)(!1),[B,V]=(0,N.useState)(P),[H,ct]=(0,N.useState)(!1),[U,W]=(0,N.useState)(null),[lt,ut]=(0,N.useState)(!1),G=(0,N.useRef)(0),K=(0,N.useRef)(null),dt=(0,N.useRef)(a.status),ft=(0,N.useId)(),q=(0,N.useCallback)(()=>{G.current+=1,K.current?.abort(),K.current=null,ut(!1),W(null)},[]);(0,N.useEffect)(()=>()=>{G.current+=1,K.current?.abort(),K.current=null},[]),(0,N.useEffect)(()=>{let e=dt.current;dt.current=a.status,e===`running`&&a.status===`complete`&&o.invalidateQueries({queryKey:d.platforms.operationsList()})},[o,a.status]),(0,N.useEffect)(()=>{D&&(A(b.id),M({label:``,hostname:``,apiToken:``,sourceHostname:``}),F(!1))},[D]);let pt=k===b.id&&j.hostname.trim().length>0&&j.sourceHostname.trim().length>0&&j.apiToken.trim().length>0,J=c.find(e=>e.id===l),mt=(0,N.useCallback)(n=>{E(!1),q(),l&&(e===`model`?a.startApply(ge({targetId:l,model:t,protocol:f,result:n})):a.startApply(he({targetId:l,template:t,result:n})))},[l,t,e,f,a,q]),ht=(0,N.useCallback)(async n=>{if(!l)return;a.operation&&a.status!==`running`&&a.reset(),K.current?.abort(),G.current+=1;let r=G.current,i=new AbortController;K.current=i,ut(!0),W(null);try{let a=await xe(e===`model`?ge({targetId:l,model:t,protocol:f,result:n}):he({targetId:l,template:t,result:n}),{signal:i.signal});if(r!==G.current)return;W(a.plan)}catch(e){if(r!==G.current||be(e))return;m.error(w(e,`Plan failed.`))}finally{r===G.current&&ut(!1)}},[l,e,t,f,a]),gt=(0,N.useCallback)(async()=>{if(k!==b.id){m.error(`${it(k)} target setup is coming soon.`);return}if(!j.label||!j.hostname||!j.sourceHostname){m.error(`Label, hostname, and source host are required.`);return}if(!j.apiToken){m.error(`API token is required for new targets.`);return}I(!0);try{await rt({create:()=>ke({...j,platformId:k}),onCreated:e=>{o.setQueryData(d.platforms.targets(),t=>nt(t,e)),ee(e.id),O(!1),m.success(`Target added.`)},refresh:async()=>{let e=await s.refetch();if(e.error)throw e.error},onRefreshFailed:e=>{m.error(`Target added, but target list refresh failed.`,{description:`${w(e,`Target list refresh failed.`)} Reload targets before retrying another add.`})}})}catch(e){m.error(w(e,`Failed to add target.`))}finally{I(!1)}},[k,j,s,o]),_t=(0,N.useCallback)(()=>{pt&&L({hostname:j.hostname.trim(),sourceHostname:j.sourceHostname.trim(),apiToken:j.apiToken.trim()})},[pt,j,L]),vt=x===`source-yaml`,yt=x===`litmus-edge`||vt,Y=(0,N.useCallback)(async n=>{if(vt){try{let t=await te(r,e===`model`?u.catalogModelYaml:u.catalogTemplateYaml),n=new Blob([t],{type:`text/yaml`}),a=URL.createObjectURL(n),o=document.createElement(`a`);o.href=a,o.download=i,o.click(),URL.revokeObjectURL(a),m.success(`Exported ${i}`)}catch{m.error(`Failed to export YAML`)}return}if(x===`litmus-edge`)try{if(e===`model`){let e=await Qe(t),n=new Blob([e],{type:`application/json`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`${t}.le-dt.json`,i.click(),URL.revokeObjectURL(r),m.success(`Exported ${t}.le-dt.json`)}else{let e=n?.templateHost?.trim()??``,r=e.length>0?e:P,i=`${t}.le-template.json`,a=await $e(t,{host:r}),o=URL.createObjectURL(a),s=document.createElement(`a`);s.href=o,s.download=i,s.click(),URL.revokeObjectURL(o),m.success(`Exported ${i}`)}}catch{m.error(`Failed to export platform format`)}},[x,vt,e,t,r,i]),bt=(0,N.useCallback)(()=>{if(yt){if(x===`litmus-edge`&&e===`template`){V(P),z(!0);return}Y()}},[yt,x,e,Y]),xt=(0,N.useCallback)(async()=>{ct(!0);try{await Y({templateHost:B}),z(!1)}finally{ct(!1)}},[B,Y]),X=a.status===`running`,Z=a.cancelRequested,Q=!!l&&!X,St=!!a.operation||X,$=St?ve(a):null;return(0,T.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-6 px-1 py-2`,children:[(0,T.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto pr-2`,children:(0,T.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,T.jsx)(`p`,{className:`font-heading text-[11px] font-semibold uppercase tracking-[0.2em] text-foreground`,children:`Deploy`}),(0,T.jsxs)(`div`,{className:`space-y-2`,children:[(0,T.jsx)(C,{className:`font-heading text-[11px] font-medium uppercase tracking-[0.14em] text-foreground/78`,children:`Target`}),s.isError&&s.data===void 0&&(0,T.jsx)(ie,{message:w(s.error,`Failed to load targets.`),onRetry:()=>void s.refetch(),isRetrying:s.isFetching&&!s.isPending}),(0,T.jsx)(Ee,{targets:c,value:l,onValueChange:ee,loading:s.isPending&&s.data===void 0,size:`sm`,className:`min-w-0 w-full border-border/65 bg-background/55 text-xs text-foreground`,onAddNew:()=>O(!0)})]}),e===`model`&&c.length>0&&(0,T.jsxs)(`div`,{className:`space-y-2`,children:[(0,T.jsx)(C,{id:ft,className:`font-heading text-[11px] font-medium uppercase tracking-[0.14em] text-foreground/78`,children:`Protocol binding`}),(0,T.jsx)(Ze,{value:f,onValueChange:_,labelledBy:ft})]}),c.length>0&&(0,T.jsxs)(`button`,{type:`button`,disabled:!Q,onClick:()=>E(!0),className:v(`group flex w-full min-h-14 min-w-0 items-stretch overflow-hidden rounded-[var(--miravo-radius-stadium-lg)] text-left outline-none`,`transition-[border-color,box-shadow,background-color] duration-200 ease-out`,`focus-visible:ring-2 focus-visible:ring-ring/70 focus-visible:ring-offset-2 focus-visible:ring-offset-background`,`disabled:pointer-events-none disabled:opacity-55`,Q?[`border-2 border-primary/40 bg-background`,`bg-linear-to-r from-primary/12 via-background to-background`,`shadow-[inset_0_1px_0_0_rgba(255,255,255,0.025)]`,`hover:border-primary/56 hover:shadow-[inset_0_1px_0_0_rgba(255,255,255,0.025),0_0_14px_-8px_color-mix(in_srgb,var(--primary)_18%,transparent),0_0_22px_-12px_color-mix(in_srgb,var(--primary)_8%,transparent)]`]:[`border border-dashed border-border/65 bg-muted/15`,`hover:bg-muted/22`]),children:[(0,T.jsxs)(`span`,{className:`relative flex w-18 shrink-0 items-center justify-center bg-transparent`,"aria-hidden":!0,children:[(0,T.jsx)(`span`,{className:v(`absolute inset-y-2 -right-px w-px bg-linear-to-b from-transparent via-primary/30 to-transparent opacity-70`,!Q&&`via-border/80`)}),(0,T.jsx)(Ke,{className:v(`relative size-5`,Q?`text-primary`:`text-foreground/75`)})]}),(0,T.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col justify-center gap-0.5 overflow-hidden px-3 py-2.5 sm:px-4`,children:[(0,T.jsx)(`span`,{className:v(`font-heading text-[11px] font-semibold uppercase tracking-[0.16em]`,Q?`text-primary`:`text-foreground/78`),children:Q?`Review deploy`:X?`Deploy in progress…`:`Awaiting target`}),(0,T.jsx)(`span`,{className:v(`truncate font-mono text-[13px] leading-tight tracking-tight`,Q?`text-foreground`:`text-foreground/80`),children:J?.label??`Select a target above`})]}),(0,T.jsx)(`span`,{className:v(`flex shrink-0 items-center pr-2.5 sm:pr-3`,Q&&`pl-1`),children:(0,T.jsx)(`span`,{className:v(`flex size-9 items-center justify-center rounded-[var(--miravo-radius-stadium-sm)] border bg-transparent transition-[border-color,color] duration-200`,Q?`border-primary/40 text-primary group-hover:border-primary/55`:`border-border/75 text-foreground/75`),"aria-hidden":!0,children:(0,T.jsx)(Ve,{className:`size-4`,strokeWidth:2.25})})})]})]})}),(0,T.jsx)(ae,{children:St&&$?(0,T.jsx)(Se,{title:$.title,subtitle:$.subtitle,canDismiss:!X,footerAction:X&&a.operation?.operationId?(0,T.jsx)(h,{variant:`outline`,size:`sm`,disabled:Z,"aria-busy":Z,className:v(`ml-auto group h-8 gap-1.5 px-3 text-xs`,Z?`cursor-not-allowed`:`hover:bg-destructive/12 hover:text-destructive hover:border-destructive/35`),onClick:()=>{a.cancel().catch(()=>{})},children:Z?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(S,{className:`size-3.5 shrink-0 animate-spin text-muted-foreground`,"aria-hidden":!0}),(0,T.jsx)(p.span,{animate:{opacity:[1,.72,1]},transition:{duration:1.25,repeat:1/0,ease:`easeInOut`},className:`font-medium text-foreground`,children:`Cancelling…`})]}):(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(g,{className:`size-3.5 shrink-0 text-foreground/65 group-hover:text-destructive`,"aria-hidden":!0}),(0,T.jsx)(p.span,{animate:{opacity:[1,.88,1]},transition:{duration:2.2,repeat:1/0,ease:`easeInOut`},children:`Cancel`})]})}):(0,T.jsx)(`div`,{className:`ml-auto shrink-0 flex items-center`,children:(0,T.jsx)(h,{type:`button`,variant:`secondary`,size:`xs`,className:`h-7 px-3 text-[10px] font-medium`,onClick:a.reset,children:`Close`})}),onDismiss:a.reset,children:a.operation?(0,T.jsx)(Ne,{operation:a.operation,catalogTemplates:[{id:t,name:n}],logs:a.logs}):(0,T.jsxs)(`div`,{className:`flex flex-col gap-2 py-1`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(S,{className:`size-3.5 animate-spin text-primary`,"aria-hidden":!0}),(0,T.jsx)(`span`,{className:`text-xs text-foreground/88`,children:`Connecting to Litmus Edge…`})]}),(0,T.jsx)(`div`,{className:`h-1 w-full overflow-hidden rounded-full bg-muted/40`,children:(0,T.jsx)(p.div,{className:`h-full w-2/5 rounded-full bg-primary`,animate:{x:[`-100%`,`250%`]},transition:{duration:1.2,repeat:1/0,ease:`easeInOut`}})})]})},`deploy-stream`):null}),(lt||U)&&!X?(0,T.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,T.jsxs)(`div`,{className:`flex w-full min-w-0 flex-wrap items-center justify-between gap-2`,children:[(0,T.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-[11px] text-muted-foreground`,children:[(0,T.jsx)(_e,{className:`size-3.5 shrink-0 text-primary`,"aria-hidden":!0}),(0,T.jsxs)(`span`,{className:`truncate`,children:[`Preview for `,J?.label??`target`,`: `,n]})]}),(0,T.jsxs)(h,{type:`button`,variant:`ghost`,size:`sm`,className:`h-8 shrink-0 gap-1.5 px-2 text-xs text-muted-foreground hover:text-foreground`,onClick:q,children:[(0,T.jsx)(g,{className:`size-3.5`,"aria-hidden":!0}),`Close preview`]})]}),lt?(0,T.jsx)(we,{}):U?(0,T.jsx)(Oe,{plan:U,planKind:`apply`,onCloseTable:q}):null]}):null,(0,T.jsxs)(`div`,{className:`flex flex-col gap-4 border-t border-border/40 pt-5`,children:[(0,T.jsx)(`p`,{className:`font-heading text-[11px] font-semibold uppercase tracking-[0.2em] text-foreground`,children:`Export`}),(0,T.jsxs)(`div`,{className:`space-y-2`,children:[(0,T.jsx)(C,{className:`font-heading text-[11px] font-medium uppercase tracking-[0.14em] text-foreground/78`,children:`Format`}),(0,T.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,children:[(0,T.jsxs)(Be,{value:x,onValueChange:e=>{e&&Je(e)},children:[(0,T.jsx)(ze,{size:`sm`,className:`h-9! min-h-9 min-w-0 flex-1 border-border/65 bg-background/55 py-0 text-xs text-foreground`,children:(0,T.jsx)(Fe,{placeholder:`Select format`,children:t=>{if(t===`source-yaml`)return`Source YAML`;let n=He.find(e=>e.id===t);return n?.id===`litmus-edge`?at(e):n?.exportLabel??`Select format`}})}),(0,T.jsxs)(Ie,{children:[(0,T.jsxs)(Re,{children:[(0,T.jsx)(Pe,{children:`Platform`}),We.map(t=>(0,T.jsx)(y,{value:t.id,children:t.id===`litmus-edge`?at(e):t.exportLabel},t.id)),Ue.map(e=>(0,T.jsx)(y,{value:e.id,disabled:!0,children:(0,T.jsxs)(`span`,{className:`flex items-center gap-2`,children:[e.exportLabel,(0,T.jsx)(qe,{variant:`outline`,className:`px-1 py-0 text-[10px] text-foreground/72`,children:`Coming Soon`})]})},e.id))]}),(0,T.jsx)(Le,{}),(0,T.jsxs)(Re,{children:[(0,T.jsx)(Pe,{children:`Source`}),(0,T.jsxs)(y,{value:`source-yaml`,children:[`Source YAML`,` `,(0,T.jsx)(`span`,{className:`text-foreground/72`,children:e===`model`?`.twin.yaml`:`.miravo.yaml`})]})]})]})]}),(0,T.jsxs)(h,{variant:`outline`,size:`sm`,className:`h-9 min-h-9 shrink-0 gap-1.5 border-border/70 bg-background/50 px-4 text-xs font-medium text-foreground sm:w-auto`,disabled:!yt,onClick:bt,children:[(0,T.jsx)(Ge,{className:`size-3.5`}),`Download`]})]})]}),(0,T.jsx)(`p`,{className:`text-[11px] leading-snug text-foreground/70`,children:(0,T.jsx)(je,{format:x,kind:e})})]}),J&&(0,T.jsx)(me,{open:Ye,onOpenChange:E,type:`apply`,label:n,targetLabel:J.label,hostname:J.hostname,sourceHostname:J.sourceHostname,onConfirm:mt,defaultDeviceName:e===`model`?tt(t):void 0,metadata:e===`model`?[{label:`Protocol`,value:f.toUpperCase()},Te]:pe,applyPreview:{onPreview:e=>void ht(e),planLoading:lt,disabled:!l||X}}),(0,T.jsx)(Ce,{open:D,editing:!1,platformId:k,form:j,showToken:Xe,saving:et,testing:ot,canTestConnection:pt,onOpenChange:O,onPlatformChange:A,onFormChange:M,onShowTokenChange:F,onSave:()=>void gt(),onTestConnection:_t,onCancelInFlight:R}),(0,T.jsx)(ce,{open:st,onOpenChange:e=>{z(e),e||V(P)},children:(0,T.jsxs)(ue,{className:`sm:max-w-md`,children:[(0,T.jsxs)(le,{children:[(0,T.jsx)(de,{children:`Download Litmus Edge Template`}),(0,T.jsx)(se,{children:Me})]}),(0,T.jsxs)(`div`,{className:`space-y-2 py-1`,children:[(0,T.jsx)(C,{htmlFor:`deploy-export-source-host`,children:ye}),(0,T.jsx)(fe,{id:`deploy-export-source-host`,value:B,onChange:e=>V(e.target.value),placeholder:P,autoComplete:`off`,className:`font-mono text-sm`}),(0,T.jsxs)(`p`,{className:`text-[11px] leading-snug text-muted-foreground`,children:[`Use an IP or hostname reachable from Litmus Edge (e.g.`,` `,(0,T.jsx)(`span`,{className:`font-mono`,children:P}),` for Docker bridge).`]})]}),(0,T.jsxs)(oe,{className:`gap-2 sm:gap-0`,children:[(0,T.jsx)(h,{type:`button`,variant:`outline`,onClick:()=>z(!1),disabled:H,children:`Cancel`}),(0,T.jsxs)(h,{type:`button`,className:`gap-1.5`,onClick:()=>void xt(),disabled:H,"aria-busy":H,children:[H?(0,T.jsx)(S,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,T.jsx)(Ge,{className:`size-3.5`,"aria-hidden":!0}),`Download`]})]})]})})]})}var L={builtin:`Built-in`,personal:`Personal`,community:`Community`},R=`border-border/60 bg-muted/40 text-muted-foreground`,st={builtin:R,personal:`border-primary/40 bg-primary/10 text-primary`,community:`border-accent/40 bg-accent/10 text-accent`};function z(e){return e===`cwd`||e===`namespace`?`personal`:e}function B(e){return L[z(e)]??e}function V(e){return st[z(e)]??R}export{E as a,A as c,Je as d,ot as i,j as l,B as n,k as o,z as r,M as s,V as t,Ye as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./control-C_0G31vu.js";export{e as ControlPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{at as n}from"./vendor-ui-CWUk2ulb.js";import{A as r,B as i,E as a,F as o,G as s,H as c,I as l,J as u,K as d,L as f,M as p,P as ee,R as m,U as h,V as g,W as _,Y as v,j as te,k as ne,q as y,z as b}from"./api-CrYvIV3A.js";import{t as x}from"./proxy-Be4WzmcS.js";import{t as S}from"./AnimatePresence-CPmH1DMY.js";import{i as re,r as ie}from"./dist-xY0pK9Wy.js";import{a as ae,i as oe,n as se,o as ce,r as le,s as ue,t as de}from"./copy-button-BvU3RDZa.js";import{t as C}from"./shallow-Cin0mLuv.js";import{S as w,d as fe,l as T,u as pe,w as me,x as he}from"./format-CshN6yEB.js";import{n as E,t as D}from"./utils-XFKvwlFT.js";import{t as ge}from"./activity-Cy_niK56.js";import{t as _e}from"./arrow-right-BjBb4z7g.js";import{c as ve,i as ye,l as be,n as xe,s as Se,t as Ce}from"./select-CmlY1M1a.js";import{a as we,c as O,i as Te,n as Ee,o as k,r as De,s as Oe,t as ke}from"./tabs-4SeH2unv.js";import{a as A,c as Ae,i as je,l as Me,n as Ne,r as Pe,s as Fe,t as Ie}from"./validation-pFKbjwNg.js";import{i as Le,n as Re,r as ze,t as Be}from"./checkbox-C_4HRnS_.js";import{t as Ve}from"./layers-1figUpjG.js";import{c as He,r as Ue,t as j}from"./use-engine-command-mutation-CT_3rCP3.js";import{t as We}from"./triangle-alert-BXrJNk3g.js";import{i as Ge,n as Ke,t as qe}from"./tooltip-D1ydB4g3.js";import{r as M}from"./engine-store-DMULdR_V.js";import{t as Je}from"./transition-nav-link-BWSxzHUf.js";import{t as N}from"./badge-eIn_7YrK.js";import{t as Ye}from"./label-CMBWxUhA.js";import{a as Xe,c as P,i as F,l as I,n as Ze,o as L,r as Qe,s as R,t as $e}from"./combobox-BCaV1Wbo.js";var et=E(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),tt=E(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),nt=E(`octagon-alert`,[[`path`,{d:`M12 16h.01`,key:`1drbdi`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z`,key:`1fd625`}]]),rt=E(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),it=E(`power-off`,[[`path`,{d:`M18.36 6.64A9 9 0 0 1 20.77 15`,key:`dxknvb`}],[`path`,{d:`M6.16 6.16a9 9 0 1 0 12.68 12.68`,key:`1x7qb5`}],[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),at=E(`power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),ot=E(`radio-tower`,[[`path`,{d:`M4.9 16.1C1 12.2 1 5.8 4.9 1.9`,key:`s0qx1y`}],[`path`,{d:`M7.8 4.7a6.14 6.14 0 0 0-.8 7.5`,key:`1idnkw`}],[`circle`,{cx:`12`,cy:`9`,r:`2`,key:`1092wv`}],[`path`,{d:`M16.2 4.8c2 2 2.26 5.11.8 7.47`,key:`ojru2q`}],[`path`,{d:`M19.1 1.9a9.96 9.96 0 0 1 0 14.1`,key:`rhi7fg`}],[`path`,{d:`M9.5 18h5`,key:`mfy3pd`}],[`path`,{d:`m8 22 4-11 4 11`,key:`25yftu`}]]),st=E(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),ct=E(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),lt=E(`trash`,[[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]);h({path:s().min(1),name:s().min(1),description:s().optional(),memberCount:c().int().nonnegative(),methodCount:c().int().nonnegative(),faultCount:c().int().nonnegative(),hasLifecycle:f(),lifecycleStageCount:c().int().nonnegative()}),h({path:s().min(1),id:s().min(1),name:s().min(1),description:s().optional(),areaCount:c().int().nonnegative(),twinAssignmentCount:c().int().nonnegative(),uniqueModelCount:c().int().nonnegative(),modelNames:l(s().min(1)),totalTwinCount:c().int().nonnegative()});var ut=h({severity:b([`error`,`warning`]),message:s(),fix:s()});h({valid:f(),templatePath:s(),issues:l(ut)});var dt=`%.A.Hz.L.L/h.L/min.L/s.N.V.bar.cfm.count.degC.h.kN.kVA.kW.kWh.m.m/s.m3.m3/h.mm.mm/min.mm/s.ppm.pu.rpm.s`.split(`.`),z=b(dt);new Set(dt);var ft=s().min(1).max(128).regex(/^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/),pt=b([`Boolean`,`Int32`,`UInt16`,`UInt32`,`Double`,`Float`,`String`]);b([`variable`,`property`]);var mt=b([`read`,`readwrite`,`write`]),ht=b([`>`,`>=`,`<`,`<=`,`==`,`!=`]),gt=`Must be 1-64 chars and contain only letters, numbers, underscores, or hyphens.`,_t=m(`type`,[h({type:g(`threshold`),member:s().regex(p,gt),operator:ht,threshold:c().finite()}).strict(),h({type:g(`lifecycle-stage`)}).strict(),h({type:g(`health-state`)}).strict(),h({type:g(`fault-active`)}).strict(),h({type:g(`fault-count`)}).strict(),h({type:g(`active-fault-code`),fallback:s().default(``)}).strict(),h({type:g(`availability-state`),member:s().regex(p,gt),operator:ht.default(`>`),threshold:c().finite().default(0),running_state:s().default(`running`),stopped_state:s().default(`stopped`),faulted_state:s().default(`faulted`)}).strict()]),B=`Must be 1-64 chars and contain only letters, numbers, underscores, or hyphens.`,V=l(s().min(1)).min(1),vt=h({data_type:pt,unit:z.optional(),description:s().optional(),enum_values:V.optional()}).strict(),yt=y([h({member:s().regex(p,B),value:y([c(),s(),f()])}).strict(),h({member:s().regex(p,B),argument:s().regex(p,B)}).strict()]),bt=h({type:g(`set-members`),writes:l(yt).min(1)}).strict(),xt=y([h({parameter:s().regex(p,B),value:c().finite()}).strict(),h({parameter:s().regex(p,B),argument:s().regex(p,B)}).strict()]),St=m(`type`,[bt,h({type:g(`set-parameters`),writes:l(xt).min(1)}).strict(),h({type:g(`clear-faults`)}).strict()]),Ct=h({description:s().optional(),input_arguments:_(s().regex(p,B),vt).optional(),output_arguments:_(s().regex(p,B),vt).optional(),runtime:St.optional()}).strict(),wt=_(s().regex(p,B),Ct);function H(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Tt(e){if(typeof e==`string`)return o.exec(e)?.[1]}function Et(e,t,n){if(!H(e)||e.type!==`weighted-sum`)return;let r=e.terms;if(Array.isArray(r))for(let e=0;e<r.length;e++){let i=r[e];H(i)&&n(i,[...t,`terms`,e])}}function Dt(e,t,n){if(!H(e))return;let r=[...t,`member`],i=[...t,`previous_member`],a=[...t,`param`],o=[...t,`generator`];typeof e.member==`string`&&n.onMember?.(e.member,r),typeof e.previous_member==`string`&&n.onPreviousMember?.(e.previous_member,i),typeof e.param==`string`&&n.onParam?.(e.param,a),`generator`in e&&n.onGenerator?.(e.generator,o)}function Ot(e,t,n,r){return{onMember:e,onPreviousMember:t,onParam:n,onGenerator:r}}function kt(e,t,n,r,i,a){Dt(e,t,Ot(n,r,i,a))}function U(e){return e===`Double`||e===`Float`||e===`Int32`||e===`UInt16`||e===`UInt32`}function At(e){return e===`Int32`||e===`UInt16`||e===`UInt32`}function W(e,t){switch(t){case`Boolean`:return typeof e==`boolean`;case`String`:return typeof e==`string`;case`Double`:case`Float`:return typeof e==`number`&&Number.isFinite(e);case`Int32`:return typeof e==`number`&&Number.isSafeInteger(e)&&e>=-2147483648&&e<=2147483647;case`UInt16`:return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0&&e<=65535;case`UInt32`:return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0&&e<=4294967295;default:return!1}}function jt(e,t,n){e.unit!==void 0&&(e.data_type===`Boolean`||e.data_type===`String`)&&t.addIssue({code:v.custom,path:[...n,`unit`],message:`Members with data_type "${e.data_type}" must not declare engineering units. Fix: remove the unit or use a numeric data_type.`}),e.enum_values&&e.data_type!==`String`&&t.addIssue({code:v.custom,path:[...n,`enum_values`],message:`enum_values is only valid for String members. Fix: remove enum_values or change data_type to "String".`})}function Mt(e,t,n,r){if(H(e)&&typeof e.type==`string`)switch(e.type){case`correlated`:typeof e.source==`string`&&n.push({member:e.source,path:[...t,`source`],previousTick:!1}),K(e.factor,[...t,`factor`],r),K(e.offset,[...t,`offset`],r);return;case`sine`:case`noise`:case`waveform`:case`chirp`:K(e.center,[...t,`center`],r);return;case`mean-reverting-noise`:K(e.mean,[...t,`mean`],r);return;case`first-order-lag`:case`second-order`:K(e.gain,[...t,`gain`],r),K(e.bias,[...t,`bias`],r),G(e.input,[...t,`input`],n,r);return;case`transport-delay`:K(e.delay,[...t,`delay`],r),G(e.input,[...t,`input`],n,r);return;case`slew-rate-limiter`:case`integrator`:G(e.input,[...t,`input`],n,r);return;case`hysteresis-relay`:K(e.on_threshold,[...t,`on_threshold`],r),K(e.off_threshold,[...t,`off_threshold`],r),G(e.input,[...t,`input`],n,r);return;case`weighted-sum`:K(e.bias,[...t,`bias`],r),Et(e,t,(e,t)=>{K(e.weight,[...t,`weight`],r),G(e.input,[...t,`input`],n,r)});return;case`gate`:n.push({member:String(e.enabled_member),path:[...t,`enabled_member`],previousTick:!1}),G(e.input,[...t,`input`],n,r);return;case`health-dependent`:{let i=e.stages;if(!H(i))return;for(let[e,a]of Object.entries(i))Mt(a,[...t,`stages`,e],n,r);return}default:return}}function G(e,t,n,r){kt(e,t,(e,t)=>n.push({member:e,path:t,previousTick:!1}),(e,t)=>n.push({member:e,path:t,previousTick:!0}),(e,t)=>r.push({param:e,path:t}),(e,t)=>Mt(e,t,n,r))}function K(e,t,n){let r=Tt(e);r!==void 0&&n.push({param:r,path:t})}function Nt(e,t,n){if(!H(e))return;let r=e.type;(r===`threshold`||r===`availability-state`)&&typeof e.member==`string`&&n.push({member:e.member,path:[...t,`member`],previousTick:!1})}function Pt(e,t,n){if(!H(e))return;let r=e.type;if(typeof r!=`string`)return;if(r===`integrator`&&e.wrap===!0&&(typeof e.wrap_at!=`number`||!Number.isFinite(e.wrap_at)||e.wrap_at<=0)&&n.addIssue({code:v.custom,path:[...t,`wrap_at`],message:`wrap_at must be a finite number greater than 0 when wrap is true. Fix: Set wrap_at to a positive number, or set wrap to false.`}),r===`health-dependent`){let r=e.stages;if(H(r))for(let[e,i]of Object.entries(r))Pt(i,[...t,`stages`,e],n)}function i(e,t){!H(e)||!(`generator`in e)||Pt(e.generator,[...t,`generator`],n)}i(e.input,[...t,`input`]),Et(e,t,(e,t)=>{i(e.input,[...t,`input`])})}function Ft(e){switch(e){case`Boolean`:return!1;case`String`:return``;case`Double`:case`Float`:case`Int32`:case`UInt16`:case`UInt32`:return 0;default:return 0}}var It=l(m(`type`,[h({type:g(`white_noise`),strength:c().min(0).max(1),scale:c().positive().optional()}).strict(),h({type:g(`drift`),tau:c().positive(),sigma:c().min(0).max(1),scale:c().positive().optional()}).strict(),h({type:g(`outlier`),probability:c().min(0).max(1),magnitude:c().positive(),scale:c().positive().optional()}).strict(),h({type:g(`gap`),probability:c().min(0).max(1),duration:c().int().positive().default(10)}).strict(),h({type:g(`noise_burst`),probability:c().min(0).max(1),duration:c().int().positive().default(5),strength:c().min(0).max(1),scale:c().positive().optional()}).strict()])).min(1).optional(),Lt=`Must be 1-64 chars and contain only letters, numbers, underscores, or hyphens.`;b([`float`,`int`,`string`,`bool`]);var Rt=m(`type`,[h({type:g(`float`),default:c().finite(),min:c().finite().optional(),max:c().finite().optional(),unit:z.optional()}),h({type:g(`int`),default:c().int().safe(),min:c().int().safe().optional(),max:c().int().safe().optional(),unit:z.optional()}),h({type:g(`string`),default:s(),unit:z.optional()}),h({type:g(`bool`),default:f(),unit:z.optional()})]),q=y([h({member:s()}).strict(),h({previous_member:s()}).strict(),h({param:s()}).strict(),h({generator:i(()=>mn)}).strict()]),zt=s().regex(o,`Must be a $param.X parameter reference`),J=y([c(),zt]),Bt=y([c().finite(),zt]),Vt={initial_value:c().default(0),gain:J.default(1),bias:J.default(0),min:c().nullable().default(null),max:c().nullable().default(null),input:q},Ht=h({type:g(`sine`),center:J,amplitude:c().positive(),period:c().positive()}).strict(),Ut=h({type:g(`random-walk`),min:c(),max:c(),step:c().positive()}).strict(),Wt=h({type:g(`noise`),center:J,stddev:c().positive()}).strict(),Gt=h({type:g(`step`),values:l(c()).min(1),interval:c().positive()}).strict(),Kt=h({type:g(`correlated`),source:s().regex(p,Lt),factor:Bt,offset:Bt,power:c().int().positive().optional()}).strict(),qt=h({from:s(),to:s(),probability:c().min(0).max(1).optional(),on:s().optional()}).strict(),Jt=h({type:g(`state-machine`),states:l(s()).min(1),initial:s(),transitions:l(qt).min(1)}).strict();function Y(e,t){let n=new Set(e.states);n.has(e.initial)||t.addIssue({code:v.custom,path:[`initial`],message:`State machine initial state "${e.initial}" is not in states. Fix: Set initial to one of: ${e.states.join(`, `)}.`});for(let r=0;r<e.transitions.length;r++){let i=e.transitions[r];i&&(n.has(i.from)||t.addIssue({code:v.custom,path:[`transitions`,r,`from`],message:`State machine transition from "${i.from}" references a state that is not in states. Fix: Add "${i.from}" to states or change transition.from to one of: ${e.states.join(`, `)}.`}),n.has(i.to)||t.addIssue({code:v.custom,path:[`transitions`,r,`to`],message:`State machine transition to "${i.to}" references a state that is not in states. Fix: Add "${i.to}" to states or change transition.to to one of: ${e.states.join(`, `)}.`}))}}Jt.superRefine(Y);var Yt=h({type:g(`ramp`),start_value:c().default(0),rate:c(),duration:c().nonnegative(),start_time:c().default(0),min:c().nullable().default(null),max:c().nullable().default(null)}).strict(),Xt=h({type:g(`mean-reverting-noise`),mean:J,tau:c().positive(),sigma:c().positive(),initial_value:c().optional(),min:c().nullable().default(null),max:c().nullable().default(null)}).strict(),Zt=h({time:c().nonnegative(),value:c()}),Qt=h({type:g(`timetable`),points:l(Zt).min(2),repeat:f().default(!1),interpolation:b([`linear`,`step`]).default(`linear`)}).strict(),$t=h({type:g(`waveform`),shape:b([`sawtooth`,`triangle`,`square`,`pulse`]),center:J,amplitude:c().positive(),period:c().positive(),duty_cycle:c().min(0).max(1).default(.5)}).strict(),en=h({type:g(`chirp`),center:J,amplitude:c().positive(),start_freq_hz:c().positive(),end_freq_hz:c().positive(),sweep_duration:c().positive(),sweep:b([`linear`,`exponential`]).default(`linear`),repeat:f().default(!0)}).strict(),tn=h({type:g(`impulse`),baseline:c().default(0),amplitude:c(),probability:c().min(0).max(1).optional(),interval:c().positive().optional(),decay:c().min(0).max(1).optional(),duration:c().int().positive().default(1)}).strict();function nn(e,t){e.probability===void 0&&e.interval===void 0&&t.addIssue({code:v.custom,path:[`probability`],message:`Impulse generator requires either probability or interval. Fix: Add probability: 0.01 (per-tick chance) or interval: 60 (seconds between triggers).`}),e.probability!==void 0&&e.interval!==void 0&&t.addIssue({code:v.custom,path:[`interval`],message:`Impulse generator cannot have both probability and interval. Fix: Remove one: use probability for random triggers, or interval for periodic triggers.`})}tn.superRefine(nn);var rn=h({type:g(`first-order-lag`),tau:c().positive(),...Vt}).strict(),an=h({type:g(`integrator`),initial_value:c().default(0),gain:c().default(1),bias_rate:c().default(0),min:c().default(-1/0),max:c().default(1/0),wrap:f().default(!1),wrap_at:c().nullable().default(null),input:q}).strict(),on=h({type:g(`transport-delay`),delay:y([c().nonnegative(),zt]),initial_value:c().default(0),interpolation:b([`linear`,`zoh`]).default(`linear`),input:q}).strict(),sn=h({type:g(`slew-rate-limiter`),rate_up:c().positive(),rate_down:c().positive().optional(),initial_value:c().default(0),min:c().nullable().default(null),max:c().nullable().default(null),input:q}).strict(),cn=h({type:g(`second-order`),natural_freq_hz:c().positive(),damping_ratio:c().positive(),initial_velocity:c().default(0),...Vt}).strict(),ln=h({type:g(`hysteresis-relay`),on_threshold:J,off_threshold:J,output_on:y([c(),s()]).default(1),output_off:y([c(),s()]).default(0),initial_state:b([`on`,`off`]).default(`off`),mode:b([`rising`,`falling`]).default(`rising`),input:q}).strict(),un=h({weight:J.default(1),input:q}),dn=h({type:g(`weighted-sum`),bias:J.default(0),terms:l(un).min(1),min:c().nullable().default(null),max:c().nullable().default(null)}).strict(),fn=h({type:g(`gate`),enabled_member:s().regex(p,Lt),input:q,disabled_value:y([c(),s(),f()])}).strict(),pn=m(`type`,[Ht,Ut,Wt,Gt,Kt,Jt,Yt,Xt,Qt,$t,en,tn]).superRefine((e,t)=>{e.type===`state-machine`&&Y(e,t),e.type===`impulse`&&nn(e,t)}),mn=m(`type`,[Ht,Ut,Wt,Gt,Kt,Jt,Yt,Xt,Qt,$t,en,tn,h({type:g(`health-dependent`),stages:_(s(),pn)}).strict(),rn,an,on,sn,cn,ln,dn,fn]).superRefine((e,t)=>{e.type===`state-machine`&&Y(e,t),e.type===`impulse`&&nn(e,t)}),hn=h({multiplier:c().finite().optional(),offset:c().finite().optional()}).strict(),gn=h({stages:l(h({name:s().min(1),duration_hours:d([c().nonnegative(),c().nonnegative()]).refine(([e,t])=>e<=t,{message:`duration_hours max must be greater than or equal to min.`}),effects:_(s(),hn)})).min(1)}).superRefine((e,t)=>{let n=new Set;for(let r=0;r<e.stages.length;r++){let i=e.stages[r];i&&(n.has(i.name)&&t.addIssue({code:v.custom,path:[`stages`,r,`name`],message:`Lifecycle stage names must be unique. Duplicate "${i.name}". Fix: Rename one stage so each lifecycle stage has a unique name.`}),n.add(i.name))}}),_n=h({multiplier:c().finite().optional(),offset:c().finite().optional(),spike:c().finite().optional(),duration_ticks:c().int().positive().optional(),onset_ticks:c().int().positive().optional(),recovery_ticks:c().int().positive().optional()}).strict(),vn=h({condition:s().optional(),lifecycle_stage:s().optional(),probability:c().min(0).max(1)}),yn=h({name:s().regex(p,Lt),trigger:vn,effects:_(s(),y([_n,s()]))}),bn=`Must be 1-64 chars and contain only letters, numbers, underscores, or hyphens.`,xn=s().regex(o,`Must be a $param.X parameter reference`),Sn=y([c(),s(),f()]),Cn=h({name:s().regex(p,bn),description:s().optional(),namespace:s().optional()}).strict(),wn=m(`kind`,[h({kind:g(`variable`),data_type:pt,access:mt,unit:z.optional(),enum_values:V.optional(),eu_range:d([c(),c()]).refine(([e,t])=>e<=t,{message:`eu_range[0] (min) must be <= eu_range[1] (max).`}).optional(),generator:mn.optional(),binding:_t.optional(),default:Sn.optional(),observation_effects:It}).strict(),h({kind:g(`property`),data_type:pt,access:mt,unit:z.optional(),enum_values:V.optional(),default:y([Sn,xn]).optional()}).strict()]);function Tn(e){return _(s().regex(p,bn),wn).refine(e=>Object.keys(e).length>=1,{message:`Members map must have at least 1 member.`}).refine(t=>Object.keys(t).length<=e,{message:`Members map must have at most ${e} members.`})}function En(e={}){let t=Tn(e.maxMembersPerModel??1e3);return h({schema_version:g(`2`),model:Cn,parameters:_(s(),Rt).optional(),members:t,methods:wt.optional(),lifecycle:gn.optional(),faults:l(yn).optional()}).strict().superRefine((e,t)=>{let n=Object.keys(e.members),r=new Map;for(let e=0;e<n.length;e++){let t=n[e];t!==void 0&&r.set(t,e)}let i=new Set(Object.keys(e.parameters??{})),a=new Set(Object.entries(e.parameters??{}).filter(([,e])=>e.type===`float`||e.type===`int`).map(([e])=>e));for(let o=0;o<n.length;o++){let s=n[o];if(s===void 0)continue;let c=e.members[s];if(!c||(jt(c,t,[`members`,s]),c.kind===`variable`&&c.generator!==void 0&&c.binding!==void 0&&t.addIssue({code:v.custom,path:[`members`,s,`binding`],message:`Variable members cannot define both "generator" and "binding". Fix: keep one source of value generation.`}),c.kind===`variable`&&c.binding!==void 0&&c.access!==`read`&&t.addIssue({code:v.custom,path:[`members`,s,`access`],message:`Variable members with a "binding" must use access "read". Fix: change access to "read" or remove the binding.`}),c.kind!==`variable`||!c.generator&&!c.binding))continue;let l=[],u=[],d=[`members`,s,`generator`];if(c.generator&&Mt(c.generator,d,l,u),c.binding&&Nt(c.binding,[`members`,s,`binding`],l),c.generator&&(Pt(c.generator,d,t),c.generator.type===`gate`)){let n=e.members[c.generator.enabled_member];n&&n.data_type!==`Boolean`&&t.addIssue({code:v.custom,path:[`members`,s,`generator`,`enabled_member`],message:`Gate generator for "${s}" references "${c.generator.enabled_member}", but "${c.generator.enabled_member}" is not Boolean. Fix: use a Boolean command/state member for enabled_member.`}),W(c.generator.disabled_value,c.data_type)||t.addIssue({code:v.custom,path:[`members`,s,`generator`,`disabled_value`],message:`Gate generator disabled_value for "${s}" does not match data_type "${c.data_type}". Fix: use a compatible disabled_value literal.`})}for(let e of l){let n=r.get(e.member);if(n===void 0){t.addIssue({code:v.custom,path:[...e.path],message:`Member "${s}" references member "${e.member}", but "${e.member}" is not defined. Fix: Define "${e.member}" in members, or change the reference to a parameter.`});continue}!e.previousTick&&n>=o&&t.addIssue({code:v.custom,path:[...e.path],message:`Member "${s}" references member "${e.member}" which is defined later (or is itself). Members are evaluated in declaration order. Fix: Move "${e.member}" above "${s}".`})}for(let n of u)i.has(n.param)?a.has(n.param)||t.addIssue({code:v.custom,path:[...n.path],message:`Member "${s}" references parameter "${n.param}" in a numeric position, but "${n.param}" has type "${e.parameters?.[n.param]?.type}". Only float and int parameters can be used as generator coefficients or inputs. Fix: Change "${n.param}" to type "float" or "int".`}):t.addIssue({code:v.custom,path:[...n.path],message:`Member "${s}" references parameter "${n.param}", but "${n.param}" is not defined. Fix: Define "${n.param}" under parameters, or replace "$param.${n.param}" with a literal value.`});if(c.binding)switch(c.binding.type){case`threshold`:c.data_type!==`Boolean`&&t.addIssue({code:v.custom,path:[`members`,s,`data_type`],message:`Members using binding.type "threshold" must use data_type "Boolean". Fix: change data_type to "Boolean".`}),Dn(s,c.binding.member,e,t,[`members`,s,`binding`,`member`]);break;case`availability-state`:c.data_type!==`String`&&t.addIssue({code:v.custom,path:[`members`,s,`data_type`],message:`Members using binding.type "availability-state" must use data_type "String". Fix: change data_type to "String".`}),Dn(s,c.binding.member,e,t,[`members`,s,`binding`,`member`]);break;case`lifecycle-stage`:case`health-state`:case`active-fault-code`:c.data_type!==`String`&&t.addIssue({code:v.custom,path:[`members`,s,`data_type`],message:`Members using binding.type "${c.binding.type}" must use data_type "String". Fix: change data_type to "String".`});break;case`fault-active`:c.data_type!==`Boolean`&&t.addIssue({code:v.custom,path:[`members`,s,`data_type`],message:`Members using binding.type "fault-active" must use data_type "Boolean". Fix: change data_type to "Boolean".`});break;case`fault-count`:c.data_type!==`Int32`&&c.data_type!==`UInt16`&&c.data_type!==`UInt32`&&t.addIssue({code:v.custom,path:[`members`,s,`data_type`],message:`Members using binding.type "fault-count" must use an integer data_type (Int32, UInt16, or UInt32). Fix: change data_type to an integer type.`});break;default:c.binding}if(c.kind===`variable`&&c.observation_effects){U(c.data_type)||t.addIssue({code:v.custom,path:[`members`,s,`observation_effects`],message:`Observation effects on "${s}" require a numeric data_type (Double, Float, Int32, UInt16, or UInt32). Member has data_type "${c.data_type}", which cannot be degraded by noise, gaps, or drift. Fix: remove observation_effects, or change data_type to a numeric type.`}),c.access!==`read`&&t.addIssue({code:v.custom,path:[`members`,s,`observation_effects`],message:`Observation effects on "${s}" require access "read". Observation effects corrupt values — they must not be applied to command targets or setpoints. Fix: change access to "read" or remove observation_effects.`});for(let e=0;e<c.observation_effects.length;e++){let n=c.observation_effects[e];n&&(n.type===`white_noise`||n.type===`drift`||n.type===`outlier`||n.type===`noise_burst`)&&!(`scale`in n&&n.scale!==void 0)&&!c.eu_range&&t.addIssue({code:v.custom,path:[`members`,s,`observation_effects`,e],message:`Member "${s}" uses relative observation effect "${n.type}" but has no eu_range and no explicit scale. Fix: add eu_range: [min, max] to the member, or add scale: <number> to the effect.`})}}}function o(n,i,a){if(!r.has(n)){t.addIssue({code:v.custom,path:[...i],message:`${a} has effect on "${n}", but "${n}" is not a defined member. Fix: Change "${n}" to a valid member name.`});return}let o=e.members[n];o&&o.kind!==`variable`&&t.addIssue({code:v.custom,path:[...i],message:`${a} has effect on "${n}", but "${n}" is a property (kind: "property"). Effects can only target variable members.`})}if(e.lifecycle){let t=[`lifecycle`,`stages`];for(let n of e.lifecycle.stages)for(let e of Object.keys(n.effects))o(e,t,`Lifecycle stage "${n.name}"`)}if(e.faults){let n=new Set;for(let r=0;r<e.faults.length;r++){let i=e.faults[r];if(!i)continue;n.has(i.name)&&t.addIssue({code:v.custom,path:[`faults`,r,`name`],message:`Fault names must be unique. Duplicate "${i.name}". Fix: Rename one fault so each fault has a unique name.`}),n.add(i.name);let a=[`faults`,r,`effects`];for(let e of Object.keys(i.effects))o(e,a,`Fault "${i.name}"`)}}for(let r of n){let n=e.members[r];if(!n||n.kind!==`property`||typeof n.default!=`string`)continue;let a=Tt(n.default);a!==void 0&&!i.has(a)&&t.addIssue({code:v.custom,path:[`members`,r,`default`],message:`Property "${r}" default references parameter "${a}", but "${a}" is not defined. Fix: Define "${a}" under parameters, or use a literal value.`})}if(e.methods)for(let[n,r]of Object.entries(e.methods))On(n,r.input_arguments,t,[`methods`,n,`input_arguments`]),On(n,r.output_arguments,t,[`methods`,n,`output_arguments`]),kn(n,r,e,t,[`methods`,n,`runtime`])})}function Dn(e,t,n,r,i){let a=n.members[t];a&&(U(a.data_type)||r.addIssue({code:v.custom,path:[...i],message:`Member "${e}" binding references "${t}", but "${t}" is not numeric. Fix: bind to a numeric member or change the source member data_type.`}))}function On(e,t,n,r){if(t)for(let[i,a]of Object.entries(t))a.unit!==void 0&&(a.data_type===`Boolean`||a.data_type===`String`)&&n.addIssue({code:v.custom,path:[...r,i,`unit`],message:`Method "${e}" argument "${i}" uses data_type "${a.data_type}" and must not declare an engineering unit. Fix: remove the unit or use a numeric data_type.`}),a.enum_values&&a.data_type!==`String`&&n.addIssue({code:v.custom,path:[...r,i,`enum_values`],message:`Method "${e}" argument "${i}" can only use enum_values with data_type "String". Fix: remove enum_values or change the data_type.`})}function kn(e,t,n,r,i){let a=t.runtime;if(a)switch(a.type){case`clear-faults`:return;case`set-parameters`:for(let o=0;o<a.writes.length;o++){let s=a.writes[o];if(!s)continue;let c=[...i,`writes`,o],l=n.parameters?.[s.parameter];if(!l){r.addIssue({code:v.custom,path:[...c,`parameter`],message:`Method "${e}" runtime targets parameter "${s.parameter}", but "${s.parameter}" is not defined. Fix: target a declared parameter.`});continue}if(l.type!==`float`&&l.type!==`int`){r.addIssue({code:v.custom,path:[...c,`parameter`],message:`Method "${e}" runtime targets parameter "${s.parameter}" of type "${l.type}". Fix: use set-parameters only with float or int parameters.`});continue}if(`argument`in s){let n=t.input_arguments?.[s.argument];if(!n){r.addIssue({code:v.custom,path:[...c,`argument`],message:`Method "${e}" runtime references input argument "${s.argument}", but that argument is not defined. Fix: declare the input argument or use a literal value.`});continue}U(n.data_type)||r.addIssue({code:v.custom,path:[...c,`argument`],message:`Method "${e}" runtime argument "${s.argument}" must be numeric to write parameter "${s.parameter}". Fix: use Double, Float, Int32, UInt16, or UInt32.`}),l.type===`int`&&!At(n.data_type)&&r.addIssue({code:v.custom,path:[...c,`argument`],message:`Method "${e}" runtime argument "${s.argument}" uses data_type "${n.data_type}" but parameter "${s.parameter}" is type "int". Fix: use Int32, UInt16, or UInt32 so runtime writes stay integer-safe.`});continue}l.type===`int`&&!Number.isSafeInteger(s.value)&&r.addIssue({code:v.custom,path:[...c,`value`],message:`Method "${e}" runtime literal for integer parameter "${s.parameter}" must be a safe integer. Fix: use a whole-number literal.`})}return;case`set-members`:for(let o=0;o<a.writes.length;o++){let s=a.writes[o];if(!s)continue;let c=[...i,`writes`,o],l=n.members[s.member];if(!l){r.addIssue({code:v.custom,path:[...c,`member`],message:`Method "${e}" runtime targets member "${s.member}", but "${s.member}" is not defined. Fix: target a declared member.`});continue}if(l.kind!==`variable`&&r.addIssue({code:v.custom,path:[...c,`member`],message:`Method "${e}" runtime targets "${s.member}", but "${s.member}" is a property. Fix: target a writable variable member.`}),l.access!==`readwrite`&&l.access!==`write`&&r.addIssue({code:v.custom,path:[...c,`member`],message:`Method "${e}" runtime targets "${s.member}", but "${s.member}" is not writable. Fix: set access to "readwrite" or "write".`}),l.kind===`variable`&&l.binding&&r.addIssue({code:v.custom,path:[...c,`member`],message:`Method "${e}" runtime targets "${s.member}", but bound members are computed at runtime. Fix: write to a command/setpoint member without a binding.`}),`argument`in s){let n=t.input_arguments?.[s.argument];if(!n){r.addIssue({code:v.custom,path:[...c,`argument`],message:`Method "${e}" runtime references input argument "${s.argument}", but that argument is not defined. Fix: declare the input argument or use a literal value.`});continue}if(W(Ft(n.data_type),l.data_type)||r.addIssue({code:v.custom,path:[...c,`argument`],message:`Method "${e}" runtime argument "${s.argument}" uses data_type "${n.data_type}" which does not match target member "${s.member}" data_type "${l.data_type}". Fix: align the argument and target member data types.`}),n.enum_values&&l.enum_values){let t=n.enum_values.filter(e=>!l.enum_values?.includes(e));t.length>0&&r.addIssue({code:v.custom,path:[...c,`argument`],message:`Method "${e}" runtime argument "${s.argument}" allows values [${t.join(`, `)}] that are not valid for target member "${s.member}". Fix: align enum_values between the argument and target member.`})}continue}W(s.value,l.data_type)||r.addIssue({code:v.custom,path:[...c,`value`],message:`Method "${e}" runtime literal for "${s.member}" does not match data_type "${l.data_type}". Fix: use a compatible literal value.`}),l.enum_values&&typeof s.value==`string`&&!l.enum_values.includes(s.value)&&r.addIssue({code:v.custom,path:[...c,`value`],message:`Method "${e}" runtime literal "${s.value}" is not allowed for member "${s.member}". Fix: use one of [${l.enum_values.join(`, `)}].`})}return;default:}}En();var An=y([c().finite(),s(),f()]),jn=s().regex(/^[a-f0-9]{64}$/),Mn=h({id:s().min(1),model:s().min(1),browsePath:l(s().min(1)).min(1),parameters:_(s(),An),lifecycleStage:s().min(1),operatingHours:c().finite().nonnegative(),activeFaults:l(s().min(1)),templateRunId:c().int().positive().optional(),protocolScope:l(a).min(1).optional(),observationState:_(s(),_(s(),u())).optional().default({}),faultState:_(s(),h({remaining:c().int(),elapsed:c().int(),recovering:f(),recoveryElapsed:c().int(),recoveryTicks:c().int()})).optional().default({})}),Nn=h({templateRunId:c().int().positive(),templateName:s().min(1),templatePath:s(),entryHash:jn.optional()}),Pn=h({name:s().min(1),enabled:f(),config:_(s(),u())});h({version:g(2),savedAt:s().min(1),environmentName:ft,models:l(s().min(1)),instances:l(Mn),templateRuns:l(Nn),adapters:l(Pn).default([])});var X=e(t(),1),Z=n(),Fn={mqtt:we,opcua:Re,modbus:tt},In={mqtt:`MQTT`,opcua:`OPC UA`,modbus:`Modbus TCP`},Ln={mqtt:r,opcua:te,modbus:ne};function Rn({adapter:e}){let t=e.pending?`pending`:e.enabled?`enabled`:`disabled`;return(0,Z.jsx)(S,{mode:`wait`,initial:!1,children:(0,Z.jsx)(x.div,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},transition:{type:`spring`,stiffness:500,damping:30},children:e.pending?(0,Z.jsxs)(N,{className:`gap-1 bg-info/20 text-info hover:bg-info/20`,children:[(0,Z.jsx)(k,{className:`size-3 animate-spin`}),e.enabled?`Disabling...`:`Enabling...`]}):e.enabled?(0,Z.jsxs)(N,{className:`gap-1 bg-success/20 text-success hover:bg-success/20`,children:[(0,Z.jsx)(O,{className:`size-3`}),`Enabled`]}):(0,Z.jsxs)(N,{variant:`outline`,className:`gap-1 text-muted-foreground`,children:[(0,Z.jsx)(et,{className:`size-2`}),`Disabled`]})},t)})}function zn({metrics:e}){return e?e.connected?null:(0,Z.jsxs)(N,{variant:`destructive`,className:`gap-1`,children:[(0,Z.jsx)(Oe,{className:`size-3`}),`Disconnected`]}):null}function Bn({health:e}){if(!e)return null;let t={healthy:`bg-success/20 text-success hover:bg-success/20`,busy:`bg-warning/20 text-warning hover:bg-warning/20`,saturated:`bg-destructive/20 text-destructive hover:bg-destructive/20`},n=e.state,r=`size-3 shrink-0`,i=n===`healthy`?(0,Z.jsx)(O,{className:r,"aria-hidden":!0}):n===`busy`?(0,Z.jsx)(ge,{className:r,"aria-hidden":!0}):n===`saturated`?(0,Z.jsx)(We,{className:r,"aria-hidden":!0}):null;return(0,Z.jsxs)(N,{className:D(`gap-1`,t[n]??``),children:[i,n]})}function Q({label:e,value:t,valueClassName:n}){return(0,Z.jsxs)(`div`,{className:`flex min-h-[3.35rem] flex-col justify-center rounded-[var(--miravo-radius-stadium-sm)] border border-border/55 px-3 py-2 transition-colors hover:border-muted-foreground/25`,children:[(0,Z.jsx)(`span`,{className:`blueprint-title text-[10px] leading-tight text-muted-foreground`,children:e}),(0,Z.jsx)(`span`,{className:D(`mt-1.5 font-mono text-[13px] leading-none tabular-nums tracking-tight text-foreground`,n),children:t})]})}function Vn({metrics:e}){return(0,Z.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-3`,children:[(0,Z.jsx)(Q,{label:`Messages sent`,value:T(e.messagesPublished)}),(0,Z.jsx)(Q,{label:`Attempted`,value:T(e.messagesAttempted)}),(0,Z.jsx)(Q,{label:`Skipped (unchanged)`,value:T(e.messagesFiltered)}),(0,Z.jsx)(Q,{label:`Errors`,value:T(e.errorsCount),valueClassName:e.errorsCount>0?`text-destructive`:void 0}),(0,Z.jsx)(Q,{label:`Publish latency`,value:`${e.lastPublishMs.toFixed(1)} ms`}),e.health?(0,Z.jsx)(Q,{label:`Queued messages`,value:String(e.health.pendingWorkCount)}):null]})}function Hn({port:e}){return(0,Z.jsxs)(`div`,{className:`flex gap-2 rounded-[var(--miravo-radius-stadium-sm)] border border-warning/30 bg-warning/10 p-3 text-sm text-warning`,children:[(0,Z.jsx)(We,{className:`mt-0.5 size-4 shrink-0`}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`p`,{className:`font-medium`,children:`Before enabling`}),(0,Z.jsxs)(`p`,{className:`mt-1 text-warning`,children:[`Ensure port `,(0,Z.jsx)(`code`,{className:`font-mono font-bold`,children:e}),` is available on the host.`]}),(0,Z.jsxs)(`ul`,{className:`mt-1 list-inside list-disc space-y-0.5 text-warning`,children:[(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`strong`,{children:`Docker:`}),` Restart with`,` `,(0,Z.jsxs)(`code`,{className:`font-mono`,children:[`-p `,e,`:`,e]}),` `,`to expose the port.`]}),(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`strong`,{children:`Bare metal:`}),` Run `,(0,Z.jsxs)(`code`,{className:`font-mono`,children:[`lsof -i :`,e]}),` to check availability.`]})]})]})]})}function Un({adapter:e,metrics:t}){let[n,r]=(0,X.useState)(!1),[i,a]=(0,X.useState)(``),[o,s]=(0,X.useState)(!1),c=j(),l=Fn[e.name]??Re,u=In[e.name]??e.name,d=Ln[e.name]??0,f=o||e.pending===!0,p=(0,X.useMemo)(()=>{let t=e.config?.port;return typeof t==`number`?t:d},[e.config,d]);return(0,Z.jsxs)(`div`,{className:`protocol-card-art min-w-0 border`,children:[(0,Z.jsxs)(`div`,{className:`relative z-2`,children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":n,className:`group/row flex w-full min-w-0 cursor-pointer gap-3 px-4 py-3 text-left transition-colors duration-[var(--miravo-duration-base)] ease-[var(--miravo-ease)] hover:bg-muted/35`,onClick:()=>r(!n),children:[(0,Z.jsx)(l,{className:`mt-0.5 size-5 shrink-0 text-muted-foreground transition-[transform,color] duration-[var(--miravo-duration-base)] ease-[var(--miravo-ease)] group-hover/row:-rotate-[8deg] group-hover/row:scale-[1.08] group-hover/row:text-primary motion-reduce:transition-none motion-reduce:group-hover/row:rotate-0 motion-reduce:group-hover/row:scale-100`,"aria-hidden":!0}),(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:(0,Z.jsxs)(`div`,{className:`flex w-full min-w-0 flex-wrap items-start justify-between gap-x-3 gap-y-2`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[e.enabled&&!e.pending&&(0,Z.jsx)(`span`,{className:`protocol-card-live-dot`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`whitespace-nowrap font-medium tracking-tight`,children:u}),(0,Z.jsx)(Rn,{adapter:e}),e.enabled&&!e.pending&&t&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(zn,{metrics:t}),t.health?(0,Z.jsx)(Bn,{health:t.health}):(0,Z.jsxs)(N,{className:`gap-1 bg-success/20 text-success hover:bg-success/20`,children:[(0,Z.jsx)(O,{className:`size-3 shrink-0`,"aria-hidden":!0}),`healthy`]})]})]}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[e.enabled&&t&&!e.pending&&(0,Z.jsxs)(`span`,{className:`protocol-card-metric-readout text-muted-foreground`,children:[(0,Z.jsx)(`span`,{className:`text-[10px] font-normal uppercase tracking-[0.12em] text-muted-foreground`,children:`out`}),` `,(0,Z.jsx)(`span`,{className:`text-foreground`,children:T(t.messagesPublished)}),(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:` msgs`}),t.errorsCount>0&&(0,Z.jsxs)(`span`,{className:`ml-1.5 text-destructive`,children:[t.errorsCount,` err`]})]}),(0,Z.jsx)(be,{className:`size-4 shrink-0 text-muted-foreground transition-[transform,color] duration-[var(--miravo-duration-base)] ease-[var(--miravo-ease)] group-hover/row:translate-y-0.5 group-hover/row:text-primary motion-reduce:transition-none motion-reduce:group-hover/row:translate-y-0 ${n?`rotate-180`:``}`})]})]})})]}),e.enabled&&!e.pending&&e.endpoint&&(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1 px-4 pb-2 pl-11`,children:[(0,Z.jsx)(`code`,{className:`min-w-0 truncate font-mono text-xs text-muted-foreground`,children:e.endpoint}),(0,Z.jsx)(de,{value:e.endpoint,label:`Copy endpoint URL`})]})]}),(0,Z.jsx)(S,{initial:!1,children:n&&(0,Z.jsx)(x.div,{initial:{height:0,opacity:0},animate:{height:`auto`,opacity:1},exit:{height:0,opacity:0},transition:{duration:.2,ease:`easeOut`},className:`overflow-hidden`,children:(0,Z.jsx)(`div`,{className:`protocol-card-art-body border-t`,children:e.enabled&&t?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`section`,{className:`px-4 pb-4 pt-4`,"aria-labelledby":`protocol-telemetry-${e.name}`,children:[(0,Z.jsxs)(`div`,{className:`mb-3 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between sm:gap-3`,children:[(0,Z.jsx)(`h4`,{id:`protocol-telemetry-${e.name}`,className:`blueprint-title shrink-0 text-muted-foreground`,children:`Telemetry`}),(0,Z.jsxs)(Je,{to:`/tags?protocol=${e.name}`,className:`group/footer-link inline-flex w-full min-h-8 min-w-0 max-w-full shrink-0 items-center justify-start gap-1.5 rounded-[var(--miravo-radius-pill)] border border-primary/25 bg-primary/5 px-2.5 py-1.5 text-xs font-medium leading-tight text-primary transition-colors hover:border-primary/40 hover:bg-primary/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background sm:w-fit`,children:[(0,Z.jsx)(`span`,{className:`whitespace-nowrap`,children:`Browse Tags`}),(0,Z.jsx)(_e,{className:`size-3 shrink-0 text-primary transition-transform group-hover/footer-link:translate-x-0.5`})]})]}),(0,Z.jsx)(Vn,{metrics:t})]}),(0,Z.jsx)(`footer`,{className:`protocol-card-art-footer flex flex-col gap-4 border-t border-border/80 px-4 pb-4 pt-4`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,Z.jsxs)(w,{variant:`destructive`,size:`sm`,className:`gap-1.5`,disabled:f,onClick:async()=>{s(!0);try{await c.mutateAsync({type:`disableAdapter`,adapter:e.name})}catch{}finally{s(!1)}},children:[f?(0,Z.jsx)(k,{className:`size-3.5 animate-spin`}):(0,Z.jsx)(it,{className:`size-3.5`}),f?`Disabling...`:`Disable ${u}`]}),!f&&(0,Z.jsx)(`span`,{className:`text-xs leading-snug text-muted-foreground`,children:`Active connections will be dropped.`})]})})]}):(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 px-4 py-4`,children:[!f&&(0,Z.jsx)(Hn,{port:i&&Number(i)||p}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(Ye,{htmlFor:`port-${e.name}`,className:`text-xs`,children:`Port`}),(0,Z.jsx)(he,{id:`port-${e.name}`,type:`number`,placeholder:String(p),value:i,onChange:e=>a(e.target.value),className:`w-28`,disabled:f})]}),(0,Z.jsxs)(w,{size:`sm`,className:`gap-1.5`,disabled:f,onClick:async()=>{s(!0);try{let t=i?Number(i):void 0,n={};t&&Number.isFinite(t)&&(n.port=t),await c.mutateAsync({type:`enableAdapter`,adapter:e.name,...Object.keys(n).length>0?{config:n}:{}})}catch{}finally{s(!1)}},children:[f?(0,Z.jsx)(k,{className:`size-3.5 animate-spin`}):(0,Z.jsx)(at,{className:`size-3.5`}),f?`Enabling...`:`Enable ${u}`]})]})]})})},`panel`)})]})}function Wn(){let{instances:e,models:t,templateRuns:n}=M(C(e=>({instances:e.instances,models:e.models,templateRuns:e.templateRuns}))),r=j(),[i,a]=(0,X.useState)(``),[o,s]=(0,X.useState)(`1`),[c,l]=(0,X.useState)(``),u=(0,X.useMemo)(()=>c?t.filter(e=>e.name.toLowerCase().includes(c.toLowerCase())):t,[t,c]);return(0,Z.jsxs)(L,{className:`h-full min-w-0`,children:[(0,Z.jsx)(P,{className:`pb-3`,children:(0,Z.jsxs)(I,{className:`flex items-center gap-2 text-xs font-medium uppercase tracking-wider`,children:[(0,Z.jsx)(Ve,{className:`size-3.5 text-muted-foreground`,"aria-hidden":!0}),`Fleet Management`]})}),(0,Z.jsxs)(R,{className:`flex flex-1 flex-col gap-4`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-[10px] font-medium uppercase tracking-wider text-muted-foreground`,children:`Spawn Instances`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2 sm:flex-row sm:items-center`,children:[(0,Z.jsx)(`div`,{className:`min-w-0 w-full sm:min-w-0 sm:flex-1`,children:(0,Z.jsxs)($e,{value:i||null,onValueChange:e=>a(e??``),onInputValueChange:l,children:[(0,Z.jsx)(Qe,{placeholder:`Select model`,className:`h-8 w-full min-w-0`,showClear:!!i}),(0,Z.jsx)(Ze,{children:(0,Z.jsxs)(Xe,{children:[u.map(e=>(0,Z.jsx)(F,{value:e.name,children:e.name},e.name)),u.length===0&&(0,Z.jsx)(`p`,{className:`py-2 text-center text-xs text-muted-foreground`,children:`No models found`})]})})]})}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,Z.jsx)(he,{type:`number`,value:o,onChange:e=>s(e.target.value),className:`h-8 w-16 text-xs`,min:`1`,"aria-label":`Number of instances to spawn`}),(0,Z.jsx)(w,{size:`sm`,className:`h-8`,onClick:()=>{let e=A(je,{model:i,count:Number(o)});e&&r.mutate({type:`spawn`,...e})},children:`Spawn`})]})]}),(0,Z.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[t.length,` models · `,e.length,` running`]})]}),n.length>0&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Fe,{}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-[10px] font-medium uppercase tracking-wider text-muted-foreground`,children:`Environment Runs`}),(0,Z.jsx)(S,{initial:!1,children:n.map(e=>(0,Z.jsx)(x.div,{initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4,transition:{duration:.12}},transition:{type:`spring`,stiffness:400,damping:30},children:(0,Z.jsxs)(`div`,{className:`flex items-center justify-between rounded-[var(--miravo-radius-tight)] border px-2.5 py-1.5`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 overflow-hidden`,children:[(0,Z.jsx)(`span`,{className:`truncate text-xs font-medium`,children:pe(e.templateName)}),(0,Z.jsxs)(N,{variant:`secondary`,className:`shrink-0 text-[10px]`,children:[e.instanceIds.length,` inst`]})]}),(0,Z.jsx)(w,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 px-1.5 text-destructive hover:text-destructive`,"aria-label":`Unload environment run`,onClick:()=>r.mutate({type:`unloadTemplateRun`,templateRunId:e.templateRunId}),children:(0,Z.jsx)(me,{className:`size-3`})})]})},e.templateRunId))})]})]})]})]})}function Gn(){let{instances:e,models:t}=M(C(e=>({instances:e.instances,models:e.models}))),n=j(),[r,i]=(0,X.useState)(``),[a,o]=(0,X.useState)(``),[s,c]=(0,X.useState)(``),l=(0,X.useMemo)(()=>s?e.filter(e=>e.id.toLowerCase().includes(s.toLowerCase())):e,[e,s]),u=(0,X.useMemo)(()=>{let n=e.find(e=>e.id===r);return n?t.find(e=>e.name===n.model)?.faultNames??[]:[]},[r,e,t]),d=(0,X.useMemo)(()=>e.filter(e=>e.activeFaults.length>0),[e]),f=d.reduce((e,t)=>e+t.activeFaults.length,0);return(0,Z.jsxs)(L,{className:`h-full min-w-0`,children:[(0,Z.jsx)(P,{className:`pb-3`,children:(0,Z.jsxs)(I,{className:`flex items-center gap-2 text-xs font-medium uppercase tracking-wider`,children:[(0,Z.jsx)(We,{className:`size-3.5 ${f>0?`text-destructive`:`text-muted-foreground`}`}),`Fault Lab`,(0,Z.jsx)(S,{children:f>0&&(0,Z.jsx)(x.div,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},transition:{type:`spring`,stiffness:500,damping:30},children:(0,Z.jsxs)(N,{variant:`destructive`,className:`text-[10px]`,children:[f,` active`]})},`fault-count`)})]})}),(0,Z.jsxs)(R,{className:`flex flex-1 flex-col gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,Z.jsxs)($e,{value:r||null,onValueChange:e=>{i(e??``),o(``)},onInputValueChange:c,children:[(0,Z.jsx)(Qe,{placeholder:`Select instance`,className:`h-8 min-h-11 w-full min-w-0 touch-manipulation sm:min-h-8`,showClear:!!r}),(0,Z.jsx)(Ze,{children:(0,Z.jsxs)(Xe,{children:[l.map(e=>(0,Z.jsxs)(F,{value:e.id,children:[(0,Z.jsx)(`span`,{className:`font-mono`,children:e.id}),e.activeFaults.length>0&&(0,Z.jsx)(N,{variant:`destructive`,className:`ml-auto text-[10px]`,children:e.activeFaults.length})]},e.id)),l.length===0&&(0,Z.jsx)(`p`,{className:`py-2 text-center text-xs text-muted-foreground`,children:`No instances found`})]})})]}),(0,Z.jsxs)(Ce,{value:a,onValueChange:e=>o(e??``),children:[(0,Z.jsx)(Se,{className:`h-8 min-h-11 w-full touch-manipulation sm:min-h-8`,"aria-label":`Fault type`,children:(0,Z.jsx)(ve,{placeholder:r?`Select fault`:`Pick instance first`})}),(0,Z.jsx)(xe,{alignItemWithTrigger:!1,align:`start`,children:u.map(e=>(0,Z.jsx)(ye,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Z.jsx)(w,{variant:`destructive`,size:`sm`,className:`h-7 min-h-11 touch-manipulation text-xs sm:min-h-7`,disabled:!r||!a,onClick:()=>{let e=A(Ie,{instanceId:r,fault:a});e&&n.mutate({type:`triggerFault`,...e})},children:`Trigger`}),(0,Z.jsx)(w,{variant:`secondary`,size:`sm`,className:`h-7 min-h-11 touch-manipulation text-xs sm:min-h-7`,disabled:!r||!a,onClick:()=>{let e=A(Ie,{instanceId:r,fault:a});e&&n.mutate({type:`clearFault`,...e})},children:`Clear`})]}),(0,Z.jsx)(Fe,{}),(0,Z.jsx)(S,{mode:`wait`,initial:!1,children:d.length>0?(0,Z.jsxs)(x.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-[10px] font-medium uppercase tracking-wider text-muted-foreground`,children:`Faulted Instances`}),(0,Z.jsx)(S,{initial:!1,children:d.map(e=>(0,Z.jsx)(x.div,{initial:{opacity:0,x:-6},animate:{opacity:1,x:0},exit:{opacity:0,x:6,transition:{duration:.1}},transition:{type:`spring`,stiffness:400,damping:35},children:(0,Z.jsxs)(`button`,{type:`button`,className:`flex min-h-11 w-full touch-manipulation items-center justify-between rounded-[var(--miravo-radius-tight)] border border-destructive/20 bg-destructive/5 px-2.5 py-1.5 text-left transition-colors hover:bg-destructive/10 sm:min-h-0`,onClick:()=>{i(e.id),o(``)},children:[(0,Z.jsx)(`span`,{className:`truncate font-mono text-xs`,children:e.id}),(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-destructive`,children:e.activeFaults.join(`, `)})]})},e.id))})]},`faulted`):(0,Z.jsxs)(x.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:`flex items-center gap-2 py-1 text-xs text-muted-foreground`,children:[(0,Z.jsx)(O,{className:`size-3.5 text-success`}),`All clear — no active faults`]},`all-clear`)})]})]})}function Kn(){let e=M(e=>e.instances),t=j(),[n,r]=(0,X.useState)(``),[i,a]=(0,X.useState)(!1),[o,s]=(0,X.useState)(``),c=(0,X.useMemo)(()=>o?e.filter(e=>e.id.toLowerCase().includes(o.toLowerCase())):e,[e,o]),l=(0,X.useMemo)(()=>e.filter(e=>e.isQuarantined),[e]),u=(0,X.useMemo)(()=>e.filter(e=>!e.isQuarantined&&e.activeFaults.length===0).length,[e]),d=(0,X.useMemo)(()=>e.filter(e=>!e.isQuarantined&&e.activeFaults.length>0).length,[e]);return(0,Z.jsxs)(L,{className:`h-full min-w-0`,children:[(0,Z.jsx)(P,{className:`pb-3`,children:(0,Z.jsxs)(I,{className:`flex items-center gap-2 text-xs font-medium uppercase tracking-wider`,children:[(0,Z.jsx)(st,{className:`size-3.5 text-muted-foreground`}),`Instance Actions`]})}),(0,Z.jsxs)(R,{className:`flex flex-1 flex-col gap-4`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-[10px] font-medium uppercase tracking-wider text-muted-foreground`,children:`Remove Instance`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2 sm:flex-row sm:items-start`,children:[(0,Z.jsx)(`div`,{className:`min-w-0 w-full sm:min-w-0 sm:flex-1`,children:(0,Z.jsxs)($e,{value:n||null,onValueChange:e=>{r(e??``),a(!1)},onInputValueChange:s,children:[(0,Z.jsx)(Qe,{placeholder:`Select instance`,className:`h-8 w-full min-w-0`,showClear:!!n}),(0,Z.jsx)(Ze,{children:(0,Z.jsxs)(Xe,{children:[c.map(e=>(0,Z.jsx)(F,{value:e.id,children:(0,Z.jsx)(`span`,{className:`font-mono`,children:e.id})},e.id)),c.length===0&&(0,Z.jsx)(`p`,{className:`py-2 text-center text-xs text-muted-foreground`,children:`No instances found`})]})})]})}),i&&n?(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 sm:shrink-0`,children:[(0,Z.jsx)(`span`,{className:`text-[10px] text-destructive`,children:`Remove?`}),(0,Z.jsx)(w,{size:`sm`,variant:`destructive`,className:`h-7 text-xs`,onClick:()=>{t.mutate({type:`removeInstance`,instanceId:n}),a(!1),r(``)},children:`Confirm`}),(0,Z.jsx)(w,{size:`sm`,variant:`ghost`,className:`h-7 text-xs`,onClick:()=>a(!1),children:`Cancel`})]}):(0,Z.jsxs)(w,{className:`h-8 w-full shrink-0 gap-1.5 sm:w-auto`,variant:`destructive`,size:`sm`,disabled:!n,onClick:()=>{A(Ne,{instanceId:n})&&a(!0)},children:[(0,Z.jsx)(lt,{className:`size-3`}),`Remove`]})]})]}),(0,Z.jsx)(Fe,{}),(0,Z.jsx)(S,{mode:`wait`,initial:!1,children:l.length>0?(0,Z.jsxs)(x.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:`flex flex-col gap-2`,children:[(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[10px] font-medium uppercase tracking-wider text-warning`,children:[`Quarantined`,(0,Z.jsx)(N,{variant:`secondary`,className:`text-[10px] text-warning`,children:l.length})]}),(0,Z.jsx)(S,{initial:!1,children:l.map(e=>(0,Z.jsx)(x.div,{initial:{opacity:0,x:-6},animate:{opacity:1,x:0},exit:{opacity:0,transition:{duration:.1}},transition:{type:`spring`,stiffness:400,damping:35},children:(0,Z.jsxs)(`div`,{className:`flex items-center justify-between rounded-[var(--miravo-radius-tight)] border border-warning/20 bg-warning/5 px-2.5 py-1.5`,children:[(0,Z.jsx)(`span`,{className:`truncate font-mono text-xs`,children:e.id}),(0,Z.jsx)(w,{size:`sm`,variant:`outline`,className:`h-6 shrink-0 text-[10px]`,onClick:()=>t.mutate({type:`unquarantine`,instanceId:e.id}),children:`Unquarantine`})]})},e.id))})]},`quarantined`):(0,Z.jsxs)(x.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-[10px] font-medium uppercase tracking-wider text-muted-foreground`,children:`Fleet Health`}),(0,Z.jsx)(`div`,{className:`flex items-center gap-4 text-xs`,children:e.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`size-2 rounded-full bg-success`}),(0,Z.jsx)(`span`,{className:`font-mono tabular-nums`,children:u}),(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`healthy`})]}),d>0&&(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`size-2 rounded-full bg-warning`}),(0,Z.jsx)(`span`,{className:`font-mono tabular-nums`,children:d}),(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`faulted`})]}),(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(ct,{className:`size-3 text-success`}),(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`0 quarantined`})]})]}):(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`No instances running`})})]},`fleet-health`)})]})]})}function qn(e){let t=Math.floor(e/1e3),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60;return n>0?`${n}h ${r}m`:r>0?`${r}m ${i}s`:`${i}s`}function Jn(e){if(!Number.isFinite(e)||e<=0)return`0s`;if(e<60)return`${e.toFixed(1)}s`;let t=Math.floor(e),n=Math.floor(t/86400),r=Math.floor(t%86400/3600),i=Math.floor(t%3600/60),a=t%60;return n>0?r>0?`${n}d ${r}h`:i>0?`${n}d ${i}m`:`${n}d`:r>0?`${r}h ${i}m`:i>0?`${i}m ${a}s`:`${a}s`}function Yn({data:e}){let t=(0,X.useMemo)(()=>{if(e.length<2)return null;let t=e.map(e=>e.tps),n=Math.max(...t,.1),r=Math.min(...t,0),i=n-r||1;return{points:t.map((e,n)=>{let a=n/(t.length-1)*200,o=2+(1-(e-r)/i)*28;return`${n===0?`M`:`L`}${a.toFixed(1)},${o.toFixed(1)}`}).join(` `),min:r,max:n}},[e]);return t?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsxs)(`svg`,{viewBox:`0 0 200 32`,className:`h-8 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":`TPS trend sparkline`,children:[(0,Z.jsx)(`line`,{x1:`0`,y1:`10.7`,x2:`200`,y2:`10.7`,stroke:`currentColor`,strokeWidth:`0.5`,strokeDasharray:`3,2`,className:`text-border`}),(0,Z.jsx)(`line`,{x1:`0`,y1:`21.3`,x2:`200`,y2:`21.3`,stroke:`currentColor`,strokeWidth:`0.5`,strokeDasharray:`3,2`,className:`text-border`}),(0,Z.jsx)(`path`,{d:t.points,fill:`none`,stroke:`var(--primary)`,strokeWidth:`1.5`})]}),(0,Z.jsxs)(`div`,{className:`flex justify-between text-[9px] text-muted-foreground`,children:[(0,Z.jsxs)(`span`,{children:[`60s ago · `,t.min.toFixed(1)]}),(0,Z.jsxs)(`span`,{children:[t.max.toFixed(1),` · now`]})]})]}):(0,Z.jsx)(`div`,{className:`flex h-8 items-center text-[10px] text-muted-foreground`,children:`Collecting...`})}var Xn={running:`bg-success`,paused:`bg-warning`,idle:`bg-muted-foreground`,stopped:`bg-destructive`};function Zn({state:e}){let t=Xn[e]??`bg-muted-foreground`,n=e===`running`;return(0,Z.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,Z.jsxs)(`div`,{className:`relative flex items-center justify-center`,children:[(0,Z.jsx)(`span`,{className:`size-2.5 rounded-full ${t}`}),n&&(0,Z.jsx)(`span`,{className:`absolute size-2.5 animate-ping rounded-full ${t} opacity-40`})]}),(0,Z.jsx)(S,{mode:`wait`,initial:!1,children:(0,Z.jsx)(x.span,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},transition:{type:`spring`,stiffness:500,damping:30},className:`font-mono text-lg font-bold uppercase tracking-wider`,children:e},e)})]})}function $({label:e,tooltip:t,tooltipClassName:n}){return(0,Z.jsxs)(`div`,{className:`inline-flex w-fit min-w-0 max-w-full items-center gap-1`,children:[(0,Z.jsx)(`span`,{className:`blueprint-title min-w-0 shrink text-[11px] leading-tight text-muted-foreground`,children:e}),(0,Z.jsxs)(qe,{children:[(0,Z.jsx)(Ge,{className:`inline-flex size-4 shrink-0 items-center justify-center rounded-[var(--miravo-radius-tight)] border-0 bg-transparent p-0 text-muted-foreground shadow-none outline-none hover:text-foreground focus-visible:ring-1 focus-visible:ring-ring`,render:(0,Z.jsx)(`button`,{type:`button`}),"aria-label":`About ${e}`,children:(0,Z.jsx)(Le,{className:`size-3`,"aria-hidden":!0})}),(0,Z.jsx)(Ke,{side:`top`,className:D(`max-w-xs`,n),children:t})]})]})}function Qn(){let{engineState:e,connectionState:t}=M(C(e=>({engineState:e.engineState,connectionState:e.connectionState}))),n=j();return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)($,{label:`Run state`,tooltip:(0,Z.jsx)(`p`,{className:`text-[11px] leading-snug`,children:`Whether the scheduler is running, paused, idle, or stopped. Pause freezes simulated time; resume continues from the same tick.`})}),(0,Z.jsx)(Zn,{state:e}),t===`live`&&(e===`running`||e===`paused`)&&(0,Z.jsx)(`div`,{className:`mt-1 flex items-center gap-2`,children:(0,Z.jsxs)(w,{type:`button`,size:`sm`,variant:e===`paused`?`default`:`outline`,className:D(`h-8 min-h-11 w-fit touch-manipulation gap-1.5 px-3 text-xs sm:min-h-8`,e===`running`&&`border-warning/40 bg-warning/10 text-warning hover:bg-warning/20 hover:text-warning focus-visible:border-warning/50 focus-visible:ring-warning/25 border-warning/35`),onClick:()=>n.mutate({type:e===`paused`?`resume`:`pause`}),children:[e===`paused`?(0,Z.jsx)(He,{className:`size-3`}):(0,Z.jsx)(rt,{className:`size-3`}),e===`paused`?`Resume`:`Pause`]})})]})}function $n(){let{speedMultiplier:e,connectionState:t}=M(C(e=>({speedMultiplier:e.speedMultiplier,connectionState:e.connectionState}))),n=j(),[r,i]=(0,X.useState)(String(e)),a=t===`live`;return(0,X.useEffect)(()=>{i(String(e))},[e]),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)($,{label:`Speed`,tooltip:(0,Z.jsx)(`p`,{className:`text-[11px] leading-snug`,children:`Runs the environment at this multiple of real time. 1× is real time; higher values speed up the model. Change it with the field and Set.`})}),(0,Z.jsxs)(`span`,{className:`w-fit font-mono text-lg font-bold tabular-nums`,children:[e,`x`]}),(0,Z.jsxs)(`div`,{className:`mt-1 flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Z.jsx)(Ye,{htmlFor:`speed-multiplier`,className:`sr-only`,children:`Speed multiplier`}),(0,Z.jsx)(he,{id:`speed-multiplier`,type:`number`,value:r,onChange:e=>i(e.target.value),className:`h-8 min-h-11 w-[4.75rem] touch-manipulation font-mono text-xs tabular-nums sm:min-h-8`,min:`1`,max:`1000`,disabled:!a}),(0,Z.jsx)(w,{type:`button`,size:`sm`,variant:`outline`,className:`h-8 min-h-11 touch-manipulation px-3 text-xs sm:min-h-8`,disabled:!a,onClick:()=>{let e=A(Pe,{multiplier:Number(r)});e&&n.mutate({type:`setSpeed`,multiplier:e.multiplier})},children:`Set`})]})]})}function er(){let{tick:e,simulationTime:t,tps:n,tpsHistory:r,uptimeMs:i,instanceCount:a,memberValueCount:o}=M(C(e=>({tick:e.tick,simulationTime:e.simulationTime,tps:e.tps,tpsHistory:e.tpsHistory,uptimeMs:e.uptimeMs,instanceCount:e.instanceCount,memberValueCount:e.memberValueCount})));return(0,Z.jsxs)(`div`,{className:D(Ue,`px-4 py-3`),children:[(0,Z.jsxs)(`header`,{className:`mb-3 border-b border-border/60 pb-2`,children:[(0,Z.jsx)(`h2`,{className:`font-heading text-sm font-semibold tracking-tight text-foreground`,children:`Engine vitals`}),(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:`Scheduler, speed, cycle count, and throughput for this session.`})]}),(0,Z.jsxs)(`div`,{className:`grid min-w-0 grid-cols-2 gap-3 @2xl/main:gap-4 @3xl/main:grid-cols-3 @5xl/main:grid-cols-6`,children:[(0,Z.jsx)(Qn,{}),(0,Z.jsx)($n,{}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)($,{label:`Cycle`,tooltipClassName:`flex flex-col items-start gap-2 text-left`,tooltip:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`text-[11px] leading-snug`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:`Cycle`}),` compares simulated progress with wall time: how many steps ran, how much model time advanced, and how long this session has been open.`]}),(0,Z.jsxs)(`p`,{className:`text-[11px] leading-snug`,children:[`The number is `,(0,Z.jsx)(`span`,{className:`font-medium`,children:`tick`}),` count — completed scheduler steps since this run. Each tick refreshes the plant model and live tags.`]}),(0,Z.jsxs)(`p`,{className:`text-[11px] leading-snug`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:`Sim`}),` is simulated elapsed time. Each tick adds (tick interval × speed) to this clock. Generators, lifecycle, and in-model timestamps use Sim, not your system clock. It stops advancing while paused.`]}),(0,Z.jsxs)(`p`,{className:`text-[11px] leading-snug`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:`Real`}),` is wall-clock uptime since the run started (real time).`]})]})}),(0,Z.jsx)(`span`,{className:`w-fit font-mono text-lg font-bold tabular-nums`,children:T(e)}),(0,Z.jsxs)(`div`,{className:`mt-1 flex w-full min-w-0 flex-col gap-0.5 leading-tight`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,Z.jsx)(`span`,{className:`w-10 shrink-0 text-[9px] font-semibold uppercase tracking-wide text-muted-foreground`,children:`Sim`}),(0,Z.jsx)(`span`,{className:`min-w-0 font-mono text-[10px] tabular-nums text-muted-foreground`,children:Jn(t)})]}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,Z.jsx)(`span`,{className:`w-10 shrink-0 text-[9px] font-semibold uppercase tracking-wide text-muted-foreground`,children:`Real`}),(0,Z.jsx)(`span`,{className:`min-w-0 font-mono text-[10px] tabular-nums text-muted-foreground`,children:qn(i)})]})]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)($,{label:`Throughput`,tooltip:(0,Z.jsx)(`p`,{className:`text-[11px] leading-snug`,children:`Ticks per second: how fast the engine is stepping. Rises and falls with workload, speed setting, and CPU headroom.`})}),(0,Z.jsxs)(`span`,{className:`w-fit font-mono text-lg font-bold tabular-nums`,children:[n.toFixed(1),` tps`]}),(0,Z.jsxs)(`span`,{className:`mt-1 text-[10px] text-muted-foreground`,children:[a,` inst · `,fe(o),` tags`]})]}),(0,Z.jsxs)(`div`,{className:`col-span-2 flex flex-col gap-2`,children:[(0,Z.jsx)($,{label:`TPS Trend`,tooltip:(0,Z.jsx)(`p`,{className:`text-[11px] leading-snug`,children:`Recent ticks-per-second samples over about the last minute. Flat or noisy lines usually mean load or speed changes.`})}),(0,Z.jsx)(Yn,{data:r})]})]})]})}var tr=[`MQTT Sparkplug B`,`EtherNet/IP`,`Siemens S7`];function nr({enabled:e,total:t}){let n=t===0?`empty`:e===0?`idle`:`live`;return(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 rounded-[var(--miravo-radius-pill)] border border-border/60 bg-background/60 px-2.5 py-1 backdrop-blur-sm`,children:[(0,Z.jsxs)(`span`,{className:`relative flex size-1.5 items-center justify-center`,children:[(0,Z.jsx)(`span`,{className:D(`size-1.5 rounded-full`,n===`live`?`bg-success shadow-[0_0_0_1px_color-mix(in_srgb,var(--success)_50%,transparent),0_0_12px_color-mix(in_srgb,var(--success)_42%,transparent)]`:n===`idle`?`bg-warning/85 shadow-[0_0_0_1px_color-mix(in_srgb,var(--warning)_50%,transparent),0_0_12px_color-mix(in_srgb,var(--warning)_38%,transparent)]`:`bg-muted-foreground/55`)}),n===`live`&&(0,Z.jsx)(`span`,{className:`absolute inset-0 animate-ping rounded-full bg-success/60`})]}),(0,Z.jsxs)(`span`,{className:`text-[11px] leading-none text-muted-foreground`,children:[(0,Z.jsx)(`span`,{className:`font-mono font-semibold tabular-nums text-foreground`,children:e}),(0,Z.jsx)(`span`,{className:`mx-1 text-muted-foreground/60`,children:`/`}),(0,Z.jsx)(`span`,{className:`font-mono tabular-nums`,children:t}),(0,Z.jsx)(`span`,{className:`ml-1.5 text-[10px] uppercase tracking-[0.14em]`,children:`active`})]})]})}function rr(){let{availableAdapters:e,adapterMetrics:t}=M(C(e=>({availableAdapters:e.availableAdapters,adapterMetrics:e.adapterMetrics}))),n=e.filter(e=>e.enabled).length;return(0,Z.jsxs)(`section`,{className:D(Ue,`flex min-w-0 flex-col hover:border-border`),children:[(0,Z.jsxs)(`header`,{className:`flex flex-wrap items-start justify-between gap-3 border-b border-border/60 px-4 py-3`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,Z.jsx)(`div`,{className:`mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-[var(--miravo-radius-tight)] border border-border/60 bg-background/70 text-muted-foreground`,"aria-hidden":!0,children:(0,Z.jsx)(ot,{className:`size-3.5`})}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`h3`,{className:`font-heading text-sm font-semibold tracking-tight text-foreground`,children:`Protocol Gateway`}),(0,Z.jsx)(`p`,{className:`mt-0.5 text-pretty text-xs text-muted-foreground`,children:`Northbound adapters publishing engine telemetry to external systems.`})]})]}),(0,Z.jsx)(nr,{enabled:n,total:e.length})]}),e.length>0&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-2 px-4 py-4`,children:(0,Z.jsx)(S,{children:e.map((e,n)=>{let r=t.find(t=>t.name===e.name)?.metrics;return(0,Z.jsx)(x.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0},transition:{type:`spring`,stiffness:380,damping:30,delay:n*.05},children:(0,Z.jsx)(Un,{adapter:e,metrics:r})},e.name)})})}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-3 gap-y-2 border-t border-border/60 bg-background/40 px-4 py-2.5`,role:`status`,"aria-label":`Upcoming protocol adapters: ${tr.join(`, `)}, and more`,children:[(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,Z.jsx)(ze,{className:`size-3 text-muted-foreground/70`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`text-[10px] font-medium uppercase tracking-[0.14em] text-muted-foreground`,children:`Roadmap`})]}),(0,Z.jsxs)(`ul`,{className:`flex min-w-0 flex-wrap items-center gap-1.5`,children:[tr.map(e=>(0,Z.jsx)(`li`,{className:`rounded-[var(--miravo-radius-tight)] border border-dashed border-border/70 bg-background/40 px-2 py-0.5 font-mono text-[10px] leading-[15px] tracking-tight text-muted-foreground`,children:e},e)),(0,Z.jsx)(`li`,{className:`font-mono text-[10px] leading-[15px] tracking-tight text-muted-foreground/75`,children:`+ more`})]})]})]})}function ir(){let e=M(e=>e.instances),t=j(),[n,r]=(0,X.useState)(!1),[i,a]=(0,X.useState)(!1),[o,s]=(0,X.useState)(!1);return(0,Z.jsxs)(`div`,{className:`flex h-full min-w-0 flex-col`,children:[(0,Z.jsxs)(L,{className:`h-full min-w-0`,children:[(0,Z.jsx)(P,{className:`pb-3`,children:(0,Z.jsxs)(I,{className:`flex items-center gap-2 text-xs font-medium uppercase tracking-wider`,children:[(0,Z.jsx)(nt,{className:`size-3.5 text-muted-foreground`,"aria-hidden":!0}),`Danger Zone`]})}),(0,Z.jsx)(R,{className:`flex flex-1 flex-col`,children:(0,Z.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-3 rounded-[var(--miravo-radius-stadium-sm)] border border-dashed border-border p-3 @2xl/main:flex-row @2xl/main:items-center @2xl/main:justify-between`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 space-y-0.5`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:`Reset environment`}),(0,Z.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Removes `,e.length,` running instance`,e.length===1?``:`s`,` and all loaded environments.`]})]}),(0,Z.jsx)(w,{className:`min-h-11 w-full shrink-0 touch-manipulation @2xl/main:w-auto sm:min-h-7`,variant:`destructive`,size:`sm`,onClick:()=>r(!0),children:`Reset`})]})})]}),(0,Z.jsx)(se,{open:n,onOpenChange:e=>{r(e),e||a(!1)},children:(0,Z.jsxs)(le,{children:[(0,Z.jsxs)(ce,{children:[(0,Z.jsx)(ue,{children:`Reset Environment`}),(0,Z.jsx)(oe,{children:`Removes all running instances and loaded environments.`})]}),(0,Z.jsx)(`div`,{className:`space-y-3 text-sm`,children:(0,Z.jsx)(`div`,{className:`rounded-[var(--miravo-radius-stadium-sm)] border p-3`,children:(0,Z.jsxs)(Ye,{htmlFor:`clear-persisted-state`,className:`items-start`,children:[(0,Z.jsx)(Be,{id:`clear-persisted-state`,checked:i,onCheckedChange:e=>a(e===!0)}),(0,Z.jsxs)(`span`,{className:`space-y-1`,children:[(0,Z.jsx)(`span`,{className:`block font-medium text-foreground`,children:`Also clear persisted state`}),(0,Z.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:`Start empty on the next restart.`})]})]})})}),(0,Z.jsxs)(ae,{children:[(0,Z.jsx)(w,{variant:`outline`,className:`min-h-11 w-full touch-manipulation sm:min-h-8 sm:w-auto`,onClick:()=>{r(!1),a(!1)},disabled:o,children:`Cancel`}),(0,Z.jsx)(w,{variant:`destructive`,className:`min-h-11 w-full touch-manipulation sm:min-h-8 sm:w-auto`,disabled:o,onClick:async()=>{s(!0);try{await t.mutateAsync({type:`resetEnvironment`,...i?{clearPersistence:!0}:{}}),r(!1),a(!1)}catch{}finally{s(!1)}},children:o?`Resetting...`:`Confirm Reset`})]})]})})]})}function ar(){let[e,t]=re(`tab`,ie([`monitor`,`operate`]).withDefault(`monitor`));return(0,Z.jsxs)(`div`,{className:`mx-auto flex w-full min-w-0 max-w-screen-2xl flex-col gap-5 p-4 sm:gap-6 sm:p-6`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`h1`,{className:`font-heading text-2xl font-semibold tracking-tight`,children:`Mission Control`}),(0,Z.jsxs)(N,{variant:`outline`,title:`Miravo version ${ee}`,className:`font-mono text-[10px] leading-none text-muted-foreground`,children:[`v`,ee]})]}),(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Engine telemetry, protocol management, and fleet operations.`})]}),(0,Z.jsxs)(ke,{value:e,onValueChange:e=>{t(e)},className:`min-h-0 flex-1`,children:[(0,Z.jsx)(`div`,{className:`shrink-0 overflow-x-auto`,children:(0,Z.jsxs)(De,{variant:`line`,className:`h-10! min-w-max gap-0.5`,children:[(0,Z.jsxs)(Te,{value:`monitor`,className:`gap-1.5 px-3 text-sm`,children:[(0,Z.jsx)(Me,{className:`size-3.5 shrink-0`}),`Monitor`]}),(0,Z.jsxs)(Te,{value:`operate`,className:`gap-1.5 px-3 text-sm`,children:[(0,Z.jsx)(Ae,{className:`size-3.5 shrink-0`}),`Operate`]})]})}),(0,Z.jsx)(Ee,{value:`monitor`,className:`flex-1 py-2`,children:(0,Z.jsxs)(x.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.15,ease:`easeOut`},className:`flex flex-col gap-5 sm:gap-6`,children:[(0,Z.jsx)(er,{}),(0,Z.jsx)(rr,{})]},`monitor`)}),(0,Z.jsx)(Ee,{value:`operate`,className:`flex-1 py-2`,children:(0,Z.jsxs)(x.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.15,ease:`easeOut`},className:`grid min-h-0 min-w-0 grid-cols-1 items-stretch gap-5 @2xl/main:grid-cols-2 @2xl/main:gap-4`,children:[(0,Z.jsx)(Wn,{}),(0,Z.jsx)(Kn,{}),(0,Z.jsx)(Gn,{}),(0,Z.jsx)(ir,{})]},`operate`)})]})]})}export{ot as n,ar as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{at as n}from"./vendor-ui-CWUk2ulb.js";import{S as r,b as i,o as a}from"./api-D8oAzcVE.js";import{i as o,s as ee,t as s}from"./query-fetch-error-NbPqVPRR.js";import{t as c}from"./proxy-Be4WzmcS.js";import{t as te}from"./AnimatePresence-CPmH1DMY.js";import{u as ne}from"./chunk-OE4NN4TA-DBWZidbW.js";import{S as re,g as l,t as u}from"./format-CshN6yEB.js";import{c as ie,i as d,n as f,s as p,t as ae}from"./select-CmlY1M1a.js";import{r as m}from"./engine-store-DMULdR_V.js";import{t as h}from"./route-preload-DQgHHtBj.js";import{t as oe}from"./use-transition-navigate-jTHkLHMS.js";import{t as se}from"./badge-eIn_7YrK.js";import{n as ce}from"./transition-types-2i1blGlR.js";import{n as le}from"./auth-screen-backdrop-Cr8qBSXP.js";import{t as g}from"./get-error-message-Dk8elqEP.js";import{r as ue}from"./runtime-link-PMxeHxd6.js";import{a as de,i as fe,n as pe,o as me,r as he,s as ge,t as _e}from"./combobox-BCaV1Wbo.js";import{a as _,c as v,i as y,o as b,r as ve,s as ye,t as be}from"./select-display-items-Bqb6Sbg6.js";var x=e(t(),1);function xe(e){return e.includes(`triggered`)?`destructive`:e.includes(`cleared`)||e.includes(`created`)?`default`:e.includes(`removed`)||e.includes(`lifecycle`)?`secondary`:(e.includes(`state-changed`),`outline`)}function Se(e){return e.includes(`state-changed`)?`border-info/30 bg-info/20 text-info hover:bg-info/20`:e===`platform:operation`?`border-chart-4/30 bg-chart-4/20 text-chart-4 hover:bg-chart-4/20`:e===`platform:resource`?`border-chart-4/30 bg-chart-4/15 text-chart-4 hover:bg-chart-4/15`:``}function S(e){if(`targetLabel`in e)return typeof e.targetLabel==`string`?e.targetLabel:void 0}function C(e){if(e.type===`platform:operation`){let t=e.operationType===`apply`?`Apply`:`Cleanup`,n=e.applied,r=e.operationType===`apply`?`applied`:`deleted`,i=e.failed>0?`, ${e.failed} failed`:``,a=S(e)??`Unknown target`;return`${t} ${e.templateId} \u2192 ${a} (${n} ${r}${i})`}return e.type===`platform:resource`?`${e.status===`success`?`✓`:`✗`} ${e.action} ${e.resourceType} ${e.resourceName}`:``}function Ce(e,t){let n=new Date(e);return n.toDateString()===t.toDateString()?n.toLocaleTimeString(u):n.toLocaleString(u,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function w(e){if(`instanceId`in e&&typeof e.instanceId==`string`)return e.instanceId}function T(e){return e.type===`platform:operation`||e.type===`platform:resource`?S(e):w(e)}function E(e){return`fault`in e?l(e.fault):e.type===`platform:operation`||e.type===`platform:resource`?C(e):`from`in e&&`to`in e?`${l(e.from)} \u2192 ${l(e.to)}`:``}function D(e,t,n){let r=new URLSearchParams;return r.set(`limit`,`50`),e!==`all`&&r.set(`type`,e),t&&r.set(`instanceId`,t),n!==null&&r.set(`cursor`,String(n)),`/events?${r.toString()}`}var O=n(),k=1500;function A(){let e=ee(),[t]=ne(),n=t.get(`type`)??`all`,l=t.get(`instanceId`)??``,[u,S]=(0,x.useState)(n),[C,A]=(0,x.useState)(l),[j,we]=(0,x.useState)(!0),M=ue(m(e=>e.connectionState))===null,N=m(e=>e.events.length),P=(0,x.useRef)(!1),F=m(e=>e.instances),Te=oe(),I=o({queryKey:i.events(u,C),queryFn:()=>a(D(u,C,null),r.events),refetchInterval:j&&M?k:!1,staleTime:5e3}),[Ee,L]=(0,x.useState)([]),[De,R]=(0,x.useState)(!1),[Oe,z]=(0,x.useState)(null),B=`${u}::${C}`,V=(0,x.useRef)(B);(0,x.useEffect)(()=>{B!==V.current&&(V.current=B,L([]),z(null),U(!1))},[B]),(0,x.useEffect)(()=>{S(e=>e===n?e:n)},[n]),(0,x.useEffect)(()=>{A(e=>e===l?e:l)},[l]);let[H,U]=(0,x.useState)(()=>(I.data?.events.length??0)>0),W=I.data?[I.data,...Ee]:[],G=W.flatMap(e=>e.events),K=W[W.length-1],q=K?.hasMore??!1;(0,x.useEffect)(()=>{G.length>0&&!H&&U(!0)},[G.length,H]);let J=(0,x.useRef)(N);(0,x.useEffect)(()=>{N!==J.current&&(J.current=N,j&&M?(e.invalidateQueries({queryKey:i.events(u,C)}),P.current=!1):j&&(P.current=!0))},[N,j,M,e,u,C]),(0,x.useEffect)(()=>{!j||!M||!P.current||(P.current=!1,e.invalidateQueries({queryKey:i.events(u,C)}))},[j,M,e,u,C]);let[Y,ke]=(0,x.useState)(``),X=(0,x.useMemo)(()=>Y?F.filter(e=>e.id.toLowerCase().includes(Y.toLowerCase())):F,[F,Y]),Z=I.isPending&&!I.data&&!I.isError,Ae=j&&!Z&&!H&&G.length===0,Q=I.error??Oe,je=I.isError&&!I.data,$=(0,x.useCallback)(()=>{I.refetch()},[I]),Me=async()=>{if(K?.nextCursor){R(!0),z(null);try{let e=await a(D(u,C,K.nextCursor),r.events);L(t=>[...t,e])}catch(e){z(e instanceof Error?e:Error(g(e,`Failed to fetch events.`)))}finally{R(!1)}}};if(je)return(0,O.jsx)(le,{className:`min-h-full`,children:(0,O.jsx)(`div`,{className:`flex min-h-[40vh] flex-col items-center justify-center p-6 sm:p-12`,children:(0,O.jsx)(`div`,{className:`w-full max-w-md`,children:(0,O.jsx)(s,{message:g(Q,`Failed to fetch events.`),onRetry:$,isRetrying:I.isFetching})})})});let Ne=new Date;return(0,O.jsxs)(`div`,{className:`mx-auto flex w-full max-w-screen-2xl flex-col gap-5 p-4 sm:gap-6 sm:p-6`,children:[Q&&G.length>0?(0,O.jsx)(s,{message:`${g(Q,`Failed to fetch events.`)} Showing cached events.`,onRetry:$,isRetrying:I.isFetching}):null,(0,O.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3 lg:flex-row lg:items-center lg:justify-between lg:gap-4`,children:[(0,O.jsxs)(`div`,{className:`min-w-0 flex flex-col gap-1`,children:[(0,O.jsx)(`h1`,{className:`font-heading text-2xl font-semibold tracking-tight`,children:`Event Log`}),(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Real-time event stream from the engine.`}),j&&!M?(0,O.jsx)(`p`,{className:`text-xs text-warning`,role:`status`,children:`Live refresh pauses until the Miravo link is live again.`}):null]}),(0,O.jsxs)(`div`,{className:`flex w-full min-w-0 flex-col gap-2 sm:flex-row sm:flex-nowrap sm:items-center sm:gap-2 lg:w-auto lg:max-w-full`,children:[(0,O.jsx)(`button`,{type:`button`,onClick:()=>we(e=>!e),className:`flex h-7 shrink-0 items-center self-start overflow-hidden rounded-[var(--miravo-radius-tight)] border border-border/40 px-2 py-1 text-xs transition-colors hover:bg-muted sm:self-auto`,children:(0,O.jsx)(te,{mode:`wait`,initial:!1,children:j?(0,O.jsxs)(c.span,{initial:{opacity:0,y:-6},animate:{opacity:1,y:0},exit:{opacity:0,y:6},transition:{type:`spring`,stiffness:500,damping:35},className:`flex items-center gap-1.5`,children:[(0,O.jsx)(`span`,{className:`size-1.5 animate-pulse rounded-full bg-success`}),(0,O.jsx)(`span`,{className:`font-medium text-success`,children:`LIVE`})]},`live`):(0,O.jsxs)(c.span,{initial:{opacity:0,y:-6},animate:{opacity:1,y:0},exit:{opacity:0,y:6},transition:{type:`spring`,stiffness:500,damping:35},className:`flex items-center gap-1.5`,children:[(0,O.jsx)(`span`,{className:`size-1.5 rounded-full bg-muted-foreground`}),(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:`Paused`})]},`paused`)})}),(0,O.jsx)(`div`,{className:`min-w-0 flex-1 lg:w-48 lg:flex-none`,children:(0,O.jsxs)(_e,{value:C||null,onValueChange:e=>{A(e??``)},onInputValueChange:ke,children:[(0,O.jsx)(he,{placeholder:`All instances`,className:`h-8 w-full min-w-0`,showClear:!!C}),(0,O.jsx)(pe,{children:(0,O.jsxs)(de,{children:[X.map(e=>(0,O.jsx)(fe,{value:e.id,children:(0,O.jsx)(`span`,{className:`font-mono`,children:e.id})},e.id)),X.length===0&&(0,O.jsx)(`p`,{className:`py-2 text-center text-xs text-muted-foreground`,children:`No instances found`})]})})]})}),(0,O.jsx)(`div`,{className:`min-w-0 flex-1 lg:w-48 lg:flex-none`,children:(0,O.jsxs)(ae,{value:u,onValueChange:e=>{S(e??`all`)},items:be,children:[(0,O.jsx)(p,{className:`w-full min-w-0 lg:w-48`,"aria-label":`Event type filter`,children:(0,O.jsx)(ie,{placeholder:`Filter by type`})}),(0,O.jsxs)(f,{alignItemWithTrigger:!1,align:`start`,children:[(0,O.jsx)(d,{value:`all`,children:`All events`}),(0,O.jsx)(d,{value:`fault:triggered`,children:`Fault Triggered`}),(0,O.jsx)(d,{value:`fault:cleared`,children:`Fault Cleared`}),(0,O.jsx)(d,{value:`lifecycle:changed`,children:`Lifecycle Changed`}),(0,O.jsx)(d,{value:`instance:created`,children:`Instance Created`}),(0,O.jsx)(d,{value:`instance:removed`,children:`Instance Removed`}),(0,O.jsx)(d,{value:`engine:state-changed`,children:`Engine State`}),(0,O.jsx)(d,{value:`platform:resource`,children:`Platform Resource`}),(0,O.jsx)(d,{value:`platform:operation`,children:`Platform Operation`})]})]})})]})]}),(0,O.jsx)(me,{className:`min-w-0 py-0`,children:(0,O.jsx)(ge,{className:`p-0`,children:(0,O.jsxs)(ve,{children:[(0,O.jsx)(ye,{children:(0,O.jsxs)(v,{children:[(0,O.jsx)(b,{className:`hidden w-12 sm:table-cell`,children:`#`}),(0,O.jsx)(b,{children:`Type`}),(0,O.jsx)(b,{children:`Context`}),(0,O.jsx)(b,{children:`Details`}),(0,O.jsx)(b,{className:`hidden text-right md:table-cell`,children:`Cycle #`}),(0,O.jsx)(b,{className:`hidden text-right sm:table-cell`,children:`Wall Clock`})]})}),(0,O.jsxs)(y,{children:[G.map(e=>{let t=w(e),n=T(e),r=e.type===`platform:resource`||e.type===`platform:operation`;return(0,O.jsxs)(v,{className:t?`transition-colors`:``,onMouseEnter:t?()=>h(`/instance/${t}`):void 0,children:[(0,O.jsx)(_,{className:`hidden font-mono text-xs text-muted-foreground sm:table-cell`,children:e.id}),(0,O.jsx)(_,{children:(0,O.jsx)(se,{variant:xe(e.type),className:`text-xs ${Se(e.type)}`,children:r?e.type===`platform:operation`?`platform:${e.operationType}`:`${e.action}:${e.resourceType}`:e.type})}),(0,O.jsx)(_,{className:`font-mono text-xs`,children:t?(0,O.jsx)(`button`,{type:`button`,className:`rounded-[var(--miravo-radius-tight)] text-left text-primary outline-none underline-offset-4 hover:underline focus-visible:ring-2 focus-visible:ring-ring/70 focus-visible:ring-offset-2 focus-visible:ring-offset-background`,onFocus:()=>h(`/instance/${t}`),onClick:()=>Te(`/instance/${t}`,{transitionType:ce}),children:n??t}):n??`—`}),(0,O.jsx)(_,{className:`max-w-xs truncate font-mono text-xs`,children:E(e)||(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,O.jsx)(_,{className:`hidden text-right font-mono text-xs md:table-cell`,children:e.tick}),(0,O.jsx)(_,{className:`hidden text-right text-xs text-muted-foreground sm:table-cell`,children:Ce(e.timestamp,Ne)})]},e.id)}),!Z&&G.length===0&&(0,O.jsx)(v,{children:(0,O.jsx)(_,{colSpan:6,className:`py-8 text-center text-muted-foreground`,children:Ae?`Listening for events…`:`No events`})})]})]})})}),q&&(0,O.jsx)(`div`,{className:`flex justify-center border-t border-border/40 pt-4`,children:(0,O.jsx)(re,{variant:`outline`,size:`sm`,onClick:()=>void Me(),disabled:De,children:`Load older events`})})]})}export{A as t};
|
|
1
|
+
import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{at as n}from"./vendor-ui-CWUk2ulb.js";import{S as r,b as i,o as a}from"./api-CrYvIV3A.js";import{i as o,s as ee,t as s}from"./query-fetch-error-BWenDoLQ.js";import{t as c}from"./proxy-Be4WzmcS.js";import{t as te}from"./AnimatePresence-CPmH1DMY.js";import{u as ne}from"./chunk-OE4NN4TA-DBWZidbW.js";import{S as re,g as l,t as u}from"./format-CshN6yEB.js";import{c as ie,i as d,n as f,s as p,t as ae}from"./select-CmlY1M1a.js";import{r as m}from"./engine-store-DMULdR_V.js";import{t as h}from"./route-preload-CLRbqehb.js";import{t as oe}from"./use-transition-navigate-Br9xwrqi.js";import{t as se}from"./badge-eIn_7YrK.js";import{n as ce}from"./transition-types-2i1blGlR.js";import{n as le}from"./auth-screen-backdrop-Cr8qBSXP.js";import{n as g}from"./get-error-message-BgE2BpPG.js";import{r as ue}from"./runtime-link-PMxeHxd6.js";import{a as de,i as fe,n as pe,o as me,r as he,s as ge,t as _e}from"./combobox-BCaV1Wbo.js";import{a as _,c as v,i as y,o as b,r as ve,s as ye,t as be}from"./select-display-items-Bqb6Sbg6.js";var x=e(t(),1);function xe(e){return e.includes(`triggered`)?`destructive`:e.includes(`cleared`)||e.includes(`created`)?`default`:e.includes(`removed`)||e.includes(`lifecycle`)?`secondary`:(e.includes(`state-changed`),`outline`)}function Se(e){return e.includes(`state-changed`)?`border-info/30 bg-info/20 text-info hover:bg-info/20`:e===`platform:operation`?`border-chart-4/30 bg-chart-4/20 text-chart-4 hover:bg-chart-4/20`:e===`platform:resource`?`border-chart-4/30 bg-chart-4/15 text-chart-4 hover:bg-chart-4/15`:``}function S(e){if(`targetLabel`in e)return typeof e.targetLabel==`string`?e.targetLabel:void 0}function C(e){if(e.type===`platform:operation`){let t=e.operationType===`apply`?`Apply`:`Cleanup`,n=e.applied,r=e.operationType===`apply`?`applied`:`deleted`,i=e.failed>0?`, ${e.failed} failed`:``,a=S(e)??`Unknown target`;return`${t} ${e.templateId} \u2192 ${a} (${n} ${r}${i})`}return e.type===`platform:resource`?`${e.status===`success`?`✓`:`✗`} ${e.action} ${e.resourceType} ${e.resourceName}`:``}function Ce(e,t){let n=new Date(e);return n.toDateString()===t.toDateString()?n.toLocaleTimeString(u):n.toLocaleString(u,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function w(e){if(`instanceId`in e&&typeof e.instanceId==`string`)return e.instanceId}function T(e){return e.type===`platform:operation`||e.type===`platform:resource`?S(e):w(e)}function E(e){return`fault`in e?l(e.fault):e.type===`platform:operation`||e.type===`platform:resource`?C(e):`from`in e&&`to`in e?`${l(e.from)} \u2192 ${l(e.to)}`:``}function D(e,t,n){let r=new URLSearchParams;return r.set(`limit`,`50`),e!==`all`&&r.set(`type`,e),t&&r.set(`instanceId`,t),n!==null&&r.set(`cursor`,String(n)),`/events?${r.toString()}`}var O=n(),k=1500;function A(){let e=ee(),[t]=ne(),n=t.get(`type`)??`all`,l=t.get(`instanceId`)??``,[u,S]=(0,x.useState)(n),[C,A]=(0,x.useState)(l),[j,we]=(0,x.useState)(!0),M=ue(m(e=>e.connectionState))===null,N=m(e=>e.events.length),P=(0,x.useRef)(!1),F=m(e=>e.instances),Te=oe(),I=o({queryKey:i.events(u,C),queryFn:()=>a(D(u,C,null),r.events),refetchInterval:j&&M?k:!1,staleTime:5e3}),[Ee,L]=(0,x.useState)([]),[De,R]=(0,x.useState)(!1),[Oe,z]=(0,x.useState)(null),B=`${u}::${C}`,V=(0,x.useRef)(B);(0,x.useEffect)(()=>{B!==V.current&&(V.current=B,L([]),z(null),U(!1))},[B]),(0,x.useEffect)(()=>{S(e=>e===n?e:n)},[n]),(0,x.useEffect)(()=>{A(e=>e===l?e:l)},[l]);let[H,U]=(0,x.useState)(()=>(I.data?.events.length??0)>0),W=I.data?[I.data,...Ee]:[],G=W.flatMap(e=>e.events),K=W[W.length-1],q=K?.hasMore??!1;(0,x.useEffect)(()=>{G.length>0&&!H&&U(!0)},[G.length,H]);let J=(0,x.useRef)(N);(0,x.useEffect)(()=>{N!==J.current&&(J.current=N,j&&M?(e.invalidateQueries({queryKey:i.events(u,C)}),P.current=!1):j&&(P.current=!0))},[N,j,M,e,u,C]),(0,x.useEffect)(()=>{!j||!M||!P.current||(P.current=!1,e.invalidateQueries({queryKey:i.events(u,C)}))},[j,M,e,u,C]);let[Y,ke]=(0,x.useState)(``),X=(0,x.useMemo)(()=>Y?F.filter(e=>e.id.toLowerCase().includes(Y.toLowerCase())):F,[F,Y]),Z=I.isPending&&!I.data&&!I.isError,Ae=j&&!Z&&!H&&G.length===0,Q=I.error??Oe,je=I.isError&&!I.data,$=(0,x.useCallback)(()=>{I.refetch()},[I]),Me=async()=>{if(K?.nextCursor){R(!0),z(null);try{let e=await a(D(u,C,K.nextCursor),r.events);L(t=>[...t,e])}catch(e){z(e instanceof Error?e:Error(g(e,`Failed to fetch events.`)))}finally{R(!1)}}};if(je)return(0,O.jsx)(le,{className:`min-h-full`,children:(0,O.jsx)(`div`,{className:`flex min-h-[40vh] flex-col items-center justify-center p-6 sm:p-12`,children:(0,O.jsx)(`div`,{className:`w-full max-w-md`,children:(0,O.jsx)(s,{message:g(Q,`Failed to fetch events.`),onRetry:$,isRetrying:I.isFetching})})})});let Ne=new Date;return(0,O.jsxs)(`div`,{className:`mx-auto flex w-full max-w-screen-2xl flex-col gap-5 p-4 sm:gap-6 sm:p-6`,children:[Q&&G.length>0?(0,O.jsx)(s,{message:`${g(Q,`Failed to fetch events.`)} Showing cached events.`,onRetry:$,isRetrying:I.isFetching}):null,(0,O.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3 lg:flex-row lg:items-center lg:justify-between lg:gap-4`,children:[(0,O.jsxs)(`div`,{className:`min-w-0 flex flex-col gap-1`,children:[(0,O.jsx)(`h1`,{className:`font-heading text-2xl font-semibold tracking-tight`,children:`Event Log`}),(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Real-time event stream from the engine.`}),j&&!M?(0,O.jsx)(`p`,{className:`text-xs text-warning`,role:`status`,children:`Live refresh pauses until the Miravo link is live again.`}):null]}),(0,O.jsxs)(`div`,{className:`flex w-full min-w-0 flex-col gap-2 sm:flex-row sm:flex-nowrap sm:items-center sm:gap-2 lg:w-auto lg:max-w-full`,children:[(0,O.jsx)(`button`,{type:`button`,onClick:()=>we(e=>!e),className:`flex h-7 shrink-0 items-center self-start overflow-hidden rounded-[var(--miravo-radius-tight)] border border-border/40 px-2 py-1 text-xs transition-colors hover:bg-muted sm:self-auto`,children:(0,O.jsx)(te,{mode:`wait`,initial:!1,children:j?(0,O.jsxs)(c.span,{initial:{opacity:0,y:-6},animate:{opacity:1,y:0},exit:{opacity:0,y:6},transition:{type:`spring`,stiffness:500,damping:35},className:`flex items-center gap-1.5`,children:[(0,O.jsx)(`span`,{className:`size-1.5 animate-pulse rounded-full bg-success`}),(0,O.jsx)(`span`,{className:`font-medium text-success`,children:`LIVE`})]},`live`):(0,O.jsxs)(c.span,{initial:{opacity:0,y:-6},animate:{opacity:1,y:0},exit:{opacity:0,y:6},transition:{type:`spring`,stiffness:500,damping:35},className:`flex items-center gap-1.5`,children:[(0,O.jsx)(`span`,{className:`size-1.5 rounded-full bg-muted-foreground`}),(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:`Paused`})]},`paused`)})}),(0,O.jsx)(`div`,{className:`min-w-0 flex-1 lg:w-48 lg:flex-none`,children:(0,O.jsxs)(_e,{value:C||null,onValueChange:e=>{A(e??``)},onInputValueChange:ke,children:[(0,O.jsx)(he,{placeholder:`All instances`,className:`h-8 w-full min-w-0`,showClear:!!C}),(0,O.jsx)(pe,{children:(0,O.jsxs)(de,{children:[X.map(e=>(0,O.jsx)(fe,{value:e.id,children:(0,O.jsx)(`span`,{className:`font-mono`,children:e.id})},e.id)),X.length===0&&(0,O.jsx)(`p`,{className:`py-2 text-center text-xs text-muted-foreground`,children:`No instances found`})]})})]})}),(0,O.jsx)(`div`,{className:`min-w-0 flex-1 lg:w-48 lg:flex-none`,children:(0,O.jsxs)(ae,{value:u,onValueChange:e=>{S(e??`all`)},items:be,children:[(0,O.jsx)(p,{className:`w-full min-w-0 lg:w-48`,"aria-label":`Event type filter`,children:(0,O.jsx)(ie,{placeholder:`Filter by type`})}),(0,O.jsxs)(f,{alignItemWithTrigger:!1,align:`start`,children:[(0,O.jsx)(d,{value:`all`,children:`All events`}),(0,O.jsx)(d,{value:`fault:triggered`,children:`Fault Triggered`}),(0,O.jsx)(d,{value:`fault:cleared`,children:`Fault Cleared`}),(0,O.jsx)(d,{value:`lifecycle:changed`,children:`Lifecycle Changed`}),(0,O.jsx)(d,{value:`instance:created`,children:`Instance Created`}),(0,O.jsx)(d,{value:`instance:removed`,children:`Instance Removed`}),(0,O.jsx)(d,{value:`engine:state-changed`,children:`Engine State`}),(0,O.jsx)(d,{value:`platform:resource`,children:`Platform Resource`}),(0,O.jsx)(d,{value:`platform:operation`,children:`Platform Operation`})]})]})})]})]}),(0,O.jsx)(me,{className:`min-w-0 py-0`,children:(0,O.jsx)(ge,{className:`p-0`,children:(0,O.jsxs)(ve,{children:[(0,O.jsx)(ye,{children:(0,O.jsxs)(v,{children:[(0,O.jsx)(b,{className:`hidden w-12 sm:table-cell`,children:`#`}),(0,O.jsx)(b,{children:`Type`}),(0,O.jsx)(b,{children:`Context`}),(0,O.jsx)(b,{children:`Details`}),(0,O.jsx)(b,{className:`hidden text-right md:table-cell`,children:`Cycle #`}),(0,O.jsx)(b,{className:`hidden text-right sm:table-cell`,children:`Wall Clock`})]})}),(0,O.jsxs)(y,{children:[G.map(e=>{let t=w(e),n=T(e),r=e.type===`platform:resource`||e.type===`platform:operation`;return(0,O.jsxs)(v,{className:t?`transition-colors`:``,onMouseEnter:t?()=>h(`/instance/${t}`):void 0,children:[(0,O.jsx)(_,{className:`hidden font-mono text-xs text-muted-foreground sm:table-cell`,children:e.id}),(0,O.jsx)(_,{children:(0,O.jsx)(se,{variant:xe(e.type),className:`text-xs ${Se(e.type)}`,children:r?e.type===`platform:operation`?`platform:${e.operationType}`:`${e.action}:${e.resourceType}`:e.type})}),(0,O.jsx)(_,{className:`font-mono text-xs`,children:t?(0,O.jsx)(`button`,{type:`button`,className:`rounded-[var(--miravo-radius-tight)] text-left text-primary outline-none underline-offset-4 hover:underline focus-visible:ring-2 focus-visible:ring-ring/70 focus-visible:ring-offset-2 focus-visible:ring-offset-background`,onFocus:()=>h(`/instance/${t}`),onClick:()=>Te(`/instance/${t}`,{transitionType:ce}),children:n??t}):n??`—`}),(0,O.jsx)(_,{className:`max-w-xs truncate font-mono text-xs`,children:E(e)||(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,O.jsx)(_,{className:`hidden text-right font-mono text-xs md:table-cell`,children:e.tick}),(0,O.jsx)(_,{className:`hidden text-right text-xs text-muted-foreground sm:table-cell`,children:Ce(e.timestamp,Ne)})]},e.id)}),!Z&&G.length===0&&(0,O.jsx)(v,{children:(0,O.jsx)(_,{colSpan:6,className:`py-8 text-center text-muted-foreground`,children:Ae?`Listening for events…`:`No events`})})]})]})})}),q&&(0,O.jsx)(`div`,{className:`flex justify-center border-t border-border/40 pt-4`,children:(0,O.jsx)(re,{variant:`outline`,size:`sm`,onClick:()=>void Me(),disabled:De,children:`Load older events`})})]})}export{A as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./events--facGImw.js";export{e as EventsPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./fleet-anqPXBbM.js";export{e as FleetPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{at as n}from"./vendor-ui-CWUk2ulb.js";import{S as r,b as i,o as a,x as o}from"./api-D8oAzcVE.js";import{i as s,n as c}from"./dist-xY0pK9Wy.js";import{c as l,n as u}from"./chunk-OE4NN4TA-DBWZidbW.js";import{t as d}from"./shallow-Cin0mLuv.js";import{c as f,d as p,g as m,l as h,p as ee,s as g,u as _,v as te,w as ne,x as re,y as v}from"./format-CshN6yEB.js";import{t as y}from"./utils-XFKvwlFT.js";import{t as b}from"./arrow-right-BjBb4z7g.js";import{t as x}from"./arrow-up-down-C1oJAmrw.js";import{c as S,i as C,n as w,s as T,t as E}from"./select-CmlY1M1a.js";import{t as ie}from"./circle-question-mark-CJvcT6V6.js";import{i as D,n as O,t as k}from"./tooltip-D1ydB4g3.js";import{r as A}from"./engine-store-DMULdR_V.js";import{t as j}from"./route-preload-DQgHHtBj.js";import{t as ae}from"./badge-eIn_7YrK.js";import{n as oe}from"./transition-types-2i1blGlR.js";import{a as se,i as ce,n as le,o as ue,r as de,s as fe,t as pe}from"./combobox-BCaV1Wbo.js";import{a as M,c as N,i as me,n as he,o as P,r as ge,s as _e}from"./select-display-items-Bqb6Sbg6.js";var F=e(t(),1);function I(e){return o.prefetchQuery({queryKey:i.instances.detail(e),queryFn:()=>a(`/instances/${e}`,r.instanceDetail),staleTime:2e3})}var L=n(),R={success:`bg-success`,warning:`bg-warning`,destructive:`bg-destructive`,foreground:`bg-foreground/60`,primary:`bg-primary`},z={success:`text-success`,warning:`text-warning`,destructive:`text-destructive`,foreground:`text-foreground`,primary:`text-primary`},B={mqtt:`MQTT`,opcua:`OPC UA`,modbus:`Modbus`};function V({label:e,pip:t,pulse:n}){return(0,L.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[t&&(n?(0,L.jsxs)(`span`,{"aria-hidden":!0,className:`relative flex size-1.5 shrink-0 items-center justify-center`,children:[(0,L.jsx)(`span`,{className:y(`absolute inline-flex h-full w-full animate-ping rounded-full opacity-75`,R[t])}),(0,L.jsx)(`span`,{className:y(`relative inline-flex size-1.5 rounded-full`,R[t])})]}):(0,L.jsx)(`span`,{"aria-hidden":!0,className:y(`size-1.5 shrink-0 rounded-full`,R[t])})),(0,L.jsx)(`span`,{className:`truncate text-[10px] font-medium uppercase tracking-(--miravo-tracking-eyebrow) text-muted-foreground`,children:e})]})}function H({children:e,tone:t=`foreground`,live:n}){return(0,L.jsx)(`span`,{...n?{role:`status`,"aria-live":`polite`}:{},className:y(`mt-1 block min-w-0 truncate font-mono text-2xl font-semibold tabular-nums leading-none transition-colors duration-300`,z[t]),children:e})}function U({children:e}){return(0,L.jsx)(`span`,{className:`mt-1 min-w-0 truncate text-[10px] text-muted-foreground`,children:e})}function W(e,t){return e===t?``:t}function ve({statusFilter:e,onStatusFilter:t}){let{instances:n,tps:r,memberValueCount:i,availableAdapters:a,adapterMetrics:o}=A(d(e=>({instances:e.instances,tps:e.tps,memberValueCount:e.memberValueCount,availableAdapters:e.availableAdapters,adapterMetrics:e.adapterMetrics}))),s=(0,F.useMemo)(()=>{let e=n.filter(e=>!e.isQuarantined&&e.activeFaults.length===0).length,t=n.filter(e=>!e.isQuarantined&&e.activeFaults.length>0).length,r=n.filter(e=>e.isQuarantined).length,i=n.length;return{healthy:e,faulted:t,quarantined:r,total:i,pct:i>0?Math.round(e/i*100):100,activeFaultCount:n.reduce((e,t)=>e+t.activeFaults.length,0),modelCount:new Set(n.map(e=>e.model)).size,affectedCount:new Set(n.filter(e=>e.activeFaults.length>0).map(e=>e.id)).size}},[n]),c=(0,F.useMemo)(()=>{let e=a.filter(e=>e.enabled);return{enabled:e,totalMessages:e.reduce((e,t)=>e+(o.find(e=>e.name===t.name)?.metrics?.messagesPublished??0),0),totalErrors:e.reduce((e,t)=>e+(o.find(e=>e.name===t.name)?.metrics?.errorsCount??0),0),labels:e.map(e=>B[e.name]??e.name)}},[a,o]),l=s.activeFaultCount>0,f=l?`destructive`:s.quarantined>0?`warning`:`success`,m=l?`faulted`:`healthy`;return(0,L.jsxs)(`section`,{"aria-label":`Fleet status`,className:`flex w-full min-w-0 max-w-full flex-col divide-y divide-border/40 overflow-hidden rounded-(--miravo-radius-stadium-sm) border sm:flex-row sm:divide-x sm:divide-y-0`,children:[(0,L.jsxs)(`button`,{type:`button`,onClick:()=>t(W(e,m)),"aria-pressed":e===`healthy`||e===`faulted`,"aria-label":l?`Filter to faulted instances`:`Filter to healthy instances`,className:y(`flex min-w-0 flex-1 flex-col overflow-hidden px-4 py-3 text-left outline-none transition-colors duration-150`,`hover:bg-muted/40 focus-visible:bg-muted/40 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`,(e===`healthy`||e===`faulted`)&&`bg-muted/50`),children:[(0,L.jsx)(V,{label:`Health`,pip:f}),(0,L.jsxs)(H,{tone:l?`destructive`:`success`,children:[s.pct,`%`]}),(0,L.jsx)(U,{children:s.total===0?`No instances`:[`${s.total} instance${s.total===1?``:`s`}`,s.faulted>0&&`${s.faulted} faulted`,s.quarantined>0&&`${s.quarantined} quarantined`,`${s.modelCount} model${s.modelCount===1?``:`s`}`].filter(Boolean).join(` · `)})]}),(0,L.jsxs)(`button`,{type:`button`,onClick:()=>t(e===`faulted`?``:`faulted`),"aria-pressed":e===`faulted`,"aria-label":`Filter to faulted instances`,className:y(`flex min-w-0 flex-1 flex-col overflow-hidden px-4 py-3 text-left outline-none transition-colors duration-150`,`hover:bg-muted/40 focus-visible:bg-muted/40 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`,e===`faulted`&&`bg-muted/50`),children:[(0,L.jsx)(V,{label:`Faults`,pip:l?`destructive`:`success`}),(0,L.jsx)(H,{tone:l?`destructive`:`foreground`,live:!0,children:s.activeFaultCount}),(0,L.jsx)(U,{children:l?`${s.affectedCount} instance${s.affectedCount===1?``:`s`} affected`:`all clear`})]}),(0,L.jsxs)(k,{children:[(0,L.jsxs)(D,{render:(0,L.jsx)(u,{to:`/tags`,"aria-label":`Open tag stream`,className:`flex min-w-0 flex-1 flex-col overflow-hidden px-4 py-3 outline-none transition-colors duration-150 hover:bg-muted/40 focus-visible:bg-muted/40 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`}),children:[(0,L.jsx)(V,{label:`Tags`,pip:`primary`,pulse:!0}),(0,L.jsx)(H,{children:p(i)}),(0,L.jsxs)(U,{children:[(0,L.jsx)(`span`,{className:`font-mono tabular-nums`,children:r.toFixed(1)}),` tps · live`]})]}),(0,L.jsx)(O,{side:`bottom`,children:(0,L.jsxs)(`div`,{className:`flex flex-col gap-0.5 text-[11px]`,children:[(0,L.jsx)(`span`,{children:`Live tags tracked across the fleet.`}),i>=1e6&&(0,L.jsxs)(`span`,{className:`font-mono tabular-nums text-muted-foreground`,children:[h(i),` tags`]}),(0,L.jsxs)(`span`,{className:`text-muted-foreground`,children:[`Updating at `,(0,L.jsx)(`span`,{className:`font-mono tabular-nums`,children:r.toFixed(1)}),` per second.`]})]})})]}),c.enabled.length>0&&(0,L.jsx)(G,{labels:c.labels,totalMessages:c.totalMessages,totalErrors:c.totalErrors,perAdapter:c.enabled.map(e=>({name:B[e.name]??e.name,metrics:o.find(t=>t.name===e.name)?.metrics}))})]})}function G({labels:e,totalMessages:t,totalErrors:n,perAdapter:r}){return(0,L.jsxs)(k,{children:[(0,L.jsxs)(D,{render:(0,L.jsx)(u,{to:`/control`,"aria-label":`Open control — protocol adapters`,className:`flex min-w-0 flex-1 flex-col overflow-hidden px-4 py-3 outline-none transition-colors duration-150 hover:bg-muted/40 focus-visible:bg-muted/40 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`}),children:[(0,L.jsx)(V,{label:`Protocol`,pip:`primary`,pulse:!0}),(0,L.jsx)(H,{tone:n>0?`warning`:`foreground`,live:!0,children:p(t)}),(0,L.jsxs)(U,{children:[e.join(` · `),n>0&&` · ${n} error${n===1?``:`s`}`]})]}),(0,L.jsx)(O,{side:`bottom`,children:(0,L.jsxs)(`div`,{className:`flex flex-col gap-1 text-[11px]`,children:[(0,L.jsx)(`span`,{children:`Messages published since session start.`}),t>=1e6&&(0,L.jsxs)(`span`,{className:`font-mono tabular-nums text-muted-foreground`,children:[h(t),` total`]}),(0,L.jsx)(`div`,{className:`flex flex-col gap-0.5 border-t border-tooltip-border/60 pt-1`,children:r.map(e=>(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,L.jsxs)(`span`,{className:`font-mono tabular-nums`,children:[h(e.metrics?.messagesPublished??0),` msg`]}),e.metrics&&e.metrics.errorsCount>0&&(0,L.jsxs)(`span`,{className:`font-mono tabular-nums text-destructive`,children:[`· `,e.metrics.errorsCount,` err`]})]},e.name))})]})})]})}var K=`Commissioning → instance is running startup diagnostics. Operating → running normally. Decommissioning → winding down.`;function ye(e,t,n){let r=n===`asc`?1:-1;return[...e].sort((e,n)=>{switch(t){case`id`:return e.id.localeCompare(n.id)*r;case`model`:return e.model.localeCompare(n.model)*r;case`lifecycle`:return e.lifecycleStage.localeCompare(n.lifecycleStage)*r;case`hours`:return(e.operatingHours-n.operatingHours)*r;case`faults`:return(e.activeFaults.length-n.activeFaults.length)*r;case`status`:{let t=e=>e.isQuarantined?2:+(e.activeFaults.length>0);return(t(e)-t(n))*r}default:return 0}})}function be(e){return e===``||e===`healthy`||e===`faulted`||e===`quarantined`}function xe(e){return e.isQuarantined?`quarantined`:e.activeFaults.length>0?`faulted`:`healthy`}var q={healthy:{pip:`bg-success`,ring:`border-success/40 text-success`,label:`healthy`,help:`No active faults, not quarantined.`},faulted:{pip:`bg-warning`,ring:`border-warning/40 text-warning`,label:`faulted`,help:`One or more active faults; instance is still running.`},quarantined:{pip:`bg-destructive`,ring:`border-destructive/40 text-destructive`,label:`quarantined`,help:`Instance isolated from production flows pending review.`}};function Se({state:e}){let t=q[e];return(0,L.jsxs)(k,{children:[(0,L.jsxs)(D,{render:(0,L.jsx)(`span`,{className:y(`inline-flex h-5 items-center gap-1.5 rounded-(--miravo-radius-pill) border bg-background/30 px-2 text-[11px] font-medium`,t.ring)}),children:[(0,L.jsx)(`span`,{"aria-hidden":!0,className:y(`size-1.5 shrink-0 rounded-full`,t.pip)}),(0,L.jsx)(`span`,{children:g(t.label)})]}),(0,L.jsx)(O,{side:`top`,children:t.help})]})}function J({label:e,sortKey:t,subtitle:n,tooltip:r,current:i,direction:a,onSort:o,className:s}){let c=i===t,l=c?a===`asc`?`ascending`:`descending`:`none`,u=(0,L.jsxs)(`button`,{type:`button`,className:`flex items-center gap-1 whitespace-nowrap rounded-(--miravo-radius-tight) text-left outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background`,onClick:()=>o(t),children:[(0,L.jsxs)(`span`,{className:`inline-flex items-baseline gap-1`,children:[(0,L.jsx)(`span`,{children:e}),n&&(0,L.jsx)(`span`,{className:`text-[10px] font-normal text-muted-foreground`,children:n})]}),(0,L.jsx)(x,{className:y(`size-3`,c?`text-foreground`:`text-muted-foreground`),"aria-hidden":!0}),(0,L.jsx)(`span`,{className:`sr-only`,children:c?`, sorted ${a===`asc`?`ascending`:`descending`}. Click to toggle.`:`, click to sort`})]});return(0,L.jsx)(P,{className:s,"aria-sort":l,children:r?(0,L.jsxs)(k,{children:[(0,L.jsx)(D,{render:u}),(0,L.jsx)(O,{side:`top`,children:r})]}):u})}function Y({title:e,body:t,action:n}){return(0,L.jsx)(N,{children:(0,L.jsx)(M,{colSpan:7,className:`py-10`,children:(0,L.jsxs)(`div`,{className:`mx-auto flex max-w-sm flex-col items-center gap-2 text-center`,children:[(0,L.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:e}),(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t}),n&&(0,L.jsxs)(u,{to:n.href,className:`mt-1 inline-flex items-center gap-1 rounded-(--miravo-radius-tight) text-xs font-medium text-primary outline-none hover:underline focus-visible:ring-2 focus-visible:ring-ring`,children:[n.label,(0,L.jsx)(b,{className:`size-3`,"aria-hidden":!0})]})]})})})}function X(){let{instances:e,connectionState:t}=A(d(e=>({instances:e.instances,connectionState:e.connectionState}))),[n,r]=s(`q`,c.withDefault(``)),[i,a]=s(`model`,c.withDefault(``)),[o,u]=s(`lifecycle`,c.withDefault(``)),[p,h]=s(`status`,c.withDefault(``)),g=be(p)?p:``,[x,R]=(0,F.useState)(`id`),[z,B]=(0,F.useState)(`asc`),V=(0,F.useRef)(null),H=l(),[U,W]=(0,F.useState)(``);(0,F.useEffect)(()=>{let e=e=>{if(e.key!==`/`||e.metaKey||e.ctrlKey||e.altKey)return;let t=e.target.tagName;t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||(e.preventDefault(),V.current?.focus())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let G=(0,F.useCallback)(e=>{e===x?B(e=>e===`asc`?`desc`:`asc`):(R(e),B(`asc`))},[x]),q=(0,F.useCallback)(e=>{h(e===``?``:e)},[h]),X=(0,F.useMemo)(()=>{let t=new Map;for(let n of e)t.set(n.model,(t.get(n.model)??0)+1);return[...t.entries()].sort((e,t)=>e[0].localeCompare(t[0]))},[e]),Z=(0,F.useMemo)(()=>[...new Set(e.map(e=>e.lifecycleStage))].sort(),[e]),Ce=(0,F.useMemo)(()=>[{value:`all`,label:`All stages`},...Z.map(e=>({value:e,label:m(e)}))],[Z]),Q=(0,F.useMemo)(()=>U?X.filter(([e])=>v(e,U)):X,[X,U]),we=(0,F.useMemo)(()=>i?{value:i,label:_(i)}:null,[i]),$=(0,F.useMemo)(()=>{let t=e;return i&&(t=t.filter(e=>e.model===i)),o&&(t=t.filter(e=>e.lifecycleStage===o)),n&&(t=t.filter(e=>te(e.id,n)||v(e.model,n))),g===`faulted`&&(t=t.filter(e=>e.activeFaults.length>0)),g===`quarantined`&&(t=t.filter(e=>e.isQuarantined)),g===`healthy`&&(t=t.filter(e=>e.activeFaults.length===0&&!e.isQuarantined)),ye(t,x,z)},[e,n,g,i,o,x,z]),Te=g!==``||i!==``||o!==``||n!==``,Ee=(0,F.useCallback)(()=>{r(``),h(``),a(``),u(``)},[r,h,a,u]),De=(0,F.useCallback)(e=>{(0,F.startTransition)(()=>{(0,F.addTransitionType)(oe),H(`/instance/${e}`)})},[H]),Oe=e.length===0&&t!==`live`,ke=e.length===0&&t===`live`;return(0,L.jsxs)(`div`,{className:`mx-auto flex w-full max-w-screen-2xl flex-col gap-5 p-4 sm:gap-6 sm:p-6`,children:[(0,L.jsx)(`h1`,{className:`font-heading text-2xl font-semibold tracking-tight`,children:`Fleet Overview`}),(0,L.jsx)(ve,{statusFilter:g,onStatusFilter:q}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsxs)(pe,{value:we,onValueChange:e=>void a(e?.value??``),isItemEqualToValue:(e,t)=>e?.value===t?.value,onInputValueChange:W,children:[(0,L.jsx)(de,{placeholder:`All models`,className:`h-8 w-48`,showClear:!!i}),(0,L.jsx)(le,{children:(0,L.jsxs)(se,{children:[Q.map(([e,t])=>(0,L.jsxs)(ce,{value:{value:e,label:_(e)},children:[(0,L.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:_(e)}),(0,L.jsxs)(`span`,{className:`shrink-0 tabular-nums text-muted-foreground`,children:[`(`,t,`)`]})]},e)),Q.length===0&&(0,L.jsx)(`p`,{className:`py-2 text-center text-xs text-muted-foreground`,children:`No models found`})]})})]}),Z.length>1&&(0,L.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,L.jsxs)(E,{value:o||`all`,onValueChange:e=>void u(!e||e===`all`?``:e),items:Ce,children:[(0,L.jsx)(T,{className:`h-8 w-36`,"aria-label":`Lifecycle stage`,children:(0,L.jsx)(S,{placeholder:`All stages`})}),(0,L.jsxs)(w,{alignItemWithTrigger:!1,align:`start`,children:[(0,L.jsx)(C,{value:`all`,children:`All stages`}),Z.map(e=>(0,L.jsx)(C,{value:e,children:m(e)},e))]})]}),(0,L.jsxs)(k,{children:[(0,L.jsx)(D,{render:(0,L.jsx)(`button`,{type:`button`,"aria-label":`About lifecycle stages`,className:`flex size-6 items-center justify-center rounded-(--miravo-radius-tight) text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring`}),children:(0,L.jsx)(ie,{className:`size-3.5`,"aria-hidden":!0})}),(0,L.jsx)(O,{side:`top`,children:K})]})]}),(0,L.jsxs)(E,{value:g||`all`,onValueChange:e=>void h(!e||e===`all`?``:e),items:he,children:[(0,L.jsx)(T,{className:`h-8 w-32`,"aria-label":`Status filter`,children:(0,L.jsx)(S,{placeholder:`All status`})}),(0,L.jsxs)(w,{alignItemWithTrigger:!1,align:`start`,children:[(0,L.jsx)(C,{value:`all`,children:`All status`}),(0,L.jsx)(C,{value:`healthy`,children:`Healthy`}),(0,L.jsx)(C,{value:`faulted`,children:`Faulted`}),(0,L.jsx)(C,{value:`quarantined`,children:`Quarantined`})]})]}),(0,L.jsxs)(`div`,{className:`relative`,children:[(0,L.jsx)(re,{ref:V,placeholder:`Search...`,value:n,onChange:e=>void r(e.target.value),"aria-label":`Search instances by id or model`,className:`h-8 w-40 pr-7 text-xs`}),!n&&(0,L.jsx)(`kbd`,{className:`pointer-events-none absolute top-1/2 right-2 -translate-y-1/2 rounded-(--miravo-radius-tight) border border-border bg-muted px-1 font-mono text-[10px] text-muted-foreground`,children:`/`})]}),Te&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`button`,{type:`button`,onClick:Ee,className:`flex items-center gap-1 rounded-(--miravo-radius-tight) px-1 text-xs text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,L.jsx)(ne,{className:`size-3`,"aria-hidden":!0}),`Clear`]}),(0,L.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,"aria-live":`polite`,children:[$.length,` of `,e.length]})]})]}),(0,L.jsx)(ue,{className:`py-0`,children:(0,L.jsx)(fe,{className:`p-0 [&_thead_tr_th:last-child]:w-6 [&_thead_tr_th:last-child]:px-1 sm:[&_thead_tr_th:last-child]:w-8 sm:[&_thead_tr_th:last-child]:px-2 [&_tbody_tr_td:last-child]:px-1 sm:[&_tbody_tr_td:last-child]:px-2`,children:(0,L.jsxs)(ge,{children:[(0,L.jsx)(_e,{children:(0,L.jsxs)(N,{children:[(0,L.jsx)(J,{label:`Instance`,sortKey:`id`,current:x,direction:z,onSort:G}),(0,L.jsx)(J,{label:`Model`,sortKey:`model`,current:x,direction:z,onSort:G,className:`hidden sm:table-cell`}),(0,L.jsx)(J,{label:`Lifecycle`,sortKey:`lifecycle`,current:x,direction:z,onSort:G,tooltip:K}),(0,L.jsx)(J,{label:`Operating age`,sortKey:`hours`,current:x,direction:z,onSort:G,tooltip:`Cumulative operating hours since the instance started running.`,className:`hidden text-right md:table-cell`}),(0,L.jsx)(J,{label:`Faults`,sortKey:`faults`,current:x,direction:z,onSort:G,tooltip:`Count of active (uncleared) faults on this instance.`}),(0,L.jsx)(J,{label:`Status`,sortKey:`status`,current:x,direction:z,onSort:G}),(0,L.jsx)(P,{children:(0,L.jsx)(`span`,{className:`sr-only`,children:`Navigate to instance`})})]})}),(0,L.jsx)(me,{children:Oe?(0,L.jsx)(Y,{title:`Connecting to runtime`,body:`Live fleet data will appear once the connection is up.`}):ke?(0,L.jsx)(Y,{title:`No running instances`,body:`Start an environment from the Catalog to see instances.`,action:{label:`Open Catalog`,href:`/catalog`}}):$.length===0?(0,L.jsx)(Y,{title:`No matches`,body:`Adjust filters or clear them to see the full fleet.`}):$.map(e=>{let t=xe(e),n=f(e.id);return(0,L.jsxs)(N,{tabIndex:0,"aria-label":`Open instance ${n}`,className:y(`group cursor-pointer outline-none transition-colors`,`focus-visible:bg-sidebar-accent focus-visible:ring-2 focus-visible:ring-ring/70 focus-visible:ring-inset`),onClick:()=>De(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),De(e.id))},onMouseEnter:()=>{j(`/instance/${e.id}`),I(e.id)},onFocus:()=>{j(`/instance/${e.id}`),I(e.id)},children:[(0,L.jsx)(M,{className:`text-sm`,children:(0,L.jsx)(F.ViewTransition,{name:`instance-${e.id}`,default:`none`,children:(0,L.jsx)(`span`,{className:`inline-flex max-w-full rounded-(--miravo-radius-tight) text-left`,children:n})})}),(0,L.jsx)(M,{className:`hidden text-sm sm:table-cell`,children:_(e.model)}),(0,L.jsx)(M,{children:(0,L.jsx)(ae,{variant:`secondary`,className:`text-xs`,children:m(e.lifecycleStage)})}),(0,L.jsx)(M,{className:`hidden font-mono text-sm md:table-cell`,children:ee(e.operatingHours)}),(0,L.jsx)(M,{children:e.activeFaults.length>0?(0,L.jsxs)(k,{children:[(0,L.jsx)(D,{render:(0,L.jsx)(`span`,{className:`inline-flex h-5 min-w-5 items-center justify-center rounded-(--miravo-radius-pill) bg-destructive/15 px-1.5 font-mono text-[11px] font-semibold tabular-nums text-destructive`}),children:e.activeFaults.length}),(0,L.jsxs)(O,{side:`top`,children:[e.activeFaults.slice(0,4).join(`, `),e.activeFaults.length>4&&` + ${e.activeFaults.length-4} more`]})]}):(0,L.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[(0,L.jsx)(`span`,{className:`sr-only`,children:`no faults`}),(0,L.jsx)(`span`,{"aria-hidden":!0,children:`—`})]})}),(0,L.jsx)(M,{children:(0,L.jsx)(Se,{state:t})}),(0,L.jsx)(M,{children:(0,L.jsx)(b,{className:`size-3.5 text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100`,"aria-hidden":!0})})]},e.id)})})]})})})]})}export{X as t};
|
|
1
|
+
import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{at as n}from"./vendor-ui-CWUk2ulb.js";import{S as r,b as i,o as a,x as o}from"./api-CrYvIV3A.js";import{i as s,n as c}from"./dist-xY0pK9Wy.js";import{c as l,n as u}from"./chunk-OE4NN4TA-DBWZidbW.js";import{t as d}from"./shallow-Cin0mLuv.js";import{c as f,d as p,g as m,l as h,p as ee,s as g,u as _,v as te,w as ne,x as re,y as v}from"./format-CshN6yEB.js";import{t as y}from"./utils-XFKvwlFT.js";import{t as b}from"./arrow-right-BjBb4z7g.js";import{t as x}from"./arrow-up-down-C1oJAmrw.js";import{c as S,i as C,n as w,s as T,t as E}from"./select-CmlY1M1a.js";import{t as ie}from"./circle-question-mark-CJvcT6V6.js";import{i as D,n as O,t as k}from"./tooltip-D1ydB4g3.js";import{r as A}from"./engine-store-DMULdR_V.js";import{t as j}from"./route-preload-CLRbqehb.js";import{t as ae}from"./badge-eIn_7YrK.js";import{n as oe}from"./transition-types-2i1blGlR.js";import{a as se,i as ce,n as le,o as ue,r as de,s as fe,t as pe}from"./combobox-BCaV1Wbo.js";import{a as M,c as N,i as me,n as he,o as P,r as ge,s as _e}from"./select-display-items-Bqb6Sbg6.js";var F=e(t(),1);function I(e){return o.prefetchQuery({queryKey:i.instances.detail(e),queryFn:()=>a(`/instances/${e}`,r.instanceDetail),staleTime:2e3})}var L=n(),R={success:`bg-success`,warning:`bg-warning`,destructive:`bg-destructive`,foreground:`bg-foreground/60`,primary:`bg-primary`},z={success:`text-success`,warning:`text-warning`,destructive:`text-destructive`,foreground:`text-foreground`,primary:`text-primary`},B={mqtt:`MQTT`,opcua:`OPC UA`,modbus:`Modbus`};function V({label:e,pip:t,pulse:n}){return(0,L.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[t&&(n?(0,L.jsxs)(`span`,{"aria-hidden":!0,className:`relative flex size-1.5 shrink-0 items-center justify-center`,children:[(0,L.jsx)(`span`,{className:y(`absolute inline-flex h-full w-full animate-ping rounded-full opacity-75`,R[t])}),(0,L.jsx)(`span`,{className:y(`relative inline-flex size-1.5 rounded-full`,R[t])})]}):(0,L.jsx)(`span`,{"aria-hidden":!0,className:y(`size-1.5 shrink-0 rounded-full`,R[t])})),(0,L.jsx)(`span`,{className:`truncate text-[10px] font-medium uppercase tracking-(--miravo-tracking-eyebrow) text-muted-foreground`,children:e})]})}function H({children:e,tone:t=`foreground`,live:n}){return(0,L.jsx)(`span`,{...n?{role:`status`,"aria-live":`polite`}:{},className:y(`mt-1 block min-w-0 truncate font-mono text-2xl font-semibold tabular-nums leading-none transition-colors duration-300`,z[t]),children:e})}function U({children:e}){return(0,L.jsx)(`span`,{className:`mt-1 min-w-0 truncate text-[10px] text-muted-foreground`,children:e})}function W(e,t){return e===t?``:t}function ve({statusFilter:e,onStatusFilter:t}){let{instances:n,tps:r,memberValueCount:i,availableAdapters:a,adapterMetrics:o}=A(d(e=>({instances:e.instances,tps:e.tps,memberValueCount:e.memberValueCount,availableAdapters:e.availableAdapters,adapterMetrics:e.adapterMetrics}))),s=(0,F.useMemo)(()=>{let e=n.filter(e=>!e.isQuarantined&&e.activeFaults.length===0).length,t=n.filter(e=>!e.isQuarantined&&e.activeFaults.length>0).length,r=n.filter(e=>e.isQuarantined).length,i=n.length;return{healthy:e,faulted:t,quarantined:r,total:i,pct:i>0?Math.round(e/i*100):100,activeFaultCount:n.reduce((e,t)=>e+t.activeFaults.length,0),modelCount:new Set(n.map(e=>e.model)).size,affectedCount:new Set(n.filter(e=>e.activeFaults.length>0).map(e=>e.id)).size}},[n]),c=(0,F.useMemo)(()=>{let e=a.filter(e=>e.enabled);return{enabled:e,totalMessages:e.reduce((e,t)=>e+(o.find(e=>e.name===t.name)?.metrics?.messagesPublished??0),0),totalErrors:e.reduce((e,t)=>e+(o.find(e=>e.name===t.name)?.metrics?.errorsCount??0),0),labels:e.map(e=>B[e.name]??e.name)}},[a,o]),l=s.activeFaultCount>0,f=l?`destructive`:s.quarantined>0?`warning`:`success`,m=l?`faulted`:`healthy`;return(0,L.jsxs)(`section`,{"aria-label":`Fleet status`,className:`flex w-full min-w-0 max-w-full flex-col divide-y divide-border/40 overflow-hidden rounded-(--miravo-radius-stadium-sm) border sm:flex-row sm:divide-x sm:divide-y-0`,children:[(0,L.jsxs)(`button`,{type:`button`,onClick:()=>t(W(e,m)),"aria-pressed":e===`healthy`||e===`faulted`,"aria-label":l?`Filter to faulted instances`:`Filter to healthy instances`,className:y(`flex min-w-0 flex-1 flex-col overflow-hidden px-4 py-3 text-left outline-none transition-colors duration-150`,`hover:bg-muted/40 focus-visible:bg-muted/40 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`,(e===`healthy`||e===`faulted`)&&`bg-muted/50`),children:[(0,L.jsx)(V,{label:`Health`,pip:f}),(0,L.jsxs)(H,{tone:l?`destructive`:`success`,children:[s.pct,`%`]}),(0,L.jsx)(U,{children:s.total===0?`No instances`:[`${s.total} instance${s.total===1?``:`s`}`,s.faulted>0&&`${s.faulted} faulted`,s.quarantined>0&&`${s.quarantined} quarantined`,`${s.modelCount} model${s.modelCount===1?``:`s`}`].filter(Boolean).join(` · `)})]}),(0,L.jsxs)(`button`,{type:`button`,onClick:()=>t(e===`faulted`?``:`faulted`),"aria-pressed":e===`faulted`,"aria-label":`Filter to faulted instances`,className:y(`flex min-w-0 flex-1 flex-col overflow-hidden px-4 py-3 text-left outline-none transition-colors duration-150`,`hover:bg-muted/40 focus-visible:bg-muted/40 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`,e===`faulted`&&`bg-muted/50`),children:[(0,L.jsx)(V,{label:`Faults`,pip:l?`destructive`:`success`}),(0,L.jsx)(H,{tone:l?`destructive`:`foreground`,live:!0,children:s.activeFaultCount}),(0,L.jsx)(U,{children:l?`${s.affectedCount} instance${s.affectedCount===1?``:`s`} affected`:`all clear`})]}),(0,L.jsxs)(k,{children:[(0,L.jsxs)(D,{render:(0,L.jsx)(u,{to:`/tags`,"aria-label":`Open tag stream`,className:`flex min-w-0 flex-1 flex-col overflow-hidden px-4 py-3 outline-none transition-colors duration-150 hover:bg-muted/40 focus-visible:bg-muted/40 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`}),children:[(0,L.jsx)(V,{label:`Tags`,pip:`primary`,pulse:!0}),(0,L.jsx)(H,{children:p(i)}),(0,L.jsxs)(U,{children:[(0,L.jsx)(`span`,{className:`font-mono tabular-nums`,children:r.toFixed(1)}),` tps · live`]})]}),(0,L.jsx)(O,{side:`bottom`,children:(0,L.jsxs)(`div`,{className:`flex flex-col gap-0.5 text-[11px]`,children:[(0,L.jsx)(`span`,{children:`Live tags tracked across the fleet.`}),i>=1e6&&(0,L.jsxs)(`span`,{className:`font-mono tabular-nums text-muted-foreground`,children:[h(i),` tags`]}),(0,L.jsxs)(`span`,{className:`text-muted-foreground`,children:[`Updating at `,(0,L.jsx)(`span`,{className:`font-mono tabular-nums`,children:r.toFixed(1)}),` per second.`]})]})})]}),c.enabled.length>0&&(0,L.jsx)(G,{labels:c.labels,totalMessages:c.totalMessages,totalErrors:c.totalErrors,perAdapter:c.enabled.map(e=>({name:B[e.name]??e.name,metrics:o.find(t=>t.name===e.name)?.metrics}))})]})}function G({labels:e,totalMessages:t,totalErrors:n,perAdapter:r}){return(0,L.jsxs)(k,{children:[(0,L.jsxs)(D,{render:(0,L.jsx)(u,{to:`/control`,"aria-label":`Open control — protocol adapters`,className:`flex min-w-0 flex-1 flex-col overflow-hidden px-4 py-3 outline-none transition-colors duration-150 hover:bg-muted/40 focus-visible:bg-muted/40 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`}),children:[(0,L.jsx)(V,{label:`Protocol`,pip:`primary`,pulse:!0}),(0,L.jsx)(H,{tone:n>0?`warning`:`foreground`,live:!0,children:p(t)}),(0,L.jsxs)(U,{children:[e.join(` · `),n>0&&` · ${n} error${n===1?``:`s`}`]})]}),(0,L.jsx)(O,{side:`bottom`,children:(0,L.jsxs)(`div`,{className:`flex flex-col gap-1 text-[11px]`,children:[(0,L.jsx)(`span`,{children:`Messages published since session start.`}),t>=1e6&&(0,L.jsxs)(`span`,{className:`font-mono tabular-nums text-muted-foreground`,children:[h(t),` total`]}),(0,L.jsx)(`div`,{className:`flex flex-col gap-0.5 border-t border-tooltip-border/60 pt-1`,children:r.map(e=>(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,L.jsxs)(`span`,{className:`font-mono tabular-nums`,children:[h(e.metrics?.messagesPublished??0),` msg`]}),e.metrics&&e.metrics.errorsCount>0&&(0,L.jsxs)(`span`,{className:`font-mono tabular-nums text-destructive`,children:[`· `,e.metrics.errorsCount,` err`]})]},e.name))})]})})]})}var K=`Commissioning → instance is running startup diagnostics. Operating → running normally. Decommissioning → winding down.`;function ye(e,t,n){let r=n===`asc`?1:-1;return[...e].sort((e,n)=>{switch(t){case`id`:return e.id.localeCompare(n.id)*r;case`model`:return e.model.localeCompare(n.model)*r;case`lifecycle`:return e.lifecycleStage.localeCompare(n.lifecycleStage)*r;case`hours`:return(e.operatingHours-n.operatingHours)*r;case`faults`:return(e.activeFaults.length-n.activeFaults.length)*r;case`status`:{let t=e=>e.isQuarantined?2:+(e.activeFaults.length>0);return(t(e)-t(n))*r}default:return 0}})}function be(e){return e===``||e===`healthy`||e===`faulted`||e===`quarantined`}function xe(e){return e.isQuarantined?`quarantined`:e.activeFaults.length>0?`faulted`:`healthy`}var q={healthy:{pip:`bg-success`,ring:`border-success/40 text-success`,label:`healthy`,help:`No active faults, not quarantined.`},faulted:{pip:`bg-warning`,ring:`border-warning/40 text-warning`,label:`faulted`,help:`One or more active faults; instance is still running.`},quarantined:{pip:`bg-destructive`,ring:`border-destructive/40 text-destructive`,label:`quarantined`,help:`Instance isolated from production flows pending review.`}};function Se({state:e}){let t=q[e];return(0,L.jsxs)(k,{children:[(0,L.jsxs)(D,{render:(0,L.jsx)(`span`,{className:y(`inline-flex h-5 items-center gap-1.5 rounded-(--miravo-radius-pill) border bg-background/30 px-2 text-[11px] font-medium`,t.ring)}),children:[(0,L.jsx)(`span`,{"aria-hidden":!0,className:y(`size-1.5 shrink-0 rounded-full`,t.pip)}),(0,L.jsx)(`span`,{children:g(t.label)})]}),(0,L.jsx)(O,{side:`top`,children:t.help})]})}function J({label:e,sortKey:t,subtitle:n,tooltip:r,current:i,direction:a,onSort:o,className:s}){let c=i===t,l=c?a===`asc`?`ascending`:`descending`:`none`,u=(0,L.jsxs)(`button`,{type:`button`,className:`flex items-center gap-1 whitespace-nowrap rounded-(--miravo-radius-tight) text-left outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background`,onClick:()=>o(t),children:[(0,L.jsxs)(`span`,{className:`inline-flex items-baseline gap-1`,children:[(0,L.jsx)(`span`,{children:e}),n&&(0,L.jsx)(`span`,{className:`text-[10px] font-normal text-muted-foreground`,children:n})]}),(0,L.jsx)(x,{className:y(`size-3`,c?`text-foreground`:`text-muted-foreground`),"aria-hidden":!0}),(0,L.jsx)(`span`,{className:`sr-only`,children:c?`, sorted ${a===`asc`?`ascending`:`descending`}. Click to toggle.`:`, click to sort`})]});return(0,L.jsx)(P,{className:s,"aria-sort":l,children:r?(0,L.jsxs)(k,{children:[(0,L.jsx)(D,{render:u}),(0,L.jsx)(O,{side:`top`,children:r})]}):u})}function Y({title:e,body:t,action:n}){return(0,L.jsx)(N,{children:(0,L.jsx)(M,{colSpan:7,className:`py-10`,children:(0,L.jsxs)(`div`,{className:`mx-auto flex max-w-sm flex-col items-center gap-2 text-center`,children:[(0,L.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:e}),(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t}),n&&(0,L.jsxs)(u,{to:n.href,className:`mt-1 inline-flex items-center gap-1 rounded-(--miravo-radius-tight) text-xs font-medium text-primary outline-none hover:underline focus-visible:ring-2 focus-visible:ring-ring`,children:[n.label,(0,L.jsx)(b,{className:`size-3`,"aria-hidden":!0})]})]})})})}function X(){let{instances:e,connectionState:t}=A(d(e=>({instances:e.instances,connectionState:e.connectionState}))),[n,r]=s(`q`,c.withDefault(``)),[i,a]=s(`model`,c.withDefault(``)),[o,u]=s(`lifecycle`,c.withDefault(``)),[p,h]=s(`status`,c.withDefault(``)),g=be(p)?p:``,[x,R]=(0,F.useState)(`id`),[z,B]=(0,F.useState)(`asc`),V=(0,F.useRef)(null),H=l(),[U,W]=(0,F.useState)(``);(0,F.useEffect)(()=>{let e=e=>{if(e.key!==`/`||e.metaKey||e.ctrlKey||e.altKey)return;let t=e.target.tagName;t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||(e.preventDefault(),V.current?.focus())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let G=(0,F.useCallback)(e=>{e===x?B(e=>e===`asc`?`desc`:`asc`):(R(e),B(`asc`))},[x]),q=(0,F.useCallback)(e=>{h(e===``?``:e)},[h]),X=(0,F.useMemo)(()=>{let t=new Map;for(let n of e)t.set(n.model,(t.get(n.model)??0)+1);return[...t.entries()].sort((e,t)=>e[0].localeCompare(t[0]))},[e]),Z=(0,F.useMemo)(()=>[...new Set(e.map(e=>e.lifecycleStage))].sort(),[e]),Ce=(0,F.useMemo)(()=>[{value:`all`,label:`All stages`},...Z.map(e=>({value:e,label:m(e)}))],[Z]),Q=(0,F.useMemo)(()=>U?X.filter(([e])=>v(e,U)):X,[X,U]),we=(0,F.useMemo)(()=>i?{value:i,label:_(i)}:null,[i]),$=(0,F.useMemo)(()=>{let t=e;return i&&(t=t.filter(e=>e.model===i)),o&&(t=t.filter(e=>e.lifecycleStage===o)),n&&(t=t.filter(e=>te(e.id,n)||v(e.model,n))),g===`faulted`&&(t=t.filter(e=>e.activeFaults.length>0)),g===`quarantined`&&(t=t.filter(e=>e.isQuarantined)),g===`healthy`&&(t=t.filter(e=>e.activeFaults.length===0&&!e.isQuarantined)),ye(t,x,z)},[e,n,g,i,o,x,z]),Te=g!==``||i!==``||o!==``||n!==``,Ee=(0,F.useCallback)(()=>{r(``),h(``),a(``),u(``)},[r,h,a,u]),De=(0,F.useCallback)(e=>{(0,F.startTransition)(()=>{(0,F.addTransitionType)(oe),H(`/instance/${e}`)})},[H]),Oe=e.length===0&&t!==`live`,ke=e.length===0&&t===`live`;return(0,L.jsxs)(`div`,{className:`mx-auto flex w-full max-w-screen-2xl flex-col gap-5 p-4 sm:gap-6 sm:p-6`,children:[(0,L.jsx)(`h1`,{className:`font-heading text-2xl font-semibold tracking-tight`,children:`Fleet Overview`}),(0,L.jsx)(ve,{statusFilter:g,onStatusFilter:q}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsxs)(pe,{value:we,onValueChange:e=>void a(e?.value??``),isItemEqualToValue:(e,t)=>e?.value===t?.value,onInputValueChange:W,children:[(0,L.jsx)(de,{placeholder:`All models`,className:`h-8 w-48`,showClear:!!i}),(0,L.jsx)(le,{children:(0,L.jsxs)(se,{children:[Q.map(([e,t])=>(0,L.jsxs)(ce,{value:{value:e,label:_(e)},children:[(0,L.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:_(e)}),(0,L.jsxs)(`span`,{className:`shrink-0 tabular-nums text-muted-foreground`,children:[`(`,t,`)`]})]},e)),Q.length===0&&(0,L.jsx)(`p`,{className:`py-2 text-center text-xs text-muted-foreground`,children:`No models found`})]})})]}),Z.length>1&&(0,L.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,L.jsxs)(E,{value:o||`all`,onValueChange:e=>void u(!e||e===`all`?``:e),items:Ce,children:[(0,L.jsx)(T,{className:`h-8 w-36`,"aria-label":`Lifecycle stage`,children:(0,L.jsx)(S,{placeholder:`All stages`})}),(0,L.jsxs)(w,{alignItemWithTrigger:!1,align:`start`,children:[(0,L.jsx)(C,{value:`all`,children:`All stages`}),Z.map(e=>(0,L.jsx)(C,{value:e,children:m(e)},e))]})]}),(0,L.jsxs)(k,{children:[(0,L.jsx)(D,{render:(0,L.jsx)(`button`,{type:`button`,"aria-label":`About lifecycle stages`,className:`flex size-6 items-center justify-center rounded-(--miravo-radius-tight) text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring`}),children:(0,L.jsx)(ie,{className:`size-3.5`,"aria-hidden":!0})}),(0,L.jsx)(O,{side:`top`,children:K})]})]}),(0,L.jsxs)(E,{value:g||`all`,onValueChange:e=>void h(!e||e===`all`?``:e),items:he,children:[(0,L.jsx)(T,{className:`h-8 w-32`,"aria-label":`Status filter`,children:(0,L.jsx)(S,{placeholder:`All status`})}),(0,L.jsxs)(w,{alignItemWithTrigger:!1,align:`start`,children:[(0,L.jsx)(C,{value:`all`,children:`All status`}),(0,L.jsx)(C,{value:`healthy`,children:`Healthy`}),(0,L.jsx)(C,{value:`faulted`,children:`Faulted`}),(0,L.jsx)(C,{value:`quarantined`,children:`Quarantined`})]})]}),(0,L.jsxs)(`div`,{className:`relative`,children:[(0,L.jsx)(re,{ref:V,placeholder:`Search...`,value:n,onChange:e=>void r(e.target.value),"aria-label":`Search instances by id or model`,className:`h-8 w-40 pr-7 text-xs`}),!n&&(0,L.jsx)(`kbd`,{className:`pointer-events-none absolute top-1/2 right-2 -translate-y-1/2 rounded-(--miravo-radius-tight) border border-border bg-muted px-1 font-mono text-[10px] text-muted-foreground`,children:`/`})]}),Te&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`button`,{type:`button`,onClick:Ee,className:`flex items-center gap-1 rounded-(--miravo-radius-tight) px-1 text-xs text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,L.jsx)(ne,{className:`size-3`,"aria-hidden":!0}),`Clear`]}),(0,L.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,"aria-live":`polite`,children:[$.length,` of `,e.length]})]})]}),(0,L.jsx)(ue,{className:`py-0`,children:(0,L.jsx)(fe,{className:`p-0 [&_thead_tr_th:last-child]:w-6 [&_thead_tr_th:last-child]:px-1 sm:[&_thead_tr_th:last-child]:w-8 sm:[&_thead_tr_th:last-child]:px-2 [&_tbody_tr_td:last-child]:px-1 sm:[&_tbody_tr_td:last-child]:px-2`,children:(0,L.jsxs)(ge,{children:[(0,L.jsx)(_e,{children:(0,L.jsxs)(N,{children:[(0,L.jsx)(J,{label:`Instance`,sortKey:`id`,current:x,direction:z,onSort:G}),(0,L.jsx)(J,{label:`Model`,sortKey:`model`,current:x,direction:z,onSort:G,className:`hidden sm:table-cell`}),(0,L.jsx)(J,{label:`Lifecycle`,sortKey:`lifecycle`,current:x,direction:z,onSort:G,tooltip:K}),(0,L.jsx)(J,{label:`Operating age`,sortKey:`hours`,current:x,direction:z,onSort:G,tooltip:`Cumulative operating hours since the instance started running.`,className:`hidden text-right md:table-cell`}),(0,L.jsx)(J,{label:`Faults`,sortKey:`faults`,current:x,direction:z,onSort:G,tooltip:`Count of active (uncleared) faults on this instance.`}),(0,L.jsx)(J,{label:`Status`,sortKey:`status`,current:x,direction:z,onSort:G}),(0,L.jsx)(P,{children:(0,L.jsx)(`span`,{className:`sr-only`,children:`Navigate to instance`})})]})}),(0,L.jsx)(me,{children:Oe?(0,L.jsx)(Y,{title:`Connecting to runtime`,body:`Live fleet data will appear once the connection is up.`}):ke?(0,L.jsx)(Y,{title:`No running instances`,body:`Start an environment from the Catalog to see instances.`,action:{label:`Open Catalog`,href:`/catalog`}}):$.length===0?(0,L.jsx)(Y,{title:`No matches`,body:`Adjust filters or clear them to see the full fleet.`}):$.map(e=>{let t=xe(e),n=f(e.id);return(0,L.jsxs)(N,{tabIndex:0,"aria-label":`Open instance ${n}`,className:y(`group cursor-pointer outline-none transition-colors`,`focus-visible:bg-sidebar-accent focus-visible:ring-2 focus-visible:ring-ring/70 focus-visible:ring-inset`),onClick:()=>De(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),De(e.id))},onMouseEnter:()=>{j(`/instance/${e.id}`),I(e.id)},onFocus:()=>{j(`/instance/${e.id}`),I(e.id)},children:[(0,L.jsx)(M,{className:`text-sm`,children:(0,L.jsx)(F.ViewTransition,{name:`instance-${e.id}`,default:`none`,children:(0,L.jsx)(`span`,{className:`inline-flex max-w-full rounded-(--miravo-radius-tight) text-left`,children:n})})}),(0,L.jsx)(M,{className:`hidden text-sm sm:table-cell`,children:_(e.model)}),(0,L.jsx)(M,{children:(0,L.jsx)(ae,{variant:`secondary`,className:`text-xs`,children:m(e.lifecycleStage)})}),(0,L.jsx)(M,{className:`hidden font-mono text-sm md:table-cell`,children:ee(e.operatingHours)}),(0,L.jsx)(M,{children:e.activeFaults.length>0?(0,L.jsxs)(k,{children:[(0,L.jsx)(D,{render:(0,L.jsx)(`span`,{className:`inline-flex h-5 min-w-5 items-center justify-center rounded-(--miravo-radius-pill) bg-destructive/15 px-1.5 font-mono text-[11px] font-semibold tabular-nums text-destructive`}),children:e.activeFaults.length}),(0,L.jsxs)(O,{side:`top`,children:[e.activeFaults.slice(0,4).join(`, `),e.activeFaults.length>4&&` + ${e.activeFaults.length-4} more`]})]}):(0,L.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[(0,L.jsx)(`span`,{className:`sr-only`,children:`no faults`}),(0,L.jsx)(`span`,{"aria-hidden":!0,children:`—`})]})}),(0,L.jsx)(M,{children:(0,L.jsx)(Se,{state:t})}),(0,L.jsx)(M,{children:(0,L.jsx)(b,{className:`size-3.5 text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100`,"aria-hidden":!0})})]},e.id)})})]})})})]})}export{X as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{C as e}from"./api-CrYvIV3A.js";function t(e,t){return e instanceof Error&&e.message.trim().length>0?e.message:typeof e==`string`&&e.trim().length>0?e:t}function n(t){if(e.is(t)&&t.hint?.trim())return t.hint}export{t as n,n as t};
|