@miravo/cli-linux-x64 0.7.8 → 0.7.10

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 (72) hide show
  1. package/console-dist/assets/api-2XqCNjt9.js +1 -0
  2. package/console-dist/assets/api-DlgMZi_j.js +1 -0
  3. package/console-dist/assets/{badge-eIn_7YrK.js → badge-i00PiRCo.js} +1 -1
  4. package/console-dist/assets/catalog-B1GRab9-.js +1 -0
  5. package/console-dist/assets/catalog-rF7BRyRf.js +1 -0
  6. package/console-dist/assets/catalog-source-wSZa7UAP.js +1 -0
  7. package/console-dist/assets/{checkbox-C_4HRnS_.js → checkbox-C84IyqEB.js} +1 -1
  8. package/console-dist/assets/{combobox-BCaV1Wbo.js → combobox-BJecIYHE.js} +1 -1
  9. package/console-dist/assets/control-BOmPym_s.js +1 -0
  10. package/console-dist/assets/control-RK2dbhks.js +1 -0
  11. package/console-dist/assets/{copy-button-BvU3RDZa.js → copy-button-DnGsXbVV.js} +1 -1
  12. package/console-dist/assets/events-B8fp1TQW.js +1 -0
  13. package/console-dist/assets/events-CVYbXGE4.js +1 -0
  14. package/console-dist/assets/fleet-CHhiI7Fk.js +1 -0
  15. package/console-dist/assets/fleet-DxLj0dPT.js +1 -0
  16. package/console-dist/assets/{format-CshN6yEB.js → format-B9CcV2dj.js} +1 -1
  17. package/console-dist/assets/{get-error-message-SEo0k4qf.js → get-error-message-BanmV5rD.js} +1 -1
  18. package/console-dist/assets/index-MRs9-toM.js +12 -0
  19. package/console-dist/assets/instance-detail-CKgv3XYh.js +1 -0
  20. package/console-dist/assets/{login-B6QpC1oU.js → login-BaheB47i.js} +2 -2
  21. package/console-dist/assets/models-BygeZ9lv.js +1 -0
  22. package/console-dist/assets/models-CTVXBFYW.js +1 -0
  23. package/console-dist/assets/{not-found-D0nX2nrf.js → not-found-BbQLiHmm.js} +1 -1
  24. package/console-dist/assets/platforms-BHZA9Eg3.js +1 -0
  25. package/console-dist/assets/platforms-BXHQU4vT.js +1 -0
  26. package/console-dist/assets/query-fetch-error-xB4By0m0.js +1 -0
  27. package/console-dist/assets/{select-CmlY1M1a.js → select-CMOnuEoT.js} +1 -1
  28. package/console-dist/assets/tabs-CDS57-lB.js +1 -0
  29. package/console-dist/assets/tags-CeGPTgMJ.js +4 -0
  30. package/console-dist/assets/tags-CmPY4kaf.js +1 -0
  31. package/console-dist/assets/transition-nav-link-BtuFK_Y8.js +1 -0
  32. package/console-dist/assets/use-engine-command-mutation-Ct9NCDug.js +1 -0
  33. package/console-dist/assets/use-platform-stream-BzqGhuJn.js +2 -0
  34. package/console-dist/assets/use-transition-navigate-D3JSD38W.js +2 -0
  35. package/console-dist/assets/validation-CCE5LmjQ.js +1 -0
  36. package/console-dist/index.html +31 -33
  37. package/miravo +0 -0
  38. package/package.json +1 -1
  39. package/console-dist/assets/api-DGtW0Fh4.js +0 -1
  40. package/console-dist/assets/catalog-DDHh7IxX.js +0 -1
  41. package/console-dist/assets/catalog-DZz3a6vE.js +0 -1
  42. package/console-dist/assets/catalog-source-DT5WAB9u.js +0 -1
  43. package/console-dist/assets/control-Br_1NEB0.js +0 -1
  44. package/console-dist/assets/control-DmjNAhq5.js +0 -1
  45. package/console-dist/assets/engine-store-DMULdR_V.js +0 -1
  46. package/console-dist/assets/events-CJIyikQE.js +0 -1
  47. package/console-dist/assets/events-DMpCBVAp.js +0 -1
  48. package/console-dist/assets/fleet-BYJ4DFYn.js +0 -1
  49. package/console-dist/assets/fleet-pSpdGZnr.js +0 -1
  50. package/console-dist/assets/index-YW1mEMDX.js +0 -12
  51. package/console-dist/assets/instance-detail-CVOl1-Oc.js +0 -1
  52. package/console-dist/assets/models-DdNy8e5C.js +0 -1
  53. package/console-dist/assets/models-EaysA2Qw.js +0 -1
  54. package/console-dist/assets/platforms-BsyqlJKi.js +0 -1
  55. package/console-dist/assets/platforms-DFoAeG0R.js +0 -1
  56. package/console-dist/assets/query-fetch-error-C6Lt-RSI.js +0 -1
  57. package/console-dist/assets/route-preload-CbmrjLlI.js +0 -2
  58. package/console-dist/assets/tabs-4SeH2unv.js +0 -1
  59. package/console-dist/assets/tags-CNF5b2a7.js +0 -4
  60. package/console-dist/assets/tags-DH-gdxLz.js +0 -1
  61. package/console-dist/assets/transition-nav-link-CbbvCaF1.js +0 -1
  62. package/console-dist/assets/use-engine-command-mutation-BJnaKdCX.js +0 -1
  63. package/console-dist/assets/use-platform-stream-D2Hnc-qx.js +0 -2
  64. package/console-dist/assets/use-transition-navigate-DHgJJMdL.js +0 -1
  65. package/console-dist/assets/validation-CCol1kXN.js +0 -1
  66. /package/console-dist/assets/{auth-screen-backdrop-Cr8qBSXP.js → auth-screen-backdrop-CgwRhIbi.js} +0 -0
  67. /package/console-dist/assets/{dropdown-menu-CrPXVXpG.js → dropdown-menu-82O7jPU6.js} +0 -0
  68. /package/console-dist/assets/{label-CMBWxUhA.js → label-DTHSKF2S.js} +0 -0
  69. /package/console-dist/assets/{runtime-link-PMxeHxd6.js → runtime-link-D-uJbw97.js} +0 -0
  70. /package/console-dist/assets/{select-display-items-Bqb6Sbg6.js → select-display-items-y2L7MHmk.js} +0 -0
  71. /package/console-dist/assets/{transition-types-2i1blGlR.js → transition-types-CPlGtM8w.js} +0 -0
  72. /package/console-dist/assets/{vendor-table-BAHQgdwg.js → vendor-table-SVvT6QrW.js} +0 -0
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{at as n}from"./vendor-ui-CWUk2ulb.js";import{F as r,I as i,M as a,O as o,P as s,k as c,rt as l,z as u}from"./api-2XqCNjt9.js";import{t as d}from"./proxy-Be4WzmcS.js";import{t as f}from"./AnimatePresence-CPmH1DMY.js";import{i as p,r as m}from"./dist-xY0pK9Wy.js";import{a as h,i as g,l as ee,n as _,o as v,r as y,s as b,t as x}from"./copy-button-DnGsXbVV.js";import{t as S}from"./shallow-Cin0mLuv.js";import{C,S as w,T as te,d as ne,f as T,u as E}from"./format-B9CcV2dj.js";import{n as D,t as O}from"./utils-XFKvwlFT.js";import{t as k}from"./activity-Cy_niK56.js";import{t as A}from"./arrow-right-BjBb4z7g.js";import{c as j,i as re,l as ie,n as ae,s as oe,t as se}from"./select-CMOnuEoT.js";import{a as ce,c as M,i as N,n as le,o as P,r as ue,s as de,t as fe}from"./tabs-CDS57-lB.js";import{a as F,c as pe,i as me,l as he,n as ge,r as _e,s as I,t as ve}from"./validation-CCE5LmjQ.js";import{i as ye,n as be,r as xe,t as Se}from"./checkbox-C84IyqEB.js";import{t as Ce}from"./layers-1figUpjG.js";import{c as we,r as Te,t as L}from"./use-engine-command-mutation-Ct9NCDug.js";import{t as R}from"./triangle-alert-BXrJNk3g.js";import{i as Ee,n as De,t as Oe}from"./tooltip-D1ydB4g3.js";import{t as ke}from"./transition-nav-link-BtuFK_Y8.js";import{t as z}from"./badge-i00PiRCo.js";import{t as B}from"./label-DTHSKF2S.js";import{a as V,c as H,i as U,l as W,n as G,o as K,r as q,s as J,t as Y}from"./combobox-BJecIYHE.js";var Ae=D(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),je=D(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),Me=D(`octagon-alert`,[[`path`,{d:`M12 16h.01`,key:`1drbdi`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z`,key:`1fd625`}]]),Ne=D(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),Pe=D(`power-off`,[[`path`,{d:`M18.36 6.64A9 9 0 0 1 20.77 15`,key:`dxknvb`}],[`path`,{d:`M6.16 6.16a9 9 0 1 0 12.68 12.68`,key:`1x7qb5`}],[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Fe=D(`power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),Ie=D(`radio-tower`,[[`path`,{d:`M4.9 16.1C1 12.2 1 5.8 4.9 1.9`,key:`s0qx1y`}],[`path`,{d:`M7.8 4.7a6.14 6.14 0 0 0-.8 7.5`,key:`1idnkw`}],[`circle`,{cx:`12`,cy:`9`,r:`2`,key:`1092wv`}],[`path`,{d:`M16.2 4.8c2 2 2.26 5.11.8 7.47`,key:`ojru2q`}],[`path`,{d:`M19.1 1.9a9.96 9.96 0 0 1 0 14.1`,key:`rhi7fg`}],[`path`,{d:`M9.5 18h5`,key:`mfy3pd`}],[`path`,{d:`m8 22 4-11 4 11`,key:`25yftu`}]]),Le=D(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),Re=D(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),ze=D(`trash`,[[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),X=e(t(),1),Z=n(),Be={mqtt:ce,opcua:be,modbus:je},Ve={mqtt:`MQTT`,opcua:`OPC UA`,modbus:`Modbus TCP`},He={mqtt:r,opcua:i,modbus:s};function Ue({adapter:e}){let t=e.pending?`pending`:e.enabled?`enabled`:`disabled`;return(0,Z.jsx)(f,{mode:`wait`,initial:!1,children:(0,Z.jsx)(d.div,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},transition:{type:`spring`,stiffness:500,damping:30},children:e.pending?(0,Z.jsxs)(z,{className:`gap-1 bg-info/20 text-info hover:bg-info/20`,children:[(0,Z.jsx)(P,{className:`size-3 animate-spin`}),e.enabled?`Disabling...`:`Enabling...`]}):e.enabled?(0,Z.jsxs)(z,{className:`gap-1 bg-success/20 text-success hover:bg-success/20`,children:[(0,Z.jsx)(M,{className:`size-3`}),`Enabled`]}):(0,Z.jsxs)(z,{variant:`outline`,className:`gap-1 text-muted-foreground`,children:[(0,Z.jsx)(Ae,{className:`size-2`}),`Disabled`]})},t)})}function We({metrics:e}){return e?e.connected?null:(0,Z.jsxs)(z,{variant:`destructive`,className:`gap-1`,children:[(0,Z.jsx)(de,{className:`size-3`}),`Disconnected`]}):null}function Ge({health:e}){if(!e)return null;let t={healthy:`bg-success/20 text-success hover:bg-success/20`,busy:`bg-warning/20 text-warning hover:bg-warning/20`,saturated:`bg-destructive/20 text-destructive hover:bg-destructive/20`},n=e.state,r=`size-3 shrink-0`,i=n===`healthy`?(0,Z.jsx)(M,{className:r,"aria-hidden":!0}):n===`busy`?(0,Z.jsx)(k,{className:r,"aria-hidden":!0}):n===`saturated`?(0,Z.jsx)(R,{className:r,"aria-hidden":!0}):null;return(0,Z.jsxs)(z,{className:O(`gap-1`,t[n]??``),children:[i,n]})}function Q({label:e,value:t,valueClassName:n}){return(0,Z.jsxs)(`div`,{className:`flex min-h-[3.35rem] flex-col justify-center rounded-[var(--miravo-radius-stadium-sm)] border border-border/55 px-3 py-2 transition-colors hover:border-muted-foreground/25`,children:[(0,Z.jsx)(`span`,{className:`blueprint-title text-[10px] leading-tight text-muted-foreground`,children:e}),(0,Z.jsx)(`span`,{className:O(`mt-1.5 font-mono text-[13px] leading-none tabular-nums tracking-tight text-foreground`,n),children:t})]})}function Ke({metrics:e}){return(0,Z.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-3`,children:[(0,Z.jsx)(Q,{label:`Messages sent`,value:E(e.messagesPublished)}),(0,Z.jsx)(Q,{label:`Attempted`,value:E(e.messagesAttempted)}),(0,Z.jsx)(Q,{label:`Skipped (unchanged)`,value:E(e.messagesFiltered)}),(0,Z.jsx)(Q,{label:`Errors`,value:E(e.errorsCount),valueClassName:e.errorsCount>0?`text-destructive`:void 0}),(0,Z.jsx)(Q,{label:`Publish latency`,value:`${e.lastPublishMs.toFixed(1)} ms`}),e.health?(0,Z.jsx)(Q,{label:`Queued messages`,value:String(e.health.pendingWorkCount)}):null]})}function qe({port:e}){return(0,Z.jsxs)(`div`,{className:`flex gap-2 rounded-[var(--miravo-radius-stadium-sm)] border border-warning/30 bg-warning/10 p-3 text-sm text-warning`,children:[(0,Z.jsx)(R,{className:`mt-0.5 size-4 shrink-0`}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`p`,{className:`font-medium`,children:`Before enabling`}),(0,Z.jsxs)(`p`,{className:`mt-1 text-warning`,children:[`Ensure port `,(0,Z.jsx)(`code`,{className:`font-mono font-bold`,children:e}),` is available on the host.`]}),(0,Z.jsxs)(`ul`,{className:`mt-1 list-inside list-disc space-y-0.5 text-warning`,children:[(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`strong`,{children:`Docker:`}),` Restart with`,` `,(0,Z.jsxs)(`code`,{className:`font-mono`,children:[`-p `,e,`:`,e]}),` `,`to expose the port.`]}),(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`strong`,{children:`Bare metal:`}),` Run `,(0,Z.jsxs)(`code`,{className:`font-mono`,children:[`lsof -i :`,e]}),` to check availability.`]})]})]})]})}function Je({adapter:e,metrics:t}){let[n,r]=(0,X.useState)(!1),[i,a]=(0,X.useState)(``),[o,s]=(0,X.useState)(!1),c=L(),l=Be[e.name]??be,u=Ve[e.name]??e.name,p=He[e.name]??0,m=o||e.pending===!0,h=(0,X.useMemo)(()=>{let t=e.config?.port;return typeof t==`number`?t:p},[e.config,p]);return(0,Z.jsxs)(`div`,{className:`protocol-card-art min-w-0 border`,children:[(0,Z.jsxs)(`div`,{className:`relative z-2`,children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":n,className:`group/row flex w-full min-w-0 cursor-pointer gap-3 px-4 py-3 text-left transition-colors duration-[var(--miravo-duration-base)] ease-[var(--miravo-ease)] hover:bg-muted/35`,onClick:()=>r(!n),children:[(0,Z.jsx)(l,{className:`mt-0.5 size-5 shrink-0 text-muted-foreground transition-[transform,color] duration-[var(--miravo-duration-base)] ease-[var(--miravo-ease)] group-hover/row:-rotate-[8deg] group-hover/row:scale-[1.08] group-hover/row:text-primary motion-reduce:transition-none motion-reduce:group-hover/row:rotate-0 motion-reduce:group-hover/row:scale-100`,"aria-hidden":!0}),(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:(0,Z.jsxs)(`div`,{className:`flex w-full min-w-0 flex-wrap items-start justify-between gap-x-3 gap-y-2`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[e.enabled&&!e.pending&&(0,Z.jsx)(`span`,{className:`protocol-card-live-dot`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`whitespace-nowrap font-medium tracking-tight`,children:u}),(0,Z.jsx)(Ue,{adapter:e}),e.enabled&&!e.pending&&t&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(We,{metrics:t}),t.health?(0,Z.jsx)(Ge,{health:t.health}):(0,Z.jsxs)(z,{className:`gap-1 bg-success/20 text-success hover:bg-success/20`,children:[(0,Z.jsx)(M,{className:`size-3 shrink-0`,"aria-hidden":!0}),`healthy`]})]})]}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[e.enabled&&t&&!e.pending&&(0,Z.jsxs)(`span`,{className:`protocol-card-metric-readout text-muted-foreground`,children:[(0,Z.jsx)(`span`,{className:`text-[10px] font-normal uppercase tracking-[0.12em] text-muted-foreground`,children:`out`}),` `,(0,Z.jsx)(`span`,{className:`text-foreground`,children:E(t.messagesPublished)}),(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:` msgs`}),t.errorsCount>0&&(0,Z.jsxs)(`span`,{className:`ml-1.5 text-destructive`,children:[t.errorsCount,` err`]})]}),(0,Z.jsx)(ie,{className:`size-4 shrink-0 text-muted-foreground transition-[transform,color] duration-[var(--miravo-duration-base)] ease-[var(--miravo-ease)] group-hover/row:translate-y-0.5 group-hover/row:text-primary motion-reduce:transition-none motion-reduce:group-hover/row:translate-y-0 ${n?`rotate-180`:``}`})]})]})})]}),e.enabled&&!e.pending&&e.endpoint&&(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1 px-4 pb-2 pl-11`,children:[(0,Z.jsx)(`code`,{className:`min-w-0 truncate font-mono text-xs text-muted-foreground`,children:e.endpoint}),(0,Z.jsx)(x,{value:e.endpoint,label:`Copy endpoint URL`})]})]}),(0,Z.jsx)(f,{initial:!1,children:n&&(0,Z.jsx)(d.div,{initial:{height:0,opacity:0},animate:{height:`auto`,opacity:1},exit:{height:0,opacity:0},transition:{duration:.2,ease:`easeOut`},className:`overflow-hidden`,children:(0,Z.jsx)(`div`,{className:`protocol-card-art-body border-t`,children:e.enabled&&t?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`section`,{className:`px-4 pb-4 pt-4`,"aria-labelledby":`protocol-telemetry-${e.name}`,children:[(0,Z.jsxs)(`div`,{className:`mb-3 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between sm:gap-3`,children:[(0,Z.jsx)(`h4`,{id:`protocol-telemetry-${e.name}`,className:`blueprint-title shrink-0 text-muted-foreground`,children:`Telemetry`}),(0,Z.jsxs)(ke,{to:`/tags?protocol=${e.name}`,className:`group/footer-link inline-flex w-full min-h-8 min-w-0 max-w-full shrink-0 items-center justify-start gap-1.5 rounded-[var(--miravo-radius-pill)] border border-primary/25 bg-primary/5 px-2.5 py-1.5 text-xs font-medium leading-tight text-primary transition-colors hover:border-primary/40 hover:bg-primary/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background sm:w-fit`,children:[(0,Z.jsx)(`span`,{className:`whitespace-nowrap`,children:`Browse Tags`}),(0,Z.jsx)(A,{className:`size-3 shrink-0 text-primary transition-transform group-hover/footer-link:translate-x-0.5`})]})]}),(0,Z.jsx)(Ke,{metrics:t})]}),(0,Z.jsx)(`footer`,{className:`protocol-card-art-footer flex flex-col gap-4 border-t border-border/80 px-4 pb-4 pt-4`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,Z.jsxs)(C,{variant:`destructive`,size:`sm`,className:`gap-1.5`,disabled:m,onClick:async()=>{s(!0);try{await c.mutateAsync({type:`disableAdapter`,adapter:e.name})}catch{}finally{s(!1)}},children:[m?(0,Z.jsx)(P,{className:`size-3.5 animate-spin`}):(0,Z.jsx)(Pe,{className:`size-3.5`}),m?`Disabling...`:`Disable ${u}`]}),!m&&(0,Z.jsx)(`span`,{className:`text-xs leading-snug text-muted-foreground`,children:`Active connections will be dropped.`})]})})]}):(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 px-4 py-4`,children:[!m&&(0,Z.jsx)(qe,{port:i&&Number(i)||h}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(B,{htmlFor:`port-${e.name}`,className:`text-xs`,children:`Port`}),(0,Z.jsx)(w,{id:`port-${e.name}`,type:`number`,placeholder:String(h),value:i,onChange:e=>a(e.target.value),className:`w-28`,disabled:m})]}),(0,Z.jsxs)(C,{size:`sm`,className:`gap-1.5`,disabled:m,onClick:async()=>{s(!0);try{let t=i?Number(i):void 0,n={};t&&Number.isFinite(t)&&(n.port=t),await c.mutateAsync({type:`enableAdapter`,adapter:e.name,...Object.keys(n).length>0?{config:n}:{}})}catch{}finally{s(!1)}},children:[m?(0,Z.jsx)(P,{className:`size-3.5 animate-spin`}):(0,Z.jsx)(Fe,{className:`size-3.5`}),m?`Enabling...`:`Enable ${u}`]})]})]})})},`panel`)})]})}function Ye(){let{instances:e,models:t,templateRuns:n}=l(S(e=>({instances:e.instances,models:e.models,templateRuns:e.templateRuns}))),r=L(),[i,s]=(0,X.useState)(``),[u,p]=(0,X.useState)(`1`),[m,h]=(0,X.useState)(``),[g,_]=(0,X.useState)(``),[v,y]=(0,X.useState)(null),[b,x]=(0,X.useState)(null),[T,E]=(0,X.useState)(``),D=(0,X.useMemo)(()=>T?t.filter(e=>e.name.toLowerCase().includes(T.toLowerCase())):t,[t,T]),k=Number(u)||1,A=i?c(i):``,j=m.trim()?m.trim():o(g.trim()||A||`instance`,1);return(0,Z.jsxs)(K,{className:`h-full min-w-0`,children:[(0,Z.jsx)(H,{className:`pb-3`,children:(0,Z.jsxs)(W,{className:`flex items-center gap-2 text-xs font-medium uppercase tracking-wider`,children:[(0,Z.jsx)(Ce,{className:`size-3.5 text-muted-foreground`,"aria-hidden":!0}),`Fleet Management`]})}),(0,Z.jsxs)(J,{className:`flex flex-1 flex-col gap-4`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-[10px] font-medium uppercase tracking-wider text-muted-foreground`,children:`Spawn Instances`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2 sm:flex-row sm:items-center`,children:[(0,Z.jsx)(`div`,{className:`min-w-0 w-full sm:min-w-0 sm:flex-1`,children:(0,Z.jsxs)(Y,{value:i||null,onValueChange:e=>s(e??``),onInputValueChange:E,children:[(0,Z.jsx)(q,{placeholder:`Select model`,className:`h-8 w-full min-w-0`,showClear:!!i}),(0,Z.jsx)(G,{children:(0,Z.jsxs)(V,{children:[D.map(e=>(0,Z.jsx)(U,{value:e.name,children:e.name},e.name)),D.length===0&&(0,Z.jsx)(`p`,{className:`py-2 text-center text-xs text-muted-foreground`,children:`No models found`})]})})]})}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,Z.jsx)(w,{type:`number`,value:u,onChange:e=>p(e.target.value),className:`h-8 w-16 text-xs`,min:`1`,"aria-label":`Number of instances to spawn`}),(0,Z.jsx)(C,{size:`sm`,className:`h-8`,disabled:v!=null||b!=null||!i,onClick:()=>{if(m.trim()&&k!==1){ee.error(`Exact instance ID requires count 1.`);return}let e=F(me,{model:i,count:k,...m.trim()?{instanceName:m.trim()}:{},...g.trim()?{instancePrefix:g.trim()}:{}});e&&r.mutate({type:`spawn`,...e})},children:`Spawn`})]})]}),(0,Z.jsxs)(`div`,{className:`grid min-w-0 gap-2 sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Z.jsx)(B,{htmlFor:`fleet-station-instance-name`,className:`text-[10px]`,children:`Exact instance ID`}),(0,Z.jsx)(w,{id:`fleet-station-instance-name`,value:m,maxLength:120,onChange:e=>{let t=e.target.value;h(t),t&&(_(``),x(null)),y(a(t))},placeholder:k===1?`Exact instance ID`:`Exact name needs count 1`,disabled:k!==1,className:O(`h-8 min-w-0 font-mono text-xs`,v&&`border-destructive`),"aria-invalid":v!=null,"aria-label":`Exact instance ID`}),v?(0,Z.jsx)(`p`,{className:`text-[10px] text-destructive`,children:v}):null]}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Z.jsx)(B,{htmlFor:`fleet-station-instance-prefix`,className:`text-[10px]`,children:`Generated prefix`}),(0,Z.jsx)(w,{id:`fleet-station-instance-prefix`,value:g,maxLength:120,onChange:e=>{let t=e.target.value;_(t),t&&(h(``),y(null)),x(a(t))},placeholder:A||`Generated prefix`,className:O(`h-8 min-w-0 font-mono text-xs`,b&&`border-destructive`),"aria-invalid":b!=null,"aria-label":`Generated prefix`}),b?(0,Z.jsx)(`p`,{className:`text-[10px] text-destructive`,children:b}):null]})]}),(0,Z.jsxs)(`span`,{className:`min-w-0 wrap-break-word text-[10px] text-muted-foreground`,children:[t.length,` models · `,e.length,` running · default`,` `,(0,Z.jsx)(`span`,{className:`font-mono`,children:A||`auto`}),` · preview`,` `,(0,Z.jsx)(`span`,{className:`break-all font-mono text-foreground`,children:j})]})]}),n.length>0&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(I,{}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-[10px] font-medium uppercase tracking-wider text-muted-foreground`,children:`Environment Runs`}),(0,Z.jsx)(f,{initial:!1,children:n.map(e=>(0,Z.jsx)(d.div,{initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4,transition:{duration:.12}},transition:{type:`spring`,stiffness:400,damping:30},children:(0,Z.jsxs)(`div`,{className:`flex items-center justify-between rounded-[var(--miravo-radius-tight)] border px-2.5 py-1.5`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 overflow-hidden`,children:[(0,Z.jsx)(`span`,{className:`truncate text-xs font-medium`,children:ne(e.templateName)}),(0,Z.jsxs)(z,{variant:`secondary`,className:`shrink-0 text-[10px]`,children:[e.instanceIds.length,` inst`]})]}),(0,Z.jsx)(C,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 px-1.5 text-destructive hover:text-destructive`,"aria-label":`Unload environment run`,onClick:()=>r.mutate({type:`unloadTemplateRun`,templateRunId:e.templateRunId}),children:(0,Z.jsx)(te,{className:`size-3`})})]})},e.templateRunId))})]})]})]})]})}function Xe(){let{instances:e,models:t}=l(S(e=>({instances:e.instances,models:e.models}))),n=L(),[r,i]=(0,X.useState)(``),[a,o]=(0,X.useState)(``),[s,c]=(0,X.useState)(``),u=(0,X.useMemo)(()=>s?e.filter(e=>e.id.toLowerCase().includes(s.toLowerCase())):e,[e,s]),p=(0,X.useMemo)(()=>{let n=e.find(e=>e.id===r);return n?t.find(e=>e.name===n.model)?.faultNames??[]:[]},[r,e,t]),m=(0,X.useMemo)(()=>e.filter(e=>e.activeFaults.length>0),[e]),h=m.reduce((e,t)=>e+t.activeFaults.length,0);return(0,Z.jsxs)(K,{className:`h-full min-w-0`,children:[(0,Z.jsx)(H,{className:`pb-3`,children:(0,Z.jsxs)(W,{className:`flex items-center gap-2 text-xs font-medium uppercase tracking-wider`,children:[(0,Z.jsx)(R,{className:`size-3.5 ${h>0?`text-destructive`:`text-muted-foreground`}`}),`Fault Lab`,(0,Z.jsx)(f,{children:h>0&&(0,Z.jsx)(d.div,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},transition:{type:`spring`,stiffness:500,damping:30},children:(0,Z.jsxs)(z,{variant:`destructive`,className:`text-[10px]`,children:[h,` active`]})},`fault-count`)})]})}),(0,Z.jsxs)(J,{className:`flex flex-1 flex-col gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,Z.jsxs)(Y,{value:r||null,onValueChange:e=>{i(e??``),o(``)},onInputValueChange:c,children:[(0,Z.jsx)(q,{placeholder:`Select instance`,className:`h-8 min-h-11 w-full min-w-0 touch-manipulation sm:min-h-8`,showClear:!!r}),(0,Z.jsx)(G,{children:(0,Z.jsxs)(V,{children:[u.map(e=>(0,Z.jsxs)(U,{value:e.id,children:[(0,Z.jsx)(`span`,{className:`font-mono`,children:e.id}),e.activeFaults.length>0&&(0,Z.jsx)(z,{variant:`destructive`,className:`ml-auto text-[10px]`,children:e.activeFaults.length})]},e.id)),u.length===0&&(0,Z.jsx)(`p`,{className:`py-2 text-center text-xs text-muted-foreground`,children:`No instances found`})]})})]}),(0,Z.jsxs)(se,{value:a,onValueChange:e=>o(e??``),children:[(0,Z.jsx)(oe,{className:`h-8 min-h-11 w-full touch-manipulation sm:min-h-8`,"aria-label":`Fault type`,children:(0,Z.jsx)(j,{placeholder:r?`Select fault`:`Pick instance first`})}),(0,Z.jsx)(ae,{alignItemWithTrigger:!1,align:`start`,children:p.map(e=>(0,Z.jsx)(re,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Z.jsx)(C,{variant:`destructive`,size:`sm`,className:`h-7 min-h-11 touch-manipulation text-xs sm:min-h-7`,disabled:!r||!a,onClick:()=>{let e=F(ve,{instanceId:r,fault:a});e&&n.mutate({type:`triggerFault`,...e})},children:`Trigger`}),(0,Z.jsx)(C,{variant:`secondary`,size:`sm`,className:`h-7 min-h-11 touch-manipulation text-xs sm:min-h-7`,disabled:!r||!a,onClick:()=>{let e=F(ve,{instanceId:r,fault:a});e&&n.mutate({type:`clearFault`,...e})},children:`Clear`})]}),(0,Z.jsx)(I,{}),(0,Z.jsx)(f,{mode:`wait`,initial:!1,children:m.length>0?(0,Z.jsxs)(d.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-[10px] font-medium uppercase tracking-wider text-muted-foreground`,children:`Faulted Instances`}),(0,Z.jsx)(f,{initial:!1,children:m.map(e=>(0,Z.jsx)(d.div,{initial:{opacity:0,x:-6},animate:{opacity:1,x:0},exit:{opacity:0,x:6,transition:{duration:.1}},transition:{type:`spring`,stiffness:400,damping:35},children:(0,Z.jsxs)(`button`,{type:`button`,className:`flex min-h-11 w-full touch-manipulation items-center justify-between rounded-[var(--miravo-radius-tight)] border border-destructive/20 bg-destructive/5 px-2.5 py-1.5 text-left transition-colors hover:bg-destructive/10 sm:min-h-0`,onClick:()=>{i(e.id),o(``)},children:[(0,Z.jsx)(`span`,{className:`truncate font-mono text-xs`,children:e.id}),(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-destructive`,children:e.activeFaults.join(`, `)})]})},e.id))})]},`faulted`):(0,Z.jsxs)(d.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:`flex items-center gap-2 py-1 text-xs text-muted-foreground`,children:[(0,Z.jsx)(M,{className:`size-3.5 text-success`}),`All clear — no active faults`]},`all-clear`)})]})]})}function Ze(){let e=l(e=>e.instances),t=L(),[n,r]=(0,X.useState)(``),[i,a]=(0,X.useState)(!1),[o,s]=(0,X.useState)(``),c=(0,X.useMemo)(()=>o?e.filter(e=>e.id.toLowerCase().includes(o.toLowerCase())):e,[e,o]),u=(0,X.useMemo)(()=>e.filter(e=>e.isQuarantined),[e]),p=(0,X.useMemo)(()=>e.filter(e=>!e.isQuarantined&&e.activeFaults.length===0).length,[e]),m=(0,X.useMemo)(()=>e.filter(e=>!e.isQuarantined&&e.activeFaults.length>0).length,[e]);return(0,Z.jsxs)(K,{className:`h-full min-w-0`,children:[(0,Z.jsx)(H,{className:`pb-3`,children:(0,Z.jsxs)(W,{className:`flex items-center gap-2 text-xs font-medium uppercase tracking-wider`,children:[(0,Z.jsx)(Le,{className:`size-3.5 text-muted-foreground`}),`Instance Actions`]})}),(0,Z.jsxs)(J,{className:`flex flex-1 flex-col gap-4`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-[10px] font-medium uppercase tracking-wider text-muted-foreground`,children:`Remove Instance`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2 sm:flex-row sm:items-start`,children:[(0,Z.jsx)(`div`,{className:`min-w-0 w-full sm:min-w-0 sm:flex-1`,children:(0,Z.jsxs)(Y,{value:n||null,onValueChange:e=>{r(e??``),a(!1)},onInputValueChange:s,children:[(0,Z.jsx)(q,{placeholder:`Select instance`,className:`h-8 w-full min-w-0`,showClear:!!n}),(0,Z.jsx)(G,{children:(0,Z.jsxs)(V,{children:[c.map(e=>(0,Z.jsx)(U,{value:e.id,children:(0,Z.jsx)(`span`,{className:`font-mono`,children:e.id})},e.id)),c.length===0&&(0,Z.jsx)(`p`,{className:`py-2 text-center text-xs text-muted-foreground`,children:`No instances found`})]})})]})}),i&&n?(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 sm:shrink-0`,children:[(0,Z.jsx)(`span`,{className:`text-[10px] text-destructive`,children:`Remove?`}),(0,Z.jsx)(C,{size:`sm`,variant:`destructive`,className:`h-7 text-xs`,onClick:()=>{t.mutate({type:`removeInstance`,instanceId:n}),a(!1),r(``)},children:`Confirm`}),(0,Z.jsx)(C,{size:`sm`,variant:`ghost`,className:`h-7 text-xs`,onClick:()=>a(!1),children:`Cancel`})]}):(0,Z.jsxs)(C,{className:`h-8 w-full shrink-0 gap-1.5 sm:w-auto`,variant:`destructive`,size:`sm`,disabled:!n,onClick:()=>{F(ge,{instanceId:n})&&a(!0)},children:[(0,Z.jsx)(ze,{className:`size-3`}),`Remove`]})]})]}),(0,Z.jsx)(I,{}),(0,Z.jsx)(f,{mode:`wait`,initial:!1,children:u.length>0?(0,Z.jsxs)(d.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:`flex flex-col gap-2`,children:[(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[10px] font-medium uppercase tracking-wider text-warning`,children:[`Quarantined`,(0,Z.jsx)(z,{variant:`secondary`,className:`text-[10px] text-warning`,children:u.length})]}),(0,Z.jsx)(f,{initial:!1,children:u.map(e=>(0,Z.jsx)(d.div,{initial:{opacity:0,x:-6},animate:{opacity:1,x:0},exit:{opacity:0,transition:{duration:.1}},transition:{type:`spring`,stiffness:400,damping:35},children:(0,Z.jsxs)(`div`,{className:`flex items-center justify-between rounded-[var(--miravo-radius-tight)] border border-warning/20 bg-warning/5 px-2.5 py-1.5`,children:[(0,Z.jsx)(`span`,{className:`truncate font-mono text-xs`,children:e.id}),(0,Z.jsx)(C,{size:`sm`,variant:`outline`,className:`h-6 shrink-0 text-[10px]`,onClick:()=>t.mutate({type:`unquarantine`,instanceId:e.id}),children:`Unquarantine`})]})},e.id))})]},`quarantined`):(0,Z.jsxs)(d.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-[10px] font-medium uppercase tracking-wider text-muted-foreground`,children:`Fleet Health`}),(0,Z.jsx)(`div`,{className:`flex items-center gap-4 text-xs`,children:e.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`size-2 rounded-full bg-success`}),(0,Z.jsx)(`span`,{className:`font-mono tabular-nums`,children:p}),(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`healthy`})]}),m>0&&(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`size-2 rounded-full bg-warning`}),(0,Z.jsx)(`span`,{className:`font-mono tabular-nums`,children:m}),(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`faulted`})]}),(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(Re,{className:`size-3 text-success`}),(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`0 quarantined`})]})]}):(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`No instances running`})})]},`fleet-health`)})]})]})}function Qe(e){let t=Math.floor(e/1e3),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60;return n>0?`${n}h ${r}m`:r>0?`${r}m ${i}s`:`${i}s`}function $e(e){if(!Number.isFinite(e)||e<=0)return`0s`;if(e<60)return`${e.toFixed(1)}s`;let t=Math.floor(e),n=Math.floor(t/86400),r=Math.floor(t%86400/3600),i=Math.floor(t%3600/60),a=t%60;return n>0?r>0?`${n}d ${r}h`:i>0?`${n}d ${i}m`:`${n}d`:r>0?`${r}h ${i}m`:i>0?`${i}m ${a}s`:`${a}s`}function et({data:e}){let t=(0,X.useMemo)(()=>{if(e.length<2)return null;let t=e.map(e=>e.tps),n=Math.max(...t,.1),r=Math.min(...t,0),i=n-r||1;return{points:t.map((e,n)=>{let a=n/(t.length-1)*200,o=2+(1-(e-r)/i)*28;return`${n===0?`M`:`L`}${a.toFixed(1)},${o.toFixed(1)}`}).join(` `),min:r,max:n}},[e]);return t?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsxs)(`svg`,{viewBox:`0 0 200 32`,className:`h-8 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":`TPS trend sparkline`,children:[(0,Z.jsx)(`line`,{x1:`0`,y1:`10.7`,x2:`200`,y2:`10.7`,stroke:`currentColor`,strokeWidth:`0.5`,strokeDasharray:`3,2`,className:`text-border`}),(0,Z.jsx)(`line`,{x1:`0`,y1:`21.3`,x2:`200`,y2:`21.3`,stroke:`currentColor`,strokeWidth:`0.5`,strokeDasharray:`3,2`,className:`text-border`}),(0,Z.jsx)(`path`,{d:t.points,fill:`none`,stroke:`var(--primary)`,strokeWidth:`1.5`})]}),(0,Z.jsxs)(`div`,{className:`flex justify-between text-[9px] text-muted-foreground`,children:[(0,Z.jsxs)(`span`,{children:[`60s ago · `,t.min.toFixed(1)]}),(0,Z.jsxs)(`span`,{children:[t.max.toFixed(1),` · now`]})]})]}):(0,Z.jsx)(`div`,{className:`flex h-8 items-center text-[10px] text-muted-foreground`,children:`Collecting...`})}var tt={running:`bg-success`,paused:`bg-warning`,idle:`bg-muted-foreground`,stopped:`bg-destructive`};function nt({state:e}){let t=tt[e]??`bg-muted-foreground`,n=e===`running`;return(0,Z.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,Z.jsxs)(`div`,{className:`relative flex items-center justify-center`,children:[(0,Z.jsx)(`span`,{className:`size-2.5 rounded-full ${t}`}),n&&(0,Z.jsx)(`span`,{className:`absolute size-2.5 animate-ping rounded-full ${t} opacity-40`})]}),(0,Z.jsx)(f,{mode:`wait`,initial:!1,children:(0,Z.jsx)(d.span,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},transition:{type:`spring`,stiffness:500,damping:30},className:`font-mono text-lg font-bold uppercase tracking-wider`,children:e},e)})]})}function $({label:e,tooltip:t,tooltipClassName:n}){return(0,Z.jsxs)(`div`,{className:`inline-flex w-fit min-w-0 max-w-full items-center gap-1`,children:[(0,Z.jsx)(`span`,{className:`blueprint-title min-w-0 shrink text-[11px] leading-tight text-muted-foreground`,children:e}),(0,Z.jsxs)(Oe,{children:[(0,Z.jsx)(Ee,{className:`inline-flex size-4 shrink-0 items-center justify-center rounded-[var(--miravo-radius-tight)] border-0 bg-transparent p-0 text-muted-foreground shadow-none outline-none hover:text-foreground focus-visible:ring-1 focus-visible:ring-ring`,render:(0,Z.jsx)(`button`,{type:`button`}),"aria-label":`About ${e}`,children:(0,Z.jsx)(ye,{className:`size-3`,"aria-hidden":!0})}),(0,Z.jsx)(De,{side:`top`,className:O(`max-w-xs`,n),children:t})]})]})}function rt(){let{engineState:e,connectionState:t}=l(S(e=>({engineState:e.engineState,connectionState:e.connectionState}))),n=L();return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)($,{label:`Run state`,tooltip:(0,Z.jsx)(`p`,{className:`text-[11px] leading-snug`,children:`Whether the scheduler is running, paused, idle, or stopped. Pause freezes simulated time; resume continues from the same tick.`})}),(0,Z.jsx)(nt,{state:e}),t===`live`&&(e===`running`||e===`paused`)&&(0,Z.jsx)(`div`,{className:`mt-1 flex items-center gap-2`,children:(0,Z.jsxs)(C,{type:`button`,size:`sm`,variant:e===`paused`?`default`:`outline`,className:O(`h-8 min-h-11 w-fit touch-manipulation gap-1.5 px-3 text-xs sm:min-h-8`,e===`running`&&`border-warning/40 bg-warning/10 text-warning hover:bg-warning/20 hover:text-warning focus-visible:border-warning/50 focus-visible:ring-warning/25 border-warning/35`),onClick:()=>n.mutate({type:e===`paused`?`resume`:`pause`}),children:[e===`paused`?(0,Z.jsx)(we,{className:`size-3`}):(0,Z.jsx)(Ne,{className:`size-3`}),e===`paused`?`Resume`:`Pause`]})})]})}function it(){let{speedMultiplier:e,connectionState:t}=l(S(e=>({speedMultiplier:e.speedMultiplier,connectionState:e.connectionState}))),n=L(),[r,i]=(0,X.useState)(String(e)),a=t===`live`;return(0,X.useEffect)(()=>{i(String(e))},[e]),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)($,{label:`Speed`,tooltip:(0,Z.jsx)(`p`,{className:`text-[11px] leading-snug`,children:`Runs the environment at this multiple of real time. 1× is real time; higher values speed up the model. Change it with the field and Set.`})}),(0,Z.jsxs)(`span`,{className:`w-fit font-mono text-lg font-bold tabular-nums`,children:[e,`x`]}),(0,Z.jsxs)(`div`,{className:`mt-1 flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Z.jsx)(B,{htmlFor:`speed-multiplier`,className:`sr-only`,children:`Speed multiplier`}),(0,Z.jsx)(w,{id:`speed-multiplier`,type:`number`,value:r,onChange:e=>i(e.target.value),className:`h-8 min-h-11 w-[4.75rem] touch-manipulation font-mono text-xs tabular-nums sm:min-h-8`,min:`1`,max:`1000`,disabled:!a}),(0,Z.jsx)(C,{type:`button`,size:`sm`,variant:`outline`,className:`h-8 min-h-11 touch-manipulation px-3 text-xs sm:min-h-8`,disabled:!a,onClick:()=>{let e=F(_e,{multiplier:Number(r)});e&&n.mutate({type:`setSpeed`,multiplier:e.multiplier})},children:`Set`})]})]})}function at(){let{tick:e,simulationTime:t,tps:n,tpsHistory:r,uptimeMs:i,instanceCount:a,memberValueCount:o}=l(S(e=>({tick:e.tick,simulationTime:e.simulationTime,tps:e.tps,tpsHistory:e.tpsHistory,uptimeMs:e.uptimeMs,instanceCount:e.instanceCount,memberValueCount:e.memberValueCount})));return(0,Z.jsxs)(`div`,{className:O(Te,`px-4 py-3`),children:[(0,Z.jsxs)(`header`,{className:`mb-3 border-b border-border/60 pb-2`,children:[(0,Z.jsx)(`h2`,{className:`font-heading text-sm font-semibold tracking-tight text-foreground`,children:`Engine vitals`}),(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:`Scheduler, speed, cycle count, and throughput for this session.`})]}),(0,Z.jsxs)(`div`,{className:`grid min-w-0 grid-cols-2 gap-3 @2xl/main:gap-4 @3xl/main:grid-cols-3 @5xl/main:grid-cols-6`,children:[(0,Z.jsx)(rt,{}),(0,Z.jsx)(it,{}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)($,{label:`Cycle`,tooltipClassName:`flex flex-col items-start gap-2 text-left`,tooltip:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`text-[11px] leading-snug`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:`Cycle`}),` compares simulated progress with wall time: how many steps ran, how much model time advanced, and how long this session has been open.`]}),(0,Z.jsxs)(`p`,{className:`text-[11px] leading-snug`,children:[`The number is `,(0,Z.jsx)(`span`,{className:`font-medium`,children:`tick`}),` count — completed scheduler steps since this run. Each tick refreshes the plant model and live tags.`]}),(0,Z.jsxs)(`p`,{className:`text-[11px] leading-snug`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:`Sim`}),` is simulated elapsed time. Each tick adds (tick interval × speed) to this clock. Generators, lifecycle, and in-model timestamps use Sim, not your system clock. It stops advancing while paused.`]}),(0,Z.jsxs)(`p`,{className:`text-[11px] leading-snug`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:`Real`}),` is wall-clock uptime since the run started (real time).`]})]})}),(0,Z.jsx)(`span`,{className:`w-fit font-mono text-lg font-bold tabular-nums`,children:E(e)}),(0,Z.jsxs)(`div`,{className:`mt-1 flex w-full min-w-0 flex-col gap-0.5 leading-tight`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,Z.jsx)(`span`,{className:`w-10 shrink-0 text-[9px] font-semibold uppercase tracking-wide text-muted-foreground`,children:`Sim`}),(0,Z.jsx)(`span`,{className:`min-w-0 font-mono text-[10px] tabular-nums text-muted-foreground`,children:$e(t)})]}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,Z.jsx)(`span`,{className:`w-10 shrink-0 text-[9px] font-semibold uppercase tracking-wide text-muted-foreground`,children:`Real`}),(0,Z.jsx)(`span`,{className:`min-w-0 font-mono text-[10px] tabular-nums text-muted-foreground`,children:Qe(i)})]})]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)($,{label:`Throughput`,tooltip:(0,Z.jsx)(`p`,{className:`text-[11px] leading-snug`,children:`Ticks per second: how fast the engine is stepping. Rises and falls with workload, speed setting, and CPU headroom.`})}),(0,Z.jsxs)(`span`,{className:`w-fit font-mono text-lg font-bold tabular-nums`,children:[n.toFixed(1),` tps`]}),(0,Z.jsxs)(`span`,{className:`mt-1 text-[10px] text-muted-foreground`,children:[a,` inst · `,T(o),` tags`]})]}),(0,Z.jsxs)(`div`,{className:`col-span-2 flex flex-col gap-2`,children:[(0,Z.jsx)($,{label:`TPS Trend`,tooltip:(0,Z.jsx)(`p`,{className:`text-[11px] leading-snug`,children:`Recent ticks-per-second samples over about the last minute. Flat or noisy lines usually mean load or speed changes.`})}),(0,Z.jsx)(et,{data:r})]})]})]})}var ot=[`MQTT Sparkplug B`,`EtherNet/IP`,`Siemens S7`];function st({enabled:e,total:t}){let n=t===0?`empty`:e===0?`idle`:`live`;return(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 rounded-[var(--miravo-radius-pill)] border border-border/60 bg-background/60 px-2.5 py-1 backdrop-blur-sm`,children:[(0,Z.jsxs)(`span`,{className:`relative flex size-1.5 items-center justify-center`,children:[(0,Z.jsx)(`span`,{className:O(`size-1.5 rounded-full`,n===`live`?`bg-success shadow-[0_0_0_1px_color-mix(in_srgb,var(--success)_50%,transparent),0_0_12px_color-mix(in_srgb,var(--success)_42%,transparent)]`:n===`idle`?`bg-warning/85 shadow-[0_0_0_1px_color-mix(in_srgb,var(--warning)_50%,transparent),0_0_12px_color-mix(in_srgb,var(--warning)_38%,transparent)]`:`bg-muted-foreground/55`)}),n===`live`&&(0,Z.jsx)(`span`,{className:`absolute inset-0 animate-ping rounded-full bg-success/60`})]}),(0,Z.jsxs)(`span`,{className:`text-[11px] leading-none text-muted-foreground`,children:[(0,Z.jsx)(`span`,{className:`font-mono font-semibold tabular-nums text-foreground`,children:e}),(0,Z.jsx)(`span`,{className:`mx-1 text-muted-foreground/60`,children:`/`}),(0,Z.jsx)(`span`,{className:`font-mono tabular-nums`,children:t}),(0,Z.jsx)(`span`,{className:`ml-1.5 text-[10px] uppercase tracking-[0.14em]`,children:`active`})]})]})}function ct(){let{availableAdapters:e,adapterMetrics:t}=l(S(e=>({availableAdapters:e.availableAdapters,adapterMetrics:e.adapterMetrics}))),n=e.filter(e=>e.enabled).length;return(0,Z.jsxs)(`section`,{className:O(Te,`flex min-w-0 flex-col hover:border-border`),children:[(0,Z.jsxs)(`header`,{className:`flex flex-wrap items-start justify-between gap-3 border-b border-border/60 px-4 py-3`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,Z.jsx)(`div`,{className:`mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-[var(--miravo-radius-tight)] border border-border/60 bg-background/70 text-muted-foreground`,"aria-hidden":!0,children:(0,Z.jsx)(Ie,{className:`size-3.5`})}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`h3`,{className:`font-heading text-sm font-semibold tracking-tight text-foreground`,children:`Protocol Gateway`}),(0,Z.jsx)(`p`,{className:`mt-0.5 text-pretty text-xs text-muted-foreground`,children:`Northbound adapters publishing engine telemetry to external systems.`})]})]}),(0,Z.jsx)(st,{enabled:n,total:e.length})]}),e.length>0&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-2 px-4 py-4`,children:(0,Z.jsx)(f,{children:e.map((e,n)=>{let r=t.find(t=>t.name===e.name)?.metrics;return(0,Z.jsx)(d.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0},transition:{type:`spring`,stiffness:380,damping:30,delay:n*.05},children:(0,Z.jsx)(Je,{adapter:e,metrics:r})},e.name)})})}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-3 gap-y-2 border-t border-border/60 bg-background/40 px-4 py-2.5`,role:`status`,"aria-label":`Upcoming protocol adapters: ${ot.join(`, `)}, and more`,children:[(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,Z.jsx)(xe,{className:`size-3 text-muted-foreground/70`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`text-[10px] font-medium uppercase tracking-[0.14em] text-muted-foreground`,children:`Roadmap`})]}),(0,Z.jsxs)(`ul`,{className:`flex min-w-0 flex-wrap items-center gap-1.5`,children:[ot.map(e=>(0,Z.jsx)(`li`,{className:`rounded-[var(--miravo-radius-tight)] border border-dashed border-border/70 bg-background/40 px-2 py-0.5 font-mono text-[10px] leading-[15px] tracking-tight text-muted-foreground`,children:e},e)),(0,Z.jsx)(`li`,{className:`font-mono text-[10px] leading-[15px] tracking-tight text-muted-foreground/75`,children:`+ more`})]})]})]})}function lt(){let e=l(e=>e.instances),t=L(),[n,r]=(0,X.useState)(!1),[i,a]=(0,X.useState)(!1),[o,s]=(0,X.useState)(!1);return(0,Z.jsxs)(`div`,{className:`flex h-full min-w-0 flex-col`,children:[(0,Z.jsxs)(K,{className:`h-full min-w-0`,children:[(0,Z.jsx)(H,{className:`pb-3`,children:(0,Z.jsxs)(W,{className:`flex items-center gap-2 text-xs font-medium uppercase tracking-wider`,children:[(0,Z.jsx)(Me,{className:`size-3.5 text-muted-foreground`,"aria-hidden":!0}),`Danger Zone`]})}),(0,Z.jsx)(J,{className:`flex flex-1 flex-col`,children:(0,Z.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-3 rounded-[var(--miravo-radius-stadium-sm)] border border-dashed border-border p-3 @2xl/main:flex-row @2xl/main:items-center @2xl/main:justify-between`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 space-y-0.5`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:`Reset environment`}),(0,Z.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Removes `,e.length,` running instance`,e.length===1?``:`s`,` and all loaded environments.`]})]}),(0,Z.jsx)(C,{className:`min-h-11 w-full shrink-0 touch-manipulation @2xl/main:w-auto sm:min-h-7`,variant:`destructive`,size:`sm`,onClick:()=>r(!0),children:`Reset`})]})})]}),(0,Z.jsx)(_,{open:n,onOpenChange:e=>{r(e),e||a(!1)},children:(0,Z.jsxs)(y,{children:[(0,Z.jsxs)(v,{children:[(0,Z.jsx)(b,{children:`Reset Environment`}),(0,Z.jsx)(g,{children:`Removes all running instances and loaded environments.`})]}),(0,Z.jsx)(`div`,{className:`space-y-3 text-sm`,children:(0,Z.jsx)(`div`,{className:`rounded-[var(--miravo-radius-stadium-sm)] border p-3`,children:(0,Z.jsxs)(B,{htmlFor:`clear-persisted-state`,className:`items-start`,children:[(0,Z.jsx)(Se,{id:`clear-persisted-state`,checked:i,onCheckedChange:e=>a(e===!0)}),(0,Z.jsxs)(`span`,{className:`space-y-1`,children:[(0,Z.jsx)(`span`,{className:`block font-medium text-foreground`,children:`Also clear persisted state`}),(0,Z.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:`Start empty on the next restart.`})]})]})})}),(0,Z.jsxs)(h,{children:[(0,Z.jsx)(C,{variant:`outline`,className:`min-h-11 w-full touch-manipulation sm:min-h-8 sm:w-auto`,onClick:()=>{r(!1),a(!1)},disabled:o,children:`Cancel`}),(0,Z.jsx)(C,{variant:`destructive`,className:`min-h-11 w-full touch-manipulation sm:min-h-8 sm:w-auto`,disabled:o,onClick:async()=>{s(!0);try{await t.mutateAsync({type:`resetEnvironment`,...i?{clearPersistence:!0}:{}}),r(!1),a(!1)}catch{}finally{s(!1)}},children:o?`Resetting...`:`Confirm Reset`})]})]})})]})}function ut(){let[e,t]=p(`tab`,m([`monitor`,`operate`]).withDefault(`monitor`));return(0,Z.jsxs)(`div`,{className:`mx-auto flex w-full min-w-0 max-w-screen-2xl flex-col gap-5 p-4 sm:gap-6 sm:p-6`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`h1`,{className:`font-heading text-2xl font-semibold tracking-tight`,children:`Mission Control`}),(0,Z.jsxs)(z,{variant:`outline`,title:`Miravo version ${u}`,className:`font-mono text-[10px] leading-none text-muted-foreground`,children:[`v`,u]})]}),(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Engine telemetry, protocol management, and fleet operations.`})]}),(0,Z.jsxs)(fe,{value:e,onValueChange:e=>{t(e)},className:`min-h-0 flex-1`,children:[(0,Z.jsx)(`div`,{className:`shrink-0 overflow-x-auto`,children:(0,Z.jsxs)(ue,{variant:`line`,className:`h-10! min-w-max gap-0.5`,children:[(0,Z.jsxs)(N,{value:`monitor`,className:`gap-1.5 px-3 text-sm`,children:[(0,Z.jsx)(he,{className:`size-3.5 shrink-0`}),`Monitor`]}),(0,Z.jsxs)(N,{value:`operate`,className:`gap-1.5 px-3 text-sm`,children:[(0,Z.jsx)(pe,{className:`size-3.5 shrink-0`}),`Operate`]})]})}),(0,Z.jsx)(le,{value:`monitor`,className:`flex-1 py-2`,children:(0,Z.jsxs)(d.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.15,ease:`easeOut`},className:`flex flex-col gap-5 sm:gap-6`,children:[(0,Z.jsx)(at,{}),(0,Z.jsx)(ct,{})]},`monitor`)}),(0,Z.jsx)(le,{value:`operate`,className:`flex-1 py-2`,children:(0,Z.jsxs)(d.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.15,ease:`easeOut`},className:`grid min-h-0 min-w-0 grid-cols-1 items-stretch gap-5 @2xl/main:grid-cols-2 @2xl/main:gap-4`,children:[(0,Z.jsx)(Ye,{}),(0,Z.jsx)(Ze,{}),(0,Z.jsx)(Xe,{}),(0,Z.jsx)(lt,{})]},`operate`)})]})]})}export{Ie as n,ut as t};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{$ as n,J as r,Q as i,X as a,Y as o,Z as s,at as c,ot as l,q as u}from"./vendor-ui-CWUk2ulb.js";import{S as d,T as ee,w as f}from"./format-CshN6yEB.js";import{n as p,t as m}from"./utils-XFKvwlFT.js";import{i as h,n as g,t as _}from"./tooltip-D1ydB4g3.js";var v=c(),y=e(t(),1),b=e(l(),1);function te(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 x=e=>{switch(e){case`success`:return w;case`info`:return ne;case`warning`:return T;case`error`:return E;default:return null}},S=Array(12).fill(0),C=({visible:e,className:t})=>y.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},y.createElement(`div`,{className:`sonner-spinner`},S.map((e,t)=>y.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),w=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`})),T=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`})),ne=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`})),E=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`})),D=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`})),O=()=>{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()});te(`[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:ee,closeButton:f,style:p,cancelButtonStyle:m,actionButtonStyle:h,className:g=``,descriptionClassName:_=``,duration:v,position:b,gap:te,expandByDefault:S,classNames:w,icons:T,closeButtonAriaLabel:ne=`Close toast`}=e,[E,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??f,[n.closeButton,f]),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=O(),Se=n.invert||t,Ce=J===`loading`;Z.current=y.useMemo(()=>X*te+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 T?.loading?y.createElement(`div`,{className:B(w?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":J===`loading`},T.loading):y.createElement(C,{className:B(w?.loader,n?.classNames?.loader),visible:J===`loading`})}let Te=n.icon||T?.[J]||x(J);return y.createElement(`li`,{tabIndex:0,ref:q,className:B(g,fe,w?.toast,n?.classNames?.toast,w?.default,w?.[J],n?.classNames?.[J]),"data-sonner-toast":``,"data-rich-colors":n.richColors??ee,"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||S&&M),"data-testid":n.testId,style:{"--index":c,"--toasts-before":c,"--z-index":l.length-c,"--offset":`${F?ce:Z.current}px`,"--initial-height":S?`auto`:`${le}px`,...p,...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=E===`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(E===`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);!E&&(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(E===`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(E===`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":ne,"data-disabled":Ce,"data-close-button":!0,onClick:Ce||!Y?()=>{}:()=>{$(),n.onDismiss==null||n.onDismiss.call(n,n)},className:B(w?.closeButton,n?.classNames?.closeButton)},T?.close??D):null,(J||n.icon||n.promise)&&n.icon!==null&&(T?.[J]!==null||n.icon)?y.createElement(`div`,{"data-icon":``,className:B(w?.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(w?.content,n?.classNames?.content)},y.createElement(`div`,{"data-title":``,className:B(w?.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,w?.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||m,onClick:e=>{P(n.cancel)&&Y&&(n.cancel.onClick==null||n.cancel.onClick.call(n.cancel,e),$())},className:B(w?.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(w?.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:ee,duration:f,style:p,visibleToasts:m=F,toastOptions:h,dir:g=V(),gap:_=re,icons:v,containerAriaLabel:te=`Notifications`}=e,[x,S]=y.useState([]),C=y.useMemo(()=>n?x.filter(e=>e.toasterId===n):x.filter(e=>!e.toasterId),[x,n]),w=y.useMemo(()=>Array.from(new Set([i].concat(C.filter(e=>e.position).map(e=>e.position)))),[C,i]),[T,ne]=y.useState([]),[E,D]=y.useState(!1),[O,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=>{S(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(()=>{S(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))});return}setTimeout(()=>{b.flushSync(()=>{S(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)]})})})}),[x]),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(()=>{x.length<=1&&D(!1)},[x]),y.useEffect(()=>{let e=e=>{if(a.every(t=>e[t]||e.code===t)){var t;D(!0),(t=N.current)==null||t.focus()}e.code===`Escape`&&(document.activeElement===N.current||N.current?.contains(document.activeElement))&&D(!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":`${te} ${P}`,tabIndex:-1,"aria-live":`polite`,"aria-relevant":`additions text`,"aria-atomic":`false`,suppressHydrationWarning:!0},w.map((t,n)=>{let[i,a]=t.split(`-`);return C.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":`${T[0]?.height||0}px`,"--width":`${z}px`,"--gap":`${_}px`,...p,...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:()=>D(!0),onMouseMove:()=>D(!0),onMouseLeave:()=>{O||D(!1)},onDragEnd:()=>D(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||k(!0)},onPointerUp:()=>k(!1)},C.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:ee,duration:h?.duration??f,className:h?.className,descriptionClassName:h?.descriptionClassName,invert:r,visibleToasts:m,closeButton:h?.closeButton??s,interacting:O,position:t,style:h?.style,unstyled:h?.unstyled,classNames:h?.classNames,cancelButtonStyle:h?.cancelButtonStyle,actionButtonStyle:h?.actionButtonStyle,closeButtonAriaLabel:h?.closeButtonAriaLabel,removeToast:R,toasts:C.filter(e=>e.position==n.position),heights:T.filter(e=>e.position==n.position),setHeights:ne,expandByDefault:o,gap:_,expanded:E,swipeDirections:e.swipeDirections}))):null}))}),U=p(`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)(r,{"data-slot":`dialog`,...e})}function W({...e}){return(0,v.jsx)(o,{"data-slot":`dialog-portal`,...e})}function G({className:e,...t}){return(0,v.jsx)(n,{"data-slot":`dialog-overlay`,className:m(`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,...r}){return(0,v.jsxs)(W,{children:[(0,v.jsx)(G,{}),(0,v.jsxs)(a,{"data-slot":`dialog-content`,className:m(`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),...r,children:[t,n&&(0,v.jsxs)(i,{"data-slot":`dialog-close`,render:(0,v.jsx)(d,{variant:`ghost`,className:`absolute top-2 right-2`,size:`icon-sm`}),children:[(0,v.jsx)(f,{}),(0,v.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function q({className:e,...t}){return(0,v.jsx)(`div`,{"data-slot":`dialog-header`,className:m(`flex flex-col gap-2`,e),...t})}function ue({className:e,showCloseButton:t=!1,children:n,...r}){return(0,v.jsxs)(`div`,{"data-slot":`dialog-footer`,className:m(`-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),...r,children:[n,t&&(0,v.jsx)(i,{render:(0,v.jsx)(d,{variant:`outline`}),children:`Close`})]})}function de({className:e,...t}){return(0,v.jsx)(u,{"data-slot":`dialog-title`,className:m(`text-base leading-none font-medium`,e),...t})}function J({className:e,...t}){return(0,v.jsx)(s,{"data-slot":`dialog-description`,className:m(`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]),d=s?(0,v.jsx)(ee,{className:`size-3 text-success`}):(0,v.jsx)(U,{className:`size-3`}),f=o?.({copied:s,icon:d});return(0,v.jsxs)(_,{children:[(0,v.jsx)(h,{className:f?void 0:m(`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:u,closeOnClick:!1,"aria-label":t,render:f,children:d}),(0,v.jsx)(g,{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
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{$ as n,J as r,Q as i,X as a,Y as o,Z as s,at as c,ot as l,q as u}from"./vendor-ui-CWUk2ulb.js";import{C as d,E as ee,T as f}from"./format-B9CcV2dj.js";import{n as p,t as m}from"./utils-XFKvwlFT.js";import{i as h,n as g,t as _}from"./tooltip-D1ydB4g3.js";var v=c(),y=e(t(),1),b=e(l(),1);function te(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 x=e=>{switch(e){case`success`:return w;case`info`:return ne;case`warning`:return T;case`error`:return E;default:return null}},S=Array(12).fill(0),C=({visible:e,className:t})=>y.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},y.createElement(`div`,{className:`sonner-spinner`},S.map((e,t)=>y.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),w=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`})),T=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`})),ne=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`})),E=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`})),D=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`})),O=()=>{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()});te(`[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:ee,closeButton:f,style:p,cancelButtonStyle:m,actionButtonStyle:h,className:g=``,descriptionClassName:_=``,duration:v,position:b,gap:te,expandByDefault:S,classNames:w,icons:T,closeButtonAriaLabel:ne=`Close toast`}=e,[E,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??f,[n.closeButton,f]),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=O(),Se=n.invert||t,Ce=J===`loading`;Z.current=y.useMemo(()=>X*te+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 T?.loading?y.createElement(`div`,{className:B(w?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":J===`loading`},T.loading):y.createElement(C,{className:B(w?.loader,n?.classNames?.loader),visible:J===`loading`})}let Te=n.icon||T?.[J]||x(J);return y.createElement(`li`,{tabIndex:0,ref:q,className:B(g,fe,w?.toast,n?.classNames?.toast,w?.default,w?.[J],n?.classNames?.[J]),"data-sonner-toast":``,"data-rich-colors":n.richColors??ee,"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||S&&M),"data-testid":n.testId,style:{"--index":c,"--toasts-before":c,"--z-index":l.length-c,"--offset":`${F?ce:Z.current}px`,"--initial-height":S?`auto`:`${le}px`,...p,...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=E===`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(E===`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);!E&&(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(E===`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(E===`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":ne,"data-disabled":Ce,"data-close-button":!0,onClick:Ce||!Y?()=>{}:()=>{$(),n.onDismiss==null||n.onDismiss.call(n,n)},className:B(w?.closeButton,n?.classNames?.closeButton)},T?.close??D):null,(J||n.icon||n.promise)&&n.icon!==null&&(T?.[J]!==null||n.icon)?y.createElement(`div`,{"data-icon":``,className:B(w?.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(w?.content,n?.classNames?.content)},y.createElement(`div`,{"data-title":``,className:B(w?.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,w?.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||m,onClick:e=>{P(n.cancel)&&Y&&(n.cancel.onClick==null||n.cancel.onClick.call(n.cancel,e),$())},className:B(w?.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(w?.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:ee,duration:f,style:p,visibleToasts:m=F,toastOptions:h,dir:g=V(),gap:_=re,icons:v,containerAriaLabel:te=`Notifications`}=e,[x,S]=y.useState([]),C=y.useMemo(()=>n?x.filter(e=>e.toasterId===n):x.filter(e=>!e.toasterId),[x,n]),w=y.useMemo(()=>Array.from(new Set([i].concat(C.filter(e=>e.position).map(e=>e.position)))),[C,i]),[T,ne]=y.useState([]),[E,D]=y.useState(!1),[O,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=>{S(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(()=>{S(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))});return}setTimeout(()=>{b.flushSync(()=>{S(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)]})})})}),[x]),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(()=>{x.length<=1&&D(!1)},[x]),y.useEffect(()=>{let e=e=>{if(a.every(t=>e[t]||e.code===t)){var t;D(!0),(t=N.current)==null||t.focus()}e.code===`Escape`&&(document.activeElement===N.current||N.current?.contains(document.activeElement))&&D(!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":`${te} ${P}`,tabIndex:-1,"aria-live":`polite`,"aria-relevant":`additions text`,"aria-atomic":`false`,suppressHydrationWarning:!0},w.map((t,n)=>{let[i,a]=t.split(`-`);return C.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":`${T[0]?.height||0}px`,"--width":`${z}px`,"--gap":`${_}px`,...p,...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:()=>D(!0),onMouseMove:()=>D(!0),onMouseLeave:()=>{O||D(!1)},onDragEnd:()=>D(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||k(!0)},onPointerUp:()=>k(!1)},C.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:ee,duration:h?.duration??f,className:h?.className,descriptionClassName:h?.descriptionClassName,invert:r,visibleToasts:m,closeButton:h?.closeButton??s,interacting:O,position:t,style:h?.style,unstyled:h?.unstyled,classNames:h?.classNames,cancelButtonStyle:h?.cancelButtonStyle,actionButtonStyle:h?.actionButtonStyle,closeButtonAriaLabel:h?.closeButtonAriaLabel,removeToast:R,toasts:C.filter(e=>e.position==n.position),heights:T.filter(e=>e.position==n.position),setHeights:ne,expandByDefault:o,gap:_,expanded:E,swipeDirections:e.swipeDirections}))):null}))}),U=p(`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)(r,{"data-slot":`dialog`,...e})}function W({...e}){return(0,v.jsx)(o,{"data-slot":`dialog-portal`,...e})}function G({className:e,...t}){return(0,v.jsx)(n,{"data-slot":`dialog-overlay`,className:m(`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,...r}){return(0,v.jsxs)(W,{children:[(0,v.jsx)(G,{}),(0,v.jsxs)(a,{"data-slot":`dialog-content`,className:m(`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),...r,children:[t,n&&(0,v.jsxs)(i,{"data-slot":`dialog-close`,render:(0,v.jsx)(d,{variant:`ghost`,className:`absolute top-2 right-2`,size:`icon-sm`}),children:[(0,v.jsx)(f,{}),(0,v.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function q({className:e,...t}){return(0,v.jsx)(`div`,{"data-slot":`dialog-header`,className:m(`flex flex-col gap-2`,e),...t})}function ue({className:e,showCloseButton:t=!1,children:n,...r}){return(0,v.jsxs)(`div`,{"data-slot":`dialog-footer`,className:m(`-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),...r,children:[n,t&&(0,v.jsx)(i,{render:(0,v.jsx)(d,{variant:`outline`}),children:`Close`})]})}function de({className:e,...t}){return(0,v.jsx)(u,{"data-slot":`dialog-title`,className:m(`text-base leading-none font-medium`,e),...t})}function J({className:e,...t}){return(0,v.jsx)(s,{"data-slot":`dialog-description`,className:m(`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]),d=s?(0,v.jsx)(ee,{className:`size-3 text-success`}):(0,v.jsx)(U,{className:`size-3`}),f=o?.({copied:s,icon:d});return(0,v.jsxs)(_,{children:[(0,v.jsx)(h,{className:f?void 0:m(`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:u,closeOnClick:!1,"aria-label":t,render:f,children:d}),(0,v.jsx)(g,{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};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{at as n}from"./vendor-ui-CWUk2ulb.js";import{S as r,o as i,rt as a,v as o}from"./api-2XqCNjt9.js";import{i as ee,s as te,t as s}from"./query-fetch-error-xB4By0m0.js";import{t as c}from"./proxy-Be4WzmcS.js";import{t as ne}from"./AnimatePresence-CPmH1DMY.js";import{u as l}from"./chunk-OE4NN4TA-DBWZidbW.js";import{C as u,_ as d,t as f}from"./format-B9CcV2dj.js";import{c as re,i as p,n as m,s as ie,t as ae}from"./select-CMOnuEoT.js";import{n as h,t as oe}from"./use-transition-navigate-D3JSD38W.js";import{t as se}from"./badge-i00PiRCo.js";import{n as ce}from"./transition-types-CPlGtM8w.js";import{n as le}from"./auth-screen-backdrop-CgwRhIbi.js";import{n as g}from"./get-error-message-BanmV5rD.js";import{r as ue}from"./runtime-link-D-uJbw97.js";import{a as de,i as fe,n as pe,o as me,r as he,s as ge,t as _e}from"./combobox-BJecIYHE.js";import{a as _,c as v,i as y,o as b,r as ve,s as ye,t as be}from"./select-display-items-y2L7MHmk.js";var x=e(t(),1);function xe(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 Se(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 S(e){if(`targetLabel`in e)return typeof e.targetLabel==`string`?e.targetLabel:void 0}function C(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=S(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 Ce(e,t){let n=new Date(e);return n.toDateString()===t.toDateString()?n.toLocaleTimeString(f):n.toLocaleString(f,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function w(e){if(`instanceId`in e&&typeof e.instanceId==`string`)return e.instanceId}function T(e){return e.type===`platform:operation`||e.type===`platform:resource`?S(e):w(e)}function E(e){return`fault`in e?d(e.fault):e.type===`platform:operation`||e.type===`platform:resource`?C(e):`from`in e&&`to`in e?`${d(e.from)} \u2192 ${d(e.to)}`:``}function D(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()}`}var O=n(),k=1500;function A(){let e=te(),[t]=l(),n=t.get(`type`)??`all`,d=t.get(`instanceId`)??``,[f,S]=(0,x.useState)(n),[C,A]=(0,x.useState)(d),[j,we]=(0,x.useState)(!0),M=ue(a(e=>e.connectionState))===null,N=a(e=>e.events.length),P=(0,x.useRef)(!1),F=a(e=>e.instances),Te=oe(),I=ee({queryKey:o.events(f,C),queryFn:()=>i(D(f,C,null),r.events),refetchInterval:j&&M?k:!1,staleTime:5e3}),[Ee,L]=(0,x.useState)([]),[De,R]=(0,x.useState)(!1),[Oe,z]=(0,x.useState)(null),B=`${f}::${C}`,V=(0,x.useRef)(B);(0,x.useEffect)(()=>{B!==V.current&&(V.current=B,L([]),z(null),U(!1))},[B]),(0,x.useEffect)(()=>{S(e=>e===n?e:n)},[n]),(0,x.useEffect)(()=>{A(e=>e===d?e:d)},[d]);let[H,U]=(0,x.useState)(()=>(I.data?.events.length??0)>0),W=I.data?[I.data,...Ee]:[],G=W.flatMap(e=>e.events),K=W[W.length-1],q=K?.hasMore??!1;(0,x.useEffect)(()=>{G.length>0&&!H&&U(!0)},[G.length,H]);let J=(0,x.useRef)(N);(0,x.useEffect)(()=>{N!==J.current&&(J.current=N,j&&M?(e.invalidateQueries({queryKey:o.events(f,C)}),P.current=!1):j&&(P.current=!0))},[N,j,M,e,f,C]),(0,x.useEffect)(()=>{!j||!M||!P.current||(P.current=!1,e.invalidateQueries({queryKey:o.events(f,C)}))},[j,M,e,f,C]);let[Y,ke]=(0,x.useState)(``),X=(0,x.useMemo)(()=>Y?F.filter(e=>e.id.toLowerCase().includes(Y.toLowerCase())):F,[F,Y]),Z=I.isPending&&!I.data&&!I.isError,Ae=j&&!Z&&!H&&G.length===0,Q=I.error??Oe,je=I.isError&&!I.data,$=(0,x.useCallback)(()=>{I.refetch()},[I]),Me=async()=>{if(K?.nextCursor){R(!0),z(null);try{let e=await i(D(f,C,K.nextCursor),r.events);L(t=>[...t,e])}catch(e){z(e instanceof Error?e:Error(g(e,`Failed to fetch events.`)))}finally{R(!1)}}};if(je)return(0,O.jsx)(le,{className:`min-h-full`,children:(0,O.jsx)(`div`,{className:`flex min-h-[40vh] flex-col items-center justify-center p-6 sm:p-12`,children:(0,O.jsx)(`div`,{className:`w-full max-w-md`,children:(0,O.jsx)(s,{message:g(Q,`Failed to fetch events.`),onRetry:$,isRetrying:I.isFetching})})})});let Ne=new Date;return(0,O.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,O.jsx)(s,{message:`${g(Q,`Failed to fetch events.`)} Showing cached events.`,onRetry:$,isRetrying:I.isFetching}):null,(0,O.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,O.jsxs)(`div`,{className:`min-w-0 flex flex-col gap-1`,children:[(0,O.jsx)(`h1`,{className:`font-heading text-2xl font-semibold tracking-tight`,children:`Event Log`}),(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Real-time event stream from the engine.`}),j&&!M?(0,O.jsx)(`p`,{className:`text-xs text-warning`,role:`status`,children:`Live refresh pauses until the Miravo link is live again.`}):null]}),(0,O.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,O.jsx)(`button`,{type:`button`,onClick:()=>we(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,O.jsx)(ne,{mode:`wait`,initial:!1,children:j?(0,O.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,O.jsx)(`span`,{className:`size-1.5 animate-pulse rounded-full bg-success`}),(0,O.jsx)(`span`,{className:`font-medium text-success`,children:`LIVE`})]},`live`):(0,O.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,O.jsx)(`span`,{className:`size-1.5 rounded-full bg-muted-foreground`}),(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:`Paused`})]},`paused`)})}),(0,O.jsx)(`div`,{className:`min-w-0 flex-1 lg:w-48 lg:flex-none`,children:(0,O.jsxs)(_e,{value:C||null,onValueChange:e=>{A(e??``)},onInputValueChange:ke,children:[(0,O.jsx)(he,{placeholder:`All instances`,className:`h-8 w-full min-w-0`,showClear:!!C}),(0,O.jsx)(pe,{children:(0,O.jsxs)(de,{children:[X.map(e=>(0,O.jsx)(fe,{value:e.id,children:(0,O.jsx)(`span`,{className:`font-mono`,children:e.id})},e.id)),X.length===0&&(0,O.jsx)(`p`,{className:`py-2 text-center text-xs text-muted-foreground`,children:`No instances found`})]})})]})}),(0,O.jsx)(`div`,{className:`min-w-0 flex-1 lg:w-48 lg:flex-none`,children:(0,O.jsxs)(ae,{value:f,onValueChange:e=>{S(e??`all`)},items:be,children:[(0,O.jsx)(ie,{className:`w-full min-w-0 lg:w-48`,"aria-label":`Event type filter`,children:(0,O.jsx)(re,{placeholder:`Filter by type`})}),(0,O.jsxs)(m,{alignItemWithTrigger:!1,align:`start`,children:[(0,O.jsx)(p,{value:`all`,children:`All events`}),(0,O.jsx)(p,{value:`fault:triggered`,children:`Fault Triggered`}),(0,O.jsx)(p,{value:`fault:cleared`,children:`Fault Cleared`}),(0,O.jsx)(p,{value:`lifecycle:changed`,children:`Lifecycle Changed`}),(0,O.jsx)(p,{value:`instance:created`,children:`Instance Created`}),(0,O.jsx)(p,{value:`instance:removed`,children:`Instance Removed`}),(0,O.jsx)(p,{value:`engine:state-changed`,children:`Engine State`}),(0,O.jsx)(p,{value:`platform:resource`,children:`Platform Resource`}),(0,O.jsx)(p,{value:`platform:operation`,children:`Platform Operation`})]})]})})]})]}),(0,O.jsx)(me,{className:`min-w-0 py-0`,children:(0,O.jsx)(ge,{className:`p-0`,children:(0,O.jsxs)(ve,{children:[(0,O.jsx)(ye,{children:(0,O.jsxs)(v,{children:[(0,O.jsx)(b,{className:`hidden w-12 sm:table-cell`,children:`#`}),(0,O.jsx)(b,{children:`Type`}),(0,O.jsx)(b,{children:`Context`}),(0,O.jsx)(b,{children:`Details`}),(0,O.jsx)(b,{className:`hidden text-right md:table-cell`,children:`Cycle #`}),(0,O.jsx)(b,{className:`hidden text-right sm:table-cell`,children:`Wall Clock`})]})}),(0,O.jsxs)(y,{children:[G.map(e=>{let t=w(e),n=T(e),r=e.type===`platform:resource`||e.type===`platform:operation`;return(0,O.jsxs)(v,{className:t?`transition-colors`:``,onMouseEnter:t?()=>h(`/instance/${t}`):void 0,children:[(0,O.jsx)(_,{className:`hidden font-mono text-xs text-muted-foreground sm:table-cell`,children:e.id}),(0,O.jsx)(_,{children:(0,O.jsx)(se,{variant:xe(e.type),className:`text-xs ${Se(e.type)}`,children:r?e.type===`platform:operation`?`platform:${e.operationType}`:`${e.action}:${e.resourceType}`:e.type})}),(0,O.jsx)(_,{className:`font-mono text-xs`,children:t?(0,O.jsx)(`button`,{type:`button`,className:`rounded-[var(--miravo-radius-tight)] text-left text-primary outline-none underline-offset-4 hover:underline focus-visible:ring-2 focus-visible:ring-ring/70 focus-visible:ring-offset-2 focus-visible:ring-offset-background`,onFocus:()=>h(`/instance/${t}`),onClick:()=>Te(`/instance/${t}`,{transitionType:ce}),children:n??t}):n??`—`}),(0,O.jsx)(_,{className:`max-w-xs truncate font-mono text-xs`,children:E(e)||(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,O.jsx)(_,{className:`hidden text-right font-mono text-xs md:table-cell`,children:e.tick}),(0,O.jsx)(_,{className:`hidden text-right text-xs text-muted-foreground sm:table-cell`,children:Ce(e.timestamp,Ne)})]},e.id)}),!Z&&G.length===0&&(0,O.jsx)(v,{children:(0,O.jsx)(_,{colSpan:6,className:`py-8 text-center text-muted-foreground`,children:Ae?`Listening for events…`:`No events`})})]})]})})}),q&&(0,O.jsx)(`div`,{className:`flex justify-center border-t border-border/40 pt-4`,children:(0,O.jsx)(u,{variant:`outline`,size:`sm`,onClick:()=>void Me(),disabled:De,children:`Load older events`})})]})}export{A as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./events-B8fp1TQW.js";export{e as EventsPage};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{at as n}from"./vendor-ui-CWUk2ulb.js";import{S as r,o as i,rt as a,v as o,y as s}from"./api-2XqCNjt9.js";import{i as c,n as l}from"./dist-xY0pK9Wy.js";import{n as u}from"./chunk-OE4NN4TA-DBWZidbW.js";import{t as d}from"./shallow-Cin0mLuv.js";import{S as f,T as p,_ as m,b as h,c as g,d as _,f as v,l as ee,m as te,s as ne,u as y,y as re}from"./format-B9CcV2dj.js";import{t as b}from"./utils-XFKvwlFT.js";import{t as x}from"./arrow-right-BjBb4z7g.js";import{t as S}from"./arrow-up-down-C1oJAmrw.js";import{c as C,i as w,n as T,s as E,t as D}from"./select-CMOnuEoT.js";import{t as ie}from"./circle-question-mark-CJvcT6V6.js";import{i as O,n as k,t as A}from"./tooltip-D1ydB4g3.js";import{n as ae,t as oe}from"./use-transition-navigate-D3JSD38W.js";import{t as se}from"./badge-i00PiRCo.js";import{n as ce}from"./transition-types-CPlGtM8w.js";import{a as le,i as ue,n as de,o as fe,r as pe,s as me,t as he}from"./combobox-BJecIYHE.js";import{a as j,c as M,i as ge,n as _e,o as N,r as ve,s as ye}from"./select-display-items-y2L7MHmk.js";var P=e(t(),1);function F(e){return s.prefetchQuery({queryKey:o.instances.detail(e),queryFn:()=>i(`/instances/${e}`,r.instanceDetail),staleTime:2e3})}var I=n(),L={success:`bg-success`,warning:`bg-warning`,destructive:`bg-destructive`,foreground:`bg-foreground/60`,primary:`bg-primary`},R={success:`text-success`,warning:`text-warning`,destructive:`text-destructive`,foreground:`text-foreground`,primary:`text-primary`},z={mqtt:`MQTT`,opcua:`OPC UA`,modbus:`Modbus`};function B({label:e,pip:t,pulse:n}){return(0,I.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[t&&(n?(0,I.jsxs)(`span`,{"aria-hidden":!0,className:`relative flex size-1.5 shrink-0 items-center justify-center`,children:[(0,I.jsx)(`span`,{className:b(`absolute inline-flex h-full w-full animate-ping rounded-full opacity-75`,L[t])}),(0,I.jsx)(`span`,{className:b(`relative inline-flex size-1.5 rounded-full`,L[t])})]}):(0,I.jsx)(`span`,{"aria-hidden":!0,className:b(`size-1.5 shrink-0 rounded-full`,L[t])})),(0,I.jsx)(`span`,{className:`truncate text-[10px] font-medium uppercase tracking-(--miravo-tracking-eyebrow) text-muted-foreground`,children:e})]})}function V({children:e,tone:t=`foreground`,live:n}){return(0,I.jsx)(`span`,{...n?{role:`status`,"aria-live":`polite`}:{},className:b(`mt-1 block min-w-0 truncate font-mono text-2xl font-semibold tabular-nums leading-none transition-colors duration-300`,R[t]),children:e})}function H({children:e}){return(0,I.jsx)(`span`,{className:`mt-1 min-w-0 truncate text-[10px] text-muted-foreground`,children:e})}function U(e,t){return e===t?``:t}function be({statusFilter:e,onStatusFilter:t}){let{instances:n,tps:r,memberValueCount:i,availableAdapters:o,adapterMetrics:s}=a(d(e=>({instances:e.instances,tps:e.tps,memberValueCount:e.memberValueCount,availableAdapters:e.availableAdapters,adapterMetrics:e.adapterMetrics}))),c=(0,P.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]),l=(0,P.useMemo)(()=>{let e=o.filter(e=>e.enabled);return{enabled:e,totalMessages:e.reduce((e,t)=>e+(s.find(e=>e.name===t.name)?.metrics?.messagesPublished??0),0),totalErrors:e.reduce((e,t)=>e+(s.find(e=>e.name===t.name)?.metrics?.errorsCount??0),0),labels:e.map(e=>z[e.name]??e.name)}},[o,s]),f=c.activeFaultCount>0,p=f?`destructive`:c.quarantined>0?`warning`:`success`,m=f?`faulted`:`healthy`;return(0,I.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,I.jsxs)(`button`,{type:`button`,onClick:()=>t(U(e,m)),"aria-pressed":e===`healthy`||e===`faulted`,"aria-label":f?`Filter to faulted instances`:`Filter to healthy instances`,className:b(`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,I.jsx)(B,{label:`Health`,pip:p}),(0,I.jsxs)(V,{tone:f?`destructive`:`success`,children:[c.pct,`%`]}),(0,I.jsx)(H,{children:c.total===0?`No instances`:[`${c.total} instance${c.total===1?``:`s`}`,c.faulted>0&&`${c.faulted} faulted`,c.quarantined>0&&`${c.quarantined} quarantined`,`${c.modelCount} model${c.modelCount===1?``:`s`}`].filter(Boolean).join(` · `)})]}),(0,I.jsxs)(`button`,{type:`button`,onClick:()=>t(e===`faulted`?``:`faulted`),"aria-pressed":e===`faulted`,"aria-label":`Filter to faulted instances`,className:b(`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,I.jsx)(B,{label:`Faults`,pip:f?`destructive`:`success`}),(0,I.jsx)(V,{tone:f?`destructive`:`foreground`,live:!0,children:c.activeFaultCount}),(0,I.jsx)(H,{children:f?`${c.affectedCount} instance${c.affectedCount===1?``:`s`} affected`:`all clear`})]}),(0,I.jsxs)(A,{children:[(0,I.jsxs)(O,{render:(0,I.jsx)(u,{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,I.jsx)(B,{label:`Tags`,pip:`primary`,pulse:!0}),(0,I.jsx)(V,{children:v(i)}),(0,I.jsxs)(H,{children:[(0,I.jsx)(`span`,{className:`font-mono tabular-nums`,children:r.toFixed(1)}),` tps · live`]})]}),(0,I.jsx)(k,{side:`bottom`,children:(0,I.jsxs)(`div`,{className:`flex flex-col gap-0.5 text-[11px]`,children:[(0,I.jsx)(`span`,{children:`Live tags tracked across the fleet.`}),i>=1e6&&(0,I.jsxs)(`span`,{className:`font-mono tabular-nums text-muted-foreground`,children:[y(i),` tags`]}),(0,I.jsxs)(`span`,{className:`text-muted-foreground`,children:[`Updating at `,(0,I.jsx)(`span`,{className:`font-mono tabular-nums`,children:r.toFixed(1)}),` per second.`]})]})})]}),l.enabled.length>0&&(0,I.jsx)(W,{labels:l.labels,totalMessages:l.totalMessages,totalErrors:l.totalErrors,perAdapter:l.enabled.map(e=>({name:z[e.name]??e.name,metrics:s.find(t=>t.name===e.name)?.metrics}))})]})}function W({labels:e,totalMessages:t,totalErrors:n,perAdapter:r}){return(0,I.jsxs)(A,{children:[(0,I.jsxs)(O,{render:(0,I.jsx)(u,{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,I.jsx)(B,{label:`Protocol`,pip:`primary`,pulse:!0}),(0,I.jsx)(V,{tone:n>0?`warning`:`foreground`,live:!0,children:v(t)}),(0,I.jsxs)(H,{children:[e.join(` · `),n>0&&` · ${n} error${n===1?``:`s`}`]})]}),(0,I.jsx)(k,{side:`bottom`,children:(0,I.jsxs)(`div`,{className:`flex flex-col gap-1 text-[11px]`,children:[(0,I.jsx)(`span`,{children:`Messages published since session start.`}),t>=1e6&&(0,I.jsxs)(`span`,{className:`font-mono tabular-nums text-muted-foreground`,children:[y(t),` total`]}),(0,I.jsx)(`div`,{className:`flex flex-col gap-0.5 border-t border-tooltip-border/60 pt-1`,children:r.map(e=>(0,I.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,I.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,I.jsxs)(`span`,{className:`font-mono tabular-nums`,children:[y(e.metrics?.messagesPublished??0),` msg`]}),e.metrics&&e.metrics.errorsCount>0&&(0,I.jsxs)(`span`,{className:`font-mono tabular-nums text-destructive`,children:[`· `,e.metrics.errorsCount,` err`]})]},e.name))})]})})]})}var G=`Commissioning → instance is running startup diagnostics. Operating → running normally. Decommissioning → winding down.`;function xe(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 Se(e){return e===``||e===`healthy`||e===`faulted`||e===`quarantined`}function Ce(e){return e.isQuarantined?`quarantined`:e.activeFaults.length>0?`faulted`:`healthy`}var K={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 we({state:e}){let t=K[e];return(0,I.jsxs)(A,{children:[(0,I.jsxs)(O,{render:(0,I.jsx)(`span`,{className:b(`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,I.jsx)(`span`,{"aria-hidden":!0,className:b(`size-1.5 shrink-0 rounded-full`,t.pip)}),(0,I.jsx)(`span`,{children:g(t.label)})]}),(0,I.jsx)(k,{side:`top`,children:t.help})]})}function q({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,I.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,I.jsxs)(`span`,{className:`inline-flex items-baseline gap-1`,children:[(0,I.jsx)(`span`,{children:e}),n&&(0,I.jsx)(`span`,{className:`text-[10px] font-normal text-muted-foreground`,children:n})]}),(0,I.jsx)(S,{className:b(`size-3`,c?`text-foreground`:`text-muted-foreground`),"aria-hidden":!0}),(0,I.jsx)(`span`,{className:`sr-only`,children:c?`, sorted ${a===`asc`?`ascending`:`descending`}. Click to toggle.`:`, click to sort`})]});return(0,I.jsx)(N,{className:s,"aria-sort":l,children:r?(0,I.jsxs)(A,{children:[(0,I.jsx)(O,{render:u}),(0,I.jsx)(k,{side:`top`,children:r})]}):u})}function J({title:e,body:t,action:n}){return(0,I.jsx)(M,{children:(0,I.jsx)(j,{colSpan:7,className:`py-10`,children:(0,I.jsxs)(`div`,{className:`mx-auto flex max-w-sm flex-col items-center gap-2 text-center`,children:[(0,I.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:e}),(0,I.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t}),n&&(0,I.jsxs)(u,{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,I.jsx)(x,{className:`size-3`,"aria-hidden":!0})]})]})})})}function Y(){let{instances:e,connectionState:t}=a(d(e=>({instances:e.instances,connectionState:e.connectionState}))),[n,r]=c(`q`,l.withDefault(``)),[i,o]=c(`model`,l.withDefault(``)),[s,u]=c(`lifecycle`,l.withDefault(``)),[g,v]=c(`status`,l.withDefault(``)),y=Se(g)?g:``,[S,L]=(0,P.useState)(`id`),[R,z]=(0,P.useState)(`asc`),B=(0,P.useRef)(null),V=oe(),[H,U]=(0,P.useState)(``);(0,P.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,P.useCallback)(e=>{e===S?z(e=>e===`asc`?`desc`:`asc`):(L(e),z(`asc`))},[S]),K=(0,P.useCallback)(e=>{v(e===``?``:e)},[v]),Y=(0,P.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]),X=(0,P.useMemo)(()=>[...new Set(e.map(e=>e.lifecycleStage))].sort(),[e]),Te=(0,P.useMemo)(()=>[{value:`all`,label:`All stages`},...X.map(e=>({value:e,label:m(e)}))],[X]),Z=(0,P.useMemo)(()=>H?Y.filter(([e])=>h(e,H)):Y,[Y,H]),Ee=(0,P.useMemo)(()=>i?{value:i,label:_(i)}:null,[i]),Q=(0,P.useMemo)(()=>{let t=e;return i&&(t=t.filter(e=>e.model===i)),s&&(t=t.filter(e=>e.lifecycleStage===s)),n&&(t=t.filter(e=>re(e.id,n)||h(e.model,n))),y===`faulted`&&(t=t.filter(e=>e.activeFaults.length>0)),y===`quarantined`&&(t=t.filter(e=>e.isQuarantined)),y===`healthy`&&(t=t.filter(e=>e.activeFaults.length===0&&!e.isQuarantined)),xe(t,S,R)},[e,n,y,i,s,S,R]),De=y!==``||i!==``||s!==``||n!==``,Oe=(0,P.useCallback)(()=>{r(``),v(``),o(``),u(``)},[r,v,o,u]),$=(0,P.useCallback)(e=>{V(`/instance/${e}`,{transitionType:ce})},[V]),ke=e.length===0&&t!==`live`,Ae=e.length===0&&t===`live`;return(0,I.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,I.jsx)(`h1`,{className:`font-heading text-2xl font-semibold tracking-tight`,children:`Fleet Overview`}),(0,I.jsx)(be,{statusFilter:y,onStatusFilter:K}),(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,I.jsxs)(he,{value:Ee,onValueChange:e=>void o(e?.value??``),isItemEqualToValue:(e,t)=>e?.value===t?.value,onInputValueChange:U,children:[(0,I.jsx)(pe,{placeholder:`All models`,className:`h-8 w-48`,showClear:!!i}),(0,I.jsx)(de,{children:(0,I.jsxs)(le,{children:[Z.map(([e,t])=>(0,I.jsxs)(ue,{value:{value:e,label:_(e)},children:[(0,I.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:_(e)}),(0,I.jsxs)(`span`,{className:`shrink-0 tabular-nums text-muted-foreground`,children:[`(`,t,`)`]})]},e)),Z.length===0&&(0,I.jsx)(`p`,{className:`py-2 text-center text-xs text-muted-foreground`,children:`No models found`})]})})]}),X.length>1&&(0,I.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,I.jsxs)(D,{value:s||`all`,onValueChange:e=>void u(!e||e===`all`?``:e),items:Te,children:[(0,I.jsx)(E,{className:`h-8 w-36`,"aria-label":`Lifecycle stage`,children:(0,I.jsx)(C,{placeholder:`All stages`})}),(0,I.jsxs)(T,{alignItemWithTrigger:!1,align:`start`,children:[(0,I.jsx)(w,{value:`all`,children:`All stages`}),X.map(e=>(0,I.jsx)(w,{value:e,children:m(e)},e))]})]}),(0,I.jsxs)(A,{children:[(0,I.jsx)(O,{render:(0,I.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,I.jsx)(ie,{className:`size-3.5`,"aria-hidden":!0})}),(0,I.jsx)(k,{side:`top`,children:G})]})]}),(0,I.jsxs)(D,{value:y||`all`,onValueChange:e=>void v(!e||e===`all`?``:e),items:_e,children:[(0,I.jsx)(E,{className:`h-8 w-32`,"aria-label":`Status filter`,children:(0,I.jsx)(C,{placeholder:`All status`})}),(0,I.jsxs)(T,{alignItemWithTrigger:!1,align:`start`,children:[(0,I.jsx)(w,{value:`all`,children:`All status`}),(0,I.jsx)(w,{value:`healthy`,children:`Healthy`}),(0,I.jsx)(w,{value:`faulted`,children:`Faulted`}),(0,I.jsx)(w,{value:`quarantined`,children:`Quarantined`})]})]}),(0,I.jsxs)(`div`,{className:`relative`,children:[(0,I.jsx)(f,{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,I.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:`/`})]}),De&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`button`,{type:`button`,onClick:Oe,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,I.jsx)(p,{className:`size-3`,"aria-hidden":!0}),`Clear`]}),(0,I.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,"aria-live":`polite`,children:[Q.length,` of `,e.length]})]})]}),(0,I.jsx)(fe,{className:`py-0`,children:(0,I.jsx)(me,{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,I.jsxs)(ve,{children:[(0,I.jsx)(ye,{children:(0,I.jsxs)(M,{children:[(0,I.jsx)(q,{label:`Instance`,sortKey:`id`,current:S,direction:R,onSort:W}),(0,I.jsx)(q,{label:`Model`,sortKey:`model`,current:S,direction:R,onSort:W,className:`hidden sm:table-cell`}),(0,I.jsx)(q,{label:`Lifecycle`,sortKey:`lifecycle`,current:S,direction:R,onSort:W,tooltip:G}),(0,I.jsx)(q,{label:`Operating age`,sortKey:`hours`,current:S,direction:R,onSort:W,tooltip:`Cumulative operating hours since the instance started running.`,className:`hidden text-right md:table-cell`}),(0,I.jsx)(q,{label:`Faults`,sortKey:`faults`,current:S,direction:R,onSort:W,tooltip:`Count of active (uncleared) faults on this instance.`}),(0,I.jsx)(q,{label:`Status`,sortKey:`status`,current:S,direction:R,onSort:W}),(0,I.jsx)(N,{children:(0,I.jsx)(`span`,{className:`sr-only`,children:`Navigate to instance`})})]})}),(0,I.jsx)(ge,{children:ke?(0,I.jsx)(J,{title:`Connecting to runtime`,body:`Live fleet data will appear once the connection is up.`}):Ae?(0,I.jsx)(J,{title:`No running instances`,body:`Start an environment from the Catalog to see instances.`,action:{label:`Open Catalog`,href:`/catalog`}}):Q.length===0?(0,I.jsx)(J,{title:`No matches`,body:`Adjust filters or clear them to see the full fleet.`}):Q.map(e=>{let t=Ce(e),n=ne(e.id),r=ee(e.id);return(0,I.jsxs)(M,{tabIndex:0,"aria-label":`Open instance ${r}`,className:b(`group cursor-pointer outline-none transition-colors`,`focus-visible:bg-sidebar-accent focus-visible:ring-2 focus-visible:ring-ring/70 focus-visible:ring-inset`),onClick:()=>$(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),$(e.id))},onMouseEnter:()=>{ae(`/instance/${e.id}`),F(e.id)},onFocus:()=>{ae(`/instance/${e.id}`),F(e.id)},children:[(0,I.jsx)(j,{className:`text-sm`,children:(0,I.jsx)(P.ViewTransition,{name:`instance-${e.id}`,default:`none`,children:(0,I.jsx)(`span`,{className:`inline-flex max-w-full truncate rounded-(--miravo-radius-tight) text-left`,title:`${r} (${e.id})`,children:n})})}),(0,I.jsx)(j,{className:`hidden text-sm sm:table-cell`,children:_(e.model)}),(0,I.jsx)(j,{children:(0,I.jsx)(se,{variant:`secondary`,className:`text-xs`,children:m(e.lifecycleStage)})}),(0,I.jsx)(j,{className:`hidden font-mono text-sm md:table-cell`,children:te(e.operatingHours)}),(0,I.jsx)(j,{children:e.activeFaults.length>0?(0,I.jsxs)(A,{children:[(0,I.jsx)(O,{render:(0,I.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,I.jsxs)(k,{side:`top`,children:[e.activeFaults.slice(0,4).join(`, `),e.activeFaults.length>4&&` + ${e.activeFaults.length-4} more`]})]}):(0,I.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[(0,I.jsx)(`span`,{className:`sr-only`,children:`no faults`}),(0,I.jsx)(`span`,{"aria-hidden":!0,children:`—`})]})}),(0,I.jsx)(j,{children:(0,I.jsx)(we,{state:t})}),(0,I.jsx)(j,{children:(0,I.jsx)(x,{className:`size-3.5 text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100`,"aria-hidden":!0})})]},e.id)})})]})})})]})}export{Y as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./fleet-CHhiI7Fk.js";export{e as FleetPage};
@@ -1 +1 @@
1
- import"./rolldown-runtime-COnpUsM8.js";import{c as e,s as t}from"./vendor-charts-95ykyDlI.js";import{at as n,nt as r,tt as i}from"./vendor-ui-CWUk2ulb.js";import{n as a,t as o}from"./utils-XFKvwlFT.js";var s=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,c=t,l=(e,t)=>n=>{if(t?.variants==null)return c(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=s(t)||s(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return c(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},u=a(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),d=a(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),f=n(),p=l(`group/button inline-flex shrink-0 items-center justify-center rounded-[var(--miravo-radius-stadium-sm)] border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:border-destructive/50 aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,outline:`border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground border-input bg-input/30 hover:bg-input/50`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground hover:bg-muted/50`,destructive:`bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 bg-destructive/20 hover:bg-destructive/30 focus-visible:ring-destructive/40`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,xs:`h-6 gap-1 rounded-[var(--miravo-radius-tight)] px-2 text-xs in-data-[slot=button-group]:rounded-[var(--miravo-radius-stadium-sm)] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-7 gap-1 rounded-[var(--miravo-radius-tight)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-[var(--miravo-radius-stadium-sm)] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3`,icon:`size-8`,"icon-xs":`relative size-6 rounded-[var(--miravo-radius-tight)] in-data-[slot=button-group]:rounded-[var(--miravo-radius-stadium-sm)] [&_svg:not([class*='size-'])]:size-3 before:absolute before:inset-[-10px] before:content-['']`,"icon-sm":`relative size-7 rounded-[var(--miravo-radius-tight)] in-data-[slot=button-group]:rounded-[var(--miravo-radius-stadium-sm)] before:absolute before:inset-[-10px] before:content-['']`,"icon-lg":`size-9`}},defaultVariants:{variant:`default`,size:`default`}});function m({className:e,variant:t=`default`,size:n=`default`,...i}){return(0,f.jsx)(r,{"data-slot":`button`,className:o(p({variant:t,size:n,className:e})),...i})}e();function h({className:e,type:t,...n}){return(0,f.jsx)(i,{type:t,"data-slot":`input`,className:o(`h-8 w-full min-w-0 rounded-[var(--miravo-radius-stadium-sm)] border border-input bg-input/30 px-2.5 py-1 text-xs transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-xs file:font-medium file:text-foreground placeholder:text-muted-foreground hover:bg-input/50 focus-visible:border-primary/35 focus-visible:ring-2 focus-visible:ring-primary/22 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...n})}function g(e){return e.split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function _(e,t){let n=t.trim().toLowerCase();return n?e.toLowerCase().includes(n)||g(e).toLowerCase().includes(n):!0}function v(e,t){let n=t.trim().toLowerCase();return n?e.toLowerCase().includes(n)||O(e).toLowerCase().includes(n):!0}function y(e){return e.split(`_`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function b(e){let t=e.trim();return t&&(t.includes(`_`)?y(t):/^[A-Z][A-Z0-9_-]*$/.test(t)?t:t.charAt(0).toUpperCase()+t.slice(1).toLowerCase())}function x(e){return e.includes(`_`)?b(e):g(e)}var S={degC:`°C`,"m3/h":`m³/h`,"mm/s":`mm/s`,pu:`pu`,"%":`%`};function C(e){return e?S[e]??e:``}var w=`en-US`;function T(e){let t=Math.max(0,Math.trunc(e));return t<1e6?t.toLocaleString(w):new Intl.NumberFormat(w,{notation:`compact`,compactDisplay:`short`,maximumFractionDigits:1}).format(t)}function E(e){return Number.isInteger(e)?Math.abs(e)>=1e4?e.toLocaleString(w):String(e):Math.abs(e)>=100?e.toFixed(1):Math.abs(e)>=1?e.toFixed(2):e.toFixed(3)}function D(e){return e.toLocaleString(w)}function O(e){let t=e.match(/^(.+)-(\d{3,})$/);if(!t)return g(e);let[,n,r]=t;return n?`${g(n)} ${r}`:g(e)}function k(e){return e.join(`/`)}function A(e,t){return`${k(e)}/${t}`}function j(e){let t=Math.round((Number.isFinite(e)&&e>=0?e:0)*60),n=1440,r=Math.floor(t/n),i=t%n,a=Math.floor(i/60),o=i%60;if(r>=365){let e=Math.floor(r/365),t=r%365,n=[`${e}y`];return t>0&&n.push(`${t}d`),a>0&&n.push(`${a}h`),o>0&&n.push(`${o}m`),n.join(` `)}if(r>0){let e=[`${r}d`];return a>0&&e.push(`${a}h`),o>0&&e.push(`${o}m`),e.join(` `)}return a>0?o>0?`${a}h ${o}m`:`${a}h`:o>0?`${o}m`:`0h`}function M(e){return new Date(e).toLocaleString(w)}function N(e){let t=Math.floor((Date.now()-e)/1e3);if(t<60)return`just now`;let n=Math.floor(t/60);if(n<60)return`${n}m ago`;let r=Math.floor(n/60);if(r<24)return`${r}h ago`;let i=Math.floor(r/24);return i<30?`${i}d ago`:new Date(e).toLocaleDateString(w,{month:`short`,day:`numeric`})}var P=new Set([`faulted`,`critical`,`stopped`,`emergency`]),F=new Set([`degraded`,`uncertain`]);function I(e){return P.has(e)?`bad`:F.has(e)?`warn`:`neutral`}export{p as C,l as E,m as S,u as T,C as _,k as a,I as b,O as c,T as d,E as f,y as g,x as h,A as i,D as l,N as m,P as n,M as o,j as p,F as r,b as s,w as t,g as u,v,d as w,h as x,_ as y};
1
+ import"./rolldown-runtime-COnpUsM8.js";import{c as e,s as t}from"./vendor-charts-95ykyDlI.js";import{at as n,nt as r,tt as i}from"./vendor-ui-CWUk2ulb.js";import{n as a,t as o}from"./utils-XFKvwlFT.js";var s=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,c=t,l=(e,t)=>n=>{if(t?.variants==null)return c(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=s(t)||s(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return c(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},u=a(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),d=a(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),f=n(),p=l(`group/button inline-flex shrink-0 items-center justify-center rounded-[var(--miravo-radius-stadium-sm)] border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:border-destructive/50 aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,outline:`border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground border-input bg-input/30 hover:bg-input/50`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground hover:bg-muted/50`,destructive:`bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 bg-destructive/20 hover:bg-destructive/30 focus-visible:ring-destructive/40`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,xs:`h-6 gap-1 rounded-[var(--miravo-radius-tight)] px-2 text-xs in-data-[slot=button-group]:rounded-[var(--miravo-radius-stadium-sm)] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-7 gap-1 rounded-[var(--miravo-radius-tight)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-[var(--miravo-radius-stadium-sm)] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3`,icon:`size-8`,"icon-xs":`relative size-6 rounded-[var(--miravo-radius-tight)] in-data-[slot=button-group]:rounded-[var(--miravo-radius-stadium-sm)] [&_svg:not([class*='size-'])]:size-3 before:absolute before:inset-[-10px] before:content-['']`,"icon-sm":`relative size-7 rounded-[var(--miravo-radius-tight)] in-data-[slot=button-group]:rounded-[var(--miravo-radius-stadium-sm)] before:absolute before:inset-[-10px] before:content-['']`,"icon-lg":`size-9`}},defaultVariants:{variant:`default`,size:`default`}});function m({className:e,variant:t=`default`,size:n=`default`,...i}){return(0,f.jsx)(r,{"data-slot":`button`,className:o(p({variant:t,size:n,className:e})),...i})}e();function h({className:e,type:t,...n}){return(0,f.jsx)(i,{type:t,"data-slot":`input`,className:o(`h-8 w-full min-w-0 rounded-[var(--miravo-radius-stadium-sm)] border border-input bg-input/30 px-2.5 py-1 text-xs transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-xs file:font-medium file:text-foreground placeholder:text-muted-foreground hover:bg-input/50 focus-visible:border-primary/35 focus-visible:ring-2 focus-visible:ring-primary/22 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...n})}function g(e){return e.split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function _(e,t){let n=t.trim().toLowerCase();return n?e.toLowerCase().includes(n)||g(e).toLowerCase().includes(n):!0}function v(e,t){let n=t.trim().toLowerCase();return n?e.toLowerCase().includes(n)||O(e).toLowerCase().includes(n)||k(e).toLowerCase().includes(n):!0}function y(e){return e.split(`_`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function b(e){let t=e.trim();return t&&(t.includes(`_`)?y(t):/^[A-Z][A-Z0-9_-]*$/.test(t)?t:t.charAt(0).toUpperCase()+t.slice(1).toLowerCase())}function x(e){return e.includes(`_`)?b(e):g(e)}var S={degC:`°C`,"m3/h":`m³/h`,"mm/s":`mm/s`,pu:`pu`,"%":`%`};function C(e){return e?S[e]??e:``}var w=`en-US`;function T(e){let t=Math.max(0,Math.trunc(e));return t<1e6?t.toLocaleString(w):new Intl.NumberFormat(w,{notation:`compact`,compactDisplay:`short`,maximumFractionDigits:1}).format(t)}function E(e){return Number.isInteger(e)?Math.abs(e)>=1e4?e.toLocaleString(w):String(e):Math.abs(e)>=100?e.toFixed(1):Math.abs(e)>=1?e.toFixed(2):e.toFixed(3)}function D(e){return e.toLocaleString(w)}function O(e){let t=e.match(/^(.+)-(\d{3,})$/);if(!t)return g(e);let[,n,r]=t;return n?`${g(n)} ${r}`:g(e)}function k(e){let t=e.match(/^(.+)-(\d{3,})$/);if(!t)return g(e);let[,n,r]=t;if(!n)return g(e);let i=n.split(`-`).filter(e=>e.length>0);if(i.length<3)return O(e);let[a,o,...s]=i;return!a||!o||s.length===0?O(e):`${`${a.charAt(0)}${o.charAt(0)}`.toUpperCase()} ${g(s.join(`-`))} ${r}`}function A(e){return e.join(`/`)}function j(e,t){return`${A(e)}/${t}`}function M(e){let t=Math.round((Number.isFinite(e)&&e>=0?e:0)*60),n=1440,r=Math.floor(t/n),i=t%n,a=Math.floor(i/60),o=i%60;if(r>=365){let e=Math.floor(r/365),t=r%365,n=[`${e}y`];return t>0&&n.push(`${t}d`),a>0&&n.push(`${a}h`),o>0&&n.push(`${o}m`),n.join(` `)}if(r>0){let e=[`${r}d`];return a>0&&e.push(`${a}h`),o>0&&e.push(`${o}m`),e.join(` `)}return a>0?o>0?`${a}h ${o}m`:`${a}h`:o>0?`${o}m`:`0h`}function N(e){return new Date(e).toLocaleString(w)}function P(e){let t=Math.floor((Date.now()-e)/1e3);if(t<60)return`just now`;let n=Math.floor(t/60);if(n<60)return`${n}m ago`;let r=Math.floor(n/60);if(r<24)return`${r}h ago`;let i=Math.floor(r/24);return i<30?`${i}d ago`:new Date(e).toLocaleDateString(w,{month:`short`,day:`numeric`})}var F=new Set([`faulted`,`critical`,`stopped`,`emergency`]),I=new Set([`degraded`,`uncertain`]);function L(e){return F.has(e)?`bad`:I.has(e)?`warn`:`neutral`}export{m as C,l as D,u as E,h as S,d as T,y as _,A as a,_ as b,b as c,g as d,T as f,x as g,P as h,j as i,O as l,M as m,F as n,N as o,E as p,I as r,k as s,w as t,D as u,C as v,p as w,L as x,v as y};
@@ -1 +1 @@
1
- import{C as e}from"./api-DGtW0Fh4.js";function t(e,t){return e instanceof Error&&e.message.trim().length>0?e.message:typeof e==`string`&&e.trim().length>0?e:t}function n(t){if(e.is(t)&&t.hint?.trim())return t.hint}export{t as n,n as t};
1
+ import{C as e}from"./api-2XqCNjt9.js";function t(e,t){return e instanceof Error&&e.message.trim().length>0?e.message:typeof e==`string`&&e.trim().length>0?e:t}function n(t){if(e.is(t)&&t.hint?.trim())return t.hint}export{t as n,n as t};