@miravo/cli-linux-arm64-musl 0.9.0 → 0.11.0

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 (142) hide show
  1. package/console-dist/assets/{AnimatePresence-CPmH1DMY.js → AnimatePresence-BSSlw02V.js} +1 -1
  2. package/console-dist/assets/api-B2QJEzbS.js +1 -0
  3. package/console-dist/assets/api-Vq4lny_H.js +1 -0
  4. package/console-dist/assets/arrow-up-right-CwPw_2U1.js +1 -0
  5. package/console-dist/assets/asset-detail-E-TllNHT.js +1 -0
  6. package/console-dist/assets/asset-detail-actions-jjbvaDES.js +1 -0
  7. package/console-dist/assets/asset-panel-DDziFlFl.js +1 -0
  8. package/console-dist/assets/{auth-screen-backdrop-CgwRhIbi.js → auth-screen-backdrop-CEykEbfF.js} +1 -1
  9. package/console-dist/assets/backup-power-BDMAO2bO.js +1 -0
  10. package/console-dist/assets/{badge-DuuEINVl.js → badge-Bk1DaL6C.js} +1 -1
  11. package/console-dist/assets/boiler-CWAR1Nq2.js +1 -0
  12. package/console-dist/assets/by-path-VBqTBdlG.js +1 -0
  13. package/console-dist/assets/catalog-BlkPPAWE.js +1 -0
  14. package/console-dist/assets/catalog-CQopEu5C.js +1 -0
  15. package/console-dist/assets/catalog-source-B4L5N-a1.js +1 -0
  16. package/console-dist/assets/catalog-template-icons-BOSywIKV.js +1 -0
  17. package/console-dist/assets/check-B-yvIfMj.js +1 -0
  18. package/console-dist/assets/checkbox-DEAkDfFr.js +1 -0
  19. package/console-dist/assets/chevron-down-x70Pto6j.js +1 -0
  20. package/console-dist/assets/chevron-left-XHFooLn1.js +1 -0
  21. package/console-dist/assets/chevron-right-CMSQPSEo.js +1 -0
  22. package/console-dist/assets/chiller-BSx8eUMN.js +1 -0
  23. package/console-dist/assets/circle-x-_o0nl0Rg.js +1 -0
  24. package/console-dist/assets/combobox-B8h0-NHs.js +1 -0
  25. package/console-dist/assets/commercial-building-CNvi6IZK.js +1 -0
  26. package/console-dist/assets/compressor-D63w6Ir2.js +1 -0
  27. package/console-dist/assets/console-panel-CMDoBJiO.js +1 -0
  28. package/console-dist/assets/control-CBviLxJB.js +1 -0
  29. package/console-dist/assets/control-jNqzZWa9.js +1 -0
  30. package/console-dist/assets/copy-button-CSUP1VjU.js +1 -0
  31. package/console-dist/assets/dialog-B5PqrKVw.js +1 -0
  32. package/console-dist/assets/district-heating-Cr4CrgCA.js +1 -0
  33. package/console-dist/assets/dom-Cm_OH5jc.js +1 -0
  34. package/console-dist/assets/dropdown-menu-B_MMNbTy.js +1 -0
  35. package/console-dist/assets/events-D531_1EZ.js +1 -0
  36. package/console-dist/assets/events-RmbRTKFV.js +1 -0
  37. package/console-dist/assets/events-format-C5HTkIsC.js +1 -0
  38. package/console-dist/assets/export-tab-fZDO4r2u.js +1 -0
  39. package/console-dist/assets/factory-C2OucdpQ.js +1 -0
  40. package/console-dist/assets/factory-CgSIjU5V.js +1 -0
  41. package/console-dist/assets/factory-DLE12zAd.js +1 -0
  42. package/console-dist/assets/floor-page-D0mX5OuA.js +1 -0
  43. package/console-dist/assets/floor-page-E-0txA4z.css +1 -0
  44. package/console-dist/assets/format-Bx7DF-TB.js +1 -0
  45. package/console-dist/assets/genset-BRgqR1AT.js +1 -0
  46. package/console-dist/assets/{get-error-message-BowDodwy.js → get-error-message-dM0BMfdP.js} +1 -1
  47. package/console-dist/assets/index-CrLa65Ur.css +2 -0
  48. package/console-dist/assets/index-CvuwOe37.js +12 -0
  49. package/console-dist/assets/integration-api-D2tA69Yb.js +2 -0
  50. package/console-dist/assets/integration-targets-Byvdd3Or.js +1 -0
  51. package/console-dist/assets/integrations-BLG4PT3c.js +1 -0
  52. package/console-dist/assets/integrations-iAjWxaDS.js +1 -0
  53. package/console-dist/assets/{label-DTHSKF2S.js → label-2sIXTEUK.js} +1 -1
  54. package/console-dist/assets/loader-circle-DjgHgHHl.js +1 -0
  55. package/console-dist/assets/{login-O9dnrHI9.js → login-DpNKicxy.js} +1 -1
  56. package/console-dist/assets/minus-CaT9UaQx.js +1 -0
  57. package/console-dist/assets/model-schemas-3w38IPdc.js +1 -0
  58. package/console-dist/assets/models-CMN9Eppf.js +1 -0
  59. package/console-dist/assets/models-I_V8J5Y0.js +1 -0
  60. package/console-dist/assets/not-found-C4YVKP97.js +1 -0
  61. package/console-dist/assets/pause-CqW7v5Dc.js +1 -0
  62. package/console-dist/assets/pharma-cleanroom-ClJRwROz.js +1 -0
  63. package/console-dist/assets/play-kg50os4l.js +1 -0
  64. package/console-dist/assets/plus-Cl4Ay5Ry.js +1 -0
  65. package/console-dist/assets/protocol-card-ARSwIjkN.js +1 -0
  66. package/console-dist/assets/{proxy-Be4WzmcS.js → proxy-CWZabK8f.js} +1 -1
  67. package/console-dist/assets/query-fetch-error-CWLZA2L5.js +1 -0
  68. package/console-dist/assets/radio-BxpVYiyS.js +1 -0
  69. package/console-dist/assets/registry-Dau_GjK6.js +2 -0
  70. package/console-dist/assets/rocket-KZ5oHK1G.js +1 -0
  71. package/console-dist/assets/rtu-D-1lltcO.js +1 -0
  72. package/console-dist/assets/select-BWlrSYlA.js +1 -0
  73. package/console-dist/assets/{select-display-items-BEVMAho-.js → select-display-items-DN2G8DNG.js} +1 -1
  74. package/console-dist/assets/server-BVem_egD.js +1 -0
  75. package/console-dist/assets/sliders-horizontal-BNKmYQgd.js +1 -0
  76. package/console-dist/assets/smart-factory-cem4tLAv.js +1 -0
  77. package/console-dist/assets/source-host-miravo-B8eM2IHw.js +1 -0
  78. package/console-dist/assets/stages-hidkaJPI.js +1 -0
  79. package/console-dist/assets/status-CZFZLqVk.js +1 -0
  80. package/console-dist/assets/tabs-BbQkzBZZ.js +1 -0
  81. package/console-dist/assets/tags-BBz30-eV.js +4 -0
  82. package/console-dist/assets/tags-K96jT8PY.js +1 -0
  83. package/console-dist/assets/tank-THHXGdzg.js +1 -0
  84. package/console-dist/assets/{tooltip-D1ydB4g3.js → tooltip-B3vOB1Vu.js} +1 -1
  85. package/console-dist/assets/{transition-nav-link-Crj9XTbK.js → transition-nav-link-B11-gXld.js} +1 -1
  86. package/console-dist/assets/trash-2-BH9HDsZv.js +1 -0
  87. package/console-dist/assets/use-engine-command-mutation-CHqjOqfS.js +1 -0
  88. package/console-dist/assets/use-transition-navigate-B-nk4aWh.js +2 -0
  89. package/console-dist/assets/useQuery-M9KTdi7Q.js +1 -0
  90. package/console-dist/assets/validation-BkfmaBBi.js +1 -0
  91. package/console-dist/assets/vendor-ui-D8j69UH4.js +1 -0
  92. package/console-dist/assets/water-treatment-CfVR0p0L.js +1 -0
  93. package/console-dist/index.html +65 -46
  94. package/miravo +2 -2
  95. package/package.json +1 -1
  96. package/console-dist/assets/api-0DOQsu1W.js +0 -1
  97. package/console-dist/assets/api-DdyA1QMC.js +0 -1
  98. package/console-dist/assets/arrow-right-BjBb4z7g.js +0 -1
  99. package/console-dist/assets/arrow-up-down-C1oJAmrw.js +0 -1
  100. package/console-dist/assets/asset-detail-D-coMgED.js +0 -1
  101. package/console-dist/assets/catalog-Ca9rhNLN.js +0 -1
  102. package/console-dist/assets/catalog-CdbAE0Ki.js +0 -1
  103. package/console-dist/assets/catalog-source-CPFWtBJF.js +0 -1
  104. package/console-dist/assets/catalog-template-icons-aec8m5-A.js +0 -1
  105. package/console-dist/assets/checkbox-BL44aFel.js +0 -1
  106. package/console-dist/assets/circle-question-mark-CJvcT6V6.js +0 -1
  107. package/console-dist/assets/combobox-B5iFVe7N.js +0 -1
  108. package/console-dist/assets/control-CtvncuAA.js +0 -1
  109. package/console-dist/assets/control-DYdEZmP0.js +0 -1
  110. package/console-dist/assets/copy-button-RVCJ3aqM.js +0 -1
  111. package/console-dist/assets/dropdown-menu-82O7jPU6.js +0 -1
  112. package/console-dist/assets/events-Bp3BqWYo.js +0 -1
  113. package/console-dist/assets/events-D5uZ2cwr.js +0 -1
  114. package/console-dist/assets/fleet-CBXZ0Xts.js +0 -1
  115. package/console-dist/assets/fleet-CRB8-QDg.js +0 -1
  116. package/console-dist/assets/format-6q8Tnwmn.js +0 -1
  117. package/console-dist/assets/index-BPmjm3uU.css +0 -2
  118. package/console-dist/assets/index-Chh5Cd8X.js +0 -12
  119. package/console-dist/assets/integration-targets-ChYQ8POe.js +0 -1
  120. package/console-dist/assets/integrations-BrZWbG5Q.js +0 -1
  121. package/console-dist/assets/integrations-D4x6ee5M.js +0 -1
  122. package/console-dist/assets/layers-1figUpjG.js +0 -1
  123. package/console-dist/assets/models-BDeOqKQk.js +0 -1
  124. package/console-dist/assets/models-CgWCVmnx.js +0 -1
  125. package/console-dist/assets/not-found-Dw4OTZHH.js +0 -1
  126. package/console-dist/assets/query-fetch-error-ytmF7SP9.js +0 -1
  127. package/console-dist/assets/select-Cg2u0NQI.js +0 -1
  128. package/console-dist/assets/shallow-Cin0mLuv.js +0 -1
  129. package/console-dist/assets/spawn-protocol-scope-picker-DDi-hZwj.js +0 -1
  130. package/console-dist/assets/tabs-BJs5Kci7.js +0 -1
  131. package/console-dist/assets/tags-CcmWc8Xj.js +0 -1
  132. package/console-dist/assets/tags-DnyhyxDB.js +0 -4
  133. package/console-dist/assets/use-engine-command-mutation-OZ8_Roso.js +0 -1
  134. package/console-dist/assets/use-integration-stream-CFkuEB9r.js +0 -2
  135. package/console-dist/assets/use-transition-navigate-BBXUEW59.js +0 -2
  136. package/console-dist/assets/validation-BvXCKp12.js +0 -1
  137. package/console-dist/assets/vendor-ui-CWUk2ulb.js +0 -1
  138. /package/console-dist/assets/{download-DmUZKo9N.js → download-i8CTJ7oi.js} +0 -0
  139. /package/console-dist/assets/{runtime-link-D-uJbw97.js → runtime-link-vBANRqcD.js} +0 -0
  140. /package/console-dist/assets/{transition-types-CPlGtM8w.js → transition-types-BKZuWApE.js} +0 -0
  141. /package/console-dist/assets/{triangle-alert-BXrJNk3g.js → triangle-alert-DoAwrRgk.js} +0 -0
  142. /package/console-dist/assets/{vendor-table-BAHQgdwg.js → vendor-table-B0Z9e_sn.js} +0 -0
@@ -1,2 +0,0 @@
1
- import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{at as n}from"./vendor-ui-CWUk2ulb.js";import{C as r,M as i,S as a,T as o,W as s,f as c,m as l,p as u,t as d,v as f,w as ee,z as p}from"./api-DdyA1QMC.js";import{s as m}from"./query-fetch-error-ytmF7SP9.js";import{t as h,u as g}from"./proxy-Be4WzmcS.js";import{t as _}from"./AnimatePresence-CPmH1DMY.js";import{a as te,i as ne,l as v,n as re,o as y,r as ie,s as ae,t as b}from"./copy-button-RVCJ3aqM.js";import{C as x,E as S,S as C,T as w}from"./format-6q8Tnwmn.js";import{n as T,t as E}from"./utils-XFKvwlFT.js";import{a as D,c as O,i as k,l as A,n as j,o as M,r as N,s as oe,t as P}from"./select-Cg2u0NQI.js";import{i as F,n as se,r as I,t as L}from"./integration-targets-ChYQ8POe.js";import{a as R,c as z,o as B,s as V}from"./tabs-BJs5Kci7.js";import{t as H}from"./circle-question-mark-CJvcT6V6.js";import{i as U,n as W,r as ce,t as le}from"./checkbox-BL44aFel.js";import{t as ue}from"./triangle-alert-BXrJNk3g.js";import{i as G,n as de,t as fe}from"./tooltip-D1ydB4g3.js";import{t as pe}from"./badge-DuuEINVl.js";import{t as K}from"./label-DTHSKF2S.js";import{n as me,t as he}from"./get-error-message-BowDodwy.js";var ge=T(`ban`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M4.929 4.929 19.07 19.071`,key:`196cmz`}]]),_e=T(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),ve=T(`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`}]]),ye=T(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),be=T(`clipboard-list`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`M12 11h4`,key:`1jrz19`}],[`path`,{d:`M12 16h4`,key:`n85exb`}],[`path`,{d:`M8 11h.01`,key:`1dfujw`}],[`path`,{d:`M8 16h.01`,key:`18s6g9`}]]),xe=T(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),Se=T(`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`}]]),Ce=T(`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`}]]),we=T(`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`}]]),Te=T(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Ee=T(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),De=T(`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`}]]),q=e(t(),1),J=n();function Y({className:e,...t}){return(0,J.jsx)(`div`,{"data-slot":`skeleton`,className:E(`animate-pulse rounded-[var(--miravo-radius-tight)] bg-muted`,e),...t})}var Oe=[`devices`,`models`,`assets`],ke=[`assets`,`models`,`devices`],Ae={label:`Alias policy`,value:`Miravo hyphens, LE underscores`},je=[{label:`Protocol`,value:`Template defaults`},Ae],Me={devices:`DeviceHub devices`,models:`Digital Twins models`,assets:`Digital Twins instances`},Ne={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 integration.`,cleanup:`Remove Digital Twins model definitions created by Miravo.`},assets:{apply:`Digital Twins instances bound to DeviceHub devices.`,cleanup:`Remove Digital Twins instances deployed for this target.`}},Pe=`Miravo calls this API.`;function Fe(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).`}function Ie(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. env-a or line-1).`}function Le(e){let t=e?.trim().toLowerCase();if(t)return i(t)}var Re={assets:`models`};function ze(e,t){let n=new Set(e);if(n.has(t)){n.delete(t);for(let[e,r]of Object.entries(Re))r===t&&n.delete(e)}else{n.add(t);let e=Re[t];e&&n.add(e)}return n}var Be=[{value:`fail`,title:`Fail if unmanaged exists`,hint:`Stop if the target has unmanaged resources.`},{value:`skip`,title:`Skip unmanaged resources`,hint:`Only update resources managed by Miravo.`}];function Ve({open:e,onOpenChange:t,isApply:n,scopeOptions:r,scope:i,onToggleScope:a,ifUnmanaged:o,onIfUnmanagedChange:s}){let c=(0,q.useId)(),l=`if-unmanaged-${c}`;return(0,J.jsxs)(J.Fragment,{children:[(0,J.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:()=>t(!e),"aria-expanded":e,children:[`Advanced`,(0,J.jsx)(A,{className:E(`size-3.5 shrink-0 text-muted-foreground transition-transform ease-out group-hover:text-foreground/80`,e?`duration-500 rotate-180 text-foreground/80`:`duration-280`),"aria-hidden":!0})]}),(0,J.jsxs)(h.div,{initial:!1,animate:{maxHeight:e?520:0,opacity:+!!e},transition:{maxHeight:{duration:e?.52:.28,ease:e?[.16,1,.3,1]:[.4,0,.2,1]},opacity:{duration:e?.42:.24,ease:e?[.16,1,.3,1]:[.4,0,.2,1]}},className:E(`overflow-hidden`,!e&&`pointer-events-none`),"aria-hidden":!e,inert:!e,children:[(0,J.jsx)(`div`,{className:`flex flex-col gap-1 pt-px`,children:r.map(e=>{let t=Object.entries(Re).find(([t,n])=>n===e)?.[0],r=t!==void 0&&i.has(t),o=n?Ne[e].apply:Ne[e].cleanup;return(0,J.jsxs)(K,{htmlFor:`scope-${e}`,className:E(`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`,r?`opacity-95`:`hover:bg-muted/25`),children:[(0,J.jsx)(`span`,{className:`pt-0.5`,children:(0,J.jsx)(le,{id:`scope-${e}`,checked:i.has(e),disabled:r,onCheckedChange:()=>a(e)})}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1 leading-snug`,children:[(0,J.jsx)(`span`,{className:`font-medium text-foreground`,children:Me[e]}),(0,J.jsx)(`span`,{className:`mt-0.5 block text-[11px] font-normal leading-tight text-muted-foreground`,children:o})]}),r?(0,J.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)})}),n&&(0,J.jsxs)(`div`,{className:`mt-2.5 space-y-1.5 border-t border-border/40 pt-2`,children:[(0,J.jsx)(`p`,{id:`${c}-legend`,className:`text-[11px] font-medium uppercase tracking-wide text-foreground/80`,children:`Collision policy`}),(0,J.jsx)(`div`,{role:`radiogroup`,"aria-labelledby":`${c}-legend`,className:`flex flex-col gap-1`,children:Be.map(e=>(0,J.jsxs)(K,{htmlFor:`if-unmanaged-${e.value}`,className:E(`flex cursor-pointer items-start gap-2 rounded-[var(--miravo-radius-tight)] border px-2.5 py-2 text-[11px] transition-colors`,o===e.value?`border-primary/45 bg-primary/8`:`border-border/40 bg-muted/10 hover:bg-muted/25`),children:[(0,J.jsx)(`input`,{id:`if-unmanaged-${e.value}`,type:`radio`,name:l,value:e.value,checked:o===e.value,onChange:()=>s(e.value),className:`mt-0.5 size-3.5 shrink-0 accent-primary`}),(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsx)(`span`,{className:`font-medium text-foreground`,children:e.title}),(0,J.jsx)(`span`,{className:`mt-px block text-[11px] leading-tight text-foreground/74`,children:e.hint})]})]},e.value))})]})]})]})}var He=[`modbus`,`opcua`,`mqtt`],Ue={modbus:`Modbus`,opcua:`OPC UA`,mqtt:`MQTT`};function We(e){return e===``?null:!/^\d+$/.test(e)||!s(Number(e))?`Use a port from 1 to 65535.`:null}function Ge(e){return Object.fromEntries(Object.entries(e??{}).map(([e,t])=>[e,String(t)]))}function Ke(e,t,n){let r={...e};for(let e of n){let n=(t[e]??``).trim();if(We(n))return null;n===``?delete r[e]:r[e]=Number(n)}return r}function qe({open:e,onOpenChange:t,protocols:n,values:r,onChange:i,hint:a}){let o=(0,q.useId)();return(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`button`,{type:`button`,onClick:()=>t(!e),"aria-expanded":e,className:`flex w-full items-center gap-1 text-left text-[11px] font-medium text-muted-foreground hover:text-foreground`,children:[(0,J.jsx)(A,{className:E(`size-3 transition-transform`,!e&&`-rotate-90`),"aria-hidden":!0}),`Miravo ports remapped (Docker)?`]}),e?(0,J.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[(0,J.jsx)(`p`,{className:`text-[11px] leading-snug text-muted-foreground`,children:a}),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-3`,children:n.map(e=>{let t=r[e]??``,n=We(t.trim());return(0,J.jsxs)(`div`,{className:`w-24 space-y-1`,children:[(0,J.jsx)(K,{htmlFor:`${o}-${e}`,className:`text-[11px] text-muted-foreground`,children:Ue[e]}),(0,J.jsx)(C,{id:`${o}-${e}`,inputMode:`numeric`,placeholder:String(p[e]),value:t,"aria-invalid":n!==null,onChange:t=>i({...r,[e]:t.currentTarget.value}),className:`h-8 font-mono text-[12px]`}),n?(0,J.jsx)(`p`,{className:`text-[10px] text-destructive`,children:n}):null]},e)})})]}):null]})}function Je(e){return e.replace(/-/g,`_`)}function Ye({targetId:e,model:t,protocol:n,result:r}){return{targetId:e,model:t,protocol:n,scope:r.scope,deviceName:r.deviceName,ifUnmanaged:r.ifUnmanaged,exposedPorts:r.exposedPorts}}function Xe({targetId:e,template:t,result:n,protocol:r}){return{targetId:e,template:t,...r?{protocol:r}:{},scope:n.scope,namePrefix:n.namePrefix,ifUnmanaged:n.ifUnmanaged,exposedPorts:n.exposedPorts}}function Ze({targetId:e,template:t,allManaged:n,result:r}){return{targetId:e,...n?{allManaged:!0}:{template:t},scope:r.scope}}var X=`Source host (Miravo)`,Qe=`Address Litmus Edge uses to reach your running Miravo factory.`;function $e({open:e,onOpenChange:t,type:n,label:r,targetLabel:i,hostname:a,sourceHostname:o,exposedPorts:s,protocols:c=He,onConfirm:l,defaultDeviceName:u,defaultNamePrefix:d,metadata:f=[],applyPreview:ee,cleanupPreview:p}){let m=n===`apply`?Oe:ke,[h,g]=(0,q.useState)(new Set(m)),[_,v]=(0,q.useState)(!1),[y,b]=(0,q.useState)(!1),[S,w]=(0,q.useState)(``),[T,D]=(0,q.useState)(null),[O,k]=(0,q.useState)(``),[A,j]=(0,q.useState)(null),[M,N]=(0,q.useState)(`fail`),[oe,P]=(0,q.useState)(!1),[F,se]=(0,q.useState)({}),I=(0,q.useId)(),L=(0,q.useId)(),R=n===`apply`,z=Le(d),B=R&&u!==void 0&&u!==``,V=R&&!B&&z!==void 0,H=(S.trim()===``?u??``:S.trim().toLowerCase()).trim(),U=(O.trim()===``?z??``:O.trim().toLowerCase()).trim(),W=H?Je(H):``;(0,q.useEffect)(()=>{e&&(g(new Set(m)),v(!1),D(null),j(null),w(B?u??``:``),k(V?z??``:``),N(`fail`),b(!1),se(Ge(s)),P(Object.keys(s??{}).length>0))},[e,s,m,B,u,V,z]);let ue=e=>{g(t=>ze(t,e))},G=R?ee:p,de=()=>{let e=fe();if(!e||!R)return e;let t=Ke(s,F,c);return t?{...e,exposedPorts:t}:(P(!0),null)},fe=()=>{let e=m.filter(e=>h.has(e));if(e.length===0)return null;if(B){let t=H,n=Fe(t);return n?(D(n),null):(D(null),j(null),{scope:e,deviceName:t,ifUnmanaged:M})}if(V){let t=U,n=Ie(t);return n?(j(n),null):(j(null),{scope:e,namePrefix:t,ifUnmanaged:M})}return{scope:e,ifUnmanaged:M}},pe=e=>{G?.onPreview(e),t(!1)};return(0,J.jsx)(re,{open:e,onOpenChange:t,children:(0,J.jsxs)(ie,{showCloseButton:!0,className:`flex max-h-[90vh] min-h-0 flex-col gap-0 overflow-hidden p-0 sm:max-w-120`,children:[(0,J.jsxs)(`div`,{className:`shrink-0 border-b border-border/60 px-5 pb-3 pt-5`,children:[(0,J.jsxs)(ae,{className:`flex items-center gap-2 text-sm font-semibold leading-snug`,children:[R?(0,J.jsx)(ce,{className:`size-3.5 shrink-0 text-primary`,"aria-hidden":!0}):(0,J.jsx)(De,{className:`size-3.5 shrink-0 text-destructive`,"aria-hidden":!0}),R?`Apply to Litmus Edge`:`Clean up Litmus Edge`]}),(0,J.jsx)(ne,{className:`sr-only`,children:R?`Review connection details and scope before applying.`:`Review target and cleanup scope before confirming.`})]}),(0,J.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain px-5 pt-4 pb-3`,children:(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-5`,children:[(0,J.jsx)(`div`,{className:`text-xs leading-snug`,children:(0,J.jsxs)(`dl`,{className:`flex flex-col gap-0`,children:[(0,J.jsx)(Z,{label:R?`Resource`:`Target`,children:r}),(0,J.jsx)(Z,{label:`Target`,children:i}),(0,J.jsx)(Z,{label:`Litmus Edge API`,help:Pe,mono:!0,children:a}),(0,J.jsx)(Z,{label:X,help:Qe,mono:!0,children:o}),R?(0,J.jsx)(`div`,{className:`border-b border-border/35 py-2.5`,children:(0,J.jsx)(qe,{open:oe,onOpenChange:P,protocols:c,values:F,onChange:se,hint:`Enter the host port Litmus Edge should dial. Leave blank to use Miravo's own port. Saved for this target.`})}):null,B&&H?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Z,{label:`Miravo asset ID`,mono:!0,children:H}),(0,J.jsx)(Z,{label:`Litmus Edge alias`,mono:!0,children:W})]}):null,f.map(e=>(0,J.jsx)(Z,{label:e.label,children:e.value},`${e.label}:${e.value}`))]})}),G?(0,J.jsxs)(K,{className:E(`flex cursor-pointer items-center gap-2.5 text-[11px] font-medium leading-snug`,G.disabled&&`pointer-events-none opacity-50`),children:[(0,J.jsx)(`span`,{className:`flex shrink-0 items-center`,children:(0,J.jsx)(le,{checked:y,onCheckedChange:e=>b(e===!0),disabled:G.disabled})}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 leading-snug`,children:R?`Dry run only — preview the plan without deploying`:`Dry run only — preview the plan without removing resources`})]}):null,B?(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,J.jsx)(K,{htmlFor:I,className:`text-[11px] font-medium`,children:`Miravo asset ID`}),(0,J.jsx)(C,{id:I,value:S,maxLength:120,onChange:e=>{let t=e.target.value;w(t),D(Fe((t.trim()===``?u??``:t.trim().toLowerCase()).trim()))},placeholder:u,autoComplete:`off`,spellCheck:!1,className:E(`h-9 min-w-0 font-mono text-xs`,T&&`border-destructive`),"aria-invalid":T!=null,"aria-describedby":`${I}-hint`}),(0,J.jsx)(`p`,{id:`${I}-hint`,className:`min-w-0 wrap-break-word text-[11px] leading-snug text-foreground/76`,children:`Same asset ID on a later run updates this asset; hyphens stay in Miravo.`}),W?(0,J.jsxs)(`p`,{className:`min-w-0 wrap-break-word text-[11px] leading-snug text-foreground/76`,children:[`LE alias`,` `,(0,J.jsxs)(`span`,{className:`break-all font-mono text-foreground`,children:[H,` -> `,W]})]}):null,T?(0,J.jsx)(`p`,{className:`text-[11px] text-destructive`,children:T}):null]}):null,V?(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,J.jsx)(K,{htmlFor:L,className:`text-[11px] font-medium`,children:`Name prefix`}),(0,J.jsx)(C,{id:L,value:O,maxLength:120,onChange:e=>{let t=e.target.value;k(t),j(Ie((t.trim()===``?z??``:t.trim().toLowerCase()).trim()))},placeholder:z,autoComplete:`off`,spellCheck:!1,className:E(`h-9 min-w-0 font-mono text-xs`,A&&`border-destructive`),"aria-invalid":A!=null,"aria-describedby":`${L}-hint`}),(0,J.jsxs)(`p`,{id:`${L}-hint`,className:`min-w-0 wrap-break-word text-[11px] leading-snug text-foreground/76`,children:[`Generated aliases use this prefix. Example`,` `,(0,J.jsxs)(`span`,{className:`break-all font-mono text-foreground`,children:[U||z,`-pump-001 ->`,` `,Je(`${U||z}-pump-001`)]})]}),A?(0,J.jsx)(`p`,{className:`text-[11px] text-destructive`,children:A}):null]}):null,(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsx)(Ve,{open:_,onOpenChange:v,isApply:R,scopeOptions:m,scope:h,onToggleScope:ue,ifUnmanaged:M,onIfUnmanagedChange:N}),h.size===0&&!(y&&G)?(0,J.jsx)(`p`,{className:`text-[11px] text-destructive`,children:`Select at least one scope or reopen to reset.`}):null]})]})}),(0,J.jsxs)(te,{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,J.jsx)(x,{type:`button`,variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,J.jsx)(x,{type:`button`,variant:R||y&&p?`default`:`destructive`,onClick:()=>{let e=de();if(e){if(y&&G){pe(e);return}l(e)}},disabled:y&&G?G.disabled||G.planLoading:h.size===0,children:R?y&&ee?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(we,{className:`size-3`,"aria-hidden":!0}),`Preview changes`]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(ce,{className:`size-3`,"aria-hidden":!0}),`Apply`]}):y&&p?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(we,{className:`size-3`,"aria-hidden":!0}),`Preview changes`]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(De,{className:`size-3`,"aria-hidden":!0}),`Clean up`]})})]})]})})}function Z({label:e,help:t,mono:n=!1,children:r}){return(0,J.jsxs)(`div`,{className:`grid grid-cols-2 items-start gap-x-4 border-b border-border/35 py-2.5 first:pt-0`,children:[t?(0,J.jsx)(`dt`,{className:`min-w-0 pt-px`,children:(0,J.jsxs)(`span`,{className:`inline-flex max-w-full items-center gap-1`,children:[(0,J.jsx)(`span`,{className:`text-[11px] font-medium leading-snug text-muted-foreground`,children:e}),(0,J.jsxs)(fe,{children:[(0,J.jsx)(G,{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 ${e}`,children:(0,J.jsx)(H,{className:`size-3`,"aria-hidden":!0})}),(0,J.jsx)(de,{side:`top`,align:`start`,className:`max-w-xs text-left`,children:t})]})]})}):(0,J.jsx)(`dt`,{className:`min-w-0 pt-px text-[11px] font-medium text-muted-foreground`,children:e}),n?(0,J.jsx)(`dd`,{className:`min-w-0 break-all font-mono text-[11px] leading-normal text-foreground/90`,children:r}):(0,J.jsx)(`dd`,{className:`min-w-0 wrap-break-word font-medium text-foreground`,children:r})]})}var et={initial:{scale:0,opacity:0},animate:{scale:1,opacity:1,originY:0},exit:{scale:0,opacity:0},transition:{type:`spring`,stiffness:350,damping:40}},tt={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 nt({children:e,variant:t=`default`}){let n=t===`default`;return(0,J.jsx)(h.div,{...n?et:tt,layout:n,className:`mx-auto w-full`,children:e})}var rt=q.memo(({children:e,className:t,delay:n=1e3,...r})=>{let[i,a]=(0,q.useState)(0),o=(0,q.useMemo)(()=>q.Children.toArray(e),[e]);(0,q.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,q.useMemo)(()=>o.slice(0,i+1).reverse(),[i,o]);return(0,J.jsx)(`div`,{className:E(`flex flex-col items-center gap-4`,t),...r,children:(0,J.jsx)(_,{children:s.map(e=>(0,J.jsx)(nt,{children:e},e.key))})})});rt.displayName=`AnimatedList`;function it({type:e,errorMessage:t,className:n}){return null}var at=`text-destructive hover:bg-destructive/25 hover:text-foreground`,ot={device:`Devices`,tags:`Tags`,model:`Models`,asset:`Assets`,"param-sync":`Parameters`};function st(e){return ot[e]??e}function ct(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 lt(e){return e===`noop`?`no-op`:e}function ut({status:e}){switch(e){case`success`:return(0,J.jsx)(z,{className:`size-3.5 shrink-0 text-success`});case`failed`:return(0,J.jsx)(V,{className:`size-3.5 shrink-0 text-destructive`});case`pending`:return(0,J.jsx)(B,{className:`size-3.5 shrink-0 animate-spin text-primary/90`})}}function dt({status:e}){switch(e){case`done`:return(0,J.jsx)(z,{className:`size-3.5 text-success`});case`active`:return(0,J.jsx)(B,{className:`size-3.5 animate-spin text-primary`});case`pending`:return(0,J.jsx)(ye,{className:`size-3.5 text-foreground/55`})}}function ft({entry:e}){let[t,n]=(0,q.useState)(!1);return(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,J.jsxs)(`button`,{type:`button`,className:E(`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,J.jsx)(ut,{status:e.status}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[11px] text-foreground`,children:e.name}),(0,J.jsx)(`span`,{className:E(`inline-flex rounded-[var(--miravo-radius-tight)] px-1.5 py-0.5 text-[9px] font-medium uppercase tracking-wider`,ct(e.action)),children:lt(e.action)}),e.error&&(0,J.jsx)(A,{className:E(`size-3 text-foreground/75 transition-transform`,t&&`rotate-180`)})]}),(0,J.jsx)(_,{initial:!1,children:t&&e.error&&(0,J.jsxs)(h.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:`auto`},exit:{opacity:0,height:0},transition:{duration:.18},className:`overflow-hidden`,children:[(0,J.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,J.jsx)(`p`,{className:`min-w-0 flex-1 text-left whitespace-normal break-words text-destructive [overflow-wrap:anywhere]`,children:e.error}),(0,J.jsx)(b,{value:e.error,label:`Copy error`,className:E(at,`shrink-0`)})]}),(0,J.jsx)(it,{type:`apply`,errorMessage:e.error,className:`mb-1 mt-2.5 w-full min-w-0`})]})})]})}function pt({phase:e,open:t,onOpenChange:n}){let r=e.resources.length,i=r===e.total,a=e.resources.length>0;return(0,J.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,J.jsxs)(`button`,{type:`button`,className:E(`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,J.jsx)(dt,{status:e.status}),(0,J.jsx)(`span`,{className:`text-xs font-medium tracking-wide text-foreground`,children:st(e.name)}),(0,J.jsxs)(`span`,{className:`font-mono text-[10px] text-foreground/70`,children:[r,`/`,e.total]}),(0,J.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1.5`,children:[i&&e.status===`done`&&(0,J.jsx)(z,{className:`size-3 text-success`}),a&&(0,J.jsx)(A,{className:E(`size-3 text-foreground/75 transition-transform`,!t&&`-rotate-90`),"aria-hidden":!0})]})]}),(0,J.jsx)(_,{initial:!1,children:a&&t&&(0,J.jsx)(h.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,J.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,J.jsx)(g.Provider,{value:null,children:e.resources.map((e,t)=>(0,J.jsx)(nt,{variant:`subtle`,children:(0,J.jsx)(ft,{entry:e})},`${e.name}-${t}`))})})})})]})}function mt({operation:e}){let t=e.status===`complete`,n=e.status===`cancelled`,r=e.failed>0,i=e.totalPlanned>0?Math.min(100,gt(e)/e.totalPlanned*100):0;return(0,J.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,J.jsx)(h.div,{"aria-hidden":`true`,className:E(`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 ht(e){return e.duration==null?(Date.now()-e.startedAt)/1e3:e.duration/1e3}function gt(e){let t=e.applied+e.failed;return e.totalPlanned>0?Math.min(t,e.totalPlanned):t}function _t(e,t){let n=e.label;return t?.length?t.find(e=>e.id===n)?.name??n:n}var vt={complete:{Icon:z,className:`size-4 text-success`},partial:{Icon:ve,className:`size-4 text-warning`},cancelled:{Icon:ge,className:`size-4 text-foreground/65`},error:{Icon:V,className:`size-4 text-destructive`},running:{Icon:B,className:`size-4 animate-spin text-warning`}};function yt({icon:e,className:t}){return(0,J.jsx)(h.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,J.jsx)(e,{className:t})})}function bt({operation:e,sourceLabel:t,isAllExpanded:n,onToggleAll:r}){let i=ht(e),a=gt(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`,d=vt[u];return(0,J.jsxs)(`div`,{className:E(`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,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,J.jsx)(_,{mode:`wait`,initial:!1,children:(0,J.jsx)(yt,{icon:d.Icon,className:d.className},u)}),(0,J.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,J.jsxs)(`span`,{className:`w-full min-w-0 text-[10px] leading-tight text-foreground/78`,children:[(0,J.jsx)(`span`,{className:`font-sans break-words`,children:t}),(0,J.jsx)(`span`,{className:`font-mono break-words`,children:` → ${e.targetLabel}`})]})]}),(0,J.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,J.jsx)(pe,{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,J.jsxs)(`span`,{className:`gap-1`,children:[(0,J.jsx)(_,{mode:`popLayout`,initial:!1,children:(0,J.jsx)(h.span,{initial:{opacity:0,y:-6},animate:{opacity:1,y:0},exit:{opacity:0,y:6},transition:{type:`spring`,stiffness:500,damping:35},className:`inline tabular-nums`,children:a},a)}),`/`,e.totalPlanned,(0,J.jsx)(`span`,{className:`text-foreground/72`,children:e.type===`apply`?`applied`:`deleted`})]})}),(0,J.jsx)(_,{initial:!1,children:e.failed>0&&(0,J.jsx)(h.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,J.jsxs)(pe,{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,J.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:[(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-mono text-[10px] leading-none text-foreground/75`,children:[(0,J.jsx)(xe,{className:`size-3 shrink-0 block text-foreground/65`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`tabular-nums leading-none`,children:typeof i==`number`?`${i.toFixed(1)}s`:`...`})]}),r&&(0,J.jsx)(`div`,{className:`flex items-center border-l border-border/40 pl-2`,children:(0,J.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,J.jsx)(_e,{className:E(`size-3.5 transition-transform duration-300`,!n&&`opacity-70 scale-y-[-1]`)})})})]})]}),(0,J.jsx)(mt,{operation:e})]})]})}function xt(e){return e?e.closest(`[data-edge-op-scroll]`)??e.closest(`.overflow-y-auto`):null}var St=350;function Ct(e){e?.scrollIntoView({block:`end`,behavior:`auto`,inline:`nearest`})}function wt(e){let t=()=>Ct(e);t(),requestAnimationFrame(t),requestAnimationFrame(()=>requestAnimationFrame(t)),window.setTimeout(t,0),window.setTimeout(t,48),window.setTimeout(t,120)}function Tt({logs:e}){return e.length===0?null:(0,J.jsx)(`div`,{className:`flex min-w-0 flex-col gap-1.5 px-2 pb-2`,children:e.map(e=>(0,J.jsxs)(`div`,{className:E(`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,J.jsx)(U,{className:`mt-0.5 size-3.5 shrink-0 text-primary`,"aria-hidden":!0}):(0,J.jsx)(ve,{className:`mt-0.5 size-3.5 shrink-0`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 wrap-anywhere`,children:e.message})]},e.id))})}function Et({operation:e,catalogTemplates:t,logs:n}){let r=(0,q.useRef)(null),i=(0,q.useRef)(null),a=(0,q.useRef)(!0),o=(0,q.useRef)(e.status);o.current=e.status;let s=(0,q.useRef)(!1),[c,l]=(0,q.useState)(new Set),u=(0,q.useMemo)(()=>_t(e,t),[e,t]);(0,q.useLayoutEffect)(()=>{let e=xt(r.current);if(!e)return;let t=()=>{a.current=e.scrollHeight-e.scrollTop-e.clientHeight<St};return e.addEventListener(`scroll`,t,{passive:!0}),t(),()=>{e.removeEventListener(`scroll`,t)}},[]),(0,q.useLayoutEffect)(()=>{if(e.status===`running`){a.current&&Ct(i.current),s.current=!0;return}s.current&&=(wt(i.current),!1)},[e.status,e.applied,e.failed,e.phases]),(0,q.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&&Ct(i.current)})});return s.observe(t),a.current&&Ct(i.current),()=>{s.disconnect(),cancelAnimationFrame(n)}},[e.status]);let d=e.phases.length>0,f=c.size===0;return(0,J.jsxs)(`div`,{ref:r,className:`flex min-w-0 w-full flex-col gap-2`,children:[(0,J.jsx)(bt,{operation:e,sourceLabel:u,isAllExpanded:f,onToggleAll:d?()=>{l(f?new Set(e.phases.map(e=>e.name)):new Set)}:void 0}),(0,J.jsx)(`div`,{className:`flex flex-col gap-1 px-2 pt-2 pb-4`,children:e.phases.map(e=>(0,J.jsx)(`div`,{children:(0,J.jsx)(pt,{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,J.jsx)(_,{initial:!1,children:e.error&&e.retryPending&&(0,J.jsxs)(h.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,J.jsx)(B,{className:`size-4 shrink-0 animate-spin`}),(0,J.jsx)(`span`,{className:`truncate`,children:e.error})]})}),(0,J.jsx)(_,{initial:!1,children:e.error&&e.status===`error`&&(0,J.jsxs)(h.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,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(`p`,{className:`min-w-0 flex-1 text-left wrap-anywhere text-destructive`,children:e.error}),(0,J.jsx)(b,{value:e.error,label:`Copy error`,className:E(at,`shrink-0`)})]}),(0,J.jsx)(it,{type:e.type,errorMessage:e.error,className:`mt-3 w-full min-w-0`})]})}),n&&n.length>0?(0,J.jsx)(Tt,{logs:n}):null,(0,J.jsx)(`div`,{ref:i,className:`h-px w-full shrink-0`,"aria-hidden":!0})]})}function Dt({format:e,kind:t}){return e===`source-yaml`?t===`model`?`Raw asset model definition. Edit locally, version-control, or use as input for the CLI.`:`Raw factory 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 Litmus Edge UI.`:`Litmus Edge template JSON (DeviceHub devices + Digital Twins). Import directly via the Litmus Edge UI.`:`Select a format to download.`}function Ot({children:e,className:t}){return(0,J.jsx)(`div`,{className:E(`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 kt({title:e,subtitle:t,footerAction:n,canDismiss:r=!0,onDismiss:i,children:a}){return(0,q.useEffect)(()=>{function e(e){e.key===`Escape`&&r&&i()}return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[r,i]),(0,J.jsx)(h.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,J.jsxs)(Ot,{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,J.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,J.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,J.jsx)(R,{className:`size-4 shrink-0 text-primary`,"aria-hidden":!0}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`p`,{className:`font-heading text-xs font-semibold tracking-tight text-foreground`,children:e}),t?(0,J.jsx)(`p`,{className:`text-[11px] leading-snug text-foreground/80`,children:t}):null]})]}),r?(0,J.jsx)(x,{type:`button`,variant:`ghost`,size:`icon-xs`,className:`shrink-0 text-foreground/70 hover:bg-muted/80 hover:text-foreground`,onClick:i,"aria-label":`Dismiss operation panel`,children:(0,J.jsx)(w,{className:`size-3.5`,"aria-hidden":!0})}):null]}),(0,J.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:a}),n?(0,J.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 At={...Object.fromEntries(F.map(e=>[e.id,e.exportLabel])),"source-yaml":`Source YAML`};function jt(e){return e==null||e===``?`Select integration`:typeof e==`string`?At[e]??e:`Select integration`}function Mt(e){return F.find(t=>t.id===e)?.label??e}function Q({id:e,label:t,hint:n,className:r,labelAdornment:i,children:a}){return(0,J.jsxs)(`div`,{className:E(`flex flex-col gap-2`,r),children:[(0,J.jsxs)(`div`,{className:`space-y-1`,children:[(0,J.jsxs)(`span`,{className:`inline-flex max-w-full items-center gap-1`,children:[(0,J.jsx)(K,{htmlFor:e,className:`text-[11px] font-medium text-foreground`,children:t}),i]}),n?(0,J.jsx)(`p`,{className:`text-[11px] leading-relaxed text-muted-foreground`,children:n}):null]}),a]})}function Nt({open:e,editing:t,integrationId:n,form:r,showToken:i,saving:a,testing:o,canTestConnection:s,onOpenChange:c,onIntegrationChange:l,onFormChange:u,onShowTokenChange:d,onSave:f,onTestConnection:ee,onCancelInFlight:p}){let m=n===I.id,h=t?`Edit Target`:`Add Target`,g=t?`Update the deployment connection.`:`Add the target used for integration deploys.`,_=t?`Leave empty to keep the current token.`:`Required for the first save and connection test.`;return(0,J.jsx)(re,{open:e,onOpenChange:e=>{e||p(),c(e)},children:(0,J.jsxs)(ie,{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,J.jsxs)(y,{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,J.jsx)(ae,{className:`text-base tracking-tight`,children:h}),(0,J.jsx)(ne,{className:`max-w-xl text-sm leading-relaxed`,children:g})]}),(0,J.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,J.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[t?(0,J.jsx)(Q,{label:`Integration`,children:(0,J.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:Mt(n)})}):(0,J.jsx)(Q,{label:`Integration`,children:(0,J.jsxs)(P,{value:n,onValueChange:e=>l(e),children:[(0,J.jsx)(oe,{className:`h-9 w-full text-sm data-placeholder:text-muted-foreground/55`,"aria-label":`Integration type`,children:(0,J.jsx)(O,{placeholder:`Select integration`,children:e=>jt(e)})}),(0,J.jsxs)(j,{children:[(0,J.jsxs)(N,{children:[(0,J.jsx)(D,{children:`Available`}),L.map(e=>(0,J.jsx)(k,{value:e.id,children:e.label},e.id))]}),(0,J.jsx)(M,{}),(0,J.jsxs)(N,{children:[(0,J.jsx)(D,{children:`Coming soon`}),se.map(e=>(0,J.jsx)(k,{value:e.id,children:e.label},e.id))]})]})]})}),m?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Q,{id:`env-label`,label:`Label`,children:(0,J.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,J.jsx)(Q,{id:`env-hostname`,label:`Hostname`,children:(0,J.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,J.jsx)(Q,{id:`env-source`,label:X,labelAdornment:(0,J.jsxs)(fe,{children:[(0,J.jsx)(G,{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 ${X}`,children:(0,J.jsx)(H,{className:`size-3`,"aria-hidden":!0})}),(0,J.jsx)(de,{side:`top`,align:`start`,className:`max-w-xs text-left`,children:Qe})]}),children:(0,J.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,J.jsx)(Q,{id:`env-token`,label:`API token`,labelAdornment:(0,J.jsxs)(fe,{children:[(0,J.jsx)(G,{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,J.jsx)(H,{className:`size-3`,"aria-hidden":!0})}),(0,J.jsx)(de,{side:`top`,align:`start`,className:`max-w-xs text-left`,children:_})]}),children:(0,J.jsxs)(`div`,{className:`relative`,children:[(0,J.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,J.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,J.jsx)(Se,{className:`size-3.5`,"aria-hidden":!0}):(0,J.jsx)(Ce,{className:`size-3.5`,"aria-hidden":!0})})]})})]}):(0,J.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:[Mt(n),` setup is not available yet. Switch back to Litmus Edge to finish target setup now.`]})]})}),(0,J.jsx)(`span`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:o&&m?`Checking connection to Litmus Edge…`:``}),(0,J.jsxs)(te,{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,J.jsx)(x,{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:ee,children:o?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(B,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),`Testing connection`]}):`Test connection`}),(0,J.jsxs)(`div`,{className:`flex w-full flex-col gap-2 sm:w-auto sm:flex-row`,children:[(0,J.jsx)(x,{variant:`outline`,size:`lg`,className:`w-full sm:w-auto`,onClick:()=>{p(),c(!1)},disabled:a,children:`Cancel`}),(0,J.jsx)(x,{size:`lg`,className:`w-full sm:w-auto`,onClick:f,disabled:a||!m,children:a?`Saving...`:t?`Save Target`:`Add Target`})]})]})]})})}var Pt=`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,loading:a=!1,className:o,preferredTargetId:s,onAddNew:c}){return(0,q.useEffect)(()=>{if(t||e.length===0)return;let r=(s?e.find(e=>e.id===s):void 0)??e[0];r&&n(r.id)},[t,e,s,n]),a?(0,J.jsx)(`div`,{className:E(`flex h-9 min-h-9 w-full items-center rounded-[var(--miravo-radius-stadium-sm)] border border-input bg-input/25 px-3 text-xs text-muted-foreground`,o),children:`Loading targets...`}):e.length===0&&c?(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 text-[11px] text-muted-foreground`,children:[(0,J.jsx)(`span`,{children:`No targets configured.`}),(0,J.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 text-primary hover:underline`,onClick:c,children:[(0,J.jsx)(Te,{className:`inline size-3`}),` Add target`]})]}):(0,J.jsxs)(P,{value:t,onValueChange:e=>e&&n(e),disabled:i,children:[(0,J.jsx)(oe,{size:r,className:E(`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`,o),children:(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,J.jsx)(`span`,{className:Pt,"aria-hidden":!0,children:(0,J.jsx)(W,{className:`size-3.5`})}),(0,J.jsx)(O,{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,J.jsxs)(`span`,{className:`flex flex-col gap-0.5`,children:[(0,J.jsx)(`span`,{className:`text-xs font-medium leading-tight`,children:n.label}),(0,J.jsx)(`span`,{className:`font-mono text-[11px] leading-none text-muted-foreground`,children:n.hostname})]}):`Select target`}})]})}),(0,J.jsx)(j,{className:`rounded-[var(--miravo-radius-stadium-sm)] p-1.5`,children:e.map(e=>(0,J.jsxs)(k,{value:e.id,className:`h-auto items-center gap-2 rounded-[var(--miravo-radius-stadium-sm)] py-2 pr-8 pl-2`,children:[(0,J.jsx)(`span`,{className:Pt,"aria-hidden":!0,children:(0,J.jsx)(W,{className:`size-3.5`})}),(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5 text-left`,children:[(0,J.jsx)(`span`,{className:`truncate text-xs font-medium leading-tight text-foreground`,children:e.label}),(0,J.jsx)(`span`,{className:`truncate font-mono text-[11px] leading-none text-muted-foreground`,children:e.hostname})]})]},e.id))})]})}async function It(){return(await u(`/integrations/le/targets`,a.integrationTargets)).targets}function Lt(e){return u(`/integrations/le/targets`,a.integrationTargetCreate,{body:e})}function Rt(e,t){return u(`/integrations/le/targets/${e}`,a.integrationTargetById,{body:t})}function zt(e){return u(`/integrations/le/targets/${e}`,a.integrationTargetDelete)}function Bt(e,t){return u(`/integrations/le/targets/test`,a.integrationConnectionTest,{body:e,init:{signal:t?.signal}})}function Vt(e,t){return u(`/integrations/le/plan`,a.integrationPlan,{body:e,init:{signal:t?.signal}})}function Ht(e,t){return u(`/integrations/le/cleanup/plan`,a.integrationCleanupPlan,{body:e,init:{signal:t?.signal}})}function Ut(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 u(n?`/integrations/le/operations?${n}`:`/integrations/le/operations`,a.integrationOperations)}async function Wt(e){try{return await u(`/integrations/le/operations/${e}/cancel`,a.integrationOperationCancel),!0}catch(e){if(r.is(e)&&e.status===404)return!1;throw e}}function Gt(e,t,n){return qt(`/integrations/le/apply/stream`,a.integrationApplyStream,e,t,n)}function Kt(e,t,n){return qt(`/integrations/le/cleanup/stream`,a.integrationCleanupStream,e,t,n)}function qt(e,t,n,i,a){let s=new AbortController;return(async()=>{try{let a=t.body.safeParse(n);if(!a.success)throw Error(`Invalid request for ${t.method} ${t.path}: ${a.error.message}`);let u=await fetch(l(d,e),{method:t.method,headers:{"content-type":`application/json`},credentials:`include`,body:JSON.stringify(a.data),signal:s.signal});if(u.status===401&&t.auth===`required`)throw c(),Error(`Session expired`);if(!u.ok){let e=`HTTP ${u.status}`;try{let e=await u.json(),t=ee.safeParse(e);if(t.success)throw new r({code:t.data.code,status:u.status,message:t.data.message,hint:t.data.hint})}catch(e){if(e instanceof r)throw e}throw Error(e)}if(!u.body)throw Error(`No response body`);let f=u.body.getReader(),p=new TextDecoder,m=``,h=``,g=``,_=!1;for(;;){let{done:e,value:t}=await f.read();if(e)break;m+=p.decode(t,{stream:!0});let n=m.split(`
2
- `);m=n.pop()??``;for(let e of n)if(e.startsWith(`event: `))h=e.slice(7).trim();else if(e.startsWith(`data: `))g=e.slice(6);else if(e===``&&h&&g){let e=!1;try{let t=JSON.parse(g),n=o.safeParse({event:h,data:t});n.success&&((n.data.event===`complete`||n.data.event===`cancelled`||n.data.event===`error`)&&(_=!0,e=!0),i(n.data))}catch{}if(h=``,g=``,e){await f.cancel();return}}}if(!_&&!s.signal.aborted)throw Error(`Connection to server was lost unexpectedly`)}catch(e){if(s.signal.aborted)return;a(e instanceof Error?e:Error(String(e)))}})(),s}function Jt(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 Yt(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:e.error??t?.error??`The operation ended with an error.`};default:return{title:`Operation`,subtitle:``}}}function Xt(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(`factory not found`))return{message:`That target was removed. Close the dialog and refresh the list.`};if(n.includes(`unsupported integration`)&&n.includes(`connection`))return{message:`This integration 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:Zt(t,200)}}function Zt(e,t){let n=e.replace(/\s+/g,` `).trim();return n.length<=t?n:`${n.slice(0,t-1)}…`}function Qt(e){if(e.connected){let t=e.litmusEdgeVersion?` Litmus Edge v${e.litmusEdgeVersion}.`:``;if(e.warning){v.warning(`Connected to ${e.hostname}.${t}`,{description:e.warning});return}v.success(`Connected to ${e.hostname}.${t}`);return}let{message:t,description:n}=Xt(e.error);v.error(t,n?{description:n}:void 0)}function $t(e){let{message:t,description:n}=Xt(e instanceof Error?e.message:String(e));v.error(t,n?{description:n}:void 0)}function en(e){return!!(typeof DOMException<`u`&&e instanceof DOMException&&e.name===`AbortError`||e instanceof Error&&(e.name===`AbortError`||/aborted/i.test(e.message)))}function tn(){let[e,t]=(0,q.useState)(!1),n=(0,q.useRef)(null),r=(0,q.useCallback)(()=>{n.current?.abort()},[]);return{testing:e,runTest:(0,q.useCallback)(async e=>{let r=new AbortController;n.current=r,t(!0);try{Qt(await Bt(e,{signal:r.signal}))}catch(e){if(en(e))return;$t(e)}finally{n.current===r&&(n.current=null),t(!1)}},[]),cancelInFlight:r}}function nn(e){return e instanceof DOMException&&e.name===`AbortError`||e instanceof Error&&e.name===`AbortError`}function rn(e){return e.map(e=>e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1)).join(`, `)}function an({onCloseTable:e,planKind:t=`apply`}){return(0,J.jsx)(`div`,{className:`border-b border-border/40 px-3 py-3 sm:px-4`,children:(0,J.jsxs)(`div`,{className:`flex gap-3`,children:[(0,J.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-[var(--miravo-radius-stadium-sm)] border border-border/50 bg-muted/15`,children:(0,J.jsx)(be,{className:`size-4 text-muted-foreground`,"aria-hidden":!0})}),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start gap-1 pt-0.5 sm:gap-2`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-2`,children:[(0,J.jsx)(`p`,{className:`font-heading text-[11px] font-semibold uppercase tracking-[0.14em] text-foreground`,children:t===`cleanup`?`Expected removals`:`Expected changes`}),(0,J.jsx)(`span`,{className:`rounded-[var(--miravo-radius-tight)] border border-primary/25 bg-primary/5 px-1.5 py-px font-mono text-[9px] uppercase tracking-wider text-primary/90`,children:`Draft`})]}),(0,J.jsx)(`p`,{className:`mt-1.5 max-w-prose text-[10px] leading-relaxed text-muted-foreground`,children:t===`cleanup`?`Preview only — nothing runs until you confirm cleanup.`:`Preview only — nothing runs until you confirm deploy.`})]}),e&&(0,J.jsx)(x,{type:`button`,variant:`ghost`,size:`icon`,className:`size-8 shrink-0 text-muted-foreground hover:text-foreground`,onClick:e,"aria-label":`Close table`,children:(0,J.jsx)(w,{className:`size-4`,"aria-hidden":!0})})]})]})})}var on={create:`border-success/30 bg-success/12 text-success`,update:`border-info/30 bg-info/12 text-info`,replace:`border-chart-2/30 bg-chart-2/12 text-chart-2`,delete:`border-destructive/30 bg-destructive/12 text-destructive`,noop:`border-border/50 bg-muted/50 text-foreground/75`,blocked:`border-warning/30 bg-warning/12 text-warning`};function sn({plan:e,planKind:t}){let n=t===`apply`&&e.sourceHostname!=null&&e.sourceHostname!==``;return(0,J.jsx)(`div`,{className:`border-b border-border/35 bg-muted/10 px-3 py-2 sm:px-4`,children:(0,J.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-[10px] leading-snug sm:flex-row sm:flex-wrap sm:items-baseline sm:gap-x-4 sm:gap-y-1`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5`,children:[(0,J.jsx)(`span`,{className:`shrink-0 font-mono text-[9px] uppercase tracking-wider text-muted-foreground/85`,children:`Target LE`}),(0,J.jsx)(`span`,{className:`font-mono text-foreground/90 wrap-anywhere`,children:e.targetHost})]}),n?(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5 sm:border-l sm:border-border/50 sm:pl-4`,children:[(0,J.jsx)(`span`,{className:`shrink-0 font-mono text-[9px] uppercase tracking-wider text-muted-foreground/85`,children:X}),(0,J.jsx)(`span`,{className:`font-mono text-foreground/90 wrap-anywhere`,children:e.sourceHostname})]}):null]})})}function cn({entries:e}){let t=e.reduce((e,t)=>(e[t.action]++,e),{create:0,update:0,replace:0,delete:0,noop:0,blocked:0});return(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-border/35 px-3 py-2.5 sm:px-4`,children:[(0,J.jsx)(`span`,{className:`sr-only`,children:`Summary of planned actions`}),(0,J.jsx)(`span`,{className:`font-mono text-[9px] uppercase tracking-[0.18em] text-muted-foreground`,children:`Manifest`}),(0,J.jsx)(`span`,{className:`hidden h-3 w-px bg-border/60 sm:block`,"aria-hidden":!0}),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center gap-2`,children:[t.create>0&&(0,J.jsxs)(`span`,{className:`inline-flex items-center rounded-[var(--miravo-radius-tight)] border border-success/25 bg-success/10 px-2 py-0.5 font-mono text-[10px] tabular-nums text-success`,children:[`+`,t.create,` new`]}),t.update>0&&(0,J.jsxs)(`span`,{className:`inline-flex items-center rounded-[var(--miravo-radius-tight)] border border-info/25 bg-info/10 px-2 py-0.5 font-mono text-[10px] tabular-nums text-info`,children:[`~`,t.update,` update`]}),t.replace>0&&(0,J.jsxs)(`span`,{className:`inline-flex items-center rounded-[var(--miravo-radius-tight)] border border-chart-2/25 bg-chart-2/10 px-2 py-0.5 font-mono text-[10px] tabular-nums text-chart-2`,children:[`↺`,t.replace,` replace`]}),t.delete>0&&(0,J.jsxs)(`span`,{className:`inline-flex items-center rounded-[var(--miravo-radius-tight)] border border-destructive/25 bg-destructive/10 px-2 py-0.5 font-mono text-[10px] tabular-nums text-destructive`,children:[`−`,t.delete,` remove`]}),t.noop>0&&(0,J.jsxs)(`span`,{className:`inline-flex items-center rounded-[var(--miravo-radius-tight)] border border-border/50 bg-muted/50 px-2 py-0.5 font-mono text-[10px] tabular-nums text-foreground/75`,children:[`=`,t.noop,` unchanged`]}),t.blocked>0&&(0,J.jsxs)(`span`,{className:`inline-flex items-center rounded-[var(--miravo-radius-tight)] border border-warning/25 bg-warning/10 px-2 py-0.5 font-mono text-[10px] tabular-nums text-warning`,children:[t.blocked,` skipped`]})]})]})}function ln({plan:e,onCloseTable:t,planKind:n=`apply`}){return e.entries.length===0?(0,J.jsxs)(`div`,{className:`overflow-hidden rounded-[var(--miravo-radius-stadium-sm)] border border-dashed border-border/55`,children:[(0,J.jsx)(an,{onCloseTable:t,planKind:n}),(0,J.jsx)(sn,{plan:e,planKind:n}),(0,J.jsxs)(`div`,{className:`flex flex-col items-center gap-3 px-4 py-10 text-center`,children:[(0,J.jsx)(`div`,{className:`flex size-12 items-center justify-center rounded-[var(--miravo-radius-stadium-sm)] border border-border/50`,children:(0,J.jsx)(be,{className:`size-6 text-muted-foreground/45`,"aria-hidden":!0})}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`p`,{className:`font-heading text-sm font-semibold tracking-tight text-foreground`,children:n===`cleanup`?`Nothing to remove`:`Nothing to change`}),(0,J.jsx)(`p`,{className:`mx-auto mt-2 max-w-sm text-[11px] leading-relaxed text-muted-foreground`,children:n===`cleanup`?`No Miravo-managed resources matched this cleanup scope on the template — nothing would be deleted.`:`This template already matches what is on the target — no create or update steps.`})]})]})]}):(0,J.jsxs)(`div`,{className:`overflow-hidden rounded-[var(--miravo-radius-stadium-sm)] border border-border/45`,children:[(0,J.jsx)(an,{onCloseTable:t,planKind:n}),(0,J.jsx)(sn,{plan:e,planKind:n}),(0,J.jsx)(cn,{entries:e.entries}),(0,J.jsx)(`div`,{className:`overflow-x-auto`,children:(0,J.jsxs)(`table`,{className:`w-full min-w-lg text-xs`,children:[(0,J.jsx)(`caption`,{className:`sr-only`,children:n===`cleanup`?`Detailed list of planned cleanup actions in deletion order`:`Detailed list of create, update, and delete actions in deployment order`}),(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{className:`border-b border-border/45`,children:[(0,J.jsx)(`th`,{scope:`col`,className:`sticky top-0 z-10 bg-background px-3 py-2 text-left font-heading text-[9px] font-semibold uppercase tracking-[0.14em] text-muted-foreground sm:px-3.5`,children:`Action`}),(0,J.jsx)(`th`,{scope:`col`,className:`sticky top-0 z-10 bg-background px-3 py-2 text-left font-heading text-[9px] font-semibold uppercase tracking-[0.14em] text-muted-foreground sm:px-3.5`,children:`Type`}),(0,J.jsx)(`th`,{scope:`col`,className:`sticky top-0 z-10 bg-background px-3 py-2 text-left font-heading text-[9px] font-semibold uppercase tracking-[0.14em] text-muted-foreground sm:px-3.5`,children:`Name`}),(0,J.jsx)(`th`,{scope:`col`,className:`sticky top-0 z-10 hidden bg-background px-3 py-2 text-left font-heading text-[9px] font-semibold uppercase tracking-[0.14em] text-muted-foreground sm:table-cell sm:px-3.5`,children:`Protocol`}),(0,J.jsx)(`th`,{scope:`col`,className:`sticky top-0 z-10 hidden bg-background px-3 py-2 text-left font-heading text-[9px] font-semibold uppercase tracking-[0.14em] text-muted-foreground md:table-cell md:px-3.5`,children:`Detail`})]})}),(0,J.jsx)(`tbody`,{children:e.entries.map((e,t)=>(0,J.jsxs)(`tr`,{className:E(`border-b border-border/25 transition-colors`,t%2==1?`bg-muted/35`:`bg-transparent`,`hover:bg-primary/4`),children:[(0,J.jsx)(`td`,{className:`px-3 py-2 align-middle sm:px-3.5`,children:(0,J.jsx)(pe,{variant:`outline`,className:E(`border px-1.5 py-0 font-mono text-[10px] uppercase tracking-wide`,on[e.action]),children:e.action})}),(0,J.jsx)(`td`,{className:`px-3 py-2 align-middle font-mono text-[11px] text-foreground sm:px-3.5`,children:e.resourceType}),(0,J.jsx)(`td`,{className:`max-w-[min(16rem,28vw)] truncate px-3 py-2 align-middle font-mono text-[11px] text-foreground sm:max-w-xs sm:px-3.5`,children:e.name}),(0,J.jsx)(`td`,{className:`hidden px-3 py-2 align-middle font-mono text-[11px] text-muted-foreground sm:table-cell sm:px-3.5`,children:e.protocol??`—`}),(0,J.jsx)(`td`,{className:`hidden max-w-xs truncate px-3 py-2 align-middle text-[11px] text-muted-foreground md:table-cell md:px-3.5`,children:e.blockReason??e.detail??`—`})]},`${e.action}-${e.resourceType}-${e.name}-${e.protocol??``}-${e.detail??e.blockReason??``}`))})]})}),(0,J.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-border/40 px-3 py-3 text-[10px] text-muted-foreground sm:flex-row sm:items-center sm:justify-between sm:gap-4 sm:px-4`,children:[(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`span`,{className:`font-mono tabular-nums text-foreground/90`,children:e.entries.length}),` `,(0,J.jsxs)(`span`,{className:`text-muted-foreground/90`,children:[e.entries.length===1?`action`:`actions`,` queued`]})]}),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 font-mono text-[10px] wrap-anywhere`,children:[(0,J.jsx)(`span`,{className:`shrink-0 text-[9px] uppercase tracking-wider text-muted-foreground/80`,children:`Scope`}),(0,J.jsx)(`span`,{className:`min-w-0 text-foreground/90`,children:rn(e.scope)})]})]})]})}var un=[`s1`,`s2`,`s3`,`s4`];function dn(){return(0,J.jsxs)(`div`,{className:`overflow-hidden rounded-[var(--miravo-radius-stadium-sm)] border border-border/45`,role:`status`,"aria-busy":`true`,"aria-live":`polite`,children:[(0,J.jsx)(`span`,{className:`sr-only`,children:`Loading plan preview`}),(0,J.jsx)(`div`,{className:`border-b border-border/40 px-3 py-3 sm:px-4`,children:(0,J.jsxs)(`div`,{className:`flex gap-3`,children:[(0,J.jsx)(Y,{className:`size-10 shrink-0 rounded-[var(--miravo-radius-stadium-sm)]`}),(0,J.jsx)(`div`,{className:`flex min-w-0 flex-1 items-start gap-1 pt-0.5 sm:gap-2`,children:(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-2`,children:[(0,J.jsx)(Y,{className:`h-3.5 w-40`}),(0,J.jsx)(Y,{className:`h-4 w-11 rounded-[var(--miravo-radius-tight)] border`})]}),(0,J.jsx)(Y,{className:`mt-1.5 h-3 max-w-prose`})]})})]})}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-border/35 px-3 py-2.5 sm:px-4`,children:[(0,J.jsx)(Y,{className:`h-2.5 w-14`}),(0,J.jsx)(Y,{className:`hidden h-3 w-px shrink-0 sm:block`}),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center gap-2`,children:[(0,J.jsx)(Y,{className:`h-5 w-18 rounded-[var(--miravo-radius-tight)]`}),(0,J.jsx)(Y,{className:`h-5 w-24 rounded-[var(--miravo-radius-tight)]`}),(0,J.jsx)(Y,{className:`h-5 w-20 rounded-[var(--miravo-radius-tight)]`})]})]}),(0,J.jsx)(`div`,{className:`overflow-x-auto`,children:(0,J.jsxs)(`table`,{className:`w-full min-w-lg text-xs`,"aria-hidden":!0,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{className:`border-b border-border/45`,children:[(0,J.jsx)(`th`,{scope:`col`,className:`sticky top-0 z-10 bg-background px-3 py-2 text-left sm:px-3.5`,children:(0,J.jsx)(Y,{className:`h-2.5 w-12`})}),(0,J.jsx)(`th`,{scope:`col`,className:`sticky top-0 z-10 bg-background px-3 py-2 text-left sm:px-3.5`,children:(0,J.jsx)(Y,{className:`h-2.5 w-9`})}),(0,J.jsx)(`th`,{scope:`col`,className:`sticky top-0 z-10 bg-background px-3 py-2 text-left sm:px-3.5`,children:(0,J.jsx)(Y,{className:`h-2.5 w-10`})}),(0,J.jsx)(`th`,{scope:`col`,className:`sticky top-0 z-10 hidden bg-background px-3 py-2 text-left sm:table-cell sm:px-3.5`,children:(0,J.jsx)(Y,{className:`h-2.5 w-14`})}),(0,J.jsx)(`th`,{scope:`col`,className:`sticky top-0 z-10 hidden bg-background px-3 py-2 text-left md:table-cell md:px-3.5`,children:(0,J.jsx)(Y,{className:`h-2.5 w-11`})})]})}),(0,J.jsx)(`tbody`,{children:un.map((e,t)=>(0,J.jsxs)(`tr`,{className:E(`border-b border-border/25 transition-colors`,t%2==1?`bg-muted/35`:`bg-transparent`,`hover:bg-primary/4`),children:[(0,J.jsx)(`td`,{className:`px-3 py-2 align-middle sm:px-3.5`,children:(0,J.jsx)(Y,{className:`h-5 w-13 rounded-[var(--miravo-radius-tight)]`})}),(0,J.jsx)(`td`,{className:`px-3 py-2 align-middle sm:px-3.5`,children:(0,J.jsx)(Y,{className:`h-3.5 w-16 font-mono`})}),(0,J.jsx)(`td`,{className:`max-w-[min(16rem,28vw)] px-3 py-2 align-middle sm:max-w-xs sm:px-3.5`,children:(0,J.jsx)(Y,{className:`h-3.5 w-full max-w-48 font-mono`})}),(0,J.jsx)(`td`,{className:`hidden px-3 py-2 align-middle sm:table-cell sm:px-3.5`,children:(0,J.jsx)(Y,{className:`h-3.5 w-10 font-mono`})}),(0,J.jsx)(`td`,{className:`hidden max-w-xs px-3 py-2 align-middle md:table-cell md:px-3.5`,children:(0,J.jsx)(Y,{className:`h-3.5 w-full max-w-40`})})]},e))})]})}),(0,J.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-border/40 px-3 py-3 text-[10px] text-muted-foreground sm:flex-row sm:items-center sm:justify-between sm:gap-4 sm:px-4`,children:[(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,J.jsx)(Y,{className:`inline-block h-3 w-6 rounded-[var(--miravo-radius-tight)]`}),(0,J.jsx)(Y,{className:`inline-block h-3 w-28`})]}),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 font-mono text-[10px] wrap-anywhere`,children:[(0,J.jsx)(Y,{className:`h-2.5 w-8 shrink-0`}),(0,J.jsx)(Y,{className:`h-6 min-w-32 rounded-[var(--miravo-radius-tight)] border border-border/50 px-2 py-0.5`}),(0,J.jsx)(Y,{className:`h-1 w-1 shrink-0 rounded-full`}),(0,J.jsx)(Y,{className:`h-2.5 w-10 shrink-0`}),(0,J.jsx)(Y,{className:`h-3 min-w-16 max-w-56 flex-1`})]})]})]})}function fn({stream:e,className:t}){let n=Jt(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,J.jsxs)(`span`,{className:E(`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,J.jsx)(S,{className:`size-3 shrink-0 opacity-95`,strokeWidth:2.5,"aria-hidden":!0}):a?(0,J.jsx)(ge,{className:`size-3 shrink-0 opacity-95`,"aria-hidden":!0}):i?(0,J.jsx)(ue,{className:`size-3 shrink-0 opacity-95`,"aria-hidden":!0}):(0,J.jsx)(B,{className:`size-3 shrink-0 animate-spin`,"aria-hidden":!0}),n]})}var pn={status:`idle`,operation:null,error:null,logs:[],cancelRequested:!1},mn=200;function hn(){let[e,t]=(0,q.useState)(pn),n=(0,q.useRef)(null),r=(0,q.useRef)(0),i=m(),a=(0,q.useRef)(0),o=(0,q.useCallback)(e=>{let n=me(e,`Integration operation failed.`),r=he(e),i=r?`${n} ${r}`:n;t(e=>({...e,status:`error`,cancelRequested:!1,error:i,operation:e.operation?{...e.operation,status:`error`,error:i}:null}))},[]),s=(0,q.useCallback)(e=>{switch(e.event){case`accepted`:gn(e.data,t);break;case`log`:vn({...e.data,id:`log-${r.current++}`},t);break;case`started`:yn(e.data,t);break;case`phase`:bn(e.data,t);break;case`resource`:xn(e.data,t);break;case`complete`:Sn(e.data,t);break;case`cancelled`:wn(e.data,t);break;case`retrying`:Tn(e.data,t);break;case`error`:o(Error(e.data.message));break}},[o]),c=(0,q.useCallback)(e=>{let c=++a.current;n.current?.abort(),r.current=0,t({status:`running`,operation:null,error:null,logs:[],cancelRequested:!1}),n.current=Gt(e,e=>{a.current===c&&(s(e),En(e)&&(i.invalidateQueries({queryKey:f.integrations.targets()}),n.current?.abort(),n.current=null))},e=>{a.current===c&&(n.current=null,o(e))})},[s,o,i]),l=(0,q.useCallback)(e=>{let i=++a.current;n.current?.abort(),r.current=0,t({status:`running`,operation:null,error:null,logs:[],cancelRequested:!1}),n.current=Kt(e,e=>{a.current===i&&(s(e),En(e)&&(n.current?.abort(),n.current=null))},e=>{a.current===i&&(n.current=null,o(e))})},[s,o]),u=(0,q.useCallback)(()=>{a.current++,n.current?.abort(),n.current=null,t(pn)},[]),d=(0,q.useCallback)(async()=>{let n=e.operation?.operationId;if(!(!n||e.status!==`running`||e.cancelRequested)){t(e=>Cn(e,n));try{await Wt(n)||o(Error(`Operation finished before cancellation was accepted.`))}catch(e){o(e instanceof Error?e:Error(`Cancellation failed.`))}}},[e.operation?.operationId,e.status,e.cancelRequested,o]);return(0,q.useEffect)(()=>()=>{a.current++,n.current?.abort(),n.current=null},[]),{...e,startApply:c,startCleanup:l,reset:u,cancel:d}}function gn(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`),targetLabel:e.targetId??`Resolving target`,totalPlanned:0,phases:[],applied:0,failed:0,status:`running`,startedAt:Date.now()}}))}function _n(e){return(e.template??e.model)||(e.type===`cleanup`?`All managed resources`:`unknown`)}function vn(e,t){t(t=>({...t,logs:[...t.logs,e].slice(-mn)}))}function yn(e,t){t(t=>({...t,status:`running`,cancelRequested:!1,error:null,operation:{operationId:e.operationId,type:e.type,label:_n(e),targetLabel:e.targetLabel,totalPlanned:e.totalPlanned,phases:[],applied:0,failed:0,status:`running`,startedAt:Date.now(),attempt:e.attempt,maxAttempts:e.maxAttempts}}))}function bn(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 xn(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 Sn(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 Cn(e,t){return!$(e,t)||e.status!==`running`?e:{...e,cancelRequested:!0}}function wn(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 Tn(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 En(e){return e.event===`complete`||e.event===`cancelled`||e.event===`error`}export{Ke as A,Qe as C,Ze as D,Xe as E,Te as F,we as I,Ce as L,je as M,De as N,qe as O,Ee as P,ye as R,$e as S,Ye as T,kt as _,nn as a,Et as b,Lt as c,It as d,Ht as f,Nt as g,Ft as h,dn as i,Ae as j,He as k,zt as l,Rt as m,fn as n,tn as o,Vt as p,ln as r,Yt as s,hn as t,Ut as u,Ot as v,X as w,it as x,Dt as y};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/fleet-CBXZ0Xts.js","assets/fleet-CRB8-QDg.js","assets/rolldown-runtime-COnpUsM8.js","assets/chunk-OE4NN4TA-DBWZidbW.js","assets/vendor-charts-95ykyDlI.js","assets/api-DdyA1QMC.js","assets/vendor-ui-CWUk2ulb.js","assets/format-6q8Tnwmn.js","assets/utils-XFKvwlFT.js","assets/arrow-right-BjBb4z7g.js","assets/arrow-up-down-C1oJAmrw.js","assets/select-Cg2u0NQI.js","assets/circle-question-mark-CJvcT6V6.js","assets/dist-xY0pK9Wy.js","assets/shallow-Cin0mLuv.js","assets/badge-DuuEINVl.js","assets/combobox-B5iFVe7N.js","assets/select-display-items-BEVMAho-.js","assets/tooltip-D1ydB4g3.js","assets/transition-types-CPlGtM8w.js","assets/catalog-CdbAE0Ki.js","assets/catalog-Ca9rhNLN.js","assets/query-fetch-error-ytmF7SP9.js","assets/AnimatePresence-CPmH1DMY.js","assets/proxy-Be4WzmcS.js","assets/use-integration-stream-CFkuEB9r.js","assets/integration-targets-ChYQ8POe.js","assets/tabs-BJs5Kci7.js","assets/copy-button-RVCJ3aqM.js","assets/checkbox-BL44aFel.js","assets/triangle-alert-BXrJNk3g.js","assets/label-DTHSKF2S.js","assets/get-error-message-BowDodwy.js","assets/catalog-template-icons-aec8m5-A.js","assets/catalog-source-CPFWtBJF.js","assets/download-DmUZKo9N.js","assets/use-engine-command-mutation-OZ8_Roso.js","assets/runtime-link-D-uJbw97.js","assets/models-CgWCVmnx.js","assets/models-BDeOqKQk.js","assets/activity-Cy_niK56.js","assets/spawn-protocol-scope-picker-DDi-hZwj.js","assets/events-D5uZ2cwr.js","assets/events-Bp3BqWYo.js","assets/auth-screen-backdrop-CgwRhIbi.js","assets/control-DYdEZmP0.js","assets/control-CtvncuAA.js","assets/validation-BvXCKp12.js","assets/layers-1figUpjG.js","assets/transition-nav-link-Crj9XTbK.js","assets/tags-CcmWc8Xj.js","assets/tags-DnyhyxDB.js","assets/vendor-table-BAHQgdwg.js","assets/dropdown-menu-82O7jPU6.js","assets/integrations-D4x6ee5M.js","assets/integrations-BrZWbG5Q.js","assets/asset-detail-D-coMgED.js","assets/login-O9dnrHI9.js"])))=>i.map(i=>d[i]);
2
- import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{c as n,d as r}from"./chunk-OE4NN4TA-DBWZidbW.js";var i=e(t(),1),a=[{test:e=>e===`/`,load:()=>r(()=>import(`./fleet-CBXZ0Xts.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]))},{test:e=>e===`/catalog`,load:()=>r(()=>import(`./catalog-CdbAE0Ki.js`),__vite__mapDeps([20,21,2,5,4,6,22,7,8,23,24,25,11,26,27,12,28,18,29,30,15,31,32,33,34,35,36,37]))},{test:e=>e===`/models`,load:()=>r(()=>import(`./models-CgWCVmnx.js`),__vite__mapDeps([38,39,2,5,4,6,22,7,8,23,24,40,25,11,26,27,12,28,18,29,30,15,31,32,34,35,36,37,41]))},{test:e=>e===`/events`,load:()=>r(()=>import(`./events-D5uZ2cwr.js`),__vite__mapDeps([42,43,2,3,4,5,6,22,7,8,23,24,11,44,15,16,17,32,37,19]))},{test:e=>e===`/control`,load:()=>r(()=>import(`./control-DYdEZmP0.js`),__vite__mapDeps([45,46,2,5,4,6,7,8,23,24,40,9,11,27,28,18,47,29,48,36,37,30,13,14,41,31,49,3,15,16]))},{test:e=>e===`/tags`,load:()=>r(()=>import(`./tags-CcmWc8Xj.js`),__vite__mapDeps([50,51,2,3,4,5,6,22,7,8,52,10,11,26,28,18,35,13,44,16,53,31,32]))},{test:e=>e===`/integrations`,load:()=>r(()=>import(`./integrations-D4x6ee5M.js`),__vite__mapDeps([54,55,2,3,4,5,6,22,7,8,23,24,40,9,25,11,26,27,12,28,18,29,30,15,31,32,33,48,13,53]))},{test:e=>e.startsWith(`/asset/`),load:()=>r(()=>import(`./asset-detail-D-coMgED.js`),__vite__mapDeps([56,2,3,4,5,6,22,7,8,24,40,27,28,18,47,36,37,30,13,44,15,32,19]))},{test:e=>e===`/login`,load:()=>r(()=>import(`./login-O9dnrHI9.js`),__vite__mapDeps([57,2,5,4,6,49,3,32]))}],o=new Set;function s(e){if(!e.startsWith(`/`))return null;let t=e.indexOf(`?`),n=e.indexOf(`#`),r=t===-1?n===-1?e.length:n:n===-1?t:Math.min(t,n);return e.slice(0,r)}function c(e){let t=s(e);if(!t||o.has(t))return;let n=a.find(e=>e.test(t));n&&(o.add(t),n.load().catch(()=>{o.delete(t)}))}function l(){let e=n();return(0,i.useCallback)((t,n)=>{n?.preload!==!1&&c(t),(0,i.startTransition)(()=>{n?.transitionType&&(0,i.addTransitionType)(n.transitionType),e(t,{replace:n?.replace})})},[e])}export{c as n,l as t};
@@ -1 +0,0 @@
1
- import{at as e,et as t}from"./vendor-ui-CWUk2ulb.js";import{$ as n,N as r,Q as i,k as a,tt as o}from"./api-DdyA1QMC.js";import{l as s}from"./copy-button-RVCJ3aqM.js";import{n as c,t as l}from"./utils-XFKvwlFT.js";import"./tabs-BJs5Kci7.js";var u=c(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),d=c(`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`}]]),f=e();function p({className:e,orientation:n=`horizontal`,...r}){return(0,f.jsx)(t,{"data-slot":`separator`,orientation:n,className:l(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,e),...r})}function m(){return o().trim().optional().refine(e=>e===void 0||e===``||e.length<=120,{message:`Use at most 120 characters.`}).refine(e=>e===void 0||e===``||r(e)===null,{message:`Use letters, numbers, underscores, and hyphens only.`})}var h=n({multiplier:i({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.`)}),g=n({model:o().min(1,`Model is required.`),count:i({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.`),assetName:m(),assetPrefix:m(),protocolScope:a.optional()}),_=n({assetId:o().min(1,`Asset is required.`),fault:o().min(1,`Fault name is required.`)}),v=n({assetId:o().min(1,`Asset is required.`)});function y(e,t,n){if(!t.trim())return s.error(`Argument "${e}" is required.`),null;switch(n){case`Double`:case`Float`:{let n=Number(t);return Number.isFinite(n)?{value:n}:(s.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)?(s.error(`"${e}" must be a valid integer.`),null):(n===`UInt16`||n===`UInt32`)&&r<0?(s.error(`"${e}" must be non-negative.`),null):{value:r}}case`Boolean`:return t!==`true`&&t!==`false`?(s.error(`"${e}" must be "true" or "false".`),null):{value:t===`true`};case`String`:return{value:t};default:return{value:t}}}function b(e,t){let n=e.safeParse(t);return n.success?n.data:(s.error(n.error.issues[0]?.message??`Validation error.`),null)}export{b as a,d as c,g as i,u as l,v as n,y as o,h as r,p as s,_ as t};