@miravo/cli-linux-arm64-musl 0.7.4 → 0.7.5

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.
Files changed (37) hide show
  1. package/console-dist/assets/{api-DimikzPd.js → api-D8oAzcVE.js} +1 -1
  2. package/console-dist/assets/catalog-B70TugE6.js +1 -0
  3. package/console-dist/assets/{catalog-CbdG58Mn.js → catalog-B_wh8kje.js} +1 -1
  4. package/console-dist/assets/{catalog-source-C4jQdH37.js → catalog-source-BU77f8QO.js} +1 -1
  5. package/console-dist/assets/control-CaFfl-Mp.js +1 -0
  6. package/console-dist/assets/control-DCNd1A3U.js +1 -0
  7. package/console-dist/assets/events-BjMeLN1K.js +1 -0
  8. package/console-dist/assets/{events-BP1rvN5g.js → events-CeR9wTII.js} +1 -1
  9. package/console-dist/assets/fleet-C9wGf070.js +1 -0
  10. package/console-dist/assets/{fleet-ne7gllQE.js → fleet-CH141gbg.js} +1 -1
  11. package/console-dist/assets/{index-Ds1n4iXS.js → index-ClSUHPGP.js} +3 -3
  12. package/console-dist/assets/{instance-detail-k6fWu2DS.js → instance-detail-DWELGCE1.js} +1 -1
  13. package/console-dist/assets/{login-BmyMgUK4.js → login-C5dQKX2Y.js} +1 -1
  14. package/console-dist/assets/{models-C_UOiHSF.js → models-CFdqSxB3.js} +1 -1
  15. package/console-dist/assets/models-hAhKpuYB.js +1 -0
  16. package/console-dist/assets/platforms-Bh63oQIi.js +1 -0
  17. package/console-dist/assets/{platforms-CmsbDw-2.js → platforms-BwYPf2Sg.js} +1 -1
  18. package/console-dist/assets/{query-fetch-error-Bcg_UjHM.js → query-fetch-error-NbPqVPRR.js} +1 -1
  19. package/console-dist/assets/{route-preload-BO6weHRR.js → route-preload-DQgHHtBj.js} +2 -2
  20. package/console-dist/assets/{tags-DORoU260.js → tags-BI93Dvh2.js} +1 -1
  21. package/console-dist/assets/tags-_ufsHpn5.js +1 -0
  22. package/console-dist/assets/{transition-nav-link-nVD3H66a.js → transition-nav-link-Ct6VIy2S.js} +1 -1
  23. package/console-dist/assets/{use-engine-command-mutation-C8S_hX0O.js → use-engine-command-mutation-CcfqRB7j.js} +1 -1
  24. package/console-dist/assets/{use-platform-stream-CZLW085n.js → use-platform-stream-DBZo6HMM.js} +1 -1
  25. package/console-dist/assets/{use-transition-navigate-jMR-y4bs.js → use-transition-navigate-jTHkLHMS.js} +1 -1
  26. package/console-dist/assets/{validation-DLydiTzj.js → validation-DRj8OKvB.js} +1 -1
  27. package/console-dist/index.html +17 -17
  28. package/miravo +0 -0
  29. package/package.json +1 -1
  30. package/console-dist/assets/catalog-8tLjGq7E.js +0 -1
  31. package/console-dist/assets/control-4ugKUt8n.js +0 -1
  32. package/console-dist/assets/control-BVr4X_wI.js +0 -1
  33. package/console-dist/assets/events-BcZCvJ63.js +0 -1
  34. package/console-dist/assets/fleet-nhb_0n25.js +0 -1
  35. package/console-dist/assets/models-DiO_AS9_.js +0 -1
  36. package/console-dist/assets/platforms-npS30Kgk.js +0 -1
  37. package/console-dist/assets/tags-nwfbo5cT.js +0 -1
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{a as t,c as n,i as r,n as i,o as a,r as o,t as s}from"./vendor-charts-95ykyDlI.js";import{at as c}from"./vendor-ui-CWUk2ulb.js";import{S as l,b as u,o as d}from"./api-DimikzPd.js";import{i as f,n as p,t as m}from"./query-fetch-error-Bcg_UjHM.js";import{t as h}from"./proxy-Be4WzmcS.js";import{i as ee,r as te}from"./dist-xY0pK9Wy.js";import{c as ne,l as re}from"./chunk-OE4NN4TA-DBWZidbW.js";import{a as g,i as _,n as v,r as y,s as b,t as x}from"./copy-button-BvU3RDZa.js";import{S,_ as C,a as ie,b as w,c as T,f as E,g as D,i as ae,n as O,p as k,r as A,s as j,u as oe,x as M}from"./format-CshN6yEB.js";import{n as N,t as P}from"./utils-XFKvwlFT.js";import{t as se}from"./activity-Cy_niK56.js";import{a as ce,c as le,i as ue,n as de,o as F,r as fe,s as pe,t as me}from"./tabs-4SeH2unv.js";import{c as he,l as ge,o as _e,s as I}from"./validation-DLydiTzj.js";import{a as ve,c as L,o as R,t as ye}from"./use-engine-command-mutation-C8S_hX0O.js";import{t as z}from"./triangle-alert-BXrJNk3g.js";import{i as B,n as V,t as H}from"./tooltip-D1ydB4g3.js";import{r as U}from"./engine-store-DMULdR_V.js";import{t as be}from"./badge-eIn_7YrK.js";import{t as xe}from"./transition-types-2i1blGlR.js";import{n as Se}from"./auth-screen-backdrop-Cr8qBSXP.js";import{t as Ce}from"./get-error-message-Dk8elqEP.js";var we=N(`layers-2`,[[`path`,{d:`M13 13.74a2 2 0 0 1-2 0L2.5 8.87a1 1 0 0 1 0-1.74L11 2.26a2 2 0 0 1 2 0l8.5 4.87a1 1 0 0 1 0 1.74z`,key:`15q6uc`}],[`path`,{d:`m20 14.285 1.5.845a1 1 0 0 1 0 1.74L13 21.74a2 2 0 0 1-2 0l-8.5-4.87a1 1 0 0 1 0-1.74l1.5-.845`,key:`byia6g`}]]),Te=N(`signal`,[[`path`,{d:`M2 20h.01`,key:`4haj6o`}],[`path`,{d:`M7 20v-4`,key:`j294jx`}],[`path`,{d:`M12 20v-8`,key:`i3yub9`}],[`path`,{d:`M17 20V8`,key:`1tkaf5`}],[`path`,{d:`M22 4v16`,key:`sih9yq`}]]),Ee=N(`timer`,[[`line`,{x1:`10`,x2:`14`,y1:`2`,y2:`2`,key:`14vaq8`}],[`line`,{x1:`12`,x2:`15`,y1:`14`,y2:`11`,key:`17fdiu`}],[`circle`,{cx:`12`,cy:`14`,r:`8`,key:`1e1u0o`}]]),W=e(n(),1),G=c(),K=`bg-transparent bg-transparent`,q=`blueprint-title text-foreground`;function De(e,t){return t.includes(`rpm`)||t.includes(`speed`)?`e.g. 2500`:t.includes(`temp`)?`e.g. 70.0`:t.includes(`pressure`)?`e.g. 4.5`:e===`Boolean`?`true / false`:e===`String`?`value`:`e.g. 100`}function Oe({detail:e,methodArgs:t,setMethodArgs:n,onInvoke:r,isPending:i=!1,pendingMethod:a=null}){let o=Object.entries(e.methods);if(o.length===0)return null;let s=o.filter(([,e])=>e.inputArguments.length===0),c=o.filter(([,e])=>e.inputArguments.length>0);return(0,G.jsxs)(`div`,{id:`commands`,className:`flex min-w-0 flex-col gap-3 p-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,G.jsx)(`h2`,{className:q,children:`Commands`}),(0,G.jsx)(`p`,{className:`text-[10px] text-muted-foreground/75`,children:`Executable methods on this asset`})]}),s.length>0&&(0,G.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:s.map(([e,t])=>{let n=a===e&&i,o=n?F:L;return t.description?(0,G.jsxs)(H,{children:[(0,G.jsx)(B,{render:(0,G.jsxs)(S,{size:`sm`,variant:`outline`,disabled:i,title:e,className:P(`h-8 gap-1.5 font-mono text-xs`,K),onClick:()=>r(e),children:[(0,G.jsx)(o,{className:P(`size-3`,n&&`animate-spin`),"aria-hidden":!0}),j(e)]})}),(0,G.jsx)(V,{side:`bottom`,className:`max-w-xs`,children:t.description})]},e):(0,G.jsxs)(S,{size:`sm`,variant:`outline`,disabled:i,title:e,className:P(`h-8 gap-1.5 font-mono text-xs`,K),onClick:()=>r(e),children:[(0,G.jsx)(o,{className:P(`size-3`,n&&`animate-spin`),"aria-hidden":!0}),j(e)]},e)})}),c.length>0&&s.length>0&&(0,G.jsx)(I,{className:`bg-border/60`}),c.map(([e,o])=>{let s=a===e&&i;return(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`p`,{title:e,className:`font-mono text-sm font-medium`,children:j(e)}),o.description&&(0,G.jsx)(`p`,{className:`mt-0.5 text-[10px] text-muted-foreground`,children:o.description})]}),(0,G.jsxs)(S,{size:`sm`,variant:`default`,disabled:i,className:`shrink-0`,onClick:()=>r(e),children:[s?(0,G.jsx)(F,{className:`mr-1 size-3 animate-spin`,"aria-hidden":!0}):(0,G.jsx)(L,{className:`mr-1 size-3`,"aria-hidden":!0}),`Execute`]})]}),(0,G.jsx)(`div`,{className:`mt-3 flex flex-col gap-1.5 border-t border-border/50 pt-3`,children:o.inputArguments.map(r=>(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(`span`,{title:r.name,className:`w-28 shrink-0 truncate pt-1.5 font-mono text-[10px] leading-tight text-muted-foreground`,children:j(r.name)}),(0,G.jsx)(M,{className:`h-7 flex-1 font-mono text-xs`,placeholder:De(r.dataType,r.name),value:t[e]?.[r.name]??``,onChange:t=>n(n=>({...n,[e]:{...n[e],[r.name]:t.target.value}}))})]},r.name))})]},e)})]})}function ke({activeFaults:e,availableFaults:t,onTriggerFault:n,onClearFault:r}){let i=e.length>0,[a,o]=(0,W.useState)(null);return(0,G.jsxs)(`div`,{id:`faults`,className:`flex min-w-0 flex-col gap-3 p-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,G.jsx)(`h2`,{className:q,children:`Alarms`}),(0,G.jsx)(`p`,{className:`text-[10px] text-muted-foreground/75`,children:`Active faults and injectable failure modes (environment)`})]}),i?(0,G.jsx)(`div`,{className:`flex flex-col gap-2`,children:e.map(e=>(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-[var(--miravo-radius-tight)] border border-destructive/30 bg-transparent py-2.5 pl-3 pr-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(z,{className:`size-4 shrink-0 text-destructive`}),(0,G.jsx)(`span`,{title:e,className:`font-mono text-sm font-medium text-destructive`,children:j(e)})]}),(0,G.jsxs)(S,{size:`sm`,variant:`outline`,className:P(`h-8 shrink-0 gap-1 border-destructive/30 px-2.5 font-mono text-[0.75rem] text-destructive shadow-none`,`hover:border-destructive/45 hover:bg-destructive/5 hover:text-destructive`,`focus-visible:border-destructive/40 focus-visible:ring-destructive/20`,K),onClick:()=>r(e),children:[(0,G.jsx)(pe,{className:`size-3.5`,"aria-hidden":!0}),`Clear`]})]},e))}):(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,G.jsx)(le,{className:`size-4 text-success`}),`All clear — no active faults`]}),t.length>0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(I,{className:`bg-border/60`}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`p`,{className:P(q,`mb-2`),children:[`Inject fault`,(0,G.jsxs)(be,{variant:`secondary`,className:`ml-2 text-[10px]`,children:[t.filter(t=>!e.includes(t)).length,` available`]})]}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.filter(t=>!e.includes(t)).map(e=>(0,G.jsx)(S,{size:`sm`,variant:`outline`,title:e,className:P(`h-7 font-mono text-[10px]`,K),onClick:()=>o(e),children:j(e)},e))})]})]}),(0,G.jsx)(v,{open:a!==null,onOpenChange:e=>{e||o(null)},children:(0,G.jsxs)(y,{children:[(0,G.jsx)(b,{className:`font-heading text-lg font-semibold tracking-tight`,children:`Inject fault?`}),(0,G.jsxs)(_,{className:`text-sm text-muted-foreground`,children:[`This asserts`,` `,(0,G.jsx)(`span`,{title:a??void 0,className:`font-mono text-foreground`,children:a?j(a):``}),` `,`on the running environment. Downstream consumers will see the fault immediately. Clear it from the active list when you're done.`]}),(0,G.jsxs)(g,{children:[(0,G.jsx)(S,{variant:`outline`,onClick:()=>o(null),children:`Cancel`}),(0,G.jsxs)(S,{variant:`destructive`,onClick:()=>{a&&n(a),o(null)},children:[(0,G.jsx)(z,{className:`mr-1 size-3.5`,"aria-hidden":!0}),`Inject fault`]})]})]})})]})}function Ae({detail:e,tick:t,activeFaults:n,memberValues:r,onBack:i}){let a=n.length,o=e.isQuarantined,s=`OK`,c=`ok`;a>0?(s=`FAULT`,c=`bad`):o&&(s=`QRTN`,c=`warn`);let l=0;if(r)for(let e of r.values())e.quality!==`good`&&l++;let u=Object.keys(e.members).length,d=r?.get(`availability_state`)?.value,f=e.members.availability_state?.value,p=typeof d==`string`?d:typeof f==`string`?f:`unknown`,m=p===`running`?{dot:`bg-success`,pulse:`bg-success/60`,animate:!0}:p===`faulted`?{dot:`bg-destructive`,pulse:`bg-destructive/60`,animate:!0}:p===`stopped`?{dot:`bg-warning`,pulse:`bg-warning/60`,animate:!0}:{dot:`bg-muted-foreground/60`,pulse:`bg-muted-foreground/50`,animate:!1},h=p===`running`?`Availability state is running — the asset is available and in service.`:p===`faulted`?`Availability state is faulted — the asset is unavailable because a fault is active.`:p===`stopped`?`Availability state is stopped — the asset is available but not running.`:`Availability state is not available for this asset yet.`;return(0,G.jsxs)(`header`,{className:P(R,`flex w-full min-w-0 flex-col`),children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-3 px-5 py-4 sm:flex-row sm:items-start sm:justify-between sm:gap-4`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1 text-[10px] font-medium uppercase tracking-wider text-muted-foreground`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:i,className:`transition-colors hover:text-foreground`,children:`Fleet`}),(0,G.jsx)(`span`,{"aria-hidden":!0,children:`/`}),(0,G.jsx)(`span`,{className:`truncate`,children:oe(e.assetType)})]}),(0,G.jsx)(W.ViewTransition,{name:`instance-${e.id}`,default:`none`,children:(0,G.jsx)(`h1`,{className:`font-heading mt-1 text-2xl font-semibold uppercase leading-tight tracking-wide`,children:T(e.id)})}),(0,G.jsxs)(`div`,{className:`mt-1.5 flex min-w-0 items-center gap-1.5`,children:[(0,G.jsx)(`p`,{className:`m-0 min-w-0 flex-1 font-mono text-[10px] leading-tight tracking-tight text-muted-foreground`,children:(0,G.jsx)(`span`,{className:`break-all`,children:e.browsePath.join(` / `)})}),(0,G.jsx)(`span`,{className:`inline-flex shrink-0`,children:(0,G.jsx)(x,{value:ie(e.browsePath),label:`Copy Topic / UNS path`})})]})]}),(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 self-end font-mono text-xs sm:self-start`,children:[(0,G.jsx)(ce,{className:`size-3.5 animate-pulse text-primary`,"aria-hidden":!0}),(0,G.jsx)(`span`,{className:`font-medium text-primary`,children:`LIVE`}),(0,G.jsxs)(`span`,{className:`tabular-nums text-muted-foreground`,children:[`t=`,t]}),(0,G.jsxs)(H,{children:[(0,G.jsx)(B,{render:(0,G.jsx)(`span`,{className:`inline-flex size-3.5 items-center justify-center outline-none focus-visible:ring-2 focus-visible:ring-ring`}),children:(0,G.jsxs)(`span`,{"aria-hidden":!0,className:`relative flex size-1.5 shrink-0 items-center justify-center`,children:[(0,G.jsx)(`span`,{className:P(`relative inline-flex size-1.5 rounded-full`,m.dot)}),m.animate&&(0,G.jsx)(`span`,{className:P(`absolute inline-flex size-2.5 animate-ping rounded-full opacity-75`,m.pulse)})]})}),(0,G.jsx)(V,{side:`top`,align:`end`,children:(0,G.jsxs)(`span`,{className:`block max-w-[16rem] text-[11px] leading-snug`,children:[(0,G.jsx)(`span`,{className:`font-medium uppercase tracking-[0.08em]`,children:`Availability`}),` `,(0,G.jsxs)(`span`,{className:`text-muted-foreground`,children:[`— `,h]})]})})]})]})]}),(0,G.jsxs)(`fieldset`,{"aria-label":`Instance status`,className:`m-0 flex flex-col border-0 border-t border-border/50 p-0`,children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-px bg-transparent`,children:[(0,G.jsx)(J,{variant:`primary`,icon:se,label:`Health`,value:s,tone:c,tooltip:`Rolls up active faults and quarantine into a single status — OK when nothing is asserted, FAULT when any fault is active, QRTN when the asset is excluded from the running fleet.`}),(0,G.jsx)(J,{variant:`primary`,icon:z,label:`Active faults`,labelCompact:`Faults`,value:String(a),tone:a>0?`bad`:`neutral`,tooltip:`Fault codes currently asserted on this asset. Clear or inject faults from the Alarms section below.`})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-px border-t border-border/50 bg-transparent sm:grid-cols-4`,children:[(0,G.jsx)(J,{variant:`compact`,icon:we,label:`Lifecycle`,labelCompact:`Life`,value:j(e.lifecycleStage),tone:w(e.lifecycleStage),tooltip:`Where this asset sits in its operational lifecycle (e.g. commissioning, operating, maintenance, retired).`}),(0,G.jsx)(J,{variant:`compact`,icon:ge,label:`Tags`,value:String(u),tone:`neutral`,tooltip:`Total members exposed by this asset — process variables, state flags, counters, commands, and reference fields combined.`}),(0,G.jsx)(J,{variant:`compact`,icon:Te,label:`Bad quality`,value:String(l),tone:l>0?`warn`:`neutral`,tooltip:`Members whose quality stamp is anything other than good (uncertain or bad). A healthy asset reads 0.`}),(0,G.jsx)(J,{variant:`compact`,icon:Ee,label:`Operating age`,value:k(e.operatingHours),tone:`neutral`,tooltip:`Total operating age on this asset, including any environment-seeded starting hours plus simulated runtime elapsed in this session.`})]})]})]})}function J({icon:e,label:t,labelCompact:n,value:r,suffix:i,tone:a,variant:o=`compact`,tooltip:s}){let c=o===`primary`;return(0,G.jsxs)(`div`,{className:P(`relative flex min-w-0 flex-col justify-center`,c?`min-h-20 gap-1.5 px-4 py-4 sm:min-h-24 sm:px-6 sm:py-5 lg:min-h-28 lg:px-8`:`min-h-12 gap-1 px-3 py-2.5 sm:min-h-13 sm:px-4 lg:min-h-14 lg:px-5`),children:[(0,G.jsx)(`div`,{className:`flex min-h-0 min-w-0 items-center gap-2`,children:(0,G.jsxs)(H,{children:[(0,G.jsxs)(B,{className:`flex min-h-0 min-w-0 flex-1 cursor-default items-center gap-2 text-left`,render:(0,G.jsx)(`div`,{}),children:[(0,G.jsx)(e,{className:P(`shrink-0 text-muted-foreground`,c?`size-4`:`size-3.5`),"aria-hidden":!0}),(0,G.jsxs)(`span`,{className:P(`min-w-0 flex-1 font-medium tracking-wide text-muted-foreground uppercase 2xl:tracking-wider`,c?`text-[11px] leading-snug sm:text-[12px]`:`text-[9px] leading-snug sm:text-[10px]`),children:[(0,G.jsx)(`span`,{className:`block wrap-break-word 2xl:hidden`,children:n??t}),(0,G.jsx)(`span`,{className:`hidden wrap-break-word 2xl:block`,children:t})]})]}),(0,G.jsx)(V,{side:`top`,align:`start`,sideOffset:6,className:`max-w-xs`,children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(`span`,{className:`font-medium text-foreground`,children:t}),(0,G.jsx)(`span`,{className:`text-muted-foreground`,children:s??t})]})})]})}),(0,G.jsxs)(`p`,{className:P(`min-w-0 wrap-break-word font-mono font-semibold leading-tight tracking-tight tabular-nums`,c?`text-2xl sm:text-3xl lg:text-4xl`:`text-base lg:text-lg`,a===`ok`&&`text-success`,a===`warn`&&`text-warning`,a===`bad`&&`text-destructive`,a===`neutral`&&`text-foreground`),children:[r,i?(0,G.jsx)(`span`,{className:P(`ml-0.5 font-medium text-muted-foreground`,c?`text-base lg:text-lg`:`text-xs lg:text-sm`),children:i}):null]})]})}function Y({title:e,subtitle:t,children:n,className:r,id:i}){return(0,G.jsxs)(`section`,{id:i,className:P(ve,r),children:[(0,G.jsxs)(`div`,{className:`border-b border-border/60 px-4 py-3`,children:[(0,G.jsx)(`h2`,{className:`blueprint-title text-foreground`,children:e}),t?(0,G.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:t}):null]}),(0,G.jsx)(`div`,{className:`overflow-hidden p-0`,children:n})]})}var je=new Set([`pu`,`h`]),Me=[`_reference`,`_baseline`,`_setpoint`,`_command`],X=`var(--color-primary)`,Ne=`var(--color-background)`,Pe=60,Fe=1e-4;function Z(e,t,n){let r=e?.get(t);return{value:r?.value??n.value,quality:r?.quality??n.quality}}function Ie(e){return Object.entries(e.members).filter(([e,t])=>t.meta.kind===`variable`&&t.meta.access===`read`&&t.meta.dataType===`Double`&&t.meta.euRange!==null&&!je.has(t.meta.unit??``)&&!Me.some(t=>e.endsWith(t)))}function Le(e,t){if(e.length<2)return!1;let n=t-Pe,r;for(let t of e)if(!(t.tick<n)){if(r===void 0){r=t.value;continue}if(Math.abs(t.value-r)>Fe)return!0}return!1}function Re({data:e,chartHeight:n=34,live:c=!1}){let l=(0,W.useId)(),[u,d]=(0,W.useState)(null),f=1/0,p=-1/0;for(let t of e)t.value<f&&(f=t.value),t.value>p&&(p=t.value);let m=e[e.length-1];return(0,G.jsxs)(`div`,{className:`flex min-h-0 w-full flex-col overflow-hidden`,style:{height:n+14},children:[(0,G.jsx)(`div`,{style:{height:n,width:`100%`},children:(0,G.jsx)(t,{width:`100%`,height:n,children:(0,G.jsxs)(s,{data:e,margin:{top:3,right:4,bottom:2,left:0},onMouseMove:e=>{let t=e?.activePayload?.[0]?.value;typeof t==`number`&&d(t)},onMouseLeave:()=>d(null),children:[(0,G.jsx)(`defs`,{children:(0,G.jsxs)(`linearGradient`,{id:l,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,G.jsx)(`stop`,{offset:`0%`,stopColor:X,stopOpacity:.32}),(0,G.jsx)(`stop`,{offset:`100%`,stopColor:X,stopOpacity:0})]})}),(0,G.jsx)(i,{domain:[`auto`,`auto`],hide:!0}),(0,G.jsx)(a,{content:()=>null,cursor:!1}),(0,G.jsx)(o,{type:`monotone`,dataKey:`value`,stroke:X,strokeWidth:1.5,strokeLinecap:`round`,strokeLinejoin:`round`,fill:`url(#${l})`,isAnimationActive:!1,dot:!1,activeDot:{r:3,fill:X,stroke:Ne,strokeWidth:1}}),m?(0,G.jsx)(r,{x:m.tick,y:m.value,r:2.25,fill:X,stroke:Ne,strokeWidth:1.25,isFront:!0,ifOverflow:`extendDomain`}):null]})})}),(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[10px] leading-none tabular-nums text-muted-foreground`,children:[c?(0,G.jsxs)(`span`,{"aria-hidden":!0,className:`relative inline-flex size-1.5 shrink-0 items-center justify-center`,children:[(0,G.jsx)(`span`,{className:`absolute inline-flex size-2 animate-ping rounded-full bg-primary/50`}),(0,G.jsx)(`span`,{className:`relative inline-flex size-1.5 rounded-full bg-primary`})]}):null,u===null?(0,G.jsxs)(`span`,{children:[E(f),`–`,E(p)]}):(0,G.jsx)(`span`,{className:`font-medium text-primary`,children:E(u)})]})]})}function ze({detail:e,processVariables:t,memberValues:n,historyRef:r,tick:i,showQuality:a}){let{liveMap:o,orderedVariables:s}=(0,W.useMemo)(()=>{let e=new Map,n=[],a=[];for(let o of t){let t=Le(r.current.get(o[0])??[],i);e.set(o[0],t),(t?n:a).push(o)}return{liveMap:e,orderedVariables:[...n,...a]}},[t,n,i,r]);return t.length===0?(0,G.jsx)(Y,{title:`Process`,subtitle:`No continuous analog readings defined for this asset`,className:`opacity-90`,children:(0,G.jsx)(`p`,{className:`px-4 py-6 text-center text-sm text-muted-foreground`,children:`This asset exposes no continuous process variables. Discrete states, flags, and commands are available in the Tags section below.`})}):(0,G.jsx)(Y,{title:`Process`,subtitle:`Live tag readings — trend is ~2 min at 1 Hz`,children:(0,G.jsx)(`ul`,{className:`divide-y divide-border/40`,children:s.map(([t,i])=>{let{value:s,quality:c}=Z(n,t,i),l=r.current.get(t)??[],u=ae(e.browsePath,t),d=o.get(t)??!1,f=l.length>=2,p=C(i.meta.unit),m=D(t);return(0,G.jsxs)(h.li,{layout:`position`,transition:{duration:.36,ease:[.22,1,.36,1]},className:`flex flex-col gap-2.5 bg-background px-4 py-3 sm:flex-row sm:items-center sm:gap-5 sm:py-3.5`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1 sm:w-44 sm:shrink-0`,children:[(0,G.jsxs)(H,{children:[(0,G.jsx)(B,{className:`min-w-0 flex-1 cursor-default truncate text-left text-[11px] font-medium uppercase tracking-[var(--miravo-tracking-eyebrow)] text-muted-foreground`,render:(0,G.jsx)(`span`,{}),children:m}),(0,G.jsx)(V,{side:`top`,align:`start`,className:`max-w-xs`,children:m})]}),(0,G.jsx)(x,{value:u,label:`Copy Topic / UNS path`})]}),(0,G.jsxs)(`div`,{className:`relative h-[56px] min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{"aria-hidden":!0,className:`absolute inset-x-0 top-1/2 h-px -translate-y-1/2 bg-border/30`}),f?(0,G.jsx)(Re,{data:l,chartHeight:42,live:d}):(0,G.jsx)(`p`,{className:`flex h-full items-center text-[10px] uppercase tracking-widest text-muted-foreground`,children:`Collecting trend…`})]}),(0,G.jsxs)(`div`,{className:`flex items-baseline gap-2 sm:min-w-36 sm:shrink-0 sm:justify-end`,children:[(0,G.jsx)(`span`,{className:`blueprint-stat text-2xl font-semibold leading-none tabular-nums text-foreground`,children:typeof s==`number`?E(s):String(s)}),p&&(0,G.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:p}),a&&c!==`good`&&(0,G.jsx)(be,{variant:c===`uncertain`?`secondary`:`destructive`,className:`shrink-0 text-[10px]`,children:c})]})]},t)})})})}function Be({name:e,value:t,dataType:n,unit:r,access:i}){let a=D(e),o=i===`readwrite`;if(n===`Boolean`||typeof t==`boolean`||r===`pu`&&(t===0||t===1)){let n=t===!0||t===`true`||t===1,r=e.includes(`fault`);return(0,G.jsxs)(`div`,{className:`flex min-h-9 min-w-0 items-center justify-between gap-2 rounded-[var(--miravo-radius-tight)] border px-2 py-1 ${r&&n?`border-destructive/30 bg-transparent`:``}`,children:[(0,G.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-left text-[10px] leading-snug text-muted-foreground`,children:[a,o&&(0,G.jsx)(`span`,{className:`ml-1 text-[8px] text-primary`,children:`CMD`})]}),(0,G.jsx)(`span`,{className:`shrink-0 font-mono text-xs font-medium tabular-nums ${r&&n?`text-destructive`:n?`text-success`:`text-muted-foreground`}`,children:n?`ON`:`OFF`})]})}if(n===`String`){let n=String(t),r=n===`none`||n===``,i=O.has(n)||e.includes(`fault_code`)&&!r,o=!i&&A.has(n);return(0,G.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-col justify-center gap-1 rounded-[var(--miravo-radius-tight)] border px-2 py-2 ${i?`border-destructive/30 bg-transparent`:o?`border-warning/30 bg-warning/5`:``}`,children:[(0,G.jsx)(`span`,{className:`wrap-break-word text-[10px] leading-tight text-muted-foreground`,children:a}),r?(0,G.jsx)(`span`,{className:`wrap-break-word font-mono text-sm font-medium leading-snug text-muted-foreground`,children:`—`}):(0,G.jsx)(`span`,{title:n,className:`wrap-break-word font-mono text-sm font-medium leading-snug ${i?`text-destructive`:o?`text-warning`:`text-foreground`}`,children:j(n)})]})}return(0,G.jsxs)(`div`,{className:`flex min-h-9 min-w-0 items-center justify-between gap-2 rounded-[var(--miravo-radius-tight)] border px-2 py-1`,children:[(0,G.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-left text-[10px] leading-snug text-muted-foreground`,children:[a,o&&(0,G.jsx)(`span`,{className:`ml-1 text-[8px] text-primary`,children:`CMD`})]}),(0,G.jsxs)(`span`,{className:`shrink-0 text-right font-mono text-xs font-medium tabular-nums`,children:[typeof t==`number`?E(t):String(t),r&&(0,G.jsx)(`span`,{className:`ml-1 text-[10px] text-muted-foreground`,children:C(r)})]})]})}function Ve(e){return[...e].sort((e,t)=>{let n=e[1].meta.access===`readwrite`;return n===(t[1].meta.access===`readwrite`)?e[0].localeCompare(t[0]):n?-1:1})}function He({stringEnumMembers:e,nonStringOperationalMembers:t,memberValues:n,className:r}){let i=(0,W.useMemo)(()=>Ve(e),[e]),a=(0,W.useMemo)(()=>Ve(t),[t]),o=`grid min-w-0 gap-2 [grid-template-columns:repeat(auto-fill,minmax(min(100%,12.5rem),1fr))]`;return(0,G.jsx)(Y,{title:`Tags`,subtitle:`Mode, status flags, and control tags`,className:r,children:(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-5 p-4`,children:[i.length>0&&(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[a.length>0&&(0,G.jsx)(`h3`,{className:`blueprint-title text-muted-foreground`,children:`States`}),(0,G.jsx)(`div`,{className:o,children:i.map(([e,t])=>{let{value:r}=Z(n,e,t);return(0,G.jsx)(Be,{name:e,value:r,dataType:t.meta.dataType,unit:t.meta.unit,access:t.meta.access},e)})})]}),a.length>0&&(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[i.length>0&&(0,G.jsx)(`h3`,{className:`blueprint-title text-muted-foreground`,children:`Flags & commands`}),(0,G.jsx)(`div`,{className:o,children:a.map(([e,t])=>{let{value:r}=Z(n,e,t);return(0,G.jsx)(Be,{name:e,value:r,dataType:t.meta.dataType,unit:t.meta.unit,access:t.meta.access},e)})})]})]})})}function Q({className:e,counters:t,memberValues:n}){return(0,G.jsx)(Y,{title:`Counters`,subtitle:`Totals, hours, and accumulators`,className:e,children:(0,G.jsx)(`div`,{className:`flex flex-col gap-2 p-4`,children:t.map(([e,t])=>{let{value:r}=Z(n,e,t);return(0,G.jsxs)(`div`,{className:`flex items-center justify-between rounded-[var(--miravo-radius-tight)] border border-border/60 bg-transparent px-3 py-2`,children:[(0,G.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:D(e)}),(0,G.jsxs)(`span`,{className:`blueprint-stat text-sm font-medium`,children:[typeof r==`number`?E(r):String(r),t.meta.unit&&(0,G.jsx)(`span`,{className:`ml-1 text-[10px] text-muted-foreground`,children:C(t.meta.unit)})]})]},e)})})})}function $({className:e,detail:t,referenceMembers:n,memberValues:r}){let i=Object.keys(t.parameters).length>0,a=n.length>0;return!i&&!a?null:(0,G.jsx)(Y,{title:`Nameplate & configuration`,subtitle:`Design parameters, identity, and reference values`,className:e,children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-4 p-4`,children:[i&&(0,G.jsx)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-3`,children:Object.entries(t.parameters).map(([e,t])=>(0,G.jsxs)(`div`,{className:`flex flex-col gap-0.5 py-1.5`,children:[(0,G.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:D(e)}),(0,G.jsxs)(`span`,{className:`font-mono text-sm font-medium`,children:[typeof t.value==`number`?E(t.value):String(t.value),t.unit&&(0,G.jsx)(`span`,{className:`ml-1 text-[10px] text-muted-foreground`,children:C(t.unit)})]})]},e))}),a&&(0,G.jsx)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-3`,children:n.map(([e,t])=>{let{value:n}=Z(r,e,t);return(0,G.jsxs)(`div`,{className:`flex flex-col gap-0.5 rounded-[var(--miravo-radius-tight)] border border-border/60 bg-transparent p-2`,children:[(0,G.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:D(e)}),(0,G.jsxs)(`span`,{className:`font-mono text-sm font-medium`,children:[typeof n==`number`?E(n):String(n),t.meta.unit&&(0,G.jsx)(`span`,{className:`ml-1 text-[10px] text-muted-foreground`,children:C(t.meta.unit)})]})]},e)})})]})})}var Ue=120,We=`gap-4 sm:gap-5 lg:gap-x-6 lg:gap-y-5 xl:gap-x-8`,Ge=`instance-detail-page relative isolate mx-auto flex min-h-full w-full max-w-screen-2xl flex-col gap-6 p-4 sm:gap-8 sm:p-6`;function Ke(e){return e instanceof Error&&`code`in e&&e.code===`NOT_FOUND`?!0:e instanceof Error&&/^404\b/.test(e.message.trim())}function qe(){let{id:e}=re(),t=ne(),n=(0,W.useCallback)(()=>{(0,W.startTransition)(()=>{(0,W.addTransitionType)(xe),t(`/`)})},[t]),[r,i]=(0,W.useState)({}),[a,o]=(0,W.useState)(null),[s,c]=(0,W.useState)(!1),[g,_]=ee(`tab`,te([`hmi`,`operate`,`data`,`operations`]).withDefault(`hmi`)),v=g===`data`||g===`operations`?`operate`:g,y=ye();(0,W.useEffect)(()=>{y.isPending||o(null)},[y.isPending]),(0,W.useEffect)(()=>{(g===`data`||g===`operations`)&&_(`operate`)},[g,_]);let b=(0,W.useCallback)(e=>{_(`operate`),requestAnimationFrame(()=>{requestAnimationFrame(()=>{document.getElementById(e)?.scrollIntoView({behavior:`smooth`,block:`start`})})})},[_]);(0,W.useEffect)(()=>{let e=null,t=!1,r=()=>{t=!1,e&&=(clearTimeout(e),null)},i=i=>{if(i.metaKey||i.ctrlKey||i.altKey)return;let a=i.target;if(a){let e=a.tagName;if(e===`INPUT`||e===`TEXTAREA`||e===`SELECT`||a.isContentEditable)return}if(t){i.key===`f`?(b(`faults`),i.preventDefault()):i.key===`c`&&(b(`commands`),i.preventDefault()),r();return}if(i.key===`g`){t=!0,e=setTimeout(r,1200);return}i.key===`b`&&!i.shiftKey?(n(),i.preventDefault()):i.key===`?`&&(c(!0),i.preventDefault())};return window.addEventListener(`keydown`,i),()=>{window.removeEventListener(`keydown`,i),r()}},[n,b]);let x=f({queryKey:u.instances.detail(e??``),queryFn:()=>d(`/instances/${e}`,l.instanceDetail),enabled:e!==void 0}),C=(0,W.useDeferredValue)(x.data??null),ie=x.isError,w=U(t=>e?t.memberValues.get(e):void 0),T=U(e=>e.models),E=U(e=>e.instances),D=(0,W.useMemo)(()=>E.find(t=>t.id===e),[E,e]),ae=D?.activeFaults,O=(0,W.useRef)(new Map),k=U(e=>e.tick);(0,W.useEffect)(()=>{if(!w||!e)return;let t=O.current;for(let[e,n]of w){if(typeof n.value!=`number`)continue;let r=t.get(e)??[];if(r[r.length-1]?.tick===k)continue;let i=r.length>=Ue?r.slice(r.length-Ue+1):r;t.set(e,[...i,{value:n.value,tick:k}])}},[w,k,e]);let A=(0,W.useMemo)(()=>C?Ie(C):[],[C]),j=(0,W.useMemo)(()=>{if(!C)return{operational:[],counters:[],reference:[]};let e=new Set(A.map(([e])=>e)),t=Object.entries(C.members).filter(([t])=>!e.has(t)),n=[],r=[],i=[];for(let e of t){let[,t]=e,a=t.meta.dataType,o=t.meta.kind,s=t.meta.unit,c=s===`pu`&&t.meta.euRange?.[0]===0&&t.meta.euRange?.[1]===1;o===`property`?i.push(e):a===`Boolean`||a===`String`||c?n.push(e):s===`count`||a===`UInt16`||a===`UInt32`?r.push(e):t.meta.access===`readwrite`||Me.some(t=>e[0].endsWith(t))?n.push(e):s===`pu`||s===`h`?r.push(e):i.push(e)}return{operational:n,counters:r,reference:i}},[C,A]),oe=(0,W.useMemo)(()=>C?T.find(e=>e.name===C.assetType)?.faultNames??[]:[],[C,T]),M=ae??C?.activeFaults??[],N=(0,W.useMemo)(()=>{if(!w)return M.length>0;for(let[,e]of w)if(e.quality!==`good`)return!0;return!1},[w,M.length]),se=(0,W.useMemo)(()=>j.operational.filter(([,e])=>e.meta.dataType===`String`),[j.operational]),ce=(0,W.useMemo)(()=>j.operational.filter(([,e])=>e.meta.dataType!==`String`),[j.operational]),le=t=>{if(!e)return;let n={},i=C?.methods[t];if(i)for(let e of i.inputArguments){let i=r[t]?.[e.name]??``,a=_e(e.name,i,e.dataType);if(!a)return;n[e.name]=a.value}o(t),y.mutateAsync({type:`invokeMethod`,instanceId:e,method:t,arguments:n}).then(async()=>{await x.refetch()}).catch(()=>{})},F=t=>{e&&y.mutateAsync({type:`triggerFault`,instanceId:e,fault:t}).then(async()=>{await x.refetch()}).catch(()=>{})},pe=t=>{e&&y.mutateAsync({type:`clearFault`,instanceId:e,fault:t}).then(async()=>{await x.refetch()}).catch(()=>{})};if(!C)return ie?Ke(x.error)?(0,G.jsx)(Se,{className:`min-h-full`,children:(0,G.jsx)(`div`,{className:`flex min-h-[40vh] items-center justify-center p-6 sm:p-12`,children:(0,G.jsx)(`div`,{className:`w-full max-w-md`,children:(0,G.jsxs)(p,{eyebrow:`Instance lookup`,stamp:`404`,title:`Instance not found`,detail:e??`Unknown instance id`,detailLabel:`Requested instance`,primaryLabel:`Back to Fleet`,onPrimary:n,children:[(0,G.jsx)(`p`,{children:`The requested asset is no longer in the running fleet or the URL is wrong.`}),(0,G.jsx)(`p`,{children:`Return to Fleet and pick a live instance from the current environment.`})]})})})}):(0,G.jsx)(Se,{className:`min-h-full`,children:(0,G.jsxs)(`div`,{className:`flex min-h-[40vh] flex-col items-center justify-center gap-4 p-6 sm:p-12`,children:[(0,G.jsx)(`div`,{className:`w-full max-w-md`,children:(0,G.jsx)(m,{message:Ce(x.error,`Could not load instance.`),onRetry:()=>void x.refetch(),isRetrying:x.isFetching})}),(0,G.jsx)(S,{variant:`outline`,size:`sm`,onClick:n,children:`Back to Fleet`})]})}):D?(0,G.jsx)(`div`,{className:Ge,children:(0,G.jsx)(Ae,{detail:{id:D.id,assetType:D.model,browsePath:D.browsePath,lifecycleStage:D.lifecycleStage,operatingHours:D.operatingHours,activeFaults:D.activeFaults,isQuarantined:D.isQuarantined,parameters:{},members:{},methods:{}},tick:k,activeFaults:M,memberValues:w,onBack:n})}):null;let I=j.operational.length>0,L=j.counters.length>0,R=j.reference.length>0||Object.keys(C.parameters).length>0,z=I||L||R,B=Object.keys(C.methods).length>0,V=I&&!L&&!R,H=I&&L&&R;return(0,G.jsxs)(`div`,{className:Ge,children:[(0,G.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-0 -z-10 hidden select-none overflow-hidden md:block`,children:(0,G.jsx)(`span`,{className:`absolute -top-2 left-0 whitespace-nowrap uppercase leading-none opacity-35 blur-[2px]`,style:{fontFamily:`var(--miravo-font-heading)`,fontSize:`clamp(5rem, 14vw, 12rem)`,fontWeight:`var(--miravo-weight-medium)`,letterSpacing:`var(--miravo-tracking-heading)`,color:`var(--miravo-ghost)`},children:C.assetType.replace(/_/g,` `)})}),(0,G.jsx)(Ae,{detail:C,tick:k,activeFaults:M,memberValues:w,onBack:n}),(0,G.jsx)(W.ViewTransition,{enter:`fade-in`,default:`none`,children:(0,G.jsxs)(me,{value:v,onValueChange:e=>{_(e)},className:`min-h-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`shrink-0 overflow-x-auto`,children:(0,G.jsxs)(fe,{variant:`line`,className:`h-10! min-w-max gap-0.5`,children:[(0,G.jsxs)(ue,{value:`hmi`,className:`gap-1.5 px-3 text-sm`,children:[(0,G.jsx)(ge,{className:`size-3.5 shrink-0`}),`HMI`]}),(0,G.jsxs)(ue,{value:`operate`,className:`gap-1.5 px-3 text-sm`,children:[(0,G.jsx)(he,{className:`size-3.5 shrink-0`}),`Operate`]})]})}),(0,G.jsx)(de,{value:`hmi`,className:`flex-1 py-2`,children:(0,G.jsx)(h.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.15,ease:`easeOut`},children:(0,G.jsx)(ze,{detail:C,processVariables:A,memberValues:w,historyRef:O,tick:k,showQuality:N})},`hmi`)}),(0,G.jsx)(de,{value:`operate`,className:`flex-1 py-2`,children:(0,G.jsxs)(h.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.15,ease:`easeOut`},className:`flex min-w-0 flex-col gap-4`,children:[z&&(0,G.jsxs)(`section`,{"aria-label":`Data`,className:P(`grid min-w-0 grid-cols-1`,We,H&&`lg:grid-cols-2 lg:grid-rows-[auto_auto] lg:items-start`,!H&&I&&(L||R)&&`lg:grid-cols-2 lg:items-start`),children:[I&&(0,G.jsx)(He,{stringEnumMembers:se,nonStringOperationalMembers:ce,memberValues:w,className:P(`min-h-0 min-w-0 self-stretch`,V&&`lg:col-span-2`,H&&`lg:row-span-2`)}),!I&&L&&R&&(0,G.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-col gap-6 lg:col-span-2`,children:[(0,G.jsx)(Q,{counters:j.counters,memberValues:w}),(0,G.jsx)($,{detail:C,referenceMembers:j.reference,memberValues:w})]}),!I&&L&&!R&&(0,G.jsx)(Q,{className:`lg:col-span-2`,counters:j.counters,memberValues:w}),!I&&!L&&R&&(0,G.jsx)($,{className:`lg:col-span-2`,detail:C,referenceMembers:j.reference,memberValues:w}),I&&L&&(0,G.jsx)(Q,{className:`min-h-0 min-w-0 self-stretch lg:col-start-2 lg:row-start-1`,counters:j.counters,memberValues:w}),I&&R&&(0,G.jsx)($,{className:P(`min-h-0 min-w-0 self-stretch lg:col-start-2`,H?`lg:row-start-2`:`lg:row-start-1`),detail:C,referenceMembers:j.reference,memberValues:w})]}),(0,G.jsxs)(`section`,{"aria-label":`Operations`,className:P(ve,`grid grid-cols-1`,B&&`lg:grid-cols-2`),children:[(0,G.jsx)(ke,{activeFaults:M,availableFaults:oe,onTriggerFault:F,onClearFault:pe}),B&&(0,G.jsx)(`div`,{className:`border-t border-border/50 lg:border-l lg:border-t-0`,children:(0,G.jsx)(Oe,{detail:C,methodArgs:r,setMethodArgs:i,onInvoke:le,isPending:y.isPending,pendingMethod:a})})]})]},`operate`)})]})}),(0,G.jsx)(Je,{open:s,onOpenChange:c})]})}function Je({open:e,onOpenChange:t}){return(0,G.jsx)(v,{open:e,onOpenChange:t,children:(0,G.jsxs)(y,{children:[(0,G.jsx)(b,{className:`font-heading text-lg font-semibold tracking-tight`,children:`Keyboard shortcuts`}),(0,G.jsx)(_,{className:`text-sm text-muted-foreground`,children:`Navigate this instance without leaving the keyboard.`}),(0,G.jsx)(`ul`,{className:`flex flex-col gap-2 pt-1`,children:[{keys:[`g`,`f`],label:`Jump to Alarms`},{keys:[`g`,`c`],label:`Jump to Commands`},{keys:[`b`],label:`Back to Fleet`},{keys:[`?`],label:`Show this sheet`}].map(e=>(0,G.jsxs)(`li`,{className:`flex items-center justify-between gap-4`,children:[(0,G.jsx)(`span`,{className:`text-sm text-foreground`,children:e.label}),(0,G.jsx)(`span`,{className:`flex items-center gap-1`,children:e.keys.map((t,n)=>(0,G.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(`kbd`,{className:`rounded-[var(--miravo-radius-tight)] border border-border bg-muted/40 px-1.5 py-0.5 font-mono text-[11px] font-medium text-foreground`,children:t}),n<e.keys.length-1&&(0,G.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:`then`})]},`${e.label}-${t}`))})]},e.label))})]})})}export{qe as InstanceDetailPage};
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{a as t,c as n,i as r,n as i,o as a,r as o,t as s}from"./vendor-charts-95ykyDlI.js";import{at as c}from"./vendor-ui-CWUk2ulb.js";import{S as l,b as u,o as d}from"./api-D8oAzcVE.js";import{i as f,n as p,t as m}from"./query-fetch-error-NbPqVPRR.js";import{t as h}from"./proxy-Be4WzmcS.js";import{i as ee,r as te}from"./dist-xY0pK9Wy.js";import{c as ne,l as re}from"./chunk-OE4NN4TA-DBWZidbW.js";import{a as g,i as _,n as v,r as y,s as b,t as x}from"./copy-button-BvU3RDZa.js";import{S,_ as C,a as ie,b as w,c as T,f as E,g as D,i as ae,n as O,p as k,r as A,s as j,u as oe,x as M}from"./format-CshN6yEB.js";import{n as N,t as P}from"./utils-XFKvwlFT.js";import{t as se}from"./activity-Cy_niK56.js";import{a as ce,c as le,i as ue,n as de,o as F,r as fe,s as pe,t as me}from"./tabs-4SeH2unv.js";import{c as he,l as ge,o as _e,s as I}from"./validation-DRj8OKvB.js";import{a as ve,c as L,o as R,t as ye}from"./use-engine-command-mutation-CcfqRB7j.js";import{t as z}from"./triangle-alert-BXrJNk3g.js";import{i as B,n as V,t as H}from"./tooltip-D1ydB4g3.js";import{r as U}from"./engine-store-DMULdR_V.js";import{t as be}from"./badge-eIn_7YrK.js";import{t as xe}from"./transition-types-2i1blGlR.js";import{n as Se}from"./auth-screen-backdrop-Cr8qBSXP.js";import{t as Ce}from"./get-error-message-Dk8elqEP.js";var we=N(`layers-2`,[[`path`,{d:`M13 13.74a2 2 0 0 1-2 0L2.5 8.87a1 1 0 0 1 0-1.74L11 2.26a2 2 0 0 1 2 0l8.5 4.87a1 1 0 0 1 0 1.74z`,key:`15q6uc`}],[`path`,{d:`m20 14.285 1.5.845a1 1 0 0 1 0 1.74L13 21.74a2 2 0 0 1-2 0l-8.5-4.87a1 1 0 0 1 0-1.74l1.5-.845`,key:`byia6g`}]]),Te=N(`signal`,[[`path`,{d:`M2 20h.01`,key:`4haj6o`}],[`path`,{d:`M7 20v-4`,key:`j294jx`}],[`path`,{d:`M12 20v-8`,key:`i3yub9`}],[`path`,{d:`M17 20V8`,key:`1tkaf5`}],[`path`,{d:`M22 4v16`,key:`sih9yq`}]]),Ee=N(`timer`,[[`line`,{x1:`10`,x2:`14`,y1:`2`,y2:`2`,key:`14vaq8`}],[`line`,{x1:`12`,x2:`15`,y1:`14`,y2:`11`,key:`17fdiu`}],[`circle`,{cx:`12`,cy:`14`,r:`8`,key:`1e1u0o`}]]),W=e(n(),1),G=c(),K=`bg-transparent bg-transparent`,q=`blueprint-title text-foreground`;function De(e,t){return t.includes(`rpm`)||t.includes(`speed`)?`e.g. 2500`:t.includes(`temp`)?`e.g. 70.0`:t.includes(`pressure`)?`e.g. 4.5`:e===`Boolean`?`true / false`:e===`String`?`value`:`e.g. 100`}function Oe({detail:e,methodArgs:t,setMethodArgs:n,onInvoke:r,isPending:i=!1,pendingMethod:a=null}){let o=Object.entries(e.methods);if(o.length===0)return null;let s=o.filter(([,e])=>e.inputArguments.length===0),c=o.filter(([,e])=>e.inputArguments.length>0);return(0,G.jsxs)(`div`,{id:`commands`,className:`flex min-w-0 flex-col gap-3 p-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,G.jsx)(`h2`,{className:q,children:`Commands`}),(0,G.jsx)(`p`,{className:`text-[10px] text-muted-foreground/75`,children:`Executable methods on this asset`})]}),s.length>0&&(0,G.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:s.map(([e,t])=>{let n=a===e&&i,o=n?F:L;return t.description?(0,G.jsxs)(H,{children:[(0,G.jsx)(B,{render:(0,G.jsxs)(S,{size:`sm`,variant:`outline`,disabled:i,title:e,className:P(`h-8 gap-1.5 font-mono text-xs`,K),onClick:()=>r(e),children:[(0,G.jsx)(o,{className:P(`size-3`,n&&`animate-spin`),"aria-hidden":!0}),j(e)]})}),(0,G.jsx)(V,{side:`bottom`,className:`max-w-xs`,children:t.description})]},e):(0,G.jsxs)(S,{size:`sm`,variant:`outline`,disabled:i,title:e,className:P(`h-8 gap-1.5 font-mono text-xs`,K),onClick:()=>r(e),children:[(0,G.jsx)(o,{className:P(`size-3`,n&&`animate-spin`),"aria-hidden":!0}),j(e)]},e)})}),c.length>0&&s.length>0&&(0,G.jsx)(I,{className:`bg-border/60`}),c.map(([e,o])=>{let s=a===e&&i;return(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`p`,{title:e,className:`font-mono text-sm font-medium`,children:j(e)}),o.description&&(0,G.jsx)(`p`,{className:`mt-0.5 text-[10px] text-muted-foreground`,children:o.description})]}),(0,G.jsxs)(S,{size:`sm`,variant:`default`,disabled:i,className:`shrink-0`,onClick:()=>r(e),children:[s?(0,G.jsx)(F,{className:`mr-1 size-3 animate-spin`,"aria-hidden":!0}):(0,G.jsx)(L,{className:`mr-1 size-3`,"aria-hidden":!0}),`Execute`]})]}),(0,G.jsx)(`div`,{className:`mt-3 flex flex-col gap-1.5 border-t border-border/50 pt-3`,children:o.inputArguments.map(r=>(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(`span`,{title:r.name,className:`w-28 shrink-0 truncate pt-1.5 font-mono text-[10px] leading-tight text-muted-foreground`,children:j(r.name)}),(0,G.jsx)(M,{className:`h-7 flex-1 font-mono text-xs`,placeholder:De(r.dataType,r.name),value:t[e]?.[r.name]??``,onChange:t=>n(n=>({...n,[e]:{...n[e],[r.name]:t.target.value}}))})]},r.name))})]},e)})]})}function ke({activeFaults:e,availableFaults:t,onTriggerFault:n,onClearFault:r}){let i=e.length>0,[a,o]=(0,W.useState)(null);return(0,G.jsxs)(`div`,{id:`faults`,className:`flex min-w-0 flex-col gap-3 p-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,G.jsx)(`h2`,{className:q,children:`Alarms`}),(0,G.jsx)(`p`,{className:`text-[10px] text-muted-foreground/75`,children:`Active faults and injectable failure modes (environment)`})]}),i?(0,G.jsx)(`div`,{className:`flex flex-col gap-2`,children:e.map(e=>(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-[var(--miravo-radius-tight)] border border-destructive/30 bg-transparent py-2.5 pl-3 pr-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(z,{className:`size-4 shrink-0 text-destructive`}),(0,G.jsx)(`span`,{title:e,className:`font-mono text-sm font-medium text-destructive`,children:j(e)})]}),(0,G.jsxs)(S,{size:`sm`,variant:`outline`,className:P(`h-8 shrink-0 gap-1 border-destructive/30 px-2.5 font-mono text-[0.75rem] text-destructive shadow-none`,`hover:border-destructive/45 hover:bg-destructive/5 hover:text-destructive`,`focus-visible:border-destructive/40 focus-visible:ring-destructive/20`,K),onClick:()=>r(e),children:[(0,G.jsx)(pe,{className:`size-3.5`,"aria-hidden":!0}),`Clear`]})]},e))}):(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,G.jsx)(le,{className:`size-4 text-success`}),`All clear — no active faults`]}),t.length>0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(I,{className:`bg-border/60`}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`p`,{className:P(q,`mb-2`),children:[`Inject fault`,(0,G.jsxs)(be,{variant:`secondary`,className:`ml-2 text-[10px]`,children:[t.filter(t=>!e.includes(t)).length,` available`]})]}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.filter(t=>!e.includes(t)).map(e=>(0,G.jsx)(S,{size:`sm`,variant:`outline`,title:e,className:P(`h-7 font-mono text-[10px]`,K),onClick:()=>o(e),children:j(e)},e))})]})]}),(0,G.jsx)(v,{open:a!==null,onOpenChange:e=>{e||o(null)},children:(0,G.jsxs)(y,{children:[(0,G.jsx)(b,{className:`font-heading text-lg font-semibold tracking-tight`,children:`Inject fault?`}),(0,G.jsxs)(_,{className:`text-sm text-muted-foreground`,children:[`This asserts`,` `,(0,G.jsx)(`span`,{title:a??void 0,className:`font-mono text-foreground`,children:a?j(a):``}),` `,`on the running environment. Downstream consumers will see the fault immediately. Clear it from the active list when you're done.`]}),(0,G.jsxs)(g,{children:[(0,G.jsx)(S,{variant:`outline`,onClick:()=>o(null),children:`Cancel`}),(0,G.jsxs)(S,{variant:`destructive`,onClick:()=>{a&&n(a),o(null)},children:[(0,G.jsx)(z,{className:`mr-1 size-3.5`,"aria-hidden":!0}),`Inject fault`]})]})]})})]})}function Ae({detail:e,tick:t,activeFaults:n,memberValues:r,onBack:i}){let a=n.length,o=e.isQuarantined,s=`OK`,c=`ok`;a>0?(s=`FAULT`,c=`bad`):o&&(s=`QRTN`,c=`warn`);let l=0;if(r)for(let e of r.values())e.quality!==`good`&&l++;let u=Object.keys(e.members).length,d=r?.get(`availability_state`)?.value,f=e.members.availability_state?.value,p=typeof d==`string`?d:typeof f==`string`?f:`unknown`,m=p===`running`?{dot:`bg-success`,pulse:`bg-success/60`,animate:!0}:p===`faulted`?{dot:`bg-destructive`,pulse:`bg-destructive/60`,animate:!0}:p===`stopped`?{dot:`bg-warning`,pulse:`bg-warning/60`,animate:!0}:{dot:`bg-muted-foreground/60`,pulse:`bg-muted-foreground/50`,animate:!1},h=p===`running`?`Availability state is running — the asset is available and in service.`:p===`faulted`?`Availability state is faulted — the asset is unavailable because a fault is active.`:p===`stopped`?`Availability state is stopped — the asset is available but not running.`:`Availability state is not available for this asset yet.`;return(0,G.jsxs)(`header`,{className:P(R,`flex w-full min-w-0 flex-col`),children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-3 px-5 py-4 sm:flex-row sm:items-start sm:justify-between sm:gap-4`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1 text-[10px] font-medium uppercase tracking-wider text-muted-foreground`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:i,className:`transition-colors hover:text-foreground`,children:`Fleet`}),(0,G.jsx)(`span`,{"aria-hidden":!0,children:`/`}),(0,G.jsx)(`span`,{className:`truncate`,children:oe(e.assetType)})]}),(0,G.jsx)(W.ViewTransition,{name:`instance-${e.id}`,default:`none`,children:(0,G.jsx)(`h1`,{className:`font-heading mt-1 text-2xl font-semibold uppercase leading-tight tracking-wide`,children:T(e.id)})}),(0,G.jsxs)(`div`,{className:`mt-1.5 flex min-w-0 items-center gap-1.5`,children:[(0,G.jsx)(`p`,{className:`m-0 min-w-0 flex-1 font-mono text-[10px] leading-tight tracking-tight text-muted-foreground`,children:(0,G.jsx)(`span`,{className:`break-all`,children:e.browsePath.join(` / `)})}),(0,G.jsx)(`span`,{className:`inline-flex shrink-0`,children:(0,G.jsx)(x,{value:ie(e.browsePath),label:`Copy Topic / UNS path`})})]})]}),(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 self-end font-mono text-xs sm:self-start`,children:[(0,G.jsx)(ce,{className:`size-3.5 animate-pulse text-primary`,"aria-hidden":!0}),(0,G.jsx)(`span`,{className:`font-medium text-primary`,children:`LIVE`}),(0,G.jsxs)(`span`,{className:`tabular-nums text-muted-foreground`,children:[`t=`,t]}),(0,G.jsxs)(H,{children:[(0,G.jsx)(B,{render:(0,G.jsx)(`span`,{className:`inline-flex size-3.5 items-center justify-center outline-none focus-visible:ring-2 focus-visible:ring-ring`}),children:(0,G.jsxs)(`span`,{"aria-hidden":!0,className:`relative flex size-1.5 shrink-0 items-center justify-center`,children:[(0,G.jsx)(`span`,{className:P(`relative inline-flex size-1.5 rounded-full`,m.dot)}),m.animate&&(0,G.jsx)(`span`,{className:P(`absolute inline-flex size-2.5 animate-ping rounded-full opacity-75`,m.pulse)})]})}),(0,G.jsx)(V,{side:`top`,align:`end`,children:(0,G.jsxs)(`span`,{className:`block max-w-[16rem] text-[11px] leading-snug`,children:[(0,G.jsx)(`span`,{className:`font-medium uppercase tracking-[0.08em]`,children:`Availability`}),` `,(0,G.jsxs)(`span`,{className:`text-muted-foreground`,children:[`— `,h]})]})})]})]})]}),(0,G.jsxs)(`fieldset`,{"aria-label":`Instance status`,className:`m-0 flex flex-col border-0 border-t border-border/50 p-0`,children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-px bg-transparent`,children:[(0,G.jsx)(J,{variant:`primary`,icon:se,label:`Health`,value:s,tone:c,tooltip:`Rolls up active faults and quarantine into a single status — OK when nothing is asserted, FAULT when any fault is active, QRTN when the asset is excluded from the running fleet.`}),(0,G.jsx)(J,{variant:`primary`,icon:z,label:`Active faults`,labelCompact:`Faults`,value:String(a),tone:a>0?`bad`:`neutral`,tooltip:`Fault codes currently asserted on this asset. Clear or inject faults from the Alarms section below.`})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-px border-t border-border/50 bg-transparent sm:grid-cols-4`,children:[(0,G.jsx)(J,{variant:`compact`,icon:we,label:`Lifecycle`,labelCompact:`Life`,value:j(e.lifecycleStage),tone:w(e.lifecycleStage),tooltip:`Where this asset sits in its operational lifecycle (e.g. commissioning, operating, maintenance, retired).`}),(0,G.jsx)(J,{variant:`compact`,icon:ge,label:`Tags`,value:String(u),tone:`neutral`,tooltip:`Total members exposed by this asset — process variables, state flags, counters, commands, and reference fields combined.`}),(0,G.jsx)(J,{variant:`compact`,icon:Te,label:`Bad quality`,value:String(l),tone:l>0?`warn`:`neutral`,tooltip:`Members whose quality stamp is anything other than good (uncertain or bad). A healthy asset reads 0.`}),(0,G.jsx)(J,{variant:`compact`,icon:Ee,label:`Operating age`,value:k(e.operatingHours),tone:`neutral`,tooltip:`Total operating age on this asset, including any environment-seeded starting hours plus simulated runtime elapsed in this session.`})]})]})]})}function J({icon:e,label:t,labelCompact:n,value:r,suffix:i,tone:a,variant:o=`compact`,tooltip:s}){let c=o===`primary`;return(0,G.jsxs)(`div`,{className:P(`relative flex min-w-0 flex-col justify-center`,c?`min-h-20 gap-1.5 px-4 py-4 sm:min-h-24 sm:px-6 sm:py-5 lg:min-h-28 lg:px-8`:`min-h-12 gap-1 px-3 py-2.5 sm:min-h-13 sm:px-4 lg:min-h-14 lg:px-5`),children:[(0,G.jsx)(`div`,{className:`flex min-h-0 min-w-0 items-center gap-2`,children:(0,G.jsxs)(H,{children:[(0,G.jsxs)(B,{className:`flex min-h-0 min-w-0 flex-1 cursor-default items-center gap-2 text-left`,render:(0,G.jsx)(`div`,{}),children:[(0,G.jsx)(e,{className:P(`shrink-0 text-muted-foreground`,c?`size-4`:`size-3.5`),"aria-hidden":!0}),(0,G.jsxs)(`span`,{className:P(`min-w-0 flex-1 font-medium tracking-wide text-muted-foreground uppercase 2xl:tracking-wider`,c?`text-[11px] leading-snug sm:text-[12px]`:`text-[9px] leading-snug sm:text-[10px]`),children:[(0,G.jsx)(`span`,{className:`block wrap-break-word 2xl:hidden`,children:n??t}),(0,G.jsx)(`span`,{className:`hidden wrap-break-word 2xl:block`,children:t})]})]}),(0,G.jsx)(V,{side:`top`,align:`start`,sideOffset:6,className:`max-w-xs`,children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(`span`,{className:`font-medium text-foreground`,children:t}),(0,G.jsx)(`span`,{className:`text-muted-foreground`,children:s??t})]})})]})}),(0,G.jsxs)(`p`,{className:P(`min-w-0 wrap-break-word font-mono font-semibold leading-tight tracking-tight tabular-nums`,c?`text-2xl sm:text-3xl lg:text-4xl`:`text-base lg:text-lg`,a===`ok`&&`text-success`,a===`warn`&&`text-warning`,a===`bad`&&`text-destructive`,a===`neutral`&&`text-foreground`),children:[r,i?(0,G.jsx)(`span`,{className:P(`ml-0.5 font-medium text-muted-foreground`,c?`text-base lg:text-lg`:`text-xs lg:text-sm`),children:i}):null]})]})}function Y({title:e,subtitle:t,children:n,className:r,id:i}){return(0,G.jsxs)(`section`,{id:i,className:P(ve,r),children:[(0,G.jsxs)(`div`,{className:`border-b border-border/60 px-4 py-3`,children:[(0,G.jsx)(`h2`,{className:`blueprint-title text-foreground`,children:e}),t?(0,G.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:t}):null]}),(0,G.jsx)(`div`,{className:`overflow-hidden p-0`,children:n})]})}var je=new Set([`pu`,`h`]),Me=[`_reference`,`_baseline`,`_setpoint`,`_command`],X=`var(--color-primary)`,Ne=`var(--color-background)`,Pe=60,Fe=1e-4;function Z(e,t,n){let r=e?.get(t);return{value:r?.value??n.value,quality:r?.quality??n.quality}}function Ie(e){return Object.entries(e.members).filter(([e,t])=>t.meta.kind===`variable`&&t.meta.access===`read`&&t.meta.dataType===`Double`&&t.meta.euRange!==null&&!je.has(t.meta.unit??``)&&!Me.some(t=>e.endsWith(t)))}function Le(e,t){if(e.length<2)return!1;let n=t-Pe,r;for(let t of e)if(!(t.tick<n)){if(r===void 0){r=t.value;continue}if(Math.abs(t.value-r)>Fe)return!0}return!1}function Re({data:e,chartHeight:n=34,live:c=!1}){let l=(0,W.useId)(),[u,d]=(0,W.useState)(null),f=1/0,p=-1/0;for(let t of e)t.value<f&&(f=t.value),t.value>p&&(p=t.value);let m=e[e.length-1];return(0,G.jsxs)(`div`,{className:`flex min-h-0 w-full flex-col overflow-hidden`,style:{height:n+14},children:[(0,G.jsx)(`div`,{style:{height:n,width:`100%`},children:(0,G.jsx)(t,{width:`100%`,height:n,children:(0,G.jsxs)(s,{data:e,margin:{top:3,right:4,bottom:2,left:0},onMouseMove:e=>{let t=e?.activePayload?.[0]?.value;typeof t==`number`&&d(t)},onMouseLeave:()=>d(null),children:[(0,G.jsx)(`defs`,{children:(0,G.jsxs)(`linearGradient`,{id:l,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,G.jsx)(`stop`,{offset:`0%`,stopColor:X,stopOpacity:.32}),(0,G.jsx)(`stop`,{offset:`100%`,stopColor:X,stopOpacity:0})]})}),(0,G.jsx)(i,{domain:[`auto`,`auto`],hide:!0}),(0,G.jsx)(a,{content:()=>null,cursor:!1}),(0,G.jsx)(o,{type:`monotone`,dataKey:`value`,stroke:X,strokeWidth:1.5,strokeLinecap:`round`,strokeLinejoin:`round`,fill:`url(#${l})`,isAnimationActive:!1,dot:!1,activeDot:{r:3,fill:X,stroke:Ne,strokeWidth:1}}),m?(0,G.jsx)(r,{x:m.tick,y:m.value,r:2.25,fill:X,stroke:Ne,strokeWidth:1.25,isFront:!0,ifOverflow:`extendDomain`}):null]})})}),(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[10px] leading-none tabular-nums text-muted-foreground`,children:[c?(0,G.jsxs)(`span`,{"aria-hidden":!0,className:`relative inline-flex size-1.5 shrink-0 items-center justify-center`,children:[(0,G.jsx)(`span`,{className:`absolute inline-flex size-2 animate-ping rounded-full bg-primary/50`}),(0,G.jsx)(`span`,{className:`relative inline-flex size-1.5 rounded-full bg-primary`})]}):null,u===null?(0,G.jsxs)(`span`,{children:[E(f),`–`,E(p)]}):(0,G.jsx)(`span`,{className:`font-medium text-primary`,children:E(u)})]})]})}function ze({detail:e,processVariables:t,memberValues:n,historyRef:r,tick:i,showQuality:a}){let{liveMap:o,orderedVariables:s}=(0,W.useMemo)(()=>{let e=new Map,n=[],a=[];for(let o of t){let t=Le(r.current.get(o[0])??[],i);e.set(o[0],t),(t?n:a).push(o)}return{liveMap:e,orderedVariables:[...n,...a]}},[t,n,i,r]);return t.length===0?(0,G.jsx)(Y,{title:`Process`,subtitle:`No continuous analog readings defined for this asset`,className:`opacity-90`,children:(0,G.jsx)(`p`,{className:`px-4 py-6 text-center text-sm text-muted-foreground`,children:`This asset exposes no continuous process variables. Discrete states, flags, and commands are available in the Tags section below.`})}):(0,G.jsx)(Y,{title:`Process`,subtitle:`Live tag readings — trend is ~2 min at 1 Hz`,children:(0,G.jsx)(`ul`,{className:`divide-y divide-border/40`,children:s.map(([t,i])=>{let{value:s,quality:c}=Z(n,t,i),l=r.current.get(t)??[],u=ae(e.browsePath,t),d=o.get(t)??!1,f=l.length>=2,p=C(i.meta.unit),m=D(t);return(0,G.jsxs)(h.li,{layout:`position`,transition:{duration:.36,ease:[.22,1,.36,1]},className:`flex flex-col gap-2.5 bg-background px-4 py-3 sm:flex-row sm:items-center sm:gap-5 sm:py-3.5`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1 sm:w-44 sm:shrink-0`,children:[(0,G.jsxs)(H,{children:[(0,G.jsx)(B,{className:`min-w-0 flex-1 cursor-default truncate text-left text-[11px] font-medium uppercase tracking-[var(--miravo-tracking-eyebrow)] text-muted-foreground`,render:(0,G.jsx)(`span`,{}),children:m}),(0,G.jsx)(V,{side:`top`,align:`start`,className:`max-w-xs`,children:m})]}),(0,G.jsx)(x,{value:u,label:`Copy Topic / UNS path`})]}),(0,G.jsxs)(`div`,{className:`relative h-[56px] min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{"aria-hidden":!0,className:`absolute inset-x-0 top-1/2 h-px -translate-y-1/2 bg-border/30`}),f?(0,G.jsx)(Re,{data:l,chartHeight:42,live:d}):(0,G.jsx)(`p`,{className:`flex h-full items-center text-[10px] uppercase tracking-widest text-muted-foreground`,children:`Collecting trend…`})]}),(0,G.jsxs)(`div`,{className:`flex items-baseline gap-2 sm:min-w-36 sm:shrink-0 sm:justify-end`,children:[(0,G.jsx)(`span`,{className:`blueprint-stat text-2xl font-semibold leading-none tabular-nums text-foreground`,children:typeof s==`number`?E(s):String(s)}),p&&(0,G.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:p}),a&&c!==`good`&&(0,G.jsx)(be,{variant:c===`uncertain`?`secondary`:`destructive`,className:`shrink-0 text-[10px]`,children:c})]})]},t)})})})}function Be({name:e,value:t,dataType:n,unit:r,access:i}){let a=D(e),o=i===`readwrite`;if(n===`Boolean`||typeof t==`boolean`||r===`pu`&&(t===0||t===1)){let n=t===!0||t===`true`||t===1,r=e.includes(`fault`);return(0,G.jsxs)(`div`,{className:`flex min-h-9 min-w-0 items-center justify-between gap-2 rounded-[var(--miravo-radius-tight)] border px-2 py-1 ${r&&n?`border-destructive/30 bg-transparent`:``}`,children:[(0,G.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-left text-[10px] leading-snug text-muted-foreground`,children:[a,o&&(0,G.jsx)(`span`,{className:`ml-1 text-[8px] text-primary`,children:`CMD`})]}),(0,G.jsx)(`span`,{className:`shrink-0 font-mono text-xs font-medium tabular-nums ${r&&n?`text-destructive`:n?`text-success`:`text-muted-foreground`}`,children:n?`ON`:`OFF`})]})}if(n===`String`){let n=String(t),r=n===`none`||n===``,i=O.has(n)||e.includes(`fault_code`)&&!r,o=!i&&A.has(n);return(0,G.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-col justify-center gap-1 rounded-[var(--miravo-radius-tight)] border px-2 py-2 ${i?`border-destructive/30 bg-transparent`:o?`border-warning/30 bg-warning/5`:``}`,children:[(0,G.jsx)(`span`,{className:`wrap-break-word text-[10px] leading-tight text-muted-foreground`,children:a}),r?(0,G.jsx)(`span`,{className:`wrap-break-word font-mono text-sm font-medium leading-snug text-muted-foreground`,children:`—`}):(0,G.jsx)(`span`,{title:n,className:`wrap-break-word font-mono text-sm font-medium leading-snug ${i?`text-destructive`:o?`text-warning`:`text-foreground`}`,children:j(n)})]})}return(0,G.jsxs)(`div`,{className:`flex min-h-9 min-w-0 items-center justify-between gap-2 rounded-[var(--miravo-radius-tight)] border px-2 py-1`,children:[(0,G.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-left text-[10px] leading-snug text-muted-foreground`,children:[a,o&&(0,G.jsx)(`span`,{className:`ml-1 text-[8px] text-primary`,children:`CMD`})]}),(0,G.jsxs)(`span`,{className:`shrink-0 text-right font-mono text-xs font-medium tabular-nums`,children:[typeof t==`number`?E(t):String(t),r&&(0,G.jsx)(`span`,{className:`ml-1 text-[10px] text-muted-foreground`,children:C(r)})]})]})}function Ve(e){return[...e].sort((e,t)=>{let n=e[1].meta.access===`readwrite`;return n===(t[1].meta.access===`readwrite`)?e[0].localeCompare(t[0]):n?-1:1})}function He({stringEnumMembers:e,nonStringOperationalMembers:t,memberValues:n,className:r}){let i=(0,W.useMemo)(()=>Ve(e),[e]),a=(0,W.useMemo)(()=>Ve(t),[t]),o=`grid min-w-0 gap-2 [grid-template-columns:repeat(auto-fill,minmax(min(100%,12.5rem),1fr))]`;return(0,G.jsx)(Y,{title:`Tags`,subtitle:`Mode, status flags, and control tags`,className:r,children:(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-5 p-4`,children:[i.length>0&&(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[a.length>0&&(0,G.jsx)(`h3`,{className:`blueprint-title text-muted-foreground`,children:`States`}),(0,G.jsx)(`div`,{className:o,children:i.map(([e,t])=>{let{value:r}=Z(n,e,t);return(0,G.jsx)(Be,{name:e,value:r,dataType:t.meta.dataType,unit:t.meta.unit,access:t.meta.access},e)})})]}),a.length>0&&(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[i.length>0&&(0,G.jsx)(`h3`,{className:`blueprint-title text-muted-foreground`,children:`Flags & commands`}),(0,G.jsx)(`div`,{className:o,children:a.map(([e,t])=>{let{value:r}=Z(n,e,t);return(0,G.jsx)(Be,{name:e,value:r,dataType:t.meta.dataType,unit:t.meta.unit,access:t.meta.access},e)})})]})]})})}function Q({className:e,counters:t,memberValues:n}){return(0,G.jsx)(Y,{title:`Counters`,subtitle:`Totals, hours, and accumulators`,className:e,children:(0,G.jsx)(`div`,{className:`flex flex-col gap-2 p-4`,children:t.map(([e,t])=>{let{value:r}=Z(n,e,t);return(0,G.jsxs)(`div`,{className:`flex items-center justify-between rounded-[var(--miravo-radius-tight)] border border-border/60 bg-transparent px-3 py-2`,children:[(0,G.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:D(e)}),(0,G.jsxs)(`span`,{className:`blueprint-stat text-sm font-medium`,children:[typeof r==`number`?E(r):String(r),t.meta.unit&&(0,G.jsx)(`span`,{className:`ml-1 text-[10px] text-muted-foreground`,children:C(t.meta.unit)})]})]},e)})})})}function $({className:e,detail:t,referenceMembers:n,memberValues:r}){let i=Object.keys(t.parameters).length>0,a=n.length>0;return!i&&!a?null:(0,G.jsx)(Y,{title:`Nameplate & configuration`,subtitle:`Design parameters, identity, and reference values`,className:e,children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-4 p-4`,children:[i&&(0,G.jsx)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-3`,children:Object.entries(t.parameters).map(([e,t])=>(0,G.jsxs)(`div`,{className:`flex flex-col gap-0.5 py-1.5`,children:[(0,G.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:D(e)}),(0,G.jsxs)(`span`,{className:`font-mono text-sm font-medium`,children:[typeof t.value==`number`?E(t.value):String(t.value),t.unit&&(0,G.jsx)(`span`,{className:`ml-1 text-[10px] text-muted-foreground`,children:C(t.unit)})]})]},e))}),a&&(0,G.jsx)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-3`,children:n.map(([e,t])=>{let{value:n}=Z(r,e,t);return(0,G.jsxs)(`div`,{className:`flex flex-col gap-0.5 rounded-[var(--miravo-radius-tight)] border border-border/60 bg-transparent p-2`,children:[(0,G.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:D(e)}),(0,G.jsxs)(`span`,{className:`font-mono text-sm font-medium`,children:[typeof n==`number`?E(n):String(n),t.meta.unit&&(0,G.jsx)(`span`,{className:`ml-1 text-[10px] text-muted-foreground`,children:C(t.meta.unit)})]})]},e)})})]})})}var Ue=120,We=`gap-4 sm:gap-5 lg:gap-x-6 lg:gap-y-5 xl:gap-x-8`,Ge=`instance-detail-page relative isolate mx-auto flex min-h-full w-full max-w-screen-2xl flex-col gap-6 p-4 sm:gap-8 sm:p-6`;function Ke(e){return e instanceof Error&&`code`in e&&e.code===`NOT_FOUND`?!0:e instanceof Error&&/^404\b/.test(e.message.trim())}function qe(){let{id:e}=re(),t=ne(),n=(0,W.useCallback)(()=>{(0,W.startTransition)(()=>{(0,W.addTransitionType)(xe),t(`/`)})},[t]),[r,i]=(0,W.useState)({}),[a,o]=(0,W.useState)(null),[s,c]=(0,W.useState)(!1),[g,_]=ee(`tab`,te([`hmi`,`operate`,`data`,`operations`]).withDefault(`hmi`)),v=g===`data`||g===`operations`?`operate`:g,y=ye();(0,W.useEffect)(()=>{y.isPending||o(null)},[y.isPending]),(0,W.useEffect)(()=>{(g===`data`||g===`operations`)&&_(`operate`)},[g,_]);let b=(0,W.useCallback)(e=>{_(`operate`),requestAnimationFrame(()=>{requestAnimationFrame(()=>{document.getElementById(e)?.scrollIntoView({behavior:`smooth`,block:`start`})})})},[_]);(0,W.useEffect)(()=>{let e=null,t=!1,r=()=>{t=!1,e&&=(clearTimeout(e),null)},i=i=>{if(i.metaKey||i.ctrlKey||i.altKey)return;let a=i.target;if(a){let e=a.tagName;if(e===`INPUT`||e===`TEXTAREA`||e===`SELECT`||a.isContentEditable)return}if(t){i.key===`f`?(b(`faults`),i.preventDefault()):i.key===`c`&&(b(`commands`),i.preventDefault()),r();return}if(i.key===`g`){t=!0,e=setTimeout(r,1200);return}i.key===`b`&&!i.shiftKey?(n(),i.preventDefault()):i.key===`?`&&(c(!0),i.preventDefault())};return window.addEventListener(`keydown`,i),()=>{window.removeEventListener(`keydown`,i),r()}},[n,b]);let x=f({queryKey:u.instances.detail(e??``),queryFn:()=>d(`/instances/${e}`,l.instanceDetail),enabled:e!==void 0}),C=(0,W.useDeferredValue)(x.data??null),ie=x.isError,w=U(t=>e?t.memberValues.get(e):void 0),T=U(e=>e.models),E=U(e=>e.instances),D=(0,W.useMemo)(()=>E.find(t=>t.id===e),[E,e]),ae=D?.activeFaults,O=(0,W.useRef)(new Map),k=U(e=>e.tick);(0,W.useEffect)(()=>{if(!w||!e)return;let t=O.current;for(let[e,n]of w){if(typeof n.value!=`number`)continue;let r=t.get(e)??[];if(r[r.length-1]?.tick===k)continue;let i=r.length>=Ue?r.slice(r.length-Ue+1):r;t.set(e,[...i,{value:n.value,tick:k}])}},[w,k,e]);let A=(0,W.useMemo)(()=>C?Ie(C):[],[C]),j=(0,W.useMemo)(()=>{if(!C)return{operational:[],counters:[],reference:[]};let e=new Set(A.map(([e])=>e)),t=Object.entries(C.members).filter(([t])=>!e.has(t)),n=[],r=[],i=[];for(let e of t){let[,t]=e,a=t.meta.dataType,o=t.meta.kind,s=t.meta.unit,c=s===`pu`&&t.meta.euRange?.[0]===0&&t.meta.euRange?.[1]===1;o===`property`?i.push(e):a===`Boolean`||a===`String`||c?n.push(e):s===`count`||a===`UInt16`||a===`UInt32`?r.push(e):t.meta.access===`readwrite`||Me.some(t=>e[0].endsWith(t))?n.push(e):s===`pu`||s===`h`?r.push(e):i.push(e)}return{operational:n,counters:r,reference:i}},[C,A]),oe=(0,W.useMemo)(()=>C?T.find(e=>e.name===C.assetType)?.faultNames??[]:[],[C,T]),M=ae??C?.activeFaults??[],N=(0,W.useMemo)(()=>{if(!w)return M.length>0;for(let[,e]of w)if(e.quality!==`good`)return!0;return!1},[w,M.length]),se=(0,W.useMemo)(()=>j.operational.filter(([,e])=>e.meta.dataType===`String`),[j.operational]),ce=(0,W.useMemo)(()=>j.operational.filter(([,e])=>e.meta.dataType!==`String`),[j.operational]),le=t=>{if(!e)return;let n={},i=C?.methods[t];if(i)for(let e of i.inputArguments){let i=r[t]?.[e.name]??``,a=_e(e.name,i,e.dataType);if(!a)return;n[e.name]=a.value}o(t),y.mutateAsync({type:`invokeMethod`,instanceId:e,method:t,arguments:n}).then(async()=>{await x.refetch()}).catch(()=>{})},F=t=>{e&&y.mutateAsync({type:`triggerFault`,instanceId:e,fault:t}).then(async()=>{await x.refetch()}).catch(()=>{})},pe=t=>{e&&y.mutateAsync({type:`clearFault`,instanceId:e,fault:t}).then(async()=>{await x.refetch()}).catch(()=>{})};if(!C)return ie?Ke(x.error)?(0,G.jsx)(Se,{className:`min-h-full`,children:(0,G.jsx)(`div`,{className:`flex min-h-[40vh] items-center justify-center p-6 sm:p-12`,children:(0,G.jsx)(`div`,{className:`w-full max-w-md`,children:(0,G.jsxs)(p,{eyebrow:`Instance lookup`,stamp:`404`,title:`Instance not found`,detail:e??`Unknown instance id`,detailLabel:`Requested instance`,primaryLabel:`Back to Fleet`,onPrimary:n,children:[(0,G.jsx)(`p`,{children:`The requested asset is no longer in the running fleet or the URL is wrong.`}),(0,G.jsx)(`p`,{children:`Return to Fleet and pick a live instance from the current environment.`})]})})})}):(0,G.jsx)(Se,{className:`min-h-full`,children:(0,G.jsxs)(`div`,{className:`flex min-h-[40vh] flex-col items-center justify-center gap-4 p-6 sm:p-12`,children:[(0,G.jsx)(`div`,{className:`w-full max-w-md`,children:(0,G.jsx)(m,{message:Ce(x.error,`Could not load instance.`),onRetry:()=>void x.refetch(),isRetrying:x.isFetching})}),(0,G.jsx)(S,{variant:`outline`,size:`sm`,onClick:n,children:`Back to Fleet`})]})}):D?(0,G.jsx)(`div`,{className:Ge,children:(0,G.jsx)(Ae,{detail:{id:D.id,assetType:D.model,browsePath:D.browsePath,lifecycleStage:D.lifecycleStage,operatingHours:D.operatingHours,activeFaults:D.activeFaults,isQuarantined:D.isQuarantined,parameters:{},members:{},methods:{}},tick:k,activeFaults:M,memberValues:w,onBack:n})}):null;let I=j.operational.length>0,L=j.counters.length>0,R=j.reference.length>0||Object.keys(C.parameters).length>0,z=I||L||R,B=Object.keys(C.methods).length>0,V=I&&!L&&!R,H=I&&L&&R;return(0,G.jsxs)(`div`,{className:Ge,children:[(0,G.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-0 -z-10 hidden select-none overflow-hidden md:block`,children:(0,G.jsx)(`span`,{className:`absolute -top-2 left-0 whitespace-nowrap uppercase leading-none opacity-35 blur-[2px]`,style:{fontFamily:`var(--miravo-font-heading)`,fontSize:`clamp(5rem, 14vw, 12rem)`,fontWeight:`var(--miravo-weight-medium)`,letterSpacing:`var(--miravo-tracking-heading)`,color:`var(--miravo-ghost)`},children:C.assetType.replace(/_/g,` `)})}),(0,G.jsx)(Ae,{detail:C,tick:k,activeFaults:M,memberValues:w,onBack:n}),(0,G.jsx)(W.ViewTransition,{enter:`fade-in`,default:`none`,children:(0,G.jsxs)(me,{value:v,onValueChange:e=>{_(e)},className:`min-h-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`shrink-0 overflow-x-auto`,children:(0,G.jsxs)(fe,{variant:`line`,className:`h-10! min-w-max gap-0.5`,children:[(0,G.jsxs)(ue,{value:`hmi`,className:`gap-1.5 px-3 text-sm`,children:[(0,G.jsx)(ge,{className:`size-3.5 shrink-0`}),`HMI`]}),(0,G.jsxs)(ue,{value:`operate`,className:`gap-1.5 px-3 text-sm`,children:[(0,G.jsx)(he,{className:`size-3.5 shrink-0`}),`Operate`]})]})}),(0,G.jsx)(de,{value:`hmi`,className:`flex-1 py-2`,children:(0,G.jsx)(h.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.15,ease:`easeOut`},children:(0,G.jsx)(ze,{detail:C,processVariables:A,memberValues:w,historyRef:O,tick:k,showQuality:N})},`hmi`)}),(0,G.jsx)(de,{value:`operate`,className:`flex-1 py-2`,children:(0,G.jsxs)(h.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.15,ease:`easeOut`},className:`flex min-w-0 flex-col gap-4`,children:[z&&(0,G.jsxs)(`section`,{"aria-label":`Data`,className:P(`grid min-w-0 grid-cols-1`,We,H&&`lg:grid-cols-2 lg:grid-rows-[auto_auto] lg:items-start`,!H&&I&&(L||R)&&`lg:grid-cols-2 lg:items-start`),children:[I&&(0,G.jsx)(He,{stringEnumMembers:se,nonStringOperationalMembers:ce,memberValues:w,className:P(`min-h-0 min-w-0 self-stretch`,V&&`lg:col-span-2`,H&&`lg:row-span-2`)}),!I&&L&&R&&(0,G.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-col gap-6 lg:col-span-2`,children:[(0,G.jsx)(Q,{counters:j.counters,memberValues:w}),(0,G.jsx)($,{detail:C,referenceMembers:j.reference,memberValues:w})]}),!I&&L&&!R&&(0,G.jsx)(Q,{className:`lg:col-span-2`,counters:j.counters,memberValues:w}),!I&&!L&&R&&(0,G.jsx)($,{className:`lg:col-span-2`,detail:C,referenceMembers:j.reference,memberValues:w}),I&&L&&(0,G.jsx)(Q,{className:`min-h-0 min-w-0 self-stretch lg:col-start-2 lg:row-start-1`,counters:j.counters,memberValues:w}),I&&R&&(0,G.jsx)($,{className:P(`min-h-0 min-w-0 self-stretch lg:col-start-2`,H?`lg:row-start-2`:`lg:row-start-1`),detail:C,referenceMembers:j.reference,memberValues:w})]}),(0,G.jsxs)(`section`,{"aria-label":`Operations`,className:P(ve,`grid grid-cols-1`,B&&`lg:grid-cols-2`),children:[(0,G.jsx)(ke,{activeFaults:M,availableFaults:oe,onTriggerFault:F,onClearFault:pe}),B&&(0,G.jsx)(`div`,{className:`border-t border-border/50 lg:border-l lg:border-t-0`,children:(0,G.jsx)(Oe,{detail:C,methodArgs:r,setMethodArgs:i,onInvoke:le,isPending:y.isPending,pendingMethod:a})})]})]},`operate`)})]})}),(0,G.jsx)(Je,{open:s,onOpenChange:c})]})}function Je({open:e,onOpenChange:t}){return(0,G.jsx)(v,{open:e,onOpenChange:t,children:(0,G.jsxs)(y,{children:[(0,G.jsx)(b,{className:`font-heading text-lg font-semibold tracking-tight`,children:`Keyboard shortcuts`}),(0,G.jsx)(_,{className:`text-sm text-muted-foreground`,children:`Navigate this instance without leaving the keyboard.`}),(0,G.jsx)(`ul`,{className:`flex flex-col gap-2 pt-1`,children:[{keys:[`g`,`f`],label:`Jump to Alarms`},{keys:[`g`,`c`],label:`Jump to Commands`},{keys:[`b`],label:`Back to Fleet`},{keys:[`?`],label:`Show this sheet`}].map(e=>(0,G.jsxs)(`li`,{className:`flex items-center justify-between gap-4`,children:[(0,G.jsx)(`span`,{className:`text-sm text-foreground`,children:e.label}),(0,G.jsx)(`span`,{className:`flex items-center gap-1`,children:e.keys.map((t,n)=>(0,G.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(`kbd`,{className:`rounded-[var(--miravo-radius-tight)] border border-border bg-muted/40 px-1.5 py-0.5 font-mono text-[11px] font-medium text-foreground`,children:t}),n<e.keys.length-1&&(0,G.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:`then`})]},`${e.label}-${t}`))})]},e.label))})]})})}export{qe as InstanceDetailPage};
@@ -1,4 +1,4 @@
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{i as r,l as i,x as a}from"./api-DimikzPd.js";import{t as o}from"./use-transition-navigate-jMR-y4bs.js";import{t as s}from"./transition-nav-link-nVD3H66a.js";import{t as c}from"./get-error-message-Dk8elqEP.js";var l=e(t(),1),u=n(),d=`
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{i as r,l as i,x as a}from"./api-D8oAzcVE.js";import{t as o}from"./use-transition-navigate-jTHkLHMS.js";import{t as s}from"./transition-nav-link-Ct6VIy2S.js";import{t as c}from"./get-error-message-Dk8elqEP.js";var l=e(t(),1),u=n(),d=`
2
2
  @keyframes readout-appear {
3
3
  from { opacity: 0; transform: translateY(8px) scale(0.95); }
4
4
  to { opacity: 1; transform: translateY(0) scale(1); }
@@ -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-DimikzPd.js";import{i as o,t as s}from"./query-fetch-error-Bcg_UjHM.js";import{t as c}from"./proxy-Be4WzmcS.js";import{t as l}from"./AnimatePresence-CPmH1DMY.js";import{a as u,i as d,n as f,o as p,r as m,s as h}from"./copy-button-BvU3RDZa.js";import{S as g,g as _,l as v,s as y,u as b,x}from"./format-CshN6yEB.js";import{n as S,t as C}from"./utils-XFKvwlFT.js";import{t as w}from"./activity-Cy_niK56.js";import{D as T,T as E,n as D,t as O,w as ee}from"./use-platform-stream-CZLW085n.js";import{l as k}from"./select-CmlY1M1a.js";import{i as A,n as j,r as M,t as N}from"./tabs-4SeH2unv.js";import{r as te}from"./checkbox-C_4HRnS_.js";import{a as P,c as F,d as I,i as L,l as ne,n as R,o as z,r as B,s as V,t as H,u as U}from"./catalog-source-C4jQdH37.js";import{c as W,n as re,r as ie,s as ae,t as oe}from"./use-engine-command-mutation-C8S_hX0O.js";import{t as se}from"./triangle-alert-BXrJNk3g.js";import{t as G}from"./badge-eIn_7YrK.js";import{t as K}from"./get-error-message-Dk8elqEP.js";var q=S(`box`,[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]),ce=S(`cog`,[[`path`,{d:`M11 10.27 7 3.34`,key:`16pf9h`}],[`path`,{d:`m11 13.73-4 6.93`,key:`794ttg`}],[`path`,{d:`M12 22v-2`,key:`1osdcq`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M14 12h8`,key:`4f43i9`}],[`path`,{d:`m17 20.66-1-1.73`,key:`eq3orb`}],[`path`,{d:`m17 3.34-1 1.73`,key:`2wel8s`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`m20.66 17-1.73-1`,key:`sg0v6f`}],[`path`,{d:`m20.66 7-1.73 1`,key:`1ow05n`}],[`path`,{d:`m3.34 17 1.73-1`,key:`nuk764`}],[`path`,{d:`m3.34 7 1.73 1`,key:`1ulond`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`circle`,{cx:`12`,cy:`12`,r:`8`,key:`46899m`}]]),le=S(`heart-pulse`,[[`path`,{d:`M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5`,key:`mvr1a0`}],[`path`,{d:`M3.22 13H9.5l.5-1 2 4.5 2-7 1.5 3.5h5.27`,key:`auskq0`}]]),ue=S(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),de=S(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),J=e(t(),1),Y=n(),fe=new Set([`fault_active`,`fault_count`,`active_fault_code`,`lifecycle_stage`,`health_state`,`availability_state`]);function pe(e){let t=[],n=[],r=[],i=[];for(let[a,o]of Object.entries(e)){let e={name:a,kind:o.kind,dataType:o.dataType,access:o.access,unit:o.unit,euRange:o.euRange};fe.has(a)?i.push(e):o.kind===`property`?t.push(e):o.access===`readwrite`?n.push(e):r.push(e)}let a=[];return t.length>0&&a.push({key:`nameplate`,label:`Nameplate`,icon:(0,Y.jsx)(U,{className:`size-3`}),members:t,accentClass:`text-muted-foreground`}),n.length>0&&a.push({key:`commands`,label:`Commands`,icon:(0,Y.jsx)(ue,{className:`size-3`}),members:n,accentClass:`text-info`}),r.length>0&&a.push({key:`process`,label:`Process Tags`,icon:(0,Y.jsx)(w,{className:`size-3`}),members:r,accentClass:`text-primary`}),i.length>0&&a.push({key:`health`,label:`Health & Status`,icon:(0,Y.jsx)(le,{className:`size-3`}),members:i,accentClass:`text-success`}),a}function me({modelName:e,onClose:t}){let[n,l]=(0,J.useState)(new Set([`nameplate`,`process`])),u=o({queryKey:i.catalog.modelSchema(e??``),queryFn:()=>a(`/catalog/models/${e}`,r.catalogModelDetail),enabled:e!==null}),d=u.data,f=u.isPending&&!d,p=u.isError,m=K(u.error,`Failed to load model.`);(0,J.useEffect)(()=>{e&&l(new Set([`nameplate`,`process`]))},[e]);let h=(0,J.useMemo)(()=>d?pe(d.members):[],[d]),g=(0,J.useCallback)(e=>{l(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),v=O(),y=d?Object.keys(d.members).length:0,x=d?Object.keys(d.methods).length:0;return(0,Y.jsx)(P,{open:e!==null,onOpenChange:e=>{e||(v.reset(),t())},children:(0,Y.jsx)(z,{side:`right`,className:`flex w-full flex-col gap-4 touch-manipulation`,children:f?null:p&&!d?(0,Y.jsx)(`div`,{className:`flex flex-1 flex-col justify-center px-2`,children:(0,Y.jsx)(s,{message:m,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)(F,{className:`gap-1 pb-0 pe-12`,children:[(0,Y.jsx)(ne,{className:`font-heading text-base uppercase tracking-wide`,children:b(d.name)}),d.description&&(0,Y.jsx)(V,{className:`text-xs leading-relaxed text-foreground/88`,children:d.description}),(0,Y.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,Y.jsxs)(G,{variant:`outline`,className:`font-mono text-xs`,children:[y,` members`]}),(0,Y.jsxs)(G,{variant:`outline`,className:`font-mono text-xs`,children:[x,` methods`]}),(0,Y.jsxs)(G,{variant:`outline`,className:`font-mono text-xs`,children:[d.faults.length,` faults`]}),d.lifecycle&&(0,Y.jsxs)(G,{variant:`outline`,className:`font-mono text-xs text-primary`,children:[d.lifecycle.stages.length,`-stage lifecycle`]}),(0,Y.jsx)(D,{stream:v})]})]}),(0,Y.jsxs)(N,{defaultValue:`overview`,className:`flex min-h-0 flex-1 flex-col gap-1 pt-0`,children:[(0,Y.jsxs)(M,{variant:`line`,className:`h-8! shrink-0 gap-0.5 border-b-border/60 px-2 py-0.5`,children:[(0,Y.jsx)(A,{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)(A,{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)(j,{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-1.5 pb-1 pt-0.5`,children:[h.map(e=>(0,Y.jsx)(X,{sectionKey:e.key,label:e.label,count:e.members.length,icon:e.icon,accentClass:e.accentClass,expanded:n.has(e.key),onToggle:g,children:(0,Y.jsx)(`div`,{className:`flex flex-col gap-1`,children:e.members.map(e=>(0,Y.jsx)(he,{member:e},e.name))})},e.key)),d.faults.length>0&&(0,Y.jsx)(X,{sectionKey:`faults`,label:`Faults`,count:d.faults.length,icon:(0,Y.jsx)(se,{className:`size-3`}),accentClass:`text-warning`,expanded:n.has(`faults`),onToggle:g,children:(0,Y.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:d.faults.map(e=>(0,Y.jsx)(G,{variant:`secondary`,className:`text-[10px] text-warning`,children:_(e)},e))})}),d.lifecycle&&(0,Y.jsx)(X,{sectionKey:`lifecycle`,label:`Lifecycle`,count:d.lifecycle.stages.length,icon:(0,Y.jsx)(ce,{className:`size-3`}),accentClass:`text-primary`,expanded:n.has(`lifecycle`),onToggle:g,children:(0,Y.jsx)(ge,{lifecycle:d.lifecycle})}),x>0&&(0,Y.jsx)(X,{sectionKey:`methods`,label:`Methods`,count:x,icon:(0,Y.jsx)(de,{className:`size-3`}),accentClass:`text-info`,expanded:n.has(`methods`),onToggle:g,children:(0,Y.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:Object.entries(d.methods).map(([e,t])=>(0,Y.jsx)(_e,{name:e,method:t},e))})})]})})})}),(0,Y.jsx)(j,{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)(L,{kind:`model`,id:d.name,displayName:b(d.name),yamlPath:`/catalog/models/${d.name}/yaml`,yamlFilename:`${d.name}.twin.yaml`,stream:v})})})]})]},d.name):(0,Y.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-sm text-muted-foreground`,children:`Model not found`})})})}function X({sectionKey:e,label:t,count:n,icon:r,accentClass:i,expanded:a,onToggle:o,children:s}){return(0,Y.jsxs)(`div`,{className:`rounded-[var(--miravo-radius-tight)] border border-border/50`,children:[(0,Y.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-1.5 px-2.5 py-1.5 text-left text-xs font-medium transition-colors hover:bg-muted/30`,onClick:()=>o(e),children:[(0,Y.jsx)(`span`,{className:i,children:r}),(0,Y.jsx)(`span`,{className:`uppercase tracking-wider`,children:t}),(0,Y.jsx)(G,{variant:`secondary`,className:`ml-auto text-[10px]`,children:n}),(0,Y.jsx)(k,{className:`size-3 text-muted-foreground transition-transform ${a?`rotate-180`:``}`})]}),(0,Y.jsx)(l,{initial:!1,children:a&&(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:`border-t px-2.5 py-1.5`,children:s})},`content`)})]})}function he({member:e}){return(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-0.5 py-0.5 text-xs`,children:[(0,Y.jsx)(`span`,{title:e.name,className:`min-w-0 truncate font-mono text-foreground`,children:y(e.name)}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:e.dataType}),e.unit&&(0,Y.jsx)(G,{variant:`outline`,className:`px-1 py-0 text-[10px]`,children:e.unit}),e.euRange&&(0,Y.jsxs)(`span`,{className:`ml-auto font-mono text-xs text-muted-foreground`,children:[`[`,e.euRange[0],`–`,e.euRange[1],`]`]})]})}var Z={healthy:`bg-success`,normal:`bg-success`,degraded:`bg-warning`,critical:`bg-destructive`,failed:`bg-destructive`};function ge({lifecycle:e}){let t=e.stages.length;return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Y.jsx)(`div`,{className:`flex h-2.5 w-full overflow-hidden rounded-full bg-muted`,children:e.stages.map((e,n)=>(0,Y.jsx)(`div`,{className:`transition-[background-color] ${Z[e]??`bg-chart-1`} ${n===0?`rounded-l-full`:``} ${n===t-1?`rounded-r-full`:``}`,style:{width:`${100/t}%`}},`${e}-${n}`))}),(0,Y.jsx)(`div`,{className:`flex items-center gap-3`,children:e.stages.map((e,t)=>(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs`,children:[(0,Y.jsx)(`span`,{className:`size-2 rounded-full ${Z[e]??`bg-chart-1`}`}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:_(e)})]},`${e}-${t}`))}),(0,Y.jsxs)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:[`~`,v(e.totalHours),` total hours`]})]})}function _e({name:e,method:t}){return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`font-mono text-xs text-foreground`,children:e}),t.inputArguments.length>0&&(0,Y.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`(`,t.inputArguments.map(e=>`${e.name}: ${e.dataType}`).join(`, `),`)`]})]}),t.description&&(0,Y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t.description})]})}var Q=[`builtin`,`personal`];function ve(){let[e,t]=(0,J.useState)(``),[n,_]=(0,J.useState)(`all`),[v,y]=(0,J.useState)({}),[S,w]=(0,J.useState)(null),[T,E]=(0,J.useState)(null),[D,O]=(0,J.useState)(null),k=(0,J.useRef)(null),A=oe();(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(),k.current?.focus())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let j=o({queryKey:i.catalog.models(),queryFn:()=>a(`/catalog/models`,r.catalogModels)}),M=j.data??[],N=j.isPending&&!j.data,P=j.isError&&!j.data,F=j.isError&&!!j.data,I=K(j.error,`Failed to load models.`),L=e=>v[e]??1,ne=(0,J.useCallback)((e,t)=>{y(n=>({...n,[e]:Math.max(1,Math.min(10,t))}))},[]),R=(0,J.useCallback)(e=>{O(e)},[]),z=(0,J.useCallback)(e=>{E(e)},[]),V=async e=>{w(e);try{return await A.mutateAsync({type:`spawn`,model:e,count:L(e)}),!0}catch{return!1}finally{w(null)}},H=(0,J.useMemo)(()=>{let e={all:M.length};for(let t of Q)e[t]=0;for(let t of M){let n=B(t.source);e[n]=(e[n]??0)+1}return e},[M]),U=e.toLowerCase(),W=M.filter(e=>n===`all`||B(e.source)===n).filter(e=>U?e.name.toLowerCase().includes(U)||(e.description?.toLowerCase().includes(U)??!1):!0);return(0,Y.jsxs)(`div`,{className:`@container/models 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:`Asset Model Library`}),(0,Y.jsx)(G,{variant:`outline`,className:`text-xs`,children:P?(0,Y.jsx)(`span`,{className:`text-destructive`,children:`Unavailable`}):N&&M.length===0?(0,Y.jsx)(Y.Fragment,{children:`Loading...`}):(0,Y.jsxs)(Y.Fragment,{children:[M.length,` models`]})})]}),(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Canonical twin models with realistic physics, lifecycle degradation, and fault modes. Inspect to explore schema, copy YAML, or export.`})]}),P&&(0,Y.jsx)(s,{message:I,onRetry:()=>void j.refetch(),isRetrying:j.isFetching}),F&&(0,Y.jsx)(s,{message:`${I} Showing cached models.`,onRetry:()=>void j.refetch(),isRetrying:j.isFetching}),!P&&(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)(ee,{className:`absolute left-2.5 top-2.5 size-4 text-muted-foreground`}),(0,Y.jsx)(x,{ref:k,placeholder:`Filter models...`,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)(be,{value:n,counts:H,onChange:_})]}),(0,Y.jsx)(`div`,{className:`grid grid-cols-1 gap-4 @[720px]/models:grid-cols-2 @[1120px]/models:grid-cols-3`,"aria-busy":N&&!P,children:P?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)(ye,{model:e,count:L(e.name),spawning:S===e.name,onCountChange:ne,onInspect:R,onSpawn:z})},e.name))}),W.length===0&&M.length>0&&(0,Y.jsx)(`p`,{className:`col-span-full py-8 text-center text-sm text-muted-foreground`,children:`No models match the current filters.`})]})}),M.length>0&&(0,Y.jsx)(`div`,{className:C(ie,`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 Models`}),(0,Y.jsx)(`p`,{className:`max-w-xl text-sm leading-relaxed text-muted-foreground`,children:`Publish your custom twin models to the Miravo registry. Discover equipment models from other engineers, fork them, and adapt parameters for your use case.`}),(0,Y.jsx)(`div`,{children:(0,Y.jsx)(G,{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)(te,{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)(f,{open:T!==null,onOpenChange:e=>{e||E(null)},children:(0,Y.jsxs)(m,{children:[(0,Y.jsxs)(p,{children:[(0,Y.jsx)(h,{children:`Spawn instances?`}),(0,Y.jsx)(d,{children:T!==null&&(0,Y.jsxs)(Y.Fragment,{children:[`This spawns `,L(T),` instance`,L(T)===1?``:`s`,` of`,` `,(0,Y.jsx)(`span`,{className:`font-medium text-foreground`,children:b(T)}),` `,`into the running environment.`]})})]}),(0,Y.jsxs)(u,{children:[(0,Y.jsx)(g,{variant:`outline`,disabled:S!==null,onClick:()=>E(null),children:`Cancel`}),(0,Y.jsx)(g,{disabled:S!==null||T===null,onClick:async()=>{T!==null&&await V(T)&&E(null)},children:S===T?`Spawning...`:`Spawn`})]})]})}),(0,Y.jsx)(me,{modelName:D,onClose:()=>O(null)})]})}var ye=(0,J.memo)(function({model:e,count:t,spawning:n,onCountChange:r,onInspect:i,onSpawn:a}){return(0,Y.jsxs)(`div`,{className:C(ae,`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-9 shrink-0 items-center justify-center rounded-[var(--miravo-radius-stadium-sm)] bg-primary/10 text-primary`,children:(0,Y.jsx)(q,{className:`size-4`})}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex flex-col gap-0.5`,children:[(0,Y.jsx)(`span`,{className:`font-heading text-sm font-semibold uppercase tracking-wide`,children:b(e.name)}),e.description&&(0,Y.jsx)(`span`,{className:`line-clamp-2 text-xs leading-relaxed text-muted-foreground`,children:e.description})]})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 font-mono text-[11px] text-muted-foreground`,children:[(0,Y.jsx)($,{label:`mbr`,value:e.memberCount}),(0,Y.jsx)($,{label:`mth`,value:e.methodCount}),(0,Y.jsx)($,{label:`flt`,value:e.faultCount}),e.hasLifecycle&&(0,Y.jsxs)(`span`,{className:`flex items-center gap-1 text-primary`,children:[(0,Y.jsx)(`span`,{className:`text-[10px]`,children:`◈`}),(0,Y.jsxs)(`span`,{children:[e.lifecycleStageCount,`-stage`]})]}),(0,Y.jsx)(G,{variant:`outline`,className:C(`ml-auto shrink-0 font-sans text-[10px] font-medium uppercase tracking-wide`,H(e.source)),children:R(e.source)})]}),(0,Y.jsxs)(`div`,{className:`mt-auto 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)(g,{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.name,t-1)},children:(0,Y.jsx)(I,{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)(g,{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.name,t+1)},children:(0,Y.jsx)(E,{className:`size-3`})})]}),(0,Y.jsxs)(g,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>i(e.name),className:re,children:[(0,Y.jsx)(T,{className:`size-3.5`,"aria-hidden":!0}),`Inspect`]}),(0,Y.jsxs)(g,{size:`sm`,className:`ml-auto`,disabled:n,onClick:()=>a(e.name),children:[(0,Y.jsx)(W,{className:`mr-1 size-3`}),n?`...`:`Spawn`]})]})]})});function $({label:e,value:t}){return(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`span`,{className:`text-foreground`,children:t}),` `,(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:e})]})}function be({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`},...Q.map(e=>({id:e,label:R(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:C(`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:`models-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] text-foreground`,children:a})]},r.id)})})}export{q as n,ve 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-D8oAzcVE.js";import{i as o,t as s}from"./query-fetch-error-NbPqVPRR.js";import{t as c}from"./proxy-Be4WzmcS.js";import{t as l}from"./AnimatePresence-CPmH1DMY.js";import{a as u,i as d,n as f,o as p,r as m,s as h}from"./copy-button-BvU3RDZa.js";import{S as g,g as _,l as v,s as y,u as b,x}from"./format-CshN6yEB.js";import{n as S,t as C}from"./utils-XFKvwlFT.js";import{t as w}from"./activity-Cy_niK56.js";import{D as T,T as E,n as D,t as O,w as ee}from"./use-platform-stream-DBZo6HMM.js";import{l as k}from"./select-CmlY1M1a.js";import{i as A,n as j,r as M,t as N}from"./tabs-4SeH2unv.js";import{r as te}from"./checkbox-C_4HRnS_.js";import{a as P,c as F,d as I,i as L,l as ne,n as R,o as z,r as B,s as V,t as H,u as U}from"./catalog-source-BU77f8QO.js";import{c as W,n as re,r as ie,s as ae,t as oe}from"./use-engine-command-mutation-CcfqRB7j.js";import{t as se}from"./triangle-alert-BXrJNk3g.js";import{t as G}from"./badge-eIn_7YrK.js";import{t as K}from"./get-error-message-Dk8elqEP.js";var q=S(`box`,[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]),ce=S(`cog`,[[`path`,{d:`M11 10.27 7 3.34`,key:`16pf9h`}],[`path`,{d:`m11 13.73-4 6.93`,key:`794ttg`}],[`path`,{d:`M12 22v-2`,key:`1osdcq`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M14 12h8`,key:`4f43i9`}],[`path`,{d:`m17 20.66-1-1.73`,key:`eq3orb`}],[`path`,{d:`m17 3.34-1 1.73`,key:`2wel8s`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`m20.66 17-1.73-1`,key:`sg0v6f`}],[`path`,{d:`m20.66 7-1.73 1`,key:`1ow05n`}],[`path`,{d:`m3.34 17 1.73-1`,key:`nuk764`}],[`path`,{d:`m3.34 7 1.73 1`,key:`1ulond`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`circle`,{cx:`12`,cy:`12`,r:`8`,key:`46899m`}]]),le=S(`heart-pulse`,[[`path`,{d:`M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5`,key:`mvr1a0`}],[`path`,{d:`M3.22 13H9.5l.5-1 2 4.5 2-7 1.5 3.5h5.27`,key:`auskq0`}]]),ue=S(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),de=S(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),J=e(t(),1),Y=n(),fe=new Set([`fault_active`,`fault_count`,`active_fault_code`,`lifecycle_stage`,`health_state`,`availability_state`]);function pe(e){let t=[],n=[],r=[],i=[];for(let[a,o]of Object.entries(e)){let e={name:a,kind:o.kind,dataType:o.dataType,access:o.access,unit:o.unit,euRange:o.euRange};fe.has(a)?i.push(e):o.kind===`property`?t.push(e):o.access===`readwrite`?n.push(e):r.push(e)}let a=[];return t.length>0&&a.push({key:`nameplate`,label:`Nameplate`,icon:(0,Y.jsx)(U,{className:`size-3`}),members:t,accentClass:`text-muted-foreground`}),n.length>0&&a.push({key:`commands`,label:`Commands`,icon:(0,Y.jsx)(ue,{className:`size-3`}),members:n,accentClass:`text-info`}),r.length>0&&a.push({key:`process`,label:`Process Tags`,icon:(0,Y.jsx)(w,{className:`size-3`}),members:r,accentClass:`text-primary`}),i.length>0&&a.push({key:`health`,label:`Health & Status`,icon:(0,Y.jsx)(le,{className:`size-3`}),members:i,accentClass:`text-success`}),a}function me({modelName:e,onClose:t}){let[n,l]=(0,J.useState)(new Set([`nameplate`,`process`])),u=o({queryKey:i.catalog.modelSchema(e??``),queryFn:()=>a(`/catalog/models/${e}`,r.catalogModelDetail),enabled:e!==null}),d=u.data,f=u.isPending&&!d,p=u.isError,m=K(u.error,`Failed to load model.`);(0,J.useEffect)(()=>{e&&l(new Set([`nameplate`,`process`]))},[e]);let h=(0,J.useMemo)(()=>d?pe(d.members):[],[d]),g=(0,J.useCallback)(e=>{l(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),v=O(),y=d?Object.keys(d.members).length:0,x=d?Object.keys(d.methods).length:0;return(0,Y.jsx)(P,{open:e!==null,onOpenChange:e=>{e||(v.reset(),t())},children:(0,Y.jsx)(z,{side:`right`,className:`flex w-full flex-col gap-4 touch-manipulation`,children:f?null:p&&!d?(0,Y.jsx)(`div`,{className:`flex flex-1 flex-col justify-center px-2`,children:(0,Y.jsx)(s,{message:m,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)(F,{className:`gap-1 pb-0 pe-12`,children:[(0,Y.jsx)(ne,{className:`font-heading text-base uppercase tracking-wide`,children:b(d.name)}),d.description&&(0,Y.jsx)(V,{className:`text-xs leading-relaxed text-foreground/88`,children:d.description}),(0,Y.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,Y.jsxs)(G,{variant:`outline`,className:`font-mono text-xs`,children:[y,` members`]}),(0,Y.jsxs)(G,{variant:`outline`,className:`font-mono text-xs`,children:[x,` methods`]}),(0,Y.jsxs)(G,{variant:`outline`,className:`font-mono text-xs`,children:[d.faults.length,` faults`]}),d.lifecycle&&(0,Y.jsxs)(G,{variant:`outline`,className:`font-mono text-xs text-primary`,children:[d.lifecycle.stages.length,`-stage lifecycle`]}),(0,Y.jsx)(D,{stream:v})]})]}),(0,Y.jsxs)(N,{defaultValue:`overview`,className:`flex min-h-0 flex-1 flex-col gap-1 pt-0`,children:[(0,Y.jsxs)(M,{variant:`line`,className:`h-8! shrink-0 gap-0.5 border-b-border/60 px-2 py-0.5`,children:[(0,Y.jsx)(A,{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)(A,{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)(j,{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-1.5 pb-1 pt-0.5`,children:[h.map(e=>(0,Y.jsx)(X,{sectionKey:e.key,label:e.label,count:e.members.length,icon:e.icon,accentClass:e.accentClass,expanded:n.has(e.key),onToggle:g,children:(0,Y.jsx)(`div`,{className:`flex flex-col gap-1`,children:e.members.map(e=>(0,Y.jsx)(he,{member:e},e.name))})},e.key)),d.faults.length>0&&(0,Y.jsx)(X,{sectionKey:`faults`,label:`Faults`,count:d.faults.length,icon:(0,Y.jsx)(se,{className:`size-3`}),accentClass:`text-warning`,expanded:n.has(`faults`),onToggle:g,children:(0,Y.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:d.faults.map(e=>(0,Y.jsx)(G,{variant:`secondary`,className:`text-[10px] text-warning`,children:_(e)},e))})}),d.lifecycle&&(0,Y.jsx)(X,{sectionKey:`lifecycle`,label:`Lifecycle`,count:d.lifecycle.stages.length,icon:(0,Y.jsx)(ce,{className:`size-3`}),accentClass:`text-primary`,expanded:n.has(`lifecycle`),onToggle:g,children:(0,Y.jsx)(ge,{lifecycle:d.lifecycle})}),x>0&&(0,Y.jsx)(X,{sectionKey:`methods`,label:`Methods`,count:x,icon:(0,Y.jsx)(de,{className:`size-3`}),accentClass:`text-info`,expanded:n.has(`methods`),onToggle:g,children:(0,Y.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:Object.entries(d.methods).map(([e,t])=>(0,Y.jsx)(_e,{name:e,method:t},e))})})]})})})}),(0,Y.jsx)(j,{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)(L,{kind:`model`,id:d.name,displayName:b(d.name),yamlPath:`/catalog/models/${d.name}/yaml`,yamlFilename:`${d.name}.twin.yaml`,stream:v})})})]})]},d.name):(0,Y.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-sm text-muted-foreground`,children:`Model not found`})})})}function X({sectionKey:e,label:t,count:n,icon:r,accentClass:i,expanded:a,onToggle:o,children:s}){return(0,Y.jsxs)(`div`,{className:`rounded-[var(--miravo-radius-tight)] border border-border/50`,children:[(0,Y.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-1.5 px-2.5 py-1.5 text-left text-xs font-medium transition-colors hover:bg-muted/30`,onClick:()=>o(e),children:[(0,Y.jsx)(`span`,{className:i,children:r}),(0,Y.jsx)(`span`,{className:`uppercase tracking-wider`,children:t}),(0,Y.jsx)(G,{variant:`secondary`,className:`ml-auto text-[10px]`,children:n}),(0,Y.jsx)(k,{className:`size-3 text-muted-foreground transition-transform ${a?`rotate-180`:``}`})]}),(0,Y.jsx)(l,{initial:!1,children:a&&(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:`border-t px-2.5 py-1.5`,children:s})},`content`)})]})}function he({member:e}){return(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-0.5 py-0.5 text-xs`,children:[(0,Y.jsx)(`span`,{title:e.name,className:`min-w-0 truncate font-mono text-foreground`,children:y(e.name)}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:e.dataType}),e.unit&&(0,Y.jsx)(G,{variant:`outline`,className:`px-1 py-0 text-[10px]`,children:e.unit}),e.euRange&&(0,Y.jsxs)(`span`,{className:`ml-auto font-mono text-xs text-muted-foreground`,children:[`[`,e.euRange[0],`–`,e.euRange[1],`]`]})]})}var Z={healthy:`bg-success`,normal:`bg-success`,degraded:`bg-warning`,critical:`bg-destructive`,failed:`bg-destructive`};function ge({lifecycle:e}){let t=e.stages.length;return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Y.jsx)(`div`,{className:`flex h-2.5 w-full overflow-hidden rounded-full bg-muted`,children:e.stages.map((e,n)=>(0,Y.jsx)(`div`,{className:`transition-[background-color] ${Z[e]??`bg-chart-1`} ${n===0?`rounded-l-full`:``} ${n===t-1?`rounded-r-full`:``}`,style:{width:`${100/t}%`}},`${e}-${n}`))}),(0,Y.jsx)(`div`,{className:`flex items-center gap-3`,children:e.stages.map((e,t)=>(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs`,children:[(0,Y.jsx)(`span`,{className:`size-2 rounded-full ${Z[e]??`bg-chart-1`}`}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:_(e)})]},`${e}-${t}`))}),(0,Y.jsxs)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:[`~`,v(e.totalHours),` total hours`]})]})}function _e({name:e,method:t}){return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`font-mono text-xs text-foreground`,children:e}),t.inputArguments.length>0&&(0,Y.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`(`,t.inputArguments.map(e=>`${e.name}: ${e.dataType}`).join(`, `),`)`]})]}),t.description&&(0,Y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t.description})]})}var Q=[`builtin`,`personal`];function ve(){let[e,t]=(0,J.useState)(``),[n,_]=(0,J.useState)(`all`),[v,y]=(0,J.useState)({}),[S,w]=(0,J.useState)(null),[T,E]=(0,J.useState)(null),[D,O]=(0,J.useState)(null),k=(0,J.useRef)(null),A=oe();(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(),k.current?.focus())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let j=o({queryKey:i.catalog.models(),queryFn:()=>a(`/catalog/models`,r.catalogModels)}),M=j.data??[],N=j.isPending&&!j.data,P=j.isError&&!j.data,F=j.isError&&!!j.data,I=K(j.error,`Failed to load models.`),L=e=>v[e]??1,ne=(0,J.useCallback)((e,t)=>{y(n=>({...n,[e]:Math.max(1,Math.min(10,t))}))},[]),R=(0,J.useCallback)(e=>{O(e)},[]),z=(0,J.useCallback)(e=>{E(e)},[]),V=async e=>{w(e);try{return await A.mutateAsync({type:`spawn`,model:e,count:L(e)}),!0}catch{return!1}finally{w(null)}},H=(0,J.useMemo)(()=>{let e={all:M.length};for(let t of Q)e[t]=0;for(let t of M){let n=B(t.source);e[n]=(e[n]??0)+1}return e},[M]),U=e.toLowerCase(),W=M.filter(e=>n===`all`||B(e.source)===n).filter(e=>U?e.name.toLowerCase().includes(U)||(e.description?.toLowerCase().includes(U)??!1):!0);return(0,Y.jsxs)(`div`,{className:`@container/models 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:`Asset Model Library`}),(0,Y.jsx)(G,{variant:`outline`,className:`text-xs`,children:P?(0,Y.jsx)(`span`,{className:`text-destructive`,children:`Unavailable`}):N&&M.length===0?(0,Y.jsx)(Y.Fragment,{children:`Loading...`}):(0,Y.jsxs)(Y.Fragment,{children:[M.length,` models`]})})]}),(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Canonical twin models with realistic physics, lifecycle degradation, and fault modes. Inspect to explore schema, copy YAML, or export.`})]}),P&&(0,Y.jsx)(s,{message:I,onRetry:()=>void j.refetch(),isRetrying:j.isFetching}),F&&(0,Y.jsx)(s,{message:`${I} Showing cached models.`,onRetry:()=>void j.refetch(),isRetrying:j.isFetching}),!P&&(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)(ee,{className:`absolute left-2.5 top-2.5 size-4 text-muted-foreground`}),(0,Y.jsx)(x,{ref:k,placeholder:`Filter models...`,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)(be,{value:n,counts:H,onChange:_})]}),(0,Y.jsx)(`div`,{className:`grid grid-cols-1 gap-4 @[720px]/models:grid-cols-2 @[1120px]/models:grid-cols-3`,"aria-busy":N&&!P,children:P?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)(ye,{model:e,count:L(e.name),spawning:S===e.name,onCountChange:ne,onInspect:R,onSpawn:z})},e.name))}),W.length===0&&M.length>0&&(0,Y.jsx)(`p`,{className:`col-span-full py-8 text-center text-sm text-muted-foreground`,children:`No models match the current filters.`})]})}),M.length>0&&(0,Y.jsx)(`div`,{className:C(ie,`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 Models`}),(0,Y.jsx)(`p`,{className:`max-w-xl text-sm leading-relaxed text-muted-foreground`,children:`Publish your custom twin models to the Miravo registry. Discover equipment models from other engineers, fork them, and adapt parameters for your use case.`}),(0,Y.jsx)(`div`,{children:(0,Y.jsx)(G,{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)(te,{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)(f,{open:T!==null,onOpenChange:e=>{e||E(null)},children:(0,Y.jsxs)(m,{children:[(0,Y.jsxs)(p,{children:[(0,Y.jsx)(h,{children:`Spawn instances?`}),(0,Y.jsx)(d,{children:T!==null&&(0,Y.jsxs)(Y.Fragment,{children:[`This spawns `,L(T),` instance`,L(T)===1?``:`s`,` of`,` `,(0,Y.jsx)(`span`,{className:`font-medium text-foreground`,children:b(T)}),` `,`into the running environment.`]})})]}),(0,Y.jsxs)(u,{children:[(0,Y.jsx)(g,{variant:`outline`,disabled:S!==null,onClick:()=>E(null),children:`Cancel`}),(0,Y.jsx)(g,{disabled:S!==null||T===null,onClick:async()=>{T!==null&&await V(T)&&E(null)},children:S===T?`Spawning...`:`Spawn`})]})]})}),(0,Y.jsx)(me,{modelName:D,onClose:()=>O(null)})]})}var ye=(0,J.memo)(function({model:e,count:t,spawning:n,onCountChange:r,onInspect:i,onSpawn:a}){return(0,Y.jsxs)(`div`,{className:C(ae,`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-9 shrink-0 items-center justify-center rounded-[var(--miravo-radius-stadium-sm)] bg-primary/10 text-primary`,children:(0,Y.jsx)(q,{className:`size-4`})}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex flex-col gap-0.5`,children:[(0,Y.jsx)(`span`,{className:`font-heading text-sm font-semibold uppercase tracking-wide`,children:b(e.name)}),e.description&&(0,Y.jsx)(`span`,{className:`line-clamp-2 text-xs leading-relaxed text-muted-foreground`,children:e.description})]})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 font-mono text-[11px] text-muted-foreground`,children:[(0,Y.jsx)($,{label:`mbr`,value:e.memberCount}),(0,Y.jsx)($,{label:`mth`,value:e.methodCount}),(0,Y.jsx)($,{label:`flt`,value:e.faultCount}),e.hasLifecycle&&(0,Y.jsxs)(`span`,{className:`flex items-center gap-1 text-primary`,children:[(0,Y.jsx)(`span`,{className:`text-[10px]`,children:`◈`}),(0,Y.jsxs)(`span`,{children:[e.lifecycleStageCount,`-stage`]})]}),(0,Y.jsx)(G,{variant:`outline`,className:C(`ml-auto shrink-0 font-sans text-[10px] font-medium uppercase tracking-wide`,H(e.source)),children:R(e.source)})]}),(0,Y.jsxs)(`div`,{className:`mt-auto 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)(g,{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.name,t-1)},children:(0,Y.jsx)(I,{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)(g,{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.name,t+1)},children:(0,Y.jsx)(E,{className:`size-3`})})]}),(0,Y.jsxs)(g,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>i(e.name),className:re,children:[(0,Y.jsx)(T,{className:`size-3.5`,"aria-hidden":!0}),`Inspect`]}),(0,Y.jsxs)(g,{size:`sm`,className:`ml-auto`,disabled:n,onClick:()=>a(e.name),children:[(0,Y.jsx)(W,{className:`mr-1 size-3`}),n?`...`:`Spawn`]})]})]})});function $({label:e,value:t}){return(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`span`,{className:`text-foreground`,children:t}),` `,(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:e})]})}function be({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`},...Q.map(e=>({id:e,label:R(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:C(`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:`models-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] text-foreground`,children:a})]},r.id)})})}export{q as n,ve as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./models-CFdqSxB3.js";export{e as ModelsPage};
@@ -0,0 +1 @@
1
+ import{t as e}from"./platforms-BwYPf2Sg.js";export{e as PlatformsPage};