@miravo/cli-linux-arm64-musl 0.7.6 → 0.7.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/console-dist/assets/{api-DPmCeS_C.js → api-CrYvIV3A.js} +1 -1
- package/console-dist/assets/catalog-CMdsHJtX.js +1 -0
- package/console-dist/assets/catalog-DCLloXKb.js +1 -0
- package/console-dist/assets/catalog-source-B3vWR4vX.js +1 -0
- package/console-dist/assets/control-6TWF0ywx.js +1 -0
- package/console-dist/assets/{control-Doh5s9U2.js → control-C_0G31vu.js} +1 -1
- package/console-dist/assets/{events-DAKmlfl3.js → events--facGImw.js} +1 -1
- package/console-dist/assets/events-D7PCqbvy.js +1 -0
- package/console-dist/assets/fleet-DmMO3ebD.js +1 -0
- package/console-dist/assets/{fleet-jLriF31S.js → fleet-anqPXBbM.js} +1 -1
- package/console-dist/assets/{get-error-message-Btp63MTs.js → get-error-message-BgE2BpPG.js} +1 -1
- package/console-dist/assets/index-BNGYKshE.css +2 -0
- package/console-dist/assets/{index-0cZ4jnjm.js → index-Dmyw65xM.js} +3 -3
- package/console-dist/assets/{instance-detail-CDT9PHVw.js → instance-detail-CDK2JYdW.js} +1 -1
- package/console-dist/assets/{login-Cs-sBvVA.js → login-H82N0S2O.js} +1 -1
- package/console-dist/assets/models-B7FNHSvb.js +1 -0
- package/console-dist/assets/models-Bmif9sIG.js +1 -0
- package/console-dist/assets/platforms-DGpl5tPh.js +1 -0
- package/console-dist/assets/platforms-Djfu2pyM.js +1 -0
- package/console-dist/assets/{query-fetch-error-C-7x_NhM.js → query-fetch-error-BWenDoLQ.js} +1 -1
- package/console-dist/assets/{route-preload-cBwnl6Y_.js → route-preload-CLRbqehb.js} +2 -2
- package/console-dist/assets/tags-dBHY56Fz.js +1 -0
- package/console-dist/assets/{tags-KxhNEiLb.js → tags-zenGXuzO.js} +1 -1
- package/console-dist/assets/{transition-nav-link-DVwZxiEL.js → transition-nav-link-BWSxzHUf.js} +1 -1
- package/console-dist/assets/{use-engine-command-mutation-iPA57YyA.js → use-engine-command-mutation-CT_3rCP3.js} +1 -1
- package/console-dist/assets/use-platform-stream-QBU2PAD2.js +2 -0
- package/console-dist/assets/{use-transition-navigate-CUOoK-a_.js → use-transition-navigate-Br9xwrqi.js} +1 -1
- package/console-dist/assets/{validation-XGNj2nVO.js → validation-pFKbjwNg.js} +1 -1
- package/console-dist/index.html +19 -19
- package/miravo +0 -0
- package/package.json +1 -1
- package/console-dist/assets/catalog-CFU1TdO9.js +0 -1
- package/console-dist/assets/catalog-DSNME88V.js +0 -1
- package/console-dist/assets/catalog-source-ChUAD0NL.js +0 -1
- package/console-dist/assets/control-Cl3BCzup.js +0 -1
- package/console-dist/assets/events-9ouwtfN4.js +0 -1
- package/console-dist/assets/fleet-C5IPKrdf.js +0 -1
- package/console-dist/assets/index-D1lU9Fg9.css +0 -2
- package/console-dist/assets/models-D_OCpWPE.js +0 -1
- package/console-dist/assets/models-NVvJNhiz.js +0 -1
- package/console-dist/assets/platforms-BNTV1g6K.js +0 -1
- package/console-dist/assets/platforms-D024zTxj.js +0 -1
- package/console-dist/assets/tags-BTciN0-X.js +0 -1
- package/console-dist/assets/use-platform-stream-8tr6SVec.js +0 -2
|
@@ -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-DPmCeS_C.js";import{i as f,n as p,t as m}from"./query-fetch-error-C-7x_NhM.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-XGNj2nVO.js";import{a as ve,c as L,o as R,t as ye}from"./use-engine-command-mutation-iPA57YyA.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{n as Ce}from"./get-error-message-Btp63MTs.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-CrYvIV3A.js";import{i as f,n as p,t as m}from"./query-fetch-error-BWenDoLQ.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-pFKbjwNg.js";import{a as ve,c as L,o as R,t as ye}from"./use-engine-command-mutation-CT_3rCP3.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{n as Ce}from"./get-error-message-BgE2BpPG.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-
|
|
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-CrYvIV3A.js";import{t as o}from"./use-transition-navigate-Br9xwrqi.js";import{t as s}from"./transition-nav-link-BWSxzHUf.js";import{n as c}from"./get-error-message-BgE2BpPG.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); }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{at as n}from"./vendor-ui-CWUk2ulb.js";import{S as r,b as i,o as a}from"./api-CrYvIV3A.js";import{i as o,t as s}from"./query-fetch-error-BWenDoLQ.js";import{t as c}from"./proxy-Be4WzmcS.js";import{t as l}from"./AnimatePresence-CPmH1DMY.js";import{a as u,i as d,l as f,n as p,o as m,r as h,s as g}from"./copy-button-BvU3RDZa.js";import{S as _,g as v,l as y,s as b,u as x,x as S}from"./format-CshN6yEB.js";import{n as C,t as w}from"./utils-XFKvwlFT.js";import{t as T}from"./activity-Cy_niK56.js";import{F as E,M as ee,N as D,n as O,t as k}from"./use-platform-stream-QBU2PAD2.js";import{l as A}from"./select-CmlY1M1a.js";import{i as j,n as M,r as N,t as P}from"./tabs-4SeH2unv.js";import{r as te}from"./checkbox-C_4HRnS_.js";import{a as ne,c as F,d as I,i as L,l as R,n as z,o as B,r as V,s as H,t as U,u as W}from"./catalog-source-B3vWR4vX.js";import{c as re,n as ie,r as ae,s as oe,t as se}from"./use-engine-command-mutation-CT_3rCP3.js";import{t as ce}from"./triangle-alert-BXrJNk3g.js";import{t as G}from"./badge-eIn_7YrK.js";import{n as K}from"./get-error-message-BgE2BpPG.js";var q=C(`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`}]]),le=C(`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`}]]),ue=C(`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`}]]),de=C(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),fe=C(`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(),pe=new Set([`fault_active`,`fault_count`,`active_fault_code`,`lifecycle_stage`,`health_state`,`availability_state`]);function me(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};pe.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)(W,{className:`size-3`}),members:t,accentClass:`text-muted-foreground`}),n.length>0&&a.push({key:`commands`,label:`Commands`,icon:(0,Y.jsx)(de,{className:`size-3`}),members:n,accentClass:`text-info`}),r.length>0&&a.push({key:`process`,label:`Process Tags`,icon:(0,Y.jsx)(T,{className:`size-3`}),members:r,accentClass:`text-primary`}),i.length>0&&a.push({key:`health`,label:`Health & Status`,icon:(0,Y.jsx)(ue,{className:`size-3`}),members:i,accentClass:`text-success`}),a}function he({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,p=u.isPending&&!d,m=u.isError,h=K(u.error,`Failed to load model.`);(0,J.useEffect)(()=>{e&&l(new Set([`nameplate`,`process`]))},[e]);let g=(0,J.useMemo)(()=>d?me(d.members):[],[d]),_=(0,J.useCallback)(e=>{l(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),y=k(),b=y.status===`running`,S=d?Object.keys(d.members).length:0,C=d?Object.keys(d.methods).length:0;return(0,Y.jsx)(ne,{open:e!==null,onOpenChange:e=>{if(!e){if(b){f.message(`Deploy still running. Cancel it or wait before closing.`);return}y.reset(),t()}},children:(0,Y.jsx)(B,{side:`right`,showCloseButton:!b,className:`flex w-full flex-col gap-4 touch-manipulation`,children:p?null:m&&!d?(0,Y.jsx)(`div`,{className:`flex flex-1 flex-col justify-center px-2`,children:(0,Y.jsx)(s,{message:h,onRetry:()=>void u.refetch(),isRetrying:u.isFetching})}):d?(0,Y.jsxs)(c.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.18},className:`flex min-h-0 flex-1 flex-col gap-4`,children:[(0,Y.jsxs)(F,{className:`gap-1 pb-0 pe-12`,children:[(0,Y.jsx)(R,{className:`font-heading text-base uppercase tracking-wide`,children:x(d.name)}),d.description&&(0,Y.jsx)(H,{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:[S,` members`]}),(0,Y.jsxs)(G,{variant:`outline`,className:`font-mono text-xs`,children:[C,` 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)(O,{stream:y})]})]}),(0,Y.jsxs)(P,{defaultValue:`overview`,className:`flex min-h-0 flex-1 flex-col gap-1 pt-0`,children:[(0,Y.jsxs)(N,{variant:`line`,className:`h-8! shrink-0 gap-0.5 border-b-border/60 px-2 py-0.5`,children:[(0,Y.jsx)(j,{value:`overview`,className:`min-h-10 px-2 py-1 text-xs text-foreground/82 after:bottom-[-3px] data-active:text-foreground sm:min-h-0 sm:px-2.5 sm:py-1`,children:`Overview`}),(0,Y.jsx)(j,{value:`deploy`,className:`min-h-10 px-2 py-1 text-xs text-foreground/82 after:bottom-[-3px] data-active:text-foreground sm:min-h-0 sm:px-2.5 sm:py-1`,children:`Deploy`})]}),(0,Y.jsx)(M,{value:`overview`,keepMounted:!0,className:`flex min-h-0 flex-1 flex-col`,children:(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col px-3 pt-0`,children:(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto pr-2`,children:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1.5 pb-1 pt-0.5`,children:[g.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:_,children:(0,Y.jsx)(`div`,{className:`flex flex-col gap-1`,children:e.members.map(e=>(0,Y.jsx)(ge,{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)(ce,{className:`size-3`}),accentClass:`text-warning`,expanded:n.has(`faults`),onToggle:_,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:v(e)},e))})}),d.lifecycle&&(0,Y.jsx)(X,{sectionKey:`lifecycle`,label:`Lifecycle`,count:d.lifecycle.stages.length,icon:(0,Y.jsx)(le,{className:`size-3`}),accentClass:`text-primary`,expanded:n.has(`lifecycle`),onToggle:_,children:(0,Y.jsx)(_e,{lifecycle:d.lifecycle})}),C>0&&(0,Y.jsx)(X,{sectionKey:`methods`,label:`Methods`,count:C,icon:(0,Y.jsx)(fe,{className:`size-3`}),accentClass:`text-info`,expanded:n.has(`methods`),onToggle:_,children:(0,Y.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:Object.entries(d.methods).map(([e,t])=>(0,Y.jsx)(ve,{name:e,method:t},e))})})]})})})}),(0,Y.jsx)(M,{value:`deploy`,keepMounted:!0,className:`flex min-h-0 flex-1 flex-col`,children:(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col px-3 pt-0`,children:(0,Y.jsx)(L,{kind:`model`,id:d.name,displayName:x(d.name),yamlPath:`/catalog/models/${d.name}/yaml`,yamlFilename:`${d.name}.twin.yaml`,stream:y})})})]})]},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)(A,{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 ge({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:b(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 _e({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:v(e)})]},`${e}-${t}`))}),(0,Y.jsxs)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:[`~`,y(e.totalHours),` total hours`]})]})}function ve({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 ye(){let[e,t]=(0,J.useState)(``),[n,f]=(0,J.useState)(`all`),[v,y]=(0,J.useState)({}),[b,C]=(0,J.useState)(null),[T,E]=(0,J.useState)(null),[D,O]=(0,J.useState)(null),k=(0,J.useRef)(null),A=se();(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,ne=j.isError&&!!j.data,F=K(j.error,`Failed to load models.`),I=e=>v[e]??1,L=(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)},[]),B=async e=>{C(e);try{return await A.mutateAsync({type:`spawn`,model:e,count:I(e)}),!0}catch{return!1}finally{C(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=V(t.source);e[n]=(e[n]??0)+1}return e},[M]),U=e.toLowerCase(),W=M.filter(e=>n===`all`||V(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:F,onRetry:()=>void j.refetch(),isRetrying:j.isFetching}),ne&&(0,Y.jsx)(s,{message:`${F} 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)(S,{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)(xe,{value:n,counts:H,onChange:f})]}),(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)(be,{model:e,count:I(e.name),spawning:b===e.name,onCountChange:L,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:w(ae,`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)(p,{open:T!==null,onOpenChange:e=>{e||E(null)},children:(0,Y.jsxs)(h,{children:[(0,Y.jsxs)(m,{children:[(0,Y.jsx)(g,{children:`Spawn instances?`}),(0,Y.jsx)(d,{children:T!==null&&(0,Y.jsxs)(Y.Fragment,{children:[`This spawns `,I(T),` instance`,I(T)===1?``:`s`,` of`,` `,(0,Y.jsx)(`span`,{className:`font-medium text-foreground`,children:x(T)}),` `,`into the running environment.`]})})]}),(0,Y.jsxs)(u,{children:[(0,Y.jsx)(_,{variant:`outline`,disabled:b!==null,onClick:()=>E(null),children:`Cancel`}),(0,Y.jsx)(_,{disabled:b!==null||T===null,onClick:async()=>{T!==null&&await B(T)&&E(null)},children:b===T?`Spawning...`:`Spawn`})]})]})}),(0,Y.jsx)(he,{modelName:D,onClose:()=>O(null)})]})}var be=(0,J.memo)(function({model:e,count:t,spawning:n,onCountChange:r,onInspect:i,onSpawn:a}){return(0,Y.jsxs)(`div`,{className:w(oe,`flex flex-col gap-4 p-5`),children:[(0,Y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Y.jsx)(`div`,{className:`flex size-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:x(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:w(`ml-auto shrink-0 font-sans text-[10px] font-medium uppercase tracking-wide`,U(e.source)),children:z(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)(_,{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)(_,{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)(D,{className:`size-3`})})]}),(0,Y.jsxs)(_,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>i(e.name),className:ie,children:[(0,Y.jsx)(E,{className:`size-3.5`,"aria-hidden":!0}),`Inspect`]}),(0,Y.jsxs)(_,{size:`sm`,className:`ml-auto`,disabled:n,onClick:()=>a(e.name),children:[(0,Y.jsx)(re,{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 xe({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:z(e)}))].map(r=>{let i=e===r.id,a=t[r.id]??0,o=r.id!==`all`&&a===0;return(0,Y.jsxs)(`label`,{className:w(`inline-flex h-7 items-center gap-1.5 rounded-[var(--miravo-radius-pill)] border px-3 text-xs font-medium transition-colors`,i?`border-primary/60 bg-primary/15 text-primary`:`border-border/60 bg-card/30 text-muted-foreground hover:border-border hover:bg-muted/40 hover:text-foreground`,o?`cursor-not-allowed opacity-40 hover:border-border/60 hover:bg-card/30 hover:text-muted-foreground`:`cursor-pointer`),children:[(0,Y.jsx)(`input`,{type:`radio`,name:`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,ye as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./models-B7FNHSvb.js";export{e as ModelsPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{at as n}from"./vendor-ui-CWUk2ulb.js";import{Q as r,S as i,X as a,Z as o,b as s,o as c,x as l}from"./api-CrYvIV3A.js";import{a as u,c as d,i as f,r as p,t as m}from"./query-fetch-error-BWenDoLQ.js";import{t as h}from"./proxy-Be4WzmcS.js";import{t as g}from"./AnimatePresence-CPmH1DMY.js";import{i as _,r as v}from"./dist-xY0pK9Wy.js";import{n as y}from"./chunk-OE4NN4TA-DBWZidbW.js";import{a as b,i as x,l as S,n as C,o as w,r as ee,s as T,t as E}from"./copy-button-BvU3RDZa.js";import{C as D,S as O,m as k,o as A,u as j,w as M,x as N}from"./format-CshN6yEB.js";import{n as P,t as F}from"./utils-XFKvwlFT.js";import{t as I}from"./activity-Cy_niK56.js";import{t as L}from"./arrow-right-BjBb4z7g.js";import{A as R,C as te,D as z,M as ne,N as B,O as V,P as re,S as ie,_ as ae,a as oe,b as H,c as U,d as se,f as ce,g as le,h as ue,i as de,j as W,l as fe,m as pe,n as me,o as G,p as he,r as ge,s as _e,t as ve,u as ye,x as be,y as xe}from"./use-platform-stream-QBU2PAD2.js";import{n as Se,t as Ce}from"./catalog-template-icons-3S8RvUxD.js";import{c as we,i as K,l as Te,n as Ee,s as De,t as Oe}from"./select-CmlY1M1a.js";import{a as ke,i as Ae,r as q}from"./platform-targets-BIQ1lKOg.js";import{c as je,i as Me,n as Ne,o as Pe,r as Fe,s as Ie,t as Le}from"./tabs-4SeH2unv.js";import{i as Re,n as J,r as ze,t as Be}from"./checkbox-C_4HRnS_.js";import{t as Ve}from"./layers-1figUpjG.js";import{t as He}from"./triangle-alert-BXrJNk3g.js";import{i as Ue,n as We,t as Ge}from"./tooltip-D1ydB4g3.js";import{t as Ke}from"./badge-eIn_7YrK.js";import{a as qe,i as Je,n as Ye,o as Xe,r as Ze,s as Qe,t as $e}from"./dropdown-menu-CrPXVXpG.js";import{t as et}from"./label-CMBWxUhA.js";import{n as Y,t as tt}from"./get-error-message-BgE2BpPG.js";var nt=class extends d{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:r()})}getOptimisticResult(e){return e.behavior=r(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:s,isError:c,isRefetchError:l}=r,u=n.fetchMeta?.fetchMore?.direction,d=c&&u===`forward`,f=i&&u===`forward`,p=c&&u===`backward`,m=i&&u===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:a(t,n.data),hasPreviousPage:o(t,n.data),isFetchNextPageError:d,isFetchingNextPage:f,isFetchPreviousPageError:p,isFetchingPreviousPage:m,isRefetchError:l&&!d&&!p,isRefetching:s&&!f&&!m}}};function rt(e,t){return u(e,nt,t)}var it=P(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]),at=P(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),ot=P(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),st=P(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),X=e(t(),1),Z=n(),ct=`rounded-(--miravo-radius-stadium-sm) border border-dashed border-border/55 bg-muted/10`;function lt(){return(0,Z.jsx)(`p`,{className:`mt-2 text-pretty text-sm leading-relaxed text-muted-foreground`,children:`Add a target to get started.`})}function ut({onClick:e}){return(0,Z.jsxs)(O,{type:`button`,size:`sm`,className:`h-7 shrink-0 gap-1.5 text-xs`,onClick:e,children:[(0,Z.jsx)(B,{className:`size-3.5`,"aria-hidden":!0}),`Add Target`]})}function dt({titleId:e,frameIcon:t,description:n,children:r}){return(0,Z.jsx)(`section`,{"aria-labelledby":e,className:ct,children:(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-4 px-4 py-10 text-center`,children:[(0,Z.jsx)(`div`,{className:`flex size-12 items-center justify-center rounded-(--miravo-radius-stadium-sm) border border-dashed border-border/50`,children:t}),(0,Z.jsxs)(`div`,{className:`max-w-sm`,children:[(0,Z.jsx)(`h2`,{id:e,className:`font-heading text-sm font-semibold tracking-tight text-foreground`,children:`No targets yet`}),n]}),r]})})}function ft({stream:e,onReset:t,catalogTemplates:n}){if(!e.operation&&e.status!==`running`)return null;let{title:r,subtitle:i}=ie(e),a=e.status===`complete`,o=e.status===`error`,s=e.status===`running`,c=a||o,l=e.cancelRequested;async function u(){await e.cancel().catch(()=>{})}return(0,Z.jsx)(le,{title:r,subtitle:i,canDismiss:!s,footerAction:s&&e.operation?.operationId?(0,Z.jsx)(`div`,{className:`ml-auto shrink-0`,children:(0,Z.jsx)(`button`,{type:`button`,onClick:u,disabled:l,"aria-busy":l,className:F(D({variant:`outline`,size:`sm`}),`group h-8 gap-1.5 px-3 text-xs`,l?`cursor-not-allowed`:`hover:bg-destructive/12 hover:text-destructive hover:border-destructive/35`),children:l?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Pe,{className:`size-3.5 shrink-0 animate-spin text-muted-foreground`,"aria-hidden":!0}),(0,Z.jsx)(h.span,{animate:{opacity:[1,.72,1]},transition:{duration:1.25,repeat:1/0,ease:`easeInOut`},className:`font-medium text-foreground`,children:`Cancelling…`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(M,{className:`size-3.5 shrink-0 text-foreground/65 group-hover:text-destructive`,"aria-hidden":!0}),(0,Z.jsx)(h.span,{animate:{opacity:[1,.88,1]},transition:{duration:2.2,repeat:1/0,ease:`easeInOut`},children:`Cancel`})]})})}):c?(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-1.5`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 w-full flex-1 flex-wrap items-center justify-between gap-x-3 gap-y-1`,children:[(0,Z.jsxs)(y,{to:`/platforms?tab=activity`,className:F(D({variant:`ghost`,size:`xs`}),`group inline-flex h-6 shrink-0 items-center gap-1.5 px-2 text-[11px] font-medium text-foreground/80`,`hover:bg-primary/12 hover:text-primary`),children:[(0,Z.jsx)(I,{className:`size-3 shrink-0 text-foreground/70 group-hover:text-primary`,"aria-hidden":!0}),`View full activity`,(0,Z.jsx)(ke,{className:`size-2.5 shrink-0 text-foreground/50 group-hover:text-primary`,"aria-hidden":!0})]}),(0,Z.jsx)(`div`,{className:`flex shrink-0 items-center`,children:(0,Z.jsx)(O,{type:`button`,variant:`secondary`,size:`xs`,className:`h-6 px-2.5 text-[11px] font-medium`,onClick:t,children:`Close`})})]}),e.operation?.status===`cancelled`||o&&e.operation?(0,Z.jsx)(H,{type:e.operation.type,errorMessage:e.operation.error,className:`mt-2.5 w-full min-w-0`}):null]}):void 0,onDismiss:t,children:e.operation?(0,Z.jsx)(xe,{operation:e.operation,catalogTemplates:n,logs:e.logs}):(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2 py-1`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(Pe,{className:`size-3.5 animate-spin text-primary`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`text-xs text-foreground/78`,children:`Connecting to Litmus Edge…`})]}),(0,Z.jsx)(`div`,{className:`h-1 w-full overflow-hidden rounded-full bg-muted/55`,children:(0,Z.jsx)(h.div,{className:`h-full w-2/5 rounded-full bg-primary`,animate:{x:[`-100%`,`250%`]},transition:{duration:1.2,repeat:1/0,ease:`easeInOut`}})})]})})}var pt=`miravo:platforms:recent-template-ids`,mt=8,ht=`miravo:platforms:last-target-id`;function gt(){if(typeof window>`u`)return[];try{let e=window.localStorage.getItem(pt),t=e?JSON.parse(e):[];return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}function _t(e){if(typeof window>`u`)return;let t=[e,...gt().filter(t=>t!==e)].slice(0,mt);try{window.localStorage.setItem(pt,JSON.stringify(t))}catch{}}function vt(){if(!(typeof window>`u`))try{return window.localStorage.getItem(ht)??void 0}catch{return}}function yt(e){if(!(typeof window>`u`))try{window.localStorage.setItem(ht,e)}catch{}}var bt=50;function xt({open:e,type:t,targetLabel:n,targetHostname:r,templates:i,templatesLoading:a,templatesError:o,onRetryTemplates:s,onOpenChange:c,onSelect:l}){let[u,d]=(0,X.useState)(``),[f,p]=(0,X.useState)(gt),m=(0,X.useDeferredValue)(u);(0,X.useEffect)(()=>{e&&(d(``),p(gt()))},[e]);let h=(0,X.useMemo)(()=>{let e=m.trim().toLowerCase(),t=new Map(f.map((e,t)=>[e,t])),n=[],r=new Set;for(let t of i){if(r.has(t.id))continue;r.add(t.id);let i=[t.name,t.id,t.category,t.description??``,t.models.join(` `)].join(` `).toLowerCase();e!==``&&!i.includes(e)||n.push(t)}return n.sort((e,n)=>{let r=t.get(e.id)??1/0,i=t.get(n.id)??1/0;return r===i?e.name.localeCompare(n.name):r-i}),{items:n.slice(0,bt),total:n.length,recentRank:t}},[i,m,f]),g=t===`apply`?`Apply environment`:`Cleanup environment`,_=e=>{_t(e.id),l(e)};return(0,Z.jsx)(C,{open:e,onOpenChange:c,children:(0,Z.jsxs)(ee,{className:`flex max-h-[82vh] min-h-0 flex-col gap-0 overflow-hidden p-0 sm:max-w-xl`,children:[(0,Z.jsxs)(`div`,{className:`shrink-0 border-b border-border/60 px-5 pb-3 pt-5`,children:[(0,Z.jsx)(T,{className:`text-sm font-semibold`,children:g}),(0,Z.jsxs)(x,{className:`mt-1 text-xs`,children:[n,` / `,r]})]}),(0,Z.jsx)(`div`,{className:`shrink-0 border-b border-border/45 px-5 py-3`,children:(0,Z.jsxs)(`div`,{className:`relative`,children:[(0,Z.jsx)(ne,{className:`pointer-events-none absolute left-2.5 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground`,"aria-hidden":!0}),(0,Z.jsx)(N,{value:u,onChange:e=>d(e.currentTarget.value),className:`h-9 pl-8`,placeholder:`Search environments`,autoFocus:!0})]})}),(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-3 py-3`,children:a&&i.length===0?(0,Z.jsx)(`div`,{className:`rounded-[var(--miravo-radius-tight)] border border-border/50 px-3 py-2 text-xs text-muted-foreground`,children:`Loading environments...`}):o&&i.length===0?(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-[var(--miravo-radius-tight)] border border-warning/25 bg-warning/5 px-3 py-2 text-xs text-warning`,children:[(0,Z.jsx)(`span`,{children:`Could not load environments.`}),(0,Z.jsx)(O,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 text-warning hover:text-warning`,onClick:s,children:`Retry`})]}):h.items.length===0?(0,Z.jsx)(`div`,{className:`rounded-[var(--miravo-radius-tight)] border border-border/50 px-3 py-2 text-xs text-muted-foreground`,children:`No matching environments.`}):(0,Z.jsx)(`div`,{className:`flex flex-col gap-1`,children:h.items.map(e=>{let t=h.recentRank.has(e.id);return(0,Z.jsxs)(`button`,{type:`button`,className:`flex min-h-12 w-full min-w-0 items-center gap-2 rounded-[var(--miravo-radius-tight)] px-2 py-2 text-left text-xs transition-colors hover:bg-muted/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/70`,onClick:()=>_(e),children:[(0,Z.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-[var(--miravo-radius-tight)] border border-border/35 bg-muted/25 text-primary`,children:(0,Z.jsx)(Ce,{id:e.id,className:`size-3.5`})}),(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`truncate font-medium text-foreground`,children:e.name}),t?(0,Z.jsx)(`span`,{className:`shrink-0 rounded-[var(--miravo-radius-tight)] border border-primary/25 bg-primary/8 px-1.5 py-px font-mono text-[9px] uppercase tracking-wider text-primary`,children:`Recent`}):null]}),(0,Z.jsxs)(`span`,{className:`mt-0.5 block truncate font-mono text-[11px] text-muted-foreground`,children:[e.id,` / `,e.instanceCount,` instances`]})]})]},e.id)})})}),h.total>h.items.length?(0,Z.jsxs)(`div`,{className:`shrink-0 border-t border-border/45 px-5 py-2 text-[11px] text-muted-foreground`,children:[`Showing `,h.items.length,` of `,h.total,`. Refine search.`]}):null]})})}function St({targets:e,stream:t}){let[n,r]=(0,X.useState)(`apply`),[a,o]=(0,X.useState)(``),[l,u]=(0,X.useState)(``),[d,p]=(0,X.useState)(!1),[g,_]=(0,X.useState)(null),[v,y]=(0,X.useState)(!1),[b,x]=(0,X.useState)(!1),[C,w]=(0,X.useState)(!1),[ee]=(0,X.useState)(vt),T=(0,X.useRef)(0),E=(0,X.useRef)(null),D=t.status===`running`,k=n===`apply`,A=f({queryKey:s.catalog.templates(),queryFn:()=>c(`/catalog/templates`,i.catalogTemplates)}),j=A.data??[],N=j.find(e=>e.id===l),P=e.find(e=>e.id===a),I=k?!!a&&!!l:!!a&&(d||!!l),L=(0,X.useCallback)(()=>{T.current+=1,E.current?.abort(),E.current=null,y(!1),_(null)},[]);(0,X.useEffect)(()=>{if(!(l||j.length===0||d))for(let e of gt()){let t=j.find(t=>t.id===e);if(t){u(t.id);return}}},[l,j,d]);let ne=(0,X.useCallback)(()=>{L(),S.message(`Preview cancelled`)},[L]),B=e=>{D||(r(e),L(),p(!1))},re=(0,X.useCallback)(async(e,n)=>{if(e===`apply`){if(!a||!l)return}else if(!a||!d&&!l)return;t.operation&&t.status!==`running`&&t.reset(),E.current?.abort(),T.current+=1;let r=T.current,i=new AbortController;E.current=i,y(!0),_(null);try{let t=e===`apply`?await ce(z({targetId:a,template:l,result:n}),{signal:i.signal}):await se(V({targetId:a,template:l,allManaged:d,result:n}),{signal:i.signal});if(r!==T.current)return;_(t.plan)}catch(t){if(r!==T.current||oe(t))return;let n=Y(t,e===`apply`?`Plan failed`:`Cleanup plan failed`),i=tt(t);S.error(n,i?{description:i}:void 0)}finally{r===T.current&&y(!1)}},[a,l,d,t]),ie=(0,X.useCallback)(e=>{x(!1),L(),yt(a),l&&_t(l),n===`apply`?t.startApply(z({targetId:a,template:l,result:e})):t.startCleanup(V({targetId:a,template:l,allManaged:d,result:e}))},[n,a,l,d,t,L]),H=!k&&d,U=I&&!D,le=k?ze:W,ue=`Awaiting selection`;U&&(ue=k?`Review apply`:`Review cleanup`);let fe=H?`All managed resources`:N?.name??`Select environment`,G=(0,Z.jsx)(Ve,{className:`size-3.5`,"aria-hidden":!0});H?G=(0,Z.jsx)(W,{className:`size-3.5`,"aria-hidden":!0}):N&&(G=(0,Z.jsx)(Ce,{id:N.id,className:`size-3.5`}));let he=k?`Provisions devices, tags, and Digital Twin models from the selected environment on the selected target.`:`Removes Miravo-managed resources for this environment from the selected target.`;H&&(he=`Removes all Miravo-managed resources from the target (ignores environment scope).`);let _e=P?`${P.label} / ${fe}`:`Select target and environment`;return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,Z.jsxs)(`div`,{role:`toolbar`,"aria-label":`Operation mode`,className:`inline-flex items-center gap-0.5 rounded-[var(--miravo-radius-pill)] border border-border/50 bg-muted/15 p-0.5`,children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-pressed":k,className:F(`relative flex items-center gap-1.5 rounded-[var(--miravo-radius-pill)] px-4 py-1.5 text-xs font-medium transition-colors`,k?`text-primary`:`text-muted-foreground hover:text-foreground`),onClick:()=>B(`apply`),disabled:D,children:[k&&(0,Z.jsx)(h.span,{layoutId:`mode-pill`,className:`absolute inset-0 rounded-[var(--miravo-radius-pill)] bg-primary/15 shadow-sm`,transition:{type:`spring`,stiffness:500,damping:40}}),(0,Z.jsx)(st,{className:`relative z-10 size-3.5`}),(0,Z.jsx)(`span`,{className:`relative z-10`,children:`Apply`})]}),(0,Z.jsxs)(`button`,{type:`button`,"aria-pressed":!k,className:F(`relative flex items-center gap-1.5 rounded-[var(--miravo-radius-pill)] px-4 py-1.5 text-xs font-medium transition-colors`,k?`text-muted-foreground hover:text-foreground`:`text-destructive`),onClick:()=>B(`cleanup`),disabled:D,children:[!k&&(0,Z.jsx)(h.span,{layoutId:`mode-pill`,className:`absolute inset-0 rounded-[var(--miravo-radius-pill)] bg-destructive/15 shadow-sm`,transition:{type:`spring`,stiffness:500,damping:40}}),(0,Z.jsx)(W,{className:`relative z-10 size-3.5`}),(0,Z.jsx)(`span`,{className:`relative z-10`,children:`Cleanup`})]})]}),(0,Z.jsx)(me,{stream:t})]}),(0,Z.jsx)(ae,{children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3.5`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start gap-3 border-b border-border/25 pb-3`,children:[(0,Z.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-[var(--miravo-radius-stadium-sm)] border border-primary/25 bg-primary/9 shadow-[inset_0_1px_0_0_var(--miravo-inset-highlight)]`,children:(0,Z.jsx)(Ve,{className:`size-4 text-primary`,"aria-hidden":!0})}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`p`,{className:`font-heading text-[11px] font-semibold uppercase tracking-[0.12em] text-foreground`,children:`Litmus Edge`}),(0,Z.jsx)(`p`,{className:`mt-0.5 text-[11px] leading-relaxed text-muted-foreground`,children:he})]})]}),(0,Z.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(et,{className:`font-heading text-[11px] font-medium uppercase tracking-[0.14em] text-muted-foreground`,children:`Target`}),(0,Z.jsx)(pe,{targets:e,value:a,onValueChange:e=>{o(e),yt(e),L()},preferredTargetId:ee,disabled:D,size:`sm`,className:`min-w-0 w-full text-xs`})]}),(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(et,{className:`font-heading text-[11px] font-medium uppercase tracking-[0.14em] text-muted-foreground`,children:`Environment`}),A.isError&&!A.data&&(0,Z.jsx)(m,{message:Y(A.error,`Failed to load environments.`),onRetry:()=>void A.refetch(),isRetrying:A.isFetching&&!A.isPending}),(0,Z.jsxs)(`button`,{type:`button`,disabled:H||D||!P,onClick:()=>w(!0),className:F(`flex h-9 min-h-9 w-full min-w-0 items-center justify-between gap-1.5 rounded-[var(--miravo-radius-stadium-sm)] border border-input bg-input/30 px-2.5 py-0 text-left text-xs outline-none transition-colors select-none`,`hover:bg-input/50 focus-visible:border-primary/35 focus-visible:ring-2 focus-visible:ring-primary/22`,`disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50`),"aria-label":`Environment`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`flex size-7 shrink-0 items-center justify-center rounded-[var(--miravo-radius-stadium-sm)] border border-border/35 bg-muted/25 text-primary`,children:G}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium text-foreground`,children:fe})]}),(0,Z.jsx)(Te,{className:`pointer-events-none size-4 shrink-0 text-muted-foreground`,"aria-hidden":!0})]})]})]}),(0,Z.jsxs)(`button`,{type:`button`,disabled:!U||v,onClick:()=>x(!0),className:F(`group flex w-full min-h-14 min-w-0 items-stretch overflow-hidden rounded-[var(--miravo-radius-stadium-lg)] text-left outline-none`,`transition-[border-color,box-shadow,background-color] duration-200 ease-out`,`focus-visible:ring-2 focus-visible:ring-ring/70 focus-visible:ring-offset-2 focus-visible:ring-offset-background`,`disabled:pointer-events-none disabled:opacity-55`,U?[`border-2 border-primary/40 bg-background`,`bg-linear-to-r from-primary/12 via-background to-background`,`shadow-[inset_0_1px_0_0_rgba(255,255,255,0.025)]`,`hover:border-primary/56 hover:shadow-[inset_0_1px_0_0_rgba(255,255,255,0.025),0_0_14px_-8px_color-mix(in_srgb,var(--primary)_18%,transparent),0_0_22px_-12px_color-mix(in_srgb,var(--primary)_8%,transparent)]`]:[`border border-dashed border-border/65 bg-muted/15`,`hover:bg-muted/22`]),children:[(0,Z.jsx)(`span`,{className:`relative flex w-18 shrink-0 items-center justify-center bg-transparent`,"aria-hidden":!0,children:(0,Z.jsx)(le,{className:F(`relative size-5`,U?`text-primary`:`text-muted-foreground`)})}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col justify-center gap-0.5 overflow-hidden px-3 py-2.5 sm:px-4`,children:[(0,Z.jsx)(`span`,{className:F(`font-heading text-[11px] font-semibold uppercase tracking-[0.18em]`,U?`text-primary`:`text-muted-foreground`),children:ue}),(0,Z.jsx)(`span`,{className:F(`truncate font-mono text-[13px] leading-tight tracking-tight`,U?`text-foreground`:`text-muted-foreground`),children:_e})]}),(0,Z.jsx)(`span`,{className:F(`flex shrink-0 items-center pr-2.5 sm:pr-3`,U&&`pl-1`),children:(0,Z.jsx)(`span`,{className:F(`flex size-9 items-center justify-center rounded-[var(--miravo-radius-stadium-sm)] border bg-transparent transition-[border-color,color] duration-200`,U?`border-primary/40 text-primary group-hover:border-primary/55`:`border-border/45 text-muted-foreground`),"aria-hidden":!0,children:(0,Z.jsx)(ke,{className:`size-4`,strokeWidth:2.25})})})]}),!k&&(0,Z.jsx)(`div`,{className:`flex w-full min-w-0 flex-wrap items-center justify-end gap-2`,children:(0,Z.jsxs)(et,{id:`all-managed-label`,htmlFor:`all-managed`,"aria-disabled":D,className:F(`inline-flex h-8 w-fit max-w-full cursor-pointer items-center gap-2 text-xs font-medium leading-none`,D&&`pointer-events-none opacity-40`),children:[(0,Z.jsx)(Be,{id:`all-managed`,checked:d,onCheckedChange:e=>{p(e===!0),L()},disabled:D}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:`Remove all Miravo managed resources`})]})})]})}),(v||g)&&!D&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[v&&(0,Z.jsx)(`div`,{className:`flex w-full min-w-0 flex-wrap items-center justify-end gap-2`,children:(0,Z.jsxs)(O,{type:`button`,variant:`ghost`,size:`sm`,className:`h-8 shrink-0 gap-1.5 px-2 text-xs text-muted-foreground hover:text-foreground`,onClick:ne,children:[(0,Z.jsx)(M,{className:`size-3.5`,"aria-hidden":!0}),`Cancel preview`]})}),v&&(0,Z.jsx)(de,{}),g&&!v&&(0,Z.jsx)(ge,{plan:g,planKind:k?`apply`:`cleanup`,onCloseTable:L})]}),P&&C?(0,Z.jsx)(xt,{open:!0,type:n,targetLabel:P.label,targetHostname:P.hostname,templates:j,templatesLoading:A.isPending&&A.data===void 0,templatesError:A.isError&&j.length===0,onRetryTemplates:()=>void A.refetch(),onOpenChange:w,onSelect:e=>{u(e.id),_t(e.id),p(!1),L(),k&&t.reset(),w(!1)}}):null,P&&(0,Z.jsx)(te,{open:b,onOpenChange:x,type:n,label:H?`All managed resources`:N?.name??l,targetLabel:P.label,hostname:P.hostname,sourceHostname:P.sourceHostname,onConfirm:ie,metadata:R,applyPreview:k?{onPreview:e=>void re(`apply`,e),planLoading:v,disabled:!a||!l||D}:void 0,cleanupPreview:k?void 0:{onPreview:e=>void re(`cleanup`,e),planLoading:v,disabled:!a||!d&&!l||D}})]})}function Ct(){return(0,Z.jsx)(`section`,{"aria-labelledby":`platforms-operation-log-empty-title`,className:ct,children:(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-4 px-4 py-8 text-center sm:py-10`,children:[(0,Z.jsx)(`div`,{className:`flex size-12 items-center justify-center rounded-(--miravo-radius-stadium-sm) border border-dashed border-border/50`,children:(0,Z.jsx)(I,{className:`size-6 text-muted-foreground/45`,"aria-hidden":!0})}),(0,Z.jsxs)(`div`,{className:`max-w-sm`,children:[(0,Z.jsx)(`h2`,{id:`platforms-operation-log-empty-title`,className:`font-heading text-sm font-semibold tracking-tight text-foreground`,children:`No operations yet`}),(0,Z.jsx)(`p`,{className:`mt-2 text-pretty text-sm leading-relaxed text-muted-foreground`,children:`Run apply or cleanup from the Operations tab. Finished runs show up here with full detail.`})]})]})})}function wt(e){let t=new Date(e),n=new Date,r=new Date(n);return r.setDate(n.getDate()-1),t.toDateString()===n.toDateString()?`Today`:t.toDateString()===r.toDateString()?`Yesterday`:t.toLocaleDateString(`en-US`,{weekday:`short`,month:`short`,day:`numeric`})}function Tt(e){let t=new Map;for(let n of e){let e=new Date(n.completedAt).toDateString(),r=t.get(e);r?r.push(n):t.set(e,[n])}return Array.from(t.entries()).map(([,e])=>({label:wt(e[0]?.completedAt??Date.now()),ops:e}))}function Et(e,t){return e===`device`?t.operationType===`apply`?`Tag/register writes per device step—not a device count.`:`One count per device removed from DeviceHub.`:e===`model`?`One count per model in this run.`:e===`instance`?`One count per twin instance in this run.`:`Sets the device parameter to the bound DeviceHub device.`}var Dt={devices:`Devices`,models:`DT models`,instances:`DT instances`},Q={create:`inline-flex items-center rounded-[var(--miravo-radius-tight)] border border-success/35 bg-success/12 px-1.5 py-0.5 font-mono text-[10px] tabular-nums text-success`,update:`inline-flex items-center rounded-[var(--miravo-radius-tight)] border border-primary/35 bg-primary/12 px-1.5 py-0.5 font-mono text-[10px] tabular-nums text-primary`,replace:`inline-flex items-center rounded-[var(--miravo-radius-tight)] border border-chart-2/35 bg-chart-2/12 px-1.5 py-0.5 font-mono text-[10px] tabular-nums text-chart-2`,delete:`inline-flex items-center rounded-[var(--miravo-radius-tight)] border border-destructive/35 bg-destructive/12 px-1.5 py-0.5 font-mono text-[10px] tabular-nums text-destructive`,noop:`inline-flex items-center rounded-[var(--miravo-radius-tight)] border border-border/55 bg-muted/55 px-1.5 py-0.5 font-mono text-[10px] tabular-nums text-foreground/78`,failed:`inline-flex items-center rounded-[var(--miravo-radius-tight)] border border-destructive/40 bg-destructive/18 px-1.5 py-0.5 font-mono text-[10px] font-semibold tabular-nums text-destructive`};function Ot(e){return[{key:`device`,title:`DeviceHub — protocol tags`,subtitle:Et(`device`,e),counts:e.resourceCounts.device},{key:`model`,title:`Digital Twin models`,subtitle:Et(`model`,e),counts:e.resourceCounts.model},{key:`instance`,title:`Twin instances`,subtitle:Et(`instance`,e),counts:e.resourceCounts.instance},{key:`param-sync`,title:`Parameter sync`,subtitle:Et(`param-sync`,e),counts:e.resourceCounts[`param-sync`]}].filter(e=>e.counts.total>0||e.counts.failed>0)}function kt(e){return e.length===0?`Default (devices, models, instances)`:e.map(e=>Dt[e]??e).join(` · `)}function At(e){let t=[];return e.filters.area&&t.push(`Area ${e.filters.area}`),e.filters.line&&t.push(`Line ${e.filters.line}`),e.filters.instance&&t.push(`Instance ${e.filters.instance}`),t.length>0?t.join(` · `):null}function $(e,t,n){if(e===`device`)switch(t){case`create`:return`+${n} tags (new device)`;case`update`:return`${n} tags rewritten`;case`replace`:return`↻${n} tags (device replaced)`;case`delete`:return`−${n} removed`;case`noop`:return`=${n} unchanged`}switch(t){case`create`:return`+${n} created`;case`update`:return`${n} updated`;case`replace`:return`↻${n} replaced`;case`delete`:return`−${n} removed`;case`noop`:return`=${n} unchanged`}}function jt({row:e}){let{key:t,counts:n}=e;return(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center gap-1.5`,children:[n.create>0&&(0,Z.jsx)(`span`,{className:Q.create,children:$(t,`create`,n.create)}),n.update>0&&(0,Z.jsx)(`span`,{className:Q.update,children:$(t,`update`,n.update)}),n.replace>0&&(0,Z.jsx)(`span`,{className:Q.replace,children:$(t,`replace`,n.replace)}),n.delete>0&&(0,Z.jsx)(`span`,{className:Q.delete,children:$(t,`delete`,n.delete)}),n.noop>0&&(0,Z.jsx)(`span`,{className:Q.noop,children:$(t,`noop`,n.noop)}),n.failed>0&&(0,Z.jsx)(`span`,{className:Q.failed,children:`${n.failed} failed`})]})}function Mt(e){return e.resourceCounts.device.noop+e.resourceCounts.model.noop+e.resourceCounts.instance.noop+e.resourceCounts[`param-sync`].noop}function Nt({op:e}){let t=At(e),n=Mt(e);return(0,Z.jsxs)(`div`,{className:`rounded-[var(--miravo-radius-tight)] border border-border/50 bg-muted/25 px-3 py-2.5`,children:[(0,Z.jsx)(`p`,{className:`font-mono text-[10px] uppercase tracking-[0.16em] text-foreground/72`,children:`Run context`}),(0,Z.jsxs)(`dl`,{className:`mt-2 grid grid-cols-[minmax(0,7.5rem)_1fr] gap-x-3 gap-y-1.5 text-xs sm:grid-cols-[9rem_1fr]`,children:[(0,Z.jsx)(`dt`,{className:`text-foreground/70`,children:`Operation`}),(0,Z.jsx)(`dd`,{className:`font-medium capitalize text-foreground`,children:e.operationType}),(0,Z.jsx)(`dt`,{className:`text-foreground/70`,children:`Target host`}),(0,Z.jsx)(`dd`,{className:`break-all font-mono text-[11px] text-foreground`,children:e.hostname}),(0,Z.jsx)(`dt`,{className:`text-foreground/70`,children:`Scope`}),(0,Z.jsx)(`dd`,{className:`text-foreground`,children:kt(e.scope)}),t&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`dt`,{className:`text-foreground/70`,children:`Filters`}),(0,Z.jsx)(`dd`,{className:`text-foreground`,children:t})]}),(0,Z.jsx)(`dt`,{className:`text-foreground/70`,children:`Duration`}),(0,Z.jsxs)(`dd`,{className:`tabular-nums text-foreground`,children:[(e.durationMs/1e3).toFixed(1),`s`]}),(0,Z.jsx)(`dt`,{className:`text-foreground/70`,children:`Outcome`}),(0,Z.jsxs)(`dd`,{className:`text-foreground`,children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:e.successCount}),` steps succeeded`,n>0&&(0,Z.jsxs)(`span`,{className:`text-foreground/72`,children:[` `,`· `,(0,Z.jsx)(`span`,{className:`tabular-nums`,children:n}),` unchanged`]}),e.failedCount>0&&(0,Z.jsxs)(`span`,{className:`text-destructive`,children:[` `,`· `,(0,Z.jsx)(`span`,{className:`tabular-nums`,children:e.failedCount}),` failed`]}),e.blockedCount>0&&(0,Z.jsxs)(`span`,{className:`text-warning`,children:[` `,`· `,(0,Z.jsx)(`span`,{className:`tabular-nums`,children:e.blockedCount}),` blocked in plan`]})]})]})]})}function Pt({status:e}){switch(e){case`success`:return(0,Z.jsx)(je,{className:`mt-px size-4 shrink-0 text-success`});case`failed`:return(0,Z.jsx)(Ie,{className:`mt-px size-4 shrink-0 text-destructive`});case`partial`:case`blocked`:return(0,Z.jsx)(He,{className:`mt-px size-4 shrink-0 text-warning`});case`noop`:return(0,Z.jsx)(it,{className:`mt-px size-4 shrink-0 text-foreground/55`})}}function Ft(e){let t=e.operationType===`apply`?`Applied`:`Cleaned up`,n=`${(e.durationMs/1e3).toFixed(1)}s`,r=[];e.successCount>0&&r.push(`${e.successCount} resources`);let i=Mt(e);return i>0&&r.push(`${i} unchanged`),e.failedCount>0&&r.push(`${e.failedCount} failed`),e.blockedCount>0&&r.push(`${e.blockedCount} blocked`),r.length===0?`${t} · no changes · ${n}`:`${t} · ${r.join(`, `)} · ${n}`}function It(e){return e.operationType===`cleanup`&&e.successCount===0&&e.failedCount===0&&e.blockedCount===0?`No Miravo-managed resources were found to clean up.`:e.failedCount>0&&e.blockedCount>0?`No per-phase counts — failures and blocked plan entries.`:e.failedCount>0?`No per-phase counts — run failed.`:e.blockedCount>0?`No per-phase counts — blocked plan entries.`:Mt(e)>0?`No resources were mutated. Existing managed resources already matched the desired state.`:`No per-phase counts recorded.`}function Lt({op:e}){let t=Ot(e);return t.length===0?(0,Z.jsx)(`p`,{className:`py-1 text-sm text-foreground/75`,children:It(e)}):(0,Z.jsxs)(`div`,{className:`space-y-3 pt-1`,children:[(0,Z.jsx)(`div`,{className:`flex flex-col divide-y divide-border/45 rounded-[var(--miravo-radius-tight)] border border-border/50`,children:t.map(e=>(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2 px-3 py-2.5 sm:flex-row sm:items-start sm:gap-4`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 shrink-0 sm:w-[11.5rem]`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Z.jsx)(`span`,{className:`text-xs font-medium leading-snug text-foreground`,children:e.title}),(0,Z.jsxs)(Ge,{children:[(0,Z.jsx)(Ue,{type:`button`,className:`inline-flex shrink-0 items-center justify-center rounded-[var(--miravo-radius-tight)] p-0.5 text-foreground/60 hover:bg-muted/50 hover:text-foreground`,"aria-label":`About ${e.title}`,children:(0,Z.jsx)(Re,{className:`size-3.5`,"aria-hidden":!0})}),(0,Z.jsx)(We,{side:`top`,className:`max-w-xs text-left`,children:e.subtitle})]})]}),(0,Z.jsx)(`p`,{className:`mt-0.5 text-[11px] leading-snug text-foreground/72 sm:hidden`,children:e.subtitle})]}),(0,Z.jsx)(jt,{row:e})]},e.key))}),e.blockedCount>0&&(0,Z.jsxs)(`p`,{className:`rounded-[var(--miravo-radius-tight)] border border-warning/20 bg-warning/5 px-2.5 py-1.5 text-[11px] text-warning`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:e.blockedCount}),` plan entries were blocked (skipped). Open a `,(0,Z.jsx)(`span`,{className:`font-medium`,children:`deploy preview`}),` before running to see block reasons.`]})]})}function Rt({operation:e}){let[t,n]=(0,X.useState)(!1);return(0,Z.jsxs)(`div`,{className:F(`overflow-hidden rounded-[var(--miravo-radius-stadium-sm)] border border-border/55`,`transition-colors duration-150`),children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":t,onClick:()=>n(e=>!e),className:F(`flex w-full items-start gap-3 p-3.5 text-left`,`transition-colors duration-100`,`hover:bg-muted/25`,t&&`bg-muted/18`),children:[(0,Z.jsx)(Pt,{status:e.status}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Z.jsxs)(`p`,{className:`min-w-0 truncate text-sm`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-foreground`,children:j(e.templateId)}),(0,Z.jsx)(`span`,{className:`mx-1.5 text-foreground/50`,children:`→`}),(0,Z.jsx)(`span`,{className:`text-foreground/82`,children:e.targetLabel})]}),(0,Z.jsx)(`time`,{dateTime:new Date(e.completedAt).toISOString(),title:A(e.completedAt),className:`shrink-0 text-xs text-foreground/75`,children:k(e.completedAt)})]}),(0,Z.jsx)(`p`,{className:`text-xs text-foreground/78`,children:Ft(e)}),(e.failedCount>0||e.status===`failed`)&&(0,Z.jsx)(`p`,{className:`text-[11px] leading-snug text-foreground/72`,children:be(e.operationType,e.error)})]}),(0,Z.jsx)(Te,{className:F(`mt-0.5 size-3.5 shrink-0 text-foreground/55 transition-transform duration-150`,t&&`rotate-180`)})]}),(0,Z.jsx)(g,{initial:!1,children:t&&(0,Z.jsx)(h.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:`auto`},exit:{opacity:0,height:0},transition:{duration:.2,ease:`easeOut`},className:`overflow-hidden`,children:(0,Z.jsxs)(`div`,{className:`space-y-3 border-t border-border/45 px-4 pb-3 pt-3`,children:[(0,Z.jsx)(Nt,{op:e}),e.error&&(0,Z.jsxs)(`div`,{className:`relative rounded-[var(--miravo-radius-tight)] border border-destructive/40 bg-destructive/15 px-3 py-2 pr-10 text-xs font-medium`,children:[(0,Z.jsx)(`div`,{className:`absolute top-1.5 right-1.5 z-10`,children:(0,Z.jsx)(E,{value:e.error,label:`Copy error`,className:`text-destructive hover:bg-destructive/25 hover:text-foreground`})}),(0,Z.jsx)(`p`,{className:`whitespace-normal break-words text-destructive [overflow-wrap:anywhere]`,children:e.error}),(0,Z.jsx)(`p`,{className:`mt-2 text-[11px] font-normal leading-snug text-foreground/78 [overflow-wrap:anywhere]`,children:be(e.operationType,e.error)})]}),(0,Z.jsx)(Lt,{op:e})]})})})]})}function zt({label:e}){return(0,Z.jsxs)(`div`,{className:`flex items-center gap-3 py-1`,children:[(0,Z.jsx)(`div`,{className:`h-px flex-1 bg-border/65`}),(0,Z.jsx)(`span`,{className:`text-xs font-medium text-foreground/78`,children:e}),(0,Z.jsx)(`div`,{className:`h-px flex-1 bg-border/65`})]})}var Bt={type:``,status:``,target:``,search:``},Vt={_all:`All types`,apply:`Apply`,cleanup:`Cleanup`},Ht={_all:`All statuses`,success:`Success`,partial:`Partial`,failed:`Failed`,blocked:`Blocked`,noop:`No-op`},Ut=`h-7 min-h-7 gap-1.5 border-border/50 bg-transparent px-2 text-xs hover:bg-muted/30 focus:ring-0`;function Wt({filters:e,targetOptions:t,hasFilters:n,searchRef:r,onTypeChange:i,onStatusChange:a,onTargetChange:o,onSearchChange:s,onClear:c}){return(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 border-b border-border/50 px-3 py-2`,children:[(0,Z.jsxs)(Oe,{value:e.type||`_all`,onValueChange:e=>e&&i(e===`_all`?``:e),children:[(0,Z.jsx)(De,{size:`sm`,className:Ut,"aria-label":`Operation type`,children:(0,Z.jsx)(we,{children:e=>Vt[e??`_all`]??Vt._all})}),(0,Z.jsxs)(Ee,{children:[(0,Z.jsx)(K,{value:`_all`,children:`All types`}),(0,Z.jsx)(K,{value:`apply`,children:`Apply`}),(0,Z.jsx)(K,{value:`cleanup`,children:`Cleanup`})]})]}),(0,Z.jsxs)(Oe,{value:e.status||`_all`,onValueChange:e=>e&&a(e===`_all`?``:e),children:[(0,Z.jsx)(De,{size:`sm`,className:Ut,"aria-label":`Operation status`,children:(0,Z.jsx)(we,{children:e=>Ht[e??`_all`]??Ht._all})}),(0,Z.jsxs)(Ee,{children:[(0,Z.jsx)(K,{value:`_all`,children:`All statuses`}),(0,Z.jsx)(K,{value:`success`,children:`Success`}),(0,Z.jsx)(K,{value:`partial`,children:`Partial`}),(0,Z.jsx)(K,{value:`failed`,children:`Failed`}),(0,Z.jsx)(K,{value:`blocked`,children:`Blocked`}),(0,Z.jsx)(K,{value:`noop`,children:`No-op`})]})]}),t.length>1&&(0,Z.jsxs)(Oe,{value:e.target||`_all`,onValueChange:e=>e&&o(e===`_all`?``:e),children:[(0,Z.jsx)(De,{size:`sm`,className:Ut,"aria-label":`Target filter`,children:(0,Z.jsx)(we,{children:e=>!e||e===`_all`?`All targets`:e})}),(0,Z.jsxs)(Ee,{children:[(0,Z.jsx)(K,{value:`_all`,children:`All targets`}),t.map(e=>(0,Z.jsx)(K,{value:e,children:e},e))]})]}),(0,Z.jsxs)(`div`,{className:`relative flex min-w-[140px] flex-1 items-center`,children:[(0,Z.jsx)(`input`,{ref:r,type:`search`,value:e.search,onChange:e=>s(e.target.value),placeholder:`Search environment or target…`,"aria-describedby":`ops-search-shortcut`,className:F(`h-7 w-full rounded-[var(--miravo-radius-tight)] border border-border/50 bg-transparent pl-2 pr-7 text-xs`,`placeholder:text-foreground/60 focus:outline-none focus:ring-1 focus:ring-ring/40`,e.search&&`pr-2`)}),(0,Z.jsx)(`span`,{id:`ops-search-shortcut`,className:`sr-only`,children:`Press slash to focus search`}),!e.search&&(0,Z.jsx)(`kbd`,{"aria-hidden":!0,className:`pointer-events-none absolute right-2 flex h-4 items-center rounded-[var(--miravo-radius-tight)] border border-border/60 bg-muted/50 px-1 font-mono text-[10px] text-foreground/65`,children:`/`})]}),n&&(0,Z.jsxs)(`button`,{type:`button`,onClick:c,className:`flex h-7 items-center gap-1 rounded-[var(--miravo-radius-tight)] px-2 text-xs text-foreground/72 transition-colors hover:bg-muted/40 hover:text-foreground`,children:[(0,Z.jsx)(M,{className:`size-3`}),`Clear`]})]})}function Gt({operations:e,totalKnown:t,isLoading:n,error:r,onRefresh:i,hasNextPage:a=!1,isFetchingNextPage:o=!1,loadMoreError:s=null,onRetryLoadMore:c,onLoadMore:l}){let[u,d]=(0,X.useState)(!1),[f,m]=(0,X.useState)(Bt),_=(0,X.useRef)(null);(0,X.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(),_.current?.focus())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let v=()=>{d(!0),i(),S.success(`Operations refreshed`),setTimeout(()=>d(!1),600)},y=(0,X.useMemo)(()=>{let t=new Set;for(let n of e){let e=n.targetLabel;t.add(e)}return[...t].sort()},[e]),b=(0,X.useMemo)(()=>{let t=e;if(f.type&&(t=t.filter(e=>e.operationType===f.type)),f.status&&(t=t.filter(e=>e.status===f.status)),f.target&&(t=t.filter(e=>e.targetLabel===f.target)),f.search){let e=f.search.toLowerCase();t=t.filter(t=>{let n=t.targetLabel;return t.templateId.toLowerCase().includes(e)||j(t.templateId).toLowerCase().includes(e)||n.toLowerCase().includes(e)})}return t},[e,f]),x=f.type!==``||f.status!==``||f.target!==``||f.search!==``,C=(0,X.useMemo)(()=>Tt(b),[b]);return(0,Z.jsxs)(`div`,{className:`flex h-full flex-col rounded-[var(--miravo-radius-stadium-sm)] border border-border/55`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border/50 px-3.5 py-2.5`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:`Operation log`}),e.length>0&&(0,Z.jsx)(`span`,{className:`font-mono text-xs tabular-nums text-foreground/75`,children:typeof t==`number`&&t>0&&e.length<t?`${e.length} / ${t}`:String(e.length)})]}),(0,Z.jsx)(`button`,{type:`button`,onClick:v,disabled:u,"aria-label":`Refresh operation list`,className:`relative rounded-[var(--miravo-radius-tight)] p-1 text-foreground/70 transition-colors before:absolute before:inset-[-10px] before:content-[''] hover:bg-muted/50 hover:text-foreground disabled:pointer-events-none`,children:(0,Z.jsx)(p,{className:F(`size-3.5`,u&&`animate-spin`),"aria-hidden":!0})})]}),(0,Z.jsx)(Wt,{filters:f,targetOptions:y,hasFilters:x,searchRef:_,onTypeChange:e=>m(t=>({...t,type:e})),onStatusChange:e=>m(t=>({...t,status:e})),onTargetChange:e=>m(t=>({...t,target:e})),onSearchChange:e=>m(t=>({...t,search:e})),onClear:()=>m(Bt)}),(0,Z.jsxs)(`div`,{className:`flex flex-1 min-h-0 flex-col gap-2 overflow-y-auto overscroll-y-contain p-3`,children:[r&&(0,Z.jsxs)(`p`,{className:`py-2 text-xs text-destructive`,children:[`✕ `,r.message]}),n&&e.length===0&&!r&&(0,Z.jsx)(`p`,{className:`py-4 text-sm text-foreground/75`,children:`Loading…`}),!n&&e.length===0&&!r&&(0,Z.jsx)(Ct,{}),!n&&e.length>0&&b.length===0&&(0,Z.jsxs)(`p`,{className:`py-6 text-center text-sm text-foreground/75`,children:[`No operations match your filters.`,` `,(0,Z.jsx)(`button`,{type:`button`,onClick:()=>m(Bt),className:`text-primary hover:underline`,children:`Clear filters`})]}),x&&b.length>0&&b.length!==e.length&&(0,Z.jsxs)(`p`,{className:`text-xs text-foreground/75`,children:[`Showing`,` `,(0,Z.jsx)(`span`,{className:`font-medium tabular-nums text-foreground`,children:b.length}),` of`,` `,(0,Z.jsx)(`span`,{className:`tabular-nums`,children:e.length}),` loaded`]}),!x&&typeof t==`number`&&t>0&&e.length<t&&(0,Z.jsxs)(`p`,{className:`text-xs text-foreground/75`,children:[`Showing`,` `,(0,Z.jsx)(`span`,{className:`font-medium tabular-nums text-foreground`,children:e.length}),` `,`of `,(0,Z.jsx)(`span`,{className:`tabular-nums`,children:t}),`. Load more for older entries.`]}),(0,Z.jsx)(g,{initial:!1,children:C.map(e=>(0,Z.jsxs)(h.div,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(zt,{label:e.label}),(0,Z.jsx)(g,{initial:!1,children:e.ops.map(e=>(0,Z.jsx)(h.div,{initial:b.length>40?!1:{opacity:0,x:-6},animate:{opacity:1,x:0},transition:{type:`spring`,stiffness:400,damping:35},children:(0,Z.jsx)(Rt,{operation:e})},`${e.operationId}-${e.completedAt}`))})]},e.label))}),s?(0,Z.jsxs)(`div`,{role:`alert`,className:`flex shrink-0 flex-col items-center gap-2 border-t border-border/50 pt-3 pb-1 text-center`,children:[(0,Z.jsxs)(`p`,{className:`text-xs text-destructive`,children:[`Could not load older entries: `,s.message]}),c?(0,Z.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,onClick:c,children:`Retry`}):null]}):a&&l?(0,Z.jsx)(`div`,{className:`flex shrink-0 justify-center border-t border-border/50 pt-3 pb-1`,children:(0,Z.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,className:`min-w-[7rem]`,disabled:o,"aria-busy":o,"aria-label":o?`Loading older operations`:`Load older operations`,onClick:l,children:o?`Loading…`:`Load more`})}):null]})]})}function Kt({target:e,templates:t,templatesLoading:n,templatesError:r,isStreaming:i,onRetryTemplates:a,onSelect:o}){let s=t.length===0&&!n&&!r,[c,l]=(0,X.useState)(null);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`absolute right-3 top-3 z-20`,children:(0,Z.jsxs)($e,{children:[(0,Z.jsx)(Qe,{render:(0,Z.jsx)(O,{type:`button`,variant:`ghost`,size:`icon-sm`,disabled:i,className:`border border-border/45 bg-background/70 text-muted-foreground shadow-[inset_0_1px_0_0_var(--miravo-inset-highlight)] hover:border-primary/30 hover:bg-muted/55 hover:text-foreground`,"aria-label":`Open quick actions for ${e.label}`}),children:(0,Z.jsx)(at,{className:`size-3.5`,"aria-hidden":!0})}),(0,Z.jsx)(Ye,{align:`end`,sideOffset:6,className:`min-w-56`,children:(0,Z.jsxs)(Ze,{children:[(0,Z.jsx)(qe,{className:`text-[10px] uppercase tracking-[0.14em]`,children:`Quick actions`}),(0,Z.jsx)(Xe,{className:`bg-border/60`}),(0,Z.jsxs)(Je,{disabled:s,className:`h-9 gap-2 text-xs`,onClick:()=>l(`apply`),children:[(0,Z.jsx)(ze,{className:`size-3.5 shrink-0 text-primary`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:`Apply environment...`})]}),(0,Z.jsxs)(Je,{disabled:s,className:`h-9 gap-2 text-xs`,onClick:()=>l(`cleanup`),children:[(0,Z.jsx)(W,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:`Cleanup environment...`})]}),(0,Z.jsx)(Xe,{className:`bg-border/60`}),(0,Z.jsxs)(Je,{variant:`destructive`,className:`h-9 gap-2 text-xs`,onClick:()=>o({type:`cleanup`,target:e,allManaged:!0}),children:[(0,Z.jsx)(W,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:`Cleanup all managed`})]})]})})]})}),c?(0,Z.jsx)(xt,{open:!0,type:c,targetLabel:e.label,targetHostname:e.hostname,templates:t,templatesLoading:n,templatesError:r,onRetryTemplates:a,onOpenChange:e=>{e||l(null)},onSelect:t=>{o({type:c,target:e,templateId:t.id}),l(null)}},c):null]})}function qt({selection:e,templates:t,stream:n,onSelectionChange:r}){let[i,a]=(0,X.useState)(!1),[o,s]=(0,X.useState)(null),[c,l]=(0,X.useState)(!1),u=(0,X.useRef)(0),d=(0,X.useRef)(null),f=(0,X.useRef)(!1),p=n.status===`running`,m=(0,X.useCallback)(()=>{u.current+=1,f.current=!1,d.current?.abort(),d.current=null,l(!1),s(null)},[]);(0,X.useEffect)(()=>{e&&(m(),a(!0))},[e,m]),(0,X.useEffect)(()=>()=>{u.current+=1,f.current=!1,d.current?.abort(),d.current=null},[]);let h=e?.templateId==null?void 0:t.find(t=>t.id===e.templateId)?.name??e.templateId,g=e?.type===`cleanup`&&e.allManaged?`All managed resources`:h??``,_=(0,X.useCallback)(async t=>{if(!e)return;let r=e.templateId;if(e.type===`apply`&&!r||e.type===`cleanup`&&!e.allManaged&&!r)return;n.operation&&n.status!==`running`&&n.reset(),f.current=!0,d.current?.abort(),u.current+=1;let i=u.current,a=new AbortController;d.current=a,l(!0),s(null);try{let n;if(e.type===`apply`){if(!r)return;n=await ce(z({targetId:e.target.id,template:r,result:t}),{signal:a.signal})}else n=await se(V({targetId:e.target.id,template:r,allManaged:e.allManaged,result:t}),{signal:a.signal});if(i!==u.current)return;s(n.plan)}catch(t){if(i!==u.current||oe(t))return;let n=Y(t,e.type===`apply`?`Plan failed`:`Cleanup plan failed`),r=tt(t);S.error(n,r?{description:r}:void 0)}finally{i===u.current&&(l(!1),f.current=!1)}},[e,n]),v=(0,X.useCallback)(t=>{if(e){if(a(!1),m(),r(null),e.type===`apply`){if(!e.templateId)return;n.startApply(z({targetId:e.target.id,template:e.templateId,result:t}));return}n.startCleanup(V({targetId:e.target.id,template:e.templateId,allManaged:e.allManaged,result:t}))}},[e,n,m,r]),y=e=>{a(e),!(e||f.current)&&(m(),r(null))},b=()=>{m(),r(null)};return(0,Z.jsxs)(Z.Fragment,{children:[e&&(0,Z.jsx)(te,{open:i,onOpenChange:y,type:e.type,label:g,targetLabel:e.target.label,hostname:e.target.hostname,sourceHostname:e.target.sourceHostname,onConfirm:v,metadata:R,applyPreview:e.type===`apply`?{onPreview:e=>void _(e),planLoading:c,disabled:!e.templateId||p}:void 0,cleanupPreview:e.type===`cleanup`?{onPreview:e=>void _(e),planLoading:c,disabled:!e.allManaged&&!e.templateId||p}:void 0}),(c||o)&&!p&&e?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsxs)(`div`,{className:`flex w-full min-w-0 flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-[11px] text-muted-foreground`,children:[(0,Z.jsx)(re,{className:`size-3.5 shrink-0 text-primary`,"aria-hidden":!0}),(0,Z.jsxs)(`span`,{className:`truncate`,children:[`Preview for `,e.target.label,`: `,g]})]}),(0,Z.jsxs)(O,{type:`button`,variant:`ghost`,size:`sm`,className:`h-8 shrink-0 gap-1.5 px-2 text-xs text-muted-foreground hover:text-foreground`,onClick:b,children:[(0,Z.jsx)(M,{className:`size-3.5`,"aria-hidden":!0}),`Close preview`]})]}),c?(0,Z.jsx)(de,{}):o?(0,Z.jsx)(ge,{plan:o,planKind:e.type,onCloseTable:b}):null]}):null]})}function Jt(e){return Ae.find(t=>t.id===e)?.label??e}function Yt(e){if(!e)return`var(--tooltip-border)`;switch(e.status){case`success`:return`var(--success)`;case`partial`:case`blocked`:return`var(--warning)`;case`noop`:return`var(--muted-foreground)`;case`failed`:return`var(--destructive)`}}function Xt({status:e}){switch(e){case`success`:return(0,Z.jsx)(je,{className:`size-3 text-success`});case`partial`:case`blocked`:return(0,Z.jsx)(He,{className:`size-3 text-warning`});case`noop`:return(0,Z.jsx)(it,{className:`size-3 text-muted-foreground`});case`failed`:return(0,Z.jsx)(Ie,{className:`size-3 text-destructive`})}}function Zt({target:e,lastOp:t,onEdit:n,onDelete:r,quickActions:i}){return(0,Z.jsxs)(`div`,{className:`env-orbital relative overflow-hidden border`,style:{"--_status":Yt(t)},children:[i,(0,Z.jsx)(`div`,{className:`relative z-10 px-4 pt-3.5 pb-3 pr-12`,children:(0,Z.jsx)(`p`,{className:`font-heading text-[13px] font-semibold leading-tight tracking-tight text-foreground`,children:e.label})}),(0,Z.jsx)(`div`,{className:`relative z-10 px-4 py-0.5`,children:(0,Z.jsx)(`p`,{className:`font-mono text-xs tracking-tight text-muted-foreground`,children:e.hostname})}),(0,Z.jsxs)(`div`,{className:`relative z-10 mx-4 mb-3 flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate font-mono text-[11px] text-muted-foreground`,children:e.sourceHostname}),(0,Z.jsx)(`div`,{className:`env-orbital-path min-w-6 flex-1`}),(0,Z.jsx)(L,{className:`size-3 shrink-0 text-muted-foreground`})]}),(0,Z.jsxs)(`div`,{className:`relative z-10 flex items-center gap-2 border-t border-border/30 px-3 py-1.5`,children:[(0,Z.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5 rounded-full border border-border/40 px-2 py-0.5`,children:[(0,Z.jsx)(`span`,{className:`protocol-card-live-dot size-[5px]`}),(0,Z.jsx)(`span`,{className:`text-[11px] font-medium tracking-wide text-muted-foreground`,children:Jt(e.platformId)})]}),t&&(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 truncate text-[11px] text-muted-foreground`,children:[(0,Z.jsx)(Xt,{status:t.status}),t.operationType===`apply`?`Applied`:`Cleaned`,` `,(0,Z.jsx)(`time`,{dateTime:new Date(t.completedAt).toISOString(),title:A(t.completedAt),children:k(t.completedAt)})]}),(0,Z.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-0.5`,children:[(0,Z.jsx)(O,{variant:`ghost`,size:`icon-sm`,"aria-label":`Edit target`,onClick:n,children:(0,Z.jsx)(ot,{className:`size-3`})}),(0,Z.jsx)(O,{variant:`ghost`,size:`icon-sm`,className:`text-destructive hover:text-destructive`,"aria-label":`Delete target`,onClick:r,children:(0,Z.jsx)(W,{className:`size-3`})})]})]})]})}function Qt({onClick:e}){return(0,Z.jsxs)(`button`,{type:`button`,onClick:e,className:`env-orbital group h-full w-full flex flex-col items-center justify-center gap-2 border border-dashed py-10 text-muted-foreground transition-colors hover:border-primary/30 hover:text-primary`,style:{"--_status":`var(--tooltip-border)`},children:[(0,Z.jsx)(B,{className:`size-5 transition-transform group-hover:scale-110`}),(0,Z.jsx)(`span`,{className:`text-xs`,children:`Add Target`})]})}function $t({targets:e,onMutate:t,lastOpByTarget:n,templates:r,templatesLoading:i,templatesError:a,onRetryTemplates:o,stream:s}){let[c,l]=(0,X.useState)(!1),[u,d]=(0,X.useState)(null),[f,p]=(0,X.useState)(q.id),[m,_]=(0,X.useState)({label:``,hostname:``,apiToken:``,sourceHostname:``}),[v,y]=(0,X.useState)(!1),[E,D]=(0,X.useState)(!1),{testing:k,runTest:A,cancelInFlight:j}=G(),[M,N]=(0,X.useState)(null),[P,F]=(0,X.useState)(null),I=s.status===`running`,L=f===q.id&&m.hostname.trim().length>0&&m.sourceHostname.trim().length>0&&(u!==null||m.apiToken.trim().length>0),R=()=>{d(null),p(q.id),_({label:``,hostname:``,apiToken:``,sourceHostname:``}),D(!1),l(!0)},te=e=>{d(e.id),p(Ae.some(t=>t.id===e.platformId)?e.platformId:q.id),_({label:e.label,hostname:e.hostname,apiToken:``,sourceHostname:e.sourceHostname}),D(!1),l(!0)},z=async()=>{if(f!==q.id){S.error(`${Jt(f)} target setup is coming soon.`);return}if(!m.label||!m.hostname||!m.sourceHostname){S.error(`Label, hostname, and source host are required.`);return}if(!u&&!m.apiToken){S.error(`API token is required for new targets.`);return}y(!0);try{u?(await he(u,{platformId:f,label:m.label,hostname:m.hostname,sourceHostname:m.sourceHostname,...m.apiToken?{apiToken:m.apiToken}:{}}),S.success(`Target updated.`)):(await _e({...m,platformId:f}),S.success(`Target added.`)),l(!1),t()}catch(e){S.error(Y(e,`Failed to save target.`))}finally{y(!1)}};return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(`h2`,{className:`flex h-5 items-center text-xs font-medium leading-none uppercase tracking-wider text-muted-foreground`,children:`Platform Targets`}),e.length>0?(0,Z.jsx)(Ke,{variant:`secondary`,className:`relative -top-px h-5 shrink-0 px-1.5 py-0 font-mono text-[10px] leading-none tabular-nums`,children:e.length}):null]}),(0,Z.jsxs)(O,{size:`sm`,className:`h-7 shrink-0 gap-1.5 text-xs`,onClick:R,children:[(0,Z.jsx)(B,{className:`size-3.5`}),` Add Target`]})]}),e.length===0?(0,Z.jsx)(dt,{titleId:`platforms-targets-empty-title`,frameIcon:(0,Z.jsx)(J,{className:`size-6 text-muted-foreground/45`,"aria-hidden":!0}),description:(0,Z.jsx)(lt,{}),children:(0,Z.jsx)(ut,{onClick:R})}):(0,Z.jsx)(`div`,{className:`grid grid-cols-1 gap-3 @2xl/main:grid-cols-2 @5xl/main:grid-cols-3`,children:(0,Z.jsxs)(g,{children:[e.map((e,t)=>(0,Z.jsx)(h.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},children:(0,Z.jsx)(Zt,{target:e,lastOp:n.get(e.id),onEdit:()=>te(e),onDelete:()=>N(e),quickActions:(0,Z.jsx)(Kt,{target:e,templates:r,templatesLoading:i,templatesError:a,isStreaming:I,onRetryTemplates:o,onSelect:F})})},e.id)),(0,Z.jsx)(h.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{type:`spring`,stiffness:380,damping:30,delay:e.length*.04},children:(0,Z.jsx)(Qt,{onClick:R})},`add-card`)]})}),(0,Z.jsx)(qt,{selection:P,templates:r,stream:s,onSelectionChange:F}),(0,Z.jsx)(ue,{open:c,editing:u!==null,platformId:f,form:m,showToken:E,saving:v,testing:k,canTestConnection:L,onOpenChange:l,onPlatformChange:p,onFormChange:_,onShowTokenChange:D,onSave:()=>void z(),onTestConnection:()=>{L&&A({...u?{targetId:u}:{},hostname:m.hostname.trim(),sourceHostname:m.sourceHostname.trim(),...m.apiToken.trim()?{apiToken:m.apiToken.trim()}:{}})},onCancelInFlight:j}),(0,Z.jsx)(C,{open:M!==null,onOpenChange:e=>!e&&N(null),children:(0,Z.jsxs)(ee,{children:[(0,Z.jsxs)(w,{children:[(0,Z.jsx)(T,{children:`Remove Target`}),(0,Z.jsxs)(x,{children:[`Remove “`,M?.label,`”? This only deletes the saved credentials — it does not affect resources on the target platform.`]})]}),(0,Z.jsxs)(b,{children:[(0,Z.jsx)(O,{variant:`outline`,onClick:()=>N(null),children:`Cancel`}),(0,Z.jsx)(O,{variant:`destructive`,onClick:async()=>{if(!M)return;let e=M.id;N(null);try{await U(e),S.success(`Target removed.`),t()}catch(e){S.error(Y(e,`Failed to remove target.`))}},children:`Remove`})]})]})})]})}var en=25;function tn({status:e}){switch(e){case`success`:return(0,Z.jsx)(je,{className:`size-3 text-success`});case`partial`:case`blocked`:return(0,Z.jsx)(He,{className:`size-3 text-warning`});case`noop`:return(0,Z.jsx)(it,{className:`size-3 text-muted-foreground`});case`failed`:return(0,Z.jsx)(Ie,{className:`size-3 text-destructive`})}}function nn({targetCount:e,opCount:t,lastOp:n}){return(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground`,children:[(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(J,{className:`size-3`}),(0,Z.jsx)(`span`,{className:`font-mono`,children:e}),` target`,e===1?``:`s`]}),(0,Z.jsx)(`span`,{className:`hidden h-3 w-px bg-border/40 sm:inline-block`}),(0,Z.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Z.jsx)(g,{mode:`popLayout`,initial:!1,children:(0,Z.jsx)(h.span,{initial:{opacity:0,y:-6},animate:{opacity:1,y:0},exit:{opacity:0,y:6},transition:{type:`spring`,stiffness:500,damping:35},className:`font-mono tabular-nums`,children:t},t)}),` `,`operation`,t===1?``:`s`]}),n&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`hidden h-3 w-px bg-border/40 sm:inline-block`}),(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(tn,{status:n.status}),(0,Z.jsxs)(`span`,{children:[n.operationType===`apply`?`Applied`:`Cleaned`,` `,(0,Z.jsx)(`time`,{dateTime:new Date(n.completedAt).toISOString(),title:A(n.completedAt),children:k(n.completedAt)})]})]})]})]})}function rn(){let e=f({queryKey:s.platforms.targets(),queryFn:()=>ye()}),t=e.data??[],n=rt({queryKey:s.platforms.operationsList(),queryFn:({pageParam:e})=>fe({limit:en,offset:e}),initialPageParam:0,getNextPageParam:(e,t,n)=>e.hasMore&&e.operations.length>0?n+en:void 0}),r=(0,X.useMemo)(()=>n.data?.pages.flatMap(e=>e.operations)??[],[n.data]),a=n.data?.pages[0]?.total??0,o=f({queryKey:s.catalog.templates(),queryFn:()=>c(`/catalog/templates`,i.catalogTemplates)}),u=o.data??[],d=ve(),p=(0,X.useRef)(d.status);(0,X.useEffect)(()=>{let e=p.current;p.current=d.status,e===`running`&&d.status===`complete`&&l.invalidateQueries({queryKey:s.platforms.operationsList()})},[d.status]);let y=(0,X.useMemo)(()=>{let e=new Map;for(let t of r)e.has(t.targetId)||e.set(t.targetId,t);return e},[r]),[b,x]=_(`tab`,v([`targets`,`operations`,`activity`]).withDefault(`targets`)),S;return S=e.isPending&&e.data===void 0?null:e.isError&&e.data===void 0?(0,Z.jsx)(m,{message:Y(e.error,`Could not load targets.`),onRetry:()=>void e.refetch(),isRetrying:e.isFetching&&!e.isPending}):t.length===0?(0,Z.jsx)(dt,{titleId:`platforms-operations-empty-title`,frameIcon:(0,Z.jsx)(J,{className:`size-6 text-muted-foreground/45`,"aria-hidden":!0}),description:(0,Z.jsx)(lt,{}),children:(0,Z.jsx)(ut,{onClick:()=>void x(`targets`)})}):(0,Z.jsx)(St,{targets:t,stream:d}),(0,Z.jsxs)(`div`,{className:`mx-auto flex h-full w-full min-w-0 max-w-screen-2xl flex-col gap-5 p-4 sm:gap-6 sm:p-6`,children:[(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2`,children:[(0,Z.jsx)(`h1`,{className:`font-heading text-2xl font-semibold tracking-tight`,children:`Platforms`}),(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Connect Platforms as targets, then apply templates or run cleanup from Operations.`}),(0,Z.jsx)(nn,{targetCount:t.length,opCount:a,lastOp:r[0]})]}),(0,Z.jsxs)(Le,{value:b,onValueChange:e=>{x(e)},className:`flex-1 min-h-0`,children:[(0,Z.jsx)(`div`,{className:`shrink-0 overflow-x-auto`,children:(0,Z.jsxs)(Fe,{variant:`line`,className:`h-10! gap-0.5 min-w-max`,children:[(0,Z.jsxs)(Me,{value:`targets`,className:`gap-1.5 px-3 text-sm`,children:[(0,Z.jsx)(J,{className:`size-3.5 shrink-0`}),`Targets`]}),(0,Z.jsxs)(Me,{value:`operations`,className:`gap-1.5 px-3 text-sm`,children:[(0,Z.jsx)(Se,{className:`size-3.5 shrink-0`}),`Operations`]}),(0,Z.jsxs)(Me,{value:`activity`,className:`gap-1.5 px-3 text-sm`,children:[(0,Z.jsx)(I,{className:`size-3.5 shrink-0`}),`Activity`]})]})}),(0,Z.jsx)(Ne,{value:`targets`,className:`flex-1 py-2`,children:(0,Z.jsx)(h.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.15,ease:`easeOut`},children:e.isError&&e.data===void 0?(0,Z.jsx)(m,{message:Y(e.error,`Failed to load targets.`),onRetry:()=>void e.refetch(),isRetrying:e.isFetching&&!e.isPending}):(0,Z.jsx)($t,{targets:t,onMutate:()=>void e.refetch(),lastOpByTarget:y,templates:u,templatesLoading:o.isPending&&o.data===void 0,templatesError:o.isError&&u.length===0,onRetryTemplates:()=>void o.refetch(),stream:d})},`targets`)}),(0,Z.jsx)(Ne,{value:`operations`,className:`flex-1 py-2`,children:(0,Z.jsx)(h.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.15,ease:`easeOut`},children:S},`operations`)}),(0,Z.jsx)(Ne,{value:`activity`,className:`flex flex-col flex-1 min-h-0 py-2`,children:(0,Z.jsx)(h.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.15,ease:`easeOut`},className:`flex flex-col flex-1 min-h-0`,children:(0,Z.jsx)(Gt,{operations:r,totalKnown:a,isLoading:n.isPending&&!n.data,error:n.error,onRefresh:()=>void l.invalidateQueries({queryKey:s.platforms.operationsList()}),hasNextPage:n.hasNextPage,isFetchingNextPage:n.isFetchingNextPage,loadMoreError:n.isFetchNextPageError&&n.error instanceof Error?n.error:null,onRetryLoadMore:()=>void n.fetchNextPage(),onLoadMore:()=>void n.fetchNextPage()})},`activity`)})]}),(0,Z.jsx)(g,{children:d.operation||d.status===`running`?(0,Z.jsx)(ft,{stream:d,onReset:d.reset,catalogTemplates:u}):null})]})}export{rn as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./platforms-DGpl5tPh.js";export{e as PlatformsPage};
|
|
@@ -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{$ as r,at as i,ct as a,dt as o,et as s,ft as c,lt as l,mt as u,nt as d,ot as f,pt as p,rt as m,st as h,tt as g,ut as _}from"./api-DPmCeS_C.js";import{S as v}from"./format-CshN6yEB.js";import{n as y,t as b}from"./utils-XFKvwlFT.js";var x=class extends u{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=g(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),C(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return w(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return w(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof h(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!l(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&T(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||h(this.options.enabled,this.#t)!==h(t.enabled,this.#t)||a(this.options.staleTime,this.#t)!==a(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||h(this.options.enabled,this.#t)!==h(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return D(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(i)),t}#g(){this.#b();let e=a(this.options.staleTime,this.#t);if(d.isServer()||this.#r.isStale||!m(e))return;let t=o(this.#r.dataUpdatedAt,e)+1;this.#d=c.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(d.isServer()||h(this.options.enabled,this.#t)===!1||!m(this.#p)||this.#p===0)&&(this.#f=c.setInterval(()=>{(this.options.refetchIntervalInBackground||p.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(c.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(c.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,i=this.options,a=this.#r,o=this.#i,s=this.#a,c=e===n?this.#n:e.state,{state:l}=e,u={...l},d=!1,p;if(t._optimisticResults){let a=this.hasListeners(),o=!a&&C(e,t),s=a&&T(e,n,t,i);(o||s)&&(u={...u,...r(l.data,e.options)}),t._optimisticResults===`isRestoring`&&(u.fetchStatus=`idle`)}let{error:m,errorUpdatedAt:_,status:v}=u;p=u.data;let y=!1;if(t.placeholderData!==void 0&&p===void 0&&v===`pending`){let e;a?.isPlaceholderData&&t.placeholderData===s?.placeholderData?(e=a.data,y=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(v=`success`,p=f(a?.data,e,t),d=!0)}if(t.select&&p!==void 0&&!y)if(a&&p===o?.data&&t.select===this.#c)p=this.#l;else try{this.#c=t.select,p=t.select(p),p=f(a?.data,p,t),this.#l=p,this.#s=null}catch(e){this.#s=e}this.#s&&(m=this.#s,p=this.#l,_=Date.now(),v=`error`);let b=u.fetchStatus===`fetching`,x=v===`pending`,S=v===`error`,w=x&&b,D=p!==void 0,O={status:v,fetchStatus:u.fetchStatus,isPending:x,isSuccess:v===`success`,isError:S,isInitialLoading:w,isLoading:w,data:p,dataUpdatedAt:u.dataUpdatedAt,error:m,errorUpdatedAt:_,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:u.dataUpdateCount>c.dataUpdateCount||u.errorUpdateCount>c.errorUpdateCount,isFetching:b,isRefetching:b&&!x,isLoadingError:S&&!D,isPaused:u.fetchStatus===`paused`,isPlaceholderData:d,isRefetchError:S&&D,isStale:E(e,t),refetch:this.refetch,promise:this.#o,isEnabled:h(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=O.data!==void 0,r=O.status===`error`&&!t,i=e=>{r?e.reject(O.error):t&&e.resolve(O.data)},a=()=>{i(this.#o=O.promise=g())},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||O.data!==o.value)&&a();break;case`rejected`:(!r||O.error!==o.reason)&&a();break}}return O}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!l(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){s.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function S(e,t){return h(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&t.retryOnMount===!1)}function C(e,t){return S(e,t)||e.state.data!==void 0&&w(e,t,t.refetchOnMount)}function w(e,t,n){if(h(t.enabled,e)!==!1&&a(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&E(e,t)}return!1}function T(e,t,n,r){return(e!==t||h(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&E(e,n)}function E(e,t){return h(t.enabled,e)!==!1&&e.isStaleByTime(a(t.staleTime,e))}function D(e,t){return!l(e.getCurrentResult(),t)}var O=e(t(),1),k=n(),A=O.createContext(void 0),j=e=>{let t=O.useContext(A);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},M=({client:e,children:t})=>(O.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,k.jsx)(A.Provider,{value:e,children:t})),N=O.createContext(!1),P=()=>O.useContext(N);N.Provider;function F(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var I=O.createContext(F()),L=()=>O.useContext(I),R=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?_(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},z=e=>{O.useEffect(()=>{e.clearReset()},[e])},B=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||_(n,[e.error,r])),V=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},H=(e,t)=>e.isLoading&&e.isFetching&&!t,U=(e,t)=>e?.suspense&&t.isPending,W=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function G(e,t,n){let r=P(),a=L(),o=j(n),c=o.defaultQueryOptions(e);o.getDefaultOptions().queries?._experimental_beforeQuery?.(c);let l=o.getQueryCache().get(c.queryHash);c._optimisticResults=r?`isRestoring`:`optimistic`,V(c),R(c,a,l),z(a);let u=!o.getQueryCache().get(c.queryHash),[f]=O.useState(()=>new t(o,c)),p=f.getOptimisticResult(c),m=!r&&e.subscribed!==!1;if(O.useSyncExternalStore(O.useCallback(e=>{let t=m?f.subscribe(s.batchCalls(e)):i;return f.updateResult(),t},[f,m]),()=>f.getCurrentResult(),()=>f.getCurrentResult()),O.useEffect(()=>{f.setOptions(c)},[c,f]),U(c,p))throw W(c,f,a);if(B({result:p,errorResetBoundary:a,throwOnError:c.throwOnError,query:l,suspense:c.suspense}))throw p.error;return o.getDefaultOptions().queries?._experimental_afterQuery?.(c,p),c.experimental_prefetchInRender&&!d.isServer()&&H(p,r)&&(u?W(c,f,a):l?.promise)?.catch(i).finally(()=>{f.updateResult()}),c.notifyOnChangeProps?p:f.trackResult(p)}function K(e,t){return G(e,x,t)}var q=y(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]);function J({role:e=`status`,"aria-live":t=`polite`,"aria-atomic":n=!0,className:r,eyebrow:i,stamp:a,title:o,children:s,detailLabel:c=`Technical detail`,detail:l,primaryLabel:u,onPrimary:d,primaryIcon:f,primaryDisabled:p,primaryBusy:m,secondaryLabel:h,onSecondary:g}){return(0,k.jsx)(`div`,{role:e,"aria-live":t,"aria-atomic":n,className:b(`relative overflow-hidden rounded-[var(--miravo-radius-stadium-lg)] border border-primary/20 bg-transparent`,r),children:(0,k.jsx)(`div`,{className:`p-5 sm:p-6`,children:(0,k.jsxs)(`div`,{className:`min-w-0 space-y-4`,children:[(0,k.jsxs)(`div`,{className:`space-y-3`,children:[(0,k.jsx)(`p`,{className:`font-mono text-[0.65rem] uppercase tracking-[0.38em] text-muted-foreground`,children:i}),(0,k.jsxs)(`div`,{className:`flex items-end gap-3`,children:[(0,k.jsx)(`span`,{className:`font-heading text-3xl font-black leading-none tracking-[-0.06em] text-transparent [-webkit-text-stroke:1px_color-mix(in_srgb,var(--primary)_50%,transparent)] sm:text-4xl`,"aria-hidden":!0,children:a}),(0,k.jsx)(`div`,{className:`mb-1.5 h-px min-w-8 flex-1 bg-linear-to-r from-primary/55 to-transparent`})]}),(0,k.jsx)(`h2`,{className:`text-lg font-semibold tracking-[-0.03em] text-foreground sm:text-xl`,children:o}),s?(0,k.jsx)(`div`,{className:`space-y-2 text-sm leading-relaxed text-muted-foreground`,children:s}):null]}),(0,k.jsxs)(`div`,{className:`rounded-[var(--miravo-radius-stadium-sm)] border border-border/80 bg-background/55 p-4 backdrop-blur-sm`,children:[(0,k.jsx)(`div`,{className:`mb-2 font-mono text-[0.65rem] uppercase tracking-[0.28em] text-muted-foreground`,children:c}),(0,k.jsx)(`p`,{className:`wrap-break-word font-mono text-sm leading-relaxed text-primary`,children:l})]}),(0,k.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:flex-wrap`,children:[(0,k.jsxs)(v,{type:`button`,onClick:d,disabled:!!(p||m),"aria-busy":m,className:b(`inline-flex w-full items-center justify-center gap-2 rounded-[var(--miravo-radius-stadium-sm)] border border-foreground/15 bg-foreground px-4 py-2.5 font-medium text-background shadow-none transition hover:bg-foreground/90 sm:w-auto`,m&&`pointer-events-none opacity-90`),children:[f,u]}),h&&g?(0,k.jsx)(v,{type:`button`,variant:`ghost`,size:`sm`,className:`sm:self-center`,onClick:g,children:h}):null]})]})})})}function Y({message:e,onRetry:t,isRetrying:n}){return(0,k.jsxs)(J,{role:`alert`,eyebrow:`Data link fault`,stamp:`ERR`,title:`Couldn't reach Miravo`,detail:e,primaryLabel:`Retry request`,onPrimary:t,primaryBusy:!!n,primaryIcon:(0,k.jsx)(q,{className:b(`size-4 shrink-0`,n&&`animate-spin`),"aria-hidden":!0}),children:[(0,k.jsxs)(`p`,{children:[(0,k.jsx)(`span`,{className:`text-foreground`,children:`Most often:`}),` the Miravo admin server isn't running, or this browser can't reach it (wrong host, port, or firewall).`]}),(0,k.jsx)(`p`,{children:`Start or restart Miravo if needed, use the correct link to the Miravo Console, then try again.`})]})}export{G as a,x as c,K as i,J as n,M as o,q as r,j as s,Y 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{$ as r,at as i,ct as a,dt as o,et as s,ft as c,lt as l,mt as u,nt as d,ot as f,pt as p,rt as m,st as h,tt as g,ut as _}from"./api-CrYvIV3A.js";import{S as v}from"./format-CshN6yEB.js";import{n as y,t as b}from"./utils-XFKvwlFT.js";var x=class extends u{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=g(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),C(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return w(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return w(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof h(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!l(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&T(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||h(this.options.enabled,this.#t)!==h(t.enabled,this.#t)||a(this.options.staleTime,this.#t)!==a(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||h(this.options.enabled,this.#t)!==h(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return D(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(i)),t}#g(){this.#b();let e=a(this.options.staleTime,this.#t);if(d.isServer()||this.#r.isStale||!m(e))return;let t=o(this.#r.dataUpdatedAt,e)+1;this.#d=c.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(d.isServer()||h(this.options.enabled,this.#t)===!1||!m(this.#p)||this.#p===0)&&(this.#f=c.setInterval(()=>{(this.options.refetchIntervalInBackground||p.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(c.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(c.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,i=this.options,a=this.#r,o=this.#i,s=this.#a,c=e===n?this.#n:e.state,{state:l}=e,u={...l},d=!1,p;if(t._optimisticResults){let a=this.hasListeners(),o=!a&&C(e,t),s=a&&T(e,n,t,i);(o||s)&&(u={...u,...r(l.data,e.options)}),t._optimisticResults===`isRestoring`&&(u.fetchStatus=`idle`)}let{error:m,errorUpdatedAt:_,status:v}=u;p=u.data;let y=!1;if(t.placeholderData!==void 0&&p===void 0&&v===`pending`){let e;a?.isPlaceholderData&&t.placeholderData===s?.placeholderData?(e=a.data,y=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(v=`success`,p=f(a?.data,e,t),d=!0)}if(t.select&&p!==void 0&&!y)if(a&&p===o?.data&&t.select===this.#c)p=this.#l;else try{this.#c=t.select,p=t.select(p),p=f(a?.data,p,t),this.#l=p,this.#s=null}catch(e){this.#s=e}this.#s&&(m=this.#s,p=this.#l,_=Date.now(),v=`error`);let b=u.fetchStatus===`fetching`,x=v===`pending`,S=v===`error`,w=x&&b,D=p!==void 0,O={status:v,fetchStatus:u.fetchStatus,isPending:x,isSuccess:v===`success`,isError:S,isInitialLoading:w,isLoading:w,data:p,dataUpdatedAt:u.dataUpdatedAt,error:m,errorUpdatedAt:_,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:u.dataUpdateCount>c.dataUpdateCount||u.errorUpdateCount>c.errorUpdateCount,isFetching:b,isRefetching:b&&!x,isLoadingError:S&&!D,isPaused:u.fetchStatus===`paused`,isPlaceholderData:d,isRefetchError:S&&D,isStale:E(e,t),refetch:this.refetch,promise:this.#o,isEnabled:h(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=O.data!==void 0,r=O.status===`error`&&!t,i=e=>{r?e.reject(O.error):t&&e.resolve(O.data)},a=()=>{i(this.#o=O.promise=g())},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||O.data!==o.value)&&a();break;case`rejected`:(!r||O.error!==o.reason)&&a();break}}return O}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!l(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){s.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function S(e,t){return h(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&t.retryOnMount===!1)}function C(e,t){return S(e,t)||e.state.data!==void 0&&w(e,t,t.refetchOnMount)}function w(e,t,n){if(h(t.enabled,e)!==!1&&a(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&E(e,t)}return!1}function T(e,t,n,r){return(e!==t||h(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&E(e,n)}function E(e,t){return h(t.enabled,e)!==!1&&e.isStaleByTime(a(t.staleTime,e))}function D(e,t){return!l(e.getCurrentResult(),t)}var O=e(t(),1),k=n(),A=O.createContext(void 0),j=e=>{let t=O.useContext(A);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},M=({client:e,children:t})=>(O.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,k.jsx)(A.Provider,{value:e,children:t})),N=O.createContext(!1),P=()=>O.useContext(N);N.Provider;function F(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var I=O.createContext(F()),L=()=>O.useContext(I),R=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?_(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},z=e=>{O.useEffect(()=>{e.clearReset()},[e])},B=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||_(n,[e.error,r])),V=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},H=(e,t)=>e.isLoading&&e.isFetching&&!t,U=(e,t)=>e?.suspense&&t.isPending,W=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function G(e,t,n){let r=P(),a=L(),o=j(n),c=o.defaultQueryOptions(e);o.getDefaultOptions().queries?._experimental_beforeQuery?.(c);let l=o.getQueryCache().get(c.queryHash);c._optimisticResults=r?`isRestoring`:`optimistic`,V(c),R(c,a,l),z(a);let u=!o.getQueryCache().get(c.queryHash),[f]=O.useState(()=>new t(o,c)),p=f.getOptimisticResult(c),m=!r&&e.subscribed!==!1;if(O.useSyncExternalStore(O.useCallback(e=>{let t=m?f.subscribe(s.batchCalls(e)):i;return f.updateResult(),t},[f,m]),()=>f.getCurrentResult(),()=>f.getCurrentResult()),O.useEffect(()=>{f.setOptions(c)},[c,f]),U(c,p))throw W(c,f,a);if(B({result:p,errorResetBoundary:a,throwOnError:c.throwOnError,query:l,suspense:c.suspense}))throw p.error;return o.getDefaultOptions().queries?._experimental_afterQuery?.(c,p),c.experimental_prefetchInRender&&!d.isServer()&&H(p,r)&&(u?W(c,f,a):l?.promise)?.catch(i).finally(()=>{f.updateResult()}),c.notifyOnChangeProps?p:f.trackResult(p)}function K(e,t){return G(e,x,t)}var q=y(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]);function J({role:e=`status`,"aria-live":t=`polite`,"aria-atomic":n=!0,className:r,eyebrow:i,stamp:a,title:o,children:s,detailLabel:c=`Technical detail`,detail:l,primaryLabel:u,onPrimary:d,primaryIcon:f,primaryDisabled:p,primaryBusy:m,secondaryLabel:h,onSecondary:g}){return(0,k.jsx)(`div`,{role:e,"aria-live":t,"aria-atomic":n,className:b(`relative overflow-hidden rounded-[var(--miravo-radius-stadium-lg)] border border-primary/20 bg-transparent`,r),children:(0,k.jsx)(`div`,{className:`p-5 sm:p-6`,children:(0,k.jsxs)(`div`,{className:`min-w-0 space-y-4`,children:[(0,k.jsxs)(`div`,{className:`space-y-3`,children:[(0,k.jsx)(`p`,{className:`font-mono text-[0.65rem] uppercase tracking-[0.38em] text-muted-foreground`,children:i}),(0,k.jsxs)(`div`,{className:`flex items-end gap-3`,children:[(0,k.jsx)(`span`,{className:`font-heading text-3xl font-black leading-none tracking-[-0.06em] text-transparent [-webkit-text-stroke:1px_color-mix(in_srgb,var(--primary)_50%,transparent)] sm:text-4xl`,"aria-hidden":!0,children:a}),(0,k.jsx)(`div`,{className:`mb-1.5 h-px min-w-8 flex-1 bg-linear-to-r from-primary/55 to-transparent`})]}),(0,k.jsx)(`h2`,{className:`text-lg font-semibold tracking-[-0.03em] text-foreground sm:text-xl`,children:o}),s?(0,k.jsx)(`div`,{className:`space-y-2 text-sm leading-relaxed text-muted-foreground`,children:s}):null]}),(0,k.jsxs)(`div`,{className:`rounded-[var(--miravo-radius-stadium-sm)] border border-border/80 bg-background/55 p-4 backdrop-blur-sm`,children:[(0,k.jsx)(`div`,{className:`mb-2 font-mono text-[0.65rem] uppercase tracking-[0.28em] text-muted-foreground`,children:c}),(0,k.jsx)(`p`,{className:`wrap-break-word font-mono text-sm leading-relaxed text-primary`,children:l})]}),(0,k.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:flex-wrap`,children:[(0,k.jsxs)(v,{type:`button`,onClick:d,disabled:!!(p||m),"aria-busy":m,className:b(`inline-flex w-full items-center justify-center gap-2 rounded-[var(--miravo-radius-stadium-sm)] border border-foreground/15 bg-foreground px-4 py-2.5 font-medium text-background shadow-none transition hover:bg-foreground/90 sm:w-auto`,m&&`pointer-events-none opacity-90`),children:[f,u]}),h&&g?(0,k.jsx)(v,{type:`button`,variant:`ghost`,size:`sm`,className:`sm:self-center`,onClick:g,children:h}):null]})]})})})}function Y({message:e,onRetry:t,isRetrying:n}){return(0,k.jsxs)(J,{role:`alert`,eyebrow:`Data link fault`,stamp:`ERR`,title:`Couldn't reach Miravo`,detail:e,primaryLabel:`Retry request`,onPrimary:t,primaryBusy:!!n,primaryIcon:(0,k.jsx)(q,{className:b(`size-4 shrink-0`,n&&`animate-spin`),"aria-hidden":!0}),children:[(0,k.jsxs)(`p`,{children:[(0,k.jsx)(`span`,{className:`text-foreground`,children:`Most often:`}),` the Miravo admin server isn't running, or this browser can't reach it (wrong host, port, or firewall).`]}),(0,k.jsx)(`p`,{children:`Start or restart Miravo if needed, use the correct link to the Miravo Console, then try again.`})]})}export{G as a,x as c,K as i,J as n,M as o,q as r,j as s,Y as t};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/fleet-
|
|
2
|
-
import{d as e}from"./chunk-OE4NN4TA-DBWZidbW.js";var t=[{test:e=>e===`/`,load:()=>e(()=>import(`./fleet-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/fleet-DmMO3ebD.js","assets/fleet-anqPXBbM.js","assets/rolldown-runtime-COnpUsM8.js","assets/chunk-OE4NN4TA-DBWZidbW.js","assets/vendor-charts-95ykyDlI.js","assets/api-CrYvIV3A.js","assets/vendor-ui-CWUk2ulb.js","assets/format-CshN6yEB.js","assets/utils-XFKvwlFT.js","assets/arrow-right-BjBb4z7g.js","assets/arrow-up-down-C1oJAmrw.js","assets/select-CmlY1M1a.js","assets/circle-question-mark-CJvcT6V6.js","assets/dist-xY0pK9Wy.js","assets/engine-store-DMULdR_V.js","assets/shallow-Cin0mLuv.js","assets/badge-eIn_7YrK.js","assets/combobox-BCaV1Wbo.js","assets/select-display-items-Bqb6Sbg6.js","assets/tooltip-D1ydB4g3.js","assets/transition-types-2i1blGlR.js","assets/catalog-DCLloXKb.js","assets/catalog-CMdsHJtX.js","assets/query-fetch-error-BWenDoLQ.js","assets/AnimatePresence-CPmH1DMY.js","assets/proxy-Be4WzmcS.js","assets/use-platform-stream-QBU2PAD2.js","assets/platform-targets-BIQ1lKOg.js","assets/tabs-4SeH2unv.js","assets/copy-button-BvU3RDZa.js","assets/checkbox-C_4HRnS_.js","assets/triangle-alert-BXrJNk3g.js","assets/label-CMBWxUhA.js","assets/get-error-message-BgE2BpPG.js","assets/catalog-template-icons-3S8RvUxD.js","assets/catalog-source-B3vWR4vX.js","assets/download-DmUZKo9N.js","assets/use-engine-command-mutation-CT_3rCP3.js","assets/runtime-link-PMxeHxd6.js","assets/models-Bmif9sIG.js","assets/models-B7FNHSvb.js","assets/activity-Cy_niK56.js","assets/events-D7PCqbvy.js","assets/events--facGImw.js","assets/auth-screen-backdrop-Cr8qBSXP.js","assets/use-transition-navigate-Br9xwrqi.js","assets/control-6TWF0ywx.js","assets/control-C_0G31vu.js","assets/validation-pFKbjwNg.js","assets/layers-1figUpjG.js","assets/transition-nav-link-BWSxzHUf.js","assets/tags-dBHY56Fz.js","assets/tags-zenGXuzO.js","assets/vendor-table-BAHQgdwg.js","assets/dropdown-menu-CrPXVXpG.js","assets/platforms-Djfu2pyM.js","assets/platforms-DGpl5tPh.js","assets/instance-detail-CDK2JYdW.js","assets/login-H82N0S2O.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{d as e}from"./chunk-OE4NN4TA-DBWZidbW.js";var t=[{test:e=>e===`/`,load:()=>e(()=>import(`./fleet-DmMO3ebD.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]))},{test:e=>e===`/catalog`,load:()=>e(()=>import(`./catalog-DCLloXKb.js`),__vite__mapDeps([21,22,2,5,6,4,23,7,8,24,25,26,11,27,28,12,29,19,30,31,16,32,33,34,35,36,37,14,38]))},{test:e=>e===`/models`,load:()=>e(()=>import(`./models-Bmif9sIG.js`),__vite__mapDeps([39,40,2,5,6,4,23,7,8,24,25,41,26,11,27,28,12,29,19,30,31,16,32,33,35,36,37,14,38]))},{test:e=>e===`/events`,load:()=>e(()=>import(`./events-D7PCqbvy.js`),__vite__mapDeps([42,43,2,3,4,5,6,23,7,8,24,25,11,14,44,16,17,18,45,33,38,20]))},{test:e=>e===`/control`,load:()=>e(()=>import(`./control-6TWF0ywx.js`),__vite__mapDeps([46,47,2,5,6,4,7,8,24,25,41,9,11,28,29,19,48,30,49,37,14,38,31,13,15,50,3,45,16,17,32]))},{test:e=>e===`/tags`,load:()=>e(()=>import(`./tags-dBHY56Fz.js`),__vite__mapDeps([51,52,2,3,4,5,6,23,7,8,53,10,11,27,29,19,36,13,14,44,17,54,32,33]))},{test:e=>e===`/platforms`,load:()=>e(()=>import(`./platforms-Djfu2pyM.js`),__vite__mapDeps([55,56,2,3,4,5,6,23,7,8,24,25,41,9,26,11,27,28,12,29,19,30,31,16,32,33,34,49,13,54]))},{test:e=>e.startsWith(`/instance/`),load:()=>e(()=>import(`./instance-detail-CDK2JYdW.js`),__vite__mapDeps([57,2,3,4,5,6,23,7,8,25,41,28,29,19,48,37,14,38,31,13,44,16,33,20]))},{test:e=>e===`/login`,load:()=>e(()=>import(`./login-H82N0S2O.js`),__vite__mapDeps([58,2,5,6,4,50,3,45,33]))}],n=new Set;function r(e){if(!e.startsWith(`/`))return null;let t=e.indexOf(`?`),n=e.indexOf(`#`),r=t===-1?n===-1?e.length:n:n===-1?t:Math.min(t,n);return e.slice(0,r)}function i(e){let i=r(e);if(!i||n.has(i))return;let a=t.find(e=>e.test(i));a&&(n.add(i),a.load().catch(()=>{n.delete(i)}))}export{i as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./tags-zenGXuzO.js";export{e as TagsPage};
|
|
@@ -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{S as r,b as i,it as a,o}from"./api-
|
|
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,it as a,o}from"./api-CrYvIV3A.js";import{i as s,t as c}from"./query-fetch-error-BWenDoLQ.js";import{i as l,n as u,t as d}from"./dist-xY0pK9Wy.js";import{n as f}from"./chunk-OE4NN4TA-DBWZidbW.js";import{a as p,i as m,n as h,o as g,r as _,s as v,t as y}from"./copy-button-BvU3RDZa.js";import{S as b,c as x,u as S,v as ee,w as C,x as w,y as te}from"./format-CshN6yEB.js";import{n as T,t as ne}from"./utils-XFKvwlFT.js";import{t as E}from"./arrow-up-down-C1oJAmrw.js";import{c as D,i as O,l as re,n as k,s as A,t as j}from"./select-CmlY1M1a.js";import{a as ie,n as M,r as N}from"./platform-targets-BIQ1lKOg.js";import{t as ae}from"./download-DmUZKo9N.js";import{i as P,n as F,t as I}from"./tooltip-D1ydB4g3.js";import{r as oe}from"./engine-store-DMULdR_V.js";import{n as se}from"./auth-screen-backdrop-Cr8qBSXP.js";import{a as ce,i as le,n as ue,o as de,r as fe,s as pe,t as me}from"./dropdown-menu-CrPXVXpG.js";import{t as L}from"./label-CMBWxUhA.js";import{n as he}from"./get-error-message-BgE2BpPG.js";import{a as R,i as z,n as B,o as ge,r as V,s as _e,t as H}from"./combobox-BCaV1Wbo.js";import{a as ve,i as ye,n as be,o as xe,r as Se,t as Ce}from"./vendor-table-BAHQgdwg.js";var we=T(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),Te=T(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),Ee=T(`braces`,[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]]),De=T(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Oe=T(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),ke=T(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),Ae=T(`table-2`,[[`path`,{d:`M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18`,key:`gugj83`}]]),U=e(t(),1),je={mqtt:`MQTT Client`,opcua:`OPC UA Client Advanced`,modbus:`Modbus TCP`},W={Boolean:`bool`,Int32:`int32`,UInt16:`uint16`,UInt32:`uint32`,Float:`float32`,Double:`float64`,String:`string`},G={float32:`float32`,int32:`int32`,uint32:`uint32`,uint16:`word`,boolean:`word`},Me=`deviceId,deviceName,driverName,name,tagName,description,valueType,registerId,publishCoV,tagFormula,metaData,Retain,Qos,address,count,pollingInterval,endianness`;function Ne(e,t,n){let r=[Me];for(let i of n){let n=je[i]??i;for(let a of e){let e=a.protocols[i];e&&r.push(K(i,{deviceName:t,driverName:n,memberName:a.member,browsePath:a.browsePath,dataType:a.dataType,protocolData:e,unit:a.unit,euRange:a.euRange,model:a.model,instance:a.instance,access:a.access}))}}return`${r.join(`
|
|
2
2
|
`)}\n`}function K(e,t){switch(e){case`mqtt`:return q(t);case`opcua`:return Pe(t);case`modbus`:return Fe(t);default:throw Error(`Unsupported LE export protocol: "${e}"`)}}function q(e){let t=typeof e.protocolData?.topic==`string`?e.protocolData.topic:`${e.browsePath}/${e.memberName}`;return[``,J(e.deviceName),J(e.driverName),J(t),J(e.memberName),``,`string`,``,`false`,``,Y(e),`Disable`,`0`,``,``,``,``].join(`,`)}function Pe(e){let t=typeof e.protocolData?.nodeId==`string`?e.protocolData.nodeId:`ns=1;s=${e.browsePath}/${e.memberName}`,n=W[e.dataType]??`string`;return[``,J(e.deviceName),J(e.driverName),J(t),J(e.memberName),``,n,``,`false`,``,Y(e),``,``,``,``,``,``].join(`,`)}function Fe(e){let t=G[String(e.protocolData?.registerType??``)]??Ie(e.dataType),n=e.protocolData?.address;return[``,J(e.deviceName),J(e.driverName),`H`,J(e.memberName),``,t,``,`false`,``,Y(e),``,``,typeof n==`number`?String(n):`0`,`1`,`1.0000000000`,`AB CD`].join(`,`)}function Ie(e){switch(e){case`Double`:case`Float`:return`float32`;case`Int32`:return`int32`;case`UInt32`:return`uint32`;case`Boolean`:case`UInt16`:return`word`;default:return`float32`}}function J(e){return e.includes(`,`)||e.includes(`"`)||e.includes(`
|
|
3
3
|
`)?`"${e.replace(/"/g,`""`)}"`:e}function Y(e){let t={uns_path:e.browsePath?`${e.browsePath}/${e.memberName}`:e.memberName,model:e.model,instance:e.instance,access:e.access};return e.unit!=null&&(t.unit=e.unit),e.euRange!=null&&(t.eu_range_min=String(e.euRange[0]),t.eu_range_max=String(e.euRange[1])),J(JSON.stringify(t))}var X=n(),Le={mqtt:`MQTT`,opcua:`OPC UA`,modbus:`Modbus`},Re=[{id:N.id,label:N.label}];function ze({open:e,onOpenChange:t,tags:n,totalTags:r,enabledProtocols:i,selectedInstance:a}){let[o,s]=(0,U.useState)(`litmus-edge`),[c,l]=(0,U.useState)(``),[u,d]=(0,U.useState)(``),f=(0,U.useRef)(null),y=(0,U.useRef)(!1);(0,U.useEffect)(()=>{e&&!y.current&&(s(N.id),l(a??``),d(i[0]??``),setTimeout(()=>f.current?.focus(),80)),y.current=e},[e,i,a]);let x=c.trim()!==``&&u!==``,S=o===N.id?x:!1,ee=(0,U.useCallback)(()=>{if(o===N.id){let e=Ne(n,c.trim(),[u]),r=new Blob([e],{type:`text/csv`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`${c.trim()}-litmus-edge-tags.csv`,a.click(),URL.revokeObjectURL(i),t(!1)}},[o,c,n,u,t]),C=n.length<r,te=(0,U.useMemo)(()=>[...Re.map(e=>({value:e.id,label:e.label})),...M.map(e=>({value:e.id,label:e.label}))],[]),T=(0,U.useMemo)(()=>i.map(e=>({value:e,label:Le[e]??e.toUpperCase()})),[i]);return(0,X.jsx)(h,{open:e,onOpenChange:t,children:(0,X.jsxs)(_,{className:`sm:max-w-lg`,children:[(0,X.jsxs)(g,{children:[(0,X.jsx)(v,{children:`Export for Platform`}),(0,X.jsx)(m,{children:C?`Exporting ${n.length} of ${r} tags based on current table filters.`:`Exporting all ${n.length} tags. Use table filters to narrow scope.`})]}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-4 py-1`,children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsx)(L,{className:`text-sm`,children:`Platform`}),(0,X.jsxs)(j,{value:o,onValueChange:e=>e&&s(e),items:te,children:[(0,X.jsx)(A,{className:`w-full text-sm`,children:(0,X.jsx)(D,{placeholder:`Select platform`})}),(0,X.jsxs)(k,{children:[Re.map(e=>(0,X.jsx)(O,{value:e.id,children:e.label},e.id)),M.map(e=>(0,X.jsx)(O,{value:e.id,disabled:!0,children:e.label},e.id))]})]})]}),o===N.id&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsxs)(L,{htmlFor:`device-name`,className:`text-sm`,children:[`Device name `,(0,X.jsx)(`span`,{className:`text-destructive`,children:`*`})]}),(0,X.jsx)(w,{id:`device-name`,ref:f,placeholder:`e.g. DTW-FAB-PLC`,value:c,onChange:e=>l(e.target.value),onKeyDown:e=>e.key===`Enter`&&S&&ee(),className:`font-mono text-sm`})]}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsx)(L,{className:`text-sm`,children:`Protocol`}),(0,X.jsxs)(j,{value:u||void 0,onValueChange:e=>e&&d(e),items:T,children:[(0,X.jsx)(A,{className:`w-full text-sm`,children:(0,X.jsx)(D,{placeholder:`Select a protocol`})}),(0,X.jsx)(k,{children:i.map(e=>(0,X.jsx)(O,{value:e,children:Le[e]??e.toUpperCase()},e))})]})]})]})]}),(0,X.jsxs)(p,{children:[(0,X.jsx)(b,{variant:`outline`,size:`sm`,onClick:()=>t(!1),children:`Cancel`}),(0,X.jsxs)(b,{size:`sm`,className:`gap-1.5`,disabled:!S,onClick:ee,children:[(0,X.jsx)(ae,{className:`size-3.5`}),`Download CSV`]})]})]})})}var Be=`border-border/70 bg-popover/98 font-body text-sm shadow-xl ring-1 ring-foreground/12 backdrop-blur-sm supports-backdrop-filter:bg-popover/90 p-1.5`,Ve=`px-2 pb-1 font-heading text-[9px] font-semibold tracking-[0.14em] text-muted-foreground uppercase`,He=`h-8 gap-1.5 border-border/80 bg-background/80 text-xs font-medium shadow-sm transition-colors hover:border-primary/35 hover:bg-accent/40`,Ue=`gap-2.5 rounded-[var(--miravo-radius-tight)] py-2 pl-2 pr-2 text-[13px] data-[highlighted]:bg-sidebar-accent data-[highlighted]:text-sidebar-accent-foreground`;function We({protocol:e,instance:t,model:n,member:r,enabledProtocols:i,hasFilters:a,memberSearchRef:o,onProtocolChange:s,onInstanceChange:c,onModelChange:l,onMemberChange:u,onClearFilters:d,onInstanceSearch:f,onModelSearch:p,filteredInstanceOptions:m,filteredModelOptions:h}){let g=(0,U.useMemo)(()=>[{value:`all`,label:`All protocols`},...i.map(e=>({value:e,label:e.toUpperCase()}))],[i]);return(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsxs)(j,{value:e||`all`,onValueChange:e=>s(!e||e===`all`?``:e),items:g,children:[(0,X.jsx)(A,{className:`h-8 w-[140px]`,"aria-label":`Protocol filter`,children:(0,X.jsx)(D,{placeholder:`All protocols`})}),(0,X.jsxs)(k,{alignItemWithTrigger:!1,align:`start`,children:[(0,X.jsx)(O,{value:`all`,children:`All protocols`}),i.map(e=>(0,X.jsx)(O,{value:e,children:e.toUpperCase()},e))]})]}),(0,X.jsxs)(H,{value:t?{value:t,label:x(t)}:null,onValueChange:e=>c(e?.value??``),isItemEqualToValue:(e,t)=>e?.value===t?.value,onInputValueChange:f,children:[(0,X.jsx)(V,{placeholder:`All instances`,className:`h-8 w-[200px]`,showClear:!!t}),(0,X.jsx)(B,{children:(0,X.jsxs)(R,{children:[m.map(([e,t])=>(0,X.jsxs)(z,{value:{value:e,label:x(e)},children:[(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:x(e)}),(0,X.jsxs)(`span`,{className:`shrink-0 tabular-nums text-muted-foreground`,children:[`(`,t,`)`]})]},e)),m.length===0&&(0,X.jsx)(`p`,{className:`py-2 text-center text-xs text-muted-foreground`,children:`No instances found`})]})})]}),(0,X.jsxs)(H,{value:n?{value:n,label:S(n)}:null,onValueChange:e=>l(e?.value??``),isItemEqualToValue:(e,t)=>e?.value===t?.value,onInputValueChange:p,children:[(0,X.jsx)(V,{placeholder:`All models`,className:`h-8 w-[200px]`,showClear:!!n}),(0,X.jsx)(B,{children:(0,X.jsxs)(R,{children:[h.map(([e,t])=>(0,X.jsxs)(z,{value:{value:e,label:S(e)},children:[(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:S(e)}),(0,X.jsxs)(`span`,{className:`shrink-0 tabular-nums text-muted-foreground`,children:[`(`,t,`)`]})]},e)),h.length===0&&(0,X.jsx)(`p`,{className:`py-2 text-center text-xs text-muted-foreground`,children:`No models found`})]})})]}),(0,X.jsxs)(`div`,{className:`relative`,children:[(0,X.jsx)(w,{ref:o,placeholder:`Search member…`,className:`h-8 w-[160px] pr-7`,value:r,onChange:e=>u(e.target.value)}),!r&&(0,X.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:`/`})]}),a&&(0,X.jsxs)(b,{variant:`ghost`,size:`sm`,className:`h-8 gap-1 text-xs`,onClick:d,children:[(0,X.jsx)(C,{className:`size-3`}),`Clear`]})]})}function Z({sorted:e}){return e===`asc`?(0,X.jsx)(Te,{className:`ml-1 inline size-3`}):e===`desc`?(0,X.jsx)(we,{className:`ml-1 inline size-3`}):(0,X.jsx)(E,{className:`ml-1 inline size-3 opacity-30`})}function Ge(e,t=1,n=2){let r=e.split(`/`);return r.length<=t+n+1?e:[...r.slice(0,t),`...`,...r.slice(-n)].join(`/`)}function Q({label:e,value:t,collapsible:n}){let r=n?Ge(t):t;return(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`p`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground`,children:e}),(0,X.jsx)(y,{value:t,label:`Copy ${e}`,tooltipSide:`top`,render:({icon:e})=>(0,X.jsxs)(`button`,{type:`button`,className:`mt-0.5 flex items-start gap-1 font-mono text-xs hover:text-foreground`,children:[n?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`break-all lg:hidden`,children:r}),(0,X.jsx)(`span`,{className:`hidden break-all lg:inline`,children:t})]}):(0,X.jsx)(`span`,{className:`break-all`,children:t}),(0,X.jsx)(`span`,{className:`mt-0.5 shrink-0 text-muted-foreground`,children:e})]})})]})}function Ke({tag:e,enabledProtocols:t}){let n=`${e.browsePath}/${e.member}`,r=e.protocols.opcua,i=e.protocols.modbus,a=e.access===`readwrite`?`rw`:e.access;return(0,X.jsxs)(`div`,{className:`flex flex-col gap-3 text-xs`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-x-10 gap-y-2.5`,children:[(0,X.jsx)(Q,{label:`Topic / UNS`,value:n,collapsible:!0}),t.includes(`opcua`)&&typeof r?.nodeId==`string`&&(0,X.jsx)(Q,{label:`OPC UA NodeId`,value:r.nodeId,collapsible:!0}),t.includes(`modbus`)&&i?.address!=null&&(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`p`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground`,children:`Modbus`}),(0,X.jsxs)(`p`,{className:`mt-0.5 font-mono`,children:[`addr=`,String(i.address),` regs=`,String(i.count),` `,String(i.registerType)]})]})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 text-muted-foreground`,children:[(0,X.jsxs)(I,{children:[(0,X.jsx)(P,{className:`font-mono`,render:(0,X.jsx)(`span`,{}),children:e.dataType}),(0,X.jsx)(F,{side:`top`,children:`Data type`})]}),e.unit&&(0,X.jsxs)(I,{children:[(0,X.jsx)(P,{className:`font-mono`,render:(0,X.jsx)(`span`,{}),children:e.unit}),(0,X.jsx)(F,{side:`top`,children:`Unit`})]}),(0,X.jsxs)(I,{children:[(0,X.jsx)(P,{className:`font-mono`,render:(0,X.jsx)(`span`,{}),children:a}),(0,X.jsx)(F,{side:`top`,children:`Access: r / w / rw`})]}),e.euRange&&(0,X.jsxs)(I,{children:[(0,X.jsxs)(P,{className:`font-mono`,render:(0,X.jsx)(`span`,{}),children:[`[`,e.euRange[0],`, `,e.euRange[1],`]`]}),(0,X.jsx)(F,{side:`top`,children:`EU range (min, max)`})]}),(0,X.jsxs)(I,{children:[(0,X.jsxs)(P,{render:(0,X.jsx)(f,{to:`/instance/${e.instance}`,className:`inline-flex items-center gap-1 text-primary underline-offset-4 hover:underline`,"aria-label":`Open instance`}),children:[`View instance`,(0,X.jsx)(ke,{className:`size-3`})]}),(0,X.jsx)(F,{side:`top`,children:`Open instance`})]})]})]})}var qe=[{id:`expand`,meta:{cellClass:`!pl-2 !pr-0 w-0`},header:()=>(0,X.jsx)(`span`,{className:`sr-only`,children:`Expand row`}),enableSorting:!1,cell:({row:e})=>(0,X.jsx)(`button`,{type:`button`,className:`inline-flex size-5 items-center justify-center rounded-[var(--miravo-radius-tight)] text-muted-foreground hover:text-foreground`,"aria-label":e.getIsExpanded()?`Collapse row`:`Expand row`,"aria-expanded":e.getIsExpanded(),onClick:t=>{t.stopPropagation(),e.toggleExpanded()},children:(0,X.jsx)(re,{className:`size-3.5 transition-transform ${e.getIsExpanded()?`rotate-0`:`-rotate-90`}`})})},{accessorKey:`instance`,header:({column:e})=>(0,X.jsxs)(`button`,{type:`button`,className:`inline-flex items-center`,onClick:e.getToggleSortingHandler(),children:[`Instance`,(0,X.jsx)(Z,{sorted:e.getIsSorted()})]}),cell:({getValue:e})=>(0,X.jsx)(`span`,{className:`block max-w-[18rem] truncate font-mono text-xs`,title:e(),children:e()})},{accessorKey:`member`,header:({column:e})=>(0,X.jsxs)(`button`,{type:`button`,className:`inline-flex items-center`,onClick:e.getToggleSortingHandler(),children:[`Member`,(0,X.jsx)(Z,{sorted:e.getIsSorted()})]}),cell:({getValue:e})=>(0,X.jsx)(`span`,{className:`block max-w-[20rem] truncate font-mono text-xs`,title:e(),children:e()})},{accessorKey:`model`,header:({column:e})=>(0,X.jsxs)(`button`,{type:`button`,className:`inline-flex items-center`,onClick:e.getToggleSortingHandler(),children:[`Model`,(0,X.jsx)(Z,{sorted:e.getIsSorted()})]}),cell:({getValue:e})=>(0,X.jsx)(`span`,{className:`block max-w-[18rem] truncate text-xs`,title:e(),children:e()})},{accessorKey:`dataType`,meta:{hideClass:`hidden lg:table-cell`},header:({column:e})=>(0,X.jsxs)(`button`,{type:`button`,className:`inline-flex items-center`,onClick:e.getToggleSortingHandler(),children:[`Type`,(0,X.jsx)(Z,{sorted:e.getIsSorted()})]}),cell:({getValue:e})=>(0,X.jsx)(`span`,{className:`font-mono text-xs`,children:e()})},{accessorKey:`unit`,meta:{hideClass:`hidden lg:table-cell`},header:`Unit`,enableSorting:!1,cell:({getValue:e})=>(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e()??`—`})},{accessorKey:`access`,meta:{hideClass:`hidden lg:table-cell`},header:`Access`,enableSorting:!1,cell:({getValue:e})=>{let t=e();return(0,X.jsx)(`span`,{className:`font-mono text-xs`,children:t===`readwrite`?`rw`:t})}}];function Je(e,t){let n=new Blob([e],{type:`text/csv`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=t,i.click(),URL.revokeObjectURL(r)}var Ye=[10,15,25,50,100],Xe=15,Ze=100;function Qe(e){return Ye.includes(e)?e:Xe}function $e(e){return/[",\r\n]/.test(e)?`"${e.replaceAll(`"`,`""`)}"`:e}function $(){let[e,t]=(0,U.useState)(!1),n=(0,U.useRef)(null);(0,U.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(),n.current?.focus())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let[p,m]=l(`protocol`,u.withDefault(``)),[h,g]=l(`instance`,u.withDefault(``)),[_,v]=l(`model`,u.withDefault(``)),[y,x]=l(`member`,u.withDefault(``)),[S,C]=l(`perPage`,d.withDefault(Xe)),w=Qe(S),T=oe(e=>e.instanceCount),E=s({queryKey:i.tags.manifest(T),queryFn:()=>o(`/manifest`,r.manifest),placeholderData:a}),M=E.data??null,N=E.isError,P=E.isPending&&!M&&!N,F=he(E.error,`Failed to fetch manifest.`),I=M?.tags??[],L=M?.summary?.enabledProtocols??[],R=(0,U.useDeferredValue)(y),z=(0,U.useMemo)(()=>I.filter(e=>e.kind===`variable`),[I]),B=(0,U.useMemo)(()=>{let e=new Map;for(let t of z)e.set(t.instance,(e.get(t.instance)??0)+1);return[...e.entries()].sort((e,t)=>e[0].localeCompare(t[0]))},[z]),V=(0,U.useMemo)(()=>{let e=new Map;for(let t of z)e.set(t.model,(e.get(t.model)??0)+1);return[...e.entries()].sort((e,t)=>e[0].localeCompare(t[0]))},[z]),H=(0,U.useMemo)(()=>{let e=R.trim().toLowerCase();if(!p&&!h&&!_&&!e)return z;let t=[];for(let n of z)p&&n.protocols[p]==null||h&&n.instance!==h||_&&n.model!==_||e&&!n.member.toLowerCase().includes(e)||t.push(n);return t},[z,p,h,_,R]),[we,Te]=(0,U.useState)([]),[ke,je]=(0,U.useState)({}),[W,G]=(0,U.useState)(0),Me=p!==``||h!==``||_!==``||y!==``,Ne=(0,U.useCallback)(()=>{m(``),g(``),v(``),x(``),G(0)},[m,g,v,x]),K=be({data:H,columns:qe,getCoreRowModel:Se(),getSortedRowModel:xe(),getExpandedRowModel:ye(),getRowCanExpand:()=>!0,getPaginationRowModel:ve(),onSortingChange:Te,onExpandedChange:je,onPaginationChange:e=>{let t=typeof e==`function`?e({pageIndex:W,pageSize:w}):e;G(t.pageIndex),C(t.pageSize)},state:{sorting:we,expanded:ke,pagination:{pageIndex:W,pageSize:w}}}),q=Math.ceil(H.length/w);(0,U.useEffect)(()=>{S!==w&&C(w)},[w,S,C]),(0,U.useEffect)(()=>{q>0&&W>=q&&G(q-1)},[q,W]);let Pe=(0,U.useCallback)(e=>{G(0),C(e)},[C]),Fe=(0,U.useCallback)(e=>{G(0),m(e)},[m]),Ie=(0,U.useCallback)(e=>{G(0),g(e)},[g]),J=(0,U.useCallback)(e=>{G(0),v(e)},[v]),Y=(0,U.useCallback)(e=>{G(0),x(e)},[x]),[Le,Re]=(0,U.useState)(``),[Z,Ge]=(0,U.useState)(``),Q=(0,U.useDeferredValue)(Le),$=(0,U.useDeferredValue)(Z),et=(0,U.useMemo)(()=>(Q?B.filter(([e])=>ee(e,Q)):B).slice(0,Ze),[B,Q]),tt=(0,U.useMemo)(()=>($?V.filter(([e])=>te(e,$)):V).slice(0,Ze),[V,$]),nt=K.getRowModel().rows,rt=nt.length,it=rt===0||H.length===0?0:W*w+1,at=rt===0||H.length===0?0:W*w+rt,ot=q,st=H.length===0||ot===0?0:W+1,ct=(0,U.useCallback)(()=>{let e=p?[p]:L,t=[`instance`,`member`,`model`,`dataType`,`unit`,`access`,`browsePath`,...e.includes(`mqtt`)?[`mqtt_topic`]:[],...e.includes(`opcua`)?[`opcua_nodeId`]:[],...e.includes(`modbus`)?[`modbus_address`,`modbus_count`,`modbus_encoding`]:[]],n=H.map(t=>{let n=t.protocols.mqtt,r=t.protocols.opcua,i=t.protocols.modbus;return[t.instance,t.member,t.model,t.dataType,t.unit??``,t.access,t.browsePath,...e.includes(`mqtt`)?[String(n?.topic??``)]:[],...e.includes(`opcua`)?[String(r?.nodeId??``)]:[],...e.includes(`modbus`)?[String(i?.address??``),String(i?.count??``),String(i?.registerType??``)]:[]]});Je([t.map($e).join(`,`),...n.map(e=>e.map($e).join(`,`))].join(`
|
|
4
4
|
`),`miravo-tags.csv`)},[H,p,L]);return N&&!M?(0,X.jsx)(se,{className:`min-h-full`,children:(0,X.jsx)(`div`,{className:`flex min-h-[40vh] flex-col items-center justify-center p-6 sm:p-12`,children:(0,X.jsx)(`div`,{className:`w-full max-w-md`,children:(0,X.jsx)(c,{message:F,onRetry:()=>void E.refetch(),isRetrying:E.isFetching})})})}):(0,X.jsxs)(`div`,{className:`mx-auto flex w-full max-w-screen-2xl flex-col gap-5 p-4 sm:gap-6 sm:p-6`,children:[N&&M?(0,X.jsx)(c,{message:`${F} Showing cached tags.`,onRetry:()=>void E.refetch(),isRetrying:E.isFetching}):null,(0,X.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,X.jsx)(`h1`,{className:`font-heading text-2xl font-semibold tracking-tight`,children:`Tag Explorer`}),(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:P?`Loading tag manifest...`:`${M?.summary?.totalInstances??0} instances · ${L.length} protocols`})]}),(0,X.jsxs)(me,{children:[(0,X.jsxs)(pe,{render:(0,X.jsx)(b,{variant:`outline`,size:`sm`,className:ne(He,`px-3`)}),children:[(0,X.jsx)(ae,{className:`size-3.5 opacity-90`,"aria-hidden":!0}),`Export`,(0,X.jsx)(re,{className:`size-3 opacity-60`,"aria-hidden":!0})]}),(0,X.jsx)(ue,{align:`end`,sideOffset:6,className:ne(`min-w-[13.5rem]`,Be),children:(0,X.jsxs)(fe,{children:[(0,X.jsx)(ce,{className:Ve,children:`Export`}),(0,X.jsx)(de,{className:`bg-border/60`}),(0,X.jsxs)(le,{onClick:ct,className:Ue,children:[(0,X.jsx)(Ae,{className:`size-3.5 shrink-0 text-primary`,"aria-hidden":!0}),`Download CSV`]}),(0,X.jsxs)(le,{onClick:()=>t(!0),className:Ue,children:[(0,X.jsx)(Ee,{className:`size-3.5 shrink-0 text-primary`,"aria-hidden":!0}),`Export for Platform…`]})]})})]})]}),(0,X.jsx)(We,{protocol:p,instance:h,model:_,member:y,enabledProtocols:L,hasFilters:Me,memberSearchRef:n,onProtocolChange:Fe,onInstanceChange:Ie,onModelChange:J,onMemberChange:Y,onClearFilters:Ne,onInstanceSearch:Re,onModelSearch:Ge,filteredInstanceOptions:et,filteredModelOptions:tt}),H.length!==z.length&&z.length>0&&(0,X.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Showing`,` `,(0,X.jsx)(`span`,{className:`font-medium tabular-nums text-foreground`,children:H.length}),` of`,` `,(0,X.jsx)(`span`,{className:`tabular-nums`,children:z.length}),` tags`]}),(0,X.jsx)(ge,{className:`min-w-0 py-0`,children:(0,X.jsx)(_e,{className:`p-0`,children:(0,X.jsx)(`div`,{className:`min-w-0 overflow-auto`,children:(0,X.jsxs)(`table`,{className:`w-full caption-bottom text-sm`,children:[(0,X.jsx)(`thead`,{className:`sticky top-0 z-10 border-b bg-background [&_tr]:border-b`,children:K.getHeaderGroups().map(e=>(0,X.jsx)(`tr`,{className:`border-b transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground`,children:e.headers.map(e=>{let t=e.column.columnDef.meta;return(0,X.jsx)(`th`,{className:`h-10 whitespace-nowrap px-1.5 text-left text-xs font-medium text-muted-foreground sm:px-4 ${t?.hideClass??``} ${t?.cellClass??``}`,children:e.isPlaceholder?null:Ce(e.column.columnDef.header,e.getContext())},e.id)})},e.id))}),(0,X.jsx)(`tbody`,{className:`[&_tr:last-child]:border-0`,children:P?null:nt.length>0?nt.map(e=>{let t=e.getIsExpanded(),n=e.getVisibleCells();return(0,X.jsxs)(U.Fragment,{children:[(0,X.jsx)(`tr`,{"aria-expanded":t,tabIndex:0,className:`cursor-pointer border-b transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:bg-sidebar-accent focus-visible:outline-none`,onClick:()=>e.toggleExpanded(),onKeyDown:t=>{t.key!==`Enter`&&t.key!==` `||(t.preventDefault(),e.toggleExpanded())},children:n.map(e=>{let t=e.column.columnDef.meta;return(0,X.jsx)(`td`,{className:`whitespace-nowrap px-1.5 py-1.5 text-left sm:px-4 ${t?.hideClass??``} ${t?.cellClass??``}`,children:Ce(e.column.columnDef.cell,e.getContext())},e.id)})}),t&&(0,X.jsx)(`tr`,{children:(0,X.jsx)(`td`,{colSpan:n.length,className:`p-0`,children:(0,X.jsx)(`div`,{className:`border-b`,children:(0,X.jsx)(`div`,{className:`px-1.5 py-3 pl-6 sm:px-4 sm:pl-10`,children:(0,X.jsx)(Ke,{tag:e.original,enabledProtocols:L})})})})})]},e.id)}):(0,X.jsx)(`tr`,{children:(0,X.jsx)(`td`,{colSpan:qe.length,className:`h-32 px-2 text-center sm:px-4`,children:z.length===0?(0,X.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,children:[(0,X.jsx)(Oe,{className:`size-8 text-muted-foreground`}),(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No tags available`}),(0,X.jsx)(f,{to:`/catalog`,className:`text-xs text-primary underline-offset-4 hover:underline`,children:`Start an environment from the Catalog to generate tags`})]}):(0,X.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`No matching tags.`,` `,(0,X.jsx)(`span`,{className:`text-xs`,children:`Try adjusting your filters.`})]})})})})]})})})}),(0,X.jsx)(`div`,{className:`px-3 py-2 text-xs text-muted-foreground`,children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between sm:gap-4`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3 sm:justify-start sm:gap-5`,children:[(0,X.jsxs)(`p`,{className:`min-w-0 leading-tight`,children:[(0,X.jsx)(`span`,{className:`font-medium tabular-nums text-foreground`,children:it===0?`0`:`${it}\u2013${at}`}),` `,(0,X.jsxs)(`span`,{className:`text-muted-foreground`,children:[`of `,H.length,` tags`]})]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 whitespace-nowrap`,children:[(0,X.jsxs)(j,{value:String(w),onValueChange:e=>e&&Pe(Number(e)),children:[(0,X.jsx)(A,{className:`h-8 w-[4.25rem]`,"aria-label":`Rows per page`,children:(0,X.jsx)(D,{})}),(0,X.jsx)(k,{children:Ye.map(e=>(0,X.jsx)(O,{value:String(e),children:e},e))})]}),(0,X.jsx)(`span`,{className:`hidden text-muted-foreground sm:inline`,children:`per page`})]})]}),(0,X.jsxs)(`nav`,{className:`flex items-center justify-center gap-2 border-border/60 border-t pt-2 sm:justify-end sm:border-0 sm:pt-0`,"aria-label":`Table pages`,children:[(0,X.jsx)(b,{variant:`outline`,size:`sm`,className:`h-8 w-8 shrink-0 p-0`,disabled:!K.getCanPreviousPage(),onClick:()=>K.previousPage(),"aria-label":`Previous page`,children:(0,X.jsx)(De,{className:`size-3.5`})}),(0,X.jsxs)(`span`,{className:`min-w-[5ch] text-center text-sm font-medium tabular-nums whitespace-nowrap text-foreground`,children:[st,` / `,ot]}),(0,X.jsx)(b,{variant:`outline`,size:`sm`,className:`h-8 w-8 shrink-0 p-0`,disabled:!K.getCanNextPage(),onClick:()=>K.nextPage(),"aria-label":`Next page`,children:(0,X.jsx)(ie,{className:`size-3.5`})})]})]})}),(0,X.jsx)(ze,{open:e,onOpenChange:t,tags:H,totalTags:I.length,enabledProtocols:L,selectedInstance:h||void 0})]})}export{$ as t};
|
package/console-dist/assets/{transition-nav-link-DVwZxiEL.js → transition-nav-link-BWSxzHUf.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{at as e}from"./vendor-ui-CWUk2ulb.js";import{r as t}from"./chunk-OE4NN4TA-DBWZidbW.js";import{t as n}from"./route-preload-
|
|
1
|
+
import{at as e}from"./vendor-ui-CWUk2ulb.js";import{r as t}from"./chunk-OE4NN4TA-DBWZidbW.js";import{t as n}from"./route-preload-CLRbqehb.js";import{t as r}from"./use-transition-navigate-Br9xwrqi.js";var i=e();function a(e){return e.button===0&&!e.metaKey&&!e.altKey&&!e.ctrlKey&&!e.shiftKey}function o({to:e,transitionType:o,preloadOnIntent:s=!0,onClick:c,...l}){let u=r();return(0,i.jsx)(t,{...l,to:e,onMouseEnter:t=>{l.onMouseEnter?.(t),s&&n(e)},onFocus:t=>{l.onFocus?.(t),s&&n(e)},onClick:t=>{c?.(t),!t.defaultPrevented&&(l.reloadDocument||l.target&&l.target!==`_self`||l.download||a(t)&&(t.preventDefault(),u(e,{transitionType:o})))}})}export{o as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{C as n,c as r,d as i,n as a,x as o}from"./api-
|
|
1
|
+
import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{C as n,c as r,d as i,n as a,x as o}from"./api-CrYvIV3A.js";import{l as s}from"./copy-button-BvU3RDZa.js";import{n as c}from"./utils-XFKvwlFT.js";import{r as l}from"./engine-store-DMULdR_V.js";import{n as u,r as d,t as f}from"./runtime-link-PMxeHxd6.js";var p=c(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),m=`group relative border border-solid border-border transition-colors hover:border-muted-foreground/25`,h=`group relative border border-solid border-border`,g=`blueprint-card ${m} overflow-hidden rounded-[var(--miravo-radius-stadium-sm)]`,_=`${h} w-full min-w-0 overflow-hidden rounded-[var(--miravo-radius-stadium-sm)] bg-transparent`,v=`${h} w-full min-w-0 overflow-hidden rounded-[var(--miravo-radius-stadium-sm)] bg-transparent`,y=`blueprint-card catalog-card-frame group relative border border-solid overflow-hidden rounded-[var(--miravo-radius-stadium-sm)]`,b=y,x=`border-border bg-muted/40 text-primary shadow-none hover:border-muted-foreground/30 hover:bg-muted/60 hover:text-primary focus-visible:border-ring border-border bg-muted/30 hover:border-muted-foreground/35 hover:bg-muted/45 [&_svg]:text-primary`,S=e(t(),1),C=new Set([`spawn`,`removeInstance`,`loadTemplate`,`unloadTemplateRun`,`resetEnvironment`,`enableAdapter`,`disableAdapter`]);function w(e){if(e instanceof f){s.error(`Command not sent`,{description:e.detail});return}if(e instanceof a){s.error(e.result.message,{description:e.result.error});return}if(n.is(e)){s.error(e.message,{description:e.hint});return}if(e instanceof TypeError){if(typeof navigator<`u`&&navigator.onLine===!1){s.error(`Command not sent`,{description:`This browser is offline — reconnect to the network and try again.`});return}let{connectionState:e}=l.getState(),t=d(e);if(t){s.error(`Command not sent`,{description:t});return}s.error(`Command failed`,{description:`Could not reach the Miravo server — it may have stopped or restarted.`});return}s.error(`Command failed`,{description:e instanceof Error?e.message:`Unknown error.`})}async function T(){try{let e=await r();if(o.setQueryData([`bootstrap`],e),e.authenticated){let t=l.getState();e.runtime.revision>=t.lastRevision&&t.replaceRuntime(e.runtime,{allowSameRevision:!0})}else l.getState().markUnauthenticated()}catch{}finally{o.invalidateQueries({queryKey:[`bootstrap`]})}}function E(){let[e,t]=(0,S.useState)(!1);return{mutate:(0,S.useCallback)(e=>{try{u(l.getState().connectionState)}catch(e){w(e);return}t(!0),i(e).then(t=>{if(s.success(t.message),C.has(e.type))return T()}).catch(w).finally(()=>{t(!1)})},[]),mutateAsync:(0,S.useCallback)(async e=>{try{u(l.getState().connectionState)}catch(e){throw w(e),e}t(!0);try{let t=await i(e);return s.success(t.message),C.has(e.type)&&await T(),t}catch(e){throw w(e),e}finally{t(!1)}},[]),isPending:e}}export{v as a,p as c,y as i,x as n,_ as o,g as r,b as s,E as t};
|