@miravo/cli-linux-x64 0.6.2 → 0.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/console-dist/assets/api-BjnU1LXi.js +1 -0
  2. package/console-dist/assets/catalog-BGQVa6B3.js +1 -0
  3. package/console-dist/assets/catalog-DEAID15Z.js +1 -0
  4. package/console-dist/assets/control-B_Mo9qMu.js +1 -0
  5. package/console-dist/assets/control-ahMsWPz4.js +1 -0
  6. package/console-dist/assets/copy-button-DYqJP5N8.js +1 -0
  7. package/console-dist/assets/{deploy-tab-zi4NXsfj.js → deploy-tab-BRET5egR.js} +1 -1
  8. package/console-dist/assets/{events-CfrhnDG_.js → events-B2IxlA63.js} +1 -1
  9. package/console-dist/assets/events-rhPd7QcZ.js +1 -0
  10. package/console-dist/assets/{fleet-CcdFCWOI.js → fleet-CF_yW3Xe.js} +1 -1
  11. package/console-dist/assets/fleet-DbMmYTAW.js +1 -0
  12. package/console-dist/assets/{get-error-message-DhCjoSSJ.js → get-error-message-BzBOywwk.js} +1 -1
  13. package/console-dist/assets/{index-DVW3M0iW.js → index-JB69yOxP.js} +3 -3
  14. package/console-dist/assets/{instance-detail-bpv-KYmO.js → instance-detail-4eUBkrXG.js} +1 -1
  15. package/console-dist/assets/{login-DV1Fd0nK.js → login-B7ZXWxuU.js} +2 -2
  16. package/console-dist/assets/models-BUJkHhCT.js +1 -0
  17. package/console-dist/assets/{models-BbWAxRFR.js → models-DeByQ5rq.js} +1 -1
  18. package/console-dist/assets/platforms-Caq2eqh-.js +1 -0
  19. package/console-dist/assets/{platforms-Dq6BGck6.js → platforms-DjGsPZpq.js} +1 -1
  20. package/console-dist/assets/route-preload-DZpMivUv.js +2 -0
  21. package/console-dist/assets/{tags-DZpOeuyx.js → tags-CL_-O-ZZ.js} +1 -1
  22. package/console-dist/assets/tags-DEKAj0l-.js +1 -0
  23. package/console-dist/assets/{transition-nav-link-B89fDRXR.js → transition-nav-link-99H9mlJO.js} +1 -1
  24. package/console-dist/assets/{use-engine-command-mutation-DTvKLMBg.js → use-engine-command-mutation--eob_QrP.js} +1 -1
  25. package/console-dist/assets/{use-platform-stream-BZTQlkbS.js → use-platform-stream-ScJV0xv8.js} +1 -1
  26. package/console-dist/assets/{use-transition-navigate-CG8tHeYN.js → use-transition-navigate-Dp3qkQ87.js} +1 -1
  27. package/console-dist/assets/{validation-CyzCfw_2.js → validation-BTuAJAb2.js} +1 -1
  28. package/console-dist/index.html +18 -18
  29. package/miravo +0 -0
  30. package/nodesets/.ignore +1 -0
  31. package/nodesets/1.02/FTNIR.NodeSet2.xml +819 -0
  32. package/nodesets/1.02/Opc.Ua.Adi.NodeSet2.xml +8301 -0
  33. package/nodesets/1.02/Opc.Ua.Di.NodeSet2.xml +1785 -0
  34. package/nodesets/Opc.ISA95.NodeSet2.xml +3589 -0
  35. package/nodesets/Opc.Ua.AMB.NodeSet2.xml +1395 -0
  36. package/nodesets/Opc.Ua.Adi.NodeSet2.xml +8301 -0
  37. package/nodesets/Opc.Ua.Adi.Types.xsd +104 -0
  38. package/nodesets/Opc.Ua.AutoID.NodeSet2.xml +6062 -0
  39. package/nodesets/Opc.Ua.CNC.NodeSet.xml +15875 -0
  40. package/nodesets/Opc.Ua.CommercialKitchenEquipment.NodeSet2.xml +12096 -0
  41. package/nodesets/Opc.Ua.Di.NodeSet2.xml +6042 -0
  42. package/nodesets/Opc.Ua.Di.Types.xsd +161 -0
  43. package/nodesets/Opc.Ua.Eumabois.Nodeset2.xml +2483 -0
  44. package/nodesets/Opc.Ua.Gds.NodeSet2.xml +8282 -0
  45. package/nodesets/Opc.Ua.Glass.NodeSet2.xml +5100 -0
  46. package/nodesets/Opc.Ua.IA.NodeSet2.xml +1782 -0
  47. package/nodesets/Opc.Ua.IOLink.NodeSet2.xml +4374 -0
  48. package/nodesets/Opc.Ua.IOLinkIODD.NodeSet2.xml +139 -0
  49. package/nodesets/Opc.Ua.IRDI.NodeSet2.xml +2243 -0
  50. package/nodesets/Opc.Ua.Ijt.Base.NodeSet2.xml +19459 -0
  51. package/nodesets/Opc.Ua.Ijt.Tightening.NodeSet2.xml +883 -0
  52. package/nodesets/Opc.Ua.LADS.NodeSet2.xml +7086 -0
  53. package/nodesets/Opc.Ua.MachineTool.NodeSet2.xml +7884 -0
  54. package/nodesets/Opc.Ua.MachineVision.NodeSet2.xml +17324 -0
  55. package/nodesets/Opc.Ua.Machinery.Jobs.Nodeset2.xml +1249 -0
  56. package/nodesets/Opc.Ua.Machinery.NodeSet2.xml +2099 -0
  57. package/nodesets/Opc.Ua.Machinery.ProcessValues.NodeSet2.xml +1858 -0
  58. package/nodesets/Opc.Ua.Machinery_Result.NodeSet2.xml +2640 -0
  59. package/nodesets/Opc.Ua.MetalForming.NodeSet2.xml +1577 -0
  60. package/nodesets/Opc.Ua.NodeSet2.xml +81975 -0
  61. package/nodesets/Opc.Ua.PADIM.NodeSet2.xml +14131 -0
  62. package/nodesets/Opc.Ua.PackML.NodeSet2.xml +3030 -0
  63. package/nodesets/Opc.Ua.Robotics.NodeSet2.xml +7409 -0
  64. package/nodesets/Opc.Ua.Scales.NodeSet2.xml +15817 -0
  65. package/nodesets/Opc.Ua.Types.bsd +3499 -0
  66. package/nodesets/Opc.Ua.Weihenstephan.NodeSet2.xml +821 -0
  67. package/nodesets/Opc.Ua.Woodworking.NodeSet2.xml +17831 -0
  68. package/nodesets/UANodeSet.xsd +497 -0
  69. package/nodesets/opc.ua.isa95-jobcontrol.nodeset2.xml +4594 -0
  70. package/package.json +3 -2
  71. package/console-dist/assets/api-Bef9FEIU.js +0 -1
  72. package/console-dist/assets/catalog-BKhsnMBa.js +0 -1
  73. package/console-dist/assets/catalog-Ia1pbi0U.js +0 -1
  74. package/console-dist/assets/control-M9POk7sD.js +0 -1
  75. package/console-dist/assets/control-xSKU0dgF.js +0 -1
  76. package/console-dist/assets/copy-button-BK3jqKBZ.js +0 -1
  77. package/console-dist/assets/events-BRekhc6s.js +0 -1
  78. package/console-dist/assets/fleet-Bk6J6tiE.js +0 -1
  79. package/console-dist/assets/models-BOPuZsyi.js +0 -1
  80. package/console-dist/assets/platforms-H2Z4z-EX.js +0 -1
  81. package/console-dist/assets/route-preload-CMl-AryU.js +0 -2
  82. package/console-dist/assets/tags-nAOAgZzI.js +0 -1
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{s as t}from"./vendor-charts-CAZdaPlq.js";import{B as n,G as r,H as i,K as a,U as o,V as s,W as c,at as l,ot as u}from"./vendor-ui-mizMYESS.js";import{n as d,t as f}from"./createLucideIcon-Yddw9eHa.js";import{i as p,n as m,t as ee}from"./tooltip-TtanriwA.js";import{a as h,n as g,o as _}from"./input-BCiRHEmc.js";var v=l(),y=e(t(),1),b=e(u(),1);function x(e){if(!e||typeof document>`u`)return;let t=document.head||document.getElementsByTagName(`head`)[0],n=document.createElement(`style`);n.type=`text/css`,t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}var S=e=>{switch(e){case`success`:return T;case`info`:return te;case`warning`:return E;case`error`:return D;default:return null}},C=Array(12).fill(0),w=({visible:e,className:t})=>y.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},y.createElement(`div`,{className:`sonner-spinner`},C.map((e,t)=>y.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),T=y.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},y.createElement(`path`,{fillRule:`evenodd`,d:`M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z`,clipRule:`evenodd`})),E=y.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,height:`20`,width:`20`},y.createElement(`path`,{fillRule:`evenodd`,d:`M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z`,clipRule:`evenodd`})),te=y.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},y.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z`,clipRule:`evenodd`})),D=y.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},y.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z`,clipRule:`evenodd`})),O=y.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`},y.createElement(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),y.createElement(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})),ne=()=>{let[e,t]=y.useState(document.hidden);return y.useEffect(()=>{let e=()=>{t(document.hidden)};return document.addEventListener(`visibilitychange`,e),()=>window.removeEventListener(`visibilitychange`,e)},[]),e},k=1,A=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{let{message:t,...n}=e,r=typeof e?.id==`number`||e.id?.length>0?e.id:k++,i=this.toasts.find(e=>e.id===r),a=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(r)&&this.dismissedToasts.delete(r),i?this.toasts=this.toasts.map(n=>n.id===r?(this.publish({...n,...e,id:r,title:t}),{...n,...e,id:r,dismissible:a,title:t}):n):this.addToast({title:t,...n,dismissible:a,id:r}),r},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(t=>t({id:e,dismiss:!0})))):this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:`error`}),this.success=(e,t)=>this.create({...t,type:`success`,message:e}),this.info=(e,t)=>this.create({...t,type:`info`,message:e}),this.warning=(e,t)=>this.create({...t,type:`warning`,message:e}),this.loading=(e,t)=>this.create({...t,type:`loading`,message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:`loading`,message:t.loading,description:typeof t.description==`function`?void 0:t.description}));let r=Promise.resolve(e instanceof Function?e():e),i=n!==void 0,a,o=r.then(async e=>{if(a=[`resolve`,e],y.isValidElement(e))i=!1,this.create({id:n,type:`default`,message:e});else if(M(e)&&!e.ok){i=!1;let r=typeof t.error==`function`?await t.error(`HTTP error! status: ${e.status}`):t.error,a=typeof t.description==`function`?await t.description(`HTTP error! status: ${e.status}`):t.description,o=typeof r==`object`&&!y.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(e instanceof Error){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!y.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(t.success!==void 0){i=!1;let r=typeof t.success==`function`?await t.success(e):t.success,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!y.isValidElement(r)?r:{message:r};this.create({id:n,type:`success`,description:a,...o})}}).catch(async e=>{if(a=[`reject`,e],t.error!==void 0){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!y.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}}).finally(()=>{i&&(this.dismiss(n),n=void 0),t.finally==null||t.finally.call(t)}),s=()=>new Promise((e,t)=>o.then(()=>a[0]===`reject`?t(a[1]):e(a[1])).catch(t));return typeof n!=`string`&&typeof n!=`number`?{unwrap:s}:Object.assign(n,{unwrap:s})},this.custom=(e,t)=>{let n=t?.id||k++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},j=(e,t)=>{let n=t?.id||k++;return A.addToast({title:e,...t,id:n}),n},M=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,N=Object.assign(j,{success:A.success,info:A.info,warning:A.warning,error:A.error,custom:A.custom,message:A.message,promise:A.promise,dismiss:A.dismiss,loading:A.loading},{getHistory:()=>A.toasts,getToasts:()=>A.getActiveToasts()});x(`[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}`);function P(e){return e.label!==void 0}var F=3,I=`24px`,L=`16px`,R=4e3,z=356,re=14,ie=45,ae=200;function B(...e){return e.filter(Boolean).join(` `)}function oe(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}var se=e=>{let{invert:t,toast:n,unstyled:r,interacting:i,setHeights:a,visibleToasts:o,heights:s,index:c,toasts:l,expanded:u,removeToast:d,defaultRichColors:f,closeButton:p,style:m,cancelButtonStyle:ee,actionButtonStyle:h,className:g=``,descriptionClassName:_=``,duration:v,position:b,gap:x,expandByDefault:C,classNames:T,icons:E,closeButtonAriaLabel:te=`Close toast`}=e,[D,k]=y.useState(null),[A,j]=y.useState(null),[M,N]=y.useState(!1),[F,I]=y.useState(!1),[L,z]=y.useState(!1),[re,se]=y.useState(!1),[V,H]=y.useState(!1),[ce,U]=y.useState(0),[le,W]=y.useState(0),G=y.useRef(n.duration||v||R),K=y.useRef(null),q=y.useRef(null),ue=c===0,de=c+1<=o,J=n.type,Y=n.dismissible!==!1,fe=n.className||``,pe=n.descriptionClassName||``,X=y.useMemo(()=>s.findIndex(e=>e.toastId===n.id)||0,[s,n.id]),me=y.useMemo(()=>n.closeButton??p,[n.closeButton,p]),he=y.useMemo(()=>n.duration||v||R,[n.duration,v]),ge=y.useRef(0),Z=y.useRef(0),_e=y.useRef(0),Q=y.useRef(null),[ve,ye]=b.split(`-`),be=y.useMemo(()=>s.reduce((e,t,n)=>n>=X?e:e+t.height,0),[s,X]),xe=ne(),Se=n.invert||t,Ce=J===`loading`;Z.current=y.useMemo(()=>X*x+be,[X,be]),y.useEffect(()=>{G.current=he},[he]),y.useEffect(()=>{N(!0)},[]),y.useEffect(()=>{let e=q.current;if(e){let t=e.getBoundingClientRect().height;return W(t),a(e=>[{toastId:n.id,height:t,position:n.position},...e]),()=>a(e=>e.filter(e=>e.toastId!==n.id))}},[a,n.id]),y.useLayoutEffect(()=>{if(!M)return;let e=q.current,t=e.style.height;e.style.height=`auto`;let r=e.getBoundingClientRect().height;e.style.height=t,W(r),a(e=>e.find(e=>e.toastId===n.id)?e.map(e=>e.toastId===n.id?{...e,height:r}:e):[{toastId:n.id,height:r,position:n.position},...e])},[M,n.title,n.description,a,n.id,n.jsx,n.action,n.cancel]);let $=y.useCallback(()=>{I(!0),U(Z.current),a(e=>e.filter(e=>e.toastId!==n.id)),setTimeout(()=>{d(n)},ae)},[n,d,a,Z]);y.useEffect(()=>{if(n.promise&&J===`loading`||n.duration===1/0||n.type===`loading`)return;let e;return u||i||xe?(()=>{if(_e.current<ge.current){let e=new Date().getTime()-ge.current;G.current-=e}_e.current=new Date().getTime()})():G.current!==1/0&&(ge.current=new Date().getTime(),e=setTimeout(()=>{n.onAutoClose==null||n.onAutoClose.call(n,n),$()},G.current)),()=>clearTimeout(e)},[u,i,n,J,xe,$]),y.useEffect(()=>{n.delete&&($(),n.onDismiss==null||n.onDismiss.call(n,n))},[$,n.delete]);function we(){return E?.loading?y.createElement(`div`,{className:B(T?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":J===`loading`},E.loading):y.createElement(w,{className:B(T?.loader,n?.classNames?.loader),visible:J===`loading`})}let Te=n.icon||E?.[J]||S(J);return y.createElement(`li`,{tabIndex:0,ref:q,className:B(g,fe,T?.toast,n?.classNames?.toast,T?.default,T?.[J],n?.classNames?.[J]),"data-sonner-toast":``,"data-rich-colors":n.richColors??f,"data-styled":!(n.jsx||n.unstyled||r),"data-mounted":M,"data-promise":!!n.promise,"data-swiped":V,"data-removed":F,"data-visible":de,"data-y-position":ve,"data-x-position":ye,"data-index":c,"data-front":ue,"data-swiping":L,"data-dismissible":Y,"data-type":J,"data-invert":Se,"data-swipe-out":re,"data-swipe-direction":A,"data-expanded":!!(u||C&&M),"data-testid":n.testId,style:{"--index":c,"--toasts-before":c,"--z-index":l.length-c,"--offset":`${F?ce:Z.current}px`,"--initial-height":C?`auto`:`${le}px`,...m,...n.style},onDragEnd:()=>{z(!1),k(null),Q.current=null},onPointerDown:e=>{e.button!==2&&(Ce||!Y||(K.current=new Date,U(Z.current),e.target.setPointerCapture(e.pointerId),e.target.tagName!==`BUTTON`&&(z(!0),Q.current={x:e.clientX,y:e.clientY})))},onPointerUp:()=>{if(re||!Y)return;Q.current=null;let e=Number(q.current?.style.getPropertyValue(`--swipe-amount-x`).replace(`px`,``)||0),t=Number(q.current?.style.getPropertyValue(`--swipe-amount-y`).replace(`px`,``)||0),r=new Date().getTime()-K.current?.getTime(),i=D===`x`?e:t,a=Math.abs(i)/r;if(Math.abs(i)>=ie||a>.11){U(Z.current),n.onDismiss==null||n.onDismiss.call(n,n),j(D===`x`?e>0?`right`:`left`:t>0?`down`:`up`),$(),se(!0);return}else{var o,s;(o=q.current)==null||o.style.setProperty(`--swipe-amount-x`,`0px`),(s=q.current)==null||s.style.setProperty(`--swipe-amount-y`,`0px`)}H(!1),z(!1),k(null)},onPointerMove:t=>{var n,r;if(!Q.current||!Y||window.getSelection()?.toString().length>0)return;let i=t.clientY-Q.current.y,a=t.clientX-Q.current.x,o=e.swipeDirections??oe(b);!D&&(Math.abs(a)>1||Math.abs(i)>1)&&k(Math.abs(a)>Math.abs(i)?`x`:`y`);let s={x:0,y:0},c=e=>1/(1.5+Math.abs(e)/20);if(D===`y`){if(o.includes(`top`)||o.includes(`bottom`))if(o.includes(`top`)&&i<0||o.includes(`bottom`)&&i>0)s.y=i;else{let e=i*c(i);s.y=Math.abs(e)<Math.abs(i)?e:i}}else if(D===`x`&&(o.includes(`left`)||o.includes(`right`)))if(o.includes(`left`)&&a<0||o.includes(`right`)&&a>0)s.x=a;else{let e=a*c(a);s.x=Math.abs(e)<Math.abs(a)?e:a}(Math.abs(s.x)>0||Math.abs(s.y)>0)&&H(!0),(n=q.current)==null||n.style.setProperty(`--swipe-amount-x`,`${s.x}px`),(r=q.current)==null||r.style.setProperty(`--swipe-amount-y`,`${s.y}px`)}},me&&!n.jsx&&J!==`loading`?y.createElement(`button`,{"aria-label":te,"data-disabled":Ce,"data-close-button":!0,onClick:Ce||!Y?()=>{}:()=>{$(),n.onDismiss==null||n.onDismiss.call(n,n)},className:B(T?.closeButton,n?.classNames?.closeButton)},E?.close??O):null,(J||n.icon||n.promise)&&n.icon!==null&&(E?.[J]!==null||n.icon)?y.createElement(`div`,{"data-icon":``,className:B(T?.icon,n?.classNames?.icon)},n.promise||n.type===`loading`&&!n.icon?n.icon||we():null,n.type===`loading`?null:Te):null,y.createElement(`div`,{"data-content":``,className:B(T?.content,n?.classNames?.content)},y.createElement(`div`,{"data-title":``,className:B(T?.title,n?.classNames?.title)},n.jsx?n.jsx:typeof n.title==`function`?n.title():n.title),n.description?y.createElement(`div`,{"data-description":``,className:B(_,pe,T?.description,n?.classNames?.description)},typeof n.description==`function`?n.description():n.description):null),y.isValidElement(n.cancel)?n.cancel:n.cancel&&P(n.cancel)?y.createElement(`button`,{"data-button":!0,"data-cancel":!0,style:n.cancelButtonStyle||ee,onClick:e=>{P(n.cancel)&&Y&&(n.cancel.onClick==null||n.cancel.onClick.call(n.cancel,e),$())},className:B(T?.cancelButton,n?.classNames?.cancelButton)},n.cancel.label):null,y.isValidElement(n.action)?n.action:n.action&&P(n.action)?y.createElement(`button`,{"data-button":!0,"data-action":!0,style:n.actionButtonStyle||h,onClick:e=>{P(n.action)&&(n.action.onClick==null||n.action.onClick.call(n.action,e),!e.defaultPrevented&&$())},className:B(T?.actionButton,n?.classNames?.actionButton)},n.action.label):null)};function V(){if(typeof window>`u`||typeof document>`u`)return`ltr`;let e=document.documentElement.getAttribute(`dir`);return e===`auto`||!e?window.getComputedStyle(document.documentElement).direction:e}function H(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?L:I;function o(e){[`top`,`right`,`bottom`,`left`].forEach(t=>{n[`${i}-${t}`]=typeof e==`number`?`${e}px`:e})}typeof e==`number`||typeof e==`string`?o(e):typeof e==`object`?[`top`,`right`,`bottom`,`left`].forEach(t=>{e[t]===void 0?n[`${i}-${t}`]=a:n[`${i}-${t}`]=typeof e[t]==`number`?`${e[t]}px`:e[t]}):o(a)}),n}var ce=y.forwardRef(function(e,t){let{id:n,invert:r,position:i=`bottom-right`,hotkey:a=[`altKey`,`KeyT`],expand:o,closeButton:s,className:c,offset:l,mobileOffset:u,theme:d=`light`,richColors:f,duration:p,style:m,visibleToasts:ee=F,toastOptions:h,dir:g=V(),gap:_=re,icons:v,containerAriaLabel:x=`Notifications`}=e,[S,C]=y.useState([]),w=y.useMemo(()=>n?S.filter(e=>e.toasterId===n):S.filter(e=>!e.toasterId),[S,n]),T=y.useMemo(()=>Array.from(new Set([i].concat(w.filter(e=>e.position).map(e=>e.position)))),[w,i]),[E,te]=y.useState([]),[D,O]=y.useState(!1),[ne,k]=y.useState(!1),[j,M]=y.useState(d===`system`?typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:d),N=y.useRef(null),P=a.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),I=y.useRef(null),L=y.useRef(!1),R=y.useCallback(e=>{C(t=>(t.find(t=>t.id===e.id)?.delete||A.dismiss(e.id),t.filter(({id:t})=>t!==e.id)))},[]);return y.useEffect(()=>A.subscribe(e=>{if(e.dismiss){requestAnimationFrame(()=>{C(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))});return}setTimeout(()=>{b.flushSync(()=>{C(t=>{let n=t.findIndex(t=>t.id===e.id);return n===-1?[e,...t]:[...t.slice(0,n),{...t[n],...e},...t.slice(n+1)]})})})}),[S]),y.useEffect(()=>{if(d!==`system`){M(d);return}if(d===`system`&&(window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?M(`dark`):M(`light`)),typeof window>`u`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`);try{e.addEventListener(`change`,({matches:e})=>{M(e?`dark`:`light`)})}catch{e.addListener(({matches:e})=>{try{M(e?`dark`:`light`)}catch(e){console.error(e)}})}},[d]),y.useEffect(()=>{S.length<=1&&O(!1)},[S]),y.useEffect(()=>{let e=e=>{if(a.every(t=>e[t]||e.code===t)){var t;O(!0),(t=N.current)==null||t.focus()}e.code===`Escape`&&(document.activeElement===N.current||N.current?.contains(document.activeElement))&&O(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[a]),y.useEffect(()=>{if(N.current)return()=>{I.current&&(I.current.focus({preventScroll:!0}),I.current=null,L.current=!1)}},[N.current]),y.createElement(`section`,{ref:t,"aria-label":`${x} ${P}`,tabIndex:-1,"aria-live":`polite`,"aria-relevant":`additions text`,"aria-atomic":`false`,suppressHydrationWarning:!0},T.map((t,n)=>{let[i,a]=t.split(`-`);return w.length?y.createElement(`ol`,{key:t,dir:g===`auto`?V():g,tabIndex:-1,ref:N,className:c,"data-sonner-toaster":!0,"data-sonner-theme":j,"data-y-position":i,"data-x-position":a,style:{"--front-toast-height":`${E[0]?.height||0}px`,"--width":`${z}px`,"--gap":`${_}px`,...m,...H(l,u)},onBlur:e=>{L.current&&!e.currentTarget.contains(e.relatedTarget)&&(L.current=!1,I.current&&=(I.current.focus({preventScroll:!0}),null))},onFocus:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||L.current||(L.current=!0,I.current=e.relatedTarget)},onMouseEnter:()=>O(!0),onMouseMove:()=>O(!0),onMouseLeave:()=>{ne||O(!1)},onDragEnd:()=>O(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||k(!0)},onPointerUp:()=>k(!1)},w.filter(e=>!e.position&&n===0||e.position===t).map((n,i)=>y.createElement(se,{key:n.id,icons:v,index:i,toast:n,defaultRichColors:f,duration:h?.duration??p,className:h?.className,descriptionClassName:h?.descriptionClassName,invert:r,visibleToasts:ee,closeButton:h?.closeButton??s,interacting:ne,position:t,style:h?.style,unstyled:h?.unstyled,classNames:h?.classNames,cancelButtonStyle:h?.cancelButtonStyle,actionButtonStyle:h?.actionButtonStyle,closeButtonAriaLabel:h?.closeButtonAriaLabel,removeToast:R,toasts:w.filter(e=>e.position==n.position),heights:E.filter(e=>e.position==n.position),setHeights:te,expandByDefault:o,gap:_,expanded:D,swipeDirections:e.swipeDirections}))):null}))}),U=f(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]);function le({...e}){return(0,v.jsx)(s,{"data-slot":`dialog`,...e})}function W({...e}){return(0,v.jsx)(i,{"data-slot":`dialog-portal`,...e})}function G({className:e,...t}){return(0,v.jsx)(a,{"data-slot":`dialog-overlay`,className:d(`fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function K({className:e,children:t,showCloseButton:n=!0,...i}){return(0,v.jsxs)(W,{children:[(0,v.jsx)(G,{}),(0,v.jsxs)(o,{"data-slot":`dialog-content`,className:d(`fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-[var(--miravo-radius-stadium-sm)] bg-background p-4 text-sm ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...i,children:[t,n&&(0,v.jsxs)(r,{"data-slot":`dialog-close`,render:(0,v.jsx)(g,{variant:`ghost`,className:`absolute top-2 right-2`,size:`icon-sm`}),children:[(0,v.jsx)(h,{}),(0,v.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function q({className:e,...t}){return(0,v.jsx)(`div`,{"data-slot":`dialog-header`,className:d(`flex flex-col gap-2`,e),...t})}function ue({className:e,showCloseButton:t=!1,children:n,...i}){return(0,v.jsxs)(`div`,{"data-slot":`dialog-footer`,className:d(`-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-[var(--miravo-radius-stadium-sm)] border-t p-4 sm:flex-row sm:justify-end`,e),...i,children:[n,t&&(0,v.jsx)(r,{render:(0,v.jsx)(g,{variant:`outline`}),children:`Close`})]})}function de({className:e,...t}){return(0,v.jsx)(n,{"data-slot":`dialog-title`,className:d(`text-base leading-none font-medium`,e),...t})}function J({className:e,...t}){return(0,v.jsx)(c,{"data-slot":`dialog-description`,className:d(`text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function Y(e,t){if(!t?.body||!t.createElement||typeof t.execCommand!=`function`)return!1;let n=t.createElement(`textarea`),r=t.activeElement;n.value=e,n.setAttribute(`readonly`,``),n.setAttribute(`aria-hidden`,`true`),n.style.position=`fixed`,n.style.top=`0`,n.style.left=`-9999px`,n.style.opacity=`0`,t.body.appendChild(n),n.focus(),n.select(),n.setSelectionRange(0,n.value.length);try{return t.execCommand(`copy`)}finally{t.body.removeChild(n),r?.focus?.()}}async function fe(e,t=globalThis){let n=t.navigator?.clipboard?.writeText;if(n)try{await n(e);return}catch{if(Y(e,t.document))return;throw Error(`Clipboard write failed`)}if(!Y(e,t.document))throw Error(`Clipboard API unavailable`)}function pe({value:e,label:t=`Copy`,className:n,successMessage:r=`Copied to clipboard`,successDescription:i,tooltipSide:a=`right`,render:o}){let[s,c]=(0,y.useState)(!1),l=(0,y.useRef)(void 0);(0,y.useEffect)(()=>()=>clearTimeout(l.current),[]);let u=(0,y.useCallback)(async t=>{t.stopPropagation();try{await fe(e),c(!0),N.success(r,{description:i}),clearTimeout(l.current),l.current=setTimeout(()=>c(!1),1500)}catch{N.error(`Failed to copy`)}},[i,r,e]),f=s?(0,v.jsx)(_,{className:`size-3 text-success`}):(0,v.jsx)(U,{className:`size-3`}),h=o?.({copied:s,icon:f});return(0,v.jsxs)(ee,{children:[(0,v.jsx)(p,{className:h?void 0:d(`relative inline-flex size-6 items-center justify-center rounded-[var(--miravo-radius-tight)] text-muted-foreground hover:bg-muted hover:text-foreground before:absolute before:inset-[-10px] before:content-['']`,n),onClick:h?void 0:u,closeOnClick:!1,"aria-label":t,render:h,children:f}),(0,v.jsx)(m,{side:a,children:s?`Copied!`:t})]})}export{ue as a,ce as c,J as i,N as l,le as n,q as o,K as r,de as s,pe as t};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{s as t}from"./vendor-charts-CAZdaPlq.js";import{B as n,G as r,H as i,K as a,U as o,V as s,W as c,at as l}from"./vendor-ui-mizMYESS.js";import{_ as u,a as d,i as f,o as ee}from"./api-Bef9FEIU.js";import{a as te,c as ne}from"./get-error-message-DhCjoSSJ.js";import{t as p}from"./proxy-CgM57W61.js";import{t as re}from"./AnimatePresence-CVhkybDC.js";import{a as ie,i as ae,l as m,n as oe,o as se,r as ce,s as le}from"./copy-button-BK3jqKBZ.js";import{n as h,t as g}from"./createLucideIcon-Yddw9eHa.js";import{a as ue,n as _,t as de}from"./input-BCiRHEmc.js";import{_ as fe,a as pe,b as me,c as he,f as ge,g as _e,i as ve,m as ye,p as be,r as xe,x as Se,y as Ce}from"./use-platform-stream-BZTQlkbS.js";import{a as we,c as Te,i as v,n as Ee,o as De,r as Oe,s as ke,t as Ae}from"./select-4wihIkEE.js";import{a as je,i as y,n as Me,r as b,t as Ne}from"./platform-targets-BbVxaqAc.js";import{a as x,o as S}from"./tabs-BgPF8MSY.js";import{t as C}from"./download-BPgKzo-_.js";import{n as Pe}from"./checkbox-Xly18Uyz.js";import{t as Fe}from"./badge-tnWgSITj.js";import{t as w}from"./query-keys-Co1J4HmV.js";import{t as T}from"./label-xIWEC6lW.js";var E=g(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),D=g(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),O=g(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),k=l();function A({...e}){return(0,k.jsx)(s,{"data-slot":`sheet`,...e})}function j({...e}){return(0,k.jsx)(i,{"data-slot":`sheet-portal`,...e})}function M({className:e,...t}){return(0,k.jsx)(a,{"data-slot":`sheet-overlay`,className:h(`fixed inset-0 z-50 bg-black/10 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs`,e),...t})}function N({className:e,children:t,side:n=`right`,showCloseButton:i=!0,...a}){return(0,k.jsxs)(j,{children:[(0,k.jsx)(M,{}),(0,k.jsxs)(o,{"data-slot":`sheet-content`,"data-side":n,className:h(`fixed z-50 flex flex-col gap-4 bg-background bg-clip-padding text-sm shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-[calc(100vw-1rem)] data-[side=left]:max-w-md data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-[calc(100vw-1rem)] data-[side=right]:max-w-xl data-[side=right]:border-l data-[side=right]:pl-1 data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem]`,e),...a,children:[t,i&&(0,k.jsxs)(r,{"data-slot":`sheet-close`,render:(0,k.jsx)(_,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`}),children:[(0,k.jsx)(ue,{}),(0,k.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function P({className:e,...t}){return(0,k.jsx)(`div`,{"data-slot":`sheet-header`,className:h(`flex flex-col gap-0.5 p-2`,e),...t})}function F({className:e,...t}){return(0,k.jsx)(n,{"data-slot":`sheet-title`,className:h(`text-base font-medium text-foreground`,e),...t})}function Ie({className:e,...t}){return(0,k.jsx)(c,{"data-slot":`sheet-description`,className:h(`text-sm text-muted-foreground`,e),...t})}var I=e(t(),1),L=[{value:`opcua`,label:`OPC UA`},{value:`mqtt`,label:`MQTT`},{value:`modbus`,label:`Modbus`}];function Le({value:e,onValueChange:t,labelledBy:n}){return(0,k.jsx)(`fieldset`,{"aria-labelledby":n,className:`min-w-0 border-0 p-0`,children:(0,k.jsx)(`div`,{className:`flex gap-1.5`,children:L.map(n=>{let r=e===n.value;return(0,k.jsx)(`button`,{type:`button`,"aria-pressed":r,onClick:()=>t(n.value),className:h(`flex flex-1 items-center justify-center rounded-[var(--miravo-radius-pill)] border py-1.5 text-center transition-[background-color,border-color,color,box-shadow] duration-200`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/80 focus-visible:ring-offset-2 focus-visible:ring-offset-background`,r?`border-primary/45 bg-primary/10 text-primary shadow-[inset_0_1px_0_0_rgba(255,255,255,0.06),0_0_0_1px_color-mix(in_srgb,var(--primary)_25%,transparent)]`:`border-border/75 bg-background/55 text-foreground/82 hover:border-border/90 hover:bg-background/70 hover:text-foreground/92`),children:(0,k.jsxs)(`span`,{className:`inline-flex items-center justify-center gap-1.5 font-mono text-[11px] font-medium leading-none tracking-wide`,children:[(0,k.jsx)(x,{className:`size-2.5 shrink-0 -translate-y-px opacity-80`,"aria-hidden":!0}),(0,k.jsx)(`span`,{children:n.label})]})},n.value)})})})}var R=`172.17.0.1`;async function Re(e){let t=await d(`/catalog/models/${encodeURIComponent(e)}/le-dt.json`,u.catalogModelLeDt);return JSON.stringify(t,null,2)}async function ze(e,t={host:R}){let n=u.catalogTemplateLeTemplateJson.query;if(!n)throw Error(`Missing query schema for ${u.catalogTemplateLeTemplateJson.method} ${u.catalogTemplateLeTemplateJson.path}`);let r=n.safeParse(t);if(!r.success)throw Error(`Invalid request for ${u.catalogTemplateLeTemplateJson.method} ${u.catalogTemplateLeTemplateJson.path}: ${r.error.message}`);return f(`/catalog/templates/${encodeURIComponent(e)}/le-template.json${Be(r.data)}`,u.catalogTemplateLeTemplateJson)}function Be(e){let t=new URLSearchParams;return e.host&&t.set(`host`,e.host),e.protocol&&t.set(`protocol`,e.protocol),t.size>0?`?${t.toString()}`:``}function z(e){let t=e.split(/[-_]/).filter(e=>e.length>0);return t[t.length-1]??e}function Ve(e){return`${z(e)}-001`}function He(e,t){return[t,...e?.filter(e=>e.id!==t.id)??[]]}async function Ue(e){let t=await e.create();e.onCreated(t);try{await e.refresh()}catch(t){e.onRefreshFailed(t)}}function We(e){return y.find(t=>t.id===e)?.label??e}function Ge(e){return e===`template`?`Litmus Edge Template`:`Litmus Edge Digital Twin`}function Ke({kind:e,id:t,displayName:n,yamlPath:r,yamlFilename:i,stream:a}){let o=ne(),s=te({queryKey:w.platforms.targets(),queryFn:()=>he()}),c=s.data??[],[l,d]=(0,I.useState)(``),[f,g]=(0,I.useState)(`opcua`),[x,E]=(0,I.useState)(`litmus-edge`),[D,O]=(0,I.useState)(!1),[A,j]=(0,I.useState)(!1),[M,N]=(0,I.useState)(b.id),[P,F]=(0,I.useState)({label:``,hostname:``,apiToken:``,sourceHostname:``}),[Ie,L]=(0,I.useState)(!1),[Be,z]=(0,I.useState)(!1),{testing:Ke,runTest:qe,cancelInFlight:Je}=xe(),[Ye,B]=(0,I.useState)(!1),[V,H]=(0,I.useState)(R),[U,Xe]=(0,I.useState)(!1),[W,G]=(0,I.useState)(!1),Ze=(0,I.useId)(),Qe=a.operation?.operationId;(0,I.useEffect)(()=>{G(!1)},[Qe]),(0,I.useEffect)(()=>{A&&(N(b.id),F({label:``,hostname:``,apiToken:``,sourceHostname:``}),L(!1))},[A]);let K=M===b.id&&P.hostname.trim().length>0&&P.sourceHostname.trim().length>0&&P.apiToken.trim().length>0,q=c.find(e=>e.id===l),$e=(0,I.useCallback)(n=>{O(!1),l&&(e===`model`?a.startApply({targetId:l,model:t,protocol:f,scope:n.scope,deviceName:n.deviceName,ifUnmanaged:n.ifUnmanaged}):a.startApply({targetId:l,template:t,scope:n.scope,ifUnmanaged:n.ifUnmanaged}))},[l,t,e,f,a]),et=(0,I.useCallback)(async()=>{if(M!==b.id){m.error(`${We(M)} target setup is coming soon.`);return}if(!P.label||!P.hostname||!P.sourceHostname){m.error(`Label, hostname, and source host are required.`);return}if(!P.apiToken){m.error(`API token is required for new targets.`);return}z(!0);try{await Ue({create:()=>pe({...P,platformId:M}),onCreated:e=>{o.setQueryData(w.platforms.targets(),t=>He(t,e)),d(e.id),j(!1),m.success(`Target added.`)},refresh:async()=>{let e=await s.refetch();if(e.error)throw e.error},onRefreshFailed:e=>{m.error(`Target added, but target list refresh failed.`,{description:e instanceof Error&&e.message?`${e.message} Reload targets before retrying another add.`:`Reload targets before retrying another add.`})}})}catch(e){m.error(e instanceof Error?e.message:`Failed to add target.`)}finally{z(!1)}},[M,P,s,o]),tt=(0,I.useCallback)(()=>{K&&qe({hostname:P.hostname.trim(),sourceHostname:P.sourceHostname.trim(),apiToken:P.apiToken.trim()})},[K,P,qe]),J=x===`source-yaml`,Y=x===`litmus-edge`||J,X=(0,I.useCallback)(async n=>{if(J){try{let t=await ee(r,e===`model`?u.catalogModelYaml:u.catalogTemplateYaml),n=new Blob([t],{type:`text/yaml`}),a=URL.createObjectURL(n),o=document.createElement(`a`);o.href=a,o.download=i,o.click(),URL.revokeObjectURL(a),m.success(`Exported ${i}`)}catch{m.error(`Failed to export YAML`)}return}if(x===`litmus-edge`)try{if(e===`model`){let e=await Re(t),n=new Blob([e],{type:`application/json`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`${t}.le-dt.json`,i.click(),URL.revokeObjectURL(r),m.success(`Exported ${t}.le-dt.json`)}else{let e=n?.templateHost?.trim()??``,r=e.length>0?e:R,i=`${t}.le-template.json`,a=await ze(t,{host:r,protocol:f}),o=URL.createObjectURL(a),s=document.createElement(`a`);s.href=o,s.download=i,s.click(),URL.revokeObjectURL(o),m.success(`Exported ${i}`)}}catch{m.error(`Failed to export platform format`)}},[x,J,e,t,r,i,f]),nt=(0,I.useCallback)(()=>{if(Y){if(x===`litmus-edge`&&e===`template`){H(R),B(!0);return}X()}},[Y,x,e,X]),rt=(0,I.useCallback)(async()=>{Xe(!0);try{await X({templateHost:V}),B(!1)}finally{Xe(!1)}},[V,X]),Z=a.status===`running`,Q=!!l&&!Z,it=!!a.operation||Z,$=it?ve(a):null;return(0,k.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-6 px-1 py-2`,children:[(0,k.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto pr-2`,children:(0,k.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,k.jsx)(`p`,{className:`font-heading text-[11px] font-semibold uppercase tracking-[0.2em] text-foreground`,children:`Deploy`}),(0,k.jsxs)(`div`,{className:`space-y-2`,children:[(0,k.jsx)(T,{className:`font-heading text-[11px] font-medium uppercase tracking-[0.14em] text-foreground/78`,children:`Target`}),(0,k.jsx)(ge,{targets:c,value:l,onValueChange:d,size:`sm`,className:`min-w-0 w-full border-border/65 bg-background/55 text-xs text-foreground`,onAddNew:()=>j(!0)})]}),e===`model`&&c.length>0&&(0,k.jsxs)(`div`,{className:`space-y-2`,children:[(0,k.jsx)(T,{id:Ze,className:`font-heading text-[11px] font-medium uppercase tracking-[0.14em] text-foreground/78`,children:`Protocol binding`}),(0,k.jsx)(Le,{value:f,onValueChange:g,labelledBy:Ze})]}),c.length>0&&(0,k.jsxs)(`button`,{type:`button`,disabled:!Q,onClick:()=>O(!0),className:h(`group flex w-full min-h-14 min-w-0 items-stretch overflow-hidden rounded-[var(--miravo-radius-stadium-lg)] text-left outline-none`,`transition-[border-color,box-shadow,background-color] duration-200 ease-out`,`focus-visible:ring-2 focus-visible:ring-ring/70 focus-visible:ring-offset-2 focus-visible:ring-offset-background`,`disabled:pointer-events-none disabled:opacity-55`,Q?[`border-2 border-primary/40 bg-background`,`bg-linear-to-r from-primary/12 via-background to-background`,`shadow-[inset_0_1px_0_0_rgba(255,255,255,0.025)]`,`hover:border-primary/56 hover:shadow-[inset_0_1px_0_0_rgba(255,255,255,0.025),0_0_14px_-8px_color-mix(in_srgb,var(--primary)_18%,transparent),0_0_22px_-12px_color-mix(in_srgb,var(--primary)_8%,transparent)]`]:[`border border-dashed border-border/65 bg-muted/15`,`hover:bg-muted/22`]),children:[(0,k.jsxs)(`span`,{className:`relative flex w-18 shrink-0 items-center justify-center bg-transparent`,"aria-hidden":!0,children:[(0,k.jsx)(`span`,{className:h(`absolute inset-y-2 -right-px w-px bg-linear-to-b from-transparent via-primary/30 to-transparent opacity-70`,!Q&&`via-border/80`)}),(0,k.jsx)(Pe,{className:h(`relative size-5`,Q?`text-primary`:`text-foreground/75`)})]}),(0,k.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col justify-center gap-0.5 overflow-hidden px-3 py-2.5 sm:px-4`,children:[(0,k.jsx)(`span`,{className:h(`font-heading text-[11px] font-semibold uppercase tracking-[0.16em]`,Q?`text-primary`:`text-foreground/78`),children:Q?`Commit deploy`:Z?`Deploy in progress…`:`Awaiting target`}),(0,k.jsx)(`span`,{className:h(`truncate font-mono text-[13px] leading-tight tracking-tight`,Q?`text-foreground`:`text-foreground/80`),children:q?.label??`Select a target above`})]}),(0,k.jsx)(`span`,{className:h(`flex shrink-0 items-center pr-2.5 sm:pr-3`,Q&&`pl-1`),children:(0,k.jsx)(`span`,{className:h(`flex size-9 items-center justify-center rounded-[var(--miravo-radius-stadium-sm)] border bg-transparent transition-[border-color,color] duration-200`,Q?`border-primary/40 text-primary group-hover:border-primary/55`:`border-border/75 text-foreground/75`),"aria-hidden":!0,children:(0,k.jsx)(je,{className:`size-4`,strokeWidth:2.25})})})]})]})}),(0,k.jsx)(re,{children:it&&$?(0,k.jsx)(ye,{title:$.title,subtitle:$.subtitle,footerAction:Z&&a.operation?.operationId?(0,k.jsx)(_,{variant:`outline`,size:`sm`,disabled:W,"aria-busy":W,className:h(`ml-auto group h-8 gap-1.5 px-3 text-xs`,W?`cursor-not-allowed`:`hover:bg-destructive/12 hover:text-destructive hover:border-destructive/35`),onClick:async()=>{G(!0);try{await a.cancel()}catch{G(!1)}},children:W?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(S,{className:`size-3.5 shrink-0 animate-spin text-muted-foreground`,"aria-hidden":!0}),(0,k.jsx)(p.span,{animate:{opacity:[1,.72,1]},transition:{duration:1.25,repeat:1/0,ease:`easeInOut`},className:`font-medium text-foreground`,children:`Cancelling…`})]}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(ue,{className:`size-3.5 shrink-0 text-foreground/65 group-hover:text-destructive`,"aria-hidden":!0}),(0,k.jsx)(p.span,{animate:{opacity:[1,.88,1]},transition:{duration:2.2,repeat:1/0,ease:`easeInOut`},children:`Cancel`})]})}):(0,k.jsx)(`div`,{className:`ml-auto shrink-0 flex items-center`,children:(0,k.jsx)(_,{type:`button`,variant:`secondary`,size:`xs`,className:`h-7 px-3 text-[10px] font-medium`,onClick:a.reset,children:`Close`})}),onDismiss:a.reset,children:a.operation?(0,k.jsx)(fe,{operation:a.operation,catalogTemplates:[{id:t,name:n}]}):(0,k.jsxs)(`div`,{className:`flex flex-col gap-2 py-1`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,k.jsx)(S,{className:`size-3.5 animate-spin text-primary`,"aria-hidden":!0}),(0,k.jsx)(`span`,{className:`text-xs text-foreground/88`,children:`Connecting to Litmus Edge…`})]}),(0,k.jsx)(`div`,{className:`h-1 w-full overflow-hidden rounded-full bg-muted/40`,children:(0,k.jsx)(p.div,{className:`h-full w-2/5 rounded-full bg-primary`,animate:{x:[`-100%`,`250%`]},transition:{duration:1.2,repeat:1/0,ease:`easeInOut`}})})]})},`deploy-stream`):null}),(0,k.jsxs)(`div`,{className:`flex flex-col gap-4 border-t border-border/40 pt-5`,children:[(0,k.jsx)(`p`,{className:`font-heading text-[11px] font-semibold uppercase tracking-[0.2em] text-foreground`,children:`Export`}),(0,k.jsxs)(`div`,{className:`space-y-2`,children:[(0,k.jsx)(T,{className:`font-heading text-[11px] font-medium uppercase tracking-[0.14em] text-foreground/78`,children:`Format`}),(0,k.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,children:[(0,k.jsxs)(Ae,{value:x,onValueChange:e=>{e&&E(e)},children:[(0,k.jsx)(ke,{size:`sm`,className:`h-9! min-h-9 min-w-0 flex-1 border-border/65 bg-background/55 py-0 text-xs text-foreground`,children:(0,k.jsx)(Te,{placeholder:`Select format`,children:t=>{if(t===`source-yaml`)return`Source YAML`;let n=y.find(e=>e.id===t);return n?.id===`litmus-edge`?Ge(e):n?.exportLabel??`Select format`}})}),(0,k.jsxs)(Ee,{children:[(0,k.jsxs)(Oe,{children:[(0,k.jsx)(we,{children:`Platform`}),Ne.map(t=>(0,k.jsx)(v,{value:t.id,children:t.id===`litmus-edge`?Ge(e):t.exportLabel},t.id)),Me.map(e=>(0,k.jsx)(v,{value:e.id,disabled:!0,children:(0,k.jsxs)(`span`,{className:`flex items-center gap-2`,children:[e.exportLabel,(0,k.jsx)(Fe,{variant:`outline`,className:`px-1 py-0 text-[10px] text-foreground/72`,children:`Coming Soon`})]})},e.id))]}),(0,k.jsx)(De,{}),(0,k.jsxs)(Oe,{children:[(0,k.jsx)(we,{children:`Source`}),(0,k.jsxs)(v,{value:`source-yaml`,children:[`Source YAML`,` `,(0,k.jsx)(`span`,{className:`text-foreground/72`,children:e===`model`?`.twin.yaml`:`.miravo.yaml`})]})]})]})]}),(0,k.jsxs)(_,{variant:`outline`,size:`sm`,className:`h-9 min-h-9 shrink-0 gap-1.5 border-border/70 bg-background/50 px-4 text-xs font-medium text-foreground sm:w-auto`,disabled:!Y,onClick:nt,children:[(0,k.jsx)(C,{className:`size-3.5`}),`Download`]})]})]}),(0,k.jsx)(`p`,{className:`text-[11px] leading-snug text-foreground/70`,children:(0,k.jsx)(_e,{format:x,kind:e})})]}),q&&(0,k.jsx)(Ce,{open:D,onOpenChange:O,type:`apply`,label:n,targetLabel:q.label,hostname:q.hostname,sourceHostname:q.sourceHostname,onConfirm:$e,defaultDeviceName:e===`model`?Ve(t):void 0}),(0,k.jsx)(be,{open:A,editing:!1,platformId:M,form:P,showToken:Ie,saving:Be,testing:Ke,canTestConnection:K,onOpenChange:j,onPlatformChange:N,onFormChange:F,onShowTokenChange:L,onSave:()=>void et(),onTestConnection:tt,onCancelInFlight:Je}),(0,k.jsx)(oe,{open:Ye,onOpenChange:e=>{B(e),e||H(R)},children:(0,k.jsxs)(ce,{className:`sm:max-w-md`,children:[(0,k.jsxs)(se,{children:[(0,k.jsx)(le,{children:`Download Litmus Edge Template`}),(0,k.jsx)(ae,{children:me})]}),(0,k.jsxs)(`div`,{className:`space-y-2 py-1`,children:[(0,k.jsx)(T,{htmlFor:`deploy-export-source-host`,children:Se}),(0,k.jsx)(de,{id:`deploy-export-source-host`,value:V,onChange:e=>H(e.target.value),placeholder:R,autoComplete:`off`,className:`font-mono text-sm`}),(0,k.jsxs)(`p`,{className:`text-[11px] leading-snug text-muted-foreground`,children:[`Use an IP or hostname reachable from Litmus Edge (e.g.`,` `,(0,k.jsx)(`span`,{className:`font-mono`,children:R}),` for Docker bridge).`]})]}),(0,k.jsxs)(ie,{className:`gap-2 sm:gap-0`,children:[(0,k.jsx)(_,{type:`button`,variant:`outline`,onClick:()=>B(!1),disabled:U,children:`Cancel`}),(0,k.jsxs)(_,{type:`button`,className:`gap-1.5`,onClick:()=>void rt(),disabled:U,"aria-busy":U,children:[U?(0,k.jsx)(S,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,k.jsx)(C,{className:`size-3.5`,"aria-hidden":!0}),`Download`]})]})]})})]})}export{P as a,D as c,Ie as i,E as l,A as n,F as o,N as r,O as s,Ke as t};
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{s as t}from"./vendor-charts-CAZdaPlq.js";import{B as n,G as r,H as i,K as a,U as o,V as s,W as c,at as l}from"./vendor-ui-mizMYESS.js";import{_ as u,a as d,i as f,o as ee}from"./api-BjnU1LXi.js";import{a as te,c as ne}from"./get-error-message-BzBOywwk.js";import{t as p}from"./proxy-CgM57W61.js";import{t as re}from"./AnimatePresence-CVhkybDC.js";import{a as ie,i as ae,l as m,n as oe,o as se,r as ce,s as le}from"./copy-button-DYqJP5N8.js";import{n as h,t as g}from"./createLucideIcon-Yddw9eHa.js";import{a as ue,n as _,t as de}from"./input-BCiRHEmc.js";import{_ as fe,a as pe,b as me,c as he,f as ge,g as _e,i as ve,m as ye,p as be,r as xe,x as Se,y as Ce}from"./use-platform-stream-ScJV0xv8.js";import{a as we,c as Te,i as v,n as Ee,o as De,r as Oe,s as ke,t as Ae}from"./select-4wihIkEE.js";import{a as je,i as y,n as Me,r as b,t as Ne}from"./platform-targets-BbVxaqAc.js";import{a as x,o as S}from"./tabs-BgPF8MSY.js";import{t as C}from"./download-BPgKzo-_.js";import{n as Pe}from"./checkbox-Xly18Uyz.js";import{t as Fe}from"./badge-tnWgSITj.js";import{t as w}from"./query-keys-Co1J4HmV.js";import{t as T}from"./label-xIWEC6lW.js";var E=g(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),D=g(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),O=g(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),k=l();function A({...e}){return(0,k.jsx)(s,{"data-slot":`sheet`,...e})}function j({...e}){return(0,k.jsx)(i,{"data-slot":`sheet-portal`,...e})}function M({className:e,...t}){return(0,k.jsx)(a,{"data-slot":`sheet-overlay`,className:h(`fixed inset-0 z-50 bg-black/10 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs`,e),...t})}function N({className:e,children:t,side:n=`right`,showCloseButton:i=!0,...a}){return(0,k.jsxs)(j,{children:[(0,k.jsx)(M,{}),(0,k.jsxs)(o,{"data-slot":`sheet-content`,"data-side":n,className:h(`fixed z-50 flex flex-col gap-4 bg-background bg-clip-padding text-sm shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-[calc(100vw-1rem)] data-[side=left]:max-w-md data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-[calc(100vw-1rem)] data-[side=right]:max-w-xl data-[side=right]:border-l data-[side=right]:pl-1 data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem]`,e),...a,children:[t,i&&(0,k.jsxs)(r,{"data-slot":`sheet-close`,render:(0,k.jsx)(_,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`}),children:[(0,k.jsx)(ue,{}),(0,k.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function P({className:e,...t}){return(0,k.jsx)(`div`,{"data-slot":`sheet-header`,className:h(`flex flex-col gap-0.5 p-2`,e),...t})}function F({className:e,...t}){return(0,k.jsx)(n,{"data-slot":`sheet-title`,className:h(`text-base font-medium text-foreground`,e),...t})}function Ie({className:e,...t}){return(0,k.jsx)(c,{"data-slot":`sheet-description`,className:h(`text-sm text-muted-foreground`,e),...t})}var I=e(t(),1),L=[{value:`opcua`,label:`OPC UA`},{value:`mqtt`,label:`MQTT`},{value:`modbus`,label:`Modbus`}];function Le({value:e,onValueChange:t,labelledBy:n}){return(0,k.jsx)(`fieldset`,{"aria-labelledby":n,className:`min-w-0 border-0 p-0`,children:(0,k.jsx)(`div`,{className:`flex gap-1.5`,children:L.map(n=>{let r=e===n.value;return(0,k.jsx)(`button`,{type:`button`,"aria-pressed":r,onClick:()=>t(n.value),className:h(`flex flex-1 items-center justify-center rounded-[var(--miravo-radius-pill)] border py-1.5 text-center transition-[background-color,border-color,color,box-shadow] duration-200`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/80 focus-visible:ring-offset-2 focus-visible:ring-offset-background`,r?`border-primary/45 bg-primary/10 text-primary shadow-[inset_0_1px_0_0_rgba(255,255,255,0.06),0_0_0_1px_color-mix(in_srgb,var(--primary)_25%,transparent)]`:`border-border/75 bg-background/55 text-foreground/82 hover:border-border/90 hover:bg-background/70 hover:text-foreground/92`),children:(0,k.jsxs)(`span`,{className:`inline-flex items-center justify-center gap-1.5 font-mono text-[11px] font-medium leading-none tracking-wide`,children:[(0,k.jsx)(x,{className:`size-2.5 shrink-0 -translate-y-px opacity-80`,"aria-hidden":!0}),(0,k.jsx)(`span`,{children:n.label})]})},n.value)})})})}var R=`172.17.0.1`;async function Re(e){let t=await d(`/catalog/models/${encodeURIComponent(e)}/le-dt.json`,u.catalogModelLeDt);return JSON.stringify(t,null,2)}async function ze(e,t={host:R}){let n=u.catalogTemplateLeTemplateJson.query;if(!n)throw Error(`Missing query schema for ${u.catalogTemplateLeTemplateJson.method} ${u.catalogTemplateLeTemplateJson.path}`);let r=n.safeParse(t);if(!r.success)throw Error(`Invalid request for ${u.catalogTemplateLeTemplateJson.method} ${u.catalogTemplateLeTemplateJson.path}: ${r.error.message}`);return f(`/catalog/templates/${encodeURIComponent(e)}/le-template.json${Be(r.data)}`,u.catalogTemplateLeTemplateJson)}function Be(e){let t=new URLSearchParams;return e.host&&t.set(`host`,e.host),e.protocol&&t.set(`protocol`,e.protocol),t.size>0?`?${t.toString()}`:``}function z(e){let t=e.split(/[-_]/).filter(e=>e.length>0);return t[t.length-1]??e}function Ve(e){return`${z(e)}-001`}function He(e,t){return[t,...e?.filter(e=>e.id!==t.id)??[]]}async function Ue(e){let t=await e.create();e.onCreated(t);try{await e.refresh()}catch(t){e.onRefreshFailed(t)}}function We(e){return y.find(t=>t.id===e)?.label??e}function Ge(e){return e===`template`?`Litmus Edge Template`:`Litmus Edge Digital Twin`}function Ke({kind:e,id:t,displayName:n,yamlPath:r,yamlFilename:i,stream:a}){let o=ne(),s=te({queryKey:w.platforms.targets(),queryFn:()=>he()}),c=s.data??[],[l,d]=(0,I.useState)(``),[f,g]=(0,I.useState)(`opcua`),[x,E]=(0,I.useState)(`litmus-edge`),[D,O]=(0,I.useState)(!1),[A,j]=(0,I.useState)(!1),[M,N]=(0,I.useState)(b.id),[P,F]=(0,I.useState)({label:``,hostname:``,apiToken:``,sourceHostname:``}),[Ie,L]=(0,I.useState)(!1),[Be,z]=(0,I.useState)(!1),{testing:Ke,runTest:qe,cancelInFlight:Je}=xe(),[Ye,B]=(0,I.useState)(!1),[V,H]=(0,I.useState)(R),[U,Xe]=(0,I.useState)(!1),[W,G]=(0,I.useState)(!1),Ze=(0,I.useId)(),Qe=a.operation?.operationId;(0,I.useEffect)(()=>{G(!1)},[Qe]),(0,I.useEffect)(()=>{A&&(N(b.id),F({label:``,hostname:``,apiToken:``,sourceHostname:``}),L(!1))},[A]);let K=M===b.id&&P.hostname.trim().length>0&&P.sourceHostname.trim().length>0&&P.apiToken.trim().length>0,q=c.find(e=>e.id===l),$e=(0,I.useCallback)(n=>{O(!1),l&&(e===`model`?a.startApply({targetId:l,model:t,protocol:f,scope:n.scope,deviceName:n.deviceName,ifUnmanaged:n.ifUnmanaged}):a.startApply({targetId:l,template:t,scope:n.scope,ifUnmanaged:n.ifUnmanaged}))},[l,t,e,f,a]),et=(0,I.useCallback)(async()=>{if(M!==b.id){m.error(`${We(M)} target setup is coming soon.`);return}if(!P.label||!P.hostname||!P.sourceHostname){m.error(`Label, hostname, and source host are required.`);return}if(!P.apiToken){m.error(`API token is required for new targets.`);return}z(!0);try{await Ue({create:()=>pe({...P,platformId:M}),onCreated:e=>{o.setQueryData(w.platforms.targets(),t=>He(t,e)),d(e.id),j(!1),m.success(`Target added.`)},refresh:async()=>{let e=await s.refetch();if(e.error)throw e.error},onRefreshFailed:e=>{m.error(`Target added, but target list refresh failed.`,{description:e instanceof Error&&e.message?`${e.message} Reload targets before retrying another add.`:`Reload targets before retrying another add.`})}})}catch(e){m.error(e instanceof Error?e.message:`Failed to add target.`)}finally{z(!1)}},[M,P,s,o]),tt=(0,I.useCallback)(()=>{K&&qe({hostname:P.hostname.trim(),sourceHostname:P.sourceHostname.trim(),apiToken:P.apiToken.trim()})},[K,P,qe]),J=x===`source-yaml`,Y=x===`litmus-edge`||J,X=(0,I.useCallback)(async n=>{if(J){try{let t=await ee(r,e===`model`?u.catalogModelYaml:u.catalogTemplateYaml),n=new Blob([t],{type:`text/yaml`}),a=URL.createObjectURL(n),o=document.createElement(`a`);o.href=a,o.download=i,o.click(),URL.revokeObjectURL(a),m.success(`Exported ${i}`)}catch{m.error(`Failed to export YAML`)}return}if(x===`litmus-edge`)try{if(e===`model`){let e=await Re(t),n=new Blob([e],{type:`application/json`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`${t}.le-dt.json`,i.click(),URL.revokeObjectURL(r),m.success(`Exported ${t}.le-dt.json`)}else{let e=n?.templateHost?.trim()??``,r=e.length>0?e:R,i=`${t}.le-template.json`,a=await ze(t,{host:r,protocol:f}),o=URL.createObjectURL(a),s=document.createElement(`a`);s.href=o,s.download=i,s.click(),URL.revokeObjectURL(o),m.success(`Exported ${i}`)}}catch{m.error(`Failed to export platform format`)}},[x,J,e,t,r,i,f]),nt=(0,I.useCallback)(()=>{if(Y){if(x===`litmus-edge`&&e===`template`){H(R),B(!0);return}X()}},[Y,x,e,X]),rt=(0,I.useCallback)(async()=>{Xe(!0);try{await X({templateHost:V}),B(!1)}finally{Xe(!1)}},[V,X]),Z=a.status===`running`,Q=!!l&&!Z,it=!!a.operation||Z,$=it?ve(a):null;return(0,k.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-6 px-1 py-2`,children:[(0,k.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto pr-2`,children:(0,k.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,k.jsx)(`p`,{className:`font-heading text-[11px] font-semibold uppercase tracking-[0.2em] text-foreground`,children:`Deploy`}),(0,k.jsxs)(`div`,{className:`space-y-2`,children:[(0,k.jsx)(T,{className:`font-heading text-[11px] font-medium uppercase tracking-[0.14em] text-foreground/78`,children:`Target`}),(0,k.jsx)(ge,{targets:c,value:l,onValueChange:d,size:`sm`,className:`min-w-0 w-full border-border/65 bg-background/55 text-xs text-foreground`,onAddNew:()=>j(!0)})]}),e===`model`&&c.length>0&&(0,k.jsxs)(`div`,{className:`space-y-2`,children:[(0,k.jsx)(T,{id:Ze,className:`font-heading text-[11px] font-medium uppercase tracking-[0.14em] text-foreground/78`,children:`Protocol binding`}),(0,k.jsx)(Le,{value:f,onValueChange:g,labelledBy:Ze})]}),c.length>0&&(0,k.jsxs)(`button`,{type:`button`,disabled:!Q,onClick:()=>O(!0),className:h(`group flex w-full min-h-14 min-w-0 items-stretch overflow-hidden rounded-[var(--miravo-radius-stadium-lg)] text-left outline-none`,`transition-[border-color,box-shadow,background-color] duration-200 ease-out`,`focus-visible:ring-2 focus-visible:ring-ring/70 focus-visible:ring-offset-2 focus-visible:ring-offset-background`,`disabled:pointer-events-none disabled:opacity-55`,Q?[`border-2 border-primary/40 bg-background`,`bg-linear-to-r from-primary/12 via-background to-background`,`shadow-[inset_0_1px_0_0_rgba(255,255,255,0.025)]`,`hover:border-primary/56 hover:shadow-[inset_0_1px_0_0_rgba(255,255,255,0.025),0_0_14px_-8px_color-mix(in_srgb,var(--primary)_18%,transparent),0_0_22px_-12px_color-mix(in_srgb,var(--primary)_8%,transparent)]`]:[`border border-dashed border-border/65 bg-muted/15`,`hover:bg-muted/22`]),children:[(0,k.jsxs)(`span`,{className:`relative flex w-18 shrink-0 items-center justify-center bg-transparent`,"aria-hidden":!0,children:[(0,k.jsx)(`span`,{className:h(`absolute inset-y-2 -right-px w-px bg-linear-to-b from-transparent via-primary/30 to-transparent opacity-70`,!Q&&`via-border/80`)}),(0,k.jsx)(Pe,{className:h(`relative size-5`,Q?`text-primary`:`text-foreground/75`)})]}),(0,k.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col justify-center gap-0.5 overflow-hidden px-3 py-2.5 sm:px-4`,children:[(0,k.jsx)(`span`,{className:h(`font-heading text-[11px] font-semibold uppercase tracking-[0.16em]`,Q?`text-primary`:`text-foreground/78`),children:Q?`Commit deploy`:Z?`Deploy in progress…`:`Awaiting target`}),(0,k.jsx)(`span`,{className:h(`truncate font-mono text-[13px] leading-tight tracking-tight`,Q?`text-foreground`:`text-foreground/80`),children:q?.label??`Select a target above`})]}),(0,k.jsx)(`span`,{className:h(`flex shrink-0 items-center pr-2.5 sm:pr-3`,Q&&`pl-1`),children:(0,k.jsx)(`span`,{className:h(`flex size-9 items-center justify-center rounded-[var(--miravo-radius-stadium-sm)] border bg-transparent transition-[border-color,color] duration-200`,Q?`border-primary/40 text-primary group-hover:border-primary/55`:`border-border/75 text-foreground/75`),"aria-hidden":!0,children:(0,k.jsx)(je,{className:`size-4`,strokeWidth:2.25})})})]})]})}),(0,k.jsx)(re,{children:it&&$?(0,k.jsx)(ye,{title:$.title,subtitle:$.subtitle,footerAction:Z&&a.operation?.operationId?(0,k.jsx)(_,{variant:`outline`,size:`sm`,disabled:W,"aria-busy":W,className:h(`ml-auto group h-8 gap-1.5 px-3 text-xs`,W?`cursor-not-allowed`:`hover:bg-destructive/12 hover:text-destructive hover:border-destructive/35`),onClick:async()=>{G(!0);try{await a.cancel()}catch{G(!1)}},children:W?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(S,{className:`size-3.5 shrink-0 animate-spin text-muted-foreground`,"aria-hidden":!0}),(0,k.jsx)(p.span,{animate:{opacity:[1,.72,1]},transition:{duration:1.25,repeat:1/0,ease:`easeInOut`},className:`font-medium text-foreground`,children:`Cancelling…`})]}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(ue,{className:`size-3.5 shrink-0 text-foreground/65 group-hover:text-destructive`,"aria-hidden":!0}),(0,k.jsx)(p.span,{animate:{opacity:[1,.88,1]},transition:{duration:2.2,repeat:1/0,ease:`easeInOut`},children:`Cancel`})]})}):(0,k.jsx)(`div`,{className:`ml-auto shrink-0 flex items-center`,children:(0,k.jsx)(_,{type:`button`,variant:`secondary`,size:`xs`,className:`h-7 px-3 text-[10px] font-medium`,onClick:a.reset,children:`Close`})}),onDismiss:a.reset,children:a.operation?(0,k.jsx)(fe,{operation:a.operation,catalogTemplates:[{id:t,name:n}]}):(0,k.jsxs)(`div`,{className:`flex flex-col gap-2 py-1`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,k.jsx)(S,{className:`size-3.5 animate-spin text-primary`,"aria-hidden":!0}),(0,k.jsx)(`span`,{className:`text-xs text-foreground/88`,children:`Connecting to Litmus Edge…`})]}),(0,k.jsx)(`div`,{className:`h-1 w-full overflow-hidden rounded-full bg-muted/40`,children:(0,k.jsx)(p.div,{className:`h-full w-2/5 rounded-full bg-primary`,animate:{x:[`-100%`,`250%`]},transition:{duration:1.2,repeat:1/0,ease:`easeInOut`}})})]})},`deploy-stream`):null}),(0,k.jsxs)(`div`,{className:`flex flex-col gap-4 border-t border-border/40 pt-5`,children:[(0,k.jsx)(`p`,{className:`font-heading text-[11px] font-semibold uppercase tracking-[0.2em] text-foreground`,children:`Export`}),(0,k.jsxs)(`div`,{className:`space-y-2`,children:[(0,k.jsx)(T,{className:`font-heading text-[11px] font-medium uppercase tracking-[0.14em] text-foreground/78`,children:`Format`}),(0,k.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,children:[(0,k.jsxs)(Ae,{value:x,onValueChange:e=>{e&&E(e)},children:[(0,k.jsx)(ke,{size:`sm`,className:`h-9! min-h-9 min-w-0 flex-1 border-border/65 bg-background/55 py-0 text-xs text-foreground`,children:(0,k.jsx)(Te,{placeholder:`Select format`,children:t=>{if(t===`source-yaml`)return`Source YAML`;let n=y.find(e=>e.id===t);return n?.id===`litmus-edge`?Ge(e):n?.exportLabel??`Select format`}})}),(0,k.jsxs)(Ee,{children:[(0,k.jsxs)(Oe,{children:[(0,k.jsx)(we,{children:`Platform`}),Ne.map(t=>(0,k.jsx)(v,{value:t.id,children:t.id===`litmus-edge`?Ge(e):t.exportLabel},t.id)),Me.map(e=>(0,k.jsx)(v,{value:e.id,disabled:!0,children:(0,k.jsxs)(`span`,{className:`flex items-center gap-2`,children:[e.exportLabel,(0,k.jsx)(Fe,{variant:`outline`,className:`px-1 py-0 text-[10px] text-foreground/72`,children:`Coming Soon`})]})},e.id))]}),(0,k.jsx)(De,{}),(0,k.jsxs)(Oe,{children:[(0,k.jsx)(we,{children:`Source`}),(0,k.jsxs)(v,{value:`source-yaml`,children:[`Source YAML`,` `,(0,k.jsx)(`span`,{className:`text-foreground/72`,children:e===`model`?`.twin.yaml`:`.miravo.yaml`})]})]})]})]}),(0,k.jsxs)(_,{variant:`outline`,size:`sm`,className:`h-9 min-h-9 shrink-0 gap-1.5 border-border/70 bg-background/50 px-4 text-xs font-medium text-foreground sm:w-auto`,disabled:!Y,onClick:nt,children:[(0,k.jsx)(C,{className:`size-3.5`}),`Download`]})]})]}),(0,k.jsx)(`p`,{className:`text-[11px] leading-snug text-foreground/70`,children:(0,k.jsx)(_e,{format:x,kind:e})})]}),q&&(0,k.jsx)(Ce,{open:D,onOpenChange:O,type:`apply`,label:n,targetLabel:q.label,hostname:q.hostname,sourceHostname:q.sourceHostname,onConfirm:$e,defaultDeviceName:e===`model`?Ve(t):void 0}),(0,k.jsx)(be,{open:A,editing:!1,platformId:M,form:P,showToken:Ie,saving:Be,testing:Ke,canTestConnection:K,onOpenChange:j,onPlatformChange:N,onFormChange:F,onShowTokenChange:L,onSave:()=>void et(),onTestConnection:tt,onCancelInFlight:Je}),(0,k.jsx)(oe,{open:Ye,onOpenChange:e=>{B(e),e||H(R)},children:(0,k.jsxs)(ce,{className:`sm:max-w-md`,children:[(0,k.jsxs)(se,{children:[(0,k.jsx)(le,{children:`Download Litmus Edge Template`}),(0,k.jsx)(ae,{children:me})]}),(0,k.jsxs)(`div`,{className:`space-y-2 py-1`,children:[(0,k.jsx)(T,{htmlFor:`deploy-export-source-host`,children:Se}),(0,k.jsx)(de,{id:`deploy-export-source-host`,value:V,onChange:e=>H(e.target.value),placeholder:R,autoComplete:`off`,className:`font-mono text-sm`}),(0,k.jsxs)(`p`,{className:`text-[11px] leading-snug text-muted-foreground`,children:[`Use an IP or hostname reachable from Litmus Edge (e.g.`,` `,(0,k.jsx)(`span`,{className:`font-mono`,children:R}),` for Docker bridge).`]})]}),(0,k.jsxs)(ie,{className:`gap-2 sm:gap-0`,children:[(0,k.jsx)(_,{type:`button`,variant:`outline`,onClick:()=>B(!1),disabled:U,children:`Cancel`}),(0,k.jsxs)(_,{type:`button`,className:`gap-1.5`,onClick:()=>void rt(),disabled:U,"aria-busy":U,children:[U?(0,k.jsx)(S,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,k.jsx)(C,{className:`size-3.5`,"aria-hidden":!0}),`Download`]})]})]})})]})}export{P as a,D as c,Ie as i,E as l,A as n,F as o,N as r,O as s,Ke as t};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{s as t}from"./vendor-charts-CAZdaPlq.js";import{at as n}from"./vendor-ui-mizMYESS.js";import{_ as r,a as i}from"./api-Bef9FEIU.js";import{a,c as ee,n as o,t as s}from"./get-error-message-DhCjoSSJ.js";import{t as c}from"./proxy-CgM57W61.js";import{t as l}from"./AnimatePresence-CVhkybDC.js";import{u as te}from"./chunk-OE4NN4TA-m2UhO8Q2.js";import{S as u,n as ne,s as d}from"./input-BCiRHEmc.js";import{r as f}from"./engine-store-BUO-9Dsh.js";import{c as p,i as m,n as re,s as h,t as ie}from"./select-4wihIkEE.js";import{t as ae}from"./route-preload-CMl-AryU.js";import{t as oe}from"./use-transition-navigate-CG8tHeYN.js";import{t as se}from"./badge-tnWgSITj.js";import{t as g}from"./query-keys-Co1J4HmV.js";import{n as ce}from"./transition-types-CMW7IObN.js";import{n as le}from"./auth-screen-backdrop-OrOL41MR.js";import{a as ue,i as de,n as fe,o as pe,r as me,s as he,t as _}from"./combobox-gGNWoksU.js";import{a as v,c as y,i as b,o as x,r as ge,s as _e,t as ve}from"./select-display-items-DUJCelf2.js";var S=e(t(),1),C=n(),ye=1500,w=[`row-1`,`row-2`,`row-3`,`row-4`,`row-5`,`row-6`];function be(e){return e.includes(`triggered`)?`destructive`:e.includes(`cleared`)||e.includes(`created`)?`default`:e.includes(`removed`)||e.includes(`lifecycle`)?`secondary`:(e.includes(`state-changed`),`outline`)}function xe(e){return e.includes(`state-changed`)?`border-info/30 bg-info/20 text-info hover:bg-info/20`:e===`platform:operation`?`border-chart-4/30 bg-chart-4/20 text-chart-4 hover:bg-chart-4/20`:e===`platform:resource`?`border-chart-4/30 bg-chart-4/15 text-chart-4 hover:bg-chart-4/15`:``}function T(e){if(`targetLabel`in e)return typeof e.targetLabel==`string`?e.targetLabel:void 0}function E(e){if(e.type===`platform:operation`){let t=e.operationType===`apply`?`Apply`:`Cleanup`,n=e.applied,r=e.operationType===`apply`?`applied`:`deleted`,i=e.failed>0?`, ${e.failed} failed`:``,a=T(e)??`Unknown target`;return`${t} ${e.templateId} \u2192 ${a} (${n} ${r}${i})`}return e.type===`platform:resource`?`${e.status===`success`?`✓`:`✗`} ${e.action} ${e.resourceType} ${e.resourceName}`:``}function D(e,t){let n=new Date(e);return n.toDateString()===t.toDateString()?n.toLocaleTimeString(d):n.toLocaleString(d,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function O(e){if(`instanceId`in e&&typeof e.instanceId==`string`)return e.instanceId}function k(e){return e.type===`platform:operation`||e.type===`platform:resource`?T(e):O(e)}function A(e){return`fault`in e?u(e.fault):e.type===`platform:operation`||e.type===`platform:resource`?E(e):`from`in e&&`to`in e?`${u(e.from)} \u2192 ${u(e.to)}`:``}function j(e,t,n){let r=new URLSearchParams;return r.set(`limit`,`50`),e!==`all`&&r.set(`type`,e),t&&r.set(`instanceId`,t),n!==null&&r.set(`cursor`,String(n)),`/events?${r.toString()}`}function M(){let e=ee(),[t]=te(),n=t.get(`type`)??`all`,u=t.get(`instanceId`)??``,[d,T]=(0,S.useState)(n),[E,M]=(0,S.useState)(u),[N,Se]=(0,S.useState)(!0),P=f(e=>e.events.length),F=f(e=>e.instances),Ce=oe(),I=a({queryKey:g.events(d,E),queryFn:()=>i(j(d,E,null),r.events),refetchInterval:N?ye:!1,staleTime:5e3}),[we,L]=(0,S.useState)([]),[Te,R]=(0,S.useState)(!1),[Ee,z]=(0,S.useState)(null),B=`${d}::${E}`,V=(0,S.useRef)(B);(0,S.useEffect)(()=>{B!==V.current&&(V.current=B,L([]),z(null),U(!1))},[B]),(0,S.useEffect)(()=>{T(e=>e===n?e:n)},[n]),(0,S.useEffect)(()=>{M(e=>e===u?e:u)},[u]);let[H,U]=(0,S.useState)(()=>(I.data?.events.length??0)>0),W=I.data?[I.data,...we]:[],G=W.flatMap(e=>e.events),K=W[W.length-1],De=K?.hasMore??!1;(0,S.useEffect)(()=>{G.length>0&&!H&&U(!0)},[G.length,H]);let q=(0,S.useRef)(P);(0,S.useEffect)(()=>{P!==q.current&&(q.current=P,N&&e.invalidateQueries({queryKey:g.events(d,E)}))},[P,N,e,d,E]);let[J,Oe]=(0,S.useState)(``),Y=(0,S.useMemo)(()=>J?F.filter(e=>e.id.toLowerCase().includes(J.toLowerCase())):F,[F,J]),X=I.isPending&&!I.data&&!I.isError,Z=N&&!X&&!H&&G.length===0,Q=I.error??Ee,ke=I.isError&&!I.data,$=(0,S.useCallback)(()=>{I.refetch()},[I]),Ae=async()=>{if(K?.nextCursor){R(!0),z(null);try{let e=await i(j(d,E,K.nextCursor),r.events);L(t=>[...t,e])}catch(e){z(e instanceof Error?e:Error(String(e)))}finally{R(!1)}}};if(ke)return(0,C.jsx)(le,{className:`min-h-full`,children:(0,C.jsx)(`div`,{className:`flex min-h-[40vh] flex-col items-center justify-center p-6 sm:p-12`,children:(0,C.jsx)(`div`,{className:`w-full max-w-md`,children:(0,C.jsx)(o,{message:s(Q,`Failed to fetch events.`),onRetry:$,isRetrying:I.isFetching})})})});let je=new Date;return(0,C.jsxs)(`div`,{className:`mx-auto flex w-full max-w-screen-2xl flex-col gap-5 p-4 sm:gap-6 sm:p-6`,children:[Q&&G.length>0?(0,C.jsx)(o,{message:`${s(Q,`Failed to fetch events.`)} Showing cached events.`,onRetry:$,isRetrying:I.isFetching}):null,(0,C.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3 lg:flex-row lg:items-center lg:justify-between lg:gap-4`,children:[(0,C.jsxs)(`div`,{className:`min-w-0 flex flex-col gap-1`,children:[(0,C.jsx)(`h1`,{className:`font-heading text-2xl font-semibold tracking-tight`,children:`Event Log`}),(0,C.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Real-time event stream from the engine.`})]}),(0,C.jsxs)(`div`,{className:`flex w-full min-w-0 flex-col gap-2 sm:flex-row sm:flex-nowrap sm:items-center sm:gap-2 lg:w-auto lg:max-w-full`,children:[(0,C.jsx)(`button`,{type:`button`,onClick:()=>Se(e=>!e),className:`flex h-7 shrink-0 items-center self-start overflow-hidden rounded-[var(--miravo-radius-tight)] border border-border/40 px-2 py-1 text-xs transition-colors hover:bg-muted sm:self-auto`,children:(0,C.jsx)(l,{mode:`wait`,initial:!1,children:N?(0,C.jsxs)(c.span,{initial:{opacity:0,y:-6},animate:{opacity:1,y:0},exit:{opacity:0,y:6},transition:{type:`spring`,stiffness:500,damping:35},className:`flex items-center gap-1.5`,children:[(0,C.jsx)(`span`,{className:`size-1.5 animate-pulse rounded-full bg-success`}),(0,C.jsx)(`span`,{className:`font-medium text-success`,children:`LIVE`})]},`live`):(0,C.jsxs)(c.span,{initial:{opacity:0,y:-6},animate:{opacity:1,y:0},exit:{opacity:0,y:6},transition:{type:`spring`,stiffness:500,damping:35},className:`flex items-center gap-1.5`,children:[(0,C.jsx)(`span`,{className:`size-1.5 rounded-full bg-muted-foreground`}),(0,C.jsx)(`span`,{className:`text-muted-foreground`,children:`Paused`})]},`paused`)})}),(0,C.jsx)(`div`,{className:`min-w-0 flex-1 lg:w-48 lg:flex-none`,children:(0,C.jsxs)(_,{value:E||null,onValueChange:e=>{M(e??``)},onInputValueChange:Oe,children:[(0,C.jsx)(me,{placeholder:`All instances`,className:`h-8 w-full min-w-0`,showClear:!!E}),(0,C.jsx)(fe,{children:(0,C.jsxs)(ue,{children:[Y.map(e=>(0,C.jsx)(de,{value:e.id,children:(0,C.jsx)(`span`,{className:`font-mono`,children:e.id})},e.id)),Y.length===0&&(0,C.jsx)(`p`,{className:`py-2 text-center text-xs text-muted-foreground`,children:`No instances found`})]})})]})}),(0,C.jsx)(`div`,{className:`min-w-0 flex-1 lg:w-48 lg:flex-none`,children:(0,C.jsxs)(ie,{value:d,onValueChange:e=>{T(e??`all`)},items:ve,children:[(0,C.jsx)(h,{className:`w-full min-w-0 lg:w-48`,"aria-label":`Event type filter`,children:(0,C.jsx)(p,{placeholder:`Filter by type`})}),(0,C.jsxs)(re,{alignItemWithTrigger:!1,align:`start`,children:[(0,C.jsx)(m,{value:`all`,children:`All events`}),(0,C.jsx)(m,{value:`fault:triggered`,children:`Fault Triggered`}),(0,C.jsx)(m,{value:`fault:cleared`,children:`Fault Cleared`}),(0,C.jsx)(m,{value:`lifecycle:changed`,children:`Lifecycle Changed`}),(0,C.jsx)(m,{value:`instance:created`,children:`Instance Created`}),(0,C.jsx)(m,{value:`instance:removed`,children:`Instance Removed`}),(0,C.jsx)(m,{value:`engine:state-changed`,children:`Engine State`}),(0,C.jsx)(m,{value:`platform:resource`,children:`Platform Resource`}),(0,C.jsx)(m,{value:`platform:operation`,children:`Platform Operation`})]})]})})]})]}),(0,C.jsx)(pe,{className:`min-w-0 py-0`,children:(0,C.jsx)(he,{className:`p-0`,children:(0,C.jsxs)(ge,{children:[(0,C.jsx)(_e,{children:(0,C.jsxs)(y,{children:[(0,C.jsx)(x,{className:`hidden w-12 sm:table-cell`,children:`#`}),(0,C.jsx)(x,{children:`Type`}),(0,C.jsx)(x,{children:`Context`}),(0,C.jsx)(x,{children:`Details`}),(0,C.jsx)(x,{className:`hidden text-right md:table-cell`,children:`Cycle #`}),(0,C.jsx)(x,{className:`hidden text-right sm:table-cell`,children:`Wall Clock`})]})}),(0,C.jsxs)(b,{children:[X&&w.map(e=>(0,C.jsxs)(y,{children:[(0,C.jsx)(v,{className:`hidden sm:table-cell`,children:(0,C.jsx)(`div`,{className:`h-4 w-8 animate-pulse rounded-[var(--miravo-radius-tight)] bg-muted/40`})}),(0,C.jsx)(v,{children:(0,C.jsx)(`div`,{className:`h-5 w-28 animate-pulse rounded-[var(--miravo-radius-tight)] bg-muted/40`})}),(0,C.jsx)(v,{children:(0,C.jsx)(`div`,{className:`h-4 w-36 animate-pulse rounded-[var(--miravo-radius-tight)] bg-muted/30`})}),(0,C.jsx)(v,{children:(0,C.jsx)(`div`,{className:`h-4 w-56 animate-pulse rounded-[var(--miravo-radius-tight)] bg-muted/30`})}),(0,C.jsx)(v,{className:`hidden md:table-cell`,children:(0,C.jsx)(`div`,{className:`ml-auto h-4 w-16 animate-pulse rounded-[var(--miravo-radius-tight)] bg-muted/30`})}),(0,C.jsx)(v,{className:`hidden sm:table-cell`,children:(0,C.jsx)(`div`,{className:`ml-auto h-4 w-20 animate-pulse rounded-[var(--miravo-radius-tight)] bg-muted/30`})})]},e)),G.map(e=>{let t=O(e),n=k(e),r=e.type===`platform:resource`||e.type===`platform:operation`;return(0,C.jsxs)(y,{className:t?`cursor-pointer transition-colors`:``,onMouseEnter:t?()=>ae(`/instance/${t}`):void 0,onClick:t?()=>Ce(`/instance/${t}`,{transitionType:ce}):void 0,children:[(0,C.jsx)(v,{className:`hidden font-mono text-xs text-muted-foreground sm:table-cell`,children:e.id}),(0,C.jsx)(v,{children:(0,C.jsx)(se,{variant:be(e.type),className:`text-xs ${xe(e.type)}`,children:r?e.type===`platform:operation`?`platform:${e.operationType}`:`${e.action}:${e.resourceType}`:e.type})}),(0,C.jsx)(v,{className:`font-mono text-xs`,children:n??`—`}),(0,C.jsx)(v,{className:`max-w-xs truncate font-mono text-xs`,children:A(e)||(0,C.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,C.jsx)(v,{className:`hidden text-right font-mono text-xs md:table-cell`,children:e.tick}),(0,C.jsx)(v,{className:`hidden text-right text-xs text-muted-foreground sm:table-cell`,children:D(e.timestamp,je)})]},e.id)}),Z&&w.map(e=>(0,C.jsxs)(y,{children:[(0,C.jsx)(v,{className:`hidden sm:table-cell`,children:(0,C.jsx)(`div`,{className:`h-4 w-8 animate-pulse rounded-[var(--miravo-radius-tight)] bg-muted/30`})}),(0,C.jsx)(v,{children:(0,C.jsx)(`div`,{className:`h-5 w-28 animate-pulse rounded-[var(--miravo-radius-tight)] bg-muted/30`})}),(0,C.jsx)(v,{children:(0,C.jsx)(`div`,{className:`h-4 w-36 animate-pulse rounded-[var(--miravo-radius-tight)] bg-muted/20`})}),(0,C.jsx)(v,{children:(0,C.jsx)(`div`,{className:`h-4 w-56 animate-pulse rounded-[var(--miravo-radius-tight)] bg-muted/20`})}),(0,C.jsx)(v,{className:`hidden md:table-cell`,children:(0,C.jsx)(`div`,{className:`ml-auto h-4 w-16 animate-pulse rounded-[var(--miravo-radius-tight)] bg-muted/20`})}),(0,C.jsx)(v,{className:`hidden sm:table-cell`,children:(0,C.jsx)(`div`,{className:`ml-auto h-4 w-20 animate-pulse rounded-[var(--miravo-radius-tight)] bg-muted/20`})})]},`warmup-${e}`)),!X&&!Z&&G.length===0&&(0,C.jsx)(y,{children:(0,C.jsx)(v,{colSpan:6,className:`py-8 text-center text-muted-foreground`,children:`No events`})})]})]})})}),De&&(0,C.jsx)(`div`,{className:`flex justify-center border-t border-border/40 pt-4`,children:(0,C.jsx)(ne,{variant:`outline`,size:`sm`,onClick:()=>void Ae(),disabled:Te,children:`Load older events`})})]})}export{M as t};
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{s as t}from"./vendor-charts-CAZdaPlq.js";import{at as n}from"./vendor-ui-mizMYESS.js";import{_ as r,a as i}from"./api-BjnU1LXi.js";import{a,c as ee,n as o,t as s}from"./get-error-message-BzBOywwk.js";import{t as c}from"./proxy-CgM57W61.js";import{t as l}from"./AnimatePresence-CVhkybDC.js";import{u as te}from"./chunk-OE4NN4TA-m2UhO8Q2.js";import{S as u,n as ne,s as d}from"./input-BCiRHEmc.js";import{r as f}from"./engine-store-BUO-9Dsh.js";import{c as p,i as m,n as re,s as h,t as ie}from"./select-4wihIkEE.js";import{t as ae}from"./route-preload-DZpMivUv.js";import{t as oe}from"./use-transition-navigate-Dp3qkQ87.js";import{t as se}from"./badge-tnWgSITj.js";import{t as g}from"./query-keys-Co1J4HmV.js";import{n as ce}from"./transition-types-CMW7IObN.js";import{n as le}from"./auth-screen-backdrop-OrOL41MR.js";import{a as ue,i as de,n as fe,o as pe,r as me,s as he,t as _}from"./combobox-gGNWoksU.js";import{a as v,c as y,i as b,o as x,r as ge,s as _e,t as ve}from"./select-display-items-DUJCelf2.js";var S=e(t(),1),C=n(),ye=1500,w=[`row-1`,`row-2`,`row-3`,`row-4`,`row-5`,`row-6`];function be(e){return e.includes(`triggered`)?`destructive`:e.includes(`cleared`)||e.includes(`created`)?`default`:e.includes(`removed`)||e.includes(`lifecycle`)?`secondary`:(e.includes(`state-changed`),`outline`)}function xe(e){return e.includes(`state-changed`)?`border-info/30 bg-info/20 text-info hover:bg-info/20`:e===`platform:operation`?`border-chart-4/30 bg-chart-4/20 text-chart-4 hover:bg-chart-4/20`:e===`platform:resource`?`border-chart-4/30 bg-chart-4/15 text-chart-4 hover:bg-chart-4/15`:``}function T(e){if(`targetLabel`in e)return typeof e.targetLabel==`string`?e.targetLabel:void 0}function E(e){if(e.type===`platform:operation`){let t=e.operationType===`apply`?`Apply`:`Cleanup`,n=e.applied,r=e.operationType===`apply`?`applied`:`deleted`,i=e.failed>0?`, ${e.failed} failed`:``,a=T(e)??`Unknown target`;return`${t} ${e.templateId} \u2192 ${a} (${n} ${r}${i})`}return e.type===`platform:resource`?`${e.status===`success`?`✓`:`✗`} ${e.action} ${e.resourceType} ${e.resourceName}`:``}function D(e,t){let n=new Date(e);return n.toDateString()===t.toDateString()?n.toLocaleTimeString(d):n.toLocaleString(d,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function O(e){if(`instanceId`in e&&typeof e.instanceId==`string`)return e.instanceId}function k(e){return e.type===`platform:operation`||e.type===`platform:resource`?T(e):O(e)}function A(e){return`fault`in e?u(e.fault):e.type===`platform:operation`||e.type===`platform:resource`?E(e):`from`in e&&`to`in e?`${u(e.from)} \u2192 ${u(e.to)}`:``}function j(e,t,n){let r=new URLSearchParams;return r.set(`limit`,`50`),e!==`all`&&r.set(`type`,e),t&&r.set(`instanceId`,t),n!==null&&r.set(`cursor`,String(n)),`/events?${r.toString()}`}function M(){let e=ee(),[t]=te(),n=t.get(`type`)??`all`,u=t.get(`instanceId`)??``,[d,T]=(0,S.useState)(n),[E,M]=(0,S.useState)(u),[N,Se]=(0,S.useState)(!0),P=f(e=>e.events.length),F=f(e=>e.instances),Ce=oe(),I=a({queryKey:g.events(d,E),queryFn:()=>i(j(d,E,null),r.events),refetchInterval:N?ye:!1,staleTime:5e3}),[we,L]=(0,S.useState)([]),[Te,R]=(0,S.useState)(!1),[Ee,z]=(0,S.useState)(null),B=`${d}::${E}`,V=(0,S.useRef)(B);(0,S.useEffect)(()=>{B!==V.current&&(V.current=B,L([]),z(null),U(!1))},[B]),(0,S.useEffect)(()=>{T(e=>e===n?e:n)},[n]),(0,S.useEffect)(()=>{M(e=>e===u?e:u)},[u]);let[H,U]=(0,S.useState)(()=>(I.data?.events.length??0)>0),W=I.data?[I.data,...we]:[],G=W.flatMap(e=>e.events),K=W[W.length-1],De=K?.hasMore??!1;(0,S.useEffect)(()=>{G.length>0&&!H&&U(!0)},[G.length,H]);let q=(0,S.useRef)(P);(0,S.useEffect)(()=>{P!==q.current&&(q.current=P,N&&e.invalidateQueries({queryKey:g.events(d,E)}))},[P,N,e,d,E]);let[J,Oe]=(0,S.useState)(``),Y=(0,S.useMemo)(()=>J?F.filter(e=>e.id.toLowerCase().includes(J.toLowerCase())):F,[F,J]),X=I.isPending&&!I.data&&!I.isError,Z=N&&!X&&!H&&G.length===0,Q=I.error??Ee,ke=I.isError&&!I.data,$=(0,S.useCallback)(()=>{I.refetch()},[I]),Ae=async()=>{if(K?.nextCursor){R(!0),z(null);try{let e=await i(j(d,E,K.nextCursor),r.events);L(t=>[...t,e])}catch(e){z(e instanceof Error?e:Error(String(e)))}finally{R(!1)}}};if(ke)return(0,C.jsx)(le,{className:`min-h-full`,children:(0,C.jsx)(`div`,{className:`flex min-h-[40vh] flex-col items-center justify-center p-6 sm:p-12`,children:(0,C.jsx)(`div`,{className:`w-full max-w-md`,children:(0,C.jsx)(o,{message:s(Q,`Failed to fetch events.`),onRetry:$,isRetrying:I.isFetching})})})});let je=new Date;return(0,C.jsxs)(`div`,{className:`mx-auto flex w-full max-w-screen-2xl flex-col gap-5 p-4 sm:gap-6 sm:p-6`,children:[Q&&G.length>0?(0,C.jsx)(o,{message:`${s(Q,`Failed to fetch events.`)} Showing cached events.`,onRetry:$,isRetrying:I.isFetching}):null,(0,C.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3 lg:flex-row lg:items-center lg:justify-between lg:gap-4`,children:[(0,C.jsxs)(`div`,{className:`min-w-0 flex flex-col gap-1`,children:[(0,C.jsx)(`h1`,{className:`font-heading text-2xl font-semibold tracking-tight`,children:`Event Log`}),(0,C.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Real-time event stream from the engine.`})]}),(0,C.jsxs)(`div`,{className:`flex w-full min-w-0 flex-col gap-2 sm:flex-row sm:flex-nowrap sm:items-center sm:gap-2 lg:w-auto lg:max-w-full`,children:[(0,C.jsx)(`button`,{type:`button`,onClick:()=>Se(e=>!e),className:`flex h-7 shrink-0 items-center self-start overflow-hidden rounded-[var(--miravo-radius-tight)] border border-border/40 px-2 py-1 text-xs transition-colors hover:bg-muted sm:self-auto`,children:(0,C.jsx)(l,{mode:`wait`,initial:!1,children:N?(0,C.jsxs)(c.span,{initial:{opacity:0,y:-6},animate:{opacity:1,y:0},exit:{opacity:0,y:6},transition:{type:`spring`,stiffness:500,damping:35},className:`flex items-center gap-1.5`,children:[(0,C.jsx)(`span`,{className:`size-1.5 animate-pulse rounded-full bg-success`}),(0,C.jsx)(`span`,{className:`font-medium text-success`,children:`LIVE`})]},`live`):(0,C.jsxs)(c.span,{initial:{opacity:0,y:-6},animate:{opacity:1,y:0},exit:{opacity:0,y:6},transition:{type:`spring`,stiffness:500,damping:35},className:`flex items-center gap-1.5`,children:[(0,C.jsx)(`span`,{className:`size-1.5 rounded-full bg-muted-foreground`}),(0,C.jsx)(`span`,{className:`text-muted-foreground`,children:`Paused`})]},`paused`)})}),(0,C.jsx)(`div`,{className:`min-w-0 flex-1 lg:w-48 lg:flex-none`,children:(0,C.jsxs)(_,{value:E||null,onValueChange:e=>{M(e??``)},onInputValueChange:Oe,children:[(0,C.jsx)(me,{placeholder:`All instances`,className:`h-8 w-full min-w-0`,showClear:!!E}),(0,C.jsx)(fe,{children:(0,C.jsxs)(ue,{children:[Y.map(e=>(0,C.jsx)(de,{value:e.id,children:(0,C.jsx)(`span`,{className:`font-mono`,children:e.id})},e.id)),Y.length===0&&(0,C.jsx)(`p`,{className:`py-2 text-center text-xs text-muted-foreground`,children:`No instances found`})]})})]})}),(0,C.jsx)(`div`,{className:`min-w-0 flex-1 lg:w-48 lg:flex-none`,children:(0,C.jsxs)(ie,{value:d,onValueChange:e=>{T(e??`all`)},items:ve,children:[(0,C.jsx)(h,{className:`w-full min-w-0 lg:w-48`,"aria-label":`Event type filter`,children:(0,C.jsx)(p,{placeholder:`Filter by type`})}),(0,C.jsxs)(re,{alignItemWithTrigger:!1,align:`start`,children:[(0,C.jsx)(m,{value:`all`,children:`All events`}),(0,C.jsx)(m,{value:`fault:triggered`,children:`Fault Triggered`}),(0,C.jsx)(m,{value:`fault:cleared`,children:`Fault Cleared`}),(0,C.jsx)(m,{value:`lifecycle:changed`,children:`Lifecycle Changed`}),(0,C.jsx)(m,{value:`instance:created`,children:`Instance Created`}),(0,C.jsx)(m,{value:`instance:removed`,children:`Instance Removed`}),(0,C.jsx)(m,{value:`engine:state-changed`,children:`Engine State`}),(0,C.jsx)(m,{value:`platform:resource`,children:`Platform Resource`}),(0,C.jsx)(m,{value:`platform:operation`,children:`Platform Operation`})]})]})})]})]}),(0,C.jsx)(pe,{className:`min-w-0 py-0`,children:(0,C.jsx)(he,{className:`p-0`,children:(0,C.jsxs)(ge,{children:[(0,C.jsx)(_e,{children:(0,C.jsxs)(y,{children:[(0,C.jsx)(x,{className:`hidden w-12 sm:table-cell`,children:`#`}),(0,C.jsx)(x,{children:`Type`}),(0,C.jsx)(x,{children:`Context`}),(0,C.jsx)(x,{children:`Details`}),(0,C.jsx)(x,{className:`hidden text-right md:table-cell`,children:`Cycle #`}),(0,C.jsx)(x,{className:`hidden text-right sm:table-cell`,children:`Wall Clock`})]})}),(0,C.jsxs)(b,{children:[X&&w.map(e=>(0,C.jsxs)(y,{children:[(0,C.jsx)(v,{className:`hidden sm:table-cell`,children:(0,C.jsx)(`div`,{className:`h-4 w-8 animate-pulse rounded-[var(--miravo-radius-tight)] bg-muted/40`})}),(0,C.jsx)(v,{children:(0,C.jsx)(`div`,{className:`h-5 w-28 animate-pulse rounded-[var(--miravo-radius-tight)] bg-muted/40`})}),(0,C.jsx)(v,{children:(0,C.jsx)(`div`,{className:`h-4 w-36 animate-pulse rounded-[var(--miravo-radius-tight)] bg-muted/30`})}),(0,C.jsx)(v,{children:(0,C.jsx)(`div`,{className:`h-4 w-56 animate-pulse rounded-[var(--miravo-radius-tight)] bg-muted/30`})}),(0,C.jsx)(v,{className:`hidden md:table-cell`,children:(0,C.jsx)(`div`,{className:`ml-auto h-4 w-16 animate-pulse rounded-[var(--miravo-radius-tight)] bg-muted/30`})}),(0,C.jsx)(v,{className:`hidden sm:table-cell`,children:(0,C.jsx)(`div`,{className:`ml-auto h-4 w-20 animate-pulse rounded-[var(--miravo-radius-tight)] bg-muted/30`})})]},e)),G.map(e=>{let t=O(e),n=k(e),r=e.type===`platform:resource`||e.type===`platform:operation`;return(0,C.jsxs)(y,{className:t?`cursor-pointer transition-colors`:``,onMouseEnter:t?()=>ae(`/instance/${t}`):void 0,onClick:t?()=>Ce(`/instance/${t}`,{transitionType:ce}):void 0,children:[(0,C.jsx)(v,{className:`hidden font-mono text-xs text-muted-foreground sm:table-cell`,children:e.id}),(0,C.jsx)(v,{children:(0,C.jsx)(se,{variant:be(e.type),className:`text-xs ${xe(e.type)}`,children:r?e.type===`platform:operation`?`platform:${e.operationType}`:`${e.action}:${e.resourceType}`:e.type})}),(0,C.jsx)(v,{className:`font-mono text-xs`,children:n??`—`}),(0,C.jsx)(v,{className:`max-w-xs truncate font-mono text-xs`,children:A(e)||(0,C.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,C.jsx)(v,{className:`hidden text-right font-mono text-xs md:table-cell`,children:e.tick}),(0,C.jsx)(v,{className:`hidden text-right text-xs text-muted-foreground sm:table-cell`,children:D(e.timestamp,je)})]},e.id)}),Z&&w.map(e=>(0,C.jsxs)(y,{children:[(0,C.jsx)(v,{className:`hidden sm:table-cell`,children:(0,C.jsx)(`div`,{className:`h-4 w-8 animate-pulse rounded-[var(--miravo-radius-tight)] bg-muted/30`})}),(0,C.jsx)(v,{children:(0,C.jsx)(`div`,{className:`h-5 w-28 animate-pulse rounded-[var(--miravo-radius-tight)] bg-muted/30`})}),(0,C.jsx)(v,{children:(0,C.jsx)(`div`,{className:`h-4 w-36 animate-pulse rounded-[var(--miravo-radius-tight)] bg-muted/20`})}),(0,C.jsx)(v,{children:(0,C.jsx)(`div`,{className:`h-4 w-56 animate-pulse rounded-[var(--miravo-radius-tight)] bg-muted/20`})}),(0,C.jsx)(v,{className:`hidden md:table-cell`,children:(0,C.jsx)(`div`,{className:`ml-auto h-4 w-16 animate-pulse rounded-[var(--miravo-radius-tight)] bg-muted/20`})}),(0,C.jsx)(v,{className:`hidden sm:table-cell`,children:(0,C.jsx)(`div`,{className:`ml-auto h-4 w-20 animate-pulse rounded-[var(--miravo-radius-tight)] bg-muted/20`})})]},`warmup-${e}`)),!X&&!Z&&G.length===0&&(0,C.jsx)(y,{children:(0,C.jsx)(v,{colSpan:6,className:`py-8 text-center text-muted-foreground`,children:`No events`})})]})]})})}),De&&(0,C.jsx)(`div`,{className:`flex justify-center border-t border-border/40 pt-4`,children:(0,C.jsx)(ne,{variant:`outline`,size:`sm`,onClick:()=>void Ae(),disabled:Te,children:`Load older events`})})]})}export{M as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./events-B2IxlA63.js";export{e as EventsPage};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{s as t}from"./vendor-charts-CAZdaPlq.js";import{at as n}from"./vendor-ui-mizMYESS.js";import{_ as r,a as i,g as a}from"./api-Bef9FEIU.js";import{i as o,n as s}from"./dist-jROhexoH.js";import{c,n as l}from"./chunk-OE4NN4TA-m2UhO8Q2.js";import{t as u}from"./shallow-ODRQsuRf.js";import{n as d}from"./createLucideIcon-Yddw9eHa.js";import{i as f,n as p,t as m}from"./tooltip-TtanriwA.js";import{S as h,T as g,_,a as v,g as y,h as b,m as ee,p as x,t as te,w as ne,y as re}from"./input-BCiRHEmc.js";import{r as S}from"./engine-store-BUO-9Dsh.js";import{t as C}from"./arrow-right-DrKCU9WM.js";import{t as w}from"./arrow-up-down-CBuv2TSF.js";import{c as T,i as E,n as D,s as O,t as k}from"./select-4wihIkEE.js";import{t as ie}from"./circle-question-mark-Q_q7JZnT.js";import{t as ae}from"./route-preload-CMl-AryU.js";import{t as oe}from"./badge-tnWgSITj.js";import{t as A}from"./skeleton-C6iEH-9E.js";import{t as j}from"./query-keys-Co1J4HmV.js";import{n as se}from"./transition-types-CMW7IObN.js";import{a as ce,i as M,n as le,o as ue,r as de,s as fe,t as pe}from"./combobox-gGNWoksU.js";import{a as N,c as P,i as me,n as he,o as F,r as ge,s as I}from"./select-display-items-DUJCelf2.js";var L=e(t(),1);function _e(e){return a.prefetchQuery({queryKey:j.instances.detail(e),queryFn:()=>i(`/instances/${e}`,r.instanceDetail),staleTime:2e3})}var R=n(),z={success:`bg-success`,warning:`bg-warning`,destructive:`bg-destructive`,foreground:`bg-foreground/60`,primary:`bg-primary`},B={success:`text-success`,warning:`text-warning`,destructive:`text-destructive`,foreground:`text-foreground`,primary:`text-primary`},V={mqtt:`MQTT`,opcua:`OPC UA`,modbus:`Modbus`};function H({label:e,pip:t,pulse:n}){return(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[t&&(n?(0,R.jsxs)(`span`,{"aria-hidden":!0,className:`relative flex size-1.5 shrink-0 items-center justify-center`,children:[(0,R.jsx)(`span`,{className:d(`absolute inline-flex h-full w-full animate-ping rounded-full opacity-75`,z[t])}),(0,R.jsx)(`span`,{className:d(`relative inline-flex size-1.5 rounded-full`,z[t])})]}):(0,R.jsx)(`span`,{"aria-hidden":!0,className:d(`size-1.5 shrink-0 rounded-full`,z[t])})),(0,R.jsx)(`span`,{className:`truncate text-[10px] font-medium uppercase tracking-(--miravo-tracking-eyebrow) text-muted-foreground`,children:e})]})}function U({children:e,tone:t=`foreground`,live:n}){return(0,R.jsx)(`span`,{...n?{role:`status`,"aria-live":`polite`}:{},className:d(`mt-1 block min-w-0 truncate font-mono text-2xl font-semibold tabular-nums leading-none transition-colors duration-300`,B[t]),children:e})}function W({children:e}){return(0,R.jsx)(`span`,{className:`mt-1 min-w-0 truncate text-[10px] text-muted-foreground`,children:e})}function G(e,t){return e===t?``:t}function ve({statusFilter:e,onStatusFilter:t}){let{instances:n,tps:r,memberValueCount:i,availableAdapters:a,adapterMetrics:o}=S(u(e=>({instances:e.instances,tps:e.tps,memberValueCount:e.memberValueCount,availableAdapters:e.availableAdapters,adapterMetrics:e.adapterMetrics}))),s=(0,L.useMemo)(()=>{let e=n.filter(e=>!e.isQuarantined&&e.activeFaults.length===0).length,t=n.filter(e=>!e.isQuarantined&&e.activeFaults.length>0).length,r=n.filter(e=>e.isQuarantined).length,i=n.length;return{healthy:e,faulted:t,quarantined:r,total:i,pct:i>0?Math.round(e/i*100):100,activeFaultCount:n.reduce((e,t)=>e+t.activeFaults.length,0),modelCount:new Set(n.map(e=>e.model)).size,affectedCount:new Set(n.filter(e=>e.activeFaults.length>0).map(e=>e.id)).size}},[n]),c=(0,L.useMemo)(()=>{let e=a.filter(e=>e.enabled);return{enabled:e,totalMessages:e.reduce((e,t)=>e+(o.find(e=>e.name===t.name)?.metrics?.messagesPublished??0),0),totalErrors:e.reduce((e,t)=>e+(o.find(e=>e.name===t.name)?.metrics?.errorsCount??0),0),labels:e.map(e=>V[e.name]??e.name)}},[a,o]),h=s.activeFaultCount>0,g=h?`destructive`:s.quarantined>0?`warning`:`success`,v=h?`faulted`:`healthy`;return(0,R.jsxs)(`section`,{"aria-label":`Fleet status`,className:`flex w-full min-w-0 max-w-full flex-col divide-y divide-border/40 overflow-hidden rounded-(--miravo-radius-stadium-sm) border sm:flex-row sm:divide-x sm:divide-y-0`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>t(G(e,v)),"aria-pressed":e===`healthy`||e===`faulted`,"aria-label":h?`Filter to faulted instances`:`Filter to healthy instances`,className:d(`flex min-w-0 flex-1 flex-col overflow-hidden px-4 py-3 text-left outline-none transition-colors duration-150`,`hover:bg-muted/40 focus-visible:bg-muted/40 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`,(e===`healthy`||e===`faulted`)&&`bg-muted/50`),children:[(0,R.jsx)(H,{label:`Health`,pip:g}),(0,R.jsxs)(U,{tone:h?`destructive`:`success`,children:[s.pct,`%`]}),(0,R.jsx)(W,{children:s.total===0?`No instances`:[`${s.total} instance${s.total===1?``:`s`}`,s.faulted>0&&`${s.faulted} faulted`,s.quarantined>0&&`${s.quarantined} quarantined`,`${s.modelCount} model${s.modelCount===1?``:`s`}`].filter(Boolean).join(` · `)})]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>t(e===`faulted`?``:`faulted`),"aria-pressed":e===`faulted`,"aria-label":`Filter to faulted instances`,className:d(`flex min-w-0 flex-1 flex-col overflow-hidden px-4 py-3 text-left outline-none transition-colors duration-150`,`hover:bg-muted/40 focus-visible:bg-muted/40 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`,e===`faulted`&&`bg-muted/50`),children:[(0,R.jsx)(H,{label:`Faults`,pip:h?`destructive`:`success`}),(0,R.jsx)(U,{tone:h?`destructive`:`foreground`,live:!0,children:s.activeFaultCount}),(0,R.jsx)(W,{children:h?`${s.affectedCount} instance${s.affectedCount===1?``:`s`} affected`:`all clear`})]}),(0,R.jsxs)(m,{children:[(0,R.jsxs)(f,{render:(0,R.jsx)(l,{to:`/tags`,"aria-label":`Open tag stream`,className:`flex min-w-0 flex-1 flex-col overflow-hidden px-4 py-3 outline-none transition-colors duration-150 hover:bg-muted/40 focus-visible:bg-muted/40 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`}),children:[(0,R.jsx)(H,{label:`Tags`,pip:`primary`,pulse:!0}),(0,R.jsx)(U,{children:_(i)}),(0,R.jsxs)(W,{children:[(0,R.jsx)(`span`,{className:`font-mono tabular-nums`,children:r.toFixed(1)}),` tps · live`]})]}),(0,R.jsx)(p,{side:`bottom`,children:(0,R.jsxs)(`div`,{className:`flex flex-col gap-0.5 text-[11px]`,children:[(0,R.jsx)(`span`,{children:`Live tags tracked across the fleet.`}),i>=1e6&&(0,R.jsxs)(`span`,{className:`font-mono tabular-nums text-muted-foreground`,children:[b(i),` tags`]}),(0,R.jsxs)(`span`,{className:`text-muted-foreground`,children:[`Updating at `,(0,R.jsx)(`span`,{className:`font-mono tabular-nums`,children:r.toFixed(1)}),` per second.`]})]})})]}),c.enabled.length>0&&(0,R.jsx)(K,{labels:c.labels,totalMessages:c.totalMessages,totalErrors:c.totalErrors,perAdapter:c.enabled.map(e=>({name:V[e.name]??e.name,metrics:o.find(t=>t.name===e.name)?.metrics}))})]})}function K({labels:e,totalMessages:t,totalErrors:n,perAdapter:r}){return(0,R.jsxs)(m,{children:[(0,R.jsxs)(f,{render:(0,R.jsx)(l,{to:`/control`,"aria-label":`Open control — protocol adapters`,className:`flex min-w-0 flex-1 flex-col overflow-hidden px-4 py-3 outline-none transition-colors duration-150 hover:bg-muted/40 focus-visible:bg-muted/40 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`}),children:[(0,R.jsx)(H,{label:`Protocol`,pip:`primary`,pulse:!0}),(0,R.jsx)(U,{tone:n>0?`warning`:`foreground`,live:!0,children:_(t)}),(0,R.jsxs)(W,{children:[e.join(` · `),n>0&&` · ${n} error${n===1?``:`s`}`]})]}),(0,R.jsx)(p,{side:`bottom`,children:(0,R.jsxs)(`div`,{className:`flex flex-col gap-1 text-[11px]`,children:[(0,R.jsx)(`span`,{children:`Messages published since session start.`}),t>=1e6&&(0,R.jsxs)(`span`,{className:`font-mono tabular-nums text-muted-foreground`,children:[b(t),` total`]}),(0,R.jsx)(`div`,{className:`flex flex-col gap-0.5 border-t border-tooltip-border/60 pt-1`,children:r.map(e=>(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,R.jsxs)(`span`,{className:`font-mono tabular-nums`,children:[b(e.metrics?.messagesPublished??0),` msg`]}),e.metrics&&e.metrics.errorsCount>0&&(0,R.jsxs)(`span`,{className:`font-mono tabular-nums text-destructive`,children:[`· `,e.metrics.errorsCount,` err`]})]},e.name))})]})})]})}var q=`Commissioning → instance is running startup diagnostics. Operating → running normally. Decommissioning → winding down.`;function ye(e,t,n){let r=n===`asc`?1:-1;return[...e].sort((e,n)=>{switch(t){case`id`:return e.id.localeCompare(n.id)*r;case`model`:return e.model.localeCompare(n.model)*r;case`lifecycle`:return e.lifecycleStage.localeCompare(n.lifecycleStage)*r;case`hours`:return(e.operatingHours-n.operatingHours)*r;case`faults`:return(e.activeFaults.length-n.activeFaults.length)*r;case`status`:{let t=e=>e.isQuarantined?2:+(e.activeFaults.length>0);return(t(e)-t(n))*r}default:return 0}})}function be(e){return e===``||e===`healthy`||e===`faulted`||e===`quarantined`}function xe(e){return e.isQuarantined?`quarantined`:e.activeFaults.length>0?`faulted`:`healthy`}var J={healthy:{pip:`bg-success`,ring:`border-success/40 text-success`,label:`healthy`,help:`No active faults, not quarantined.`},faulted:{pip:`bg-warning`,ring:`border-warning/40 text-warning`,label:`faulted`,help:`One or more active faults; instance is still running.`},quarantined:{pip:`bg-destructive`,ring:`border-destructive/40 text-destructive`,label:`quarantined`,help:`Instance isolated from production flows pending review.`}};function Se({state:e}){let t=J[e];return(0,R.jsxs)(m,{children:[(0,R.jsxs)(f,{render:(0,R.jsx)(`span`,{className:d(`inline-flex h-5 items-center gap-1.5 rounded-(--miravo-radius-pill) border bg-background/30 px-2 text-[11px] font-medium`,t.ring)}),children:[(0,R.jsx)(`span`,{"aria-hidden":!0,className:d(`size-1.5 shrink-0 rounded-full`,t.pip)}),(0,R.jsx)(`span`,{children:x(t.label)})]}),(0,R.jsx)(p,{side:`top`,children:t.help})]})}function Y({label:e,sortKey:t,subtitle:n,tooltip:r,current:i,direction:a,onSort:o,className:s}){let c=i===t,l=c?a===`asc`?`ascending`:`descending`:`none`,u=(0,R.jsxs)(`button`,{type:`button`,className:`flex items-center gap-1 whitespace-nowrap rounded-(--miravo-radius-tight) text-left outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background`,onClick:()=>o(t),children:[(0,R.jsxs)(`span`,{className:`inline-flex items-baseline gap-1`,children:[(0,R.jsx)(`span`,{children:e}),n&&(0,R.jsx)(`span`,{className:`text-[10px] font-normal text-muted-foreground`,children:n})]}),(0,R.jsx)(w,{className:d(`size-3`,c?`text-foreground`:`text-muted-foreground`),"aria-hidden":!0}),(0,R.jsx)(`span`,{className:`sr-only`,children:c?`, sorted ${a===`asc`?`ascending`:`descending`}. Click to toggle.`:`, click to sort`})]});return(0,R.jsx)(F,{className:s,"aria-sort":l,children:r?(0,R.jsxs)(m,{children:[(0,R.jsx)(f,{render:u}),(0,R.jsx)(p,{side:`top`,children:r})]}):u})}function Ce({rows:e=6}){return(0,R.jsx)(R.Fragment,{children:Array.from({length:e}).map((e,t)=>(0,R.jsxs)(P,{"aria-hidden":!0,children:[(0,R.jsx)(N,{children:(0,R.jsx)(A,{className:`h-4 w-24`})}),(0,R.jsx)(N,{className:`hidden sm:table-cell`,children:(0,R.jsx)(A,{className:`h-4 w-20`})}),(0,R.jsx)(N,{children:(0,R.jsx)(A,{className:`h-4 w-16`})}),(0,R.jsx)(N,{className:`hidden md:table-cell`,children:(0,R.jsx)(A,{className:`ml-auto h-4 w-14`})}),(0,R.jsx)(N,{children:(0,R.jsx)(A,{className:`h-4 w-6`})}),(0,R.jsx)(N,{children:(0,R.jsx)(A,{className:`h-5 w-20 rounded-(--miravo-radius-pill)`})}),(0,R.jsx)(N,{children:(0,R.jsx)(A,{className:`h-4 w-4`})})]},`skel-${t}`))})}function X({title:e,body:t,action:n}){return(0,R.jsx)(P,{children:(0,R.jsx)(N,{colSpan:7,className:`py-10`,children:(0,R.jsxs)(`div`,{className:`mx-auto flex max-w-sm flex-col items-center gap-2 text-center`,children:[(0,R.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:e}),(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t}),n&&(0,R.jsxs)(`a`,{href:n.href,className:`mt-1 inline-flex items-center gap-1 rounded-(--miravo-radius-tight) text-xs font-medium text-primary outline-none hover:underline focus-visible:ring-2 focus-visible:ring-ring`,children:[n.label,(0,R.jsx)(C,{className:`size-3`,"aria-hidden":!0})]})]})})})}function Z(){let{instances:e,connectionState:t}=S(u(e=>({instances:e.instances,connectionState:e.connectionState}))),[n,r]=o(`q`,s.withDefault(``)),[i,a]=o(`model`,s.withDefault(``)),[l,d]=o(`lifecycle`,s.withDefault(``)),[_,b]=o(`status`,s.withDefault(``)),x=be(_)?_:``,[w,A]=(0,L.useState)(`id`),[j,z]=(0,L.useState)(`asc`),B=(0,L.useRef)(null),V=c(),[H,U]=(0,L.useState)(``);(0,L.useEffect)(()=>{let e=e=>{if(e.key!==`/`||e.metaKey||e.ctrlKey||e.altKey)return;let t=e.target.tagName;t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||(e.preventDefault(),B.current?.focus())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let W=(0,L.useCallback)(e=>{e===w?z(e=>e===`asc`?`desc`:`asc`):(A(e),z(`asc`))},[w]),G=(0,L.useCallback)(e=>{b(e===``?``:e)},[b]),K=(0,L.useMemo)(()=>{let t=new Map;for(let n of e)t.set(n.model,(t.get(n.model)??0)+1);return[...t.entries()].sort((e,t)=>e[0].localeCompare(t[0]))},[e]),J=(0,L.useMemo)(()=>[...new Set(e.map(e=>e.lifecycleStage))].sort(),[e]),Z=(0,L.useMemo)(()=>[{value:`all`,label:`All stages`},...J.map(e=>({value:e,label:h(e)}))],[J]),Q=(0,L.useMemo)(()=>H?K.filter(([e])=>g(e,H)):K,[K,H]),we=(0,L.useMemo)(()=>i?{value:i,label:y(i)}:null,[i]),$=(0,L.useMemo)(()=>{let t=e;return i&&(t=t.filter(e=>e.model===i)),l&&(t=t.filter(e=>e.lifecycleStage===l)),n&&(t=t.filter(e=>ne(e.id,n)||g(e.model,n))),x===`faulted`&&(t=t.filter(e=>e.activeFaults.length>0)),x===`quarantined`&&(t=t.filter(e=>e.isQuarantined)),x===`healthy`&&(t=t.filter(e=>e.activeFaults.length===0&&!e.isQuarantined)),ye(t,w,j)},[e,n,x,i,l,w,j]),Te=x!==``||i!==``||l!==``||n!==``,Ee=(0,L.useCallback)(()=>{r(``),b(``),a(``),d(``)},[r,b,a,d]),De=(0,L.useCallback)(e=>{(0,L.startTransition)(()=>{(0,L.addTransitionType)(se),V(`/instance/${e}`)})},[V]),Oe=e.length===0&&t!==`live`,ke=e.length===0&&t===`live`;return(0,R.jsxs)(`div`,{className:`mx-auto flex w-full max-w-screen-2xl flex-col gap-5 p-4 sm:gap-6 sm:p-6`,children:[(0,R.jsx)(`h1`,{className:`font-heading text-2xl font-semibold tracking-tight`,children:`Fleet Overview`}),(0,R.jsx)(ve,{statusFilter:x,onStatusFilter:G}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,R.jsxs)(pe,{value:we,onValueChange:e=>void a(e?.value??``),isItemEqualToValue:(e,t)=>e?.value===t?.value,onInputValueChange:U,children:[(0,R.jsx)(de,{placeholder:`All models`,className:`h-8 w-48`,showClear:!!i}),(0,R.jsx)(le,{children:(0,R.jsxs)(ce,{children:[Q.map(([e,t])=>(0,R.jsxs)(M,{value:{value:e,label:y(e)},children:[(0,R.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:y(e)}),(0,R.jsxs)(`span`,{className:`shrink-0 tabular-nums text-muted-foreground`,children:[`(`,t,`)`]})]},e)),Q.length===0&&(0,R.jsx)(`p`,{className:`py-2 text-center text-xs text-muted-foreground`,children:`No models found`})]})})]}),J.length>1&&(0,R.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,R.jsxs)(k,{value:l||`all`,onValueChange:e=>void d(!e||e===`all`?``:e),items:Z,children:[(0,R.jsx)(O,{className:`h-8 w-36`,"aria-label":`Lifecycle stage`,children:(0,R.jsx)(T,{placeholder:`All stages`})}),(0,R.jsxs)(D,{alignItemWithTrigger:!1,align:`start`,children:[(0,R.jsx)(E,{value:`all`,children:`All stages`}),J.map(e=>(0,R.jsx)(E,{value:e,children:h(e)},e))]})]}),(0,R.jsxs)(m,{children:[(0,R.jsx)(f,{render:(0,R.jsx)(`button`,{type:`button`,"aria-label":`About lifecycle stages`,className:`flex size-6 items-center justify-center rounded-(--miravo-radius-tight) text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring`}),children:(0,R.jsx)(ie,{className:`size-3.5`,"aria-hidden":!0})}),(0,R.jsx)(p,{side:`top`,children:q})]})]}),(0,R.jsxs)(k,{value:x||`all`,onValueChange:e=>void b(!e||e===`all`?``:e),items:he,children:[(0,R.jsx)(O,{className:`h-8 w-32`,"aria-label":`Status filter`,children:(0,R.jsx)(T,{placeholder:`All status`})}),(0,R.jsxs)(D,{alignItemWithTrigger:!1,align:`start`,children:[(0,R.jsx)(E,{value:`all`,children:`All status`}),(0,R.jsx)(E,{value:`healthy`,children:`Healthy`}),(0,R.jsx)(E,{value:`faulted`,children:`Faulted`}),(0,R.jsx)(E,{value:`quarantined`,children:`Quarantined`})]})]}),(0,R.jsxs)(`div`,{className:`relative`,children:[(0,R.jsx)(te,{ref:B,placeholder:`Search...`,value:n,onChange:e=>void r(e.target.value),"aria-label":`Search instances by id or model`,className:`h-8 w-40 pr-7 text-xs`}),!n&&(0,R.jsx)(`kbd`,{className:`pointer-events-none absolute top-1/2 right-2 -translate-y-1/2 rounded-(--miravo-radius-tight) border border-border bg-muted px-1 font-mono text-[10px] text-muted-foreground`,children:`/`})]}),Te&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`button`,{type:`button`,onClick:Ee,className:`flex items-center gap-1 rounded-(--miravo-radius-tight) px-1 text-xs text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,R.jsx)(v,{className:`size-3`,"aria-hidden":!0}),`Clear`]}),(0,R.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,"aria-live":`polite`,children:[$.length,` of `,e.length]})]})]}),(0,R.jsx)(ue,{className:`py-0`,children:(0,R.jsx)(fe,{className:`p-0 [&_thead_tr_th:last-child]:w-6 [&_thead_tr_th:last-child]:px-1 sm:[&_thead_tr_th:last-child]:w-8 sm:[&_thead_tr_th:last-child]:px-2 [&_tbody_tr_td:last-child]:px-1 sm:[&_tbody_tr_td:last-child]:px-2`,children:(0,R.jsxs)(ge,{children:[(0,R.jsx)(I,{children:(0,R.jsxs)(P,{children:[(0,R.jsx)(Y,{label:`Instance`,sortKey:`id`,current:w,direction:j,onSort:W}),(0,R.jsx)(Y,{label:`Model`,sortKey:`model`,current:w,direction:j,onSort:W,className:`hidden sm:table-cell`}),(0,R.jsx)(Y,{label:`Lifecycle`,sortKey:`lifecycle`,current:w,direction:j,onSort:W,tooltip:q}),(0,R.jsx)(Y,{label:`Operating age`,sortKey:`hours`,current:w,direction:j,onSort:W,tooltip:`Cumulative operating hours since the instance started running.`,className:`hidden text-right md:table-cell`}),(0,R.jsx)(Y,{label:`Faults`,sortKey:`faults`,current:w,direction:j,onSort:W,tooltip:`Count of active (uncleared) faults on this instance.`}),(0,R.jsx)(Y,{label:`Status`,sortKey:`status`,current:w,direction:j,onSort:W}),(0,R.jsx)(F,{children:(0,R.jsx)(`span`,{className:`sr-only`,children:`Navigate to instance`})})]})}),(0,R.jsx)(me,{children:Oe?(0,R.jsx)(Ce,{rows:6}):ke?(0,R.jsx)(X,{title:`No running instances`,body:`Start an environment on a platform to deploy simulated instances into the fleet.`,action:{label:`Open Platforms`,href:`/platforms`}}):$.length===0?(0,R.jsx)(X,{title:`No matches`,body:`Adjust filters or clear them to see the full fleet.`}):$.map(e=>{let t=xe(e);return(0,R.jsxs)(P,{className:`group cursor-pointer transition-colors`,onMouseEnter:()=>{ae(`/instance/${e.id}`),_e(e.id)},onClick:()=>De(e.id),children:[(0,R.jsx)(N,{className:`text-sm`,children:(0,R.jsx)(L.ViewTransition,{name:`instance-${e.id}`,default:`none`,children:(0,R.jsx)(`span`,{children:ee(e.id)})})}),(0,R.jsx)(N,{className:`hidden text-sm sm:table-cell`,children:y(e.model)}),(0,R.jsx)(N,{children:(0,R.jsx)(oe,{variant:`secondary`,className:`text-xs`,children:h(e.lifecycleStage)})}),(0,R.jsx)(N,{className:`hidden font-mono text-sm md:table-cell`,children:re(e.operatingHours)}),(0,R.jsx)(N,{children:e.activeFaults.length>0?(0,R.jsxs)(m,{children:[(0,R.jsx)(f,{render:(0,R.jsx)(`span`,{className:`inline-flex h-5 min-w-5 items-center justify-center rounded-(--miravo-radius-pill) bg-destructive/15 px-1.5 font-mono text-[11px] font-semibold tabular-nums text-destructive`}),children:e.activeFaults.length}),(0,R.jsxs)(p,{side:`top`,children:[e.activeFaults.slice(0,4).join(`, `),e.activeFaults.length>4&&` + ${e.activeFaults.length-4} more`]})]}):(0,R.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[(0,R.jsx)(`span`,{className:`sr-only`,children:`no faults`}),(0,R.jsx)(`span`,{"aria-hidden":!0,children:`—`})]})}),(0,R.jsx)(N,{children:(0,R.jsx)(Se,{state:t})}),(0,R.jsx)(N,{children:(0,R.jsx)(C,{className:`size-3.5 text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100 group-focus-visible:opacity-100`,"aria-hidden":!0})})]},e.id)})})]})})})]})}export{Z as t};
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{s as t}from"./vendor-charts-CAZdaPlq.js";import{at as n}from"./vendor-ui-mizMYESS.js";import{_ as r,a as i,g as a}from"./api-BjnU1LXi.js";import{i as o,n as s}from"./dist-jROhexoH.js";import{c,n as l}from"./chunk-OE4NN4TA-m2UhO8Q2.js";import{t as u}from"./shallow-ODRQsuRf.js";import{n as d}from"./createLucideIcon-Yddw9eHa.js";import{i as f,n as p,t as m}from"./tooltip-TtanriwA.js";import{S as h,T as g,_,a as v,g as y,h as b,m as ee,p as x,t as te,w as ne,y as re}from"./input-BCiRHEmc.js";import{r as S}from"./engine-store-BUO-9Dsh.js";import{t as C}from"./arrow-right-DrKCU9WM.js";import{t as w}from"./arrow-up-down-CBuv2TSF.js";import{c as T,i as E,n as D,s as O,t as k}from"./select-4wihIkEE.js";import{t as ie}from"./circle-question-mark-Q_q7JZnT.js";import{t as ae}from"./route-preload-DZpMivUv.js";import{t as oe}from"./badge-tnWgSITj.js";import{t as A}from"./skeleton-C6iEH-9E.js";import{t as j}from"./query-keys-Co1J4HmV.js";import{n as se}from"./transition-types-CMW7IObN.js";import{a as ce,i as M,n as le,o as ue,r as de,s as fe,t as pe}from"./combobox-gGNWoksU.js";import{a as N,c as P,i as me,n as he,o as F,r as ge,s as I}from"./select-display-items-DUJCelf2.js";var L=e(t(),1);function _e(e){return a.prefetchQuery({queryKey:j.instances.detail(e),queryFn:()=>i(`/instances/${e}`,r.instanceDetail),staleTime:2e3})}var R=n(),z={success:`bg-success`,warning:`bg-warning`,destructive:`bg-destructive`,foreground:`bg-foreground/60`,primary:`bg-primary`},B={success:`text-success`,warning:`text-warning`,destructive:`text-destructive`,foreground:`text-foreground`,primary:`text-primary`},V={mqtt:`MQTT`,opcua:`OPC UA`,modbus:`Modbus`};function H({label:e,pip:t,pulse:n}){return(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[t&&(n?(0,R.jsxs)(`span`,{"aria-hidden":!0,className:`relative flex size-1.5 shrink-0 items-center justify-center`,children:[(0,R.jsx)(`span`,{className:d(`absolute inline-flex h-full w-full animate-ping rounded-full opacity-75`,z[t])}),(0,R.jsx)(`span`,{className:d(`relative inline-flex size-1.5 rounded-full`,z[t])})]}):(0,R.jsx)(`span`,{"aria-hidden":!0,className:d(`size-1.5 shrink-0 rounded-full`,z[t])})),(0,R.jsx)(`span`,{className:`truncate text-[10px] font-medium uppercase tracking-(--miravo-tracking-eyebrow) text-muted-foreground`,children:e})]})}function U({children:e,tone:t=`foreground`,live:n}){return(0,R.jsx)(`span`,{...n?{role:`status`,"aria-live":`polite`}:{},className:d(`mt-1 block min-w-0 truncate font-mono text-2xl font-semibold tabular-nums leading-none transition-colors duration-300`,B[t]),children:e})}function W({children:e}){return(0,R.jsx)(`span`,{className:`mt-1 min-w-0 truncate text-[10px] text-muted-foreground`,children:e})}function G(e,t){return e===t?``:t}function ve({statusFilter:e,onStatusFilter:t}){let{instances:n,tps:r,memberValueCount:i,availableAdapters:a,adapterMetrics:o}=S(u(e=>({instances:e.instances,tps:e.tps,memberValueCount:e.memberValueCount,availableAdapters:e.availableAdapters,adapterMetrics:e.adapterMetrics}))),s=(0,L.useMemo)(()=>{let e=n.filter(e=>!e.isQuarantined&&e.activeFaults.length===0).length,t=n.filter(e=>!e.isQuarantined&&e.activeFaults.length>0).length,r=n.filter(e=>e.isQuarantined).length,i=n.length;return{healthy:e,faulted:t,quarantined:r,total:i,pct:i>0?Math.round(e/i*100):100,activeFaultCount:n.reduce((e,t)=>e+t.activeFaults.length,0),modelCount:new Set(n.map(e=>e.model)).size,affectedCount:new Set(n.filter(e=>e.activeFaults.length>0).map(e=>e.id)).size}},[n]),c=(0,L.useMemo)(()=>{let e=a.filter(e=>e.enabled);return{enabled:e,totalMessages:e.reduce((e,t)=>e+(o.find(e=>e.name===t.name)?.metrics?.messagesPublished??0),0),totalErrors:e.reduce((e,t)=>e+(o.find(e=>e.name===t.name)?.metrics?.errorsCount??0),0),labels:e.map(e=>V[e.name]??e.name)}},[a,o]),h=s.activeFaultCount>0,g=h?`destructive`:s.quarantined>0?`warning`:`success`,v=h?`faulted`:`healthy`;return(0,R.jsxs)(`section`,{"aria-label":`Fleet status`,className:`flex w-full min-w-0 max-w-full flex-col divide-y divide-border/40 overflow-hidden rounded-(--miravo-radius-stadium-sm) border sm:flex-row sm:divide-x sm:divide-y-0`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>t(G(e,v)),"aria-pressed":e===`healthy`||e===`faulted`,"aria-label":h?`Filter to faulted instances`:`Filter to healthy instances`,className:d(`flex min-w-0 flex-1 flex-col overflow-hidden px-4 py-3 text-left outline-none transition-colors duration-150`,`hover:bg-muted/40 focus-visible:bg-muted/40 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`,(e===`healthy`||e===`faulted`)&&`bg-muted/50`),children:[(0,R.jsx)(H,{label:`Health`,pip:g}),(0,R.jsxs)(U,{tone:h?`destructive`:`success`,children:[s.pct,`%`]}),(0,R.jsx)(W,{children:s.total===0?`No instances`:[`${s.total} instance${s.total===1?``:`s`}`,s.faulted>0&&`${s.faulted} faulted`,s.quarantined>0&&`${s.quarantined} quarantined`,`${s.modelCount} model${s.modelCount===1?``:`s`}`].filter(Boolean).join(` · `)})]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>t(e===`faulted`?``:`faulted`),"aria-pressed":e===`faulted`,"aria-label":`Filter to faulted instances`,className:d(`flex min-w-0 flex-1 flex-col overflow-hidden px-4 py-3 text-left outline-none transition-colors duration-150`,`hover:bg-muted/40 focus-visible:bg-muted/40 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`,e===`faulted`&&`bg-muted/50`),children:[(0,R.jsx)(H,{label:`Faults`,pip:h?`destructive`:`success`}),(0,R.jsx)(U,{tone:h?`destructive`:`foreground`,live:!0,children:s.activeFaultCount}),(0,R.jsx)(W,{children:h?`${s.affectedCount} instance${s.affectedCount===1?``:`s`} affected`:`all clear`})]}),(0,R.jsxs)(m,{children:[(0,R.jsxs)(f,{render:(0,R.jsx)(l,{to:`/tags`,"aria-label":`Open tag stream`,className:`flex min-w-0 flex-1 flex-col overflow-hidden px-4 py-3 outline-none transition-colors duration-150 hover:bg-muted/40 focus-visible:bg-muted/40 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`}),children:[(0,R.jsx)(H,{label:`Tags`,pip:`primary`,pulse:!0}),(0,R.jsx)(U,{children:_(i)}),(0,R.jsxs)(W,{children:[(0,R.jsx)(`span`,{className:`font-mono tabular-nums`,children:r.toFixed(1)}),` tps · live`]})]}),(0,R.jsx)(p,{side:`bottom`,children:(0,R.jsxs)(`div`,{className:`flex flex-col gap-0.5 text-[11px]`,children:[(0,R.jsx)(`span`,{children:`Live tags tracked across the fleet.`}),i>=1e6&&(0,R.jsxs)(`span`,{className:`font-mono tabular-nums text-muted-foreground`,children:[b(i),` tags`]}),(0,R.jsxs)(`span`,{className:`text-muted-foreground`,children:[`Updating at `,(0,R.jsx)(`span`,{className:`font-mono tabular-nums`,children:r.toFixed(1)}),` per second.`]})]})})]}),c.enabled.length>0&&(0,R.jsx)(K,{labels:c.labels,totalMessages:c.totalMessages,totalErrors:c.totalErrors,perAdapter:c.enabled.map(e=>({name:V[e.name]??e.name,metrics:o.find(t=>t.name===e.name)?.metrics}))})]})}function K({labels:e,totalMessages:t,totalErrors:n,perAdapter:r}){return(0,R.jsxs)(m,{children:[(0,R.jsxs)(f,{render:(0,R.jsx)(l,{to:`/control`,"aria-label":`Open control — protocol adapters`,className:`flex min-w-0 flex-1 flex-col overflow-hidden px-4 py-3 outline-none transition-colors duration-150 hover:bg-muted/40 focus-visible:bg-muted/40 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`}),children:[(0,R.jsx)(H,{label:`Protocol`,pip:`primary`,pulse:!0}),(0,R.jsx)(U,{tone:n>0?`warning`:`foreground`,live:!0,children:_(t)}),(0,R.jsxs)(W,{children:[e.join(` · `),n>0&&` · ${n} error${n===1?``:`s`}`]})]}),(0,R.jsx)(p,{side:`bottom`,children:(0,R.jsxs)(`div`,{className:`flex flex-col gap-1 text-[11px]`,children:[(0,R.jsx)(`span`,{children:`Messages published since session start.`}),t>=1e6&&(0,R.jsxs)(`span`,{className:`font-mono tabular-nums text-muted-foreground`,children:[b(t),` total`]}),(0,R.jsx)(`div`,{className:`flex flex-col gap-0.5 border-t border-tooltip-border/60 pt-1`,children:r.map(e=>(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,R.jsxs)(`span`,{className:`font-mono tabular-nums`,children:[b(e.metrics?.messagesPublished??0),` msg`]}),e.metrics&&e.metrics.errorsCount>0&&(0,R.jsxs)(`span`,{className:`font-mono tabular-nums text-destructive`,children:[`· `,e.metrics.errorsCount,` err`]})]},e.name))})]})})]})}var q=`Commissioning → instance is running startup diagnostics. Operating → running normally. Decommissioning → winding down.`;function ye(e,t,n){let r=n===`asc`?1:-1;return[...e].sort((e,n)=>{switch(t){case`id`:return e.id.localeCompare(n.id)*r;case`model`:return e.model.localeCompare(n.model)*r;case`lifecycle`:return e.lifecycleStage.localeCompare(n.lifecycleStage)*r;case`hours`:return(e.operatingHours-n.operatingHours)*r;case`faults`:return(e.activeFaults.length-n.activeFaults.length)*r;case`status`:{let t=e=>e.isQuarantined?2:+(e.activeFaults.length>0);return(t(e)-t(n))*r}default:return 0}})}function be(e){return e===``||e===`healthy`||e===`faulted`||e===`quarantined`}function xe(e){return e.isQuarantined?`quarantined`:e.activeFaults.length>0?`faulted`:`healthy`}var J={healthy:{pip:`bg-success`,ring:`border-success/40 text-success`,label:`healthy`,help:`No active faults, not quarantined.`},faulted:{pip:`bg-warning`,ring:`border-warning/40 text-warning`,label:`faulted`,help:`One or more active faults; instance is still running.`},quarantined:{pip:`bg-destructive`,ring:`border-destructive/40 text-destructive`,label:`quarantined`,help:`Instance isolated from production flows pending review.`}};function Se({state:e}){let t=J[e];return(0,R.jsxs)(m,{children:[(0,R.jsxs)(f,{render:(0,R.jsx)(`span`,{className:d(`inline-flex h-5 items-center gap-1.5 rounded-(--miravo-radius-pill) border bg-background/30 px-2 text-[11px] font-medium`,t.ring)}),children:[(0,R.jsx)(`span`,{"aria-hidden":!0,className:d(`size-1.5 shrink-0 rounded-full`,t.pip)}),(0,R.jsx)(`span`,{children:x(t.label)})]}),(0,R.jsx)(p,{side:`top`,children:t.help})]})}function Y({label:e,sortKey:t,subtitle:n,tooltip:r,current:i,direction:a,onSort:o,className:s}){let c=i===t,l=c?a===`asc`?`ascending`:`descending`:`none`,u=(0,R.jsxs)(`button`,{type:`button`,className:`flex items-center gap-1 whitespace-nowrap rounded-(--miravo-radius-tight) text-left outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background`,onClick:()=>o(t),children:[(0,R.jsxs)(`span`,{className:`inline-flex items-baseline gap-1`,children:[(0,R.jsx)(`span`,{children:e}),n&&(0,R.jsx)(`span`,{className:`text-[10px] font-normal text-muted-foreground`,children:n})]}),(0,R.jsx)(w,{className:d(`size-3`,c?`text-foreground`:`text-muted-foreground`),"aria-hidden":!0}),(0,R.jsx)(`span`,{className:`sr-only`,children:c?`, sorted ${a===`asc`?`ascending`:`descending`}. Click to toggle.`:`, click to sort`})]});return(0,R.jsx)(F,{className:s,"aria-sort":l,children:r?(0,R.jsxs)(m,{children:[(0,R.jsx)(f,{render:u}),(0,R.jsx)(p,{side:`top`,children:r})]}):u})}function Ce({rows:e=6}){return(0,R.jsx)(R.Fragment,{children:Array.from({length:e}).map((e,t)=>(0,R.jsxs)(P,{"aria-hidden":!0,children:[(0,R.jsx)(N,{children:(0,R.jsx)(A,{className:`h-4 w-24`})}),(0,R.jsx)(N,{className:`hidden sm:table-cell`,children:(0,R.jsx)(A,{className:`h-4 w-20`})}),(0,R.jsx)(N,{children:(0,R.jsx)(A,{className:`h-4 w-16`})}),(0,R.jsx)(N,{className:`hidden md:table-cell`,children:(0,R.jsx)(A,{className:`ml-auto h-4 w-14`})}),(0,R.jsx)(N,{children:(0,R.jsx)(A,{className:`h-4 w-6`})}),(0,R.jsx)(N,{children:(0,R.jsx)(A,{className:`h-5 w-20 rounded-(--miravo-radius-pill)`})}),(0,R.jsx)(N,{children:(0,R.jsx)(A,{className:`h-4 w-4`})})]},`skel-${t}`))})}function X({title:e,body:t,action:n}){return(0,R.jsx)(P,{children:(0,R.jsx)(N,{colSpan:7,className:`py-10`,children:(0,R.jsxs)(`div`,{className:`mx-auto flex max-w-sm flex-col items-center gap-2 text-center`,children:[(0,R.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:e}),(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t}),n&&(0,R.jsxs)(l,{to:n.href,className:`mt-1 inline-flex items-center gap-1 rounded-(--miravo-radius-tight) text-xs font-medium text-primary outline-none hover:underline focus-visible:ring-2 focus-visible:ring-ring`,children:[n.label,(0,R.jsx)(C,{className:`size-3`,"aria-hidden":!0})]})]})})})}function Z(){let{instances:e,connectionState:t}=S(u(e=>({instances:e.instances,connectionState:e.connectionState}))),[n,r]=o(`q`,s.withDefault(``)),[i,a]=o(`model`,s.withDefault(``)),[l,d]=o(`lifecycle`,s.withDefault(``)),[_,b]=o(`status`,s.withDefault(``)),x=be(_)?_:``,[w,A]=(0,L.useState)(`id`),[j,z]=(0,L.useState)(`asc`),B=(0,L.useRef)(null),V=c(),[H,U]=(0,L.useState)(``);(0,L.useEffect)(()=>{let e=e=>{if(e.key!==`/`||e.metaKey||e.ctrlKey||e.altKey)return;let t=e.target.tagName;t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||(e.preventDefault(),B.current?.focus())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let W=(0,L.useCallback)(e=>{e===w?z(e=>e===`asc`?`desc`:`asc`):(A(e),z(`asc`))},[w]),G=(0,L.useCallback)(e=>{b(e===``?``:e)},[b]),K=(0,L.useMemo)(()=>{let t=new Map;for(let n of e)t.set(n.model,(t.get(n.model)??0)+1);return[...t.entries()].sort((e,t)=>e[0].localeCompare(t[0]))},[e]),J=(0,L.useMemo)(()=>[...new Set(e.map(e=>e.lifecycleStage))].sort(),[e]),Z=(0,L.useMemo)(()=>[{value:`all`,label:`All stages`},...J.map(e=>({value:e,label:h(e)}))],[J]),Q=(0,L.useMemo)(()=>H?K.filter(([e])=>g(e,H)):K,[K,H]),we=(0,L.useMemo)(()=>i?{value:i,label:y(i)}:null,[i]),$=(0,L.useMemo)(()=>{let t=e;return i&&(t=t.filter(e=>e.model===i)),l&&(t=t.filter(e=>e.lifecycleStage===l)),n&&(t=t.filter(e=>ne(e.id,n)||g(e.model,n))),x===`faulted`&&(t=t.filter(e=>e.activeFaults.length>0)),x===`quarantined`&&(t=t.filter(e=>e.isQuarantined)),x===`healthy`&&(t=t.filter(e=>e.activeFaults.length===0&&!e.isQuarantined)),ye(t,w,j)},[e,n,x,i,l,w,j]),Te=x!==``||i!==``||l!==``||n!==``,Ee=(0,L.useCallback)(()=>{r(``),b(``),a(``),d(``)},[r,b,a,d]),De=(0,L.useCallback)(e=>{(0,L.startTransition)(()=>{(0,L.addTransitionType)(se),V(`/instance/${e}`)})},[V]),Oe=e.length===0&&t!==`live`,ke=e.length===0&&t===`live`;return(0,R.jsxs)(`div`,{className:`mx-auto flex w-full max-w-screen-2xl flex-col gap-5 p-4 sm:gap-6 sm:p-6`,children:[(0,R.jsx)(`h1`,{className:`font-heading text-2xl font-semibold tracking-tight`,children:`Fleet Overview`}),(0,R.jsx)(ve,{statusFilter:x,onStatusFilter:G}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,R.jsxs)(pe,{value:we,onValueChange:e=>void a(e?.value??``),isItemEqualToValue:(e,t)=>e?.value===t?.value,onInputValueChange:U,children:[(0,R.jsx)(de,{placeholder:`All models`,className:`h-8 w-48`,showClear:!!i}),(0,R.jsx)(le,{children:(0,R.jsxs)(ce,{children:[Q.map(([e,t])=>(0,R.jsxs)(M,{value:{value:e,label:y(e)},children:[(0,R.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:y(e)}),(0,R.jsxs)(`span`,{className:`shrink-0 tabular-nums text-muted-foreground`,children:[`(`,t,`)`]})]},e)),Q.length===0&&(0,R.jsx)(`p`,{className:`py-2 text-center text-xs text-muted-foreground`,children:`No models found`})]})})]}),J.length>1&&(0,R.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,R.jsxs)(k,{value:l||`all`,onValueChange:e=>void d(!e||e===`all`?``:e),items:Z,children:[(0,R.jsx)(O,{className:`h-8 w-36`,"aria-label":`Lifecycle stage`,children:(0,R.jsx)(T,{placeholder:`All stages`})}),(0,R.jsxs)(D,{alignItemWithTrigger:!1,align:`start`,children:[(0,R.jsx)(E,{value:`all`,children:`All stages`}),J.map(e=>(0,R.jsx)(E,{value:e,children:h(e)},e))]})]}),(0,R.jsxs)(m,{children:[(0,R.jsx)(f,{render:(0,R.jsx)(`button`,{type:`button`,"aria-label":`About lifecycle stages`,className:`flex size-6 items-center justify-center rounded-(--miravo-radius-tight) text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring`}),children:(0,R.jsx)(ie,{className:`size-3.5`,"aria-hidden":!0})}),(0,R.jsx)(p,{side:`top`,children:q})]})]}),(0,R.jsxs)(k,{value:x||`all`,onValueChange:e=>void b(!e||e===`all`?``:e),items:he,children:[(0,R.jsx)(O,{className:`h-8 w-32`,"aria-label":`Status filter`,children:(0,R.jsx)(T,{placeholder:`All status`})}),(0,R.jsxs)(D,{alignItemWithTrigger:!1,align:`start`,children:[(0,R.jsx)(E,{value:`all`,children:`All status`}),(0,R.jsx)(E,{value:`healthy`,children:`Healthy`}),(0,R.jsx)(E,{value:`faulted`,children:`Faulted`}),(0,R.jsx)(E,{value:`quarantined`,children:`Quarantined`})]})]}),(0,R.jsxs)(`div`,{className:`relative`,children:[(0,R.jsx)(te,{ref:B,placeholder:`Search...`,value:n,onChange:e=>void r(e.target.value),"aria-label":`Search instances by id or model`,className:`h-8 w-40 pr-7 text-xs`}),!n&&(0,R.jsx)(`kbd`,{className:`pointer-events-none absolute top-1/2 right-2 -translate-y-1/2 rounded-(--miravo-radius-tight) border border-border bg-muted px-1 font-mono text-[10px] text-muted-foreground`,children:`/`})]}),Te&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`button`,{type:`button`,onClick:Ee,className:`flex items-center gap-1 rounded-(--miravo-radius-tight) px-1 text-xs text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,R.jsx)(v,{className:`size-3`,"aria-hidden":!0}),`Clear`]}),(0,R.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,"aria-live":`polite`,children:[$.length,` of `,e.length]})]})]}),(0,R.jsx)(ue,{className:`py-0`,children:(0,R.jsx)(fe,{className:`p-0 [&_thead_tr_th:last-child]:w-6 [&_thead_tr_th:last-child]:px-1 sm:[&_thead_tr_th:last-child]:w-8 sm:[&_thead_tr_th:last-child]:px-2 [&_tbody_tr_td:last-child]:px-1 sm:[&_tbody_tr_td:last-child]:px-2`,children:(0,R.jsxs)(ge,{children:[(0,R.jsx)(I,{children:(0,R.jsxs)(P,{children:[(0,R.jsx)(Y,{label:`Instance`,sortKey:`id`,current:w,direction:j,onSort:W}),(0,R.jsx)(Y,{label:`Model`,sortKey:`model`,current:w,direction:j,onSort:W,className:`hidden sm:table-cell`}),(0,R.jsx)(Y,{label:`Lifecycle`,sortKey:`lifecycle`,current:w,direction:j,onSort:W,tooltip:q}),(0,R.jsx)(Y,{label:`Operating age`,sortKey:`hours`,current:w,direction:j,onSort:W,tooltip:`Cumulative operating hours since the instance started running.`,className:`hidden text-right md:table-cell`}),(0,R.jsx)(Y,{label:`Faults`,sortKey:`faults`,current:w,direction:j,onSort:W,tooltip:`Count of active (uncleared) faults on this instance.`}),(0,R.jsx)(Y,{label:`Status`,sortKey:`status`,current:w,direction:j,onSort:W}),(0,R.jsx)(F,{children:(0,R.jsx)(`span`,{className:`sr-only`,children:`Navigate to instance`})})]})}),(0,R.jsx)(me,{children:Oe?(0,R.jsx)(Ce,{rows:6}):ke?(0,R.jsx)(X,{title:`No running instances`,body:`Start an environment from the Catalog to see instances.`,action:{label:`Open Catalog`,href:`/catalog`}}):$.length===0?(0,R.jsx)(X,{title:`No matches`,body:`Adjust filters or clear them to see the full fleet.`}):$.map(e=>{let t=xe(e);return(0,R.jsxs)(P,{className:`group cursor-pointer transition-colors`,onMouseEnter:()=>{ae(`/instance/${e.id}`),_e(e.id)},onClick:()=>De(e.id),children:[(0,R.jsx)(N,{className:`text-sm`,children:(0,R.jsx)(L.ViewTransition,{name:`instance-${e.id}`,default:`none`,children:(0,R.jsx)(`span`,{children:ee(e.id)})})}),(0,R.jsx)(N,{className:`hidden text-sm sm:table-cell`,children:y(e.model)}),(0,R.jsx)(N,{children:(0,R.jsx)(oe,{variant:`secondary`,className:`text-xs`,children:h(e.lifecycleStage)})}),(0,R.jsx)(N,{className:`hidden font-mono text-sm md:table-cell`,children:re(e.operatingHours)}),(0,R.jsx)(N,{children:e.activeFaults.length>0?(0,R.jsxs)(m,{children:[(0,R.jsx)(f,{render:(0,R.jsx)(`span`,{className:`inline-flex h-5 min-w-5 items-center justify-center rounded-(--miravo-radius-pill) bg-destructive/15 px-1.5 font-mono text-[11px] font-semibold tabular-nums text-destructive`}),children:e.activeFaults.length}),(0,R.jsxs)(p,{side:`top`,children:[e.activeFaults.slice(0,4).join(`, `),e.activeFaults.length>4&&` + ${e.activeFaults.length-4} more`]})]}):(0,R.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[(0,R.jsx)(`span`,{className:`sr-only`,children:`no faults`}),(0,R.jsx)(`span`,{"aria-hidden":!0,children:`—`})]})}),(0,R.jsx)(N,{children:(0,R.jsx)(Se,{state:t})}),(0,R.jsx)(N,{children:(0,R.jsx)(C,{className:`size-3.5 text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100 group-focus-visible:opacity-100`,"aria-hidden":!0})})]},e.id)})})]})})})]})}export{Z as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./fleet-CF_yW3Xe.js";export{e as FleetPage};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{s as t}from"./vendor-charts-CAZdaPlq.js";import{at as n}from"./vendor-ui-mizMYESS.js";import{B as r,G as i,J as a,K as o,L as s,Q as c,R as l,U as u,V as d,W as f,X as p,Y as m,Z as h,q as g,z as _}from"./api-Bef9FEIU.js";import{n as v,t as y}from"./createLucideIcon-Yddw9eHa.js";import{n as b}from"./input-BCiRHEmc.js";var x=class extends c{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=_(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),C(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return w(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return w(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof i(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!g(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&T(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||i(this.options.enabled,this.#t)!==i(t.enabled,this.#t)||o(this.options.staleTime,this.#t)!==o(t.staleTime,this.#t))&&this.#g();let a=this.#_();r&&(this.#t!==n||i(this.options.enabled,this.#t)!==i(t.enabled,this.#t)||a!==this.#p)&&this.#v(a)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return D(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(u)),t}#g(){this.#b();let e=o(this.options.staleTime,this.#t);if(r.isServer()||this.#r.isStale||!d(e))return;let t=m(this.#r.dataUpdatedAt,e)+1;this.#d=p.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(r.isServer()||i(this.options.enabled,this.#t)===!1||!d(this.#p)||this.#p===0)&&(this.#f=p.setInterval(()=>{(this.options.refetchIntervalInBackground||h.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(p.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(p.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,a=this.#r,o=this.#i,c=this.#a,l=e===n?this.#n:e.state,{state:u}=e,d={...u},p=!1,m;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&C(e,t),o=i&&T(e,n,t,r);(a||o)&&(d={...d,...s(u.data,e.options)}),t._optimisticResults===`isRestoring`&&(d.fetchStatus=`idle`)}let{error:h,errorUpdatedAt:g,status:v}=d;m=d.data;let y=!1;if(t.placeholderData!==void 0&&m===void 0&&v===`pending`){let e;a?.isPlaceholderData&&t.placeholderData===c?.placeholderData?(e=a.data,y=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(v=`success`,m=f(a?.data,e,t),p=!0)}if(t.select&&m!==void 0&&!y)if(a&&m===o?.data&&t.select===this.#c)m=this.#l;else try{this.#c=t.select,m=t.select(m),m=f(a?.data,m,t),this.#l=m,this.#s=null}catch(e){this.#s=e}this.#s&&(h=this.#s,m=this.#l,g=Date.now(),v=`error`);let b=d.fetchStatus===`fetching`,x=v===`pending`,S=v===`error`,w=x&&b,D=m!==void 0,O={status:v,fetchStatus:d.fetchStatus,isPending:x,isSuccess:v===`success`,isError:S,isInitialLoading:w,isLoading:w,data:m,dataUpdatedAt:d.dataUpdatedAt,error:h,errorUpdatedAt:g,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:d.dataUpdateCount>l.dataUpdateCount||d.errorUpdateCount>l.errorUpdateCount,isFetching:b,isRefetching:b&&!x,isLoadingError:S&&!D,isPaused:d.fetchStatus===`paused`,isPlaceholderData:p,isRefetchError:S&&D,isStale:E(e,t),refetch:this.refetch,promise:this.#o,isEnabled:i(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=O.data!==void 0,r=O.status===`error`&&!t,i=e=>{r?e.reject(O.error):t&&e.resolve(O.data)},a=()=>{i(this.#o=O.promise=_())},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||O.data!==o.value)&&a();break;case`rejected`:(!r||O.error!==o.reason)&&a();break}}return O}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!g(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){l.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function S(e,t){return i(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&t.retryOnMount===!1)}function C(e,t){return S(e,t)||e.state.data!==void 0&&w(e,t,t.refetchOnMount)}function w(e,t,n){if(i(t.enabled,e)!==!1&&o(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&E(e,t)}return!1}function T(e,t,n,r){return(e!==t||i(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&E(e,n)}function E(e,t){return i(t.enabled,e)!==!1&&e.isStaleByTime(o(t.staleTime,e))}function D(e,t){return!g(e.getCurrentResult(),t)}var O=e(t(),1),k=n(),A=O.createContext(void 0),j=e=>{let t=O.useContext(A);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},M=({client:e,children:t})=>(O.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,k.jsx)(A.Provider,{value:e,children:t})),N=O.createContext(!1),P=()=>O.useContext(N);N.Provider;function F(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var I=O.createContext(F()),L=()=>O.useContext(I),R=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?a(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},z=e=>{O.useEffect(()=>{e.clearReset()},[e])},B=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||a(n,[e.error,r])),V=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},H=(e,t)=>e.isLoading&&e.isFetching&&!t,U=(e,t)=>e?.suspense&&t.isPending,W=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function G(e,t,n){let i=P(),a=L(),o=j(n),s=o.defaultQueryOptions(e);o.getDefaultOptions().queries?._experimental_beforeQuery?.(s);let c=o.getQueryCache().get(s.queryHash);s._optimisticResults=i?`isRestoring`:`optimistic`,V(s),R(s,a,c),z(a);let d=!o.getQueryCache().get(s.queryHash),[f]=O.useState(()=>new t(o,s)),p=f.getOptimisticResult(s),m=!i&&e.subscribed!==!1;if(O.useSyncExternalStore(O.useCallback(e=>{let t=m?f.subscribe(l.batchCalls(e)):u;return f.updateResult(),t},[f,m]),()=>f.getCurrentResult(),()=>f.getCurrentResult()),O.useEffect(()=>{f.setOptions(s)},[s,f]),U(s,p))throw W(s,f,a);if(B({result:p,errorResetBoundary:a,throwOnError:s.throwOnError,query:c,suspense:s.suspense}))throw p.error;return o.getDefaultOptions().queries?._experimental_afterQuery?.(s,p),s.experimental_prefetchInRender&&!r.isServer()&&H(p,i)&&(d?W(s,f,a):c?.promise)?.catch(u).finally(()=>{f.updateResult()}),s.notifyOnChangeProps?p:f.trackResult(p)}function K(e,t){return G(e,x,t)}var q=y(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]);function J({role:e=`status`,"aria-live":t=`polite`,"aria-atomic":n=!0,className:r,eyebrow:i,stamp:a,title:o,children:s,detailLabel:c=`Technical detail`,detail:l,primaryLabel:u,onPrimary:d,primaryIcon:f,primaryDisabled:p,primaryBusy:m,secondaryLabel:h,onSecondary:g}){return(0,k.jsx)(`div`,{role:e,"aria-live":t,"aria-atomic":n,className:v(`relative overflow-hidden rounded-[var(--miravo-radius-stadium-lg)] border border-primary/20 bg-transparent`,r),children:(0,k.jsx)(`div`,{className:`p-5 sm:p-6`,children:(0,k.jsxs)(`div`,{className:`min-w-0 space-y-4`,children:[(0,k.jsxs)(`div`,{className:`space-y-3`,children:[(0,k.jsx)(`p`,{className:`font-mono text-[0.65rem] uppercase tracking-[0.38em] text-muted-foreground`,children:i}),(0,k.jsxs)(`div`,{className:`flex items-end gap-3`,children:[(0,k.jsx)(`span`,{className:`font-heading text-3xl font-black leading-none tracking-[-0.06em] text-transparent [-webkit-text-stroke:1px_color-mix(in_srgb,var(--primary)_50%,transparent)] sm:text-4xl`,"aria-hidden":!0,children:a}),(0,k.jsx)(`div`,{className:`mb-1.5 h-px min-w-8 flex-1 bg-linear-to-r from-primary/55 to-transparent`})]}),(0,k.jsx)(`h2`,{className:`text-lg font-semibold tracking-[-0.03em] text-foreground sm:text-xl`,children:o}),s?(0,k.jsx)(`div`,{className:`space-y-2 text-sm leading-relaxed text-muted-foreground`,children:s}):null]}),(0,k.jsxs)(`div`,{className:`rounded-[var(--miravo-radius-stadium-sm)] border border-border/80 bg-background/55 p-4 backdrop-blur-sm`,children:[(0,k.jsx)(`div`,{className:`mb-2 font-mono text-[0.65rem] uppercase tracking-[0.28em] text-muted-foreground`,children:c}),(0,k.jsx)(`p`,{className:`wrap-break-word font-mono text-sm leading-relaxed text-primary`,children:l})]}),(0,k.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:flex-wrap`,children:[(0,k.jsxs)(b,{type:`button`,onClick:d,disabled:!!(p||m),"aria-busy":m,className:v(`inline-flex w-full items-center justify-center gap-2 rounded-[var(--miravo-radius-stadium-sm)] border border-foreground/15 bg-foreground px-4 py-2.5 font-medium text-background shadow-none transition hover:bg-foreground/90 sm:w-auto`,m&&`pointer-events-none opacity-90`),children:[f,u]}),h&&g?(0,k.jsx)(b,{type:`button`,variant:`ghost`,size:`sm`,className:`sm:self-center`,onClick:g,children:h}):null]})]})})})}function Y({message:e,onRetry:t,isRetrying:n}){return(0,k.jsxs)(J,{role:`alert`,eyebrow:`Data link fault`,stamp:`ERR`,title:`Couldn't reach Miravo`,detail:e,primaryLabel:`Retry request`,onPrimary:t,primaryBusy:!!n,primaryIcon:(0,k.jsx)(q,{className:v(`size-4 shrink-0`,n&&`animate-spin`),"aria-hidden":!0}),children:[(0,k.jsxs)(`p`,{children:[(0,k.jsx)(`span`,{className:`text-foreground`,children:`Most often:`}),` the Miravo admin server isn't running, or this browser can't reach it (wrong host, port, or firewall).`]}),(0,k.jsx)(`p`,{children:`Start or restart Miravo if needed, use the correct link to the Miravo Console, then try again.`})]})}function X(e,t){return e instanceof Error&&e.message.trim().length>0?e.message:typeof e==`string`&&e.trim().length>0?e:t}export{K as a,j as c,q as i,x as l,Y as n,G as o,J as r,M as s,X as t};
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{s as t}from"./vendor-charts-CAZdaPlq.js";import{at as n}from"./vendor-ui-mizMYESS.js";import{$ as r,B as i,G as a,H as o,J as s,K as c,Q as l,R as u,V as d,W as f,X as p,Y as m,Z as h,q as g,z as _}from"./api-BjnU1LXi.js";import{n as v,t as y}from"./createLucideIcon-Yddw9eHa.js";import{n as b}from"./input-BCiRHEmc.js";var x=class extends r{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=i(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),C(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return w(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return w(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof c(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!s(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&T(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||c(this.options.enabled,this.#t)!==c(t.enabled,this.#t)||g(this.options.staleTime,this.#t)!==g(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||c(this.options.enabled,this.#t)!==c(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return D(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(f)),t}#g(){this.#b();let e=g(this.options.staleTime,this.#t);if(d.isServer()||this.#r.isStale||!o(e))return;let t=p(this.#r.dataUpdatedAt,e)+1;this.#d=h.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(d.isServer()||c(this.options.enabled,this.#t)===!1||!o(this.#p)||this.#p===0)&&(this.#f=h.setInterval(()=>{(this.options.refetchIntervalInBackground||l.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(h.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(h.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,o=this.#r,s=this.#i,l=this.#a,d=e===n?this.#n:e.state,{state:f}=e,p={...f},m=!1,h;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&C(e,t),o=i&&T(e,n,t,r);(a||o)&&(p={...p,...u(f.data,e.options)}),t._optimisticResults===`isRestoring`&&(p.fetchStatus=`idle`)}let{error:g,errorUpdatedAt:_,status:v}=p;h=p.data;let y=!1;if(t.placeholderData!==void 0&&h===void 0&&v===`pending`){let e;o?.isPlaceholderData&&t.placeholderData===l?.placeholderData?(e=o.data,y=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(v=`success`,h=a(o?.data,e,t),m=!0)}if(t.select&&h!==void 0&&!y)if(o&&h===s?.data&&t.select===this.#c)h=this.#l;else try{this.#c=t.select,h=t.select(h),h=a(o?.data,h,t),this.#l=h,this.#s=null}catch(e){this.#s=e}this.#s&&(g=this.#s,h=this.#l,_=Date.now(),v=`error`);let b=p.fetchStatus===`fetching`,x=v===`pending`,S=v===`error`,w=x&&b,D=h!==void 0,O={status:v,fetchStatus:p.fetchStatus,isPending:x,isSuccess:v===`success`,isError:S,isInitialLoading:w,isLoading:w,data:h,dataUpdatedAt:p.dataUpdatedAt,error:g,errorUpdatedAt:_,failureCount:p.fetchFailureCount,failureReason:p.fetchFailureReason,errorUpdateCount:p.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:p.dataUpdateCount>d.dataUpdateCount||p.errorUpdateCount>d.errorUpdateCount,isFetching:b,isRefetching:b&&!x,isLoadingError:S&&!D,isPaused:p.fetchStatus===`paused`,isPlaceholderData:m,isRefetchError:S&&D,isStale:E(e,t),refetch:this.refetch,promise:this.#o,isEnabled:c(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=O.data!==void 0,r=O.status===`error`&&!t,a=e=>{r?e.reject(O.error):t&&e.resolve(O.data)},o=()=>{a(this.#o=O.promise=i())},s=this.#o;switch(s.status){case`pending`:e.queryHash===n.queryHash&&a(s);break;case`fulfilled`:(r||O.data!==s.value)&&o();break;case`rejected`:(!r||O.error!==s.reason)&&o();break}}return O}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!s(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){_.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function S(e,t){return c(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&t.retryOnMount===!1)}function C(e,t){return S(e,t)||e.state.data!==void 0&&w(e,t,t.refetchOnMount)}function w(e,t,n){if(c(t.enabled,e)!==!1&&g(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&E(e,t)}return!1}function T(e,t,n,r){return(e!==t||c(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&E(e,n)}function E(e,t){return c(t.enabled,e)!==!1&&e.isStaleByTime(g(t.staleTime,e))}function D(e,t){return!s(e.getCurrentResult(),t)}var O=e(t(),1),k=n(),A=O.createContext(void 0),j=e=>{let t=O.useContext(A);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},M=({client:e,children:t})=>(O.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,k.jsx)(A.Provider,{value:e,children:t})),N=O.createContext(!1),P=()=>O.useContext(N);N.Provider;function F(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var I=O.createContext(F()),L=()=>O.useContext(I),R=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?m(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},z=e=>{O.useEffect(()=>{e.clearReset()},[e])},B=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||m(n,[e.error,r])),V=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},H=(e,t)=>e.isLoading&&e.isFetching&&!t,U=(e,t)=>e?.suspense&&t.isPending,W=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function G(e,t,n){let r=P(),i=L(),a=j(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash);o._optimisticResults=r?`isRestoring`:`optimistic`,V(o),R(o,i,s),z(i);let c=!a.getQueryCache().get(o.queryHash),[l]=O.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),p=!r&&e.subscribed!==!1;if(O.useSyncExternalStore(O.useCallback(e=>{let t=p?l.subscribe(_.batchCalls(e)):f;return l.updateResult(),t},[l,p]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),O.useEffect(()=>{l.setOptions(o)},[o,l]),U(o,u))throw W(o,l,i);if(B({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,u),o.experimental_prefetchInRender&&!d.isServer()&&H(u,r)&&(c?W(o,l,i):s?.promise)?.catch(f).finally(()=>{l.updateResult()}),o.notifyOnChangeProps?u:l.trackResult(u)}function K(e,t){return G(e,x,t)}var q=y(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]);function J({role:e=`status`,"aria-live":t=`polite`,"aria-atomic":n=!0,className:r,eyebrow:i,stamp:a,title:o,children:s,detailLabel:c=`Technical detail`,detail:l,primaryLabel:u,onPrimary:d,primaryIcon:f,primaryDisabled:p,primaryBusy:m,secondaryLabel:h,onSecondary:g}){return(0,k.jsx)(`div`,{role:e,"aria-live":t,"aria-atomic":n,className:v(`relative overflow-hidden rounded-[var(--miravo-radius-stadium-lg)] border border-primary/20 bg-transparent`,r),children:(0,k.jsx)(`div`,{className:`p-5 sm:p-6`,children:(0,k.jsxs)(`div`,{className:`min-w-0 space-y-4`,children:[(0,k.jsxs)(`div`,{className:`space-y-3`,children:[(0,k.jsx)(`p`,{className:`font-mono text-[0.65rem] uppercase tracking-[0.38em] text-muted-foreground`,children:i}),(0,k.jsxs)(`div`,{className:`flex items-end gap-3`,children:[(0,k.jsx)(`span`,{className:`font-heading text-3xl font-black leading-none tracking-[-0.06em] text-transparent [-webkit-text-stroke:1px_color-mix(in_srgb,var(--primary)_50%,transparent)] sm:text-4xl`,"aria-hidden":!0,children:a}),(0,k.jsx)(`div`,{className:`mb-1.5 h-px min-w-8 flex-1 bg-linear-to-r from-primary/55 to-transparent`})]}),(0,k.jsx)(`h2`,{className:`text-lg font-semibold tracking-[-0.03em] text-foreground sm:text-xl`,children:o}),s?(0,k.jsx)(`div`,{className:`space-y-2 text-sm leading-relaxed text-muted-foreground`,children:s}):null]}),(0,k.jsxs)(`div`,{className:`rounded-[var(--miravo-radius-stadium-sm)] border border-border/80 bg-background/55 p-4 backdrop-blur-sm`,children:[(0,k.jsx)(`div`,{className:`mb-2 font-mono text-[0.65rem] uppercase tracking-[0.28em] text-muted-foreground`,children:c}),(0,k.jsx)(`p`,{className:`wrap-break-word font-mono text-sm leading-relaxed text-primary`,children:l})]}),(0,k.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:flex-wrap`,children:[(0,k.jsxs)(b,{type:`button`,onClick:d,disabled:!!(p||m),"aria-busy":m,className:v(`inline-flex w-full items-center justify-center gap-2 rounded-[var(--miravo-radius-stadium-sm)] border border-foreground/15 bg-foreground px-4 py-2.5 font-medium text-background shadow-none transition hover:bg-foreground/90 sm:w-auto`,m&&`pointer-events-none opacity-90`),children:[f,u]}),h&&g?(0,k.jsx)(b,{type:`button`,variant:`ghost`,size:`sm`,className:`sm:self-center`,onClick:g,children:h}):null]})]})})})}function Y({message:e,onRetry:t,isRetrying:n}){return(0,k.jsxs)(J,{role:`alert`,eyebrow:`Data link fault`,stamp:`ERR`,title:`Couldn't reach Miravo`,detail:e,primaryLabel:`Retry request`,onPrimary:t,primaryBusy:!!n,primaryIcon:(0,k.jsx)(q,{className:v(`size-4 shrink-0`,n&&`animate-spin`),"aria-hidden":!0}),children:[(0,k.jsxs)(`p`,{children:[(0,k.jsx)(`span`,{className:`text-foreground`,children:`Most often:`}),` the Miravo admin server isn't running, or this browser can't reach it (wrong host, port, or firewall).`]}),(0,k.jsx)(`p`,{children:`Start or restart Miravo if needed, use the correct link to the Miravo Console, then try again.`})]})}function X(e,t){return e instanceof Error&&e.message.trim().length>0?e.message:typeof e==`string`&&e.trim().length>0?e:t}export{K as a,j as c,q as i,x as l,Y as n,G as o,J as r,M as s,X as t};