@miravo/cli-linux-arm64-musl 0.7.4 → 0.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/console-dist/assets/{api-DimikzPd.js → api-D8oAzcVE.js} +1 -1
- package/console-dist/assets/catalog-B70TugE6.js +1 -0
- package/console-dist/assets/{catalog-CbdG58Mn.js → catalog-B_wh8kje.js} +1 -1
- package/console-dist/assets/{catalog-source-C4jQdH37.js → catalog-source-BU77f8QO.js} +1 -1
- package/console-dist/assets/control-CaFfl-Mp.js +1 -0
- package/console-dist/assets/control-DCNd1A3U.js +1 -0
- package/console-dist/assets/events-BjMeLN1K.js +1 -0
- package/console-dist/assets/{events-BP1rvN5g.js → events-CeR9wTII.js} +1 -1
- package/console-dist/assets/fleet-C9wGf070.js +1 -0
- package/console-dist/assets/{fleet-ne7gllQE.js → fleet-CH141gbg.js} +1 -1
- package/console-dist/assets/{index-Ds1n4iXS.js → index-ClSUHPGP.js} +3 -3
- package/console-dist/assets/{instance-detail-k6fWu2DS.js → instance-detail-DWELGCE1.js} +1 -1
- package/console-dist/assets/{login-BmyMgUK4.js → login-C5dQKX2Y.js} +1 -1
- package/console-dist/assets/{models-C_UOiHSF.js → models-CFdqSxB3.js} +1 -1
- package/console-dist/assets/models-hAhKpuYB.js +1 -0
- package/console-dist/assets/platforms-Bh63oQIi.js +1 -0
- package/console-dist/assets/{platforms-CmsbDw-2.js → platforms-BwYPf2Sg.js} +1 -1
- package/console-dist/assets/{query-fetch-error-Bcg_UjHM.js → query-fetch-error-NbPqVPRR.js} +1 -1
- package/console-dist/assets/{route-preload-BO6weHRR.js → route-preload-DQgHHtBj.js} +2 -2
- package/console-dist/assets/{tags-DORoU260.js → tags-BI93Dvh2.js} +1 -1
- package/console-dist/assets/tags-_ufsHpn5.js +1 -0
- package/console-dist/assets/{transition-nav-link-nVD3H66a.js → transition-nav-link-Ct6VIy2S.js} +1 -1
- package/console-dist/assets/{use-engine-command-mutation-C8S_hX0O.js → use-engine-command-mutation-CcfqRB7j.js} +1 -1
- package/console-dist/assets/{use-platform-stream-CZLW085n.js → use-platform-stream-DBZo6HMM.js} +1 -1
- package/console-dist/assets/{use-transition-navigate-jMR-y4bs.js → use-transition-navigate-jTHkLHMS.js} +1 -1
- package/console-dist/assets/{validation-DLydiTzj.js → validation-DRj8OKvB.js} +1 -1
- package/console-dist/index.html +17 -17
- package/miravo +0 -0
- package/package.json +1 -1
- package/console-dist/assets/catalog-8tLjGq7E.js +0 -1
- package/console-dist/assets/control-4ugKUt8n.js +0 -1
- package/console-dist/assets/control-BVr4X_wI.js +0 -1
- package/console-dist/assets/events-BcZCvJ63.js +0 -1
- package/console-dist/assets/fleet-nhb_0n25.js +0 -1
- package/console-dist/assets/models-DiO_AS9_.js +0 -1
- package/console-dist/assets/platforms-npS30Kgk.js +0 -1
- package/console-dist/assets/tags-nwfbo5cT.js +0 -1
package/console-dist/assets/{use-platform-stream-CZLW085n.js → use-platform-stream-DBZo6HMM.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
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{C as r,S as i,T as a,f as o,m as s,p as c,t as l,w as u}from"./api-DimikzPd.js";import{t as d,u as f}from"./proxy-Be4WzmcS.js";import{t as p}from"./AnimatePresence-CPmH1DMY.js";import{a as m,i as h,l as g,n as _,o as v,r as ee,s as te,t as y}from"./copy-button-BvU3RDZa.js";import{S as b,T as x,w as S,x as C}from"./format-CshN6yEB.js";import{n as w,t as T}from"./utils-XFKvwlFT.js";import{a as E,c as D,i as O,l as ne,n as k,o as A,r as j,s as M,t as N}from"./select-CmlY1M1a.js";import{i as P,n as F,r as I,t as re}from"./platform-targets-BIQ1lKOg.js";import{a as L,c as R,o as z,s as ie}from"./tabs-4SeH2unv.js";import{t as B}from"./circle-question-mark-CJvcT6V6.js";import{i as ae,n as oe,r as se,t as ce}from"./checkbox-C_4HRnS_.js";import{t as le}from"./triangle-alert-BXrJNk3g.js";import{i as V,n as H,t as U}from"./tooltip-D1ydB4g3.js";import{t as ue}from"./badge-eIn_7YrK.js";import{t as W}from"./label-CMBWxUhA.js";var de=w(`ban`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M4.929 4.929 19.07 19.071`,key:`196cmz`}]]),fe=w(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),pe=w(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),me=w(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),he=w(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),ge=w(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),_e=w(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),ve=w(`list-checks`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]),ye=w(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),be=w(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),G=w(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),K=e(t(),1),xe=[`devices`,`models`,`instances`],Se=[`instances`,`models`,`devices`],Ce={devices:`DeviceHub devices`,models:`Digital Twins models`,instances:`Digital Twins instances`},we={devices:{apply:`DeviceHub device records and settings on Litmus Edge.`,cleanup:`Remove DeviceHub device records managed from Miravo.`},models:{apply:`Digital Twins model definitions synced to the platform.`,cleanup:`Remove Digital Twins model definitions created by Miravo.`},instances:{apply:`Digital Twins instances bound to DeviceHub devices.`,cleanup:`Remove Digital Twins instances deployed for this target.`}},Te=`Miravo calls this API.`;function Ee(e){return e.length>120?`Use at most 120 characters.`:/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(e)?null:`Use lowercase letters, numbers, and hyphens only (e.g. motor-001).`}var q=`Source host (Miravo)`,J=`Address Litmus Edge uses to reach your running Miravo environment.`,Y=n();function De({open:e,onOpenChange:t,type:n,label:r,targetLabel:i,hostname:a,sourceHostname:o,onConfirm:s,defaultDeviceName:c,applyPreview:l,cleanupPreview:u}){let f=n===`apply`?xe:Se,[p,g]=(0,K.useState)(new Set(f)),[v,y]=(0,K.useState)(!1),[x,S]=(0,K.useState)(!1),[w,E]=(0,K.useState)(``),[D,O]=(0,K.useState)(null),[k,A]=(0,K.useState)(`fail`),j=(0,K.useId)(),M=(0,K.useId)(),N=`if-unmanaged-${M}`,P=n===`apply`,F=P&&c!==void 0&&c!==``;(0,K.useEffect)(()=>{e&&(g(new Set(f)),y(!1),O(null),E(F?c??``:``),A(`fail`),S(!1))},[e,f,F,c]);let I={instances:`models`},re=e=>{g(t=>{let n=new Set(t);if(n.has(e)){n.delete(e);for(let[t,r]of Object.entries(I))r===e&&n.delete(t)}else{n.add(e);let t=I[e];t&&n.add(t)}return n})},L=P?l:u,R=()=>{L?.onPreview(),t(!1)};return(0,Y.jsx)(_,{open:e,onOpenChange:t,children:(0,Y.jsxs)(ee,{showCloseButton:!0,className:`flex max-h-[90vh] min-h-0 flex-col gap-0 overflow-hidden p-0 sm:max-w-120`,children:[(0,Y.jsxs)(`div`,{className:`shrink-0 border-b border-border/60 px-5 pb-3 pt-5`,children:[(0,Y.jsxs)(te,{className:`flex items-center gap-2 text-sm font-semibold leading-snug`,children:[P?(0,Y.jsx)(se,{className:`size-3.5 shrink-0 text-primary`,"aria-hidden":!0}):(0,Y.jsx)(G,{className:`size-3.5 shrink-0 text-destructive`,"aria-hidden":!0}),P?`Apply to Litmus Edge`:`Clean up Litmus Edge`]}),(0,Y.jsx)(h,{className:`sr-only`,children:P?`Review connection details and scope before applying.`:`Review target and cleanup scope before confirming.`})]}),(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-5 pt-4 pb-3`,children:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,Y.jsx)(`div`,{className:`text-xs leading-snug`,children:(0,Y.jsxs)(`dl`,{className:`flex flex-col gap-0`,children:[(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 items-start gap-x-4 border-b border-border/35 py-2.5 first:pt-0`,children:[(0,Y.jsx)(`dt`,{className:`min-w-0 pt-px text-[11px] font-medium text-muted-foreground`,children:P?`Resource`:`Target`}),(0,Y.jsx)(`dd`,{className:`min-w-0 wrap-break-word font-medium text-foreground`,children:r})]}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 items-start gap-x-4 border-b border-border/35 py-2.5`,children:[(0,Y.jsx)(`dt`,{className:`min-w-0 pt-px text-[11px] font-medium text-muted-foreground`,children:`Target`}),(0,Y.jsx)(`dd`,{className:`min-w-0 wrap-break-word font-medium text-foreground`,children:i})]}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 items-start gap-x-4 border-b border-border/35 py-2.5`,children:[(0,Y.jsx)(`dt`,{className:`min-w-0 pt-px`,children:(0,Y.jsxs)(`span`,{className:`inline-flex max-w-full items-center gap-1`,children:[(0,Y.jsx)(`span`,{className:`text-[11px] font-medium leading-snug text-muted-foreground`,children:`Litmus Edge API`}),(0,Y.jsxs)(U,{children:[(0,Y.jsx)(V,{type:`button`,className:`inline-flex size-5 shrink-0 items-center justify-center rounded-[var(--miravo-radius-tight)] text-muted-foreground hover:bg-muted hover:text-foreground`,"aria-label":`About Litmus Edge API`,children:(0,Y.jsx)(B,{className:`size-3`,"aria-hidden":!0})}),(0,Y.jsx)(H,{side:`top`,align:`start`,className:`max-w-xs text-left`,children:Te})]})]})}),(0,Y.jsx)(`dd`,{className:`min-w-0`,children:(0,Y.jsx)(`span`,{className:`break-all font-mono text-[11px] leading-normal text-foreground/90`,children:a})})]}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 items-start gap-x-4 border-b border-border/35 py-2.5`,children:[(0,Y.jsx)(`dt`,{className:`min-w-0 pt-px`,children:(0,Y.jsxs)(`span`,{className:`inline-flex max-w-full items-center gap-1`,children:[(0,Y.jsx)(`span`,{className:`text-[11px] font-medium leading-snug text-muted-foreground`,children:q}),(0,Y.jsxs)(U,{children:[(0,Y.jsx)(V,{type:`button`,className:`inline-flex size-5 shrink-0 items-center justify-center rounded-[var(--miravo-radius-tight)] text-muted-foreground hover:bg-muted hover:text-foreground`,"aria-label":`About ${q}`,children:(0,Y.jsx)(B,{className:`size-3`,"aria-hidden":!0})}),(0,Y.jsx)(H,{side:`top`,align:`start`,className:`max-w-xs text-left`,children:J})]})]})}),(0,Y.jsx)(`dd`,{className:`min-w-0`,children:(0,Y.jsx)(`span`,{className:`break-all font-mono text-[11px] leading-normal text-foreground/90`,children:o})})]})]})}),L?(0,Y.jsxs)(W,{className:T(`flex cursor-pointer items-center gap-2.5 text-[11px] font-medium leading-snug`,L.disabled&&`pointer-events-none opacity-50`),children:[(0,Y.jsx)(`span`,{className:`flex shrink-0 items-center`,children:(0,Y.jsx)(ce,{checked:x,onCheckedChange:e=>S(e===!0),disabled:L.disabled})}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 leading-snug`,children:P?`Dry run only — preview the plan without deploying`:`Dry run only — preview the plan without removing resources`})]}):null,F?(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(W,{htmlFor:j,className:`text-[11px] font-medium`,children:`Device name`}),(0,Y.jsx)(C,{id:j,value:w,onChange:e=>{E(e.target.value),O(null)},placeholder:c,autoComplete:`off`,spellCheck:!1,className:T(`h-9 font-mono text-xs`,D&&`border-destructive`),"aria-invalid":D!=null,"aria-describedby":`${j}-hint`}),(0,Y.jsx)(`p`,{id:`${j}-hint`,className:`text-[11px] leading-snug text-foreground/76`,children:`Same name on a later run updates this device; change it to add another.`}),D?(0,Y.jsx)(`p`,{className:`text-[11px] text-destructive`,children:D}):null]}):null,(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsxs)(`button`,{type:`button`,className:`group flex w-full items-center justify-between gap-2 rounded-[var(--miravo-radius-tight)] bg-muted/40 px-2.5 py-2 text-left text-[11px] font-medium text-muted-foreground transition-colors hover:bg-muted/60 hover:text-foreground aria-expanded:bg-muted/55 aria-expanded:text-foreground`,onClick:()=>y(e=>!e),"aria-expanded":v,children:[`Advanced`,(0,Y.jsx)(ne,{className:T(`size-3.5 shrink-0 text-muted-foreground transition-transform ease-out group-hover:text-foreground/80`,v?`duration-500 rotate-180 text-foreground/80`:`duration-280`),"aria-hidden":!0})]}),(0,Y.jsxs)(d.div,{initial:!1,animate:{maxHeight:v?520:0,opacity:+!!v},transition:{maxHeight:{duration:v?.52:.28,ease:v?[.16,1,.3,1]:[.4,0,.2,1]},opacity:{duration:v?.42:.24,ease:v?[.16,1,.3,1]:[.4,0,.2,1]}},className:T(`overflow-hidden`,!v&&`pointer-events-none`),"aria-hidden":!v,inert:!v,children:[(0,Y.jsx)(`div`,{className:`flex flex-col gap-1 pt-px`,children:f.map(e=>{let t=Object.entries(I).find(([t,n])=>n===e)?.[0],n=t!==void 0&&p.has(t),r=P?we[e].apply:we[e].cleanup;return(0,Y.jsxs)(W,{htmlFor:`scope-${e}`,className:T(`flex min-h-9 cursor-pointer items-start gap-2 rounded-[var(--miravo-radius-tight)] border border-border/40 bg-muted/10 px-2.5 py-1.5 text-[11px] transition-colors`,n?`opacity-95`:`hover:bg-muted/25`),children:[(0,Y.jsx)(`span`,{className:`pt-0.5`,children:(0,Y.jsx)(ce,{id:`scope-${e}`,checked:p.has(e),disabled:n,onCheckedChange:()=>re(e)})}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1 leading-snug`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-foreground`,children:Ce[e]}),(0,Y.jsx)(`span`,{className:`mt-0.5 block text-[11px] font-normal leading-tight text-muted-foreground`,children:r})]}),n?(0,Y.jsx)(`span`,{className:`shrink-0 self-start rounded-[var(--miravo-radius-tight)] border border-primary/35 bg-primary/10 px-1.5 py-px text-[10px] font-semibold uppercase tracking-wide text-primary`,title:`Required when Digital Twins instances are selected (models must stay in scope).`,children:`Required`}):null]},e)})}),P&&(0,Y.jsxs)(`div`,{className:`mt-2.5 space-y-1.5 border-t border-border/40 pt-2`,children:[(0,Y.jsx)(`p`,{id:`${M}-legend`,className:`text-[11px] font-medium uppercase tracking-wide text-foreground/80`,children:`Collision policy`}),(0,Y.jsxs)(`div`,{role:`radiogroup`,"aria-labelledby":`${M}-legend`,className:`flex flex-col gap-1`,children:[(0,Y.jsxs)(W,{htmlFor:`if-unmanaged-fail`,className:T(`flex cursor-pointer items-start gap-2 rounded-[var(--miravo-radius-tight)] border px-2.5 py-2 text-[11px] transition-colors`,k===`fail`?`border-primary/45 bg-primary/8`:`border-border/40 bg-muted/10 hover:bg-muted/25`),children:[(0,Y.jsx)(`input`,{id:`if-unmanaged-fail`,type:`radio`,name:N,value:`fail`,checked:k===`fail`,onChange:()=>A(`fail`),className:`mt-0.5 size-3.5 shrink-0 accent-primary`}),(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-foreground`,children:`Fail if unmanaged exists`}),(0,Y.jsx)(`span`,{className:`mt-px block text-[11px] leading-tight text-foreground/74`,children:`Stop if the target has unmanaged resources.`})]})]}),(0,Y.jsxs)(W,{htmlFor:`if-unmanaged-skip`,className:T(`flex cursor-pointer items-start gap-2 rounded-[var(--miravo-radius-tight)] border px-2.5 py-2 text-[11px] transition-colors`,k===`skip`?`border-primary/45 bg-primary/8`:`border-border/40 bg-muted/10 hover:bg-muted/25`),children:[(0,Y.jsx)(`input`,{id:`if-unmanaged-skip`,type:`radio`,name:N,value:`skip`,checked:k===`skip`,onChange:()=>A(`skip`),className:`mt-0.5 size-3.5 shrink-0 accent-primary`}),(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-foreground`,children:`Skip unmanaged resources`}),(0,Y.jsx)(`span`,{className:`mt-px block text-[11px] leading-tight text-foreground/74`,children:`Only update resources managed by Miravo.`})]})]})]})]})]}),p.size===0&&!(x&&L)?(0,Y.jsx)(`p`,{className:`text-[11px] text-destructive`,children:`Select at least one scope or reopen to reset.`}):null]})]})}),(0,Y.jsxs)(m,{className:`mx-0 mb-0 shrink-0 flex flex-col gap-2 border-t border-border/60 px-5 py-4 sm:flex-row sm:justify-end`,children:[(0,Y.jsx)(b,{type:`button`,variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,Y.jsx)(b,{type:`button`,variant:P||x&&u?`default`:`destructive`,onClick:()=>{if(x&&L){R();return}let e=f.filter(e=>p.has(e));if(e.length!==0){if(F){let t=w.trim(),n=t===``?c??``:t.toLowerCase(),r=Ee(n);if(r){O(r);return}O(null),s({scope:e,deviceName:n,ifUnmanaged:k});return}s({scope:e,ifUnmanaged:k})}},disabled:x&&L?L.disabled||L.planLoading:p.size===0,children:P?x&&l?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(ve,{className:`size-3`,"aria-hidden":!0}),`Preview changes`]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(se,{className:`size-3`,"aria-hidden":!0}),`Apply`]}):x&&u?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(ve,{className:`size-3`,"aria-hidden":!0}),`Preview changes`]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(G,{className:`size-3`,"aria-hidden":!0}),`Clean up`]})})]})]})})}var Oe={initial:{scale:0,opacity:0},animate:{scale:1,opacity:1,originY:0},exit:{scale:0,opacity:0},transition:{type:`spring`,stiffness:350,damping:40}},ke={initial:{opacity:0,y:6},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{type:`tween`,duration:.22,ease:[.16,1,.3,1]}};function Ae({children:e,variant:t=`default`}){let n=t===`default`;return(0,Y.jsx)(d.div,{...n?Oe:ke,layout:n,className:`mx-auto w-full`,children:e})}var je=K.memo(({children:e,className:t,delay:n=1e3,...r})=>{let[i,a]=(0,K.useState)(0),o=(0,K.useMemo)(()=>K.Children.toArray(e),[e]);(0,K.useEffect)(()=>{let e=null;return i<o.length-1&&(e=setTimeout(()=>{a(e=>(e+1)%o.length)},n)),()=>{e!==null&&clearTimeout(e)}},[i,n,o.length]);let s=(0,K.useMemo)(()=>o.slice(0,i+1).reverse(),[i,o]);return(0,Y.jsx)(`div`,{className:T(`flex flex-col items-center gap-4`,t),...r,children:(0,Y.jsx)(p,{children:s.map(e=>(0,Y.jsx)(Ae,{children:e},e.key))})})});je.displayName=`AnimatedList`;var Me=`could not load certificate or private key from pki`;function Ne(e){return e.status===`running`?e.operation?e.operation.type===`apply`?`Apply`:`Cleanup`:`Connecting`:e.status===`error`?`Failed`:e.operation&&e.status===`complete`?e.operation.status===`cancelled`?`Cancelled`:`Complete`:null}function Pe(e){return(e?.toLowerCase()??``).includes(Me)}function Fe(e,t){if(e===`cleanup`)return`Try cleanup again to resume.`;let n=t?.toLowerCase()??``;return Pe(t)?`Litmus Edge DeviceHub could not start the OPC UA device because its PKI files are broken. Delete the stopped device in DeviceHub, repair /var/lib/loopedge-dh/db/OPC_UA_Client_Advanced/, then run apply again.`:n.includes(`unmanaged device`)||n.includes(`unmanaged instance`)?`Update the collision policy, try apply again to resume, or clean up the created resources.`:`Try apply again to resume, or clean up the created resources.`}function Ie(e){let t=e.operation,n=t?.type===`apply`?`apply`:`cleanup`;switch(e.status){case`running`:return{title:`Operation in progress`,subtitle:`Streaming ${n} steps to Litmus Edge`};case`complete`:return t?.status===`cancelled`?{title:`Operation cancelled`,subtitle:`Stopped — resources created so far remain in Litmus Edge.`}:{title:`Operation complete`,subtitle:n===`apply`?`Apply finished — review the summary below.`:`Cleanup finished — review the summary below.`};case`error`:return{title:`Operation failed`,subtitle:t?.type===`apply`&&Pe(e.error??t?.error)?`OPC UA device stopped on Litmus Edge — repair DeviceHub PKI and retry apply.`:e.error??t?.error??`The operation ended with an error.`};default:return{title:`Operation`,subtitle:``}}}function X({type:e,errorMessage:t,className:n}){let r=Fe(e,t);return(0,Y.jsxs)(`div`,{className:T(`flex items-start gap-1.5 rounded-[var(--miravo-radius-tight)] border border-info/40 bg-info/10 px-2.5 py-1.5 text-[10px] font-medium leading-relaxed`,n),children:[(0,Y.jsx)(ae,{className:`mt-0.5 size-3 shrink-0 text-info`,"aria-hidden":!0}),(0,Y.jsx)(`p`,{className:`min-w-0 flex-1 text-left whitespace-normal break-words text-foreground/80 [overflow-wrap:anywhere]`,children:r})]})}var Le=`text-destructive hover:bg-destructive/25 hover:text-foreground`,Re={device:`Devices`,tags:`Tags`,model:`Models`,instance:`Instances`,"param-sync":`Parameters`};function ze(e){return Re[e]??e}function Be(e){switch(e){case`create`:return`border border-success/30 bg-success/15 text-success`;case`update`:return`border border-chart-3/30 bg-chart-3/15 text-chart-3`;case`replace`:return`border border-warning/30 bg-warning/15 text-warning`;case`delete`:return`border border-destructive/30 bg-destructive/15 text-destructive`;case`noop`:return`border border-border/60 bg-muted/70 text-foreground/75`;default:return`border border-border/50 bg-muted/80 text-foreground/85`}}function Ve(e){return e===`noop`?`no-op`:e}function He({status:e}){switch(e){case`success`:return(0,Y.jsx)(R,{className:`size-3.5 shrink-0 text-success`});case`failed`:return(0,Y.jsx)(ie,{className:`size-3.5 shrink-0 text-destructive`});case`pending`:return(0,Y.jsx)(z,{className:`size-3.5 shrink-0 animate-spin text-primary/90`})}}function Ue({status:e}){switch(e){case`done`:return(0,Y.jsx)(R,{className:`size-3.5 text-success`});case`active`:return(0,Y.jsx)(z,{className:`size-3.5 animate-spin text-primary`});case`pending`:return(0,Y.jsx)(me,{className:`size-3.5 text-foreground/55`})}}function We({entry:e}){let[t,n]=(0,K.useState)(!1);return(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,Y.jsxs)(`button`,{type:`button`,className:T(`flex items-center gap-2 rounded-[var(--miravo-radius-tight)] px-2 py-1 text-left transition-colors`,e.error?`cursor-pointer hover:bg-muted/40`:`cursor-default`),onClick:()=>e.error&&n(!t),disabled:!e.error,children:[(0,Y.jsx)(He,{status:e.status}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[11px] text-foreground`,children:e.name}),(0,Y.jsx)(`span`,{className:T(`inline-flex rounded-[var(--miravo-radius-tight)] px-1.5 py-0.5 text-[9px] font-medium uppercase tracking-wider`,Be(e.action)),children:Ve(e.action)}),e.error&&(0,Y.jsx)(ne,{className:T(`size-3 text-foreground/75 transition-transform`,t&&`rotate-180`)})]}),(0,Y.jsx)(p,{initial:!1,children:t&&e.error&&(0,Y.jsxs)(d.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:`auto`},exit:{opacity:0,height:0},transition:{duration:.18},className:`overflow-hidden`,children:[(0,Y.jsxs)(`div`,{className:`mb-0 flex min-w-0 w-full items-center gap-1.5 rounded-[var(--miravo-radius-tight)] border border-destructive/40 bg-destructive/15 px-2.5 py-1.5 text-[10px] font-medium leading-relaxed`,children:[(0,Y.jsx)(`p`,{className:`min-w-0 flex-1 text-left whitespace-normal break-words text-destructive [overflow-wrap:anywhere]`,children:e.error}),(0,Y.jsx)(y,{value:e.error,label:`Copy error`,className:T(Le,`shrink-0`)})]}),(0,Y.jsx)(X,{type:`apply`,errorMessage:e.error,className:`mb-1 mt-2.5 w-full min-w-0`})]})})]})}function Ge({phase:e,open:t,onOpenChange:n}){let r=e.resources.length,i=r===e.total,a=e.resources.length>0;return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,Y.jsxs)(`button`,{type:`button`,className:T(`flex w-full items-center gap-2 rounded-[var(--miravo-radius-tight)] px-1 py-1 text-left transition-colors`,a&&`hover:bg-muted/40`,!a&&`cursor-default`),disabled:!a,"aria-expanded":a?t:void 0,onClick:()=>a&&n(!t),children:[(0,Y.jsx)(Ue,{status:e.status}),(0,Y.jsx)(`span`,{className:`text-xs font-medium tracking-wide text-foreground`,children:ze(e.name)}),(0,Y.jsxs)(`span`,{className:`font-mono text-[10px] text-foreground/70`,children:[r,`/`,e.total]}),(0,Y.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1.5`,children:[i&&e.status===`done`&&(0,Y.jsx)(R,{className:`size-3 text-success`}),a&&(0,Y.jsx)(ne,{className:T(`size-3 text-foreground/75 transition-transform`,!t&&`-rotate-90`),"aria-hidden":!0})]})]}),(0,Y.jsx)(p,{initial:!1,children:a&&t&&(0,Y.jsx)(d.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:`auto`},exit:{opacity:0,height:0},transition:{duration:.25,ease:[.16,1,.3,1]},className:`overflow-hidden`,children:(0,Y.jsx)(`div`,{className:`ml-2 flex min-w-0 flex-col border-l border-border/55 pl-2.5 pr-1.5 pb-1 pt-0.5`,children:(0,Y.jsx)(f.Provider,{value:null,children:e.resources.map((e,t)=>(0,Y.jsx)(Ae,{variant:`subtle`,children:(0,Y.jsx)(We,{entry:e})},`${e.name}-${t}`))})})})})]})}function Ke({operation:e}){let t=e.status===`complete`,n=e.status===`cancelled`,r=e.failed>0,i=e.totalPlanned>0?Math.min(100,Je(e)/e.totalPlanned*100):0;return(0,Y.jsx)(`div`,{className:`h-1 w-full overflow-hidden rounded-full bg-muted/55`,role:`progressbar`,"aria-valuenow":Math.round(i),"aria-valuemin":0,"aria-valuemax":100,"aria-label":`Operation progress`,children:(0,Y.jsx)(d.div,{"aria-hidden":`true`,className:T(`h-full rounded-full transition-colors duration-500`,n?`bg-foreground/30`:t&&!r?`bg-success`:`bg-warning`),initial:{width:`0%`},animate:{width:`${i}%`},transition:{duration:.4,ease:[.25,.1,.25,1]}})})}function qe(e){return e.duration==null?(Date.now()-e.startedAt)/1e3:e.duration/1e3}function Je(e){let t=e.applied+e.failed;return e.totalPlanned>0?Math.min(t,e.totalPlanned):t}function Ye(e,t){let n=e.label;return t?.length?t.find(e=>e.id===n)?.name??n:n}var Xe={complete:{Icon:R,className:`size-4 text-success`},partial:{Icon:pe,className:`size-4 text-warning`},cancelled:{Icon:de,className:`size-4 text-foreground/65`},error:{Icon:ie,className:`size-4 text-destructive`},running:{Icon:z,className:`size-4 animate-spin text-warning`}};function Ze({icon:e,className:t}){return(0,Y.jsx)(d.div,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},transition:{type:`spring`,stiffness:500,damping:30},className:`shrink-0`,children:(0,Y.jsx)(e,{className:t})})}function Qe({operation:e,sourceLabel:t,isAllExpanded:n,onToggleAll:r}){let i=qe(e),a=Je(e),o=e.status===`complete`,s=e.status===`cancelled`,c=e.status===`error`,l=e.failed>0,u=o&&!l?`complete`:o&&l?`partial`:s?`cancelled`:c?`error`:`running`,f=Xe[u];return(0,Y.jsxs)(`div`,{className:T(`sticky top-0 z-10 flex min-w-0 w-full flex-col gap-1.5 rounded-[var(--miravo-radius-stadium-sm)] border px-3 pt-2.5 pb-3.5 backdrop-blur-sm transition-colors duration-500`,o&&!l&&`border-success/30 bg-success/5`,o&&l&&`border-warning/30 bg-warning/5`,s&&`border-border/60 bg-muted/50`,c&&`border-destructive/30 bg-destructive/5`,!o&&!s&&!c&&`border-warning/20 bg-warning/5`),children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,Y.jsx)(p,{mode:`wait`,initial:!1,children:(0,Y.jsx)(Ze,{icon:f.Icon,className:f.className},u)}),(0,Y.jsx)(`span`,{className:`text-xs font-medium leading-none text-foreground`,children:s?`Cancelled`:o?l?`Completed with errors`:`Complete`:c?`Failed`:e.retryPending?`Failed, retrying attempt ${e.attempt?e.attempt+1:2}/${e.maxAttempts} in ${e.retryDelayMs?e.retryDelayMs/1e3:3}s...`:e.attempt&&e.maxAttempts&&e.attempt>1?`Retrying attempt ${e.attempt}/${e.maxAttempts}...`:e.type===`apply`?`Applying...`:`Cleaning up...`}),(0,Y.jsxs)(`span`,{className:`w-full min-w-0 text-[10px] leading-tight text-foreground/78`,children:[(0,Y.jsx)(`span`,{className:`font-sans break-words`,children:t}),(0,Y.jsx)(`span`,{className:`font-mono break-words`,children:` → ${e.environment}`})]})]}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Y.jsx)(ue,{variant:`secondary`,className:`h-5 min-h-5 gap-0 overflow-hidden border border-border/50 bg-muted/70 px-1.5 !py-0 font-mono text-[10px] leading-none text-foreground shadow-sm [&>span]:inline-flex [&>span]:items-center`,children:(0,Y.jsxs)(`span`,{className:`gap-1`,children:[(0,Y.jsx)(p,{mode:`popLayout`,initial:!1,children:(0,Y.jsx)(d.span,{initial:{opacity:0,y:-6},animate:{opacity:1,y:0},exit:{opacity:0,y:6},transition:{type:`spring`,stiffness:500,damping:35},className:`inline tabular-nums`,children:a},a)}),`/`,e.totalPlanned,(0,Y.jsx)(`span`,{className:`text-foreground/72`,children:e.type===`apply`?`applied`:`deleted`})]})}),(0,Y.jsx)(p,{initial:!1,children:e.failed>0&&(0,Y.jsx)(d.div,{className:`inline-flex items-center`,initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},transition:{type:`spring`,stiffness:500,damping:30},children:(0,Y.jsxs)(ue,{variant:`destructive`,className:`h-5 min-h-5 gap-0 border border-destructive/35 bg-destructive/20 px-1.5 !py-0 font-mono text-[10px] font-semibold leading-none text-destructive`,children:[e.failed,` failed`]})})})]}),(0,Y.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:[(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-mono text-[10px] leading-none text-foreground/75`,children:[(0,Y.jsx)(he,{className:`size-3 shrink-0 block text-foreground/65`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`tabular-nums leading-none`,children:typeof i==`number`?`${i.toFixed(1)}s`:`...`})]}),r&&(0,Y.jsx)(`div`,{className:`flex items-center border-l border-border/40 pl-2`,children:(0,Y.jsx)(`button`,{type:`button`,onClick:r,className:`flex size-4.5 items-center justify-center rounded-[var(--miravo-radius-tight)] text-foreground/55 transition-colors hover:bg-muted/60 hover:text-foreground`,"aria-label":n?`Collapse all phases`:`Expand all phases`,title:n?`Collapse all`:`Expand all`,children:(0,Y.jsx)(fe,{className:T(`size-3.5 transition-transform duration-300`,!n&&`opacity-70 scale-y-[-1]`)})})})]})]}),(0,Y.jsx)(Ke,{operation:e})]})]})}function $e(e){return e?e.closest(`[data-edge-op-scroll]`)??e.closest(`.overflow-y-auto`):null}var et=350;function Z(e){e?.scrollIntoView({block:`end`,behavior:`auto`,inline:`nearest`})}function tt(e){let t=()=>Z(e);t(),requestAnimationFrame(t),requestAnimationFrame(()=>requestAnimationFrame(t)),window.setTimeout(t,0),window.setTimeout(t,48),window.setTimeout(t,120)}function nt({logs:e}){return e.length===0?null:(0,Y.jsx)(`div`,{className:`flex min-w-0 flex-col gap-1.5 px-2 pb-2`,children:e.map(e=>(0,Y.jsxs)(`div`,{className:T(`flex min-w-0 items-start gap-2 rounded-[var(--miravo-radius-tight)] border px-2.5 py-2 text-xs`,e.level===`error`?`border-destructive/35 bg-destructive/12 text-destructive`:e.level===`warn`?`border-warning/35 bg-warning/12 text-warning`:`border-primary/25 bg-primary/8 text-foreground/82`),children:[e.level===`info`?(0,Y.jsx)(ae,{className:`mt-0.5 size-3.5 shrink-0 text-primary`,"aria-hidden":!0}):(0,Y.jsx)(pe,{className:`mt-0.5 size-3.5 shrink-0`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 wrap-anywhere`,children:e.message})]},e.id))})}function rt({operation:e,catalogTemplates:t,logs:n}){let r=(0,K.useRef)(null),i=(0,K.useRef)(null),a=(0,K.useRef)(!0),o=(0,K.useRef)(e.status);o.current=e.status;let s=(0,K.useRef)(!1),[c,l]=(0,K.useState)(new Set),u=(0,K.useMemo)(()=>Ye(e,t),[e,t]);(0,K.useLayoutEffect)(()=>{let e=$e(r.current);if(!e)return;let t=()=>{a.current=e.scrollHeight-e.scrollTop-e.clientHeight<et};return e.addEventListener(`scroll`,t,{passive:!0}),t(),()=>{e.removeEventListener(`scroll`,t)}},[]),(0,K.useLayoutEffect)(()=>{if(e.status===`running`){a.current&&Z(i.current),s.current=!0;return}s.current&&=(tt(i.current),!1)},[e.status,e.applied,e.failed,e.phases]),(0,K.useEffect)(()=>{if(e.status!==`running`)return;let t=r.current;if(!t)return;let n=0,s=new ResizeObserver(()=>{cancelAnimationFrame(n),n=requestAnimationFrame(()=>{o.current===`running`&&a.current&&Z(i.current)})});return s.observe(t),a.current&&Z(i.current),()=>{s.disconnect(),cancelAnimationFrame(n)}},[e.status]);let f=e.phases.length>0,m=c.size===0;return(0,Y.jsxs)(`div`,{ref:r,className:`flex min-w-0 w-full flex-col gap-2`,children:[(0,Y.jsx)(Qe,{operation:e,sourceLabel:u,isAllExpanded:m,onToggleAll:f?()=>{l(m?new Set(e.phases.map(e=>e.name)):new Set)}:void 0}),(0,Y.jsx)(`div`,{className:`flex flex-col gap-1 px-2 pt-2 pb-4`,children:e.phases.map(e=>(0,Y.jsx)(`div`,{children:(0,Y.jsx)(Ge,{phase:e,open:!c.has(e.name),onOpenChange:t=>{l(n=>{let r=new Set(n);return t?r.delete(e.name):r.add(e.name),r})}})},e.name))}),(0,Y.jsx)(p,{initial:!1,children:e.error&&e.retryPending&&(0,Y.jsxs)(d.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},className:`sticky bottom-2 z-20 mx-2 mt-auto mb-2 flex items-center gap-2 overflow-hidden rounded-[var(--miravo-radius-stadium-sm)] border border-destructive/40 bg-destructive/15 px-3 py-2 text-xs font-medium text-destructive shadow-md backdrop-blur-md`,children:[(0,Y.jsx)(z,{className:`size-4 shrink-0 animate-spin`}),(0,Y.jsx)(`span`,{className:`truncate`,children:e.error})]})}),(0,Y.jsx)(p,{initial:!1,children:e.error&&e.status===`error`&&(0,Y.jsxs)(d.div,{initial:{opacity:0,height:0,marginTop:0},animate:{opacity:1,height:`auto`,marginTop:8},exit:{opacity:0,height:0,marginTop:0},transition:{duration:.2},className:`mx-2 mb-4 flex min-w-0 flex-col gap-0 overflow-hidden rounded-[var(--miravo-radius-stadium-sm)] border border-destructive/40 bg-destructive/15 px-3 py-2 text-xs font-medium`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(`p`,{className:`min-w-0 flex-1 text-left wrap-anywhere text-destructive`,children:e.error}),(0,Y.jsx)(y,{value:e.error,label:`Copy error`,className:T(Le,`shrink-0`)})]}),(0,Y.jsx)(X,{type:e.type,errorMessage:e.error,className:`mt-3 w-full min-w-0`})]})}),n&&n.length>0?(0,Y.jsx)(nt,{logs:n}):null,(0,Y.jsx)(`div`,{ref:i,className:`h-px w-full shrink-0`,"aria-hidden":!0})]})}function it({format:e,kind:t}){return e===`source-yaml`?t===`model`?`Raw twin model definition. Edit locally, version-control, or use as input for the CLI.`:`Raw environment definition with topology and namespace. Edit, share, or apply via CLI.`:e===`litmus-edge`?t===`model`?`Litmus Edge Digital Twin JSON for manual import via the LE UI or GraphQL API.`:`Litmus Edge template JSON (DeviceHub devices + Digital Twins). Import directly via the Litmus Edge UI.`:`Select a format to download.`}function at({children:e,className:t}){return(0,Y.jsx)(`div`,{className:T(`max-h-[min(36rem,75vh)] min-h-0 overflow-y-auto rounded-[var(--miravo-radius-stadium-sm)] border border-border/60 p-4 sm:p-5`,t),children:e})}function ot({title:e,subtitle:t,footerAction:n,onDismiss:r,children:i}){return(0,K.useEffect)(()=>{function e(e){e.key===`Escape`&&r()}return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[r]),(0,Y.jsx)(d.div,{initial:{opacity:0,y:24},animate:{opacity:1,y:0},exit:{opacity:0,y:16},transition:{type:`spring`,stiffness:380,damping:30},className:`pointer-events-none fixed bottom-4 left-4 right-4 z-[60] sm:left-auto sm:w-full sm:max-w-md`,children:(0,Y.jsxs)(at,{className:`pointer-events-auto flex flex-col overflow-hidden border-border/70 bg-background p-0 shadow-lg shadow-black/15 ring-1 ring-border/50 backdrop-blur-sm sm:p-0 bg-background shadow-black/50`,children:[(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-start gap-2 border-b border-border/45 p-2.5 pb-2 sm:p-3 sm:pb-2`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,Y.jsx)(L,{className:`size-4 shrink-0 text-primary`,"aria-hidden":!0}),(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`p`,{className:`font-heading text-xs font-semibold tracking-tight text-foreground`,children:e}),t?(0,Y.jsx)(`p`,{className:`text-[11px] leading-snug text-foreground/80`,children:t}):null]})]}),(0,Y.jsx)(b,{type:`button`,variant:`ghost`,size:`icon-xs`,className:`shrink-0 text-foreground/70 hover:bg-muted/80 hover:text-foreground`,onClick:r,"aria-label":`Dismiss operation panel`,children:(0,Y.jsx)(S,{className:`size-3.5`,"aria-hidden":!0})})]}),(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-2.5 pt-2.5 sm:px-3 sm:pt-3`,"data-edge-op-scroll":``,children:i}),n?(0,Y.jsx)(`div`,{className:`flex w-full shrink-0 min-w-0 items-center gap-2 border-t border-border/40 bg-muted/15 p-2.5 sm:p-3`,children:n}):null]})})}var st={...Object.fromEntries(P.map(e=>[e.id,e.exportLabel])),"source-yaml":`Source YAML`};function ct(e){return e==null||e===``?`Select platform`:typeof e==`string`?st[e]??e:`Select platform`}function lt(e){return P.find(t=>t.id===e)?.label??e}function Q({id:e,label:t,hint:n,className:r,labelAdornment:i,children:a}){return(0,Y.jsxs)(`div`,{className:T(`flex flex-col gap-2`,r),children:[(0,Y.jsxs)(`div`,{className:`space-y-1`,children:[(0,Y.jsxs)(`span`,{className:`inline-flex max-w-full items-center gap-1`,children:[(0,Y.jsx)(W,{htmlFor:e,className:`text-[11px] font-medium text-foreground`,children:t}),i]}),n?(0,Y.jsx)(`p`,{className:`text-[11px] leading-relaxed text-muted-foreground`,children:n}):null]}),a]})}function ut({open:e,editing:t,platformId:n,form:r,showToken:i,saving:a,testing:o,canTestConnection:s,onOpenChange:c,onPlatformChange:l,onFormChange:u,onShowTokenChange:d,onSave:f,onTestConnection:p,onCancelInFlight:g}){let y=n===I.id,x=t?`Edit Target`:`Add Target`,S=t?`Update the deployment connection.`:`Add the target used for platform deploys.`,w=t?`Leave empty to keep the current token.`:`Required for the first save and connection test.`;return(0,Y.jsx)(_,{open:e,onOpenChange:e=>{e||g(),c(e)},children:(0,Y.jsxs)(ee,{showCloseButton:!0,className:`flex max-h-[min(84vh,38rem)] min-h-0 flex-col gap-0 overflow-hidden p-0 sm:max-w-[38rem]`,children:[(0,Y.jsxs)(v,{className:`shrink-0 border-b border-border/60 px-4 pb-3.5 pt-4 pr-12 sm:px-5 sm:pr-14`,children:[(0,Y.jsx)(te,{className:`text-base tracking-tight`,children:x}),(0,Y.jsx)(h,{className:`max-w-xl text-sm leading-relaxed`,children:S})]}),(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-4 py-4 sm:px-5`,style:{scrollbarGutter:`stable`},children:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[t?(0,Y.jsx)(Q,{label:`Platform`,children:(0,Y.jsx)(`div`,{className:`flex h-9 items-center rounded-[var(--miravo-radius-stadium-sm)] border border-input bg-input/30 px-3 text-sm text-foreground`,children:lt(n)})}):(0,Y.jsx)(Q,{label:`Platform`,children:(0,Y.jsxs)(N,{value:n,onValueChange:e=>l(e),children:[(0,Y.jsx)(M,{className:`h-9 w-full text-sm data-placeholder:text-muted-foreground/55`,"aria-label":`Platform type`,children:(0,Y.jsx)(D,{placeholder:`Select platform`,children:e=>ct(e)})}),(0,Y.jsxs)(k,{children:[(0,Y.jsxs)(j,{children:[(0,Y.jsx)(E,{children:`Available`}),re.map(e=>(0,Y.jsx)(O,{value:e.id,children:e.label},e.id))]}),(0,Y.jsx)(A,{}),(0,Y.jsxs)(j,{children:[(0,Y.jsx)(E,{children:`Coming soon`}),F.map(e=>(0,Y.jsx)(O,{value:e.id,children:e.label},e.id))]})]})]})}),y?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Q,{id:`env-label`,label:`Label`,children:(0,Y.jsx)(C,{id:`env-label`,placeholder:`Production`,value:r.label,onChange:e=>u({...r,label:e.currentTarget.value}),autoComplete:`off`,className:`h-9 placeholder:text-muted-foreground/55`})}),(0,Y.jsx)(Q,{id:`env-hostname`,label:`Hostname`,children:(0,Y.jsx)(C,{id:`env-hostname`,placeholder:`192.168.1.100`,value:r.hostname,onChange:e=>u({...r,hostname:e.currentTarget.value}),autoCapitalize:`none`,autoComplete:`off`,spellCheck:!1,className:`h-9 font-mono text-[13px] placeholder:text-muted-foreground/55`})}),(0,Y.jsx)(Q,{id:`env-source`,label:q,labelAdornment:(0,Y.jsxs)(U,{children:[(0,Y.jsx)(V,{type:`button`,className:`inline-flex size-5 shrink-0 items-center justify-center rounded-[var(--miravo-radius-tight)] text-muted-foreground hover:bg-muted hover:text-foreground`,"aria-label":`About ${q}`,children:(0,Y.jsx)(B,{className:`size-3`,"aria-hidden":!0})}),(0,Y.jsx)(H,{side:`top`,align:`start`,className:`max-w-xs text-left`,children:J})]}),children:(0,Y.jsx)(C,{id:`env-source`,placeholder:`host.docker.internal`,value:r.sourceHostname,onChange:e=>u({...r,sourceHostname:e.currentTarget.value}),autoCapitalize:`none`,autoComplete:`off`,spellCheck:!1,className:`h-9 font-mono text-[13px] placeholder:text-muted-foreground/55`})}),(0,Y.jsx)(Q,{id:`env-token`,label:`API token`,labelAdornment:(0,Y.jsxs)(U,{children:[(0,Y.jsx)(V,{type:`button`,className:`inline-flex size-5 shrink-0 items-center justify-center rounded-[var(--miravo-radius-tight)] text-muted-foreground hover:bg-muted hover:text-foreground`,"aria-label":`About API token`,children:(0,Y.jsx)(B,{className:`size-3`,"aria-hidden":!0})}),(0,Y.jsx)(H,{side:`top`,align:`start`,className:`max-w-xs text-left`,children:w})]}),children:(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.jsx)(C,{id:`env-token`,type:i?`text`:`password`,placeholder:t?`••••••••`:`Enter API token`,value:r.apiToken,onChange:e=>u({...r,apiToken:e.currentTarget.value}),autoCapitalize:`none`,autoComplete:`off`,spellCheck:!1,className:`h-9 pr-11 font-mono text-[13px] placeholder:text-muted-foreground/55`}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>d(!i),"aria-label":i?`Hide token`:`Show token`,"aria-pressed":i,className:`absolute inset-y-0 right-0 flex w-11 items-center justify-center rounded-r-[var(--miravo-radius-stadium-sm)] text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,children:i?(0,Y.jsx)(ge,{className:`size-3.5`,"aria-hidden":!0}):(0,Y.jsx)(_e,{className:`size-3.5`,"aria-hidden":!0})})]})})]}):(0,Y.jsxs)(`div`,{className:`rounded-[var(--miravo-radius-stadium-sm)] border border-dashed border-border/70 px-4 py-3 text-sm text-muted-foreground`,children:[lt(n),` setup is not available yet. Switch back to Litmus Edge to finish target setup now.`]})]})}),(0,Y.jsx)(`span`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:o&&y?`Checking connection to Litmus Edge…`:``}),(0,Y.jsxs)(m,{className:`mx-0 mb-0 shrink-0 flex-col gap-2 border-t border-border/60 bg-background px-4 py-3 sm:flex-row sm:justify-end sm:px-5`,children:[(0,Y.jsx)(b,{type:`button`,variant:`outline`,size:`lg`,className:`w-full justify-center sm:mr-auto sm:w-auto`,disabled:a||o||!s,"aria-busy":o,onClick:p,children:o?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(z,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),`Testing connection`]}):`Test connection`}),(0,Y.jsxs)(`div`,{className:`flex w-full flex-col gap-2 sm:w-auto sm:flex-row`,children:[(0,Y.jsx)(b,{variant:`outline`,size:`lg`,className:`w-full sm:w-auto`,onClick:()=>{g(),c(!1)},disabled:a,children:`Cancel`}),(0,Y.jsx)(b,{size:`lg`,className:`w-full sm:w-auto`,onClick:f,disabled:a||!y,children:a?`Saving...`:t?`Save Target`:`Add Target`})]})]})]})})}var dt=`flex size-7 shrink-0 items-center justify-center rounded-[var(--miravo-radius-stadium-sm)] border border-border/35 bg-muted/25 text-primary`;function ft({targets:e,value:t,onValueChange:n,size:r=`default`,disabled:i,className:a,preferredTargetId:o,onAddNew:s}){return(0,K.useEffect)(()=>{if(t||e.length===0)return;let r=(o?e.find(e=>e.id===o):void 0)??e[0];r&&n(r.id)},[t,e,o,n]),e.length===0&&s?(0,Y.jsxs)(`button`,{type:`button`,className:`flex items-center gap-1.5 self-start text-[11px] text-primary hover:underline`,onClick:s,children:[(0,Y.jsx)(ye,{className:`inline size-3`}),` Add target`]}):(0,Y.jsxs)(N,{value:t,onValueChange:e=>e&&n(e),disabled:i,children:[(0,Y.jsx)(M,{size:r,className:T(`w-full`,r===`sm`&&`h-9! min-h-9 py-0`,r===`default`&&`h-auto! min-h-9 py-2 **:data-[slot=select-value]:line-clamp-none`,a),children:(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:dt,"aria-hidden":!0,children:(0,Y.jsx)(oe,{className:`size-3.5`})}),(0,Y.jsx)(D,{placeholder:`Select target`,className:`min-w-0 flex-1`,children:t=>{let n=e.find(e=>e.id===t);return n?r===`sm`?n.label:(0,Y.jsxs)(`span`,{className:`flex flex-col gap-0.5`,children:[(0,Y.jsx)(`span`,{className:`text-xs font-medium leading-tight`,children:n.label}),(0,Y.jsx)(`span`,{className:`font-mono text-[11px] leading-none text-muted-foreground`,children:n.hostname})]}):`Select target`}})]})}),(0,Y.jsx)(k,{className:`rounded-[var(--miravo-radius-stadium-sm)] p-1.5`,children:e.map(e=>(0,Y.jsxs)(O,{value:e.id,className:`h-auto items-center gap-2 rounded-[var(--miravo-radius-stadium-sm)] py-2 pr-8 pl-2`,children:[(0,Y.jsx)(`span`,{className:dt,"aria-hidden":!0,children:(0,Y.jsx)(oe,{className:`size-3.5`})}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5 text-left`,children:[(0,Y.jsx)(`span`,{className:`truncate text-xs font-medium leading-tight text-foreground`,children:e.label}),(0,Y.jsx)(`span`,{className:`truncate font-mono text-[11px] leading-none text-muted-foreground`,children:e.hostname})]})]},e.id))})]})}async function pt(){return(await c(`/platforms/le/targets`,i.platformTargets)).targets}function mt(e){return c(`/platforms/le/targets`,i.platformTargetCreate,{body:e})}function ht(e,t){return c(`/platforms/le/targets/${e}`,i.platformTargetById,{body:t})}function gt(e){return c(`/platforms/le/targets/${e}`,i.platformTargetDelete)}function _t(e,t){return c(`/platforms/le/targets/test`,i.platformConnectionTest,{body:e,init:{signal:t?.signal}})}function vt(e,t){return c(`/platforms/le/plan`,i.platformPlan,{body:e,init:{signal:t?.signal}})}function yt(e,t){return c(`/platforms/le/cleanup/plan`,i.platformCleanupPlan,{body:e,init:{signal:t?.signal}})}function bt(e={}){let t=new URLSearchParams;e.type&&t.set(`type`,e.type),e.targetId&&t.set(`targetId`,e.targetId),typeof e.limit==`number`&&t.set(`limit`,String(e.limit)),typeof e.offset==`number`&&t.set(`offset`,String(e.offset));let n=t.toString();return c(n?`/platforms/le/operations?${n}`:`/platforms/le/operations`,i.platformOperations)}async function xt(e){try{return await c(`/platforms/le/operations/${e}/cancel`,i.platformOperationCancel),!0}catch(e){if(r.is(e)&&e.status===404)return!1;throw e}}function St(e,t,n){return wt(`/platforms/le/apply/stream`,i.platformApplyStream,e,t,n)}function Ct(e,t,n){return wt(`/platforms/le/cleanup/stream`,i.platformCleanupStream,e,t,n)}function wt(e,t,n,i,c){let d=new AbortController;return(async()=>{try{let c=t.body.safeParse(n);if(!c.success)throw Error(`Invalid request for ${t.method} ${t.path}: ${c.error.message}`);let f=await fetch(s(l,e),{method:t.method,headers:{"content-type":`application/json`},credentials:`include`,body:JSON.stringify(c.data),signal:d.signal});if(f.status===401&&t.auth===`required`)throw o(),Error(`Session expired`);if(!f.ok){let e=`HTTP ${f.status}`;try{let e=await f.json(),t=u.safeParse(e);if(t.success)throw new r({code:t.data.code,status:f.status,message:t.data.message,hint:t.data.hint})}catch(e){if(e instanceof r)throw e}throw Error(e)}if(!f.body)throw Error(`No response body`);let p=f.body.getReader(),m=new TextDecoder,h=``,g=``,_=``,v=!1;for(;;){let{done:e,value:t}=await p.read();if(e)break;h+=m.decode(t,{stream:!0});let n=h.split(`
|
|
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{C as r,S as i,T as a,f as o,m as s,p as c,t as l,w as u}from"./api-D8oAzcVE.js";import{t as d,u as f}from"./proxy-Be4WzmcS.js";import{t as p}from"./AnimatePresence-CPmH1DMY.js";import{a as m,i as h,l as g,n as _,o as v,r as ee,s as te,t as y}from"./copy-button-BvU3RDZa.js";import{S as b,T as x,w as S,x as C}from"./format-CshN6yEB.js";import{n as w,t as T}from"./utils-XFKvwlFT.js";import{a as E,c as D,i as O,l as ne,n as k,o as A,r as j,s as M,t as N}from"./select-CmlY1M1a.js";import{i as P,n as F,r as I,t as re}from"./platform-targets-BIQ1lKOg.js";import{a as L,c as R,o as z,s as ie}from"./tabs-4SeH2unv.js";import{t as B}from"./circle-question-mark-CJvcT6V6.js";import{i as ae,n as oe,r as se,t as ce}from"./checkbox-C_4HRnS_.js";import{t as le}from"./triangle-alert-BXrJNk3g.js";import{i as V,n as H,t as U}from"./tooltip-D1ydB4g3.js";import{t as ue}from"./badge-eIn_7YrK.js";import{t as W}from"./label-CMBWxUhA.js";var de=w(`ban`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M4.929 4.929 19.07 19.071`,key:`196cmz`}]]),fe=w(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),pe=w(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),me=w(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),he=w(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),ge=w(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),_e=w(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),ve=w(`list-checks`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]),ye=w(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),be=w(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),G=w(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),K=e(t(),1),xe=[`devices`,`models`,`instances`],Se=[`instances`,`models`,`devices`],Ce={devices:`DeviceHub devices`,models:`Digital Twins models`,instances:`Digital Twins instances`},we={devices:{apply:`DeviceHub device records and settings on Litmus Edge.`,cleanup:`Remove DeviceHub device records managed from Miravo.`},models:{apply:`Digital Twins model definitions synced to the platform.`,cleanup:`Remove Digital Twins model definitions created by Miravo.`},instances:{apply:`Digital Twins instances bound to DeviceHub devices.`,cleanup:`Remove Digital Twins instances deployed for this target.`}},Te=`Miravo calls this API.`;function Ee(e){return e.length>120?`Use at most 120 characters.`:/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(e)?null:`Use lowercase letters, numbers, and hyphens only (e.g. motor-001).`}var q=`Source host (Miravo)`,J=`Address Litmus Edge uses to reach your running Miravo environment.`,Y=n();function De({open:e,onOpenChange:t,type:n,label:r,targetLabel:i,hostname:a,sourceHostname:o,onConfirm:s,defaultDeviceName:c,applyPreview:l,cleanupPreview:u}){let f=n===`apply`?xe:Se,[p,g]=(0,K.useState)(new Set(f)),[v,y]=(0,K.useState)(!1),[x,S]=(0,K.useState)(!1),[w,E]=(0,K.useState)(``),[D,O]=(0,K.useState)(null),[k,A]=(0,K.useState)(`fail`),j=(0,K.useId)(),M=(0,K.useId)(),N=`if-unmanaged-${M}`,P=n===`apply`,F=P&&c!==void 0&&c!==``;(0,K.useEffect)(()=>{e&&(g(new Set(f)),y(!1),O(null),E(F?c??``:``),A(`fail`),S(!1))},[e,f,F,c]);let I={instances:`models`},re=e=>{g(t=>{let n=new Set(t);if(n.has(e)){n.delete(e);for(let[t,r]of Object.entries(I))r===e&&n.delete(t)}else{n.add(e);let t=I[e];t&&n.add(t)}return n})},L=P?l:u,R=()=>{L?.onPreview(),t(!1)};return(0,Y.jsx)(_,{open:e,onOpenChange:t,children:(0,Y.jsxs)(ee,{showCloseButton:!0,className:`flex max-h-[90vh] min-h-0 flex-col gap-0 overflow-hidden p-0 sm:max-w-120`,children:[(0,Y.jsxs)(`div`,{className:`shrink-0 border-b border-border/60 px-5 pb-3 pt-5`,children:[(0,Y.jsxs)(te,{className:`flex items-center gap-2 text-sm font-semibold leading-snug`,children:[P?(0,Y.jsx)(se,{className:`size-3.5 shrink-0 text-primary`,"aria-hidden":!0}):(0,Y.jsx)(G,{className:`size-3.5 shrink-0 text-destructive`,"aria-hidden":!0}),P?`Apply to Litmus Edge`:`Clean up Litmus Edge`]}),(0,Y.jsx)(h,{className:`sr-only`,children:P?`Review connection details and scope before applying.`:`Review target and cleanup scope before confirming.`})]}),(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-5 pt-4 pb-3`,children:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,Y.jsx)(`div`,{className:`text-xs leading-snug`,children:(0,Y.jsxs)(`dl`,{className:`flex flex-col gap-0`,children:[(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 items-start gap-x-4 border-b border-border/35 py-2.5 first:pt-0`,children:[(0,Y.jsx)(`dt`,{className:`min-w-0 pt-px text-[11px] font-medium text-muted-foreground`,children:P?`Resource`:`Target`}),(0,Y.jsx)(`dd`,{className:`min-w-0 wrap-break-word font-medium text-foreground`,children:r})]}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 items-start gap-x-4 border-b border-border/35 py-2.5`,children:[(0,Y.jsx)(`dt`,{className:`min-w-0 pt-px text-[11px] font-medium text-muted-foreground`,children:`Target`}),(0,Y.jsx)(`dd`,{className:`min-w-0 wrap-break-word font-medium text-foreground`,children:i})]}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 items-start gap-x-4 border-b border-border/35 py-2.5`,children:[(0,Y.jsx)(`dt`,{className:`min-w-0 pt-px`,children:(0,Y.jsxs)(`span`,{className:`inline-flex max-w-full items-center gap-1`,children:[(0,Y.jsx)(`span`,{className:`text-[11px] font-medium leading-snug text-muted-foreground`,children:`Litmus Edge API`}),(0,Y.jsxs)(U,{children:[(0,Y.jsx)(V,{type:`button`,className:`inline-flex size-5 shrink-0 items-center justify-center rounded-[var(--miravo-radius-tight)] text-muted-foreground hover:bg-muted hover:text-foreground`,"aria-label":`About Litmus Edge API`,children:(0,Y.jsx)(B,{className:`size-3`,"aria-hidden":!0})}),(0,Y.jsx)(H,{side:`top`,align:`start`,className:`max-w-xs text-left`,children:Te})]})]})}),(0,Y.jsx)(`dd`,{className:`min-w-0`,children:(0,Y.jsx)(`span`,{className:`break-all font-mono text-[11px] leading-normal text-foreground/90`,children:a})})]}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 items-start gap-x-4 border-b border-border/35 py-2.5`,children:[(0,Y.jsx)(`dt`,{className:`min-w-0 pt-px`,children:(0,Y.jsxs)(`span`,{className:`inline-flex max-w-full items-center gap-1`,children:[(0,Y.jsx)(`span`,{className:`text-[11px] font-medium leading-snug text-muted-foreground`,children:q}),(0,Y.jsxs)(U,{children:[(0,Y.jsx)(V,{type:`button`,className:`inline-flex size-5 shrink-0 items-center justify-center rounded-[var(--miravo-radius-tight)] text-muted-foreground hover:bg-muted hover:text-foreground`,"aria-label":`About ${q}`,children:(0,Y.jsx)(B,{className:`size-3`,"aria-hidden":!0})}),(0,Y.jsx)(H,{side:`top`,align:`start`,className:`max-w-xs text-left`,children:J})]})]})}),(0,Y.jsx)(`dd`,{className:`min-w-0`,children:(0,Y.jsx)(`span`,{className:`break-all font-mono text-[11px] leading-normal text-foreground/90`,children:o})})]})]})}),L?(0,Y.jsxs)(W,{className:T(`flex cursor-pointer items-center gap-2.5 text-[11px] font-medium leading-snug`,L.disabled&&`pointer-events-none opacity-50`),children:[(0,Y.jsx)(`span`,{className:`flex shrink-0 items-center`,children:(0,Y.jsx)(ce,{checked:x,onCheckedChange:e=>S(e===!0),disabled:L.disabled})}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 leading-snug`,children:P?`Dry run only — preview the plan without deploying`:`Dry run only — preview the plan without removing resources`})]}):null,F?(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(W,{htmlFor:j,className:`text-[11px] font-medium`,children:`Device name`}),(0,Y.jsx)(C,{id:j,value:w,onChange:e=>{E(e.target.value),O(null)},placeholder:c,autoComplete:`off`,spellCheck:!1,className:T(`h-9 font-mono text-xs`,D&&`border-destructive`),"aria-invalid":D!=null,"aria-describedby":`${j}-hint`}),(0,Y.jsx)(`p`,{id:`${j}-hint`,className:`text-[11px] leading-snug text-foreground/76`,children:`Same name on a later run updates this device; change it to add another.`}),D?(0,Y.jsx)(`p`,{className:`text-[11px] text-destructive`,children:D}):null]}):null,(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsxs)(`button`,{type:`button`,className:`group flex w-full items-center justify-between gap-2 rounded-[var(--miravo-radius-tight)] bg-muted/40 px-2.5 py-2 text-left text-[11px] font-medium text-muted-foreground transition-colors hover:bg-muted/60 hover:text-foreground aria-expanded:bg-muted/55 aria-expanded:text-foreground`,onClick:()=>y(e=>!e),"aria-expanded":v,children:[`Advanced`,(0,Y.jsx)(ne,{className:T(`size-3.5 shrink-0 text-muted-foreground transition-transform ease-out group-hover:text-foreground/80`,v?`duration-500 rotate-180 text-foreground/80`:`duration-280`),"aria-hidden":!0})]}),(0,Y.jsxs)(d.div,{initial:!1,animate:{maxHeight:v?520:0,opacity:+!!v},transition:{maxHeight:{duration:v?.52:.28,ease:v?[.16,1,.3,1]:[.4,0,.2,1]},opacity:{duration:v?.42:.24,ease:v?[.16,1,.3,1]:[.4,0,.2,1]}},className:T(`overflow-hidden`,!v&&`pointer-events-none`),"aria-hidden":!v,inert:!v,children:[(0,Y.jsx)(`div`,{className:`flex flex-col gap-1 pt-px`,children:f.map(e=>{let t=Object.entries(I).find(([t,n])=>n===e)?.[0],n=t!==void 0&&p.has(t),r=P?we[e].apply:we[e].cleanup;return(0,Y.jsxs)(W,{htmlFor:`scope-${e}`,className:T(`flex min-h-9 cursor-pointer items-start gap-2 rounded-[var(--miravo-radius-tight)] border border-border/40 bg-muted/10 px-2.5 py-1.5 text-[11px] transition-colors`,n?`opacity-95`:`hover:bg-muted/25`),children:[(0,Y.jsx)(`span`,{className:`pt-0.5`,children:(0,Y.jsx)(ce,{id:`scope-${e}`,checked:p.has(e),disabled:n,onCheckedChange:()=>re(e)})}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1 leading-snug`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-foreground`,children:Ce[e]}),(0,Y.jsx)(`span`,{className:`mt-0.5 block text-[11px] font-normal leading-tight text-muted-foreground`,children:r})]}),n?(0,Y.jsx)(`span`,{className:`shrink-0 self-start rounded-[var(--miravo-radius-tight)] border border-primary/35 bg-primary/10 px-1.5 py-px text-[10px] font-semibold uppercase tracking-wide text-primary`,title:`Required when Digital Twins instances are selected (models must stay in scope).`,children:`Required`}):null]},e)})}),P&&(0,Y.jsxs)(`div`,{className:`mt-2.5 space-y-1.5 border-t border-border/40 pt-2`,children:[(0,Y.jsx)(`p`,{id:`${M}-legend`,className:`text-[11px] font-medium uppercase tracking-wide text-foreground/80`,children:`Collision policy`}),(0,Y.jsxs)(`div`,{role:`radiogroup`,"aria-labelledby":`${M}-legend`,className:`flex flex-col gap-1`,children:[(0,Y.jsxs)(W,{htmlFor:`if-unmanaged-fail`,className:T(`flex cursor-pointer items-start gap-2 rounded-[var(--miravo-radius-tight)] border px-2.5 py-2 text-[11px] transition-colors`,k===`fail`?`border-primary/45 bg-primary/8`:`border-border/40 bg-muted/10 hover:bg-muted/25`),children:[(0,Y.jsx)(`input`,{id:`if-unmanaged-fail`,type:`radio`,name:N,value:`fail`,checked:k===`fail`,onChange:()=>A(`fail`),className:`mt-0.5 size-3.5 shrink-0 accent-primary`}),(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-foreground`,children:`Fail if unmanaged exists`}),(0,Y.jsx)(`span`,{className:`mt-px block text-[11px] leading-tight text-foreground/74`,children:`Stop if the target has unmanaged resources.`})]})]}),(0,Y.jsxs)(W,{htmlFor:`if-unmanaged-skip`,className:T(`flex cursor-pointer items-start gap-2 rounded-[var(--miravo-radius-tight)] border px-2.5 py-2 text-[11px] transition-colors`,k===`skip`?`border-primary/45 bg-primary/8`:`border-border/40 bg-muted/10 hover:bg-muted/25`),children:[(0,Y.jsx)(`input`,{id:`if-unmanaged-skip`,type:`radio`,name:N,value:`skip`,checked:k===`skip`,onChange:()=>A(`skip`),className:`mt-0.5 size-3.5 shrink-0 accent-primary`}),(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-foreground`,children:`Skip unmanaged resources`}),(0,Y.jsx)(`span`,{className:`mt-px block text-[11px] leading-tight text-foreground/74`,children:`Only update resources managed by Miravo.`})]})]})]})]})]}),p.size===0&&!(x&&L)?(0,Y.jsx)(`p`,{className:`text-[11px] text-destructive`,children:`Select at least one scope or reopen to reset.`}):null]})]})}),(0,Y.jsxs)(m,{className:`mx-0 mb-0 shrink-0 flex flex-col gap-2 border-t border-border/60 px-5 py-4 sm:flex-row sm:justify-end`,children:[(0,Y.jsx)(b,{type:`button`,variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,Y.jsx)(b,{type:`button`,variant:P||x&&u?`default`:`destructive`,onClick:()=>{if(x&&L){R();return}let e=f.filter(e=>p.has(e));if(e.length!==0){if(F){let t=w.trim(),n=t===``?c??``:t.toLowerCase(),r=Ee(n);if(r){O(r);return}O(null),s({scope:e,deviceName:n,ifUnmanaged:k});return}s({scope:e,ifUnmanaged:k})}},disabled:x&&L?L.disabled||L.planLoading:p.size===0,children:P?x&&l?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(ve,{className:`size-3`,"aria-hidden":!0}),`Preview changes`]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(se,{className:`size-3`,"aria-hidden":!0}),`Apply`]}):x&&u?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(ve,{className:`size-3`,"aria-hidden":!0}),`Preview changes`]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(G,{className:`size-3`,"aria-hidden":!0}),`Clean up`]})})]})]})})}var Oe={initial:{scale:0,opacity:0},animate:{scale:1,opacity:1,originY:0},exit:{scale:0,opacity:0},transition:{type:`spring`,stiffness:350,damping:40}},ke={initial:{opacity:0,y:6},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{type:`tween`,duration:.22,ease:[.16,1,.3,1]}};function Ae({children:e,variant:t=`default`}){let n=t===`default`;return(0,Y.jsx)(d.div,{...n?Oe:ke,layout:n,className:`mx-auto w-full`,children:e})}var je=K.memo(({children:e,className:t,delay:n=1e3,...r})=>{let[i,a]=(0,K.useState)(0),o=(0,K.useMemo)(()=>K.Children.toArray(e),[e]);(0,K.useEffect)(()=>{let e=null;return i<o.length-1&&(e=setTimeout(()=>{a(e=>(e+1)%o.length)},n)),()=>{e!==null&&clearTimeout(e)}},[i,n,o.length]);let s=(0,K.useMemo)(()=>o.slice(0,i+1).reverse(),[i,o]);return(0,Y.jsx)(`div`,{className:T(`flex flex-col items-center gap-4`,t),...r,children:(0,Y.jsx)(p,{children:s.map(e=>(0,Y.jsx)(Ae,{children:e},e.key))})})});je.displayName=`AnimatedList`;var Me=`could not load certificate or private key from pki`;function Ne(e){return e.status===`running`?e.operation?e.operation.type===`apply`?`Apply`:`Cleanup`:`Connecting`:e.status===`error`?`Failed`:e.operation&&e.status===`complete`?e.operation.status===`cancelled`?`Cancelled`:`Complete`:null}function Pe(e){return(e?.toLowerCase()??``).includes(Me)}function Fe(e,t){if(e===`cleanup`)return`Try cleanup again to resume.`;let n=t?.toLowerCase()??``;return Pe(t)?`Litmus Edge DeviceHub could not start the OPC UA device because its PKI files are broken. Delete the stopped device in DeviceHub, repair /var/lib/loopedge-dh/db/OPC_UA_Client_Advanced/, then run apply again.`:n.includes(`unmanaged device`)||n.includes(`unmanaged instance`)?`Update the collision policy, try apply again to resume, or clean up the created resources.`:`Try apply again to resume, or clean up the created resources.`}function Ie(e){let t=e.operation,n=t?.type===`apply`?`apply`:`cleanup`;switch(e.status){case`running`:return{title:`Operation in progress`,subtitle:`Streaming ${n} steps to Litmus Edge`};case`complete`:return t?.status===`cancelled`?{title:`Operation cancelled`,subtitle:`Stopped — resources created so far remain in Litmus Edge.`}:{title:`Operation complete`,subtitle:n===`apply`?`Apply finished — review the summary below.`:`Cleanup finished — review the summary below.`};case`error`:return{title:`Operation failed`,subtitle:t?.type===`apply`&&Pe(e.error??t?.error)?`OPC UA device stopped on Litmus Edge — repair DeviceHub PKI and retry apply.`:e.error??t?.error??`The operation ended with an error.`};default:return{title:`Operation`,subtitle:``}}}function X({type:e,errorMessage:t,className:n}){let r=Fe(e,t);return(0,Y.jsxs)(`div`,{className:T(`flex items-start gap-1.5 rounded-[var(--miravo-radius-tight)] border border-info/40 bg-info/10 px-2.5 py-1.5 text-[10px] font-medium leading-relaxed`,n),children:[(0,Y.jsx)(ae,{className:`mt-0.5 size-3 shrink-0 text-info`,"aria-hidden":!0}),(0,Y.jsx)(`p`,{className:`min-w-0 flex-1 text-left whitespace-normal break-words text-foreground/80 [overflow-wrap:anywhere]`,children:r})]})}var Le=`text-destructive hover:bg-destructive/25 hover:text-foreground`,Re={device:`Devices`,tags:`Tags`,model:`Models`,instance:`Instances`,"param-sync":`Parameters`};function ze(e){return Re[e]??e}function Be(e){switch(e){case`create`:return`border border-success/30 bg-success/15 text-success`;case`update`:return`border border-chart-3/30 bg-chart-3/15 text-chart-3`;case`replace`:return`border border-warning/30 bg-warning/15 text-warning`;case`delete`:return`border border-destructive/30 bg-destructive/15 text-destructive`;case`noop`:return`border border-border/60 bg-muted/70 text-foreground/75`;default:return`border border-border/50 bg-muted/80 text-foreground/85`}}function Ve(e){return e===`noop`?`no-op`:e}function He({status:e}){switch(e){case`success`:return(0,Y.jsx)(R,{className:`size-3.5 shrink-0 text-success`});case`failed`:return(0,Y.jsx)(ie,{className:`size-3.5 shrink-0 text-destructive`});case`pending`:return(0,Y.jsx)(z,{className:`size-3.5 shrink-0 animate-spin text-primary/90`})}}function Ue({status:e}){switch(e){case`done`:return(0,Y.jsx)(R,{className:`size-3.5 text-success`});case`active`:return(0,Y.jsx)(z,{className:`size-3.5 animate-spin text-primary`});case`pending`:return(0,Y.jsx)(me,{className:`size-3.5 text-foreground/55`})}}function We({entry:e}){let[t,n]=(0,K.useState)(!1);return(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,Y.jsxs)(`button`,{type:`button`,className:T(`flex items-center gap-2 rounded-[var(--miravo-radius-tight)] px-2 py-1 text-left transition-colors`,e.error?`cursor-pointer hover:bg-muted/40`:`cursor-default`),onClick:()=>e.error&&n(!t),disabled:!e.error,children:[(0,Y.jsx)(He,{status:e.status}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[11px] text-foreground`,children:e.name}),(0,Y.jsx)(`span`,{className:T(`inline-flex rounded-[var(--miravo-radius-tight)] px-1.5 py-0.5 text-[9px] font-medium uppercase tracking-wider`,Be(e.action)),children:Ve(e.action)}),e.error&&(0,Y.jsx)(ne,{className:T(`size-3 text-foreground/75 transition-transform`,t&&`rotate-180`)})]}),(0,Y.jsx)(p,{initial:!1,children:t&&e.error&&(0,Y.jsxs)(d.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:`auto`},exit:{opacity:0,height:0},transition:{duration:.18},className:`overflow-hidden`,children:[(0,Y.jsxs)(`div`,{className:`mb-0 flex min-w-0 w-full items-center gap-1.5 rounded-[var(--miravo-radius-tight)] border border-destructive/40 bg-destructive/15 px-2.5 py-1.5 text-[10px] font-medium leading-relaxed`,children:[(0,Y.jsx)(`p`,{className:`min-w-0 flex-1 text-left whitespace-normal break-words text-destructive [overflow-wrap:anywhere]`,children:e.error}),(0,Y.jsx)(y,{value:e.error,label:`Copy error`,className:T(Le,`shrink-0`)})]}),(0,Y.jsx)(X,{type:`apply`,errorMessage:e.error,className:`mb-1 mt-2.5 w-full min-w-0`})]})})]})}function Ge({phase:e,open:t,onOpenChange:n}){let r=e.resources.length,i=r===e.total,a=e.resources.length>0;return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,Y.jsxs)(`button`,{type:`button`,className:T(`flex w-full items-center gap-2 rounded-[var(--miravo-radius-tight)] px-1 py-1 text-left transition-colors`,a&&`hover:bg-muted/40`,!a&&`cursor-default`),disabled:!a,"aria-expanded":a?t:void 0,onClick:()=>a&&n(!t),children:[(0,Y.jsx)(Ue,{status:e.status}),(0,Y.jsx)(`span`,{className:`text-xs font-medium tracking-wide text-foreground`,children:ze(e.name)}),(0,Y.jsxs)(`span`,{className:`font-mono text-[10px] text-foreground/70`,children:[r,`/`,e.total]}),(0,Y.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1.5`,children:[i&&e.status===`done`&&(0,Y.jsx)(R,{className:`size-3 text-success`}),a&&(0,Y.jsx)(ne,{className:T(`size-3 text-foreground/75 transition-transform`,!t&&`-rotate-90`),"aria-hidden":!0})]})]}),(0,Y.jsx)(p,{initial:!1,children:a&&t&&(0,Y.jsx)(d.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:`auto`},exit:{opacity:0,height:0},transition:{duration:.25,ease:[.16,1,.3,1]},className:`overflow-hidden`,children:(0,Y.jsx)(`div`,{className:`ml-2 flex min-w-0 flex-col border-l border-border/55 pl-2.5 pr-1.5 pb-1 pt-0.5`,children:(0,Y.jsx)(f.Provider,{value:null,children:e.resources.map((e,t)=>(0,Y.jsx)(Ae,{variant:`subtle`,children:(0,Y.jsx)(We,{entry:e})},`${e.name}-${t}`))})})})})]})}function Ke({operation:e}){let t=e.status===`complete`,n=e.status===`cancelled`,r=e.failed>0,i=e.totalPlanned>0?Math.min(100,Je(e)/e.totalPlanned*100):0;return(0,Y.jsx)(`div`,{className:`h-1 w-full overflow-hidden rounded-full bg-muted/55`,role:`progressbar`,"aria-valuenow":Math.round(i),"aria-valuemin":0,"aria-valuemax":100,"aria-label":`Operation progress`,children:(0,Y.jsx)(d.div,{"aria-hidden":`true`,className:T(`h-full rounded-full transition-colors duration-500`,n?`bg-foreground/30`:t&&!r?`bg-success`:`bg-warning`),initial:{width:`0%`},animate:{width:`${i}%`},transition:{duration:.4,ease:[.25,.1,.25,1]}})})}function qe(e){return e.duration==null?(Date.now()-e.startedAt)/1e3:e.duration/1e3}function Je(e){let t=e.applied+e.failed;return e.totalPlanned>0?Math.min(t,e.totalPlanned):t}function Ye(e,t){let n=e.label;return t?.length?t.find(e=>e.id===n)?.name??n:n}var Xe={complete:{Icon:R,className:`size-4 text-success`},partial:{Icon:pe,className:`size-4 text-warning`},cancelled:{Icon:de,className:`size-4 text-foreground/65`},error:{Icon:ie,className:`size-4 text-destructive`},running:{Icon:z,className:`size-4 animate-spin text-warning`}};function Ze({icon:e,className:t}){return(0,Y.jsx)(d.div,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},transition:{type:`spring`,stiffness:500,damping:30},className:`shrink-0`,children:(0,Y.jsx)(e,{className:t})})}function Qe({operation:e,sourceLabel:t,isAllExpanded:n,onToggleAll:r}){let i=qe(e),a=Je(e),o=e.status===`complete`,s=e.status===`cancelled`,c=e.status===`error`,l=e.failed>0,u=o&&!l?`complete`:o&&l?`partial`:s?`cancelled`:c?`error`:`running`,f=Xe[u];return(0,Y.jsxs)(`div`,{className:T(`sticky top-0 z-10 flex min-w-0 w-full flex-col gap-1.5 rounded-[var(--miravo-radius-stadium-sm)] border px-3 pt-2.5 pb-3.5 backdrop-blur-sm transition-colors duration-500`,o&&!l&&`border-success/30 bg-success/5`,o&&l&&`border-warning/30 bg-warning/5`,s&&`border-border/60 bg-muted/50`,c&&`border-destructive/30 bg-destructive/5`,!o&&!s&&!c&&`border-warning/20 bg-warning/5`),children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,Y.jsx)(p,{mode:`wait`,initial:!1,children:(0,Y.jsx)(Ze,{icon:f.Icon,className:f.className},u)}),(0,Y.jsx)(`span`,{className:`text-xs font-medium leading-none text-foreground`,children:s?`Cancelled`:o?l?`Completed with errors`:`Complete`:c?`Failed`:e.retryPending?`Failed, retrying attempt ${e.attempt?e.attempt+1:2}/${e.maxAttempts} in ${e.retryDelayMs?e.retryDelayMs/1e3:3}s...`:e.attempt&&e.maxAttempts&&e.attempt>1?`Retrying attempt ${e.attempt}/${e.maxAttempts}...`:e.type===`apply`?`Applying...`:`Cleaning up...`}),(0,Y.jsxs)(`span`,{className:`w-full min-w-0 text-[10px] leading-tight text-foreground/78`,children:[(0,Y.jsx)(`span`,{className:`font-sans break-words`,children:t}),(0,Y.jsx)(`span`,{className:`font-mono break-words`,children:` → ${e.environment}`})]})]}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Y.jsx)(ue,{variant:`secondary`,className:`h-5 min-h-5 gap-0 overflow-hidden border border-border/50 bg-muted/70 px-1.5 !py-0 font-mono text-[10px] leading-none text-foreground shadow-sm [&>span]:inline-flex [&>span]:items-center`,children:(0,Y.jsxs)(`span`,{className:`gap-1`,children:[(0,Y.jsx)(p,{mode:`popLayout`,initial:!1,children:(0,Y.jsx)(d.span,{initial:{opacity:0,y:-6},animate:{opacity:1,y:0},exit:{opacity:0,y:6},transition:{type:`spring`,stiffness:500,damping:35},className:`inline tabular-nums`,children:a},a)}),`/`,e.totalPlanned,(0,Y.jsx)(`span`,{className:`text-foreground/72`,children:e.type===`apply`?`applied`:`deleted`})]})}),(0,Y.jsx)(p,{initial:!1,children:e.failed>0&&(0,Y.jsx)(d.div,{className:`inline-flex items-center`,initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},transition:{type:`spring`,stiffness:500,damping:30},children:(0,Y.jsxs)(ue,{variant:`destructive`,className:`h-5 min-h-5 gap-0 border border-destructive/35 bg-destructive/20 px-1.5 !py-0 font-mono text-[10px] font-semibold leading-none text-destructive`,children:[e.failed,` failed`]})})})]}),(0,Y.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:[(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-mono text-[10px] leading-none text-foreground/75`,children:[(0,Y.jsx)(he,{className:`size-3 shrink-0 block text-foreground/65`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`tabular-nums leading-none`,children:typeof i==`number`?`${i.toFixed(1)}s`:`...`})]}),r&&(0,Y.jsx)(`div`,{className:`flex items-center border-l border-border/40 pl-2`,children:(0,Y.jsx)(`button`,{type:`button`,onClick:r,className:`flex size-4.5 items-center justify-center rounded-[var(--miravo-radius-tight)] text-foreground/55 transition-colors hover:bg-muted/60 hover:text-foreground`,"aria-label":n?`Collapse all phases`:`Expand all phases`,title:n?`Collapse all`:`Expand all`,children:(0,Y.jsx)(fe,{className:T(`size-3.5 transition-transform duration-300`,!n&&`opacity-70 scale-y-[-1]`)})})})]})]}),(0,Y.jsx)(Ke,{operation:e})]})]})}function $e(e){return e?e.closest(`[data-edge-op-scroll]`)??e.closest(`.overflow-y-auto`):null}var et=350;function Z(e){e?.scrollIntoView({block:`end`,behavior:`auto`,inline:`nearest`})}function tt(e){let t=()=>Z(e);t(),requestAnimationFrame(t),requestAnimationFrame(()=>requestAnimationFrame(t)),window.setTimeout(t,0),window.setTimeout(t,48),window.setTimeout(t,120)}function nt({logs:e}){return e.length===0?null:(0,Y.jsx)(`div`,{className:`flex min-w-0 flex-col gap-1.5 px-2 pb-2`,children:e.map(e=>(0,Y.jsxs)(`div`,{className:T(`flex min-w-0 items-start gap-2 rounded-[var(--miravo-radius-tight)] border px-2.5 py-2 text-xs`,e.level===`error`?`border-destructive/35 bg-destructive/12 text-destructive`:e.level===`warn`?`border-warning/35 bg-warning/12 text-warning`:`border-primary/25 bg-primary/8 text-foreground/82`),children:[e.level===`info`?(0,Y.jsx)(ae,{className:`mt-0.5 size-3.5 shrink-0 text-primary`,"aria-hidden":!0}):(0,Y.jsx)(pe,{className:`mt-0.5 size-3.5 shrink-0`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 wrap-anywhere`,children:e.message})]},e.id))})}function rt({operation:e,catalogTemplates:t,logs:n}){let r=(0,K.useRef)(null),i=(0,K.useRef)(null),a=(0,K.useRef)(!0),o=(0,K.useRef)(e.status);o.current=e.status;let s=(0,K.useRef)(!1),[c,l]=(0,K.useState)(new Set),u=(0,K.useMemo)(()=>Ye(e,t),[e,t]);(0,K.useLayoutEffect)(()=>{let e=$e(r.current);if(!e)return;let t=()=>{a.current=e.scrollHeight-e.scrollTop-e.clientHeight<et};return e.addEventListener(`scroll`,t,{passive:!0}),t(),()=>{e.removeEventListener(`scroll`,t)}},[]),(0,K.useLayoutEffect)(()=>{if(e.status===`running`){a.current&&Z(i.current),s.current=!0;return}s.current&&=(tt(i.current),!1)},[e.status,e.applied,e.failed,e.phases]),(0,K.useEffect)(()=>{if(e.status!==`running`)return;let t=r.current;if(!t)return;let n=0,s=new ResizeObserver(()=>{cancelAnimationFrame(n),n=requestAnimationFrame(()=>{o.current===`running`&&a.current&&Z(i.current)})});return s.observe(t),a.current&&Z(i.current),()=>{s.disconnect(),cancelAnimationFrame(n)}},[e.status]);let f=e.phases.length>0,m=c.size===0;return(0,Y.jsxs)(`div`,{ref:r,className:`flex min-w-0 w-full flex-col gap-2`,children:[(0,Y.jsx)(Qe,{operation:e,sourceLabel:u,isAllExpanded:m,onToggleAll:f?()=>{l(m?new Set(e.phases.map(e=>e.name)):new Set)}:void 0}),(0,Y.jsx)(`div`,{className:`flex flex-col gap-1 px-2 pt-2 pb-4`,children:e.phases.map(e=>(0,Y.jsx)(`div`,{children:(0,Y.jsx)(Ge,{phase:e,open:!c.has(e.name),onOpenChange:t=>{l(n=>{let r=new Set(n);return t?r.delete(e.name):r.add(e.name),r})}})},e.name))}),(0,Y.jsx)(p,{initial:!1,children:e.error&&e.retryPending&&(0,Y.jsxs)(d.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},className:`sticky bottom-2 z-20 mx-2 mt-auto mb-2 flex items-center gap-2 overflow-hidden rounded-[var(--miravo-radius-stadium-sm)] border border-destructive/40 bg-destructive/15 px-3 py-2 text-xs font-medium text-destructive shadow-md backdrop-blur-md`,children:[(0,Y.jsx)(z,{className:`size-4 shrink-0 animate-spin`}),(0,Y.jsx)(`span`,{className:`truncate`,children:e.error})]})}),(0,Y.jsx)(p,{initial:!1,children:e.error&&e.status===`error`&&(0,Y.jsxs)(d.div,{initial:{opacity:0,height:0,marginTop:0},animate:{opacity:1,height:`auto`,marginTop:8},exit:{opacity:0,height:0,marginTop:0},transition:{duration:.2},className:`mx-2 mb-4 flex min-w-0 flex-col gap-0 overflow-hidden rounded-[var(--miravo-radius-stadium-sm)] border border-destructive/40 bg-destructive/15 px-3 py-2 text-xs font-medium`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(`p`,{className:`min-w-0 flex-1 text-left wrap-anywhere text-destructive`,children:e.error}),(0,Y.jsx)(y,{value:e.error,label:`Copy error`,className:T(Le,`shrink-0`)})]}),(0,Y.jsx)(X,{type:e.type,errorMessage:e.error,className:`mt-3 w-full min-w-0`})]})}),n&&n.length>0?(0,Y.jsx)(nt,{logs:n}):null,(0,Y.jsx)(`div`,{ref:i,className:`h-px w-full shrink-0`,"aria-hidden":!0})]})}function it({format:e,kind:t}){return e===`source-yaml`?t===`model`?`Raw twin model definition. Edit locally, version-control, or use as input for the CLI.`:`Raw environment definition with topology and namespace. Edit, share, or apply via CLI.`:e===`litmus-edge`?t===`model`?`Litmus Edge Digital Twin JSON for manual import via the LE UI or GraphQL API.`:`Litmus Edge template JSON (DeviceHub devices + Digital Twins). Import directly via the Litmus Edge UI.`:`Select a format to download.`}function at({children:e,className:t}){return(0,Y.jsx)(`div`,{className:T(`max-h-[min(36rem,75vh)] min-h-0 overflow-y-auto rounded-[var(--miravo-radius-stadium-sm)] border border-border/60 p-4 sm:p-5`,t),children:e})}function ot({title:e,subtitle:t,footerAction:n,onDismiss:r,children:i}){return(0,K.useEffect)(()=>{function e(e){e.key===`Escape`&&r()}return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[r]),(0,Y.jsx)(d.div,{initial:{opacity:0,y:24},animate:{opacity:1,y:0},exit:{opacity:0,y:16},transition:{type:`spring`,stiffness:380,damping:30},className:`pointer-events-none fixed bottom-4 left-4 right-4 z-[60] sm:left-auto sm:w-full sm:max-w-md`,children:(0,Y.jsxs)(at,{className:`pointer-events-auto flex flex-col overflow-hidden border-border/70 bg-background p-0 shadow-lg shadow-black/15 ring-1 ring-border/50 backdrop-blur-sm sm:p-0 bg-background shadow-black/50`,children:[(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-start gap-2 border-b border-border/45 p-2.5 pb-2 sm:p-3 sm:pb-2`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,Y.jsx)(L,{className:`size-4 shrink-0 text-primary`,"aria-hidden":!0}),(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`p`,{className:`font-heading text-xs font-semibold tracking-tight text-foreground`,children:e}),t?(0,Y.jsx)(`p`,{className:`text-[11px] leading-snug text-foreground/80`,children:t}):null]})]}),(0,Y.jsx)(b,{type:`button`,variant:`ghost`,size:`icon-xs`,className:`shrink-0 text-foreground/70 hover:bg-muted/80 hover:text-foreground`,onClick:r,"aria-label":`Dismiss operation panel`,children:(0,Y.jsx)(S,{className:`size-3.5`,"aria-hidden":!0})})]}),(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-2.5 pt-2.5 sm:px-3 sm:pt-3`,"data-edge-op-scroll":``,children:i}),n?(0,Y.jsx)(`div`,{className:`flex w-full shrink-0 min-w-0 items-center gap-2 border-t border-border/40 bg-muted/15 p-2.5 sm:p-3`,children:n}):null]})})}var st={...Object.fromEntries(P.map(e=>[e.id,e.exportLabel])),"source-yaml":`Source YAML`};function ct(e){return e==null||e===``?`Select platform`:typeof e==`string`?st[e]??e:`Select platform`}function lt(e){return P.find(t=>t.id===e)?.label??e}function Q({id:e,label:t,hint:n,className:r,labelAdornment:i,children:a}){return(0,Y.jsxs)(`div`,{className:T(`flex flex-col gap-2`,r),children:[(0,Y.jsxs)(`div`,{className:`space-y-1`,children:[(0,Y.jsxs)(`span`,{className:`inline-flex max-w-full items-center gap-1`,children:[(0,Y.jsx)(W,{htmlFor:e,className:`text-[11px] font-medium text-foreground`,children:t}),i]}),n?(0,Y.jsx)(`p`,{className:`text-[11px] leading-relaxed text-muted-foreground`,children:n}):null]}),a]})}function ut({open:e,editing:t,platformId:n,form:r,showToken:i,saving:a,testing:o,canTestConnection:s,onOpenChange:c,onPlatformChange:l,onFormChange:u,onShowTokenChange:d,onSave:f,onTestConnection:p,onCancelInFlight:g}){let y=n===I.id,x=t?`Edit Target`:`Add Target`,S=t?`Update the deployment connection.`:`Add the target used for platform deploys.`,w=t?`Leave empty to keep the current token.`:`Required for the first save and connection test.`;return(0,Y.jsx)(_,{open:e,onOpenChange:e=>{e||g(),c(e)},children:(0,Y.jsxs)(ee,{showCloseButton:!0,className:`flex max-h-[min(84vh,38rem)] min-h-0 flex-col gap-0 overflow-hidden p-0 sm:max-w-[38rem]`,children:[(0,Y.jsxs)(v,{className:`shrink-0 border-b border-border/60 px-4 pb-3.5 pt-4 pr-12 sm:px-5 sm:pr-14`,children:[(0,Y.jsx)(te,{className:`text-base tracking-tight`,children:x}),(0,Y.jsx)(h,{className:`max-w-xl text-sm leading-relaxed`,children:S})]}),(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-4 py-4 sm:px-5`,style:{scrollbarGutter:`stable`},children:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[t?(0,Y.jsx)(Q,{label:`Platform`,children:(0,Y.jsx)(`div`,{className:`flex h-9 items-center rounded-[var(--miravo-radius-stadium-sm)] border border-input bg-input/30 px-3 text-sm text-foreground`,children:lt(n)})}):(0,Y.jsx)(Q,{label:`Platform`,children:(0,Y.jsxs)(N,{value:n,onValueChange:e=>l(e),children:[(0,Y.jsx)(M,{className:`h-9 w-full text-sm data-placeholder:text-muted-foreground/55`,"aria-label":`Platform type`,children:(0,Y.jsx)(D,{placeholder:`Select platform`,children:e=>ct(e)})}),(0,Y.jsxs)(k,{children:[(0,Y.jsxs)(j,{children:[(0,Y.jsx)(E,{children:`Available`}),re.map(e=>(0,Y.jsx)(O,{value:e.id,children:e.label},e.id))]}),(0,Y.jsx)(A,{}),(0,Y.jsxs)(j,{children:[(0,Y.jsx)(E,{children:`Coming soon`}),F.map(e=>(0,Y.jsx)(O,{value:e.id,children:e.label},e.id))]})]})]})}),y?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Q,{id:`env-label`,label:`Label`,children:(0,Y.jsx)(C,{id:`env-label`,placeholder:`Production`,value:r.label,onChange:e=>u({...r,label:e.currentTarget.value}),autoComplete:`off`,className:`h-9 placeholder:text-muted-foreground/55`})}),(0,Y.jsx)(Q,{id:`env-hostname`,label:`Hostname`,children:(0,Y.jsx)(C,{id:`env-hostname`,placeholder:`192.168.1.100`,value:r.hostname,onChange:e=>u({...r,hostname:e.currentTarget.value}),autoCapitalize:`none`,autoComplete:`off`,spellCheck:!1,className:`h-9 font-mono text-[13px] placeholder:text-muted-foreground/55`})}),(0,Y.jsx)(Q,{id:`env-source`,label:q,labelAdornment:(0,Y.jsxs)(U,{children:[(0,Y.jsx)(V,{type:`button`,className:`inline-flex size-5 shrink-0 items-center justify-center rounded-[var(--miravo-radius-tight)] text-muted-foreground hover:bg-muted hover:text-foreground`,"aria-label":`About ${q}`,children:(0,Y.jsx)(B,{className:`size-3`,"aria-hidden":!0})}),(0,Y.jsx)(H,{side:`top`,align:`start`,className:`max-w-xs text-left`,children:J})]}),children:(0,Y.jsx)(C,{id:`env-source`,placeholder:`host.docker.internal`,value:r.sourceHostname,onChange:e=>u({...r,sourceHostname:e.currentTarget.value}),autoCapitalize:`none`,autoComplete:`off`,spellCheck:!1,className:`h-9 font-mono text-[13px] placeholder:text-muted-foreground/55`})}),(0,Y.jsx)(Q,{id:`env-token`,label:`API token`,labelAdornment:(0,Y.jsxs)(U,{children:[(0,Y.jsx)(V,{type:`button`,className:`inline-flex size-5 shrink-0 items-center justify-center rounded-[var(--miravo-radius-tight)] text-muted-foreground hover:bg-muted hover:text-foreground`,"aria-label":`About API token`,children:(0,Y.jsx)(B,{className:`size-3`,"aria-hidden":!0})}),(0,Y.jsx)(H,{side:`top`,align:`start`,className:`max-w-xs text-left`,children:w})]}),children:(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.jsx)(C,{id:`env-token`,type:i?`text`:`password`,placeholder:t?`••••••••`:`Enter API token`,value:r.apiToken,onChange:e=>u({...r,apiToken:e.currentTarget.value}),autoCapitalize:`none`,autoComplete:`off`,spellCheck:!1,className:`h-9 pr-11 font-mono text-[13px] placeholder:text-muted-foreground/55`}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>d(!i),"aria-label":i?`Hide token`:`Show token`,"aria-pressed":i,className:`absolute inset-y-0 right-0 flex w-11 items-center justify-center rounded-r-[var(--miravo-radius-stadium-sm)] text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,children:i?(0,Y.jsx)(ge,{className:`size-3.5`,"aria-hidden":!0}):(0,Y.jsx)(_e,{className:`size-3.5`,"aria-hidden":!0})})]})})]}):(0,Y.jsxs)(`div`,{className:`rounded-[var(--miravo-radius-stadium-sm)] border border-dashed border-border/70 px-4 py-3 text-sm text-muted-foreground`,children:[lt(n),` setup is not available yet. Switch back to Litmus Edge to finish target setup now.`]})]})}),(0,Y.jsx)(`span`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:o&&y?`Checking connection to Litmus Edge…`:``}),(0,Y.jsxs)(m,{className:`mx-0 mb-0 shrink-0 flex-col gap-2 border-t border-border/60 bg-background px-4 py-3 sm:flex-row sm:justify-end sm:px-5`,children:[(0,Y.jsx)(b,{type:`button`,variant:`outline`,size:`lg`,className:`w-full justify-center sm:mr-auto sm:w-auto`,disabled:a||o||!s,"aria-busy":o,onClick:p,children:o?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(z,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),`Testing connection`]}):`Test connection`}),(0,Y.jsxs)(`div`,{className:`flex w-full flex-col gap-2 sm:w-auto sm:flex-row`,children:[(0,Y.jsx)(b,{variant:`outline`,size:`lg`,className:`w-full sm:w-auto`,onClick:()=>{g(),c(!1)},disabled:a,children:`Cancel`}),(0,Y.jsx)(b,{size:`lg`,className:`w-full sm:w-auto`,onClick:f,disabled:a||!y,children:a?`Saving...`:t?`Save Target`:`Add Target`})]})]})]})})}var dt=`flex size-7 shrink-0 items-center justify-center rounded-[var(--miravo-radius-stadium-sm)] border border-border/35 bg-muted/25 text-primary`;function ft({targets:e,value:t,onValueChange:n,size:r=`default`,disabled:i,className:a,preferredTargetId:o,onAddNew:s}){return(0,K.useEffect)(()=>{if(t||e.length===0)return;let r=(o?e.find(e=>e.id===o):void 0)??e[0];r&&n(r.id)},[t,e,o,n]),e.length===0&&s?(0,Y.jsxs)(`button`,{type:`button`,className:`flex items-center gap-1.5 self-start text-[11px] text-primary hover:underline`,onClick:s,children:[(0,Y.jsx)(ye,{className:`inline size-3`}),` Add target`]}):(0,Y.jsxs)(N,{value:t,onValueChange:e=>e&&n(e),disabled:i,children:[(0,Y.jsx)(M,{size:r,className:T(`w-full`,r===`sm`&&`h-9! min-h-9 py-0`,r===`default`&&`h-auto! min-h-9 py-2 **:data-[slot=select-value]:line-clamp-none`,a),children:(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:dt,"aria-hidden":!0,children:(0,Y.jsx)(oe,{className:`size-3.5`})}),(0,Y.jsx)(D,{placeholder:`Select target`,className:`min-w-0 flex-1`,children:t=>{let n=e.find(e=>e.id===t);return n?r===`sm`?n.label:(0,Y.jsxs)(`span`,{className:`flex flex-col gap-0.5`,children:[(0,Y.jsx)(`span`,{className:`text-xs font-medium leading-tight`,children:n.label}),(0,Y.jsx)(`span`,{className:`font-mono text-[11px] leading-none text-muted-foreground`,children:n.hostname})]}):`Select target`}})]})}),(0,Y.jsx)(k,{className:`rounded-[var(--miravo-radius-stadium-sm)] p-1.5`,children:e.map(e=>(0,Y.jsxs)(O,{value:e.id,className:`h-auto items-center gap-2 rounded-[var(--miravo-radius-stadium-sm)] py-2 pr-8 pl-2`,children:[(0,Y.jsx)(`span`,{className:dt,"aria-hidden":!0,children:(0,Y.jsx)(oe,{className:`size-3.5`})}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5 text-left`,children:[(0,Y.jsx)(`span`,{className:`truncate text-xs font-medium leading-tight text-foreground`,children:e.label}),(0,Y.jsx)(`span`,{className:`truncate font-mono text-[11px] leading-none text-muted-foreground`,children:e.hostname})]})]},e.id))})]})}async function pt(){return(await c(`/platforms/le/targets`,i.platformTargets)).targets}function mt(e){return c(`/platforms/le/targets`,i.platformTargetCreate,{body:e})}function ht(e,t){return c(`/platforms/le/targets/${e}`,i.platformTargetById,{body:t})}function gt(e){return c(`/platforms/le/targets/${e}`,i.platformTargetDelete)}function _t(e,t){return c(`/platforms/le/targets/test`,i.platformConnectionTest,{body:e,init:{signal:t?.signal}})}function vt(e,t){return c(`/platforms/le/plan`,i.platformPlan,{body:e,init:{signal:t?.signal}})}function yt(e,t){return c(`/platforms/le/cleanup/plan`,i.platformCleanupPlan,{body:e,init:{signal:t?.signal}})}function bt(e={}){let t=new URLSearchParams;e.type&&t.set(`type`,e.type),e.targetId&&t.set(`targetId`,e.targetId),typeof e.limit==`number`&&t.set(`limit`,String(e.limit)),typeof e.offset==`number`&&t.set(`offset`,String(e.offset));let n=t.toString();return c(n?`/platforms/le/operations?${n}`:`/platforms/le/operations`,i.platformOperations)}async function xt(e){try{return await c(`/platforms/le/operations/${e}/cancel`,i.platformOperationCancel),!0}catch(e){if(r.is(e)&&e.status===404)return!1;throw e}}function St(e,t,n){return wt(`/platforms/le/apply/stream`,i.platformApplyStream,e,t,n)}function Ct(e,t,n){return wt(`/platforms/le/cleanup/stream`,i.platformCleanupStream,e,t,n)}function wt(e,t,n,i,c){let d=new AbortController;return(async()=>{try{let c=t.body.safeParse(n);if(!c.success)throw Error(`Invalid request for ${t.method} ${t.path}: ${c.error.message}`);let f=await fetch(s(l,e),{method:t.method,headers:{"content-type":`application/json`},credentials:`include`,body:JSON.stringify(c.data),signal:d.signal});if(f.status===401&&t.auth===`required`)throw o(),Error(`Session expired`);if(!f.ok){let e=`HTTP ${f.status}`;try{let e=await f.json(),t=u.safeParse(e);if(t.success)throw new r({code:t.data.code,status:f.status,message:t.data.message,hint:t.data.hint})}catch(e){if(e instanceof r)throw e}throw Error(e)}if(!f.body)throw Error(`No response body`);let p=f.body.getReader(),m=new TextDecoder,h=``,g=``,_=``,v=!1;for(;;){let{done:e,value:t}=await p.read();if(e)break;h+=m.decode(t,{stream:!0});let n=h.split(`
|
|
2
2
|
`);h=n.pop()??``;for(let e of n)if(e.startsWith(`event: `))g=e.slice(7).trim();else if(e.startsWith(`data: `))_=e.slice(6);else if(e===``&&g&&_){let e=!1;try{let t=JSON.parse(_),n=a.safeParse({event:g,data:t});n.success&&((n.data.event===`complete`||n.data.event===`cancelled`||n.data.event===`error`)&&(v=!0,e=!0),i(n.data))}catch{}if(g=``,_=``,e){await p.cancel();return}}}if(!v&&!d.signal.aborted)throw Error(`Connection to server was lost unexpectedly`)}catch(e){if(d.signal.aborted)return;c(e instanceof Error?e:Error(String(e)))}})(),d}function Tt(e){let t=e.trim();if(t.length===0)return{message:`Connection test failed with no details from the server.`};let n=t.toLowerCase();if(t.includes(`timed out`))return{message:`Litmus Edge did not respond in time.`,description:`Check the hostname, VPN or firewall, and that the device is online.`};if(/\b401\b/.test(t)||/\b403\b/.test(t)||n.includes(`unauthorized`))return{message:`The API token was rejected.`,description:`Create or copy a valid token in Litmus Edge and paste it into the API token field.`};if(/\b404\b/.test(t)&&(n.includes(`sysinfo`)||n.includes(`/sysinfo/`)))return{message:`This Litmus Edge host or version does not expose the system info API.`,description:`Confirm the hostname and that Litmus Edge is running a build with GET /sysinfo/devinfo.`};if(n.includes(`econnrefused`)||n.includes(`connection refused`)||n.includes(`enotfound`)||n.includes(`getaddrinfo`)||n.includes(`failed`)&&n.includes(`fetch`))return{message:`Could not reach the Litmus Edge host.`,description:`Check the hostname or IP, TLS, and that this computer can reach the edge network.`};if(t.includes(`Session expired`))return{message:`Your session expired. Sign in again, then retry the connection test.`};if(n.includes(`environment not found`))return{message:`That target was removed. Close the dialog and refresh the list.`};if(n.includes(`unsupported platform`)&&n.includes(`connection`))return{message:`This platform type does not support connection tests yet.`,description:`Use Litmus Edge for remote apply and connection testing.`};if(n.includes(`invalid request body`)||n.includes(`api token is required`))return{message:`Some required fields are missing or invalid.`,description:`Fill in hostname, source host (Miravo), and API token (for new targets).`};let r=t.replace(/^LE\s+\S+\s+/i,``).trim();return{message:`Could not verify the connection to Litmus Edge.`,description:r.length>0&&r.length<=220?r:Et(t,200)}}function Et(e,t){let n=e.replace(/\s+/g,` `).trim();return n.length<=t?n:`${n.slice(0,t-1)}…`}function Dt(e){if(e.connected){let t=e.litmusEdgeVersion?` Litmus Edge v${e.litmusEdgeVersion}.`:``;if(e.warning){g.warning(`Connected to ${e.hostname}.${t}`,{description:e.warning});return}g.success(`Connected to ${e.hostname}.${t}`);return}let{message:t,description:n}=Tt(e.error);g.error(t,n?{description:n}:void 0)}function Ot(e){let{message:t,description:n}=Tt(e instanceof Error?e.message:String(e));g.error(t,n?{description:n}:void 0)}function kt(e){return!!(typeof DOMException<`u`&&e instanceof DOMException&&e.name===`AbortError`||e instanceof Error&&(e.name===`AbortError`||/aborted/i.test(e.message)))}function At(){let[e,t]=(0,K.useState)(!1),n=(0,K.useRef)(null),r=(0,K.useCallback)(()=>{n.current?.abort()},[]);return{testing:e,runTest:(0,K.useCallback)(async e=>{let r=new AbortController;n.current=r,t(!0);try{Dt(await _t(e,{signal:r.signal}))}catch(e){if(kt(e))return;Ot(e)}finally{n.current===r&&(n.current=null),t(!1)}},[]),cancelInFlight:r}}function jt({stream:e,className:t}){let n=Ne(e);if(!n)return null;let r=e.status===`running`,i=e.status===`error`,a=e.status===`complete`&&e.operation?.status===`cancelled`,o=e.status===`complete`&&!a;return(0,Y.jsxs)(`span`,{className:T(`inline-flex h-6 w-fit min-w-0 shrink-0 items-center justify-center gap-1 rounded-full border px-2 py-0`,`text-xs font-medium leading-none tracking-wide uppercase shadow-[inset_0_1px_0_0_rgba(255,255,255,0.05)]`,t,o&&`border-success/45 bg-success/[0.1] text-success`,a&&`border-muted-foreground/30 bg-muted/[0.1] text-muted-foreground shadow-none`,i&&`border-destructive/50 bg-destructive/[0.1] text-destructive shadow-none`,r&&`border-primary/40 bg-primary/[0.1] text-primary border-primary/35`),children:[o?(0,Y.jsx)(x,{className:`size-3 shrink-0 opacity-95`,strokeWidth:2.5,"aria-hidden":!0}):a?(0,Y.jsx)(de,{className:`size-3 shrink-0 opacity-95`,"aria-hidden":!0}):i?(0,Y.jsx)(le,{className:`size-3 shrink-0 opacity-95`,"aria-hidden":!0}):(0,Y.jsx)(z,{className:`size-3 shrink-0 animate-spin`,"aria-hidden":!0}),n]})}var Mt={status:`idle`,operation:null,error:null,logs:[],cancelRequested:!1},Nt=200;function Pt(){let[e,t]=(0,K.useState)(Mt),n=(0,K.useRef)(null),r=(0,K.useRef)(0),i=(0,K.useRef)(0),a=(0,K.useCallback)(e=>{t(t=>({...t,status:`error`,cancelRequested:!1,error:e.message,operation:t.operation?{...t.operation,status:`error`,error:e.message}:null}))},[]),o=(0,K.useCallback)(e=>{switch(e.event){case`accepted`:Ft(e.data,t);break;case`log`:Lt({...e.data,id:`log-${r.current++}`},t);break;case`started`:Rt(e.data,t);break;case`phase`:zt(e.data,t);break;case`resource`:Bt(e.data,t);break;case`complete`:Vt(e.data,t);break;case`cancelled`:Ut(e.data,t);break;case`retrying`:Wt(e.data,t);break;case`error`:a(Error(e.data.message));break}},[a]),s=(0,K.useCallback)(e=>{let s=++i.current;n.current?.abort(),r.current=0,t({status:`running`,operation:null,error:null,logs:[],cancelRequested:!1}),n.current=St(e,e=>{i.current===s&&(o(e),Gt(e)&&(n.current?.abort(),n.current=null))},e=>{i.current===s&&(n.current=null,a(e))})},[o,a]),c=(0,K.useCallback)(e=>{let s=++i.current;n.current?.abort(),r.current=0,t({status:`running`,operation:null,error:null,logs:[],cancelRequested:!1}),n.current=Ct(e,e=>{i.current===s&&(o(e),Gt(e)&&(n.current?.abort(),n.current=null))},e=>{i.current===s&&(n.current=null,a(e))})},[o,a]),l=(0,K.useCallback)(()=>{i.current++,n.current?.abort(),n.current=null,t(Mt)},[]),u=(0,K.useCallback)(async()=>{let r=e.operation?.operationId;!r||e.status!==`running`||e.cancelRequested||(xt(r).catch(()=>!1),n.current?.abort(),n.current=null,t(e=>Ht(e,r)))},[e.operation?.operationId,e.status,e.cancelRequested]);return(0,K.useEffect)(()=>()=>{i.current++,n.current?.abort(),n.current=null},[]),{...e,startApply:s,startCleanup:c,reset:l,cancel:u}}function Ft(e,t){t(t=>({...t,status:`running`,cancelRequested:!1,error:null,operation:{operationId:e.operationId,type:e.type,label:e.template??e.model??(e.type===`apply`?`Preparing apply`:`Preparing cleanup`),environment:e.targetId??`Resolving target`,totalPlanned:0,phases:[],applied:0,failed:0,status:`running`,startedAt:Date.now()}}))}function It(e){return(e.template??e.model)||(e.type===`cleanup`?`All managed resources`:`unknown`)}function Lt(e,t){t(t=>({...t,logs:[...t.logs,e].slice(-Nt)}))}function Rt(e,t){t(t=>({...t,status:`running`,cancelRequested:!1,error:null,operation:{operationId:e.operationId,type:e.type,label:It(e),environment:e.environment,totalPlanned:e.totalPlanned,phases:[],applied:0,failed:0,status:`running`,startedAt:Date.now(),attempt:e.attempt,maxAttempts:e.maxAttempts}}))}function zt(e,t){t(t=>{if(!$(t,e.operationId))return t;let n=t.operation.phases.map(e=>e.status===`active`?{...e,status:`done`}:e),r=n.findIndex(t=>t.name===e.phase),i=r>=0?n.map((t,n)=>n===r?{...t,status:`active`,total:e.total}:t):[...n,{name:e.phase,total:e.total,resources:[],status:`active`}];return{...t,operation:{...t.operation,phases:i}}})}function Bt(e,t){t(t=>{if(!$(t,e.operationId))return t;let n={name:e.name,action:e.action,status:e.status,error:e.error},r=t.operation.phases.map(t=>t.name===e.phase&&t.status===`active`?{...t,resources:[...t.resources,n]}:t);return{...t,operation:{...t.operation,phases:r,applied:t.operation.applied+ +(e.status===`success`&&e.action!==`noop`),failed:t.operation.failed+ +(e.status===`failed`)}}})}function Vt(e,t){t(t=>{if(!$(t,e.operationId))return t;let n=t.operation.phases.map(e=>e.status===`active`?{...e,status:`done`}:e);return{...t,status:`complete`,cancelRequested:!1,error:null,operation:{...t.operation,phases:n,applied:e.applied??e.deleted??0,failed:e.failed,duration:e.duration,status:`complete`}}})}function Ht(e,t){if(!$(e,t)||e.status!==`running`)return e;let n=e.operation.phases.map(e=>e.status===`active`?{...e,status:`done`}:e);return{...e,status:`complete`,cancelRequested:!1,error:null,operation:{...e.operation,phases:n,duration:Date.now()-e.operation.startedAt,status:`cancelled`}}}function Ut(e,t){t(t=>{if(!$(t,e.operationId))return t;let n=t.operation.phases.map(e=>e.status===`active`?{...e,status:`done`}:e);return{...t,status:`complete`,cancelRequested:!1,error:null,operation:{...t.operation,phases:n,applied:e.applied??e.deleted??0,failed:e.failed,duration:e.duration,status:`cancelled`}}})}function Wt(e,t){t(t=>$(t,e.operationId)?{...t,status:`running`,cancelRequested:!1,error:null,operation:{...t.operation,status:`running`,retryPending:!0,retryDelayMs:e.delayMs,attempt:e.attempt,maxAttempts:e.maxAttempts,error:e.error,applied:0,failed:0,phases:[]}}:t)}function $(e,t){return e.operation?.operationId===t}function Gt(e){return e.event===`complete`||e.event===`cancelled`||e.event===`error`}export{G as C,_e as D,ve as E,me as O,q as S,ye as T,X as _,gt as a,De as b,yt as c,ft as d,ut as f,rt as g,it as h,mt as i,vt as l,at as m,jt as n,bt as o,ot as p,At as r,pt as s,Pt as t,ht as u,Fe as v,be as w,J as x,Ie as y};
|
|
@@ -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}from"./chunk-OE4NN4TA-DBWZidbW.js";import{t as r}from"./route-preload-
|
|
1
|
+
import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{c as n}from"./chunk-OE4NN4TA-DBWZidbW.js";import{t as r}from"./route-preload-DQgHHtBj.js";var i=e(t(),1);function a(){let e=n();return(0,i.useCallback)((t,n)=>{n?.preload!==!1&&r(t),(0,i.startTransition)(()=>{n?.transitionType&&(0,i.addTransitionType)(n.transitionType),e(t,{replace:n?.replace})})},[e])}export{a as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{at as e,et as t}from"./vendor-ui-CWUk2ulb.js";import{B as n,U as r,V as i}from"./api-
|
|
1
|
+
import{at as e,et as t}from"./vendor-ui-CWUk2ulb.js";import{B as n,U as r,V as i}from"./api-D8oAzcVE.js";import{l as a}from"./copy-button-BvU3RDZa.js";import{n as o,t as s}from"./utils-XFKvwlFT.js";var c=o(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),l=o(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),u=e();function d({className:e,orientation:n=`horizontal`,...r}){return(0,u.jsx)(t,{"data-slot":`separator`,orientation:n,className:s(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,e),...r})}var f=i({multiplier:n({message:`Speed multiplier must be a number.`}).positive(`Speed multiplier must be positive.`).finite(`Speed multiplier must be finite.`).max(1e3,`Speed multiplier cannot exceed 1000.`)}),p=i({model:r().min(1,`Model is required.`),count:n({message:`Count must be a number.`}).int(`Count must be a whole number.`).positive(`Count must be at least 1.`).max(100,`Count cannot exceed 100.`)}),m=i({instanceId:r().min(1,`Instance is required.`),fault:r().min(1,`Fault name is required.`)}),h=i({instanceId:r().min(1,`Instance is required.`)});function g(e,t,n){if(!t.trim())return a.error(`Argument "${e}" is required.`),null;switch(n){case`Double`:case`Float`:{let n=Number(t);return Number.isFinite(n)?{value:n}:(a.error(`"${e}" must be a valid number.`),null)}case`Int32`:case`UInt16`:case`UInt32`:{let r=Number(t);return!Number.isFinite(r)||!Number.isSafeInteger(r)?(a.error(`"${e}" must be a valid integer.`),null):(n===`UInt16`||n===`UInt32`)&&r<0?(a.error(`"${e}" must be non-negative.`),null):{value:r}}case`Boolean`:return t!==`true`&&t!==`false`?(a.error(`"${e}" must be "true" or "false".`),null):{value:t===`true`};case`String`:return{value:t};default:return{value:t}}}function _(e,t){let n=e.safeParse(t);return n.success?n.data:(a.error(n.error.issues[0]?.message??`Validation error.`),null)}export{_ as a,l as c,p as i,c as l,h as n,g as o,f as r,d as s,m as t};
|
package/console-dist/index.html
CHANGED
|
@@ -21,15 +21,15 @@
|
|
|
21
21
|
}
|
|
22
22
|
</style>
|
|
23
23
|
<title>Miravo</title>
|
|
24
|
-
<script type="module" crossorigin src="/assets/index-
|
|
24
|
+
<script type="module" crossorigin src="/assets/index-ClSUHPGP.js"></script>
|
|
25
25
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-COnpUsM8.js">
|
|
26
26
|
<link rel="modulepreload" crossorigin href="/assets/vendor-charts-95ykyDlI.js">
|
|
27
27
|
<link rel="modulepreload" crossorigin href="/assets/chunk-OE4NN4TA-DBWZidbW.js">
|
|
28
|
-
<link rel="modulepreload" crossorigin href="/assets/api-
|
|
28
|
+
<link rel="modulepreload" crossorigin href="/assets/api-D8oAzcVE.js">
|
|
29
29
|
<link rel="modulepreload" crossorigin href="/assets/vendor-ui-CWUk2ulb.js">
|
|
30
30
|
<link rel="modulepreload" crossorigin href="/assets/utils-XFKvwlFT.js">
|
|
31
31
|
<link rel="modulepreload" crossorigin href="/assets/format-CshN6yEB.js">
|
|
32
|
-
<link rel="modulepreload" crossorigin href="/assets/query-fetch-error-
|
|
32
|
+
<link rel="modulepreload" crossorigin href="/assets/query-fetch-error-NbPqVPRR.js">
|
|
33
33
|
<link rel="modulepreload" crossorigin href="/assets/proxy-Be4WzmcS.js">
|
|
34
34
|
<link rel="modulepreload" crossorigin href="/assets/AnimatePresence-CPmH1DMY.js">
|
|
35
35
|
<link rel="modulepreload" crossorigin href="/assets/activity-Cy_niK56.js">
|
|
@@ -44,35 +44,35 @@
|
|
|
44
44
|
<link rel="modulepreload" crossorigin href="/assets/triangle-alert-BXrJNk3g.js">
|
|
45
45
|
<link rel="modulepreload" crossorigin href="/assets/badge-eIn_7YrK.js">
|
|
46
46
|
<link rel="modulepreload" crossorigin href="/assets/label-CMBWxUhA.js">
|
|
47
|
-
<link rel="modulepreload" crossorigin href="/assets/use-platform-stream-
|
|
47
|
+
<link rel="modulepreload" crossorigin href="/assets/use-platform-stream-DBZo6HMM.js">
|
|
48
48
|
<link rel="modulepreload" crossorigin href="/assets/catalog-template-icons-3S8RvUxD.js">
|
|
49
49
|
<link rel="modulepreload" crossorigin href="/assets/layers-1figUpjG.js">
|
|
50
50
|
<link rel="modulepreload" crossorigin href="/assets/dist-xY0pK9Wy.js">
|
|
51
51
|
<link rel="modulepreload" crossorigin href="/assets/dropdown-menu-CrPXVXpG.js">
|
|
52
52
|
<link rel="modulepreload" crossorigin href="/assets/get-error-message-Dk8elqEP.js">
|
|
53
|
-
<link rel="modulepreload" crossorigin href="/assets/platforms-
|
|
53
|
+
<link rel="modulepreload" crossorigin href="/assets/platforms-BwYPf2Sg.js">
|
|
54
54
|
<link rel="modulepreload" crossorigin href="/assets/vendor-table-BAHQgdwg.js">
|
|
55
55
|
<link rel="modulepreload" crossorigin href="/assets/arrow-up-down-C1oJAmrw.js">
|
|
56
56
|
<link rel="modulepreload" crossorigin href="/assets/download-DmUZKo9N.js">
|
|
57
57
|
<link rel="modulepreload" crossorigin href="/assets/engine-store-DMULdR_V.js">
|
|
58
58
|
<link rel="modulepreload" crossorigin href="/assets/auth-screen-backdrop-Cr8qBSXP.js">
|
|
59
59
|
<link rel="modulepreload" crossorigin href="/assets/combobox-BCaV1Wbo.js">
|
|
60
|
-
<link rel="modulepreload" crossorigin href="/assets/tags-
|
|
61
|
-
<link rel="modulepreload" crossorigin href="/assets/catalog-source-
|
|
60
|
+
<link rel="modulepreload" crossorigin href="/assets/tags-BI93Dvh2.js">
|
|
61
|
+
<link rel="modulepreload" crossorigin href="/assets/catalog-source-BU77f8QO.js">
|
|
62
62
|
<link rel="modulepreload" crossorigin href="/assets/runtime-link-PMxeHxd6.js">
|
|
63
|
-
<link rel="modulepreload" crossorigin href="/assets/use-engine-command-mutation-
|
|
64
|
-
<link rel="modulepreload" crossorigin href="/assets/models-
|
|
65
|
-
<link rel="modulepreload" crossorigin href="/assets/validation-
|
|
63
|
+
<link rel="modulepreload" crossorigin href="/assets/use-engine-command-mutation-CcfqRB7j.js">
|
|
64
|
+
<link rel="modulepreload" crossorigin href="/assets/models-CFdqSxB3.js">
|
|
65
|
+
<link rel="modulepreload" crossorigin href="/assets/validation-DRj8OKvB.js">
|
|
66
66
|
<link rel="modulepreload" crossorigin href="/assets/shallow-Cin0mLuv.js">
|
|
67
|
-
<link rel="modulepreload" crossorigin href="/assets/route-preload-
|
|
68
|
-
<link rel="modulepreload" crossorigin href="/assets/use-transition-navigate-
|
|
69
|
-
<link rel="modulepreload" crossorigin href="/assets/transition-nav-link-
|
|
70
|
-
<link rel="modulepreload" crossorigin href="/assets/control-
|
|
71
|
-
<link rel="modulepreload" crossorigin href="/assets/catalog-
|
|
67
|
+
<link rel="modulepreload" crossorigin href="/assets/route-preload-DQgHHtBj.js">
|
|
68
|
+
<link rel="modulepreload" crossorigin href="/assets/use-transition-navigate-jTHkLHMS.js">
|
|
69
|
+
<link rel="modulepreload" crossorigin href="/assets/transition-nav-link-Ct6VIy2S.js">
|
|
70
|
+
<link rel="modulepreload" crossorigin href="/assets/control-DCNd1A3U.js">
|
|
71
|
+
<link rel="modulepreload" crossorigin href="/assets/catalog-B_wh8kje.js">
|
|
72
72
|
<link rel="modulepreload" crossorigin href="/assets/select-display-items-Bqb6Sbg6.js">
|
|
73
73
|
<link rel="modulepreload" crossorigin href="/assets/transition-types-2i1blGlR.js">
|
|
74
|
-
<link rel="modulepreload" crossorigin href="/assets/fleet-
|
|
75
|
-
<link rel="modulepreload" crossorigin href="/assets/events-
|
|
74
|
+
<link rel="modulepreload" crossorigin href="/assets/fleet-CH141gbg.js">
|
|
75
|
+
<link rel="modulepreload" crossorigin href="/assets/events-CeR9wTII.js">
|
|
76
76
|
<link rel="stylesheet" crossorigin href="/assets/index-D1lU9Fg9.css">
|
|
77
77
|
</head>
|
|
78
78
|
<body>
|
package/miravo
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./catalog-CbdG58Mn.js";export{e as CatalogPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{at as n}from"./vendor-ui-CWUk2ulb.js";import{A as r,B as i,F as a,G as o,H as s,I as c,K as l,L as u,M as d,N as f,O as ee,P as p,R as te,U as m,V as h,W as ne,j as g,k as re,q as _,z as v}from"./api-DimikzPd.js";import{t as y}from"./proxy-Be4WzmcS.js";import{t as b}from"./AnimatePresence-CPmH1DMY.js";import{i as ie,r as ae}from"./dist-xY0pK9Wy.js";import{a as oe,i as se,n as ce,o as le,r as ue,s as de,t as fe}from"./copy-button-BvU3RDZa.js";import{t as x}from"./shallow-Cin0mLuv.js";import{S,d as pe,l as C,u as me,w as he,x as ge}from"./format-CshN6yEB.js";import{n as w,t as T}from"./utils-XFKvwlFT.js";import{t as _e}from"./activity-Cy_niK56.js";import{t as ve}from"./arrow-right-BjBb4z7g.js";import{c as ye,i as be,l as xe,n as Se,s as Ce,t as we}from"./select-CmlY1M1a.js";import{a as Te,c as E,i as Ee,n as De,o as Oe,r as ke,s as Ae,t as je}from"./tabs-4SeH2unv.js";import{a as D,c as Me,i as Ne,l as Pe,n as Fe,r as Ie,s as O,t as Le}from"./validation-DLydiTzj.js";import{i as Re,n as ze,r as Be,t as Ve}from"./checkbox-C_4HRnS_.js";import{t as He}from"./layers-1figUpjG.js";import{c as Ue,r as We,t as k}from"./use-engine-command-mutation-C8S_hX0O.js";import{t as Ge}from"./triangle-alert-BXrJNk3g.js";import{i as Ke,n as qe,t as Je}from"./tooltip-D1ydB4g3.js";import{r as A}from"./engine-store-DMULdR_V.js";import{t as Ye}from"./transition-nav-link-nVD3H66a.js";import{t as j}from"./badge-eIn_7YrK.js";import{t as M}from"./label-CMBWxUhA.js";import{a as N,c as P,i as Xe,l as F,n as Ze,o as I,r as Qe,s as L,t as $e}from"./combobox-BCaV1Wbo.js";var et=w(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),tt=w(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),nt=w(`octagon-alert`,[[`path`,{d:`M12 16h.01`,key:`1drbdi`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z`,key:`1fd625`}]]),rt=w(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),it=w(`power-off`,[[`path`,{d:`M18.36 6.64A9 9 0 0 1 20.77 15`,key:`dxknvb`}],[`path`,{d:`M6.16 6.16a9 9 0 1 0 12.68 12.68`,key:`1x7qb5`}],[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),at=w(`power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),ot=w(`radio-tower`,[[`path`,{d:`M4.9 16.1C1 12.2 1 5.8 4.9 1.9`,key:`s0qx1y`}],[`path`,{d:`M7.8 4.7a6.14 6.14 0 0 0-.8 7.5`,key:`1idnkw`}],[`circle`,{cx:`12`,cy:`9`,r:`2`,key:`1092wv`}],[`path`,{d:`M16.2 4.8c2 2 2.26 5.11.8 7.47`,key:`ojru2q`}],[`path`,{d:`M19.1 1.9a9.96 9.96 0 0 1 0 14.1`,key:`rhi7fg`}],[`path`,{d:`M9.5 18h5`,key:`mfy3pd`}],[`path`,{d:`m8 22 4-11 4 11`,key:`25yftu`}]]),st=w(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),ct=w(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),lt=w(`trash`,[[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]);h({path:m().min(1),name:m().min(1),description:m().optional(),memberCount:i().int().nonnegative(),methodCount:i().int().nonnegative(),faultCount:i().int().nonnegative(),hasLifecycle:a(),lifecycleStageCount:i().int().nonnegative()}),h({path:m().min(1),id:m().min(1),name:m().min(1),description:m().optional(),areaCount:i().int().nonnegative(),twinAssignmentCount:i().int().nonnegative(),uniqueModelCount:i().int().nonnegative(),modelNames:p(m().min(1)),totalTwinCount:i().int().nonnegative()});var ut=h({severity:u([`error`,`warning`]),message:m(),fix:m()});h({valid:a(),templatePath:m(),issues:p(ut)});var dt=`%.A.Hz.L.L/h.L/min.L/s.N.V.bar.cfm.count.degC.h.kN.kVA.kW.kWh.m.m/s.m3.m3/h.mm.mm/min.mm/s.ppm.pu.rpm.s`.split(`.`),R=u(dt);new Set(dt);var ft=m().min(1).max(128).regex(/^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/),pt=u([`Boolean`,`Int32`,`UInt16`,`UInt32`,`Double`,`Float`,`String`]);u([`variable`,`property`]);var mt=u([`read`,`readwrite`,`write`]),ht=u([`>`,`>=`,`<`,`<=`,`==`,`!=`]),gt=`Must be 1-64 chars and contain only letters, numbers, underscores, or hyphens.`,_t=c(`type`,[h({type:v(`threshold`),member:m().regex(g,gt),operator:ht,threshold:i().finite()}).strict(),h({type:v(`lifecycle-stage`)}).strict(),h({type:v(`health-state`)}).strict(),h({type:v(`fault-active`)}).strict(),h({type:v(`fault-count`)}).strict(),h({type:v(`active-fault-code`),fallback:m().default(``)}).strict(),h({type:v(`availability-state`),member:m().regex(g,gt),operator:ht.default(`>`),threshold:i().finite().default(0),running_state:m().default(`running`),stopped_state:m().default(`stopped`),faulted_state:m().default(`faulted`)}).strict()]),z=`Must be 1-64 chars and contain only letters, numbers, underscores, or hyphens.`,B=p(m().min(1)).min(1),vt=h({data_type:pt,unit:R.optional(),description:m().optional(),enum_values:B.optional()}).strict(),yt=o([h({member:m().regex(g,z),value:o([i(),m(),a()])}).strict(),h({member:m().regex(g,z),argument:m().regex(g,z)}).strict()]),bt=h({type:v(`set-members`),writes:p(yt).min(1)}).strict(),xt=o([h({parameter:m().regex(g,z),value:i().finite()}).strict(),h({parameter:m().regex(g,z),argument:m().regex(g,z)}).strict()]),St=c(`type`,[bt,h({type:v(`set-parameters`),writes:p(xt).min(1)}).strict(),h({type:v(`clear-faults`)}).strict()]),Ct=h({description:m().optional(),input_arguments:s(m().regex(g,z),vt).optional(),output_arguments:s(m().regex(g,z),vt).optional(),runtime:St.optional()}).strict(),wt=s(m().regex(g,z),Ct);function V(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Tt(e){if(typeof e==`string`)return f.exec(e)?.[1]}function Et(e,t,n){if(!V(e)||e.type!==`weighted-sum`)return;let r=e.terms;if(Array.isArray(r))for(let e=0;e<r.length;e++){let i=r[e];V(i)&&n(i,[...t,`terms`,e])}}function Dt(e,t,n){if(!V(e))return;let r=[...t,`member`],i=[...t,`previous_member`],a=[...t,`param`],o=[...t,`generator`];typeof e.member==`string`&&n.onMember?.(e.member,r),typeof e.previous_member==`string`&&n.onPreviousMember?.(e.previous_member,i),typeof e.param==`string`&&n.onParam?.(e.param,a),`generator`in e&&n.onGenerator?.(e.generator,o)}function Ot(e,t,n,r){return{onMember:e,onPreviousMember:t,onParam:n,onGenerator:r}}function kt(e,t,n,r,i,a){Dt(e,t,Ot(n,r,i,a))}function H(e){return e===`Double`||e===`Float`||e===`Int32`||e===`UInt16`||e===`UInt32`}function At(e){return e===`Int32`||e===`UInt16`||e===`UInt32`}function U(e,t){switch(t){case`Boolean`:return typeof e==`boolean`;case`String`:return typeof e==`string`;case`Double`:case`Float`:return typeof e==`number`&&Number.isFinite(e);case`Int32`:return typeof e==`number`&&Number.isSafeInteger(e)&&e>=-2147483648&&e<=2147483647;case`UInt16`:return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0&&e<=65535;case`UInt32`:return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0&&e<=4294967295;default:return!1}}function jt(e,t,n){e.unit!==void 0&&(e.data_type===`Boolean`||e.data_type===`String`)&&t.addIssue({code:_.custom,path:[...n,`unit`],message:`Members with data_type "${e.data_type}" must not declare engineering units. Fix: remove the unit or use a numeric data_type.`}),e.enum_values&&e.data_type!==`String`&&t.addIssue({code:_.custom,path:[...n,`enum_values`],message:`enum_values is only valid for String members. Fix: remove enum_values or change data_type to "String".`})}function W(e,t,n,r){if(V(e)&&typeof e.type==`string`)switch(e.type){case`correlated`:typeof e.source==`string`&&n.push({member:e.source,path:[...t,`source`],previousTick:!1}),K(e.factor,[...t,`factor`],r),K(e.offset,[...t,`offset`],r);return;case`sine`:case`noise`:case`waveform`:case`chirp`:K(e.center,[...t,`center`],r);return;case`mean-reverting-noise`:K(e.mean,[...t,`mean`],r);return;case`first-order-lag`:case`second-order`:K(e.gain,[...t,`gain`],r),K(e.bias,[...t,`bias`],r),G(e.input,[...t,`input`],n,r);return;case`transport-delay`:K(e.delay,[...t,`delay`],r),G(e.input,[...t,`input`],n,r);return;case`slew-rate-limiter`:case`integrator`:G(e.input,[...t,`input`],n,r);return;case`hysteresis-relay`:K(e.on_threshold,[...t,`on_threshold`],r),K(e.off_threshold,[...t,`off_threshold`],r),G(e.input,[...t,`input`],n,r);return;case`weighted-sum`:K(e.bias,[...t,`bias`],r),Et(e,t,(e,t)=>{K(e.weight,[...t,`weight`],r),G(e.input,[...t,`input`],n,r)});return;case`gate`:n.push({member:String(e.enabled_member),path:[...t,`enabled_member`],previousTick:!1}),G(e.input,[...t,`input`],n,r);return;case`health-dependent`:{let i=e.stages;if(!V(i))return;for(let[e,a]of Object.entries(i))W(a,[...t,`stages`,e],n,r);return}default:return}}function G(e,t,n,r){kt(e,t,(e,t)=>n.push({member:e,path:t,previousTick:!1}),(e,t)=>n.push({member:e,path:t,previousTick:!0}),(e,t)=>r.push({param:e,path:t}),(e,t)=>W(e,t,n,r))}function K(e,t,n){let r=Tt(e);r!==void 0&&n.push({param:r,path:t})}function Mt(e,t,n){if(!V(e))return;let r=e.type;(r===`threshold`||r===`availability-state`)&&typeof e.member==`string`&&n.push({member:e.member,path:[...t,`member`],previousTick:!1})}function Nt(e,t,n){if(!V(e))return;let r=e.type;if(typeof r!=`string`)return;if(r===`integrator`&&e.wrap===!0&&(typeof e.wrap_at!=`number`||!Number.isFinite(e.wrap_at)||e.wrap_at<=0)&&n.addIssue({code:_.custom,path:[...t,`wrap_at`],message:`wrap_at must be a finite number greater than 0 when wrap is true. Fix: Set wrap_at to a positive number, or set wrap to false.`}),r===`health-dependent`){let r=e.stages;if(V(r))for(let[e,i]of Object.entries(r))Nt(i,[...t,`stages`,e],n)}function i(e,t){!V(e)||!(`generator`in e)||Nt(e.generator,[...t,`generator`],n)}i(e.input,[...t,`input`]),Et(e,t,(e,t)=>{i(e.input,[...t,`input`])})}function Pt(e){switch(e){case`Boolean`:return!1;case`String`:return``;case`Double`:case`Float`:case`Int32`:case`UInt16`:case`UInt32`:return 0;default:return 0}}var Ft=p(c(`type`,[h({type:v(`white_noise`),strength:i().min(0).max(1),scale:i().positive().optional()}).strict(),h({type:v(`drift`),tau:i().positive(),sigma:i().min(0).max(1),scale:i().positive().optional()}).strict(),h({type:v(`outlier`),probability:i().min(0).max(1),magnitude:i().positive(),scale:i().positive().optional()}).strict(),h({type:v(`gap`),probability:i().min(0).max(1),duration:i().int().positive().default(10)}).strict(),h({type:v(`noise_burst`),probability:i().min(0).max(1),duration:i().int().positive().default(5),strength:i().min(0).max(1),scale:i().positive().optional()}).strict()])).min(1).optional(),It=`Must be 1-64 chars and contain only letters, numbers, underscores, or hyphens.`;u([`float`,`int`,`string`,`bool`]);var Lt=c(`type`,[h({type:v(`float`),default:i().finite(),min:i().finite().optional(),max:i().finite().optional(),unit:R.optional()}),h({type:v(`int`),default:i().int().safe(),min:i().int().safe().optional(),max:i().int().safe().optional(),unit:R.optional()}),h({type:v(`string`),default:m(),unit:R.optional()}),h({type:v(`bool`),default:a(),unit:R.optional()})]),q=o([h({member:m()}).strict(),h({previous_member:m()}).strict(),h({param:m()}).strict(),h({generator:te(()=>pn)}).strict()]),Rt=m().regex(f,`Must be a $param.X parameter reference`),J=o([i(),Rt]),zt=o([i().finite(),Rt]),Bt={initial_value:i().default(0),gain:J.default(1),bias:J.default(0),min:i().nullable().default(null),max:i().nullable().default(null),input:q},Vt=h({type:v(`sine`),center:J,amplitude:i().positive(),period:i().positive()}).strict(),Ht=h({type:v(`random-walk`),min:i(),max:i(),step:i().positive()}).strict(),Ut=h({type:v(`noise`),center:J,stddev:i().positive()}).strict(),Wt=h({type:v(`step`),values:p(i()).min(1),interval:i().positive()}).strict(),Gt=h({type:v(`correlated`),source:m().regex(g,It),factor:zt,offset:zt,power:i().int().positive().optional()}).strict(),Kt=h({from:m(),to:m(),probability:i().min(0).max(1).optional(),on:m().optional()}).strict(),qt=h({type:v(`state-machine`),states:p(m()).min(1),initial:m(),transitions:p(Kt).min(1)}).strict();function Jt(e,t){let n=new Set(e.states);n.has(e.initial)||t.addIssue({code:_.custom,path:[`initial`],message:`State machine initial state "${e.initial}" is not in states. Fix: Set initial to one of: ${e.states.join(`, `)}.`});for(let r=0;r<e.transitions.length;r++){let i=e.transitions[r];i&&(n.has(i.from)||t.addIssue({code:_.custom,path:[`transitions`,r,`from`],message:`State machine transition from "${i.from}" references a state that is not in states. Fix: Add "${i.from}" to states or change transition.from to one of: ${e.states.join(`, `)}.`}),n.has(i.to)||t.addIssue({code:_.custom,path:[`transitions`,r,`to`],message:`State machine transition to "${i.to}" references a state that is not in states. Fix: Add "${i.to}" to states or change transition.to to one of: ${e.states.join(`, `)}.`}))}}qt.superRefine(Jt);var Yt=h({type:v(`ramp`),start_value:i().default(0),rate:i(),duration:i().nonnegative(),start_time:i().default(0),min:i().nullable().default(null),max:i().nullable().default(null)}).strict(),Xt=h({type:v(`mean-reverting-noise`),mean:J,tau:i().positive(),sigma:i().positive(),initial_value:i().optional(),min:i().nullable().default(null),max:i().nullable().default(null)}).strict(),Zt=h({time:i().nonnegative(),value:i()}),Qt=h({type:v(`timetable`),points:p(Zt).min(2),repeat:a().default(!1),interpolation:u([`linear`,`step`]).default(`linear`)}).strict(),$t=h({type:v(`waveform`),shape:u([`sawtooth`,`triangle`,`square`,`pulse`]),center:J,amplitude:i().positive(),period:i().positive(),duty_cycle:i().min(0).max(1).default(.5)}).strict(),en=h({type:v(`chirp`),center:J,amplitude:i().positive(),start_freq_hz:i().positive(),end_freq_hz:i().positive(),sweep_duration:i().positive(),sweep:u([`linear`,`exponential`]).default(`linear`),repeat:a().default(!0)}).strict(),Y=h({type:v(`impulse`),baseline:i().default(0),amplitude:i(),probability:i().min(0).max(1).optional(),interval:i().positive().optional(),decay:i().min(0).max(1).optional(),duration:i().int().positive().default(1)}).strict();function tn(e,t){e.probability===void 0&&e.interval===void 0&&t.addIssue({code:_.custom,path:[`probability`],message:`Impulse generator requires either probability or interval. Fix: Add probability: 0.01 (per-tick chance) or interval: 60 (seconds between triggers).`}),e.probability!==void 0&&e.interval!==void 0&&t.addIssue({code:_.custom,path:[`interval`],message:`Impulse generator cannot have both probability and interval. Fix: Remove one: use probability for random triggers, or interval for periodic triggers.`})}Y.superRefine(tn);var nn=h({type:v(`first-order-lag`),tau:i().positive(),...Bt}).strict(),rn=h({type:v(`integrator`),initial_value:i().default(0),gain:i().default(1),bias_rate:i().default(0),min:i().default(-1/0),max:i().default(1/0),wrap:a().default(!1),wrap_at:i().nullable().default(null),input:q}).strict(),an=h({type:v(`transport-delay`),delay:o([i().nonnegative(),Rt]),initial_value:i().default(0),interpolation:u([`linear`,`zoh`]).default(`linear`),input:q}).strict(),on=h({type:v(`slew-rate-limiter`),rate_up:i().positive(),rate_down:i().positive().optional(),initial_value:i().default(0),min:i().nullable().default(null),max:i().nullable().default(null),input:q}).strict(),sn=h({type:v(`second-order`),natural_freq_hz:i().positive(),damping_ratio:i().positive(),initial_velocity:i().default(0),...Bt}).strict(),cn=h({type:v(`hysteresis-relay`),on_threshold:J,off_threshold:J,output_on:o([i(),m()]).default(1),output_off:o([i(),m()]).default(0),initial_state:u([`on`,`off`]).default(`off`),mode:u([`rising`,`falling`]).default(`rising`),input:q}).strict(),ln=h({weight:J.default(1),input:q}),un=h({type:v(`weighted-sum`),bias:J.default(0),terms:p(ln).min(1),min:i().nullable().default(null),max:i().nullable().default(null)}).strict(),dn=h({type:v(`gate`),enabled_member:m().regex(g,It),input:q,disabled_value:o([i(),m(),a()])}).strict(),fn=c(`type`,[Vt,Ht,Ut,Wt,Gt,qt,Yt,Xt,Qt,$t,en,Y]).superRefine((e,t)=>{e.type===`state-machine`&&Jt(e,t),e.type===`impulse`&&tn(e,t)}),pn=c(`type`,[Vt,Ht,Ut,Wt,Gt,qt,Yt,Xt,Qt,$t,en,Y,h({type:v(`health-dependent`),stages:s(m(),fn)}).strict(),nn,rn,an,on,sn,cn,un,dn]).superRefine((e,t)=>{e.type===`state-machine`&&Jt(e,t),e.type===`impulse`&&tn(e,t)}),mn=h({multiplier:i().finite().optional(),offset:i().finite().optional()}).strict(),hn=h({stages:p(h({name:m().min(1),duration_hours:ne([i().nonnegative(),i().nonnegative()]).refine(([e,t])=>e<=t,{message:`duration_hours max must be greater than or equal to min.`}),effects:s(m(),mn)})).min(1)}).superRefine((e,t)=>{let n=new Set;for(let r=0;r<e.stages.length;r++){let i=e.stages[r];i&&(n.has(i.name)&&t.addIssue({code:_.custom,path:[`stages`,r,`name`],message:`Lifecycle stage names must be unique. Duplicate "${i.name}". Fix: Rename one stage so each lifecycle stage has a unique name.`}),n.add(i.name))}}),gn=h({multiplier:i().finite().optional(),offset:i().finite().optional(),spike:i().finite().optional(),duration_ticks:i().int().positive().optional(),onset_ticks:i().int().positive().optional(),recovery_ticks:i().int().positive().optional()}).strict(),_n=h({condition:m().optional(),lifecycle_stage:m().optional(),probability:i().min(0).max(1)}),vn=h({name:m().regex(g,It),trigger:_n,effects:s(m(),o([gn,m()]))}),yn=`Must be 1-64 chars and contain only letters, numbers, underscores, or hyphens.`,bn=m().regex(f,`Must be a $param.X parameter reference`),xn=o([i(),m(),a()]),Sn=h({name:m().regex(g,yn),description:m().optional(),namespace:m().optional()}).strict(),Cn=c(`kind`,[h({kind:v(`variable`),data_type:pt,access:mt,unit:R.optional(),enum_values:B.optional(),eu_range:ne([i(),i()]).refine(([e,t])=>e<=t,{message:`eu_range[0] (min) must be <= eu_range[1] (max).`}).optional(),generator:pn.optional(),binding:_t.optional(),default:xn.optional(),observation_effects:Ft}).strict(),h({kind:v(`property`),data_type:pt,access:mt,unit:R.optional(),enum_values:B.optional(),default:o([xn,bn]).optional()}).strict()]),wn=s(m().regex(g,yn),Cn).refine(e=>Object.keys(e).length>=1,{message:`Members map must have at least 1 member.`}).refine(e=>Object.keys(e).length<=256,{message:`Members map must have at most 256 members.`});h({schema_version:v(`2`),model:Sn,parameters:s(m(),Lt).optional(),members:wn,methods:wt.optional(),lifecycle:hn.optional(),faults:p(vn).optional()}).strict().superRefine((e,t)=>{let n=Object.keys(e.members),r=new Map;for(let e=0;e<n.length;e++){let t=n[e];t!==void 0&&r.set(t,e)}let i=new Set(Object.keys(e.parameters??{})),a=new Set(Object.entries(e.parameters??{}).filter(([,e])=>e.type===`float`||e.type===`int`).map(([e])=>e));for(let o=0;o<n.length;o++){let s=n[o];if(s===void 0)continue;let c=e.members[s];if(!c||(jt(c,t,[`members`,s]),c.kind===`variable`&&c.generator!==void 0&&c.binding!==void 0&&t.addIssue({code:_.custom,path:[`members`,s,`binding`],message:`Variable members cannot define both "generator" and "binding". Fix: keep one source of value generation.`}),c.kind===`variable`&&c.binding!==void 0&&c.access!==`read`&&t.addIssue({code:_.custom,path:[`members`,s,`access`],message:`Variable members with a "binding" must use access "read". Fix: change access to "read" or remove the binding.`}),c.kind!==`variable`||!c.generator&&!c.binding))continue;let l=[],u=[],d=[`members`,s,`generator`];if(c.generator&&W(c.generator,d,l,u),c.binding&&Mt(c.binding,[`members`,s,`binding`],l),c.generator&&(Nt(c.generator,d,t),c.generator.type===`gate`)){let n=e.members[c.generator.enabled_member];n&&n.data_type!==`Boolean`&&t.addIssue({code:_.custom,path:[`members`,s,`generator`,`enabled_member`],message:`Gate generator for "${s}" references "${c.generator.enabled_member}", but "${c.generator.enabled_member}" is not Boolean. Fix: use a Boolean command/state member for enabled_member.`}),U(c.generator.disabled_value,c.data_type)||t.addIssue({code:_.custom,path:[`members`,s,`generator`,`disabled_value`],message:`Gate generator disabled_value for "${s}" does not match data_type "${c.data_type}". Fix: use a compatible disabled_value literal.`})}for(let e of l){let n=r.get(e.member);if(n===void 0){t.addIssue({code:_.custom,path:[...e.path],message:`Member "${s}" references member "${e.member}", but "${e.member}" is not defined. Fix: Define "${e.member}" in members, or change the reference to a parameter.`});continue}!e.previousTick&&n>=o&&t.addIssue({code:_.custom,path:[...e.path],message:`Member "${s}" references member "${e.member}" which is defined later (or is itself). Members are evaluated in declaration order. Fix: Move "${e.member}" above "${s}".`})}for(let n of u)i.has(n.param)?a.has(n.param)||t.addIssue({code:_.custom,path:[...n.path],message:`Member "${s}" references parameter "${n.param}" in a numeric position, but "${n.param}" has type "${e.parameters?.[n.param]?.type}". Only float and int parameters can be used as generator coefficients or inputs. Fix: Change "${n.param}" to type "float" or "int".`}):t.addIssue({code:_.custom,path:[...n.path],message:`Member "${s}" references parameter "${n.param}", but "${n.param}" is not defined. Fix: Define "${n.param}" under parameters, or replace "$param.${n.param}" with a literal value.`});if(c.binding)switch(c.binding.type){case`threshold`:c.data_type!==`Boolean`&&t.addIssue({code:_.custom,path:[`members`,s,`data_type`],message:`Members using binding.type "threshold" must use data_type "Boolean". Fix: change data_type to "Boolean".`}),Tn(s,c.binding.member,e,t,[`members`,s,`binding`,`member`]);break;case`availability-state`:c.data_type!==`String`&&t.addIssue({code:_.custom,path:[`members`,s,`data_type`],message:`Members using binding.type "availability-state" must use data_type "String". Fix: change data_type to "String".`}),Tn(s,c.binding.member,e,t,[`members`,s,`binding`,`member`]);break;case`lifecycle-stage`:case`health-state`:case`active-fault-code`:c.data_type!==`String`&&t.addIssue({code:_.custom,path:[`members`,s,`data_type`],message:`Members using binding.type "${c.binding.type}" must use data_type "String". Fix: change data_type to "String".`});break;case`fault-active`:c.data_type!==`Boolean`&&t.addIssue({code:_.custom,path:[`members`,s,`data_type`],message:`Members using binding.type "fault-active" must use data_type "Boolean". Fix: change data_type to "Boolean".`});break;case`fault-count`:c.data_type!==`Int32`&&c.data_type!==`UInt16`&&c.data_type!==`UInt32`&&t.addIssue({code:_.custom,path:[`members`,s,`data_type`],message:`Members using binding.type "fault-count" must use an integer data_type (Int32, UInt16, or UInt32). Fix: change data_type to an integer type.`});break;default:c.binding}if(c.kind===`variable`&&c.observation_effects){H(c.data_type)||t.addIssue({code:_.custom,path:[`members`,s,`observation_effects`],message:`Observation effects on "${s}" require a numeric data_type (Double, Float, Int32, UInt16, or UInt32). Member has data_type "${c.data_type}", which cannot be degraded by noise, gaps, or drift. Fix: remove observation_effects, or change data_type to a numeric type.`}),c.access!==`read`&&t.addIssue({code:_.custom,path:[`members`,s,`observation_effects`],message:`Observation effects on "${s}" require access "read". Observation effects corrupt values — they must not be applied to command targets or setpoints. Fix: change access to "read" or remove observation_effects.`});for(let e=0;e<c.observation_effects.length;e++){let n=c.observation_effects[e];n&&(n.type===`white_noise`||n.type===`drift`||n.type===`outlier`||n.type===`noise_burst`)&&!(`scale`in n&&n.scale!==void 0)&&!c.eu_range&&t.addIssue({code:_.custom,path:[`members`,s,`observation_effects`,e],message:`Member "${s}" uses relative observation effect "${n.type}" but has no eu_range and no explicit scale. Fix: add eu_range: [min, max] to the member, or add scale: <number> to the effect.`})}}}function o(n,i,a){if(!r.has(n)){t.addIssue({code:_.custom,path:[...i],message:`${a} has effect on "${n}", but "${n}" is not a defined member. Fix: Change "${n}" to a valid member name.`});return}let o=e.members[n];o&&o.kind!==`variable`&&t.addIssue({code:_.custom,path:[...i],message:`${a} has effect on "${n}", but "${n}" is a property (kind: "property"). Effects can only target variable members.`})}if(e.lifecycle){let t=[`lifecycle`,`stages`];for(let n of e.lifecycle.stages)for(let e of Object.keys(n.effects))o(e,t,`Lifecycle stage "${n.name}"`)}if(e.faults){let n=new Set;for(let r=0;r<e.faults.length;r++){let i=e.faults[r];if(!i)continue;n.has(i.name)&&t.addIssue({code:_.custom,path:[`faults`,r,`name`],message:`Fault names must be unique. Duplicate "${i.name}". Fix: Rename one fault so each fault has a unique name.`}),n.add(i.name);let a=[`faults`,r,`effects`];for(let e of Object.keys(i.effects))o(e,a,`Fault "${i.name}"`)}}for(let r of n){let n=e.members[r];if(!n||n.kind!==`property`||typeof n.default!=`string`)continue;let a=Tt(n.default);a!==void 0&&!i.has(a)&&t.addIssue({code:_.custom,path:[`members`,r,`default`],message:`Property "${r}" default references parameter "${a}", but "${a}" is not defined. Fix: Define "${a}" under parameters, or use a literal value.`})}if(e.methods)for(let[n,r]of Object.entries(e.methods))En(n,r.input_arguments,t,[`methods`,n,`input_arguments`]),En(n,r.output_arguments,t,[`methods`,n,`output_arguments`]),Dn(n,r,e,t,[`methods`,n,`runtime`])});function Tn(e,t,n,r,i){let a=n.members[t];a&&(H(a.data_type)||r.addIssue({code:_.custom,path:[...i],message:`Member "${e}" binding references "${t}", but "${t}" is not numeric. Fix: bind to a numeric member or change the source member data_type.`}))}function En(e,t,n,r){if(t)for(let[i,a]of Object.entries(t))a.unit!==void 0&&(a.data_type===`Boolean`||a.data_type===`String`)&&n.addIssue({code:_.custom,path:[...r,i,`unit`],message:`Method "${e}" argument "${i}" uses data_type "${a.data_type}" and must not declare an engineering unit. Fix: remove the unit or use a numeric data_type.`}),a.enum_values&&a.data_type!==`String`&&n.addIssue({code:_.custom,path:[...r,i,`enum_values`],message:`Method "${e}" argument "${i}" can only use enum_values with data_type "String". Fix: remove enum_values or change the data_type.`})}function Dn(e,t,n,r,i){let a=t.runtime;if(a)switch(a.type){case`clear-faults`:return;case`set-parameters`:for(let o=0;o<a.writes.length;o++){let s=a.writes[o];if(!s)continue;let c=[...i,`writes`,o],l=n.parameters?.[s.parameter];if(!l){r.addIssue({code:_.custom,path:[...c,`parameter`],message:`Method "${e}" runtime targets parameter "${s.parameter}", but "${s.parameter}" is not defined. Fix: target a declared parameter.`});continue}if(l.type!==`float`&&l.type!==`int`){r.addIssue({code:_.custom,path:[...c,`parameter`],message:`Method "${e}" runtime targets parameter "${s.parameter}" of type "${l.type}". Fix: use set-parameters only with float or int parameters.`});continue}if(`argument`in s){let n=t.input_arguments?.[s.argument];if(!n){r.addIssue({code:_.custom,path:[...c,`argument`],message:`Method "${e}" runtime references input argument "${s.argument}", but that argument is not defined. Fix: declare the input argument or use a literal value.`});continue}H(n.data_type)||r.addIssue({code:_.custom,path:[...c,`argument`],message:`Method "${e}" runtime argument "${s.argument}" must be numeric to write parameter "${s.parameter}". Fix: use Double, Float, Int32, UInt16, or UInt32.`}),l.type===`int`&&!At(n.data_type)&&r.addIssue({code:_.custom,path:[...c,`argument`],message:`Method "${e}" runtime argument "${s.argument}" uses data_type "${n.data_type}" but parameter "${s.parameter}" is type "int". Fix: use Int32, UInt16, or UInt32 so runtime writes stay integer-safe.`});continue}l.type===`int`&&!Number.isSafeInteger(s.value)&&r.addIssue({code:_.custom,path:[...c,`value`],message:`Method "${e}" runtime literal for integer parameter "${s.parameter}" must be a safe integer. Fix: use a whole-number literal.`})}return;case`set-members`:for(let o=0;o<a.writes.length;o++){let s=a.writes[o];if(!s)continue;let c=[...i,`writes`,o],l=n.members[s.member];if(!l){r.addIssue({code:_.custom,path:[...c,`member`],message:`Method "${e}" runtime targets member "${s.member}", but "${s.member}" is not defined. Fix: target a declared member.`});continue}if(l.kind!==`variable`&&r.addIssue({code:_.custom,path:[...c,`member`],message:`Method "${e}" runtime targets "${s.member}", but "${s.member}" is a property. Fix: target a writable variable member.`}),l.access!==`readwrite`&&l.access!==`write`&&r.addIssue({code:_.custom,path:[...c,`member`],message:`Method "${e}" runtime targets "${s.member}", but "${s.member}" is not writable. Fix: set access to "readwrite" or "write".`}),l.kind===`variable`&&l.binding&&r.addIssue({code:_.custom,path:[...c,`member`],message:`Method "${e}" runtime targets "${s.member}", but bound members are computed at runtime. Fix: write to a command/setpoint member without a binding.`}),`argument`in s){let n=t.input_arguments?.[s.argument];if(!n){r.addIssue({code:_.custom,path:[...c,`argument`],message:`Method "${e}" runtime references input argument "${s.argument}", but that argument is not defined. Fix: declare the input argument or use a literal value.`});continue}if(U(Pt(n.data_type),l.data_type)||r.addIssue({code:_.custom,path:[...c,`argument`],message:`Method "${e}" runtime argument "${s.argument}" uses data_type "${n.data_type}" which does not match target member "${s.member}" data_type "${l.data_type}". Fix: align the argument and target member data types.`}),n.enum_values&&l.enum_values){let t=n.enum_values.filter(e=>!l.enum_values?.includes(e));t.length>0&&r.addIssue({code:_.custom,path:[...c,`argument`],message:`Method "${e}" runtime argument "${s.argument}" allows values [${t.join(`, `)}] that are not valid for target member "${s.member}". Fix: align enum_values between the argument and target member.`})}continue}U(s.value,l.data_type)||r.addIssue({code:_.custom,path:[...c,`value`],message:`Method "${e}" runtime literal for "${s.member}" does not match data_type "${l.data_type}". Fix: use a compatible literal value.`}),l.enum_values&&typeof s.value==`string`&&!l.enum_values.includes(s.value)&&r.addIssue({code:_.custom,path:[...c,`value`],message:`Method "${e}" runtime literal "${s.value}" is not allowed for member "${s.member}". Fix: use one of [${l.enum_values.join(`, `)}].`})}return;default:}}var On=o([i().finite(),m(),a()]),kn=m().regex(/^[a-f0-9]{64}$/),An=h({id:m().min(1),model:m().min(1),browsePath:p(m().min(1)).min(1),parameters:s(m(),On),lifecycleStage:m().min(1),operatingHours:i().finite().nonnegative(),activeFaults:p(m().min(1)),templateRunId:i().int().positive().optional(),observationState:s(m(),s(m(),l())).optional().default({}),faultState:s(m(),h({remaining:i().int(),elapsed:i().int(),recovering:a(),recoveryElapsed:i().int(),recoveryTicks:i().int()})).optional().default({})}),jn=h({templateRunId:i().int().positive(),templateName:m().min(1),templatePath:m(),entryHash:kn.optional()}),Mn=h({name:m().min(1),enabled:a(),config:s(m(),l())});h({version:v(1),savedAt:m().min(1),environmentName:ft,models:p(m().min(1)),instances:p(An),templateRuns:p(jn),adapters:p(Mn).default([])});var X=e(t(),1),Z=n(),Nn={mqtt:Te,opcua:ze,modbus:tt},Pn={mqtt:`MQTT`,opcua:`OPC UA`,modbus:`Modbus TCP`},Fn={mqtt:re,opcua:r,modbus:ee};function In({adapter:e}){let t=e.pending?`pending`:e.enabled?`enabled`:`disabled`;return(0,Z.jsx)(b,{mode:`wait`,initial:!1,children:(0,Z.jsx)(y.div,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},transition:{type:`spring`,stiffness:500,damping:30},children:e.pending?(0,Z.jsxs)(j,{className:`gap-1 bg-info/20 text-info hover:bg-info/20`,children:[(0,Z.jsx)(Oe,{className:`size-3 animate-spin`}),e.enabled?`Disabling...`:`Enabling...`]}):e.enabled?(0,Z.jsxs)(j,{className:`gap-1 bg-success/20 text-success hover:bg-success/20`,children:[(0,Z.jsx)(E,{className:`size-3`}),`Enabled`]}):(0,Z.jsxs)(j,{variant:`outline`,className:`gap-1 text-muted-foreground`,children:[(0,Z.jsx)(et,{className:`size-2`}),`Disabled`]})},t)})}function Ln({metrics:e}){return e?e.connected?null:(0,Z.jsxs)(j,{variant:`destructive`,className:`gap-1`,children:[(0,Z.jsx)(Ae,{className:`size-3`}),`Disconnected`]}):null}function Rn({health:e}){if(!e)return null;let t={healthy:`bg-success/20 text-success hover:bg-success/20`,busy:`bg-warning/20 text-warning hover:bg-warning/20`,saturated:`bg-destructive/20 text-destructive hover:bg-destructive/20`},n=e.state,r=`size-3 shrink-0`,i=n===`healthy`?(0,Z.jsx)(E,{className:r,"aria-hidden":!0}):n===`busy`?(0,Z.jsx)(_e,{className:r,"aria-hidden":!0}):n===`saturated`?(0,Z.jsx)(Ge,{className:r,"aria-hidden":!0}):null;return(0,Z.jsxs)(j,{className:T(`gap-1`,t[n]??``),children:[i,n]})}function Q({label:e,value:t,valueClassName:n}){return(0,Z.jsxs)(`div`,{className:`flex min-h-[3.35rem] flex-col justify-center rounded-[var(--miravo-radius-stadium-sm)] border border-border/55 px-3 py-2 transition-colors hover:border-muted-foreground/25`,children:[(0,Z.jsx)(`span`,{className:`blueprint-title text-[10px] leading-tight text-muted-foreground`,children:e}),(0,Z.jsx)(`span`,{className:T(`mt-1.5 font-mono text-[13px] leading-none tabular-nums tracking-tight text-foreground`,n),children:t})]})}function zn({metrics:e}){return(0,Z.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-3`,children:[(0,Z.jsx)(Q,{label:`Messages sent`,value:C(e.messagesPublished)}),(0,Z.jsx)(Q,{label:`Attempted`,value:C(e.messagesAttempted)}),(0,Z.jsx)(Q,{label:`Skipped (unchanged)`,value:C(e.messagesFiltered)}),(0,Z.jsx)(Q,{label:`Errors`,value:C(e.errorsCount),valueClassName:e.errorsCount>0?`text-destructive`:void 0}),(0,Z.jsx)(Q,{label:`Publish latency`,value:`${e.lastPublishMs.toFixed(1)} ms`}),e.health?(0,Z.jsx)(Q,{label:`Queued messages`,value:String(e.health.pendingWorkCount)}):null]})}function Bn({port:e}){return(0,Z.jsxs)(`div`,{className:`flex gap-2 rounded-[var(--miravo-radius-stadium-sm)] border border-warning/30 bg-warning/10 p-3 text-sm text-warning`,children:[(0,Z.jsx)(Ge,{className:`mt-0.5 size-4 shrink-0`}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`p`,{className:`font-medium`,children:`Before enabling`}),(0,Z.jsxs)(`p`,{className:`mt-1 text-warning`,children:[`Ensure port `,(0,Z.jsx)(`code`,{className:`font-mono font-bold`,children:e}),` is available on the host.`]}),(0,Z.jsxs)(`ul`,{className:`mt-1 list-inside list-disc space-y-0.5 text-warning`,children:[(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`strong`,{children:`Docker:`}),` Restart with`,` `,(0,Z.jsxs)(`code`,{className:`font-mono`,children:[`-p `,e,`:`,e]}),` `,`to expose the port.`]}),(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`strong`,{children:`Bare metal:`}),` Run `,(0,Z.jsxs)(`code`,{className:`font-mono`,children:[`lsof -i :`,e]}),` to check availability.`]})]})]})]})}function Vn({adapter:e,metrics:t}){let[n,r]=(0,X.useState)(!1),[i,a]=(0,X.useState)(``),[o,s]=(0,X.useState)(!1),c=k(),l=Nn[e.name]??ze,u=Pn[e.name]??e.name,d=Fn[e.name]??0,f=o||e.pending===!0,ee=(0,X.useMemo)(()=>{let t=e.config?.port;return typeof t==`number`?t:d},[e.config,d]);return(0,Z.jsxs)(`div`,{className:`protocol-card-art min-w-0 border`,children:[(0,Z.jsxs)(`div`,{className:`relative z-2`,children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":n,className:`group/row flex w-full min-w-0 cursor-pointer gap-3 px-4 py-3 text-left transition-colors duration-[var(--miravo-duration-base)] ease-[var(--miravo-ease)] hover:bg-muted/35`,onClick:()=>r(!n),children:[(0,Z.jsx)(l,{className:`mt-0.5 size-5 shrink-0 text-muted-foreground transition-[transform,color] duration-[var(--miravo-duration-base)] ease-[var(--miravo-ease)] group-hover/row:-rotate-[8deg] group-hover/row:scale-[1.08] group-hover/row:text-primary motion-reduce:transition-none motion-reduce:group-hover/row:rotate-0 motion-reduce:group-hover/row:scale-100`,"aria-hidden":!0}),(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:(0,Z.jsxs)(`div`,{className:`flex w-full min-w-0 flex-wrap items-start justify-between gap-x-3 gap-y-2`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[e.enabled&&!e.pending&&(0,Z.jsx)(`span`,{className:`protocol-card-live-dot`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`whitespace-nowrap font-medium tracking-tight`,children:u}),(0,Z.jsx)(In,{adapter:e}),e.enabled&&!e.pending&&t&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ln,{metrics:t}),t.health?(0,Z.jsx)(Rn,{health:t.health}):(0,Z.jsxs)(j,{className:`gap-1 bg-success/20 text-success hover:bg-success/20`,children:[(0,Z.jsx)(E,{className:`size-3 shrink-0`,"aria-hidden":!0}),`healthy`]})]})]}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[e.enabled&&t&&!e.pending&&(0,Z.jsxs)(`span`,{className:`protocol-card-metric-readout text-muted-foreground`,children:[(0,Z.jsx)(`span`,{className:`text-[10px] font-normal uppercase tracking-[0.12em] text-muted-foreground`,children:`out`}),` `,(0,Z.jsx)(`span`,{className:`text-foreground`,children:C(t.messagesPublished)}),(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:` msgs`}),t.errorsCount>0&&(0,Z.jsxs)(`span`,{className:`ml-1.5 text-destructive`,children:[t.errorsCount,` err`]})]}),(0,Z.jsx)(xe,{className:`size-4 shrink-0 text-muted-foreground transition-[transform,color] duration-[var(--miravo-duration-base)] ease-[var(--miravo-ease)] group-hover/row:translate-y-0.5 group-hover/row:text-primary motion-reduce:transition-none motion-reduce:group-hover/row:translate-y-0 ${n?`rotate-180`:``}`})]})]})})]}),e.enabled&&!e.pending&&e.endpoint&&(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1 px-4 pb-2 pl-11`,children:[(0,Z.jsx)(`code`,{className:`min-w-0 truncate font-mono text-xs text-muted-foreground`,children:e.endpoint}),(0,Z.jsx)(fe,{value:e.endpoint,label:`Copy endpoint URL`})]})]}),(0,Z.jsx)(b,{initial:!1,children:n&&(0,Z.jsx)(y.div,{initial:{height:0,opacity:0},animate:{height:`auto`,opacity:1},exit:{height:0,opacity:0},transition:{duration:.2,ease:`easeOut`},className:`overflow-hidden`,children:(0,Z.jsx)(`div`,{className:`protocol-card-art-body border-t`,children:e.enabled&&t?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`section`,{className:`px-4 pb-4 pt-4`,"aria-labelledby":`protocol-telemetry-${e.name}`,children:[(0,Z.jsxs)(`div`,{className:`mb-3 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between sm:gap-3`,children:[(0,Z.jsx)(`h4`,{id:`protocol-telemetry-${e.name}`,className:`blueprint-title shrink-0 text-muted-foreground`,children:`Telemetry`}),(0,Z.jsxs)(Ye,{to:`/tags?protocol=${e.name}`,className:`group/footer-link inline-flex w-full min-h-8 min-w-0 max-w-full shrink-0 items-center justify-start gap-1.5 rounded-[var(--miravo-radius-pill)] border border-primary/25 bg-primary/5 px-2.5 py-1.5 text-xs font-medium leading-tight text-primary transition-colors hover:border-primary/40 hover:bg-primary/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background sm:w-fit`,children:[(0,Z.jsx)(`span`,{className:`whitespace-nowrap`,children:`Browse Tags`}),(0,Z.jsx)(ve,{className:`size-3 shrink-0 text-primary transition-transform group-hover/footer-link:translate-x-0.5`})]})]}),(0,Z.jsx)(zn,{metrics:t})]}),(0,Z.jsx)(`footer`,{className:`protocol-card-art-footer flex flex-col gap-4 border-t border-border/80 px-4 pb-4 pt-4`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,Z.jsxs)(S,{variant:`destructive`,size:`sm`,className:`gap-1.5`,disabled:f,onClick:async()=>{s(!0);try{await c.mutateAsync({type:`disableAdapter`,adapter:e.name})}catch{}finally{s(!1)}},children:[f?(0,Z.jsx)(Oe,{className:`size-3.5 animate-spin`}):(0,Z.jsx)(it,{className:`size-3.5`}),f?`Disabling...`:`Disable ${u}`]}),!f&&(0,Z.jsx)(`span`,{className:`text-xs leading-snug text-muted-foreground`,children:`Active connections will be dropped.`})]})})]}):(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 px-4 py-4`,children:[!f&&(0,Z.jsx)(Bn,{port:i&&Number(i)||ee}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(M,{htmlFor:`port-${e.name}`,className:`text-xs`,children:`Port`}),(0,Z.jsx)(ge,{id:`port-${e.name}`,type:`number`,placeholder:String(ee),value:i,onChange:e=>a(e.target.value),className:`w-28`,disabled:f})]}),(0,Z.jsxs)(S,{size:`sm`,className:`gap-1.5`,disabled:f,onClick:async()=>{s(!0);try{let t=i?Number(i):void 0,n={};t&&Number.isFinite(t)&&(n.port=t),await c.mutateAsync({type:`enableAdapter`,adapter:e.name,...Object.keys(n).length>0?{config:n}:{}})}catch{}finally{s(!1)}},children:[f?(0,Z.jsx)(Oe,{className:`size-3.5 animate-spin`}):(0,Z.jsx)(at,{className:`size-3.5`}),f?`Enabling...`:`Enable ${u}`]})]})]})})},`panel`)})]})}function Hn(){let{instances:e,models:t,templateRuns:n}=A(x(e=>({instances:e.instances,models:e.models,templateRuns:e.templateRuns}))),r=k(),[i,a]=(0,X.useState)(``),[o,s]=(0,X.useState)(`1`),[c,l]=(0,X.useState)(``),u=(0,X.useMemo)(()=>c?t.filter(e=>e.name.toLowerCase().includes(c.toLowerCase())):t,[t,c]);return(0,Z.jsxs)(I,{className:`h-full min-w-0`,children:[(0,Z.jsx)(P,{className:`pb-3`,children:(0,Z.jsxs)(F,{className:`flex items-center gap-2 text-xs font-medium uppercase tracking-wider`,children:[(0,Z.jsx)(He,{className:`size-3.5 text-muted-foreground`,"aria-hidden":!0}),`Fleet Management`]})}),(0,Z.jsxs)(L,{className:`flex flex-1 flex-col gap-4`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-[10px] font-medium uppercase tracking-wider text-muted-foreground`,children:`Spawn Instances`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2 sm:flex-row sm:items-center`,children:[(0,Z.jsx)(`div`,{className:`min-w-0 w-full sm:min-w-0 sm:flex-1`,children:(0,Z.jsxs)($e,{value:i||null,onValueChange:e=>a(e??``),onInputValueChange:l,children:[(0,Z.jsx)(Qe,{placeholder:`Select model`,className:`h-8 w-full min-w-0`,showClear:!!i}),(0,Z.jsx)(Ze,{children:(0,Z.jsxs)(N,{children:[u.map(e=>(0,Z.jsx)(Xe,{value:e.name,children:e.name},e.name)),u.length===0&&(0,Z.jsx)(`p`,{className:`py-2 text-center text-xs text-muted-foreground`,children:`No models found`})]})})]})}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,Z.jsx)(ge,{type:`number`,value:o,onChange:e=>s(e.target.value),className:`h-8 w-16 text-xs`,min:`1`,"aria-label":`Number of instances to spawn`}),(0,Z.jsx)(S,{size:`sm`,className:`h-8`,onClick:()=>{let e=D(Ne,{model:i,count:Number(o)});e&&r.mutate({type:`spawn`,...e})},children:`Spawn`})]})]}),(0,Z.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[t.length,` models · `,e.length,` running`]})]}),n.length>0&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(O,{}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-[10px] font-medium uppercase tracking-wider text-muted-foreground`,children:`Environment Runs`}),(0,Z.jsx)(b,{initial:!1,children:n.map(e=>(0,Z.jsx)(y.div,{initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4,transition:{duration:.12}},transition:{type:`spring`,stiffness:400,damping:30},children:(0,Z.jsxs)(`div`,{className:`flex items-center justify-between rounded-[var(--miravo-radius-tight)] border px-2.5 py-1.5`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 overflow-hidden`,children:[(0,Z.jsx)(`span`,{className:`truncate text-xs font-medium`,children:me(e.templateName)}),(0,Z.jsxs)(j,{variant:`secondary`,className:`shrink-0 text-[10px]`,children:[e.instanceIds.length,` inst`]})]}),(0,Z.jsx)(S,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 px-1.5 text-destructive hover:text-destructive`,"aria-label":`Unload environment run`,onClick:()=>r.mutate({type:`unloadTemplateRun`,templateRunId:e.templateRunId}),children:(0,Z.jsx)(he,{className:`size-3`})})]})},e.templateRunId))})]})]})]})]})}function Un(){let{instances:e,models:t}=A(x(e=>({instances:e.instances,models:e.models}))),n=k(),[r,i]=(0,X.useState)(``),[a,o]=(0,X.useState)(``),[s,c]=(0,X.useState)(``),l=(0,X.useMemo)(()=>s?e.filter(e=>e.id.toLowerCase().includes(s.toLowerCase())):e,[e,s]),u=(0,X.useMemo)(()=>{let n=e.find(e=>e.id===r);return n?t.find(e=>e.name===n.model)?.faultNames??[]:[]},[r,e,t]),d=(0,X.useMemo)(()=>e.filter(e=>e.activeFaults.length>0),[e]),f=d.reduce((e,t)=>e+t.activeFaults.length,0);return(0,Z.jsxs)(I,{className:`h-full min-w-0`,children:[(0,Z.jsx)(P,{className:`pb-3`,children:(0,Z.jsxs)(F,{className:`flex items-center gap-2 text-xs font-medium uppercase tracking-wider`,children:[(0,Z.jsx)(Ge,{className:`size-3.5 ${f>0?`text-destructive`:`text-muted-foreground`}`}),`Fault Lab`,(0,Z.jsx)(b,{children:f>0&&(0,Z.jsx)(y.div,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},transition:{type:`spring`,stiffness:500,damping:30},children:(0,Z.jsxs)(j,{variant:`destructive`,className:`text-[10px]`,children:[f,` active`]})},`fault-count`)})]})}),(0,Z.jsxs)(L,{className:`flex flex-1 flex-col gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,Z.jsxs)($e,{value:r||null,onValueChange:e=>{i(e??``),o(``)},onInputValueChange:c,children:[(0,Z.jsx)(Qe,{placeholder:`Select instance`,className:`h-8 min-h-11 w-full min-w-0 touch-manipulation sm:min-h-8`,showClear:!!r}),(0,Z.jsx)(Ze,{children:(0,Z.jsxs)(N,{children:[l.map(e=>(0,Z.jsxs)(Xe,{value:e.id,children:[(0,Z.jsx)(`span`,{className:`font-mono`,children:e.id}),e.activeFaults.length>0&&(0,Z.jsx)(j,{variant:`destructive`,className:`ml-auto text-[10px]`,children:e.activeFaults.length})]},e.id)),l.length===0&&(0,Z.jsx)(`p`,{className:`py-2 text-center text-xs text-muted-foreground`,children:`No instances found`})]})})]}),(0,Z.jsxs)(we,{value:a,onValueChange:e=>o(e??``),children:[(0,Z.jsx)(Ce,{className:`h-8 min-h-11 w-full touch-manipulation sm:min-h-8`,"aria-label":`Fault type`,children:(0,Z.jsx)(ye,{placeholder:r?`Select fault`:`Pick instance first`})}),(0,Z.jsx)(Se,{alignItemWithTrigger:!1,align:`start`,children:u.map(e=>(0,Z.jsx)(be,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Z.jsx)(S,{variant:`destructive`,size:`sm`,className:`h-7 min-h-11 touch-manipulation text-xs sm:min-h-7`,disabled:!r||!a,onClick:()=>{let e=D(Le,{instanceId:r,fault:a});e&&n.mutate({type:`triggerFault`,...e})},children:`Trigger`}),(0,Z.jsx)(S,{variant:`secondary`,size:`sm`,className:`h-7 min-h-11 touch-manipulation text-xs sm:min-h-7`,disabled:!r||!a,onClick:()=>{let e=D(Le,{instanceId:r,fault:a});e&&n.mutate({type:`clearFault`,...e})},children:`Clear`})]}),(0,Z.jsx)(O,{}),(0,Z.jsx)(b,{mode:`wait`,initial:!1,children:d.length>0?(0,Z.jsxs)(y.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-[10px] font-medium uppercase tracking-wider text-muted-foreground`,children:`Faulted Instances`}),(0,Z.jsx)(b,{initial:!1,children:d.map(e=>(0,Z.jsx)(y.div,{initial:{opacity:0,x:-6},animate:{opacity:1,x:0},exit:{opacity:0,x:6,transition:{duration:.1}},transition:{type:`spring`,stiffness:400,damping:35},children:(0,Z.jsxs)(`button`,{type:`button`,className:`flex min-h-11 w-full touch-manipulation items-center justify-between rounded-[var(--miravo-radius-tight)] border border-destructive/20 bg-destructive/5 px-2.5 py-1.5 text-left transition-colors hover:bg-destructive/10 sm:min-h-0`,onClick:()=>{i(e.id),o(``)},children:[(0,Z.jsx)(`span`,{className:`truncate font-mono text-xs`,children:e.id}),(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-destructive`,children:e.activeFaults.join(`, `)})]})},e.id))})]},`faulted`):(0,Z.jsxs)(y.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:`flex items-center gap-2 py-1 text-xs text-muted-foreground`,children:[(0,Z.jsx)(E,{className:`size-3.5 text-success`}),`All clear — no active faults`]},`all-clear`)})]})]})}function Wn(){let e=A(e=>e.instances),t=k(),[n,r]=(0,X.useState)(``),[i,a]=(0,X.useState)(!1),[o,s]=(0,X.useState)(``),c=(0,X.useMemo)(()=>o?e.filter(e=>e.id.toLowerCase().includes(o.toLowerCase())):e,[e,o]),l=(0,X.useMemo)(()=>e.filter(e=>e.isQuarantined),[e]),u=(0,X.useMemo)(()=>e.filter(e=>!e.isQuarantined&&e.activeFaults.length===0).length,[e]),d=(0,X.useMemo)(()=>e.filter(e=>!e.isQuarantined&&e.activeFaults.length>0).length,[e]);return(0,Z.jsxs)(I,{className:`h-full min-w-0`,children:[(0,Z.jsx)(P,{className:`pb-3`,children:(0,Z.jsxs)(F,{className:`flex items-center gap-2 text-xs font-medium uppercase tracking-wider`,children:[(0,Z.jsx)(st,{className:`size-3.5 text-muted-foreground`}),`Instance Actions`]})}),(0,Z.jsxs)(L,{className:`flex flex-1 flex-col gap-4`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-[10px] font-medium uppercase tracking-wider text-muted-foreground`,children:`Remove Instance`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2 sm:flex-row sm:items-start`,children:[(0,Z.jsx)(`div`,{className:`min-w-0 w-full sm:min-w-0 sm:flex-1`,children:(0,Z.jsxs)($e,{value:n||null,onValueChange:e=>{r(e??``),a(!1)},onInputValueChange:s,children:[(0,Z.jsx)(Qe,{placeholder:`Select instance`,className:`h-8 w-full min-w-0`,showClear:!!n}),(0,Z.jsx)(Ze,{children:(0,Z.jsxs)(N,{children:[c.map(e=>(0,Z.jsx)(Xe,{value:e.id,children:(0,Z.jsx)(`span`,{className:`font-mono`,children:e.id})},e.id)),c.length===0&&(0,Z.jsx)(`p`,{className:`py-2 text-center text-xs text-muted-foreground`,children:`No instances found`})]})})]})}),i&&n?(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 sm:shrink-0`,children:[(0,Z.jsx)(`span`,{className:`text-[10px] text-destructive`,children:`Remove?`}),(0,Z.jsx)(S,{size:`sm`,variant:`destructive`,className:`h-7 text-xs`,onClick:()=>{t.mutate({type:`removeInstance`,instanceId:n}),a(!1),r(``)},children:`Confirm`}),(0,Z.jsx)(S,{size:`sm`,variant:`ghost`,className:`h-7 text-xs`,onClick:()=>a(!1),children:`Cancel`})]}):(0,Z.jsxs)(S,{className:`h-8 w-full shrink-0 gap-1.5 sm:w-auto`,variant:`destructive`,size:`sm`,disabled:!n,onClick:()=>{D(Fe,{instanceId:n})&&a(!0)},children:[(0,Z.jsx)(lt,{className:`size-3`}),`Remove`]})]})]}),(0,Z.jsx)(O,{}),(0,Z.jsx)(b,{mode:`wait`,initial:!1,children:l.length>0?(0,Z.jsxs)(y.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:`flex flex-col gap-2`,children:[(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[10px] font-medium uppercase tracking-wider text-warning`,children:[`Quarantined`,(0,Z.jsx)(j,{variant:`secondary`,className:`text-[10px] text-warning`,children:l.length})]}),(0,Z.jsx)(b,{initial:!1,children:l.map(e=>(0,Z.jsx)(y.div,{initial:{opacity:0,x:-6},animate:{opacity:1,x:0},exit:{opacity:0,transition:{duration:.1}},transition:{type:`spring`,stiffness:400,damping:35},children:(0,Z.jsxs)(`div`,{className:`flex items-center justify-between rounded-[var(--miravo-radius-tight)] border border-warning/20 bg-warning/5 px-2.5 py-1.5`,children:[(0,Z.jsx)(`span`,{className:`truncate font-mono text-xs`,children:e.id}),(0,Z.jsx)(S,{size:`sm`,variant:`outline`,className:`h-6 shrink-0 text-[10px]`,onClick:()=>t.mutate({type:`unquarantine`,instanceId:e.id}),children:`Unquarantine`})]})},e.id))})]},`quarantined`):(0,Z.jsxs)(y.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-[10px] font-medium uppercase tracking-wider text-muted-foreground`,children:`Fleet Health`}),(0,Z.jsx)(`div`,{className:`flex items-center gap-4 text-xs`,children:e.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`size-2 rounded-full bg-success`}),(0,Z.jsx)(`span`,{className:`font-mono tabular-nums`,children:u}),(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`healthy`})]}),d>0&&(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`size-2 rounded-full bg-warning`}),(0,Z.jsx)(`span`,{className:`font-mono tabular-nums`,children:d}),(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`faulted`})]}),(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(ct,{className:`size-3 text-success`}),(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`0 quarantined`})]})]}):(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`No instances running`})})]},`fleet-health`)})]})]})}function Gn(e){let t=Math.floor(e/1e3),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60;return n>0?`${n}h ${r}m`:r>0?`${r}m ${i}s`:`${i}s`}function Kn(e){if(!Number.isFinite(e)||e<=0)return`0s`;if(e<60)return`${e.toFixed(1)}s`;let t=Math.floor(e),n=Math.floor(t/86400),r=Math.floor(t%86400/3600),i=Math.floor(t%3600/60),a=t%60;return n>0?r>0?`${n}d ${r}h`:i>0?`${n}d ${i}m`:`${n}d`:r>0?`${r}h ${i}m`:i>0?`${i}m ${a}s`:`${a}s`}function qn({data:e}){let t=(0,X.useMemo)(()=>{if(e.length<2)return null;let t=e.map(e=>e.tps),n=Math.max(...t,.1),r=Math.min(...t,0),i=n-r||1;return{points:t.map((e,n)=>{let a=n/(t.length-1)*200,o=2+(1-(e-r)/i)*28;return`${n===0?`M`:`L`}${a.toFixed(1)},${o.toFixed(1)}`}).join(` `),min:r,max:n}},[e]);return t?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsxs)(`svg`,{viewBox:`0 0 200 32`,className:`h-8 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":`TPS trend sparkline`,children:[(0,Z.jsx)(`line`,{x1:`0`,y1:`10.7`,x2:`200`,y2:`10.7`,stroke:`currentColor`,strokeWidth:`0.5`,strokeDasharray:`3,2`,className:`text-border`}),(0,Z.jsx)(`line`,{x1:`0`,y1:`21.3`,x2:`200`,y2:`21.3`,stroke:`currentColor`,strokeWidth:`0.5`,strokeDasharray:`3,2`,className:`text-border`}),(0,Z.jsx)(`path`,{d:t.points,fill:`none`,stroke:`var(--primary)`,strokeWidth:`1.5`})]}),(0,Z.jsxs)(`div`,{className:`flex justify-between text-[9px] text-muted-foreground`,children:[(0,Z.jsxs)(`span`,{children:[`60s ago · `,t.min.toFixed(1)]}),(0,Z.jsxs)(`span`,{children:[t.max.toFixed(1),` · now`]})]})]}):(0,Z.jsx)(`div`,{className:`flex h-8 items-center text-[10px] text-muted-foreground`,children:`Collecting...`})}var Jn={running:`bg-success`,paused:`bg-warning`,idle:`bg-muted-foreground`,stopped:`bg-destructive`};function Yn({state:e}){let t=Jn[e]??`bg-muted-foreground`,n=e===`running`;return(0,Z.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,Z.jsxs)(`div`,{className:`relative flex items-center justify-center`,children:[(0,Z.jsx)(`span`,{className:`size-2.5 rounded-full ${t}`}),n&&(0,Z.jsx)(`span`,{className:`absolute size-2.5 animate-ping rounded-full ${t} opacity-40`})]}),(0,Z.jsx)(b,{mode:`wait`,initial:!1,children:(0,Z.jsx)(y.span,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},transition:{type:`spring`,stiffness:500,damping:30},className:`font-mono text-lg font-bold uppercase tracking-wider`,children:e},e)})]})}function $({label:e,tooltip:t,tooltipClassName:n}){return(0,Z.jsxs)(`div`,{className:`inline-flex w-fit min-w-0 max-w-full items-center gap-1`,children:[(0,Z.jsx)(`span`,{className:`blueprint-title min-w-0 shrink text-[11px] leading-tight text-muted-foreground`,children:e}),(0,Z.jsxs)(Je,{children:[(0,Z.jsx)(Ke,{className:`inline-flex size-4 shrink-0 items-center justify-center rounded-[var(--miravo-radius-tight)] border-0 bg-transparent p-0 text-muted-foreground shadow-none outline-none hover:text-foreground focus-visible:ring-1 focus-visible:ring-ring`,render:(0,Z.jsx)(`button`,{type:`button`}),"aria-label":`About ${e}`,children:(0,Z.jsx)(Re,{className:`size-3`,"aria-hidden":!0})}),(0,Z.jsx)(qe,{side:`top`,className:T(`max-w-xs`,n),children:t})]})]})}function Xn(){let{engineState:e,connectionState:t}=A(x(e=>({engineState:e.engineState,connectionState:e.connectionState}))),n=k();return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)($,{label:`Run state`,tooltip:(0,Z.jsx)(`p`,{className:`text-[11px] leading-snug`,children:`Whether the scheduler is running, paused, idle, or stopped. Pause freezes simulated time; resume continues from the same tick.`})}),(0,Z.jsx)(Yn,{state:e}),t===`live`&&(e===`running`||e===`paused`)&&(0,Z.jsx)(`div`,{className:`mt-1 flex items-center gap-2`,children:(0,Z.jsxs)(S,{type:`button`,size:`sm`,variant:e===`paused`?`default`:`outline`,className:T(`h-8 min-h-11 w-fit touch-manipulation gap-1.5 px-3 text-xs sm:min-h-8`,e===`running`&&`border-warning/40 bg-warning/10 text-warning hover:bg-warning/20 hover:text-warning focus-visible:border-warning/50 focus-visible:ring-warning/25 border-warning/35`),onClick:()=>n.mutate({type:e===`paused`?`resume`:`pause`}),children:[e===`paused`?(0,Z.jsx)(Ue,{className:`size-3`}):(0,Z.jsx)(rt,{className:`size-3`}),e===`paused`?`Resume`:`Pause`]})})]})}function Zn(){let{speedMultiplier:e,connectionState:t}=A(x(e=>({speedMultiplier:e.speedMultiplier,connectionState:e.connectionState}))),n=k(),[r,i]=(0,X.useState)(String(e)),a=t===`live`;return(0,X.useEffect)(()=>{i(String(e))},[e]),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)($,{label:`Speed`,tooltip:(0,Z.jsx)(`p`,{className:`text-[11px] leading-snug`,children:`Runs the environment at this multiple of real time. 1× is real time; higher values speed up the model. Change it with the field and Set.`})}),(0,Z.jsxs)(`span`,{className:`w-fit font-mono text-lg font-bold tabular-nums`,children:[e,`x`]}),(0,Z.jsxs)(`div`,{className:`mt-1 flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Z.jsx)(M,{htmlFor:`speed-multiplier`,className:`sr-only`,children:`Speed multiplier`}),(0,Z.jsx)(ge,{id:`speed-multiplier`,type:`number`,value:r,onChange:e=>i(e.target.value),className:`h-8 min-h-11 w-[4.75rem] touch-manipulation font-mono text-xs tabular-nums sm:min-h-8`,min:`1`,max:`1000`,disabled:!a}),(0,Z.jsx)(S,{type:`button`,size:`sm`,variant:`outline`,className:`h-8 min-h-11 touch-manipulation px-3 text-xs sm:min-h-8`,disabled:!a,onClick:()=>{let e=D(Ie,{multiplier:Number(r)});e&&n.mutate({type:`setSpeed`,multiplier:e.multiplier})},children:`Set`})]})]})}function Qn(){let{tick:e,simulationTime:t,tps:n,tpsHistory:r,uptimeMs:i,instanceCount:a,memberValueCount:o}=A(x(e=>({tick:e.tick,simulationTime:e.simulationTime,tps:e.tps,tpsHistory:e.tpsHistory,uptimeMs:e.uptimeMs,instanceCount:e.instanceCount,memberValueCount:e.memberValueCount})));return(0,Z.jsxs)(`div`,{className:T(We,`px-4 py-3`),children:[(0,Z.jsxs)(`header`,{className:`mb-3 border-b border-border/60 pb-2`,children:[(0,Z.jsx)(`h2`,{className:`font-heading text-sm font-semibold tracking-tight text-foreground`,children:`Engine vitals`}),(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:`Scheduler, speed, cycle count, and throughput for this session.`})]}),(0,Z.jsxs)(`div`,{className:`grid min-w-0 grid-cols-2 gap-3 @2xl/main:gap-4 @3xl/main:grid-cols-3 @5xl/main:grid-cols-6`,children:[(0,Z.jsx)(Xn,{}),(0,Z.jsx)(Zn,{}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)($,{label:`Cycle`,tooltipClassName:`flex flex-col items-start gap-2 text-left`,tooltip:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`text-[11px] leading-snug`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:`Cycle`}),` compares simulated progress with wall time: how many steps ran, how much model time advanced, and how long this session has been open.`]}),(0,Z.jsxs)(`p`,{className:`text-[11px] leading-snug`,children:[`The number is `,(0,Z.jsx)(`span`,{className:`font-medium`,children:`tick`}),` count — completed scheduler steps since this run. Each tick refreshes the plant model and live tags.`]}),(0,Z.jsxs)(`p`,{className:`text-[11px] leading-snug`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:`Sim`}),` is simulated elapsed time. Each tick adds (tick interval × speed) to this clock. Generators, lifecycle, and in-model timestamps use Sim, not your system clock. It stops advancing while paused.`]}),(0,Z.jsxs)(`p`,{className:`text-[11px] leading-snug`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:`Real`}),` is wall-clock uptime since the run started (real time).`]})]})}),(0,Z.jsx)(`span`,{className:`w-fit font-mono text-lg font-bold tabular-nums`,children:C(e)}),(0,Z.jsxs)(`div`,{className:`mt-1 flex w-full min-w-0 flex-col gap-0.5 leading-tight`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,Z.jsx)(`span`,{className:`w-10 shrink-0 text-[9px] font-semibold uppercase tracking-wide text-muted-foreground`,children:`Sim`}),(0,Z.jsx)(`span`,{className:`min-w-0 font-mono text-[10px] tabular-nums text-muted-foreground`,children:Kn(t)})]}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,Z.jsx)(`span`,{className:`w-10 shrink-0 text-[9px] font-semibold uppercase tracking-wide text-muted-foreground`,children:`Real`}),(0,Z.jsx)(`span`,{className:`min-w-0 font-mono text-[10px] tabular-nums text-muted-foreground`,children:Gn(i)})]})]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)($,{label:`Throughput`,tooltip:(0,Z.jsx)(`p`,{className:`text-[11px] leading-snug`,children:`Ticks per second: how fast the engine is stepping. Rises and falls with workload, speed setting, and CPU headroom.`})}),(0,Z.jsxs)(`span`,{className:`w-fit font-mono text-lg font-bold tabular-nums`,children:[n.toFixed(1),` tps`]}),(0,Z.jsxs)(`span`,{className:`mt-1 text-[10px] text-muted-foreground`,children:[a,` inst · `,pe(o),` tags`]})]}),(0,Z.jsxs)(`div`,{className:`col-span-2 flex flex-col gap-2`,children:[(0,Z.jsx)($,{label:`TPS Trend`,tooltip:(0,Z.jsx)(`p`,{className:`text-[11px] leading-snug`,children:`Recent ticks-per-second samples over about the last minute. Flat or noisy lines usually mean load or speed changes.`})}),(0,Z.jsx)(qn,{data:r})]})]})]})}var $n=[`MQTT Sparkplug B`,`EtherNet/IP`,`Siemens S7`];function er({enabled:e,total:t}){let n=t===0?`empty`:e===0?`idle`:`live`;return(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 rounded-[var(--miravo-radius-pill)] border border-border/60 bg-background/60 px-2.5 py-1 backdrop-blur-sm`,children:[(0,Z.jsxs)(`span`,{className:`relative flex size-1.5 items-center justify-center`,children:[(0,Z.jsx)(`span`,{className:T(`size-1.5 rounded-full`,n===`live`?`bg-success shadow-[0_0_0_1px_color-mix(in_srgb,var(--success)_50%,transparent),0_0_12px_color-mix(in_srgb,var(--success)_42%,transparent)]`:n===`idle`?`bg-warning/85 shadow-[0_0_0_1px_color-mix(in_srgb,var(--warning)_50%,transparent),0_0_12px_color-mix(in_srgb,var(--warning)_38%,transparent)]`:`bg-muted-foreground/55`)}),n===`live`&&(0,Z.jsx)(`span`,{className:`absolute inset-0 animate-ping rounded-full bg-success/60`})]}),(0,Z.jsxs)(`span`,{className:`text-[11px] leading-none text-muted-foreground`,children:[(0,Z.jsx)(`span`,{className:`font-mono font-semibold tabular-nums text-foreground`,children:e}),(0,Z.jsx)(`span`,{className:`mx-1 text-muted-foreground/60`,children:`/`}),(0,Z.jsx)(`span`,{className:`font-mono tabular-nums`,children:t}),(0,Z.jsx)(`span`,{className:`ml-1.5 text-[10px] uppercase tracking-[0.14em]`,children:`active`})]})]})}function tr(){let{availableAdapters:e,adapterMetrics:t}=A(x(e=>({availableAdapters:e.availableAdapters,adapterMetrics:e.adapterMetrics}))),n=e.filter(e=>e.enabled).length;return(0,Z.jsxs)(`section`,{className:T(We,`flex min-w-0 flex-col hover:border-border`),children:[(0,Z.jsxs)(`header`,{className:`flex flex-wrap items-start justify-between gap-3 border-b border-border/60 px-4 py-3`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,Z.jsx)(`div`,{className:`mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-[var(--miravo-radius-tight)] border border-border/60 bg-background/70 text-muted-foreground`,"aria-hidden":!0,children:(0,Z.jsx)(ot,{className:`size-3.5`})}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`h3`,{className:`font-heading text-sm font-semibold tracking-tight text-foreground`,children:`Protocol Gateway`}),(0,Z.jsx)(`p`,{className:`mt-0.5 text-pretty text-xs text-muted-foreground`,children:`Northbound adapters publishing engine telemetry to external systems.`})]})]}),(0,Z.jsx)(er,{enabled:n,total:e.length})]}),e.length>0&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-2 px-4 py-4`,children:(0,Z.jsx)(b,{children:e.map((e,n)=>{let r=t.find(t=>t.name===e.name)?.metrics;return(0,Z.jsx)(y.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0},transition:{type:`spring`,stiffness:380,damping:30,delay:n*.05},children:(0,Z.jsx)(Vn,{adapter:e,metrics:r})},e.name)})})}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-3 gap-y-2 border-t border-border/60 bg-background/40 px-4 py-2.5`,role:`status`,"aria-label":`Upcoming protocol adapters: ${$n.join(`, `)}, and more`,children:[(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,Z.jsx)(Be,{className:`size-3 text-muted-foreground/70`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`text-[10px] font-medium uppercase tracking-[0.14em] text-muted-foreground`,children:`Roadmap`})]}),(0,Z.jsxs)(`ul`,{className:`flex min-w-0 flex-wrap items-center gap-1.5`,children:[$n.map(e=>(0,Z.jsx)(`li`,{className:`rounded-[var(--miravo-radius-tight)] border border-dashed border-border/70 bg-background/40 px-2 py-0.5 font-mono text-[10px] leading-[15px] tracking-tight text-muted-foreground`,children:e},e)),(0,Z.jsx)(`li`,{className:`font-mono text-[10px] leading-[15px] tracking-tight text-muted-foreground/75`,children:`+ more`})]})]})]})}function nr(){let e=A(e=>e.instances),t=k(),[n,r]=(0,X.useState)(!1),[i,a]=(0,X.useState)(!1),[o,s]=(0,X.useState)(!1);return(0,Z.jsxs)(`div`,{className:`flex h-full min-w-0 flex-col`,children:[(0,Z.jsxs)(I,{className:`h-full min-w-0`,children:[(0,Z.jsx)(P,{className:`pb-3`,children:(0,Z.jsxs)(F,{className:`flex items-center gap-2 text-xs font-medium uppercase tracking-wider`,children:[(0,Z.jsx)(nt,{className:`size-3.5 text-muted-foreground`,"aria-hidden":!0}),`Danger Zone`]})}),(0,Z.jsx)(L,{className:`flex flex-1 flex-col`,children:(0,Z.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-3 rounded-[var(--miravo-radius-stadium-sm)] border border-dashed border-border p-3 @2xl/main:flex-row @2xl/main:items-center @2xl/main:justify-between`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 space-y-0.5`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:`Reset environment`}),(0,Z.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Removes `,e.length,` running instance`,e.length===1?``:`s`,` and all loaded environments.`]})]}),(0,Z.jsx)(S,{className:`min-h-11 w-full shrink-0 touch-manipulation @2xl/main:w-auto sm:min-h-7`,variant:`destructive`,size:`sm`,onClick:()=>r(!0),children:`Reset`})]})})]}),(0,Z.jsx)(ce,{open:n,onOpenChange:e=>{r(e),e||a(!1)},children:(0,Z.jsxs)(ue,{children:[(0,Z.jsxs)(le,{children:[(0,Z.jsx)(de,{children:`Reset Environment`}),(0,Z.jsx)(se,{children:`Removes all running instances and loaded environments.`})]}),(0,Z.jsx)(`div`,{className:`space-y-3 text-sm`,children:(0,Z.jsx)(`div`,{className:`rounded-[var(--miravo-radius-stadium-sm)] border p-3`,children:(0,Z.jsxs)(M,{htmlFor:`clear-persisted-state`,className:`items-start`,children:[(0,Z.jsx)(Ve,{id:`clear-persisted-state`,checked:i,onCheckedChange:e=>a(e===!0)}),(0,Z.jsxs)(`span`,{className:`space-y-1`,children:[(0,Z.jsx)(`span`,{className:`block font-medium text-foreground`,children:`Also clear persisted state`}),(0,Z.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:`Start empty on the next restart.`})]})]})})}),(0,Z.jsxs)(oe,{children:[(0,Z.jsx)(S,{variant:`outline`,className:`min-h-11 w-full touch-manipulation sm:min-h-8 sm:w-auto`,onClick:()=>{r(!1),a(!1)},disabled:o,children:`Cancel`}),(0,Z.jsx)(S,{variant:`destructive`,className:`min-h-11 w-full touch-manipulation sm:min-h-8 sm:w-auto`,disabled:o,onClick:async()=>{s(!0);try{await t.mutateAsync({type:`resetEnvironment`,...i?{clearPersistence:!0}:{}}),r(!1),a(!1)}catch{}finally{s(!1)}},children:o?`Resetting...`:`Confirm Reset`})]})]})})]})}function rr(){let[e,t]=ie(`tab`,ae([`monitor`,`operate`]).withDefault(`monitor`));return(0,Z.jsxs)(`div`,{className:`mx-auto flex w-full min-w-0 max-w-screen-2xl flex-col gap-5 p-4 sm:gap-6 sm:p-6`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`h1`,{className:`font-heading text-2xl font-semibold tracking-tight`,children:`Mission Control`}),(0,Z.jsxs)(j,{variant:`outline`,title:`Miravo version ${d}`,className:`font-mono text-[10px] leading-none text-muted-foreground`,children:[`v`,d]})]}),(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Engine telemetry, protocol management, and fleet operations.`})]}),(0,Z.jsxs)(je,{value:e,onValueChange:e=>{t(e)},className:`min-h-0 flex-1`,children:[(0,Z.jsx)(`div`,{className:`shrink-0 overflow-x-auto`,children:(0,Z.jsxs)(ke,{variant:`line`,className:`h-10! min-w-max gap-0.5`,children:[(0,Z.jsxs)(Ee,{value:`monitor`,className:`gap-1.5 px-3 text-sm`,children:[(0,Z.jsx)(Pe,{className:`size-3.5 shrink-0`}),`Monitor`]}),(0,Z.jsxs)(Ee,{value:`operate`,className:`gap-1.5 px-3 text-sm`,children:[(0,Z.jsx)(Me,{className:`size-3.5 shrink-0`}),`Operate`]})]})}),(0,Z.jsx)(De,{value:`monitor`,className:`flex-1 py-2`,children:(0,Z.jsxs)(y.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.15,ease:`easeOut`},className:`flex flex-col gap-5 sm:gap-6`,children:[(0,Z.jsx)(Qn,{}),(0,Z.jsx)(tr,{})]},`monitor`)}),(0,Z.jsx)(De,{value:`operate`,className:`flex-1 py-2`,children:(0,Z.jsxs)(y.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.15,ease:`easeOut`},className:`grid min-h-0 min-w-0 grid-cols-1 items-stretch gap-5 @2xl/main:grid-cols-2 @2xl/main:gap-4`,children:[(0,Z.jsx)(Hn,{}),(0,Z.jsx)(Wn,{}),(0,Z.jsx)(Un,{}),(0,Z.jsx)(nr,{})]},`operate`)})]})]})}export{ot as n,rr as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./control-4ugKUt8n.js";export{e as ControlPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./events-BP1rvN5g.js";export{e as EventsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./fleet-ne7gllQE.js";export{e as FleetPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./models-C_UOiHSF.js";export{e as ModelsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./platforms-CmsbDw-2.js";export{e as PlatformsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./tags-DORoU260.js";export{e as TagsPage};
|