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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/console-dist/assets/{api-B8Cqrm2G.js → api-DimikzPd.js} +1 -1
  2. package/console-dist/assets/catalog-8tLjGq7E.js +1 -0
  3. package/console-dist/assets/{catalog-C4iFSXl0.js → catalog-CbdG58Mn.js} +1 -1
  4. package/console-dist/assets/{catalog-source-B_3_Upeh.js → catalog-source-C4jQdH37.js} +1 -1
  5. package/console-dist/assets/{control-CvQvIf00.js → control-4ugKUt8n.js} +1 -1
  6. package/console-dist/assets/control-BVr4X_wI.js +1 -0
  7. package/console-dist/assets/{events-BZaBqF9J.js → events-BP1rvN5g.js} +1 -1
  8. package/console-dist/assets/events-BcZCvJ63.js +1 -0
  9. package/console-dist/assets/{fleet-efugggyV.js → fleet-ne7gllQE.js} +1 -1
  10. package/console-dist/assets/fleet-nhb_0n25.js +1 -0
  11. package/console-dist/assets/{index-DWUbVyod.js → index-Ds1n4iXS.js} +3 -3
  12. package/console-dist/assets/{instance-detail-CmF_Rznd.js → instance-detail-k6fWu2DS.js} +1 -1
  13. package/console-dist/assets/{login-KqoOCjoH.js → login-BmyMgUK4.js} +1 -1
  14. package/console-dist/assets/{models-Dn9__adB.js → models-C_UOiHSF.js} +1 -1
  15. package/console-dist/assets/models-DiO_AS9_.js +1 -0
  16. package/console-dist/assets/{platforms-B52boh2S.js → platforms-CmsbDw-2.js} +1 -1
  17. package/console-dist/assets/platforms-npS30Kgk.js +1 -0
  18. package/console-dist/assets/{query-fetch-error-B6y_Rlj9.js → query-fetch-error-Bcg_UjHM.js} +1 -1
  19. package/console-dist/assets/{route-preload-BOrx0jh2.js → route-preload-BO6weHRR.js} +2 -2
  20. package/console-dist/assets/{tags-C6UILCQv.js → tags-DORoU260.js} +1 -1
  21. package/console-dist/assets/tags-nwfbo5cT.js +1 -0
  22. package/console-dist/assets/{transition-nav-link-LpMCFklr.js → transition-nav-link-nVD3H66a.js} +1 -1
  23. package/console-dist/assets/{use-engine-command-mutation-dw_B-1qa.js → use-engine-command-mutation-C8S_hX0O.js} +1 -1
  24. package/console-dist/assets/{use-platform-stream-DAr3QTPE.js → use-platform-stream-CZLW085n.js} +1 -1
  25. package/console-dist/assets/{use-transition-navigate-Fgz_LNAd.js → use-transition-navigate-jMR-y4bs.js} +1 -1
  26. package/console-dist/assets/{validation-eLNuMo9E.js → validation-DLydiTzj.js} +1 -1
  27. package/console-dist/index.html +17 -17
  28. package/miravo +0 -0
  29. package/package.json +1 -1
  30. package/console-dist/assets/catalog-CvtaOpMA.js +0 -1
  31. package/console-dist/assets/control-DL1KRHz-.js +0 -1
  32. package/console-dist/assets/events-BdFbWiaW.js +0 -1
  33. package/console-dist/assets/fleet-B7pD7lbL.js +0 -1
  34. package/console-dist/assets/models-IiGAU-LZ.js +0 -1
  35. package/console-dist/assets/platforms-CleAbZI5.js +0 -1
  36. package/console-dist/assets/tags-CFcLbtJE.js +0 -1
@@ -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-B8Cqrm2G.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-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(`
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-BOrx0jh2.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
+ 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-BO6weHRR.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-B8Cqrm2G.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};
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-DimikzPd.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};
@@ -21,15 +21,15 @@
21
21
  }
22
22
  </style>
23
23
  <title>Miravo</title>
24
- <script type="module" crossorigin src="/assets/index-DWUbVyod.js"></script>
24
+ <script type="module" crossorigin src="/assets/index-Ds1n4iXS.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-B8Cqrm2G.js">
28
+ <link rel="modulepreload" crossorigin href="/assets/api-DimikzPd.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-B6y_Rlj9.js">
32
+ <link rel="modulepreload" crossorigin href="/assets/query-fetch-error-Bcg_UjHM.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-DAr3QTPE.js">
47
+ <link rel="modulepreload" crossorigin href="/assets/use-platform-stream-CZLW085n.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-B52boh2S.js">
53
+ <link rel="modulepreload" crossorigin href="/assets/platforms-CmsbDw-2.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-C6UILCQv.js">
61
- <link rel="modulepreload" crossorigin href="/assets/catalog-source-B_3_Upeh.js">
60
+ <link rel="modulepreload" crossorigin href="/assets/tags-DORoU260.js">
61
+ <link rel="modulepreload" crossorigin href="/assets/catalog-source-C4jQdH37.js">
62
62
  <link rel="modulepreload" crossorigin href="/assets/runtime-link-PMxeHxd6.js">
63
- <link rel="modulepreload" crossorigin href="/assets/use-engine-command-mutation-dw_B-1qa.js">
64
- <link rel="modulepreload" crossorigin href="/assets/models-Dn9__adB.js">
65
- <link rel="modulepreload" crossorigin href="/assets/validation-eLNuMo9E.js">
63
+ <link rel="modulepreload" crossorigin href="/assets/use-engine-command-mutation-C8S_hX0O.js">
64
+ <link rel="modulepreload" crossorigin href="/assets/models-C_UOiHSF.js">
65
+ <link rel="modulepreload" crossorigin href="/assets/validation-DLydiTzj.js">
66
66
  <link rel="modulepreload" crossorigin href="/assets/shallow-Cin0mLuv.js">
67
- <link rel="modulepreload" crossorigin href="/assets/route-preload-BOrx0jh2.js">
68
- <link rel="modulepreload" crossorigin href="/assets/use-transition-navigate-Fgz_LNAd.js">
69
- <link rel="modulepreload" crossorigin href="/assets/transition-nav-link-LpMCFklr.js">
70
- <link rel="modulepreload" crossorigin href="/assets/control-CvQvIf00.js">
71
- <link rel="modulepreload" crossorigin href="/assets/catalog-C4iFSXl0.js">
67
+ <link rel="modulepreload" crossorigin href="/assets/route-preload-BO6weHRR.js">
68
+ <link rel="modulepreload" crossorigin href="/assets/use-transition-navigate-jMR-y4bs.js">
69
+ <link rel="modulepreload" crossorigin href="/assets/transition-nav-link-nVD3H66a.js">
70
+ <link rel="modulepreload" crossorigin href="/assets/control-4ugKUt8n.js">
71
+ <link rel="modulepreload" crossorigin href="/assets/catalog-CbdG58Mn.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-efugggyV.js">
75
- <link rel="modulepreload" crossorigin href="/assets/events-BZaBqF9J.js">
74
+ <link rel="modulepreload" crossorigin href="/assets/fleet-ne7gllQE.js">
75
+ <link rel="modulepreload" crossorigin href="/assets/events-BP1rvN5g.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,6 +1,6 @@
1
1
  {
2
2
  "name": "@miravo/cli-linux-arm64-musl",
3
- "version": "0.7.3",
3
+ "version": "0.7.4",
4
4
  "description": "Miravo platform binary for linux-arm64-musl.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -1 +0,0 @@
1
- import{t as e}from"./catalog-C4iFSXl0.js";export{e as CatalogPage};
@@ -1 +0,0 @@
1
- import{t as e}from"./control-CvQvIf00.js";export{e as ControlPage};
@@ -1 +0,0 @@
1
- import{t as e}from"./events-BZaBqF9J.js";export{e as EventsPage};
@@ -1 +0,0 @@
1
- import{t as e}from"./fleet-efugggyV.js";export{e as FleetPage};
@@ -1 +0,0 @@
1
- import{t as e}from"./models-Dn9__adB.js";export{e as ModelsPage};
@@ -1 +0,0 @@
1
- import{t as e}from"./platforms-B52boh2S.js";export{e as PlatformsPage};
@@ -1 +0,0 @@
1
- import{t as e}from"./tags-C6UILCQv.js";export{e as TagsPage};