@miravo/cli-linux-x64 0.14.0 → 0.14.1

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 (51) hide show
  1. package/console-dist/assets/api-Bp-mG9Rs.js +1 -0
  2. package/console-dist/assets/{api-GfuYYI6q.js → api-CtMmjN9m.js} +1 -1
  3. package/console-dist/assets/{asset-detail-CbRJwcZg.js → asset-detail-JDx-26wg.js} +1 -1
  4. package/console-dist/assets/{asset-detail-actions-Ceb1_r18.js → asset-detail-actions-BrLTJCzY.js} +1 -1
  5. package/console-dist/assets/{backup-power-qtHJlSI4.js → backup-power-B1THpfxc.js} +1 -1
  6. package/console-dist/assets/{by-path-CKZo157c.js → by-path-CGbqDnvK.js} +1 -1
  7. package/console-dist/assets/catalog-B3KfEJkB.js +1 -0
  8. package/console-dist/assets/{catalog-Lt1tguKF.js → catalog-Whukru3I.js} +1 -1
  9. package/console-dist/assets/{catalog-template-icons-DvKspieo.js → catalog-template-icons-GGQGFjA8.js} +1 -1
  10. package/console-dist/assets/{commercial-building-Bk4sBQtx.js → commercial-building-BeGD1bPV.js} +1 -1
  11. package/console-dist/assets/{console-panel-DOt0r_Oz.js → console-panel-DXk4doxV.js} +1 -1
  12. package/console-dist/assets/control-BeyuTMD5.js +1 -0
  13. package/console-dist/assets/{control-89sOxkPx.js → control-HoYOjLyM.js} +1 -1
  14. package/console-dist/assets/{district-heating-BofEIyfg.js → district-heating-MuLRna9G.js} +1 -1
  15. package/console-dist/assets/events-C2Q9HRYG.js +1 -0
  16. package/console-dist/assets/{events-NZs3OoQw.js → events-Cb1faGh2.js} +1 -1
  17. package/console-dist/assets/{export-tab-R8Oac9J5.js → export-tab-CtH28h1G.js} +1 -1
  18. package/console-dist/assets/{factory-BYX8AmsW.js → factory-Boh-9Tjz.js} +1 -1
  19. package/console-dist/assets/factory-CpziAEBj.js +1 -0
  20. package/console-dist/assets/{floor-page-CiS52QbQ.js → floor-page-Bxq5t8Yi.js} +1 -1
  21. package/console-dist/assets/{get-error-message-DJGhcwLn.js → get-error-message-D800c4Uu.js} +1 -1
  22. package/console-dist/assets/{index-B8B-S-lq.js → index-CHgd8U-y.js} +3 -3
  23. package/console-dist/assets/{integration-api-B5s7_LWo.js → integration-api-DnCoHAoa.js} +1 -1
  24. package/console-dist/assets/integrations-DYDSuhVG.js +1 -0
  25. package/console-dist/assets/{integrations-Bg7xzjIj.js → integrations-DlVDmGqI.js} +1 -1
  26. package/console-dist/assets/{login-Dq1AJRqO.js → login-D6-swZqz.js} +1 -1
  27. package/console-dist/assets/models-C1sVJK7p.js +1 -0
  28. package/console-dist/assets/{models-BYr_QK_5.js → models-CDGbNOUr.js} +1 -1
  29. package/console-dist/assets/{pharma-cleanroom-oxgPn6h6.js → pharma-cleanroom-DnxAzkeg.js} +1 -1
  30. package/console-dist/assets/{protocol-card-1DCkgN_l.js → protocol-card-Bf06qKjE.js} +1 -1
  31. package/console-dist/assets/{registry-BqqyCPJz.js → registry-BKilgP4M.js} +2 -2
  32. package/console-dist/assets/{status-kit-Darp7bPB.js → status-kit-eQF95zN0.js} +1 -1
  33. package/console-dist/assets/tags-BPR9ZiaM.js +1 -0
  34. package/console-dist/assets/{tags-r7Fx_0yG.js → tags-DtfR_AgF.js} +1 -1
  35. package/console-dist/assets/{transition-nav-link-DIx78Lol.js → transition-nav-link-ZpTbW2Hm.js} +1 -1
  36. package/console-dist/assets/{use-engine-command-mutation-CTbPh58S.js → use-engine-command-mutation-5q_LI_xT.js} +1 -1
  37. package/console-dist/assets/{use-transition-navigate-aOjMH_eS.js → use-transition-navigate-5-QJHk2I.js} +2 -2
  38. package/console-dist/assets/{useQuery-BfWNkVkT.js → useQuery-Dxp3WSXF.js} +1 -1
  39. package/console-dist/assets/{validation-DSsZ8qyt.js → validation-BSQDilvJ.js} +1 -1
  40. package/console-dist/assets/{water-treatment-COXMW4qC.js → water-treatment-CAxvQSI-.js} +1 -1
  41. package/console-dist/index.html +23 -23
  42. package/miravo +1 -1
  43. package/package.json +1 -1
  44. package/console-dist/assets/api-DEoRnScz.js +0 -1
  45. package/console-dist/assets/catalog-CshTwzQu.js +0 -1
  46. package/console-dist/assets/control-BBMXQRSU.js +0 -1
  47. package/console-dist/assets/events-DFkG5maw.js +0 -1
  48. package/console-dist/assets/factory-Cp52pnAL.js +0 -1
  49. package/console-dist/assets/integrations-CG1fPcwM.js +0 -1
  50. package/console-dist/assets/models-jmRXhSoh.js +0 -1
  51. package/console-dist/assets/tags-DlnWXo4p.js +0 -1
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{ot as n}from"./vendor-ui-D8j69UH4.js";import{C as r,a as i,b as a,c as o,d as s,f as c,l,m as u,n as d,s as f}from"./dom-CQuChC3G.js";import{n as p,t as m}from"./by-path-CKZo157c.js";import{A as h,D as g,E as _,F as v,H as ee,L as te,N as ne,P as re,T as ie,V as ae,X as oe,a as se,b as ce,g as le,i as ue,j as de,k as fe,n as pe,o as me,r as he,s as ge,t as _e}from"./status-DNfdEhTs.js";import{r as ve,t as ye}from"./chiller-Jug0vRg-.js";import{n as be,o as xe,s as Se,t as Ce}from"./genset-DBpkUT9p.js";import{t as we}from"./stages-C0cErwSQ.js";import{a as Te,i as Ee,n as De,o as Oe,s as ke,t as Ae}from"./rtu-BR4DhLbE.js";import{a as je,i as Me,n as Ne,o as Pe,r as Fe,t as Ie}from"./boiler-BQwqgoVY.js";var Le=[[`rtu1`,`hvac-rtu`,`hvac`,`floor-1`,0],[`rtu2`,`hvac-rtu`,`hvac`,`floor-2`,0],[`rtu3`,`hvac-rtu`,`hvac`,`floor-3`,0],[`chiller`,`industrial-chiller`,`chilled-water`,`plant`,0],[`chwPump`,`centrifugal-pump`,`chilled-water`,`plant`,0],[`boiler`,`hot-water-boiler`,`heating`,`boiler-room`,0],[`hwPump`,`centrifugal-pump`,`heating`,`boiler-room`,0],[`fanA`,`ac-induction-motor`,`electrical`,`ahu-fans`,0],[`fanB`,`ac-induction-motor`,`electrical`,`ahu-fans`,1],[`genset`,`diesel-generator`,`electrical`,`emergency-power`,0]],Re=e=>m(Le,e);function ze(e){let t=(e,t,n)=>({key:e,assetId:e,name:t,kind:`utility`,area:n});return[t(e.rtu1,`Rooftop unit · floor 1`,`HVAC`),t(e.rtu2,`Rooftop unit · floor 2`,`HVAC`),t(e.rtu3,`Rooftop unit · floor 3`,`HVAC`),t(e.chiller,`Chiller`,`Chilled water`),t(e.chwPump,`Chilled-water pump`,`Chilled water`),t(e.boiler,`Hot-water boiler`,`Heating`),t(e.hwPump,`Heating circulation pump`,`Heating`),t(e.fanA,`AHU supply fan 1`,`Electrical`),t(e.fanB,`AHU supply fan 2`,`Electrical`),t(e.genset,`Emergency generator`,`Electrical`)]}var y=e(t(),1),b={x:-332,y:-228,w:232,d:74,r:2},Be=29,x=1,Ve={x:-86,y:-192,w:44,d:36,r:1.5},S={x:-79,y:-184,w:30,d:20,r:1.5},C=26,He=-150;function Ue(e){let{k:t,P:n,L:r,slab:i,cyl:a}=e,o=[];for(let e=b.x+Be;e<b.x+b.w-1;e+=Be)o.push(t.segment([e,b.y,x],[e,b.y+b.d,x],n));for(let e=b.y+Be;e<b.y+b.d-1;e+=Be)o.push(t.segment([b.x,e,x],[b.x+b.w,e,x],n));let s=[i(b,0,x,{tone:`mid`,inner:r(o.join(``),{tone:`faint`})},3,.3)];for(let e of[-322,-124])s.push(i({x:e,y:-216,w:22,d:10,r:1},x,5,{tone:`mid`},2,.3),i({x:e+1.6,y:-214.4,w:18.8,d:6.8,r:.6},x+5,.6,{tone:`lo`},2,0));for(let e=-316;e<b.x+b.w-8;e+=46)s.push(a(e,b.y+b.d-4,1.3,x,7,{tone:`mid`},12));return s.join(``)}function We(e,t){let{k:n,P:r,L:i,slab:a}=e,o=Ve.x+Ve.w,s=[];for(let e=o+12;e<t-4;e+=12)s.push(n.segment([e,He-3,.6],[e,He+3,.6],r));return a({x:o,y:He-3.5,w:t-o,d:7,r:.4},0,.6,{tone:`mid`,inner:i(s.join(``),{tone:`faint`})},2,.1)}function Ge(e){let{k:t,P:n,L:r,slab:i,cyl:a}=e,{x:o,y:s,w:c,d:l}=S,u=1.5,d=[];for(let e=1;e<12;e++)d.push(t.segment([o+3+e*2,s+l+5,u+4],[o+3+e*2,s+l+5,C-4],n));let f=[i(Ve,0,u,{tone:`mid`},3,.3),i(S,u,C,{tone:`mid`},2,.5),i({x:o+3,y:s+l,w:c-6,d:5,r:.6},u+3,C-7,{tone:`mid`,inner:r(d.join(``),{tone:`faint`})},2,.2),i({x:o-.8,y:s-.8,w:c+1.6,d:l+1.6,r:1.5},u+C,1.4,{tone:`mid`},2,.2)];for(let e of[o+7,o+15,o+23])f.push(a(e,s+5,1.4,u+C+1.4,7,{tone:`mid`},12),a(e,s+5,2.2,u+C+1.4,1.4,{tone:`mid`},12));for(let e of[s+5,s+10,s+15])f.push(a(o+c-3,e,1,u+C+1.4,3,{tone:`lo`},10));return f.join(``)}function Ke(e,t,n=1.6){let{k:r,P:i,L:a,slab:o,screws:s}=e;return o(t,0,n,{tone:`mid`},3,.4)+a(r.planOutline(r.insetPlan(t,3),n,i,3),{tone:`faint`})+s(r.corners(t,4),n)}function w(e,t,n,r,{louvres:i=[],doors:a=[]}={}){let{k:o,P:s,L:c,slab:l}=e,u=[l(t,0,n,{tone:`mid`},2,.3),l({x:t.x-.6,y:t.y-.6,w:t.w+1.2,d:t.d+1.2,r:.3},n,1.4,{tone:`mid`},2,.2)],d=r===`south`?e.front(t.y+t.d):o.sideMatrix([t.x+t.w,t.y+t.d],0,s,`right`),f=[];for(let[e,t]of i){let[r,i]=[e,t];f.push(`<path class="cr-grille" d="M${r} ${-(n-9)}H${i}V-13H${r}Z"/>`);let a=[];for(let e=16;e<n-9;e+=3)a.push(`M${r+1} ${-e}H${i-1}`);f.push(c(a.join(``),{tone:`lo`}))}for(let[e,t]of a){let[r,i]=[e,t];f.push(`<path class="cr-door" d="M${r} -1H${i}V${-(n-16)}H${r}Z"/>`),f.push(c(`M${r-1.2} 0V${-(n-14.8)}H${i+1.2}V0M${r-1.2} -1H${i+1.2}`,{tone:`lo`})),f.push(`<circle class="sf-screw" cx="${i-2.4}" cy="${-(n/2-4)}" r="0.7"/>`)}return f.length&&u.push(`<g transform="${d}">${f.join(``)}</g>`),u.join(``)}function qe(e,t,n,r){let{k:i,P:a,L:o,slab:s,screws:c}=e,l=t.x+t.w,u=[w(e,t,n,`south`,{doors:[[t.x+8,t.x+22]],louvres:[[t.x+30,t.x+46]]})];u.push(s({x:t.x+t.w-18,y:t.y+8,w:10,d:8,r:.8},n+1.4,4,{tone:`mid`},2,.3));let d=i.sideMatrix([l,t.y+t.d],0,a,`right`),f=t.y+t.d-r.y;return u.push(`<g transform="${d}"><path class="sf-plate" d="M${f-7} ${-(r.z+7)}H${f+7}V${-(r.z-7)}H${f-7}Z"/>${o(`M${f-7} ${-(r.z+7)}H${f+7}V${-(r.z-7)}H${f-7}Z`,{tone:`lo`})}</g>`,c([[l+.05,r.y-5.6],[l+.05,r.y+5.6]],r.z+5.6),c([[l+.05,r.y-5.6],[l+.05,r.y+5.6]],r.z-5.6)),u.join(``)}function Je(e,[t,n],r,i,a,o){let{k:s,P:c,L:l,slab:u,cyl:d}=e,f=[],p=[];for(let e=i+48;e<a-12;e+=48)p.push(e);let m=p.map(e=>s.sideArc(t,n,r,e,c,24)).join(``);f.push(d(t,n,r,i,a-i,{tone:`mid`,inner:l(m,{tone:`faint`})},28));for(let e of p)f.push(d(t,n,r+1.2,e-.8,1.6,{tone:`mid`},28));for(let e of o)f.push(u({x:e.toX,y:n-.9,w:t-r-e.toX,d:1.8,r:.3},e.z-.9,1.8,{tone:`mid`},2,.1),u({x:e.toX-1.2,y:n-3.5,w:1.2,d:7,r:.3},e.z-3.5,7,{tone:`mid`},2,.1),d(t,n,r+.9,e.z-1.1,2.2,{tone:`mid`},28));for(let e of[0,2.1,4.2])f.push(d(t+Math.cos(e)*(r-1.4),n+Math.sin(e)*(r-1.4),.5,a,3,{tone:`lo`,crease:`none`},8));return f.push(d(t,n,r+2.2,a+3,1.2,{tone:`mid`},28)),f.join(``)}var T={x:-300,y:-268,w:290,d:32,r:.6},E=[4,64,124],D=3,Ye=6,O={x:-334,y:-268,w:34,d:32,r:.6},k=e=>(E[e+1]??184)-4,Xe={x:O.x-3,y:T.y-3,w:T.w+O.w+3+7,d:T.d+3+8,r:1.5},A={x:T.x+D,y:T.y+D,w:T.w-D,d:T.d-D,r:0},Ze=A.x+A.w,Qe=A.y+A.d,$e=[-247,-185,-123,-61,-13],et=2.2,j=2.6,M=E[0],N=-247,tt=-255,nt=11,rt=e=>k(e)-nt,it=[-246,-162,-78],at=-251,ot=.8,st=[46*ot,20*ot],ct=e=>[(it[e]??0)-9,(it[e]??0)+9],lt=e=>{let[t,n]=ct(e);return{x:t-5,y:tt-4.5,w:n-t+10,d:9,r:.3}},ut=e=>it.map((e,t)=>t).filter(t=>t<e),dt=4,P=1.6,ft=.6;function pt(e){let{k:t,P:n,L:r,slab:i}=e;return i(Xe,0,M,{tone:`mid`,inner:r(t.planOutline({x:T.x-.5,y:T.y-.5,w:T.w+1,d:T.d+1,r:0},M,n,2),{tone:`faint`})},4,.5)}function mt(e){let{k:t,P:n,L:r,S:i}=e,a=184+Ye-M,o=(e,r,i)=>t.segment([r[0],r[1],E[e]??0],[i[0],i[1],E[e]??0],n),s={x:T.x,y:T.y,w:T.w,d:D,r:.3},c={x:T.x,y:T.y+D,w:D,d:T.d-D,r:.3};return[i(t.slabOf(s,M,a,n,2,.3),{tone:`mid`,inner:r([1,2].map(e=>o(e,[s.x,s.y+s.d],[s.x+s.w,s.y+s.d])).join(``),{tone:`faint`})}),i(t.slabOf(c,M,a,n,2,.3),{tone:`mid`}),ht(e)].join(``)}function ht(e){let{k:t,P:n,L:r,S:i,front:a}=e,o=O.y+O.d,s=O.x+O.w/2,c=[],l=[];for(let[e,t]of E.entries()){for(let e of[s-8,s+.4])c.push(`<path class="cr-door" d="M${e} ${-(t+1)}h7.6v-23h-7.6Z"/>`);l.push(`M${s-9} ${-t}V${-(t+25)}H${s+9}V${-t}`),c.push(`<path class="cr-grille" d="M${s-2.4} ${-(t+28)}h4.8v-2.4h-4.8Z"/>`),e<E.length-1&&l.push(`M${O.x} ${-(k(e)+4)}H${O.x+O.w}`)}return i(t.slabOf(O,M,184-M,n,2,.4),{tone:`mid`})+`<g transform="${a(o)}">${c.join(``)}${r(l.join(``),{tone:`lo`})}</g>`}var gt=Array.from({length:6},(e,t)=>[-284+t*36,-284+t*36+32]),_t=21,vt=8;function yt(e,t){let{k:n,P:r,L:i,front:a}=e,o=(E[t]??0)+_t,s=k(t)-vt,c=(e,n)=>`<path class="bd-win bt-pane" data-occ="${t}" d="M${e} ${-s}H${n}V${-o}H${e}Z"/>`,l=(e,t)=>`M${e-1} ${-(o-1.6)}H${t+1}M${(e+t)/2} ${-s}V${-o}`,u=gt.map(([e,t])=>c(e,t)).join(``),d=gt.map(([e,t])=>l(e,t)).join(``),f=n.sideMatrix([T.x+D,T.y+T.d],0,r,`right`);return`<g transform="${a(T.y+D)}">${u}${i(d,{tone:`lo`})}</g><g transform="${f}">${c(4,20)}${i(l(4,20),{tone:`lo`})}</g>`}function bt(e,t){let{k:n,P:r,L:i,slab:a}=e,o=(E[t]??0)-4,s=[a(A,o,4,{tone:`mid`,inner:i(n.segment([A.x,A.y+A.d,o+1.4],[A.x+A.w,A.y+A.d,o+1.4],r),{tone:`faint`})},2,.4)],c=E[t]??0;for(let e of ut(t)){let t=lt(e);s.push(a({...t,d:P},c,dt,{tone:`mid`},2,.2),a({...t,w:P},c,dt,{tone:`mid`},2,.2))}return s.join(``)}function xt(e,t,n,r){let{cyl:i}=e,a=lt(t),o=(E[n]??0)+dt,s=r===`back`?a.y+ft+.4:a.y+a.d-ft-.4;return[a.x+.8,a.x+a.w-.8].map(e=>i(e,s,ft,o,k(n)-o,{tone:`mid`,crease:`none`},8))}function St(e,t){return ut(t).flatMap(n=>xt(e,n,t,`back`)).join(``)}function Ct(e,t){let{cyl:n,slab:r}=e,i=E[t]??0,a=k(t)-i,o=Qe-j,s=$e.map(e=>n(e,o,et,i,a,{tone:`mid`},14));s.push(n(Ze-j,-251,et,i,a,{tone:`mid`},14));for(let n of ut(t)){let a=lt(n);s.push(r({...a,y:a.y+a.d-P,d:P},i,dt,{tone:`mid`},2,.2),r({...a,x:a.x+a.w-P,w:P},i,dt,{tone:`mid`},2,.2),...xt(e,n,t,`front`))}return s.join(``)}function wt(e){let{k:t,P:n,L:r,S:i,slab:a}=e,o=[.25,.5,.75].map(e=>t.segment([A.x+A.w*e,A.y,184],[A.x+A.w*e,A.y+A.d,184],n)).join(``),s=A.y+A.d,c=A.x+A.w;return[i(t.slabOf(A,180,4,n,2,.4),{tone:`mid`,inner:r(o,{tone:`faint`})}),a({x:A.x,y:s-j,w:A.w,d:j,r:.3},184,Ye-1,{tone:`mid`},2,.3),a({x:c-j,y:A.y,w:j,d:A.d-j,r:.3},184,Ye-1,{tone:`mid`},2,.3),...it.map(e=>a({x:e-st[0]-1.5,y:at-st[1]-1.5,w:st[0]*2+3,d:st[1]*2+3,r:.6},184,3,{tone:`mid`},2,.2)),a({x:O.x+4,y:O.y+8,w:O.w-8,d:O.d-16,r:.6},184,14,{tone:`mid`},2,.3)].join(``)}var Tt={w:16,d:10,h:4},Et=18,Dt=1.8,Ot=[[-190,-100],[-120,-65],[-120,-204]],F={x:-24,y:N,w:16,d:14,h:12,top:32},kt={w:10,d:8,h:4},At=-262,I=-264.4,jt=5.5,Mt=1.5,Nt=1.1,Pt=[-282,-246,-210,-174,-138,-102],Ft=8.5,It=-292,Lt=(e,t)=>[e,N,k(t)-Et+Dt],Rt=[F.x,F.y,F.top+Dt],zt=e=>[ct(e)[1],tt,k(e)-Et+Dt];function Bt(e,t,n,r,i,a,o,s,c){let{k:l,P:u,L:d,D:f,slab:p,cyl:m,at:h}=e,g=o-a,_=[[t-r/2+1.5,n-i/2+1.5],[t+r/2-1.5,n-i/2+1.5],[t-r/2+1.5,n+i/2-1.5],[t+r/2-1.5,n+i/2-1.5]].map(([e=0,t=0])=>m(e,t,.5,o,s-o,{tone:`lo`,crease:`none`},8)),v=[.3,.55,.8].map(e=>l.segment([t-r/2+1.5,n+i/2,g+a*e],[t+r/2-1.5,n+i/2,g+a*e],u)).join(``),ee=[];for(let e=0;e<6;e++)ee.push([t-r/2+2+e*(r-4)/5,n+i/2,g+1.2]);return[..._,p({x:t-r/2,y:n-i/2,w:r,d:i,r:.8},g,a,{tone:`mid`,inner:d(v,{tone:`faint`})},2,.3),m(t,n,Math.min(5.2,i/2-1.2),o,Dt,{tone:`mid`},24),f(ee.map(e=>h(e)),{size:.3}),c?`<g data-diffuser="${t},${n},${g},${r/2}"></g>`:``].join(``)}var Vt=(e,t,n)=>Bt(e,t,N,Tt.w,Tt.d,Tt.h,k(n)-Et,k(n),!0),Ht=e=>Bt(e,F.x,F.y,F.w,F.d,F.h,F.top,k(0),!0),Ut=(e,t)=>Bt(e,ct(t)[1],tt,kt.w,kt.d,kt.h,k(t)-Et,k(t),!1);function Wt(e,t,n){let{k:r,P:i,L:a,slab:o}=e,s=n+11,c=s+Ft,l=-265,u=Array.from({length:7},(e,n)=>r.segment([t+3.5+n*3.5,l+3.6,s+1],[t+3.5+n*3.5,l+3.6,c-1],i)).join(``);return[...[t+5,t+28-5].map(e=>o({x:e-1,y:-265,w:2,d:.9,r:.2},s+2,4,{tone:`lo`},2,0)),o({x:t,y:l,w:28,d:3.6,r:.5},s,Ft,{tone:`mid`,inner:a(u,{tone:`faint`})},2,.3)].join(``)}function Gt(e,t,n){let{G:r,P:i,S:a}=e,o=r.frameAlong([It,t,n],[-1,0,0]);return a(r.disc(0,1.4,Nt+.7,o,i),{tone:`mid`})}function Kt(e,t,n,r,i){let{slab:a,cyl:o,front:s}=e,c=r+8,l=[a({x:t+.8,y:n+.6,w:1.2,d:6.8,r:.2},r,8,{tone:`lo`},2,0),a({x:t+22-2,y:n+.6,w:1.2,d:6.8,r:.2},r,8,{tone:`lo`},2,0),a({x:t,y:n,w:22,d:8,r:.6},c,1.4,{tone:`mid`},2,.3),o(t+22/2,n+8*.4,1.1,c+1.4,2.4,{tone:`lo`,crease:`none`},10),a({x:t+22/2-4.2,y:n+8*.4-.5,w:8.4,d:1,r:.3},c+3.8,5.4,{tone:`lo`},2,0)],u=n+8*.4+.5;return l.push(`<g transform="${s(u)}"><path class="bd-win" data-occ="${i}" d="M${t+22/2-3.6} ${-(c+4.2)}h7.2v-4.4h-7.2Z"/></g>`),l.join(``)}function qt(e,t,n,r){let{slab:i,cyl:a}=e;return[a(t,n,3,r,.8,{tone:`lo`},14),a(t,n,.6,r+.8,3.6,{tone:`lo`,crease:`none`},8),a(t,n,3.2,r+4.4,1.4,{tone:`mid`},16),i({x:t-3,y:n+2.6,w:6,d:.9,r:.3},r+5.6,5.4,{tone:`mid`},2,.2)].join(``)}function Jt(e,t,n,r){let{slab:i}=e;return[Kt(e,t,-249,n,r),Kt(e,t+25,-249,n,r),i({x:t+22.6,y:-249.5,w:1,d:7,r:.2},n+1.2,12,{tone:`mid`},2,.2),qt(e,t+11,-239.6,n),qt(e,t+36,-239.6,n)].join(``)}function Yt(e,t){let{slab:n,cyl:r}=e,i=[],a=-250;i.push(n({x:a,y:-251,w:46,d:8,r:1},t,10,{tone:`mid`},3,.4),n({x:a+36,y:-243,w:10,d:7,r:1},t,10,{tone:`mid`},3,.4),n({x:a-.8,y:-251.8,w:47.6,d:9.6,r:1},t+10,1.4,{tone:`mid`},3,.2),n({x:a+35.2,y:-243.8,w:11.6,d:8.6,r:1},t+10,1.4,{tone:`mid`},3,.2));for(let e of[-170,-144])i.push(n({x:e,y:-250,w:20,d:6,r:.8},t+3.2,3,{tone:`mid`},2,.3),n({x:e,y:-252,w:20,d:2,r:.4},t+6.2,6,{tone:`mid`},2,.2),r(e+2.4,-245.4,.9,t,3.2,{tone:`lo`,crease:`none`},8),r(e+17.6,-245.4,.9,t,3.2,{tone:`lo`,crease:`none`},8));return i.join(``)}function Xt(e,t){let n=E[t]??0,r=Pt.map(t=>Wt(e,t,n));r.push(Gt(e,At,n+jt),Gt(e,I,n+Mt));let i=Ot[t]??[];r.push(St(e,t));for(let n of i)r.push(Vt(e,n,t));if(r.push(Ut(e,t)),t===0)r.push(Yt(e,n));else for(let a of i)r.push(Jt(e,a-23.5,n,t));return r.join(``)}var Zt=1e3,Qt={x:-352,y:-286,w:652,d:170,r:8},$t={x:-14,y:-516,w:314,d:220,r:8},en={x:-374,y:-538,w:690,d:444,r:16},tn=[34,-242],nn=a([...u(en,-21,-14),...u(Qt,-14,20),...u($t,-14,20),...u(Xe,0,214),...u({x:26,y:-250,w:16,d:16,r:0},0,244)],Zt,620,{pad:22,azimuth:60}),rn=-325,an=[70,205],on=Te(100,!0),sn=[-202,-135,0],cn=[-34,36.6,40],ln=[-20,36.6,40],un=[94,-130,0],L=[.55,.5],dn=-385,fn=-462,pn=(e,t)=>[(e[0]-un[0])*t,(e[1]-un[1])*t,e[2]*t],mn=e=>{let t=an[e],n=Oe(100,7),r=e=>[t+e[0],rn+e[1],e[2]];return{supply:r(n.chwSupply),ret:r(n.chwReturn),discharge:r(n.discharge)}},hn=[mn(0),mn(1)],R=[hn[0].supply[0]-ln[0],fn],z=[tn[0]-Me[0],tn[1]],gn=[z[0]+je[0],z[1]+je[1],je[2]],_n=[z[0]+Fe[0],z[1]+Fe[1],Fe[2]],vn=(e,t,n)=>[e-pn(h,L[n])[0],t],yn=[vn(R[0]+cn[0],dn,0),vn(_n[0],-204,1)],bn=(e,t)=>{let[n,r]=yn[e]??[0,0],[i,a,o]=pn(t,L[e]);return[n+i,r+a,o]},xn=[{suction:bn(0,re),riser:bn(0,h)},{suction:bn(1,re),riser:bn(1,h)}],Sn=[190,-150],B={x:24,y:-160,w:56,d:44,r:1},Cn={x:108,y:-192,w:164,d:72,r:2},wn={x:108,y:-194,w:164,d:3,r:.3},Tn={x:108,y:-194,w:3,d:76,r:.3},En=[-49,0,60.8],Dn={x:0,y:-272,w:252,d:76,r:2},On={x:2,y:-270,w:250,d:3,r:.3},kn={x:-10,y:-512,w:306,d:4,r:.3},An={x:-12,y:-512,w:4,d:214,r:.3},jn=we([...yn.map((e,t)=>({key:`pump${t}`,at:e,h:45*L[t]})),{key:`chiller`,at:R,h:56},{key:`boiler`,at:z,h:je[2]-8},{key:`flue`,at:tn,h:236},...an.map((e,t)=>({key:`ahu${t}`,at:[e,rn],h:36})),{key:`xfmr`,at:[S.x+S.w/2,S.y+S.d/2],h:36},{key:`genset`,at:Sn,h:126},{key:`elec`,at:[B.x+B.w/2,B.y+B.d/2],h:46},{key:`gen-back`,at:[wn.x+wn.w/2,wn.y],h:36},{key:`gen-west`,at:[Tn.x,Tn.y+Tn.d/2],h:36}],nn),Mn=jn.order,Nn=E.length,Pn=([e,t])=>e<14&&t>-269&&t<-232,Fn=([e,t])=>e<-8&&t<-269,In=([e,t])=>e<-8&&t<-256.5,Ln=e=>E.filter((t,n)=>n>0&&e>=t).length,Rn={layer:e=>Fn(e)?0:Pn(e)&&e[2]>=184?Nn+1:Pn(e)&&In(e)?zn+Ln(e[2]):Pn(e)?1+Ln(e[2]):Nn+1+jn.depth.layer(e),glide:()=>!0},zn=Nn+1+Mn.length+1,Bn={y:Sn[1],z:26};function Vn(e,t){return[e,...[...E].filter(n=>n>0&&n<e&&n>t).sort((e,t)=>t-e),t]}var Hn=3.2,Un=2.2,Wn=180;function Gn(e,t,n,r){let i=Vn(Wn,n);return i.slice(0,-1).map((n,a)=>{let o=[[t,tt,n],[t,tt,i[a+1]??0]];return a===i.length-2&&o.push(...r),{id:`${e}${a}`,medium:`duct`,r:Hn,bend:2,bare:[a===0,!1],pts:o}})}var Kn=[0,1,2].flatMap(e=>{let t=rt(e),[n,r]=ct(e),i=[...Ot[e]??[]].sort((e,t)=>Math.abs(e-n)-Math.abs(t-n)),a=i[i.length-1]??n,o=i.slice(0,-1).map((n,r)=>({id:`sup${e}-n${r}`,medium:`duct`,r:Un,pts:[[n,N,t],Lt(n,e)]}));return[...Gn(`sup${e}-`,n,t,[[n,N,t],[a,N,t],Lt(a,e)]),...o,...Gn(`ret${e}-`,r,zt(e)[2],[])]}),[V,H]=hn,U=-279,qn=Rt[0],W=40,Jn=[{id:`ahu-a`,medium:`duct`,r:3.5,pts:[V.discharge,[V.discharge[0],U,V.discharge[2]],[V.discharge[0],U,W]]},{id:`ahu-b`,medium:`duct`,r:3.5,pts:[H.discharge,[H.discharge[0],U,H.discharge[2]],[H.discharge[0],U,W],[qn,U,W],[qn,-266.5,W]]},{id:`ahu-in`,medium:`duct`,r:3.5,pts:[[qn,-265,W],[qn,Rt[1],W],Rt]}],G=[R[0]+ln[0],R[1]+ln[1],ln[2]],Yn=[R[0]+cn[0],R[1]+cn[1],cn[2]],[K,q]=xn,Xn=46,Zn=-360,Qn=K.suction[2],$n=K.suction[1],er=V.supply[1],tr=e=>[[e,er,Xn],[e,$n,Xn],[e,$n,Qn]],nr=[{id:`chw-dis`,medium:`coolantret`,r:ne*L[0],fromStub:!0,pts:[K.riser,[K.riser[0],K.riser[1],Yn[2]],Yn]},{id:`chw-sup`,medium:`coolant`,r:2.6,pts:[G,[G[0],er,G[2]],V.supply]},{id:`chw-sup-b`,medium:`coolant`,r:2.6,pts:[[G[0],Zn,G[2]],[H.supply[0],Zn,G[2]],[H.supply[0],er,G[2]],H.supply]},{id:`chw-ret-b`,medium:`coolantret`,r:2.6,pts:[H.ret,...tr(H.ret[0]),K.suction]},{id:`chw-ret`,medium:`coolantret`,r:2.6,pts:[V.ret,...tr(V.ret[0])]}],J=-6,Y=At,rr=-258,ir=-18,ar=-180,or=q.suction[0]+40,sr=70,cr=_n[2]+20,lr=(e,t,n,r,i,a)=>Vn(a,i).slice(0,-1).map((o,s,c)=>{let l=s===c.length-1?i:Vn(a,i)[s+1]??i;return{id:`${e}${s}`,medium:n,r,blind:[s===c.length-1,s===0],pts:[[J,t,l],[J,t,o]]}}),ur=E.flatMap((e,t)=>{let n=e+jt,r=e+Mt;return[{id:`hw-s${t}`,medium:`heat`,r:Nt,blind:[!1,!0],pts:[[J,Y,n],[It,Y,n]]},{id:`hw-r${t}`,medium:`hotret`,r:Nt,blind:[!0,!1],pts:[[It,I,r],[ir,I,r],[ir,rr,r],[J,rr,r]]},...Pt.flatMap((i,a)=>[{id:`hw-st${t}-${a}`,medium:`heat`,r:1,bare:[!1,!0],pts:[[i+28-3,Y,n],[i+28-3,Y,e+11]]},{id:`hw-rt${t}-${a}`,medium:`hotret`,r:1,bare:[!0,!1],pts:[[i+3,I,e+11],[i+3,I,r]]}])]}),dr=[...lr(`hw-sr`,Y,`heat`,2.2,5,E[2]+jt+6),...lr(`hw-rr`,rr,`hotret`,2.2,3,E[2]+Mt+6),{id:`hw-feed-s`,medium:`heat`,r:2.2,pts:[gn,[gn[0],gn[1],sr],[gn[0],Y,sr],[J,Y,sr]]},{id:`hw-feed-r`,medium:`hotret`,r:2.2,pts:[[J,rr,q.suction[2]],[J,ar,q.suction[2]],[or,ar,q.suction[2]],[or,q.suction[1],q.suction[2]],q.suction]},{id:`hw-dis`,medium:`hotret`,r:ne*L[1],fromStub:!0,pts:[q.riser,[q.riser[0],q.riser[1],cr],[_n[0],_n[1],cr],_n]}],X=[Sn[0]+En[0],Sn[1]+En[1],En[2]],fr=B.x+B.w,pr=[{id:`gen-cable`,medium:`cable`,r:1.6,pts:[X,[X[0],X[1],72],[fr+12,X[1],72],[fr+12,X[1],Bn.z],[fr,X[1],Bn.z]]}],mr=[...ur,...Kn,...nr,...Jn,...dr,...pr],Z=(e,t,n,r,i=0)=>[e,t,n,r,i],hr={z:10,flanged:!0,routes:mr,posts:[Z(180,U,3.5,W),Z(60,U,3.5,W),Z(20,U,3.5,W),Z(40,Y,2.2,sr,4),Z(G[0],-416,2.6,G[2]),Z(Yn[0],-405,2.6,G[2]),...[110,150,190].flatMap(e=>[Z(e,Zn,2.6,G[2]),Z(e,$n,2.6,Qn)]),Z(X[0]-20,X[1],1.6,72,1.6)]},Q=n(),gr={x:-248,y:-164,w:92,d:58,r:3},_r=0,vr=(e,t)=>Ee(e,t,`downshot`),yr=(e,t)=>Pe(e,t,7,236-_r),br=(e,t)=>v(e,t,`coolantret`,!0),xr=(e,t)=>v(e,t,`hotret`,!0),Sr=(e,t)=>ke(e,t,100,{humidifier:!1,filterGauge:!1,fanHook:`data-vfan`,stubHalf:7,motor:!0}),Cr=[E[1]-4/2,E[2]-4/2,184-4/2];function wr(e){return te(e,en)+e.plinth(Qt)+e.plinth($t)+Ue(e)+We(e,B.x)+Ke(e,Dn)+Ke(e,Cn)+w(e,On,34,`south`,{louvres:[[30,50],[100,120],[170,190]]})+w(e,kn,64,`south`,{louvres:[[60,90],[130,160],[200,230],[260,290]]})+w(e,An,64,`east`,{doors:[[60,80]]})}var Tr=e=>Je(e,tn,6,112,236,Cr.map(e=>({z:e,toX:Ze}))),Er=e=>qe(e,B,40,Bn),Dr=e=>w(e,wn,36,`south`,{louvres:[[128,158],[200,230]]}),Or=e=>w(e,Tn,36,`east`,{louvres:[[20,50]],doors:[[56,74]]});function kr({ids:e}){let t=c(),n=_(hr,Rn),r=(0,y.useMemo)(()=>wr(t),[t]),i=(0,y.useMemo)(()=>pt(t)+mt(t),[t]),a=e=>(0,Q.jsx)(s,{html:`${n.layers[e]??``}<g data-flows="${e}" data-depth="${e}"></g>`,data:{pipes:``}},`pipes-${e}`),o=[e.rtu1,e.rtu2,e.rtu3],u=[];for(let[n,r]of o.entries())u.push(n>0?(0,Q.jsx)(s,{html:bt(t,n)},`slab${n}`):null,(0,Q.jsx)(s,{html:yt(t,n)},`win${n}`),a(zn+n),(0,Q.jsx)(s,{asset:r,intro:2+n,html:Xt(t,n)},`in${n}`),n===0?(0,Q.jsx)(s,{asset:e.fanA,intro:5,html:Ht(t)},`ahu-box`):null,a(1+n),(0,Q.jsx)(s,{html:Ct(t,n)},`col${n}`));let d={chiller:(0,Q.jsx)(g,{from:sn,to:fe(R),children:(0,Q.jsx)(l,{id:e.chiller,plan:gr,intro:12,draw:ve})}),boiler:(0,Q.jsx)(g,{to:fe(z),children:(0,Q.jsx)(l,{id:e.boiler,plan:Ne,intro:13,draw:yr})}),flue:(0,Q.jsx)(s,{html:(0,y.useMemo)(()=>Tr(t),[t]),intro:13}),xfmr:(0,Q.jsx)(s,{html:(0,y.useMemo)(()=>Ge(t),[t]),intro:16}),elec:(0,Q.jsx)(s,{html:(0,y.useMemo)(()=>Er(t),[t]),intro:16}),"gen-back":(0,Q.jsx)(s,{html:(0,y.useMemo)(()=>Dr(t),[t]),intro:15}),"gen-west":(0,Q.jsx)(s,{html:(0,y.useMemo)(()=>Or(t),[t]),intro:15}),genset:(0,Q.jsx)(`g`,{className:`gen-set`,children:(0,Q.jsx)(g,{to:fe(Sn),children:(0,Q.jsx)(l,{id:e.genset,plan:xe,intro:16,draw:Se})})})};for(let[t,[n,r]]of yn.entries())d[`pump${t}`]=(0,Q.jsx)(g,{from:un,to:fe([n,r]),scale:L[t],children:(0,Q.jsx)(l,{id:t?e.hwPump:e.chwPump,plan:de,intro:14+t,draw:t?xr:br})});for(let[t,n]of an.entries())d[`ahu${t}`]=(0,Q.jsx)(g,{to:fe([n,rn]),children:(0,Q.jsx)(l,{id:t?e.fanB:e.fanA,plan:on,intro:10+t,draw:Sr})});return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(s,{html:r,data:{plinth:``}}),a(0),(0,Q.jsx)(s,{html:i}),u,(0,Q.jsx)(s,{html:wt(t)}),it.map((e,t)=>(0,Q.jsx)(g,{to:[e,at,187],scale:ot,children:(0,Q.jsx)(l,{id:o[t]??``,plan:De,intro:6+t,draw:vr})},e)),a(4),Mn.flatMap((e,t)=>[(0,Q.jsx)(`g`,{children:d[e.key]},e.key),a(5+t)])]})}var Ar=10,jr=17,Mr=.55;function Nr(e,t,n){let{svg:a,P:s,feed:c}=e,l=d(a,`[data-occ]`).map(e=>({el:e,id:t[Number(e.dataset.occ)]??ge(e)})),u=d(a,`[data-diffuser]`).map(e=>({id:ge(e),at:f(e.dataset.diffuser),streaks:ie(e,Ar,`path`,`cr-stream`),phase:0}));return{draw(t,a,d){for(let e of l)o(e.el,`data-on`,c.num(e.id,`occupied`)>0?``:null);let f=e.reducedMotion();for(let e of u){let a=le(n(e.id));e.phase=(e.phase+a*Mr*t)%1;let[c=0,l=0,u=0,p=0]=e.at;for(let[t,n]of e.streaks.entries()){if(!d||f||a<.02||n.seed>.25+a){i(n.el,`0`);continue}let m=(e.phase+n.seed*3.1)%1,h=((t+.5)/Ar-.5)*2*(p-1.5),g=(n.seed-.5)*8,_=u-.5-m*jr,v=[c+h,l+g,_],ee=[c+h,l+g,_-3],[te,ne]=r(v,s),[re,ie]=r(ee,s);o(n.el,`d`,`M${te.toFixed(1)} ${ne.toFixed(1)}L${re.toFixed(1)} ${ie.toFixed(1)}`),i(n.el,(Math.sin(Math.PI*m)*.5).toFixed(2))}}},bar(){}}}var $=e=>e>.002?6+26*le(e*2):0,Pr=e=>{let{svg:t,feed:n,ids:r}=e,i=ce(t),a=Ae(e,i),o=ye(e,i),s=he(e,i),c=Ie(e,i),l=be(e,i),u=Ce(e,i),d=e=>le(n.num(e,`speed_feedback`)/n.param(e,`rated_rpm`,1450)),f=e=>e===r.fanA?(d(r.fanA)+d(r.fanB))/2:a.airPu(e),p=[a,o,s,c,l,u,Nr(e,[r.rtu1,r.rtu2,r.rtu3],f)],m=ue(e,e=>pe(n,e,`availability`)),h=me(e,{needle:e=>o.needle(e)??c.needle(e)??0,bar:e=>p.reduce((t,n)=>t??n.bar(e),void 0)??0,alertsHigh:()=>!0,ready:()=>!0}),g=[r.rtu1,r.rtu2,r.rtu3],_=()=>s.flowPu(r.chwPump),v=()=>s.flowPu(r.hwPump),ee=()=>{let e=n.param(r.genset,`rated_power_kva`,500)*.8;return e>0?le(n.num(r.genset,`load_actual`)/e):0},te=se(e,({id:e})=>{let t=/^(?:sup|ret)(\d)-/.exec(e);if(t)return $(a.airPu(g[Number(t[1])]??``));if(e.startsWith(`hw-s`)||e.startsWith(`hw-r`))return $(/^hw-[sr]\d$/.test(e)?v()/3:v());switch(e){case`ahu-a`:return $(d(r.fanA));case`ahu-b`:return $(d(r.fanB));case`ahu-in`:return $(f(r.fanA));case`chw-dis`:case`chw-sup`:case`chw-ret`:return $(_());case`chw-sup-b`:case`chw-ret-b`:return $(_()/2);case`hw-feed-s`:case`hw-feed-r`:case`hw-dis`:return $(v());case`gen-cable`:return $(ee());default:return 0}});return{data(e){m.draw(e)},draw({sdt:e,t,introDone:n}){te.draw(e),h.draw(e,t);for(let r of p)r.draw(e,t,n)},resync(){},status:e=>_e(n,e,`availability`)}},Fr=ae(nn),Ir=ee(Fr,hr,Rn),Lr=oe({layout:{width:Zt,height:620,label:`Isometric model of the Commercial Building: a three-storey office tower with a rooftop unit on each roof curb whose supply and return ducts drop through a chase to that storey's ceiling diffusers, and a loop of radiators along the back wall; behind it the mechanical room with the chiller, the chilled-water pump and two air handlers with their fan motors; beside it the boiler with its flue stack and heating pump, the transformer, and the standby diesel generator with its feeder to the electrical room. Pipes and ducts carry chilled water, hot water and air between them. Every moving part follows live values from the running engine.`,kit:Fr,flows:Ir.flows,joints:Ir.joints,Scene:kr,compose:Pr},resolve:Re,things:ze,caption:`rooftop units · plant · standby power`,mismatch:`This floor expects the Commercial Building: three rooftop units, the chiller with its chilled-water pump, the hot-water boiler with its heating pump, two air handler fan motors and the standby diesel generator, by area and line.`,statusBasis:`availability`,Overview:p,tab:`Building`});export{Lr as buildingFloor};
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{ot as n}from"./vendor-ui-D8j69UH4.js";import{C as r,a as i,b as a,c as o,d as s,f as c,l,m as u,n as d,s as f}from"./dom-CQuChC3G.js";import{n as p,t as m}from"./by-path-CGbqDnvK.js";import{A as h,D as g,E as _,F as v,H as ee,L as te,N as ne,P as re,T as ie,V as ae,X as oe,a as se,b as ce,g as le,i as ue,j as de,k as fe,n as pe,o as me,r as he,s as ge,t as _e}from"./status-DNfdEhTs.js";import{r as ve,t as ye}from"./chiller-Jug0vRg-.js";import{n as be,o as xe,s as Se,t as Ce}from"./genset-DBpkUT9p.js";import{t as we}from"./stages-C0cErwSQ.js";import{a as Te,i as Ee,n as De,o as Oe,s as ke,t as Ae}from"./rtu-BR4DhLbE.js";import{a as je,i as Me,n as Ne,o as Pe,r as Fe,t as Ie}from"./boiler-BQwqgoVY.js";var Le=[[`rtu1`,`hvac-rtu`,`hvac`,`floor-1`,0],[`rtu2`,`hvac-rtu`,`hvac`,`floor-2`,0],[`rtu3`,`hvac-rtu`,`hvac`,`floor-3`,0],[`chiller`,`industrial-chiller`,`chilled-water`,`plant`,0],[`chwPump`,`centrifugal-pump`,`chilled-water`,`plant`,0],[`boiler`,`hot-water-boiler`,`heating`,`boiler-room`,0],[`hwPump`,`centrifugal-pump`,`heating`,`boiler-room`,0],[`fanA`,`ac-induction-motor`,`electrical`,`ahu-fans`,0],[`fanB`,`ac-induction-motor`,`electrical`,`ahu-fans`,1],[`genset`,`diesel-generator`,`electrical`,`emergency-power`,0]],Re=e=>m(Le,e);function ze(e){let t=(e,t,n)=>({key:e,assetId:e,name:t,kind:`utility`,area:n});return[t(e.rtu1,`Rooftop unit · floor 1`,`HVAC`),t(e.rtu2,`Rooftop unit · floor 2`,`HVAC`),t(e.rtu3,`Rooftop unit · floor 3`,`HVAC`),t(e.chiller,`Chiller`,`Chilled water`),t(e.chwPump,`Chilled-water pump`,`Chilled water`),t(e.boiler,`Hot-water boiler`,`Heating`),t(e.hwPump,`Heating circulation pump`,`Heating`),t(e.fanA,`AHU supply fan 1`,`Electrical`),t(e.fanB,`AHU supply fan 2`,`Electrical`),t(e.genset,`Emergency generator`,`Electrical`)]}var y=e(t(),1),b={x:-332,y:-228,w:232,d:74,r:2},Be=29,x=1,Ve={x:-86,y:-192,w:44,d:36,r:1.5},S={x:-79,y:-184,w:30,d:20,r:1.5},C=26,He=-150;function Ue(e){let{k:t,P:n,L:r,slab:i,cyl:a}=e,o=[];for(let e=b.x+Be;e<b.x+b.w-1;e+=Be)o.push(t.segment([e,b.y,x],[e,b.y+b.d,x],n));for(let e=b.y+Be;e<b.y+b.d-1;e+=Be)o.push(t.segment([b.x,e,x],[b.x+b.w,e,x],n));let s=[i(b,0,x,{tone:`mid`,inner:r(o.join(``),{tone:`faint`})},3,.3)];for(let e of[-322,-124])s.push(i({x:e,y:-216,w:22,d:10,r:1},x,5,{tone:`mid`},2,.3),i({x:e+1.6,y:-214.4,w:18.8,d:6.8,r:.6},x+5,.6,{tone:`lo`},2,0));for(let e=-316;e<b.x+b.w-8;e+=46)s.push(a(e,b.y+b.d-4,1.3,x,7,{tone:`mid`},12));return s.join(``)}function We(e,t){let{k:n,P:r,L:i,slab:a}=e,o=Ve.x+Ve.w,s=[];for(let e=o+12;e<t-4;e+=12)s.push(n.segment([e,He-3,.6],[e,He+3,.6],r));return a({x:o,y:He-3.5,w:t-o,d:7,r:.4},0,.6,{tone:`mid`,inner:i(s.join(``),{tone:`faint`})},2,.1)}function Ge(e){let{k:t,P:n,L:r,slab:i,cyl:a}=e,{x:o,y:s,w:c,d:l}=S,u=1.5,d=[];for(let e=1;e<12;e++)d.push(t.segment([o+3+e*2,s+l+5,u+4],[o+3+e*2,s+l+5,C-4],n));let f=[i(Ve,0,u,{tone:`mid`},3,.3),i(S,u,C,{tone:`mid`},2,.5),i({x:o+3,y:s+l,w:c-6,d:5,r:.6},u+3,C-7,{tone:`mid`,inner:r(d.join(``),{tone:`faint`})},2,.2),i({x:o-.8,y:s-.8,w:c+1.6,d:l+1.6,r:1.5},u+C,1.4,{tone:`mid`},2,.2)];for(let e of[o+7,o+15,o+23])f.push(a(e,s+5,1.4,u+C+1.4,7,{tone:`mid`},12),a(e,s+5,2.2,u+C+1.4,1.4,{tone:`mid`},12));for(let e of[s+5,s+10,s+15])f.push(a(o+c-3,e,1,u+C+1.4,3,{tone:`lo`},10));return f.join(``)}function Ke(e,t,n=1.6){let{k:r,P:i,L:a,slab:o,screws:s}=e;return o(t,0,n,{tone:`mid`},3,.4)+a(r.planOutline(r.insetPlan(t,3),n,i,3),{tone:`faint`})+s(r.corners(t,4),n)}function w(e,t,n,r,{louvres:i=[],doors:a=[]}={}){let{k:o,P:s,L:c,slab:l}=e,u=[l(t,0,n,{tone:`mid`},2,.3),l({x:t.x-.6,y:t.y-.6,w:t.w+1.2,d:t.d+1.2,r:.3},n,1.4,{tone:`mid`},2,.2)],d=r===`south`?e.front(t.y+t.d):o.sideMatrix([t.x+t.w,t.y+t.d],0,s,`right`),f=[];for(let[e,t]of i){let[r,i]=[e,t];f.push(`<path class="cr-grille" d="M${r} ${-(n-9)}H${i}V-13H${r}Z"/>`);let a=[];for(let e=16;e<n-9;e+=3)a.push(`M${r+1} ${-e}H${i-1}`);f.push(c(a.join(``),{tone:`lo`}))}for(let[e,t]of a){let[r,i]=[e,t];f.push(`<path class="cr-door" d="M${r} -1H${i}V${-(n-16)}H${r}Z"/>`),f.push(c(`M${r-1.2} 0V${-(n-14.8)}H${i+1.2}V0M${r-1.2} -1H${i+1.2}`,{tone:`lo`})),f.push(`<circle class="sf-screw" cx="${i-2.4}" cy="${-(n/2-4)}" r="0.7"/>`)}return f.length&&u.push(`<g transform="${d}">${f.join(``)}</g>`),u.join(``)}function qe(e,t,n,r){let{k:i,P:a,L:o,slab:s,screws:c}=e,l=t.x+t.w,u=[w(e,t,n,`south`,{doors:[[t.x+8,t.x+22]],louvres:[[t.x+30,t.x+46]]})];u.push(s({x:t.x+t.w-18,y:t.y+8,w:10,d:8,r:.8},n+1.4,4,{tone:`mid`},2,.3));let d=i.sideMatrix([l,t.y+t.d],0,a,`right`),f=t.y+t.d-r.y;return u.push(`<g transform="${d}"><path class="sf-plate" d="M${f-7} ${-(r.z+7)}H${f+7}V${-(r.z-7)}H${f-7}Z"/>${o(`M${f-7} ${-(r.z+7)}H${f+7}V${-(r.z-7)}H${f-7}Z`,{tone:`lo`})}</g>`,c([[l+.05,r.y-5.6],[l+.05,r.y+5.6]],r.z+5.6),c([[l+.05,r.y-5.6],[l+.05,r.y+5.6]],r.z-5.6)),u.join(``)}function Je(e,[t,n],r,i,a,o){let{k:s,P:c,L:l,slab:u,cyl:d}=e,f=[],p=[];for(let e=i+48;e<a-12;e+=48)p.push(e);let m=p.map(e=>s.sideArc(t,n,r,e,c,24)).join(``);f.push(d(t,n,r,i,a-i,{tone:`mid`,inner:l(m,{tone:`faint`})},28));for(let e of p)f.push(d(t,n,r+1.2,e-.8,1.6,{tone:`mid`},28));for(let e of o)f.push(u({x:e.toX,y:n-.9,w:t-r-e.toX,d:1.8,r:.3},e.z-.9,1.8,{tone:`mid`},2,.1),u({x:e.toX-1.2,y:n-3.5,w:1.2,d:7,r:.3},e.z-3.5,7,{tone:`mid`},2,.1),d(t,n,r+.9,e.z-1.1,2.2,{tone:`mid`},28));for(let e of[0,2.1,4.2])f.push(d(t+Math.cos(e)*(r-1.4),n+Math.sin(e)*(r-1.4),.5,a,3,{tone:`lo`,crease:`none`},8));return f.push(d(t,n,r+2.2,a+3,1.2,{tone:`mid`},28)),f.join(``)}var T={x:-300,y:-268,w:290,d:32,r:.6},E=[4,64,124],D=3,Ye=6,O={x:-334,y:-268,w:34,d:32,r:.6},k=e=>(E[e+1]??184)-4,Xe={x:O.x-3,y:T.y-3,w:T.w+O.w+3+7,d:T.d+3+8,r:1.5},A={x:T.x+D,y:T.y+D,w:T.w-D,d:T.d-D,r:0},Ze=A.x+A.w,Qe=A.y+A.d,$e=[-247,-185,-123,-61,-13],et=2.2,j=2.6,M=E[0],N=-247,tt=-255,nt=11,rt=e=>k(e)-nt,it=[-246,-162,-78],at=-251,ot=.8,st=[46*ot,20*ot],ct=e=>[(it[e]??0)-9,(it[e]??0)+9],lt=e=>{let[t,n]=ct(e);return{x:t-5,y:tt-4.5,w:n-t+10,d:9,r:.3}},ut=e=>it.map((e,t)=>t).filter(t=>t<e),dt=4,P=1.6,ft=.6;function pt(e){let{k:t,P:n,L:r,slab:i}=e;return i(Xe,0,M,{tone:`mid`,inner:r(t.planOutline({x:T.x-.5,y:T.y-.5,w:T.w+1,d:T.d+1,r:0},M,n,2),{tone:`faint`})},4,.5)}function mt(e){let{k:t,P:n,L:r,S:i}=e,a=184+Ye-M,o=(e,r,i)=>t.segment([r[0],r[1],E[e]??0],[i[0],i[1],E[e]??0],n),s={x:T.x,y:T.y,w:T.w,d:D,r:.3},c={x:T.x,y:T.y+D,w:D,d:T.d-D,r:.3};return[i(t.slabOf(s,M,a,n,2,.3),{tone:`mid`,inner:r([1,2].map(e=>o(e,[s.x,s.y+s.d],[s.x+s.w,s.y+s.d])).join(``),{tone:`faint`})}),i(t.slabOf(c,M,a,n,2,.3),{tone:`mid`}),ht(e)].join(``)}function ht(e){let{k:t,P:n,L:r,S:i,front:a}=e,o=O.y+O.d,s=O.x+O.w/2,c=[],l=[];for(let[e,t]of E.entries()){for(let e of[s-8,s+.4])c.push(`<path class="cr-door" d="M${e} ${-(t+1)}h7.6v-23h-7.6Z"/>`);l.push(`M${s-9} ${-t}V${-(t+25)}H${s+9}V${-t}`),c.push(`<path class="cr-grille" d="M${s-2.4} ${-(t+28)}h4.8v-2.4h-4.8Z"/>`),e<E.length-1&&l.push(`M${O.x} ${-(k(e)+4)}H${O.x+O.w}`)}return i(t.slabOf(O,M,184-M,n,2,.4),{tone:`mid`})+`<g transform="${a(o)}">${c.join(``)}${r(l.join(``),{tone:`lo`})}</g>`}var gt=Array.from({length:6},(e,t)=>[-284+t*36,-284+t*36+32]),_t=21,vt=8;function yt(e,t){let{k:n,P:r,L:i,front:a}=e,o=(E[t]??0)+_t,s=k(t)-vt,c=(e,n)=>`<path class="bd-win bt-pane" data-occ="${t}" d="M${e} ${-s}H${n}V${-o}H${e}Z"/>`,l=(e,t)=>`M${e-1} ${-(o-1.6)}H${t+1}M${(e+t)/2} ${-s}V${-o}`,u=gt.map(([e,t])=>c(e,t)).join(``),d=gt.map(([e,t])=>l(e,t)).join(``),f=n.sideMatrix([T.x+D,T.y+T.d],0,r,`right`);return`<g transform="${a(T.y+D)}">${u}${i(d,{tone:`lo`})}</g><g transform="${f}">${c(4,20)}${i(l(4,20),{tone:`lo`})}</g>`}function bt(e,t){let{k:n,P:r,L:i,slab:a}=e,o=(E[t]??0)-4,s=[a(A,o,4,{tone:`mid`,inner:i(n.segment([A.x,A.y+A.d,o+1.4],[A.x+A.w,A.y+A.d,o+1.4],r),{tone:`faint`})},2,.4)],c=E[t]??0;for(let e of ut(t)){let t=lt(e);s.push(a({...t,d:P},c,dt,{tone:`mid`},2,.2),a({...t,w:P},c,dt,{tone:`mid`},2,.2))}return s.join(``)}function xt(e,t,n,r){let{cyl:i}=e,a=lt(t),o=(E[n]??0)+dt,s=r===`back`?a.y+ft+.4:a.y+a.d-ft-.4;return[a.x+.8,a.x+a.w-.8].map(e=>i(e,s,ft,o,k(n)-o,{tone:`mid`,crease:`none`},8))}function St(e,t){return ut(t).flatMap(n=>xt(e,n,t,`back`)).join(``)}function Ct(e,t){let{cyl:n,slab:r}=e,i=E[t]??0,a=k(t)-i,o=Qe-j,s=$e.map(e=>n(e,o,et,i,a,{tone:`mid`},14));s.push(n(Ze-j,-251,et,i,a,{tone:`mid`},14));for(let n of ut(t)){let a=lt(n);s.push(r({...a,y:a.y+a.d-P,d:P},i,dt,{tone:`mid`},2,.2),r({...a,x:a.x+a.w-P,w:P},i,dt,{tone:`mid`},2,.2),...xt(e,n,t,`front`))}return s.join(``)}function wt(e){let{k:t,P:n,L:r,S:i,slab:a}=e,o=[.25,.5,.75].map(e=>t.segment([A.x+A.w*e,A.y,184],[A.x+A.w*e,A.y+A.d,184],n)).join(``),s=A.y+A.d,c=A.x+A.w;return[i(t.slabOf(A,180,4,n,2,.4),{tone:`mid`,inner:r(o,{tone:`faint`})}),a({x:A.x,y:s-j,w:A.w,d:j,r:.3},184,Ye-1,{tone:`mid`},2,.3),a({x:c-j,y:A.y,w:j,d:A.d-j,r:.3},184,Ye-1,{tone:`mid`},2,.3),...it.map(e=>a({x:e-st[0]-1.5,y:at-st[1]-1.5,w:st[0]*2+3,d:st[1]*2+3,r:.6},184,3,{tone:`mid`},2,.2)),a({x:O.x+4,y:O.y+8,w:O.w-8,d:O.d-16,r:.6},184,14,{tone:`mid`},2,.3)].join(``)}var Tt={w:16,d:10,h:4},Et=18,Dt=1.8,Ot=[[-190,-100],[-120,-65],[-120,-204]],F={x:-24,y:N,w:16,d:14,h:12,top:32},kt={w:10,d:8,h:4},At=-262,I=-264.4,jt=5.5,Mt=1.5,Nt=1.1,Pt=[-282,-246,-210,-174,-138,-102],Ft=8.5,It=-292,Lt=(e,t)=>[e,N,k(t)-Et+Dt],Rt=[F.x,F.y,F.top+Dt],zt=e=>[ct(e)[1],tt,k(e)-Et+Dt];function Bt(e,t,n,r,i,a,o,s,c){let{k:l,P:u,L:d,D:f,slab:p,cyl:m,at:h}=e,g=o-a,_=[[t-r/2+1.5,n-i/2+1.5],[t+r/2-1.5,n-i/2+1.5],[t-r/2+1.5,n+i/2-1.5],[t+r/2-1.5,n+i/2-1.5]].map(([e=0,t=0])=>m(e,t,.5,o,s-o,{tone:`lo`,crease:`none`},8)),v=[.3,.55,.8].map(e=>l.segment([t-r/2+1.5,n+i/2,g+a*e],[t+r/2-1.5,n+i/2,g+a*e],u)).join(``),ee=[];for(let e=0;e<6;e++)ee.push([t-r/2+2+e*(r-4)/5,n+i/2,g+1.2]);return[..._,p({x:t-r/2,y:n-i/2,w:r,d:i,r:.8},g,a,{tone:`mid`,inner:d(v,{tone:`faint`})},2,.3),m(t,n,Math.min(5.2,i/2-1.2),o,Dt,{tone:`mid`},24),f(ee.map(e=>h(e)),{size:.3}),c?`<g data-diffuser="${t},${n},${g},${r/2}"></g>`:``].join(``)}var Vt=(e,t,n)=>Bt(e,t,N,Tt.w,Tt.d,Tt.h,k(n)-Et,k(n),!0),Ht=e=>Bt(e,F.x,F.y,F.w,F.d,F.h,F.top,k(0),!0),Ut=(e,t)=>Bt(e,ct(t)[1],tt,kt.w,kt.d,kt.h,k(t)-Et,k(t),!1);function Wt(e,t,n){let{k:r,P:i,L:a,slab:o}=e,s=n+11,c=s+Ft,l=-265,u=Array.from({length:7},(e,n)=>r.segment([t+3.5+n*3.5,l+3.6,s+1],[t+3.5+n*3.5,l+3.6,c-1],i)).join(``);return[...[t+5,t+28-5].map(e=>o({x:e-1,y:-265,w:2,d:.9,r:.2},s+2,4,{tone:`lo`},2,0)),o({x:t,y:l,w:28,d:3.6,r:.5},s,Ft,{tone:`mid`,inner:a(u,{tone:`faint`})},2,.3)].join(``)}function Gt(e,t,n){let{G:r,P:i,S:a}=e,o=r.frameAlong([It,t,n],[-1,0,0]);return a(r.disc(0,1.4,Nt+.7,o,i),{tone:`mid`})}function Kt(e,t,n,r,i){let{slab:a,cyl:o,front:s}=e,c=r+8,l=[a({x:t+.8,y:n+.6,w:1.2,d:6.8,r:.2},r,8,{tone:`lo`},2,0),a({x:t+22-2,y:n+.6,w:1.2,d:6.8,r:.2},r,8,{tone:`lo`},2,0),a({x:t,y:n,w:22,d:8,r:.6},c,1.4,{tone:`mid`},2,.3),o(t+22/2,n+8*.4,1.1,c+1.4,2.4,{tone:`lo`,crease:`none`},10),a({x:t+22/2-4.2,y:n+8*.4-.5,w:8.4,d:1,r:.3},c+3.8,5.4,{tone:`lo`},2,0)],u=n+8*.4+.5;return l.push(`<g transform="${s(u)}"><path class="bd-win" data-occ="${i}" d="M${t+22/2-3.6} ${-(c+4.2)}h7.2v-4.4h-7.2Z"/></g>`),l.join(``)}function qt(e,t,n,r){let{slab:i,cyl:a}=e;return[a(t,n,3,r,.8,{tone:`lo`},14),a(t,n,.6,r+.8,3.6,{tone:`lo`,crease:`none`},8),a(t,n,3.2,r+4.4,1.4,{tone:`mid`},16),i({x:t-3,y:n+2.6,w:6,d:.9,r:.3},r+5.6,5.4,{tone:`mid`},2,.2)].join(``)}function Jt(e,t,n,r){let{slab:i}=e;return[Kt(e,t,-249,n,r),Kt(e,t+25,-249,n,r),i({x:t+22.6,y:-249.5,w:1,d:7,r:.2},n+1.2,12,{tone:`mid`},2,.2),qt(e,t+11,-239.6,n),qt(e,t+36,-239.6,n)].join(``)}function Yt(e,t){let{slab:n,cyl:r}=e,i=[],a=-250;i.push(n({x:a,y:-251,w:46,d:8,r:1},t,10,{tone:`mid`},3,.4),n({x:a+36,y:-243,w:10,d:7,r:1},t,10,{tone:`mid`},3,.4),n({x:a-.8,y:-251.8,w:47.6,d:9.6,r:1},t+10,1.4,{tone:`mid`},3,.2),n({x:a+35.2,y:-243.8,w:11.6,d:8.6,r:1},t+10,1.4,{tone:`mid`},3,.2));for(let e of[-170,-144])i.push(n({x:e,y:-250,w:20,d:6,r:.8},t+3.2,3,{tone:`mid`},2,.3),n({x:e,y:-252,w:20,d:2,r:.4},t+6.2,6,{tone:`mid`},2,.2),r(e+2.4,-245.4,.9,t,3.2,{tone:`lo`,crease:`none`},8),r(e+17.6,-245.4,.9,t,3.2,{tone:`lo`,crease:`none`},8));return i.join(``)}function Xt(e,t){let n=E[t]??0,r=Pt.map(t=>Wt(e,t,n));r.push(Gt(e,At,n+jt),Gt(e,I,n+Mt));let i=Ot[t]??[];r.push(St(e,t));for(let n of i)r.push(Vt(e,n,t));if(r.push(Ut(e,t)),t===0)r.push(Yt(e,n));else for(let a of i)r.push(Jt(e,a-23.5,n,t));return r.join(``)}var Zt=1e3,Qt={x:-352,y:-286,w:652,d:170,r:8},$t={x:-14,y:-516,w:314,d:220,r:8},en={x:-374,y:-538,w:690,d:444,r:16},tn=[34,-242],nn=a([...u(en,-21,-14),...u(Qt,-14,20),...u($t,-14,20),...u(Xe,0,214),...u({x:26,y:-250,w:16,d:16,r:0},0,244)],Zt,620,{pad:22,azimuth:60}),rn=-325,an=[70,205],on=Te(100,!0),sn=[-202,-135,0],cn=[-34,36.6,40],ln=[-20,36.6,40],un=[94,-130,0],L=[.55,.5],dn=-385,fn=-462,pn=(e,t)=>[(e[0]-un[0])*t,(e[1]-un[1])*t,e[2]*t],mn=e=>{let t=an[e],n=Oe(100,7),r=e=>[t+e[0],rn+e[1],e[2]];return{supply:r(n.chwSupply),ret:r(n.chwReturn),discharge:r(n.discharge)}},hn=[mn(0),mn(1)],R=[hn[0].supply[0]-ln[0],fn],z=[tn[0]-Me[0],tn[1]],gn=[z[0]+je[0],z[1]+je[1],je[2]],_n=[z[0]+Fe[0],z[1]+Fe[1],Fe[2]],vn=(e,t,n)=>[e-pn(h,L[n])[0],t],yn=[vn(R[0]+cn[0],dn,0),vn(_n[0],-204,1)],bn=(e,t)=>{let[n,r]=yn[e]??[0,0],[i,a,o]=pn(t,L[e]);return[n+i,r+a,o]},xn=[{suction:bn(0,re),riser:bn(0,h)},{suction:bn(1,re),riser:bn(1,h)}],Sn=[190,-150],B={x:24,y:-160,w:56,d:44,r:1},Cn={x:108,y:-192,w:164,d:72,r:2},wn={x:108,y:-194,w:164,d:3,r:.3},Tn={x:108,y:-194,w:3,d:76,r:.3},En=[-49,0,60.8],Dn={x:0,y:-272,w:252,d:76,r:2},On={x:2,y:-270,w:250,d:3,r:.3},kn={x:-10,y:-512,w:306,d:4,r:.3},An={x:-12,y:-512,w:4,d:214,r:.3},jn=we([...yn.map((e,t)=>({key:`pump${t}`,at:e,h:45*L[t]})),{key:`chiller`,at:R,h:56},{key:`boiler`,at:z,h:je[2]-8},{key:`flue`,at:tn,h:236},...an.map((e,t)=>({key:`ahu${t}`,at:[e,rn],h:36})),{key:`xfmr`,at:[S.x+S.w/2,S.y+S.d/2],h:36},{key:`genset`,at:Sn,h:126},{key:`elec`,at:[B.x+B.w/2,B.y+B.d/2],h:46},{key:`gen-back`,at:[wn.x+wn.w/2,wn.y],h:36},{key:`gen-west`,at:[Tn.x,Tn.y+Tn.d/2],h:36}],nn),Mn=jn.order,Nn=E.length,Pn=([e,t])=>e<14&&t>-269&&t<-232,Fn=([e,t])=>e<-8&&t<-269,In=([e,t])=>e<-8&&t<-256.5,Ln=e=>E.filter((t,n)=>n>0&&e>=t).length,Rn={layer:e=>Fn(e)?0:Pn(e)&&e[2]>=184?Nn+1:Pn(e)&&In(e)?zn+Ln(e[2]):Pn(e)?1+Ln(e[2]):Nn+1+jn.depth.layer(e),glide:()=>!0},zn=Nn+1+Mn.length+1,Bn={y:Sn[1],z:26};function Vn(e,t){return[e,...[...E].filter(n=>n>0&&n<e&&n>t).sort((e,t)=>t-e),t]}var Hn=3.2,Un=2.2,Wn=180;function Gn(e,t,n,r){let i=Vn(Wn,n);return i.slice(0,-1).map((n,a)=>{let o=[[t,tt,n],[t,tt,i[a+1]??0]];return a===i.length-2&&o.push(...r),{id:`${e}${a}`,medium:`duct`,r:Hn,bend:2,bare:[a===0,!1],pts:o}})}var Kn=[0,1,2].flatMap(e=>{let t=rt(e),[n,r]=ct(e),i=[...Ot[e]??[]].sort((e,t)=>Math.abs(e-n)-Math.abs(t-n)),a=i[i.length-1]??n,o=i.slice(0,-1).map((n,r)=>({id:`sup${e}-n${r}`,medium:`duct`,r:Un,pts:[[n,N,t],Lt(n,e)]}));return[...Gn(`sup${e}-`,n,t,[[n,N,t],[a,N,t],Lt(a,e)]),...o,...Gn(`ret${e}-`,r,zt(e)[2],[])]}),[V,H]=hn,U=-279,qn=Rt[0],W=40,Jn=[{id:`ahu-a`,medium:`duct`,r:3.5,pts:[V.discharge,[V.discharge[0],U,V.discharge[2]],[V.discharge[0],U,W]]},{id:`ahu-b`,medium:`duct`,r:3.5,pts:[H.discharge,[H.discharge[0],U,H.discharge[2]],[H.discharge[0],U,W],[qn,U,W],[qn,-266.5,W]]},{id:`ahu-in`,medium:`duct`,r:3.5,pts:[[qn,-265,W],[qn,Rt[1],W],Rt]}],G=[R[0]+ln[0],R[1]+ln[1],ln[2]],Yn=[R[0]+cn[0],R[1]+cn[1],cn[2]],[K,q]=xn,Xn=46,Zn=-360,Qn=K.suction[2],$n=K.suction[1],er=V.supply[1],tr=e=>[[e,er,Xn],[e,$n,Xn],[e,$n,Qn]],nr=[{id:`chw-dis`,medium:`coolantret`,r:ne*L[0],fromStub:!0,pts:[K.riser,[K.riser[0],K.riser[1],Yn[2]],Yn]},{id:`chw-sup`,medium:`coolant`,r:2.6,pts:[G,[G[0],er,G[2]],V.supply]},{id:`chw-sup-b`,medium:`coolant`,r:2.6,pts:[[G[0],Zn,G[2]],[H.supply[0],Zn,G[2]],[H.supply[0],er,G[2]],H.supply]},{id:`chw-ret-b`,medium:`coolantret`,r:2.6,pts:[H.ret,...tr(H.ret[0]),K.suction]},{id:`chw-ret`,medium:`coolantret`,r:2.6,pts:[V.ret,...tr(V.ret[0])]}],J=-6,Y=At,rr=-258,ir=-18,ar=-180,or=q.suction[0]+40,sr=70,cr=_n[2]+20,lr=(e,t,n,r,i,a)=>Vn(a,i).slice(0,-1).map((o,s,c)=>{let l=s===c.length-1?i:Vn(a,i)[s+1]??i;return{id:`${e}${s}`,medium:n,r,blind:[s===c.length-1,s===0],pts:[[J,t,l],[J,t,o]]}}),ur=E.flatMap((e,t)=>{let n=e+jt,r=e+Mt;return[{id:`hw-s${t}`,medium:`heat`,r:Nt,blind:[!1,!0],pts:[[J,Y,n],[It,Y,n]]},{id:`hw-r${t}`,medium:`hotret`,r:Nt,blind:[!0,!1],pts:[[It,I,r],[ir,I,r],[ir,rr,r],[J,rr,r]]},...Pt.flatMap((i,a)=>[{id:`hw-st${t}-${a}`,medium:`heat`,r:1,bare:[!1,!0],pts:[[i+28-3,Y,n],[i+28-3,Y,e+11]]},{id:`hw-rt${t}-${a}`,medium:`hotret`,r:1,bare:[!0,!1],pts:[[i+3,I,e+11],[i+3,I,r]]}])]}),dr=[...lr(`hw-sr`,Y,`heat`,2.2,5,E[2]+jt+6),...lr(`hw-rr`,rr,`hotret`,2.2,3,E[2]+Mt+6),{id:`hw-feed-s`,medium:`heat`,r:2.2,pts:[gn,[gn[0],gn[1],sr],[gn[0],Y,sr],[J,Y,sr]]},{id:`hw-feed-r`,medium:`hotret`,r:2.2,pts:[[J,rr,q.suction[2]],[J,ar,q.suction[2]],[or,ar,q.suction[2]],[or,q.suction[1],q.suction[2]],q.suction]},{id:`hw-dis`,medium:`hotret`,r:ne*L[1],fromStub:!0,pts:[q.riser,[q.riser[0],q.riser[1],cr],[_n[0],_n[1],cr],_n]}],X=[Sn[0]+En[0],Sn[1]+En[1],En[2]],fr=B.x+B.w,pr=[{id:`gen-cable`,medium:`cable`,r:1.6,pts:[X,[X[0],X[1],72],[fr+12,X[1],72],[fr+12,X[1],Bn.z],[fr,X[1],Bn.z]]}],mr=[...ur,...Kn,...nr,...Jn,...dr,...pr],Z=(e,t,n,r,i=0)=>[e,t,n,r,i],hr={z:10,flanged:!0,routes:mr,posts:[Z(180,U,3.5,W),Z(60,U,3.5,W),Z(20,U,3.5,W),Z(40,Y,2.2,sr,4),Z(G[0],-416,2.6,G[2]),Z(Yn[0],-405,2.6,G[2]),...[110,150,190].flatMap(e=>[Z(e,Zn,2.6,G[2]),Z(e,$n,2.6,Qn)]),Z(X[0]-20,X[1],1.6,72,1.6)]},Q=n(),gr={x:-248,y:-164,w:92,d:58,r:3},_r=0,vr=(e,t)=>Ee(e,t,`downshot`),yr=(e,t)=>Pe(e,t,7,236-_r),br=(e,t)=>v(e,t,`coolantret`,!0),xr=(e,t)=>v(e,t,`hotret`,!0),Sr=(e,t)=>ke(e,t,100,{humidifier:!1,filterGauge:!1,fanHook:`data-vfan`,stubHalf:7,motor:!0}),Cr=[E[1]-4/2,E[2]-4/2,184-4/2];function wr(e){return te(e,en)+e.plinth(Qt)+e.plinth($t)+Ue(e)+We(e,B.x)+Ke(e,Dn)+Ke(e,Cn)+w(e,On,34,`south`,{louvres:[[30,50],[100,120],[170,190]]})+w(e,kn,64,`south`,{louvres:[[60,90],[130,160],[200,230],[260,290]]})+w(e,An,64,`east`,{doors:[[60,80]]})}var Tr=e=>Je(e,tn,6,112,236,Cr.map(e=>({z:e,toX:Ze}))),Er=e=>qe(e,B,40,Bn),Dr=e=>w(e,wn,36,`south`,{louvres:[[128,158],[200,230]]}),Or=e=>w(e,Tn,36,`east`,{louvres:[[20,50]],doors:[[56,74]]});function kr({ids:e}){let t=c(),n=_(hr,Rn),r=(0,y.useMemo)(()=>wr(t),[t]),i=(0,y.useMemo)(()=>pt(t)+mt(t),[t]),a=e=>(0,Q.jsx)(s,{html:`${n.layers[e]??``}<g data-flows="${e}" data-depth="${e}"></g>`,data:{pipes:``}},`pipes-${e}`),o=[e.rtu1,e.rtu2,e.rtu3],u=[];for(let[n,r]of o.entries())u.push(n>0?(0,Q.jsx)(s,{html:bt(t,n)},`slab${n}`):null,(0,Q.jsx)(s,{html:yt(t,n)},`win${n}`),a(zn+n),(0,Q.jsx)(s,{asset:r,intro:2+n,html:Xt(t,n)},`in${n}`),n===0?(0,Q.jsx)(s,{asset:e.fanA,intro:5,html:Ht(t)},`ahu-box`):null,a(1+n),(0,Q.jsx)(s,{html:Ct(t,n)},`col${n}`));let d={chiller:(0,Q.jsx)(g,{from:sn,to:fe(R),children:(0,Q.jsx)(l,{id:e.chiller,plan:gr,intro:12,draw:ve})}),boiler:(0,Q.jsx)(g,{to:fe(z),children:(0,Q.jsx)(l,{id:e.boiler,plan:Ne,intro:13,draw:yr})}),flue:(0,Q.jsx)(s,{html:(0,y.useMemo)(()=>Tr(t),[t]),intro:13}),xfmr:(0,Q.jsx)(s,{html:(0,y.useMemo)(()=>Ge(t),[t]),intro:16}),elec:(0,Q.jsx)(s,{html:(0,y.useMemo)(()=>Er(t),[t]),intro:16}),"gen-back":(0,Q.jsx)(s,{html:(0,y.useMemo)(()=>Dr(t),[t]),intro:15}),"gen-west":(0,Q.jsx)(s,{html:(0,y.useMemo)(()=>Or(t),[t]),intro:15}),genset:(0,Q.jsx)(`g`,{className:`gen-set`,children:(0,Q.jsx)(g,{to:fe(Sn),children:(0,Q.jsx)(l,{id:e.genset,plan:xe,intro:16,draw:Se})})})};for(let[t,[n,r]]of yn.entries())d[`pump${t}`]=(0,Q.jsx)(g,{from:un,to:fe([n,r]),scale:L[t],children:(0,Q.jsx)(l,{id:t?e.hwPump:e.chwPump,plan:de,intro:14+t,draw:t?xr:br})});for(let[t,n]of an.entries())d[`ahu${t}`]=(0,Q.jsx)(g,{to:fe([n,rn]),children:(0,Q.jsx)(l,{id:t?e.fanB:e.fanA,plan:on,intro:10+t,draw:Sr})});return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(s,{html:r,data:{plinth:``}}),a(0),(0,Q.jsx)(s,{html:i}),u,(0,Q.jsx)(s,{html:wt(t)}),it.map((e,t)=>(0,Q.jsx)(g,{to:[e,at,187],scale:ot,children:(0,Q.jsx)(l,{id:o[t]??``,plan:De,intro:6+t,draw:vr})},e)),a(4),Mn.flatMap((e,t)=>[(0,Q.jsx)(`g`,{children:d[e.key]},e.key),a(5+t)])]})}var Ar=10,jr=17,Mr=.55;function Nr(e,t,n){let{svg:a,P:s,feed:c}=e,l=d(a,`[data-occ]`).map(e=>({el:e,id:t[Number(e.dataset.occ)]??ge(e)})),u=d(a,`[data-diffuser]`).map(e=>({id:ge(e),at:f(e.dataset.diffuser),streaks:ie(e,Ar,`path`,`cr-stream`),phase:0}));return{draw(t,a,d){for(let e of l)o(e.el,`data-on`,c.num(e.id,`occupied`)>0?``:null);let f=e.reducedMotion();for(let e of u){let a=le(n(e.id));e.phase=(e.phase+a*Mr*t)%1;let[c=0,l=0,u=0,p=0]=e.at;for(let[t,n]of e.streaks.entries()){if(!d||f||a<.02||n.seed>.25+a){i(n.el,`0`);continue}let m=(e.phase+n.seed*3.1)%1,h=((t+.5)/Ar-.5)*2*(p-1.5),g=(n.seed-.5)*8,_=u-.5-m*jr,v=[c+h,l+g,_],ee=[c+h,l+g,_-3],[te,ne]=r(v,s),[re,ie]=r(ee,s);o(n.el,`d`,`M${te.toFixed(1)} ${ne.toFixed(1)}L${re.toFixed(1)} ${ie.toFixed(1)}`),i(n.el,(Math.sin(Math.PI*m)*.5).toFixed(2))}}},bar(){}}}var $=e=>e>.002?6+26*le(e*2):0,Pr=e=>{let{svg:t,feed:n,ids:r}=e,i=ce(t),a=Ae(e,i),o=ye(e,i),s=he(e,i),c=Ie(e,i),l=be(e,i),u=Ce(e,i),d=e=>le(n.num(e,`speed_feedback`)/n.param(e,`rated_rpm`,1450)),f=e=>e===r.fanA?(d(r.fanA)+d(r.fanB))/2:a.airPu(e),p=[a,o,s,c,l,u,Nr(e,[r.rtu1,r.rtu2,r.rtu3],f)],m=ue(e,e=>pe(n,e,`availability`)),h=me(e,{needle:e=>o.needle(e)??c.needle(e)??0,bar:e=>p.reduce((t,n)=>t??n.bar(e),void 0)??0,alertsHigh:()=>!0,ready:()=>!0}),g=[r.rtu1,r.rtu2,r.rtu3],_=()=>s.flowPu(r.chwPump),v=()=>s.flowPu(r.hwPump),ee=()=>{let e=n.param(r.genset,`rated_power_kva`,500)*.8;return e>0?le(n.num(r.genset,`load_actual`)/e):0},te=se(e,({id:e})=>{let t=/^(?:sup|ret)(\d)-/.exec(e);if(t)return $(a.airPu(g[Number(t[1])]??``));if(e.startsWith(`hw-s`)||e.startsWith(`hw-r`))return $(/^hw-[sr]\d$/.test(e)?v()/3:v());switch(e){case`ahu-a`:return $(d(r.fanA));case`ahu-b`:return $(d(r.fanB));case`ahu-in`:return $(f(r.fanA));case`chw-dis`:case`chw-sup`:case`chw-ret`:return $(_());case`chw-sup-b`:case`chw-ret-b`:return $(_()/2);case`hw-feed-s`:case`hw-feed-r`:case`hw-dis`:return $(v());case`gen-cable`:return $(ee());default:return 0}});return{data(e){m.draw(e)},draw({sdt:e,t,introDone:n}){te.draw(e),h.draw(e,t);for(let r of p)r.draw(e,t,n)},resync(){},status:e=>_e(n,e,`availability`)}},Fr=ae(nn),Ir=ee(Fr,hr,Rn),Lr=oe({layout:{width:Zt,height:620,label:`Isometric model of the Commercial Building: a three-storey office tower with a rooftop unit on each roof curb whose supply and return ducts drop through a chase to that storey's ceiling diffusers, and a loop of radiators along the back wall; behind it the mechanical room with the chiller, the chilled-water pump and two air handlers with their fan motors; beside it the boiler with its flue stack and heating pump, the transformer, and the standby diesel generator with its feeder to the electrical room. Pipes and ducts carry chilled water, hot water and air between them. Every moving part follows live values from the running engine.`,kit:Fr,flows:Ir.flows,joints:Ir.joints,Scene:kr,compose:Pr},resolve:Re,things:ze,caption:`rooftop units · plant · standby power`,mismatch:`This floor expects the Commercial Building: three rooftop units, the chiller with its chilled-water pump, the hot-water boiler with its heating pump, two air handler fan motors and the standby diesel generator, by area and line.`,statusBasis:`availability`,Overview:p,tab:`Building`});export{Lr as buildingFloor};
@@ -1 +1 @@
1
- import{ot as e}from"./vendor-ui-D8j69UH4.js";import{t}from"./utils-XFKvwlFT.js";import{a as n}from"./use-engine-command-mutation-CTbPh58S.js";var r=e(),i=`inline-flex items-center gap-1 rounded-[var(--miravo-radius-tight)] outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring`,a={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)]`,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)]`,fault:`bg-destructive shadow-[0_0_0_1px_color-mix(in_srgb,var(--destructive)_50%,transparent),0_0_12px_color-mix(in_srgb,var(--destructive)_38%,transparent)]`,off:`bg-muted-foreground/55`};function o({tone:e,children:n,className:i}){return(0,r.jsxs)(`div`,{className:t(`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`,i),children:[(0,r.jsxs)(`span`,{className:`relative flex size-1.5 items-center justify-center`,children:[(0,r.jsx)(`span`,{className:t(`size-1.5 rounded-full`,a[e])}),e===`live`&&(0,r.jsx)(`span`,{className:`absolute inset-0 animate-ping rounded-full bg-success/60`})]}),(0,r.jsx)(`span`,{className:`text-[11px] leading-none text-muted-foreground`,children:n})]})}function s({children:e}){return(0,r.jsx)(`span`,{className:`text-[10px] uppercase tracking-[0.14em]`,children:e})}function c({icon:e,title:i,description:a,aside:o,footer:s,children:c,id:l,className:u,bodyClassName:d}){return(0,r.jsxs)(`section`,{id:l,tabIndex:l?-1:void 0,"aria-label":typeof i==`string`?i:void 0,className:t(n,`flex min-w-0 scroll-mt-4 flex-col outline-none hover:border-border`,u),children:[(0,r.jsxs)(`header`,{className:`flex items-start justify-between gap-3 border-b border-border/60 px-4 py-3`,children:[(0,r.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,r.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,r.jsx)(e,{className:`size-3.5`})}),(0,r.jsxs)(`div`,{className:`min-w-0`,children:[(0,r.jsx)(`h2`,{className:`font-heading text-sm font-semibold tracking-tight text-foreground`,children:i}),a?(0,r.jsx)(`p`,{className:`mt-0.5 text-pretty text-xs text-muted-foreground`,children:a}):null]})]}),o?(0,r.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:o}):null]}),c===void 0?null:(0,r.jsx)(`div`,{className:t(`flex min-w-0 flex-col px-4 py-4`,d),children:c}),s?(0,r.jsx)(`div`,{className:`mt-auto flex min-w-0 flex-wrap items-center gap-x-4 gap-y-2 border-t border-border/60 bg-background/40 px-4 py-2.5 text-xs text-muted-foreground`,children:s}):null]})}export{o as i,i as n,s as r,c as t};
1
+ import{ot as e}from"./vendor-ui-D8j69UH4.js";import{t}from"./utils-XFKvwlFT.js";import{a as n}from"./use-engine-command-mutation-5q_LI_xT.js";var r=e(),i=`inline-flex items-center gap-1 rounded-[var(--miravo-radius-tight)] outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring`,a={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)]`,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)]`,fault:`bg-destructive shadow-[0_0_0_1px_color-mix(in_srgb,var(--destructive)_50%,transparent),0_0_12px_color-mix(in_srgb,var(--destructive)_38%,transparent)]`,off:`bg-muted-foreground/55`};function o({tone:e,children:n,className:i}){return(0,r.jsxs)(`div`,{className:t(`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`,i),children:[(0,r.jsxs)(`span`,{className:`relative flex size-1.5 items-center justify-center`,children:[(0,r.jsx)(`span`,{className:t(`size-1.5 rounded-full`,a[e])}),e===`live`&&(0,r.jsx)(`span`,{className:`absolute inset-0 animate-ping rounded-full bg-success/60`})]}),(0,r.jsx)(`span`,{className:`text-[11px] leading-none text-muted-foreground`,children:n})]})}function s({children:e}){return(0,r.jsx)(`span`,{className:`text-[10px] uppercase tracking-[0.14em]`,children:e})}function c({icon:e,title:i,description:a,aside:o,footer:s,children:c,id:l,className:u,bodyClassName:d}){return(0,r.jsxs)(`section`,{id:l,tabIndex:l?-1:void 0,"aria-label":typeof i==`string`?i:void 0,className:t(n,`flex min-w-0 scroll-mt-4 flex-col outline-none hover:border-border`,u),children:[(0,r.jsxs)(`header`,{className:`flex items-start justify-between gap-3 border-b border-border/60 px-4 py-3`,children:[(0,r.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,r.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,r.jsx)(e,{className:`size-3.5`})}),(0,r.jsxs)(`div`,{className:`min-w-0`,children:[(0,r.jsx)(`h2`,{className:`font-heading text-sm font-semibold tracking-tight text-foreground`,children:i}),a?(0,r.jsx)(`p`,{className:`mt-0.5 text-pretty text-xs text-muted-foreground`,children:a}):null]})]}),o?(0,r.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:o}):null]}),c===void 0?null:(0,r.jsx)(`div`,{className:t(`flex min-w-0 flex-col px-4 py-4`,d),children:c}),s?(0,r.jsx)(`div`,{className:`mt-auto flex min-w-0 flex-wrap items-center gap-x-4 gap-y-2 border-t border-border/60 bg-background/40 px-4 py-2.5 text-xs text-muted-foreground`,children:s}):null]})}export{o as i,i as n,s as r,c as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./control-HoYOjLyM.js";export{e as ControlPage};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{ot as n}from"./vendor-ui-D8j69UH4.js";import{et as r,vt as i}from"./api-GfuYYI6q.js";import{t as a}from"./proxy-CWZabK8f.js";import{t as o}from"./AnimatePresence-BSSlw02V.js";import{i as s,r as c}from"./dist-xY0pK9Wy.js";import{a as l,i as u,n as d,o as f,r as p,t as m}from"./dialog-B5PqrKVw.js";import{t as h}from"./shallow-Cin0mLuv.js";import{C as g,S as _,d as ee,l as te}from"./format-Bx7DF-TB.js";import{n as v,t as y}from"./utils-XFKvwlFT.js";import{n as b}from"./server-BVem_egD.js";import{n as x}from"./circle-x-6JtFdy1_.js";import{n as S}from"./protocol-card-1DCkgN_l.js";import{n as C,t as w}from"./sliders-horizontal-BNKmYQgd.js";import{t as T}from"./pause-CqW7v5Dc.js";import{a as E,l as ne,t as D}from"./use-engine-command-mutation-CTbPh58S.js";import{t as re}from"./rocket-KZ5oHK1G.js";import{t as ie}from"./triangle-alert-DoAwrRgk.js";import{a as ae,n as oe,r as O,t as k}from"./validation-DSsZ8qyt.js";import{i as A,n as j,t as M}from"./tooltip-B3vOB1Vu.js";import{t as N}from"./badge-Bk1DaL6C.js";import{t as P}from"./label-2sIXTEUK.js";import{i as F,r as I,t as L}from"./console-panel-DOt0r_Oz.js";import{i as R,n as z,r as B,t as V}from"./tabs-Ch_VG8_S.js";import{a as H,c as U,i as W,l as G,n as K,o as q,r as se,s as J,t as ce}from"./combobox-B8h0-NHs.js";import{c as le,i as ue,n as de,s as fe,t as pe}from"./select-BWlrSYlA.js";var me=v(`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`}]]),Y=v(`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`}]]),X=e(t(),1),Z=n();function he(){let{assets:e,models:t}=i(h(e=>({assets:e.assets,models:e.models}))),n=D(),[r,s]=(0,X.useState)(``),[c,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(``),f=(0,X.useMemo)(()=>u?e.filter(e=>e.id.toLowerCase().includes(u.toLowerCase())):e,[e,u]),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]),_=m.reduce((e,t)=>e+t.activeFaults.length,0);return(0,Z.jsxs)(q,{className:`h-full min-w-0`,children:[(0,Z.jsx)(U,{className:`pb-3`,children:(0,Z.jsxs)(G,{className:`flex items-center gap-2 text-xs font-medium uppercase tracking-wider`,children:[(0,Z.jsx)(ie,{className:`size-3.5 ${_>0?`text-destructive`:`text-muted-foreground`}`}),`Fault Lab`,(0,Z.jsx)(o,{children:_>0&&(0,Z.jsx)(a.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)(N,{variant:`destructive`,className:`text-[10px]`,children:[_,` 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)(ce,{value:r||null,onValueChange:e=>{s(e??``),l(``)},onInputValueChange:d,children:[(0,Z.jsx)(se,{placeholder:`Select asset`,"aria-label":`Fault asset`,className:`h-8 min-h-11 w-full min-w-0 touch-manipulation sm:min-h-8`,showClear:!!r}),(0,Z.jsx)(K,{children:(0,Z.jsxs)(H,{children:[f.map(e=>(0,Z.jsxs)(W,{value:e.id,children:[(0,Z.jsx)(`span`,{className:`font-mono`,children:e.id}),e.activeFaults.length>0&&(0,Z.jsx)(N,{variant:`destructive`,className:`ml-auto text-[10px]`,children:e.activeFaults.length})]},e.id)),f.length===0&&(0,Z.jsx)(`p`,{className:`py-2 text-center text-xs text-muted-foreground`,children:`No assets found`})]})})]}),(0,Z.jsxs)(pe,{value:c,onValueChange:e=>l(e??``),children:[(0,Z.jsx)(fe,{className:`h-8 min-h-11 w-full touch-manipulation sm:min-h-8`,"aria-label":`Fault type`,children:(0,Z.jsx)(le,{placeholder:r?`Select fault`:`Pick asset first`})}),(0,Z.jsx)(de,{alignItemWithTrigger:!1,align:`start`,children:p.map(e=>(0,Z.jsx)(ue,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Z.jsx)(g,{variant:`destructive`,size:`sm`,className:`h-7 min-h-11 touch-manipulation text-xs sm:min-h-7`,disabled:!r||!c,onClick:()=>{let e=O(k,{assetId:r,fault:c});e&&n.mutate({type:`triggerFault`,...e})},children:`Trigger`}),(0,Z.jsx)(g,{variant:`secondary`,size:`sm`,className:`h-7 min-h-11 touch-manipulation text-xs sm:min-h-7`,disabled:!r||!c,onClick:()=>{let e=O(k,{assetId:r,fault:c});e&&n.mutate({type:`clearFault`,...e})},children:`Clear`})]}),(0,Z.jsx)(ae,{}),(0,Z.jsx)(o,{mode:`wait`,initial:!1,children:m.length>0?(0,Z.jsxs)(a.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 Assets`}),(0,Z.jsx)(o,{initial:!1,children:m.map(e=>(0,Z.jsx)(a.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:()=>{s(e.id),l(``)},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)(a.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)(x,{className:`size-3.5 text-success`}),`All clear — no active faults`]},`all-clear`)})]})]})}function ge(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 ve({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 ye={running:`bg-success`,paused:`bg-warning`,idle:`bg-muted-foreground`,stopped:`bg-destructive`};function be({state:e}){let t=ye[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)(o,{mode:`wait`,initial:!1,children:(0,Z.jsx)(a.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 Q({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)(M,{children:[(0,Z.jsx)(A,{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)(b,{className:`size-3`,"aria-hidden":!0})}),(0,Z.jsx)(j,{side:`top`,className:y(`max-w-xs`,n),children:t})]})]})}function $(){let{engineState:e,connectionState:t}=i(h(e=>({engineState:e.engineState,connectionState:e.connectionState}))),n=D();return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(Q,{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)(be,{state:e}),t===`live`&&(e===`running`||e===`paused`)&&(0,Z.jsx)(`div`,{className:`mt-1 flex items-center gap-2`,children:(0,Z.jsxs)(g,{type:`button`,size:`sm`,variant:e===`paused`?`default`:`outline`,className:y(`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)(ne,{className:`size-3`}):(0,Z.jsx)(T,{className:`size-3`}),e===`paused`?`Resume`:`Pause`]})})]})}function xe(){let{speedMultiplier:e,connectionState:t}=i(h(e=>({speedMultiplier:e.speedMultiplier,connectionState:e.connectionState}))),n=D(),[r,a]=(0,X.useState)(String(e)),o=t===`live`;return(0,X.useEffect)(()=>{a(String(e))},[e]),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(Q,{label:`Speed`,tooltip:(0,Z.jsx)(`p`,{className:`text-[11px] leading-snug`,children:`Runs the factory 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)(P,{htmlFor:`speed-multiplier`,className:`sr-only`,children:`Speed multiplier`}),(0,Z.jsx)(_,{id:`speed-multiplier`,type:`number`,value:r,onChange:e=>a(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:!o}),(0,Z.jsx)(g,{type:`button`,size:`sm`,variant:`outline`,className:`h-8 min-h-11 touch-manipulation px-3 text-xs sm:min-h-8`,disabled:!o,onClick:()=>{let e=O(oe,{multiplier:Number(r)});e&&n.mutate({type:`setSpeed`,multiplier:e.multiplier})},children:`Set`})]})]})}function Se(){let{tick:e,simulationTime:t,tps:n,tpsHistory:r,uptimeMs:a,assetCount:o,memberValueCount:s}=i(h(e=>({tick:e.tick,simulationTime:e.simulationTime,tps:e.tps,tpsHistory:e.tpsHistory,uptimeMs:e.uptimeMs,assetCount:e.assetCount,memberValueCount:e.memberValueCount})));return(0,Z.jsxs)(`div`,{className:y(E,`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)($,{}),(0,Z.jsx)(xe,{}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(Q,{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:te(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:ge(a)})]})]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(Q,{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:[o,` inst · `,ee(s),` tags`]})]}),(0,Z.jsxs)(`div`,{className:`col-span-2 flex flex-col gap-2`,children:[(0,Z.jsx)(Q,{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)(ve,{data:r})]})]})]})}function Ce({enabled:e,total:t}){return(0,Z.jsxs)(F,{tone:t===0?`off`:e===0?`idle`:`live`,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`}),(0,Z.jsx)(I,{children:`active`})]})}function we(){let{availableAdapters:e,adapterMetrics:t}=i(h(e=>({availableAdapters:e.availableAdapters,adapterMetrics:e.adapterMetrics}))),n=e.filter(e=>e.enabled).length;return(0,Z.jsxs)(L,{icon:Y,title:`Protocol Gateway`,description:`Northbound adapters publishing engine telemetry to external systems.`,aside:(0,Z.jsx)(Ce,{enabled:n,total:e.length}),bodyClassName:`p-0`,children:[e.length>0&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-2 px-4 py-4`,children:(0,Z.jsx)(o,{children:e.map((e,n)=>{let r=t.find(t=>t.name===e.name)?.metrics;return(0,Z.jsx)(a.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)(S,{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`,children:[(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,Z.jsx)(re,{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.jsx)(`span`,{className:`font-mono text-[10px] leading-[15px] tracking-tight text-muted-foreground`,children:`More protocols to come`})]})]})}function Te(){let{assets:e,templates:t}=i(h(e=>({assets:e.assets,templates:e.templates}))),n=D(),[r,a]=(0,X.useState)(!1),[o,s]=(0,X.useState)(!1);return(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,Z.jsxs)(q,{className:`min-w-0`,children:[(0,Z.jsx)(U,{className:`pb-3`,children:(0,Z.jsxs)(G,{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 factory`}),(0,Z.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Unloads `,t.length,` template`,t.length===1?``:`s`,` and removes`,` `,e.length,` asset`,e.length===1?``:`s`,`, including standalone ones.`]})]}),(0,Z.jsx)(g,{className:`min-h-11 w-full shrink-0 touch-manipulation @2xl/main:w-auto sm:min-h-7`,variant:`destructive`,size:`sm`,onClick:()=>a(!0),children:`Reset`})]})})]}),(0,Z.jsx)(m,{open:r,onOpenChange:a,children:(0,Z.jsxs)(d,{children:[(0,Z.jsxs)(l,{children:[(0,Z.jsx)(f,{children:`Reset Factory`}),(0,Z.jsx)(p,{children:`Unloads every template and removes every asset, including standalone ones. With persistence on, the empty factory is saved and stays empty after a restart.`})]}),(0,Z.jsxs)(u,{children:[(0,Z.jsx)(g,{variant:`outline`,className:`min-h-11 w-full touch-manipulation sm:min-h-8 sm:w-auto`,onClick:()=>a(!1),disabled:o,children:`Cancel`}),(0,Z.jsx)(g,{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 n.mutateAsync({type:`resetFactory`}),a(!1)}catch{}finally{s(!1)}},children:o?`Resetting...`:`Confirm Reset`})]})]})})]})}function Ee(){let[e,t]=s(`tab`,c([`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)(N,{variant:`outline`,title:`Miravo version ${r}`,className:`font-mono text-[10px] leading-none text-muted-foreground`,children:[`v`,r]})]}),(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Engine telemetry, protocol management, and fault operations.`})]}),(0,Z.jsxs)(V,{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)(B,{variant:`line`,className:`h-10! min-w-max gap-0.5`,children:[(0,Z.jsxs)(R,{value:`monitor`,className:`gap-1.5 px-3 text-sm`,children:[(0,Z.jsx)(C,{className:`size-3.5 shrink-0`}),`Monitor`]}),(0,Z.jsxs)(R,{value:`operate`,className:`gap-1.5 px-3 text-sm`,children:[(0,Z.jsx)(w,{className:`size-3.5 shrink-0`}),`Operate`]})]})}),(0,Z.jsx)(z,{value:`monitor`,className:`flex-1 py-2`,children:(0,Z.jsxs)(a.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)(Se,{}),(0,Z.jsx)(we,{})]},`monitor`)}),(0,Z.jsx)(z,{value:`operate`,className:`flex-1 py-2`,children:(0,Z.jsxs)(a.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-start gap-5 @2xl/main:grid-cols-2 @2xl/main:gap-4`,children:[(0,Z.jsx)(he,{}),(0,Z.jsx)(Te,{})]},`operate`)})]})]})}export{Y as n,Ee as t};
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{ot as n}from"./vendor-ui-D8j69UH4.js";import{et as r,vt as i}from"./api-CtMmjN9m.js";import{t as a}from"./proxy-CWZabK8f.js";import{t as o}from"./AnimatePresence-BSSlw02V.js";import{i as s,r as c}from"./dist-xY0pK9Wy.js";import{a as l,i as u,n as d,o as f,r as p,t as m}from"./dialog-B5PqrKVw.js";import{t as h}from"./shallow-Cin0mLuv.js";import{C as g,S as _,d as ee,l as te}from"./format-Bx7DF-TB.js";import{n as v,t as y}from"./utils-XFKvwlFT.js";import{n as b}from"./server-BVem_egD.js";import{n as x}from"./circle-x-6JtFdy1_.js";import{n as S}from"./protocol-card-Bf06qKjE.js";import{n as C,t as w}from"./sliders-horizontal-BNKmYQgd.js";import{t as T}from"./pause-CqW7v5Dc.js";import{a as E,l as ne,t as D}from"./use-engine-command-mutation-5q_LI_xT.js";import{t as re}from"./rocket-KZ5oHK1G.js";import{t as ie}from"./triangle-alert-DoAwrRgk.js";import{a as ae,n as oe,r as O,t as k}from"./validation-BSQDilvJ.js";import{i as A,n as j,t as M}from"./tooltip-B3vOB1Vu.js";import{t as N}from"./badge-Bk1DaL6C.js";import{t as P}from"./label-2sIXTEUK.js";import{i as F,r as I,t as L}from"./console-panel-DXk4doxV.js";import{i as R,n as z,r as B,t as V}from"./tabs-Ch_VG8_S.js";import{a as H,c as U,i as W,l as G,n as K,o as q,r as se,s as J,t as ce}from"./combobox-B8h0-NHs.js";import{c as le,i as ue,n as de,s as fe,t as pe}from"./select-BWlrSYlA.js";var me=v(`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`}]]),Y=v(`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`}]]),X=e(t(),1),Z=n();function he(){let{assets:e,models:t}=i(h(e=>({assets:e.assets,models:e.models}))),n=D(),[r,s]=(0,X.useState)(``),[c,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(``),f=(0,X.useMemo)(()=>u?e.filter(e=>e.id.toLowerCase().includes(u.toLowerCase())):e,[e,u]),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]),_=m.reduce((e,t)=>e+t.activeFaults.length,0);return(0,Z.jsxs)(q,{className:`h-full min-w-0`,children:[(0,Z.jsx)(U,{className:`pb-3`,children:(0,Z.jsxs)(G,{className:`flex items-center gap-2 text-xs font-medium uppercase tracking-wider`,children:[(0,Z.jsx)(ie,{className:`size-3.5 ${_>0?`text-destructive`:`text-muted-foreground`}`}),`Fault Lab`,(0,Z.jsx)(o,{children:_>0&&(0,Z.jsx)(a.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)(N,{variant:`destructive`,className:`text-[10px]`,children:[_,` 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)(ce,{value:r||null,onValueChange:e=>{s(e??``),l(``)},onInputValueChange:d,children:[(0,Z.jsx)(se,{placeholder:`Select asset`,"aria-label":`Fault asset`,className:`h-8 min-h-11 w-full min-w-0 touch-manipulation sm:min-h-8`,showClear:!!r}),(0,Z.jsx)(K,{children:(0,Z.jsxs)(H,{children:[f.map(e=>(0,Z.jsxs)(W,{value:e.id,children:[(0,Z.jsx)(`span`,{className:`font-mono`,children:e.id}),e.activeFaults.length>0&&(0,Z.jsx)(N,{variant:`destructive`,className:`ml-auto text-[10px]`,children:e.activeFaults.length})]},e.id)),f.length===0&&(0,Z.jsx)(`p`,{className:`py-2 text-center text-xs text-muted-foreground`,children:`No assets found`})]})})]}),(0,Z.jsxs)(pe,{value:c,onValueChange:e=>l(e??``),children:[(0,Z.jsx)(fe,{className:`h-8 min-h-11 w-full touch-manipulation sm:min-h-8`,"aria-label":`Fault type`,children:(0,Z.jsx)(le,{placeholder:r?`Select fault`:`Pick asset first`})}),(0,Z.jsx)(de,{alignItemWithTrigger:!1,align:`start`,children:p.map(e=>(0,Z.jsx)(ue,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Z.jsx)(g,{variant:`destructive`,size:`sm`,className:`h-7 min-h-11 touch-manipulation text-xs sm:min-h-7`,disabled:!r||!c,onClick:()=>{let e=O(k,{assetId:r,fault:c});e&&n.mutate({type:`triggerFault`,...e})},children:`Trigger`}),(0,Z.jsx)(g,{variant:`secondary`,size:`sm`,className:`h-7 min-h-11 touch-manipulation text-xs sm:min-h-7`,disabled:!r||!c,onClick:()=>{let e=O(k,{assetId:r,fault:c});e&&n.mutate({type:`clearFault`,...e})},children:`Clear`})]}),(0,Z.jsx)(ae,{}),(0,Z.jsx)(o,{mode:`wait`,initial:!1,children:m.length>0?(0,Z.jsxs)(a.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 Assets`}),(0,Z.jsx)(o,{initial:!1,children:m.map(e=>(0,Z.jsx)(a.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:()=>{s(e.id),l(``)},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)(a.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)(x,{className:`size-3.5 text-success`}),`All clear — no active faults`]},`all-clear`)})]})]})}function ge(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 ve({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 ye={running:`bg-success`,paused:`bg-warning`,idle:`bg-muted-foreground`,stopped:`bg-destructive`};function be({state:e}){let t=ye[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)(o,{mode:`wait`,initial:!1,children:(0,Z.jsx)(a.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 Q({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)(M,{children:[(0,Z.jsx)(A,{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)(b,{className:`size-3`,"aria-hidden":!0})}),(0,Z.jsx)(j,{side:`top`,className:y(`max-w-xs`,n),children:t})]})]})}function $(){let{engineState:e,connectionState:t}=i(h(e=>({engineState:e.engineState,connectionState:e.connectionState}))),n=D();return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(Q,{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)(be,{state:e}),t===`live`&&(e===`running`||e===`paused`)&&(0,Z.jsx)(`div`,{className:`mt-1 flex items-center gap-2`,children:(0,Z.jsxs)(g,{type:`button`,size:`sm`,variant:e===`paused`?`default`:`outline`,className:y(`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)(ne,{className:`size-3`}):(0,Z.jsx)(T,{className:`size-3`}),e===`paused`?`Resume`:`Pause`]})})]})}function xe(){let{speedMultiplier:e,connectionState:t}=i(h(e=>({speedMultiplier:e.speedMultiplier,connectionState:e.connectionState}))),n=D(),[r,a]=(0,X.useState)(String(e)),o=t===`live`;return(0,X.useEffect)(()=>{a(String(e))},[e]),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(Q,{label:`Speed`,tooltip:(0,Z.jsx)(`p`,{className:`text-[11px] leading-snug`,children:`Runs the factory 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)(P,{htmlFor:`speed-multiplier`,className:`sr-only`,children:`Speed multiplier`}),(0,Z.jsx)(_,{id:`speed-multiplier`,type:`number`,value:r,onChange:e=>a(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:!o}),(0,Z.jsx)(g,{type:`button`,size:`sm`,variant:`outline`,className:`h-8 min-h-11 touch-manipulation px-3 text-xs sm:min-h-8`,disabled:!o,onClick:()=>{let e=O(oe,{multiplier:Number(r)});e&&n.mutate({type:`setSpeed`,multiplier:e.multiplier})},children:`Set`})]})]})}function Se(){let{tick:e,simulationTime:t,tps:n,tpsHistory:r,uptimeMs:a,assetCount:o,memberValueCount:s}=i(h(e=>({tick:e.tick,simulationTime:e.simulationTime,tps:e.tps,tpsHistory:e.tpsHistory,uptimeMs:e.uptimeMs,assetCount:e.assetCount,memberValueCount:e.memberValueCount})));return(0,Z.jsxs)(`div`,{className:y(E,`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)($,{}),(0,Z.jsx)(xe,{}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(Q,{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:te(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:ge(a)})]})]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(Q,{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:[o,` inst · `,ee(s),` tags`]})]}),(0,Z.jsxs)(`div`,{className:`col-span-2 flex flex-col gap-2`,children:[(0,Z.jsx)(Q,{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)(ve,{data:r})]})]})]})}function Ce({enabled:e,total:t}){return(0,Z.jsxs)(F,{tone:t===0?`off`:e===0?`idle`:`live`,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`}),(0,Z.jsx)(I,{children:`active`})]})}function we(){let{availableAdapters:e,adapterMetrics:t}=i(h(e=>({availableAdapters:e.availableAdapters,adapterMetrics:e.adapterMetrics}))),n=e.filter(e=>e.enabled).length;return(0,Z.jsxs)(L,{icon:Y,title:`Protocol Gateway`,description:`Northbound adapters publishing engine telemetry to external systems.`,aside:(0,Z.jsx)(Ce,{enabled:n,total:e.length}),bodyClassName:`p-0`,children:[e.length>0&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-2 px-4 py-4`,children:(0,Z.jsx)(o,{children:e.map((e,n)=>{let r=t.find(t=>t.name===e.name)?.metrics;return(0,Z.jsx)(a.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)(S,{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`,children:[(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,Z.jsx)(re,{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.jsx)(`span`,{className:`font-mono text-[10px] leading-[15px] tracking-tight text-muted-foreground`,children:`More protocols to come`})]})]})}function Te(){let{assets:e,templates:t}=i(h(e=>({assets:e.assets,templates:e.templates}))),n=D(),[r,a]=(0,X.useState)(!1),[o,s]=(0,X.useState)(!1);return(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,Z.jsxs)(q,{className:`min-w-0`,children:[(0,Z.jsx)(U,{className:`pb-3`,children:(0,Z.jsxs)(G,{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 factory`}),(0,Z.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Unloads `,t.length,` template`,t.length===1?``:`s`,` and removes`,` `,e.length,` asset`,e.length===1?``:`s`,`, including standalone ones.`]})]}),(0,Z.jsx)(g,{className:`min-h-11 w-full shrink-0 touch-manipulation @2xl/main:w-auto sm:min-h-7`,variant:`destructive`,size:`sm`,onClick:()=>a(!0),children:`Reset`})]})})]}),(0,Z.jsx)(m,{open:r,onOpenChange:a,children:(0,Z.jsxs)(d,{children:[(0,Z.jsxs)(l,{children:[(0,Z.jsx)(f,{children:`Reset Factory`}),(0,Z.jsx)(p,{children:`Unloads every template and removes every asset, including standalone ones. With persistence on, the empty factory is saved and stays empty after a restart.`})]}),(0,Z.jsxs)(u,{children:[(0,Z.jsx)(g,{variant:`outline`,className:`min-h-11 w-full touch-manipulation sm:min-h-8 sm:w-auto`,onClick:()=>a(!1),disabled:o,children:`Cancel`}),(0,Z.jsx)(g,{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 n.mutateAsync({type:`resetFactory`}),a(!1)}catch{}finally{s(!1)}},children:o?`Resetting...`:`Confirm Reset`})]})]})})]})}function Ee(){let[e,t]=s(`tab`,c([`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)(N,{variant:`outline`,title:`Miravo version ${r}`,className:`font-mono text-[10px] leading-none text-muted-foreground`,children:[`v`,r]})]}),(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Engine telemetry, protocol management, and fault operations.`})]}),(0,Z.jsxs)(V,{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)(B,{variant:`line`,className:`h-10! min-w-max gap-0.5`,children:[(0,Z.jsxs)(R,{value:`monitor`,className:`gap-1.5 px-3 text-sm`,children:[(0,Z.jsx)(C,{className:`size-3.5 shrink-0`}),`Monitor`]}),(0,Z.jsxs)(R,{value:`operate`,className:`gap-1.5 px-3 text-sm`,children:[(0,Z.jsx)(w,{className:`size-3.5 shrink-0`}),`Operate`]})]})}),(0,Z.jsx)(z,{value:`monitor`,className:`flex-1 py-2`,children:(0,Z.jsxs)(a.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)(Se,{}),(0,Z.jsx)(we,{})]},`monitor`)}),(0,Z.jsx)(z,{value:`operate`,className:`flex-1 py-2`,children:(0,Z.jsxs)(a.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-start gap-5 @2xl/main:grid-cols-2 @2xl/main:gap-4`,children:[(0,Z.jsx)(he,{}),(0,Z.jsx)(Te,{})]},`operate`)})]})]})}export{Y as n,Ee as t};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{ot as n}from"./vendor-ui-D8j69UH4.js";import{T as r,b as i,c as a,d as o,f as s,l as c,m as l,n as u,s as d}from"./dom-CQuChC3G.js";import{n as f,t as ee}from"./by-path-CKZo157c.js";import{A as p,B as m,C as te,D as h,E as g,F as _,H as v,L as y,P as b,V as x,X as ne,_ as re,a as S,b as ie,c as ae,g as C,h as oe,i as se,j as ce,k as le,n as ue,o as de,r as fe,s as pe,t as me,w as he,x as ge}from"./status-DNfdEhTs.js";import{i as _e,n as ve,r as ye,t as be}from"./tank-xgQfMS2d.js";import{t as xe}from"./stages-C0cErwSQ.js";import{a as Se,n as Ce,o as we,r as Te,t as Ee}from"./boiler-BQwqgoVY.js";var De=[[`boilerA`,`hot-water-boiler`,`heat-plant`,`boilers`,0],[`boilerB`,`hot-water-boiler`,`heat-plant`,`boilers`,1],[`boilerC`,`hot-water-boiler`,`heat-plant`,`boilers`,2],[`primaryA`,`centrifugal-pump`,`heat-plant`,`primary-loop`,0],[`primaryB`,`centrifugal-pump`,`heat-plant`,`primary-loop`,1],[`accumulator`,`storage-tank`,`heat-plant`,`primary-loop`,0],[`networkA`,`centrifugal-pump`,`network`,`trunk-main`,0],[`networkB`,`centrifugal-pump`,`network`,`trunk-main`,1],[`hospital`,`heat-substation`,`customers`,`hospital`,0],[`university`,`heat-substation`,`customers`,`university`,0],[`residential`,`heat-substation`,`customers`,`residential`,0],[`office`,`heat-substation`,`customers`,`office-park`,0]],Oe=e=>ee(De,e);function ke(e){let t=(e,t,n)=>({key:e,assetId:e,name:t,kind:`utility`,area:n});return[t(e.boilerA,`Boiler 1 (lead)`,`Heat plant`),t(e.boilerB,`Boiler 2`,`Heat plant`),t(e.boilerC,`Boiler 3`,`Heat plant`),t(e.accumulator,`Thermal accumulator`,`Heat plant`),t(e.primaryA,`Primary pump A`,`Heat plant`),t(e.primaryB,`Primary pump B`,`Heat plant`),t(e.networkA,`Network pump A`,`Network`),t(e.networkB,`Network pump B`,`Network`),t(e.hospital,`Hospital substation`,`Customers`),t(e.university,`University substation`,`Customers`),t(e.residential,`Residential substation`,`Customers`),t(e.office,`Office park substation`,`Customers`)]}var Ae=3600/(4186*30*.97),je=8,Me=e=>Number(e.dataset.win)*37%101;function Ne(e){let{svg:t,P:n,feed:i}=e,o=(e,t)=>i.num(e,t),s=u(t,`[data-valve]`).map(e=>{let n=pe(e),r=e=>u(t,`[data-asset="${n}"] ${e}`),i=r(`[data-spin="sub"]`)[0];return{id:n,el:e,at:d(e.dataset.valve),rotor:i,rotorAt:ae(i?.dataset.at),rotorR:Number(i?.dataset.radius)||2,foul:r(`[data-foul]`)[0],act:r(`[data-act]`)[0],wins:r(`[data-win]`).sort((e,t)=>Me(e)-Me(t)),valve:0,rate:0,spin:0,lit:-1,heat:ge(te(t,n),3,2),ret:ae(e.dataset.ret)}}),c=new Map(s.map(e=>[e.id,e]));return{draw(t,c,l){let u=e.reducedMotion();for(let e of s){e.valve=re(e.valve,C(o(e.id,`control_valve_position`)/100),t,.6,u);let[s=0,d=0,f=0,ee=4]=e.at;if(a(e.el,`d`,r([s,d],[s,d],f,n)+r([s-1.6,d],[s+1.6,d],f+e.valve*ee,n)),e.rate=re(e.rate,o(e.id,`circulation_pump_speed`)/100*je,t,.8,u),u||(e.spin+=e.rate*t),e.rotor){let[t,i,o]=e.rotorAt,s=``;for(let a=0;a<3;a++){let c=e.spin+a*oe/3;s+=r([t,i],[t+Math.cos(c)*e.rotorR,i+Math.sin(c)*e.rotorR],o,n)}a(e.rotor,`d`,s)}e.foul&&(e.foul.style.opacity=l&&he(i,e.id,`hx_fouling`)?`0.85`:`0`);let p=l&&he(i,e.id,`valve_stuck`);a(e.act,`data-s`,p&&Math.sin(c*6)>0?`a`:null),e.heat.draw(l&&!u&&he(i,e.id,`low_delta_t`),c,n,e.ret);let m=Math.round(C(o(e.id,`occupancy_pu`))*e.wins.length);if(m!==e.lit){e.lit=m;for(let[t,n]of e.wins.entries())a(n,`data-on`,t<m?``:null)}}},bar(e){return c.has(e)?C(o(e,`heat_delivered_kw`)/i.param(e,`design_load_kw`,500)):void 0},flowPu(e){let t=i.param(e,`design_load_kw`,0)*Ae;return t>0?C(o(e,`primary_flow`)/t):0}}}var w=e=>e>.002?6+26*C(e*2):0,Pe=e=>{let{svg:t,feed:n,ids:r}=e,i=ie(t),a=fe(e,i),o=Ee(e,i),s=be(e),c=Ne(e),l=[a,o,s,c],u=se(e,e=>ue(n,e,`availability`)),d=de(e,{needle:e=>o.needle(e)??0,bar:e=>l.reduce((t,n)=>t??n.bar(e),void 0)??0,alertsHigh:()=>!0,ready:()=>!0}),f=()=>a.flowPu(r.primaryA)+a.flowPu(r.primaryB),ee=()=>a.flowPu(r.networkA)+a.flowPu(r.networkB),p=[r.boilerA,r.boilerB,r.boilerC],m=e=>{let t=p.filter(e=>o.circulating(e)).length;return o.circulating(e)?f()/t:0},te=new Map([[`hospital`,r.hospital],[`university`,r.university],[`residential`,r.residential],[`office`,r.office]]),h=S(e,({id:e})=>{switch(e){case`sup-1`:return w(m(r.boilerA));case`sup-2`:case`ret-2`:return w(m(r.boilerB));case`sup-3`:case`ret-3`:return w(m(r.boilerC));case`sup-23`:return w(m(r.boilerB)+m(r.boilerC));case`to-acc`:return w(f());case`ret-a`:case`suction-pa`:return w(a.flowPu(r.primaryA));case`ret-collect`:return w(f());case`ret-12`:return w(m(r.boilerA)+m(r.boilerB));case`ret-1`:return w(m(r.boilerA));case`ret-b`:case`suction-b`:return w(a.flowPu(r.primaryB));case`suction-a`:case`sup-a`:return w(a.flowPu(r.networkA));case`sup-b`:case`suction-nb`:return w(a.flowPu(r.networkB));case`acc-out`:case`trunk-sup`:case`trunk-ret`:return w(ee());default:{let t=te.get(e.slice(0,e.lastIndexOf(`-`)));return t?w(c.flowPu(t)):0}}});return{data(e){u.draw(e)},draw({sdt:e,t,introDone:n}){h.draw(e),d.draw(e,t);for(let r of l)r.draw(e,t,n)},resync(){},status:e=>me(n,e,`availability`)}},Fe=e(t(),1),Ie=11;function Le(e,t){let{k:n,P:r,S:i,L:a,slab:o,cyl:s}=e,{plan:c,floors:l,kind:u}=t,d=l*14+4,f=[],ee=e=>a(e,{tone:`faint`}),p=Array.from({length:l-1},(e,t)=>n.sideSeam(c,4+(t+1)*14,r,2)).join(``);f.push(i(n.slabOf(c,0,d,r,2,.6),{tone:u===`office`?`lo`:`mid`,inner:ee(p)})),f.push(a(n.planOutline(n.insetPlan(c,2),d,r,2),{tone:`lo`})),f.push(o({x:c.x+c.w*.2,y:c.y+c.d*.2,w:18,d:12,r:1},d,7,{tone:`mid`},2,.3)),f.push(s(c.x+c.w*.7,c.y+c.d*.35,4,d,9,{tone:`mid`},20));let m=[],te=0,h=(e,t,n)=>`<path class="bd-win" data-win="${te++}" d="M${e.toFixed(1)} ${(-(t+8)).toFixed(1)}H${(e+n).toFixed(1)}V${(-t).toFixed(1)}H${e.toFixed(1)}Z"/>`,g=u===`office`;for(let[t,i,a]of[[c.w,e.front(c.y+c.d),c.x],[c.d,n.sideMatrix([c.x+c.w,c.y+c.d],0,r,`right`),0]]){let e=Math.max(1,Math.floor((t-6)/Ie)),n=a+(t-e*Ie)/2,r=[];for(let t=0;t<l;t++){let i=7+t*14;if(g)r.push(h(n+1,i,e*Ie-2));else for(let t=0;t<e;t++)r.push(h(n+t*Ie+2,i,Ie-4))}m.push(`<g transform="${i}">${r.join(``)}</g>`)}f.push(...m);let _=c.x+c.w/2,v=c.y+c.d,y=(e,t,n,r,i,a=0)=>{let l=c.x+c.w/2+a;f.push(o({x:l-4.5,y:v,w:9,d:.6,r:.2},0,n-1,{tone:`lo`},2,0),...[-1,1].flatMap(r=>[s(l+r*(e-3)/2,v+t-1.2,1.7,0,.8,{tone:`lo`},14),s(l+r*(e-3)/2,v+t-1.2,i,.8,n-.8,{tone:`mid`},12)]),o({x:l-e/2,y:v,w:e,d:t,r:.5},n,1.4,{tone:r},2,.2))};if(u===`hospital`)f.push(o({x:_-6,y:v-1,w:12,d:1.2,r:.4},d-14,12,{tone:`lo`},2,0)),f.push(`<g transform="${e.front(v+.25)}"><path class="bd-cross" d="M${_-1.4} ${-(d-3.6)}H${_+1.4}V${-(d-6.6)}H${_+4.4}V${-(d-9.4)}H${_+1.4}V${-(d-12.4)}H${_-1.4}V${-(d-9.4)}H${_-4.4}V${-(d-6.6)}H${_-1.4}Z"/></g>`),y(24,8,12,`mid`,.9);else if(u===`university`)y(30,9,18,`mid`,1.8,-16);else if(u===`residential`)for(let e=1;e<l;e++)f.push(o({x:c.x+4,y:v,w:c.w-8,d:4,r:.4},4+e*14,1,{tone:`mid`},2,0));else y(20,7,14,`mid`,.9);return f.join(``)}var T=1.8,E=4,D=-14,O=[-5,5],k=[10,26],A=[26,k[0]],j=13,Re=17.5,ze=2.2,Be=-26,M=[[O[0],28,k[1]],[O[0],28,k[0]]],Ve={x:-16,y:-24,w:34,d:54,r:2};function He(e,t){let{k:n,G:r,P:i,at:a,S:o,L:s,D:c,slab:l,cyl:u,hmi:d,screws:f,faceRule:ee}=e,p=[];p.push(l({x:-14,y:-22,w:30,d:50,r:2},0,3,{tone:`lo`},3,.4)),p.push(f(n.corners({x:-14,y:-22,w:30,d:50},2.4),3)),p.push(l({x:-1.2,y:D-6,w:2.4,d:3,r:.4},3,36,{tone:`mid`},2,.2),l({x:-1.4,y:D-6,w:2.8,d:E-D+9,r:.4},36,2.6,{tone:`mid`},2,.2)),p.push(l({x:-10,y:D-3,w:20,d:3,r:.6},3,33,{tone:`mid`},2,.3));let te=[];for(let e=D+.8;e<E-.4;e+=.9)te.push(n.segment([9,e,6],[9,e,33],i));p.push(o(n.slabOf({x:-9,y:D,w:18,d:E-D,r:.4},5,29,i,2,.2),{tone:`lo`,inner:s(te.join(``),{tone:`faint`})}));let h=[[9.1,D+.4,6],[9.1,E-.4,6],[9.1,E-.4,33],[9.1,D+.4,33]].map(e=>a(e));p.push(`<path class="sf-grime" data-foul="" style="opacity:0" d="${n.pathOf(h,!0)}"/>`),p.push(l({x:-11,y:E,w:22,d:3.4,r:.6},3,35,{tone:`mid`},2,.3));let g=E+3.4;p.push(c([-10.4,10.4].flatMap(e=>[7,31].map(t=>a([e,g,t]))),{size:.5}));for(let e of O)for(let t of k){let n=r.frameAlong([e,g,t],[0,1,0]);p.push(o(r.disc(0,2.2,T+.2,n,i),{tone:`mid`}),o(r.disc(2.2,3,T+1.4,n,i),{tone:`mid`}))}let _=(e,t)=>[O[e],g+3,k[t]],[v,y]=M;p.push(m(e,[v,_(0,1)],T,`mid`,3,`heat`),m(e,[_(0,0),y],T,`mid`,3,`heatret`));for(let e of[v,y]){let t=r.frameAlong([e[0],e[1]-1.6,e[2]],[0,1,0]);p.push(o(r.disc(0,1.6,T+1.2,t,i),{tone:`mid`}))}let[b,,x]=v,ne=r.frameAlong([b,14,x],[0,1,0]);p.push(o(r.disc(0,1,T+1.4,ne,i),{tone:`mid`}),o(r.solidOf([[1,2.6],[2.6,3.6,1],[5.4,3.6,1],[7,2.6]],ne,i),{tone:`mid`}),o(r.disc(7,8,T+1.4,ne,i),{tone:`mid`}),u(b,18,1.2,x+3,4,{tone:`mid`,crease:`none`},12),u(b,18,4.4,x+7,2,{tone:`mid`},24),u(b,18,4.8,x+9,5,{tone:`mid`,crease:`lo`},28));let re=a([b+4.8,18,x+11.5]);p.push(`<path class="iso-line" data-tone="lit" data-valve="${b},21,${x+14},4" data-ret="${y[0]},${y[1]-4},${y[2]+2}" d=""/>`,`<circle class="sb-act" data-act="" cx="${re[0].toFixed(2)}" cy="${re[1].toFixed(2)}" r="0.6"/>`);let S=[O[1],g+14,k[1]],ie=(e,t)=>{let n=r.frameAlong([e,-30,t],[0,1,0]);return o(r.disc(0,1.2,T+2.6,n,i),{tone:`mid`})+o(r.disc(1.2,ze,T+1.4,n,i),{tone:`mid`})},ae=(e,t)=>u(e,Be,2.4,0,1,{tone:`lo`},18)+u(e,Be,.9,1,t-T-2.6,{tone:`mid`,crease:`none`},12)+u(e,Be,1.8,t-T-1.6,1,{tone:`mid`},16),C=-30+ze;return p.push(ie(j,A[0]),ie(j,A[1]),ae(j,A[1]),ae(Re,A[0]),l({x:j-1,y:Be-.9,w:Re-j+1.9,d:1.8,r:.3},A[0]-T-1.6,1,{tone:`mid`},2,0),m(e,[_(1,1),S,[j,S[1],A[0]],[j,C,A[0]]],T,`mid`,4,`heat`,[!0,!1]),m(e,[_(1,0),[O[1],g+16,k[0]],[j,g+16,k[0]],[j,C,A[1]]],T,`mid`,4,`heatret`,[!0,!1])),p.push(u(S[0],S[1],3.6,k[1]-3,6,{tone:`mid`},24)),p.push(u(S[0],S[1],3,k[1]+3,7,{tone:`mid`,crease:`lo`},24)),p.push(`<path class="iso-line" data-tone="lo" data-spin="sub" data-at="${S[0]},${S[1]},${k[1]+10}" data-radius="2.4" d=""/>`),p.push(l({x:-14,y:10,w:6,d:8,r:.6},3,22,{tone:`mid`},2,.3)),p.push(d(t,18,-13.6,-8.4,8,21)),p.push(ee(18,-13.6,4,5,2)),p.join(``)}var Ue=1e3,We={x:-380,y:-360,w:305,d:315,r:8},Ge={x:-60,y:-300,w:240,d:150,r:8},Ke={x:-380,y:-15,w:620,d:200,r:8},qe={x:-400,y:-380,w:660,d:585,r:16},Je=i([...l(qe,-21,-14),...l(We,-14,120),...l(Ge,-14,90),...l(Ke,-14,110)],Ue,620,{pad:22,azimuth:60}),Ye=[[-262,-335],[-262,-245],[-262,-155]],Xe=[-120,-255],Ze={r:34,h:118,windowX:6,panelX:40,nozzles:[{angle:180,z:80,r:3.4,role:`inlet`},{angle:0,z:80,r:3.4,role:`outlet`}]},Qe=[94,-130,0],N={primaryA:{c:[-255,-78],scale:1},primaryB:{c:[-130,-78],scale:1},networkA:{c:[0,-190],scale:1.15},networkB:{c:[135,-190],scale:1.15}},$e=[b[0]-Qe[0],b[1]-Qe[1],b[2]],et=[p[0]-Qe[0],p[1]-Qe[1],p[2]],tt=18,nt=(e,t,n,r,i)=>({key:e,skid:[t+n/2-tt,104],building:{kind:e,plan:{x:t-n/2,y:74-r,w:n,d:r,r:2},floors:i}}),rt=[nt(`hospital`,150,112,62,4),nt(`university`,-5,120,64,3),nt(`residential`,-158,68,56,5),nt(`office`,-300,92,58,4)],it=xe([...Ye.map((e,t)=>({key:`boiler${t}`,at:e,h:60})),{key:`accumulator`,at:Xe,h:Ze.h+12},...Object.entries(N).map(([e,t])=>({key:e,at:t.c,h:45})),...rt.flatMap(e=>[{key:`${e.key}-building`,at:[e.building.plan.x+e.building.plan.w/2,e.building.plan.y+e.building.plan.d/2],h:e.building.floors*14+4},{key:e.key,at:e.skid,h:40}])],Je),at=it.order,ot=it.slotDepths,st=it.depth,ct=(e,t)=>[e.c[0]+t[0]*e.scale,e.c[1]+t[1]*e.scale,t[2]*e.scale],P=(e,t,n,r)=>[t??e[0],n??e[1],r??e[2]],lt=e=>{let t=Ze.nozzles[e],[n,r,i]=t?ye(Ze,t):[0,0,0];return[Xe[0]+n,Xe[1]+r,i]},F=(Ye[0]?.[0]??0)+Se[0],I=(Ye[0]?.[0]??0)+Te[0],ut=Se[2],L=80,R=84,[dt=0,z=0,ft=0]=Ye.map(e=>e[1]),pt=lt(0),B=lt(1),{primaryA:V,primaryB:H,networkA:U,networkB:W}=N,G=e=>ct(e,[et[0],et[1],et[2]-3]),K=e=>ct(e,$e),mt=10,q=e=>P(K(e),K(e)[0]+mt*e.scale,null,null),ht=72,J=-106,gt=K(V)[2],Y=220,X=232,_t=3.2*N.networkA.scale,vt=100,yt=vt-18,bt=-40,xt=M[0][2],Z=M[1][2],Q=104+M[0][1]+30,St=Math.min(...rt.map(e=>e.skid[0]))+M[0][0]-14,Ct={z:10,flanged:!0,routes:[{id:`sup-1`,medium:`heat`,r:3.2,pts:[[F,dt,ut],[F,dt,L],[F,pt[1],L]]},{id:`sup-23`,medium:`heat`,r:3.2,reverse:!0,pts:[[F,pt[1],L],[F,z,L]]},{id:`sup-3`,medium:`heat`,r:3.2,reverse:!0,pts:[[F,z,L],[F,ft,L],[F,ft,ut]]},{id:`sup-2`,medium:`heat`,r:3.2,pts:[[F,z,ut],[F,z,L]]},{id:`to-acc`,medium:`heat`,r:3.4,pts:[[F,pt[1],L],pt]},{id:`ret-b`,medium:`heatret`,r:3.2,fromStub:!0,pts:[G(H),P(G(H),null,null,ht),P(G(V),null,null,ht)]},{id:`ret-a`,medium:`heatret`,r:3.2,fromStub:!0,pts:[G(V),P(G(V),null,null,ht)]},{id:`ret-collect`,medium:`heatret`,r:3.2,bend:6,pts:[P(G(V),null,null,ht),P(G(V),I,null,ht),P(G(V),I,null,R),[I,ft,R]]},{id:`ret-12`,medium:`heatret`,r:3.2,pts:[[I,ft,R],[I,z,R]]},{id:`ret-1`,medium:`heatret`,r:3.2,pts:[[I,z,R],[I,dt,R],[I,dt,ut]]},{id:`ret-2`,medium:`heatret`,r:3.2,pts:[[I,z,R],[I,z,ut]]},{id:`ret-3`,medium:`heatret`,r:3.2,pts:[[I,ft,R],[I,ft,ut]]},{id:`acc-out`,medium:`heat`,r:3.4,pts:[B,P(q(U),null,B[1],B[2])]},{id:`suction-nb`,medium:`heat`,r:3.4,pts:[P(q(U),null,B[1],B[2]),P(B,q(W)[0],null,null),P(q(W),null,B[1],null),q(W),K(W)]},{id:`suction-a`,medium:`heat`,r:3.4,pts:[P(q(U),null,B[1],B[2]),P(q(U),null,B[1],null),q(U),K(U)]},...rt.flatMap(e=>{let[t,n]=e.skid,r=[t+M[0][0],n+M[0][1],xt],i=[t+M[1][0],n+M[1][1],Z];return[{id:`${e.key}-sup`,medium:`heat`,r:1.8,pts:[P(r,null,Q,null),r]},{id:`${e.key}-ret`,medium:`heatret`,r:1.8,pts:[i,P(i,null,Q,null)]}]}),{id:`trunk-ret`,medium:`heatret`,r:3.6,blind:[!0,!1],pts:[[St,Q,Z],[X,Q,Z],[X,J,Z],[X,J,gt],P(q(H),null,J,null)]},{id:`suction-pa`,medium:`heatret`,r:3.6,pts:[P(q(H),null,J,null),P(q(V),null,J,null),q(V),K(V)]},{id:`sup-a`,medium:`heat`,r:_t,fromStub:!0,pts:[G(U),P(G(U),null,null,vt),P(G(W),null,null,vt)]},{id:`trunk-sup`,medium:`heat`,r:3.6,blind:[!1,!0],pts:[P(G(W),null,null,vt),[Y,G(U)[1],vt],[Y,G(U)[1],yt],[Y,bt,yt],[Y,bt,xt],[Y,Q,xt],[St,Q,xt]]},{id:`sup-b`,medium:`heat`,r:_t,fromStub:!0,pts:[G(W),P(G(W),null,null,vt)]},{id:`suction-b`,medium:`heatret`,r:3.2,pts:[K(H),q(H),P(q(H),null,J,null)]}],posts:[[Y,-130,3.6,yt],[Y,-70,3.6,yt],[Y,0,3.6,xt,0],[Y,80,3.6,xt,0],[X,-60,3.6,Z],[X,40,3.6,Z,0],[X,120,3.6,Z,0],...[150,50,-40].map(e=>[e,J,3.6,gt]),[-120,J,3.6,gt,0],...[-230,-80,75,140].map(e=>[e,Q,3.6,Z,0])]},$=n(),wt=(e,t)=>we(e,t,10),Tt=(e,t)=>_(e,t,`heatret`,!0),Et=(e,t)=>_(e,t,`heat`,!0),Dt=(e,t)=>_e(e,t,Ze),Ot=ve(Ze);function kt({id:e,spec:t,intro:n}){let r=s();return(0,$.jsx)(o,{html:(0,Fe.useMemo)(()=>Le(r,t),[r,t]),asset:e,intro:n})}function At({ids:e}){let t=s(),n=g(Ct,st),r=(0,Fe.useMemo)(()=>y(t,qe)+t.plinth(We)+t.plinth(Ge)+t.plinth(Ke),[t]),i=e=>(0,$.jsx)(o,{html:`${n.layers[e]??``}<g data-flows="${e}" data-depth="${e===0?-1e9:ot[e-1]??0}"></g>`,data:{pipes:``}},`pipes-${e}`),a=(e,t,n,r)=>(0,$.jsx)(h,{from:Qe,to:le(t.c),scale:t.scale,children:(0,$.jsx)(c,{id:e,plan:ce,intro:r,draw:n})}),l=[e.boilerA,e.boilerB,e.boilerC],u={hospital:e.hospital,university:e.university,residential:e.residential,office:e.office},d={accumulator:(0,$.jsx)(h,{to:le(Xe),children:(0,$.jsx)(c,{id:e.accumulator,plan:Ot,intro:5,draw:Dt})}),primaryA:a(e.primaryA,N.primaryA,Tt,6),primaryB:a(e.primaryB,N.primaryB,Tt,7),networkA:a(e.networkA,N.networkA,Et,8),networkB:a(e.networkB,N.networkB,Et,9)};for(let[e,t]of Ye.entries())d[`boiler${e}`]=(0,$.jsx)(h,{to:le(t),children:(0,$.jsx)(c,{id:l[e]??``,plan:Ce,intro:2+e,draw:wt})});for(let[e,t]of rt.entries()){let n=u[t.key];d[`${t.key}-building`]=(0,$.jsx)(kt,{id:n,spec:t.building,intro:10+e}),d[t.key]=(0,$.jsx)(h,{to:le(t.skid),children:(0,$.jsx)(c,{id:n,plan:Ve,intro:11+e,draw:He})})}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(o,{html:r,data:{plinth:``}}),i(0),at.flatMap((e,t)=>[(0,$.jsx)(`g`,{children:d[e.key]},e.key),i(t+1)])]})}var jt=x(Je),Mt=v(jt,Ct,st),Nt=ne({layout:{width:Ue,height:620,label:`Isometric model of the District Heating network: the heat plant with three gas boilers, the thermal accumulator and two primary pumps; the network pump house with two trunk pumps; and four customers (a hospital, a university, a residential block and an office park), each with its substation, joined by the supply and return trunk main. Every moving part follows live values from the running engine.`,kit:jt,flows:Mt.flows,joints:Mt.joints,Scene:At,compose:Pe},resolve:Oe,things:ke,caption:`heat plant · network · customers`,mismatch:`This floor expects the District Heating network: three boilers, the accumulator and two primary pumps, two network pumps, and the hospital, university, residential and office substations, by area and line.`,statusBasis:`availability`,Overview:f,tab:`Network`});export{Nt as heatingFloor};
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{ot as n}from"./vendor-ui-D8j69UH4.js";import{T as r,b as i,c as a,d as o,f as s,l as c,m as l,n as u,s as d}from"./dom-CQuChC3G.js";import{n as f,t as ee}from"./by-path-CGbqDnvK.js";import{A as p,B as m,C as te,D as h,E as g,F as _,H as v,L as y,P as b,V as x,X as ne,_ as re,a as S,b as ie,c as ae,g as C,h as oe,i as se,j as ce,k as le,n as ue,o as de,r as fe,s as pe,t as me,w as he,x as ge}from"./status-DNfdEhTs.js";import{i as _e,n as ve,r as ye,t as be}from"./tank-xgQfMS2d.js";import{t as xe}from"./stages-C0cErwSQ.js";import{a as Se,n as Ce,o as we,r as Te,t as Ee}from"./boiler-BQwqgoVY.js";var De=[[`boilerA`,`hot-water-boiler`,`heat-plant`,`boilers`,0],[`boilerB`,`hot-water-boiler`,`heat-plant`,`boilers`,1],[`boilerC`,`hot-water-boiler`,`heat-plant`,`boilers`,2],[`primaryA`,`centrifugal-pump`,`heat-plant`,`primary-loop`,0],[`primaryB`,`centrifugal-pump`,`heat-plant`,`primary-loop`,1],[`accumulator`,`storage-tank`,`heat-plant`,`primary-loop`,0],[`networkA`,`centrifugal-pump`,`network`,`trunk-main`,0],[`networkB`,`centrifugal-pump`,`network`,`trunk-main`,1],[`hospital`,`heat-substation`,`customers`,`hospital`,0],[`university`,`heat-substation`,`customers`,`university`,0],[`residential`,`heat-substation`,`customers`,`residential`,0],[`office`,`heat-substation`,`customers`,`office-park`,0]],Oe=e=>ee(De,e);function ke(e){let t=(e,t,n)=>({key:e,assetId:e,name:t,kind:`utility`,area:n});return[t(e.boilerA,`Boiler 1 (lead)`,`Heat plant`),t(e.boilerB,`Boiler 2`,`Heat plant`),t(e.boilerC,`Boiler 3`,`Heat plant`),t(e.accumulator,`Thermal accumulator`,`Heat plant`),t(e.primaryA,`Primary pump A`,`Heat plant`),t(e.primaryB,`Primary pump B`,`Heat plant`),t(e.networkA,`Network pump A`,`Network`),t(e.networkB,`Network pump B`,`Network`),t(e.hospital,`Hospital substation`,`Customers`),t(e.university,`University substation`,`Customers`),t(e.residential,`Residential substation`,`Customers`),t(e.office,`Office park substation`,`Customers`)]}var Ae=3600/(4186*30*.97),je=8,Me=e=>Number(e.dataset.win)*37%101;function Ne(e){let{svg:t,P:n,feed:i}=e,o=(e,t)=>i.num(e,t),s=u(t,`[data-valve]`).map(e=>{let n=pe(e),r=e=>u(t,`[data-asset="${n}"] ${e}`),i=r(`[data-spin="sub"]`)[0];return{id:n,el:e,at:d(e.dataset.valve),rotor:i,rotorAt:ae(i?.dataset.at),rotorR:Number(i?.dataset.radius)||2,foul:r(`[data-foul]`)[0],act:r(`[data-act]`)[0],wins:r(`[data-win]`).sort((e,t)=>Me(e)-Me(t)),valve:0,rate:0,spin:0,lit:-1,heat:ge(te(t,n),3,2),ret:ae(e.dataset.ret)}}),c=new Map(s.map(e=>[e.id,e]));return{draw(t,c,l){let u=e.reducedMotion();for(let e of s){e.valve=re(e.valve,C(o(e.id,`control_valve_position`)/100),t,.6,u);let[s=0,d=0,f=0,ee=4]=e.at;if(a(e.el,`d`,r([s,d],[s,d],f,n)+r([s-1.6,d],[s+1.6,d],f+e.valve*ee,n)),e.rate=re(e.rate,o(e.id,`circulation_pump_speed`)/100*je,t,.8,u),u||(e.spin+=e.rate*t),e.rotor){let[t,i,o]=e.rotorAt,s=``;for(let a=0;a<3;a++){let c=e.spin+a*oe/3;s+=r([t,i],[t+Math.cos(c)*e.rotorR,i+Math.sin(c)*e.rotorR],o,n)}a(e.rotor,`d`,s)}e.foul&&(e.foul.style.opacity=l&&he(i,e.id,`hx_fouling`)?`0.85`:`0`);let p=l&&he(i,e.id,`valve_stuck`);a(e.act,`data-s`,p&&Math.sin(c*6)>0?`a`:null),e.heat.draw(l&&!u&&he(i,e.id,`low_delta_t`),c,n,e.ret);let m=Math.round(C(o(e.id,`occupancy_pu`))*e.wins.length);if(m!==e.lit){e.lit=m;for(let[t,n]of e.wins.entries())a(n,`data-on`,t<m?``:null)}}},bar(e){return c.has(e)?C(o(e,`heat_delivered_kw`)/i.param(e,`design_load_kw`,500)):void 0},flowPu(e){let t=i.param(e,`design_load_kw`,0)*Ae;return t>0?C(o(e,`primary_flow`)/t):0}}}var w=e=>e>.002?6+26*C(e*2):0,Pe=e=>{let{svg:t,feed:n,ids:r}=e,i=ie(t),a=fe(e,i),o=Ee(e,i),s=be(e),c=Ne(e),l=[a,o,s,c],u=se(e,e=>ue(n,e,`availability`)),d=de(e,{needle:e=>o.needle(e)??0,bar:e=>l.reduce((t,n)=>t??n.bar(e),void 0)??0,alertsHigh:()=>!0,ready:()=>!0}),f=()=>a.flowPu(r.primaryA)+a.flowPu(r.primaryB),ee=()=>a.flowPu(r.networkA)+a.flowPu(r.networkB),p=[r.boilerA,r.boilerB,r.boilerC],m=e=>{let t=p.filter(e=>o.circulating(e)).length;return o.circulating(e)?f()/t:0},te=new Map([[`hospital`,r.hospital],[`university`,r.university],[`residential`,r.residential],[`office`,r.office]]),h=S(e,({id:e})=>{switch(e){case`sup-1`:return w(m(r.boilerA));case`sup-2`:case`ret-2`:return w(m(r.boilerB));case`sup-3`:case`ret-3`:return w(m(r.boilerC));case`sup-23`:return w(m(r.boilerB)+m(r.boilerC));case`to-acc`:return w(f());case`ret-a`:case`suction-pa`:return w(a.flowPu(r.primaryA));case`ret-collect`:return w(f());case`ret-12`:return w(m(r.boilerA)+m(r.boilerB));case`ret-1`:return w(m(r.boilerA));case`ret-b`:case`suction-b`:return w(a.flowPu(r.primaryB));case`suction-a`:case`sup-a`:return w(a.flowPu(r.networkA));case`sup-b`:case`suction-nb`:return w(a.flowPu(r.networkB));case`acc-out`:case`trunk-sup`:case`trunk-ret`:return w(ee());default:{let t=te.get(e.slice(0,e.lastIndexOf(`-`)));return t?w(c.flowPu(t)):0}}});return{data(e){u.draw(e)},draw({sdt:e,t,introDone:n}){h.draw(e),d.draw(e,t);for(let r of l)r.draw(e,t,n)},resync(){},status:e=>me(n,e,`availability`)}},Fe=e(t(),1),Ie=11;function Le(e,t){let{k:n,P:r,S:i,L:a,slab:o,cyl:s}=e,{plan:c,floors:l,kind:u}=t,d=l*14+4,f=[],ee=e=>a(e,{tone:`faint`}),p=Array.from({length:l-1},(e,t)=>n.sideSeam(c,4+(t+1)*14,r,2)).join(``);f.push(i(n.slabOf(c,0,d,r,2,.6),{tone:u===`office`?`lo`:`mid`,inner:ee(p)})),f.push(a(n.planOutline(n.insetPlan(c,2),d,r,2),{tone:`lo`})),f.push(o({x:c.x+c.w*.2,y:c.y+c.d*.2,w:18,d:12,r:1},d,7,{tone:`mid`},2,.3)),f.push(s(c.x+c.w*.7,c.y+c.d*.35,4,d,9,{tone:`mid`},20));let m=[],te=0,h=(e,t,n)=>`<path class="bd-win" data-win="${te++}" d="M${e.toFixed(1)} ${(-(t+8)).toFixed(1)}H${(e+n).toFixed(1)}V${(-t).toFixed(1)}H${e.toFixed(1)}Z"/>`,g=u===`office`;for(let[t,i,a]of[[c.w,e.front(c.y+c.d),c.x],[c.d,n.sideMatrix([c.x+c.w,c.y+c.d],0,r,`right`),0]]){let e=Math.max(1,Math.floor((t-6)/Ie)),n=a+(t-e*Ie)/2,r=[];for(let t=0;t<l;t++){let i=7+t*14;if(g)r.push(h(n+1,i,e*Ie-2));else for(let t=0;t<e;t++)r.push(h(n+t*Ie+2,i,Ie-4))}m.push(`<g transform="${i}">${r.join(``)}</g>`)}f.push(...m);let _=c.x+c.w/2,v=c.y+c.d,y=(e,t,n,r,i,a=0)=>{let l=c.x+c.w/2+a;f.push(o({x:l-4.5,y:v,w:9,d:.6,r:.2},0,n-1,{tone:`lo`},2,0),...[-1,1].flatMap(r=>[s(l+r*(e-3)/2,v+t-1.2,1.7,0,.8,{tone:`lo`},14),s(l+r*(e-3)/2,v+t-1.2,i,.8,n-.8,{tone:`mid`},12)]),o({x:l-e/2,y:v,w:e,d:t,r:.5},n,1.4,{tone:r},2,.2))};if(u===`hospital`)f.push(o({x:_-6,y:v-1,w:12,d:1.2,r:.4},d-14,12,{tone:`lo`},2,0)),f.push(`<g transform="${e.front(v+.25)}"><path class="bd-cross" d="M${_-1.4} ${-(d-3.6)}H${_+1.4}V${-(d-6.6)}H${_+4.4}V${-(d-9.4)}H${_+1.4}V${-(d-12.4)}H${_-1.4}V${-(d-9.4)}H${_-4.4}V${-(d-6.6)}H${_-1.4}Z"/></g>`),y(24,8,12,`mid`,.9);else if(u===`university`)y(30,9,18,`mid`,1.8,-16);else if(u===`residential`)for(let e=1;e<l;e++)f.push(o({x:c.x+4,y:v,w:c.w-8,d:4,r:.4},4+e*14,1,{tone:`mid`},2,0));else y(20,7,14,`mid`,.9);return f.join(``)}var T=1.8,E=4,D=-14,O=[-5,5],k=[10,26],A=[26,k[0]],j=13,Re=17.5,ze=2.2,Be=-26,M=[[O[0],28,k[1]],[O[0],28,k[0]]],Ve={x:-16,y:-24,w:34,d:54,r:2};function He(e,t){let{k:n,G:r,P:i,at:a,S:o,L:s,D:c,slab:l,cyl:u,hmi:d,screws:f,faceRule:ee}=e,p=[];p.push(l({x:-14,y:-22,w:30,d:50,r:2},0,3,{tone:`lo`},3,.4)),p.push(f(n.corners({x:-14,y:-22,w:30,d:50},2.4),3)),p.push(l({x:-1.2,y:D-6,w:2.4,d:3,r:.4},3,36,{tone:`mid`},2,.2),l({x:-1.4,y:D-6,w:2.8,d:E-D+9,r:.4},36,2.6,{tone:`mid`},2,.2)),p.push(l({x:-10,y:D-3,w:20,d:3,r:.6},3,33,{tone:`mid`},2,.3));let te=[];for(let e=D+.8;e<E-.4;e+=.9)te.push(n.segment([9,e,6],[9,e,33],i));p.push(o(n.slabOf({x:-9,y:D,w:18,d:E-D,r:.4},5,29,i,2,.2),{tone:`lo`,inner:s(te.join(``),{tone:`faint`})}));let h=[[9.1,D+.4,6],[9.1,E-.4,6],[9.1,E-.4,33],[9.1,D+.4,33]].map(e=>a(e));p.push(`<path class="sf-grime" data-foul="" style="opacity:0" d="${n.pathOf(h,!0)}"/>`),p.push(l({x:-11,y:E,w:22,d:3.4,r:.6},3,35,{tone:`mid`},2,.3));let g=E+3.4;p.push(c([-10.4,10.4].flatMap(e=>[7,31].map(t=>a([e,g,t]))),{size:.5}));for(let e of O)for(let t of k){let n=r.frameAlong([e,g,t],[0,1,0]);p.push(o(r.disc(0,2.2,T+.2,n,i),{tone:`mid`}),o(r.disc(2.2,3,T+1.4,n,i),{tone:`mid`}))}let _=(e,t)=>[O[e],g+3,k[t]],[v,y]=M;p.push(m(e,[v,_(0,1)],T,`mid`,3,`heat`),m(e,[_(0,0),y],T,`mid`,3,`heatret`));for(let e of[v,y]){let t=r.frameAlong([e[0],e[1]-1.6,e[2]],[0,1,0]);p.push(o(r.disc(0,1.6,T+1.2,t,i),{tone:`mid`}))}let[b,,x]=v,ne=r.frameAlong([b,14,x],[0,1,0]);p.push(o(r.disc(0,1,T+1.4,ne,i),{tone:`mid`}),o(r.solidOf([[1,2.6],[2.6,3.6,1],[5.4,3.6,1],[7,2.6]],ne,i),{tone:`mid`}),o(r.disc(7,8,T+1.4,ne,i),{tone:`mid`}),u(b,18,1.2,x+3,4,{tone:`mid`,crease:`none`},12),u(b,18,4.4,x+7,2,{tone:`mid`},24),u(b,18,4.8,x+9,5,{tone:`mid`,crease:`lo`},28));let re=a([b+4.8,18,x+11.5]);p.push(`<path class="iso-line" data-tone="lit" data-valve="${b},21,${x+14},4" data-ret="${y[0]},${y[1]-4},${y[2]+2}" d=""/>`,`<circle class="sb-act" data-act="" cx="${re[0].toFixed(2)}" cy="${re[1].toFixed(2)}" r="0.6"/>`);let S=[O[1],g+14,k[1]],ie=(e,t)=>{let n=r.frameAlong([e,-30,t],[0,1,0]);return o(r.disc(0,1.2,T+2.6,n,i),{tone:`mid`})+o(r.disc(1.2,ze,T+1.4,n,i),{tone:`mid`})},ae=(e,t)=>u(e,Be,2.4,0,1,{tone:`lo`},18)+u(e,Be,.9,1,t-T-2.6,{tone:`mid`,crease:`none`},12)+u(e,Be,1.8,t-T-1.6,1,{tone:`mid`},16),C=-30+ze;return p.push(ie(j,A[0]),ie(j,A[1]),ae(j,A[1]),ae(Re,A[0]),l({x:j-1,y:Be-.9,w:Re-j+1.9,d:1.8,r:.3},A[0]-T-1.6,1,{tone:`mid`},2,0),m(e,[_(1,1),S,[j,S[1],A[0]],[j,C,A[0]]],T,`mid`,4,`heat`,[!0,!1]),m(e,[_(1,0),[O[1],g+16,k[0]],[j,g+16,k[0]],[j,C,A[1]]],T,`mid`,4,`heatret`,[!0,!1])),p.push(u(S[0],S[1],3.6,k[1]-3,6,{tone:`mid`},24)),p.push(u(S[0],S[1],3,k[1]+3,7,{tone:`mid`,crease:`lo`},24)),p.push(`<path class="iso-line" data-tone="lo" data-spin="sub" data-at="${S[0]},${S[1]},${k[1]+10}" data-radius="2.4" d=""/>`),p.push(l({x:-14,y:10,w:6,d:8,r:.6},3,22,{tone:`mid`},2,.3)),p.push(d(t,18,-13.6,-8.4,8,21)),p.push(ee(18,-13.6,4,5,2)),p.join(``)}var Ue=1e3,We={x:-380,y:-360,w:305,d:315,r:8},Ge={x:-60,y:-300,w:240,d:150,r:8},Ke={x:-380,y:-15,w:620,d:200,r:8},qe={x:-400,y:-380,w:660,d:585,r:16},Je=i([...l(qe,-21,-14),...l(We,-14,120),...l(Ge,-14,90),...l(Ke,-14,110)],Ue,620,{pad:22,azimuth:60}),Ye=[[-262,-335],[-262,-245],[-262,-155]],Xe=[-120,-255],Ze={r:34,h:118,windowX:6,panelX:40,nozzles:[{angle:180,z:80,r:3.4,role:`inlet`},{angle:0,z:80,r:3.4,role:`outlet`}]},Qe=[94,-130,0],N={primaryA:{c:[-255,-78],scale:1},primaryB:{c:[-130,-78],scale:1},networkA:{c:[0,-190],scale:1.15},networkB:{c:[135,-190],scale:1.15}},$e=[b[0]-Qe[0],b[1]-Qe[1],b[2]],et=[p[0]-Qe[0],p[1]-Qe[1],p[2]],tt=18,nt=(e,t,n,r,i)=>({key:e,skid:[t+n/2-tt,104],building:{kind:e,plan:{x:t-n/2,y:74-r,w:n,d:r,r:2},floors:i}}),rt=[nt(`hospital`,150,112,62,4),nt(`university`,-5,120,64,3),nt(`residential`,-158,68,56,5),nt(`office`,-300,92,58,4)],it=xe([...Ye.map((e,t)=>({key:`boiler${t}`,at:e,h:60})),{key:`accumulator`,at:Xe,h:Ze.h+12},...Object.entries(N).map(([e,t])=>({key:e,at:t.c,h:45})),...rt.flatMap(e=>[{key:`${e.key}-building`,at:[e.building.plan.x+e.building.plan.w/2,e.building.plan.y+e.building.plan.d/2],h:e.building.floors*14+4},{key:e.key,at:e.skid,h:40}])],Je),at=it.order,ot=it.slotDepths,st=it.depth,ct=(e,t)=>[e.c[0]+t[0]*e.scale,e.c[1]+t[1]*e.scale,t[2]*e.scale],P=(e,t,n,r)=>[t??e[0],n??e[1],r??e[2]],lt=e=>{let t=Ze.nozzles[e],[n,r,i]=t?ye(Ze,t):[0,0,0];return[Xe[0]+n,Xe[1]+r,i]},F=(Ye[0]?.[0]??0)+Se[0],I=(Ye[0]?.[0]??0)+Te[0],ut=Se[2],L=80,R=84,[dt=0,z=0,ft=0]=Ye.map(e=>e[1]),pt=lt(0),B=lt(1),{primaryA:V,primaryB:H,networkA:U,networkB:W}=N,G=e=>ct(e,[et[0],et[1],et[2]-3]),K=e=>ct(e,$e),mt=10,q=e=>P(K(e),K(e)[0]+mt*e.scale,null,null),ht=72,J=-106,gt=K(V)[2],Y=220,X=232,_t=3.2*N.networkA.scale,vt=100,yt=vt-18,bt=-40,xt=M[0][2],Z=M[1][2],Q=104+M[0][1]+30,St=Math.min(...rt.map(e=>e.skid[0]))+M[0][0]-14,Ct={z:10,flanged:!0,routes:[{id:`sup-1`,medium:`heat`,r:3.2,pts:[[F,dt,ut],[F,dt,L],[F,pt[1],L]]},{id:`sup-23`,medium:`heat`,r:3.2,reverse:!0,pts:[[F,pt[1],L],[F,z,L]]},{id:`sup-3`,medium:`heat`,r:3.2,reverse:!0,pts:[[F,z,L],[F,ft,L],[F,ft,ut]]},{id:`sup-2`,medium:`heat`,r:3.2,pts:[[F,z,ut],[F,z,L]]},{id:`to-acc`,medium:`heat`,r:3.4,pts:[[F,pt[1],L],pt]},{id:`ret-b`,medium:`heatret`,r:3.2,fromStub:!0,pts:[G(H),P(G(H),null,null,ht),P(G(V),null,null,ht)]},{id:`ret-a`,medium:`heatret`,r:3.2,fromStub:!0,pts:[G(V),P(G(V),null,null,ht)]},{id:`ret-collect`,medium:`heatret`,r:3.2,bend:6,pts:[P(G(V),null,null,ht),P(G(V),I,null,ht),P(G(V),I,null,R),[I,ft,R]]},{id:`ret-12`,medium:`heatret`,r:3.2,pts:[[I,ft,R],[I,z,R]]},{id:`ret-1`,medium:`heatret`,r:3.2,pts:[[I,z,R],[I,dt,R],[I,dt,ut]]},{id:`ret-2`,medium:`heatret`,r:3.2,pts:[[I,z,R],[I,z,ut]]},{id:`ret-3`,medium:`heatret`,r:3.2,pts:[[I,ft,R],[I,ft,ut]]},{id:`acc-out`,medium:`heat`,r:3.4,pts:[B,P(q(U),null,B[1],B[2])]},{id:`suction-nb`,medium:`heat`,r:3.4,pts:[P(q(U),null,B[1],B[2]),P(B,q(W)[0],null,null),P(q(W),null,B[1],null),q(W),K(W)]},{id:`suction-a`,medium:`heat`,r:3.4,pts:[P(q(U),null,B[1],B[2]),P(q(U),null,B[1],null),q(U),K(U)]},...rt.flatMap(e=>{let[t,n]=e.skid,r=[t+M[0][0],n+M[0][1],xt],i=[t+M[1][0],n+M[1][1],Z];return[{id:`${e.key}-sup`,medium:`heat`,r:1.8,pts:[P(r,null,Q,null),r]},{id:`${e.key}-ret`,medium:`heatret`,r:1.8,pts:[i,P(i,null,Q,null)]}]}),{id:`trunk-ret`,medium:`heatret`,r:3.6,blind:[!0,!1],pts:[[St,Q,Z],[X,Q,Z],[X,J,Z],[X,J,gt],P(q(H),null,J,null)]},{id:`suction-pa`,medium:`heatret`,r:3.6,pts:[P(q(H),null,J,null),P(q(V),null,J,null),q(V),K(V)]},{id:`sup-a`,medium:`heat`,r:_t,fromStub:!0,pts:[G(U),P(G(U),null,null,vt),P(G(W),null,null,vt)]},{id:`trunk-sup`,medium:`heat`,r:3.6,blind:[!1,!0],pts:[P(G(W),null,null,vt),[Y,G(U)[1],vt],[Y,G(U)[1],yt],[Y,bt,yt],[Y,bt,xt],[Y,Q,xt],[St,Q,xt]]},{id:`sup-b`,medium:`heat`,r:_t,fromStub:!0,pts:[G(W),P(G(W),null,null,vt)]},{id:`suction-b`,medium:`heatret`,r:3.2,pts:[K(H),q(H),P(q(H),null,J,null)]}],posts:[[Y,-130,3.6,yt],[Y,-70,3.6,yt],[Y,0,3.6,xt,0],[Y,80,3.6,xt,0],[X,-60,3.6,Z],[X,40,3.6,Z,0],[X,120,3.6,Z,0],...[150,50,-40].map(e=>[e,J,3.6,gt]),[-120,J,3.6,gt,0],...[-230,-80,75,140].map(e=>[e,Q,3.6,Z,0])]},$=n(),wt=(e,t)=>we(e,t,10),Tt=(e,t)=>_(e,t,`heatret`,!0),Et=(e,t)=>_(e,t,`heat`,!0),Dt=(e,t)=>_e(e,t,Ze),Ot=ve(Ze);function kt({id:e,spec:t,intro:n}){let r=s();return(0,$.jsx)(o,{html:(0,Fe.useMemo)(()=>Le(r,t),[r,t]),asset:e,intro:n})}function At({ids:e}){let t=s(),n=g(Ct,st),r=(0,Fe.useMemo)(()=>y(t,qe)+t.plinth(We)+t.plinth(Ge)+t.plinth(Ke),[t]),i=e=>(0,$.jsx)(o,{html:`${n.layers[e]??``}<g data-flows="${e}" data-depth="${e===0?-1e9:ot[e-1]??0}"></g>`,data:{pipes:``}},`pipes-${e}`),a=(e,t,n,r)=>(0,$.jsx)(h,{from:Qe,to:le(t.c),scale:t.scale,children:(0,$.jsx)(c,{id:e,plan:ce,intro:r,draw:n})}),l=[e.boilerA,e.boilerB,e.boilerC],u={hospital:e.hospital,university:e.university,residential:e.residential,office:e.office},d={accumulator:(0,$.jsx)(h,{to:le(Xe),children:(0,$.jsx)(c,{id:e.accumulator,plan:Ot,intro:5,draw:Dt})}),primaryA:a(e.primaryA,N.primaryA,Tt,6),primaryB:a(e.primaryB,N.primaryB,Tt,7),networkA:a(e.networkA,N.networkA,Et,8),networkB:a(e.networkB,N.networkB,Et,9)};for(let[e,t]of Ye.entries())d[`boiler${e}`]=(0,$.jsx)(h,{to:le(t),children:(0,$.jsx)(c,{id:l[e]??``,plan:Ce,intro:2+e,draw:wt})});for(let[e,t]of rt.entries()){let n=u[t.key];d[`${t.key}-building`]=(0,$.jsx)(kt,{id:n,spec:t.building,intro:10+e}),d[t.key]=(0,$.jsx)(h,{to:le(t.skid),children:(0,$.jsx)(c,{id:n,plan:Ve,intro:11+e,draw:He})})}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(o,{html:r,data:{plinth:``}}),i(0),at.flatMap((e,t)=>[(0,$.jsx)(`g`,{children:d[e.key]},e.key),i(t+1)])]})}var jt=x(Je),Mt=v(jt,Ct,st),Nt=ne({layout:{width:Ue,height:620,label:`Isometric model of the District Heating network: the heat plant with three gas boilers, the thermal accumulator and two primary pumps; the network pump house with two trunk pumps; and four customers (a hospital, a university, a residential block and an office park), each with its substation, joined by the supply and return trunk main. Every moving part follows live values from the running engine.`,kit:jt,flows:Mt.flows,joints:Mt.joints,Scene:At,compose:Pe},resolve:Oe,things:ke,caption:`heat plant · network · customers`,mismatch:`This floor expects the District Heating network: three boilers, the accumulator and two primary pumps, two network pumps, and the hospital, university, residential and office substations, by area and line.`,statusBasis:`availability`,Overview:f,tab:`Network`});export{Nt as heatingFloor};
@@ -0,0 +1 @@
1
+ import{t as e}from"./events-Cb1faGh2.js";export{e as EventsPage};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{ot as n}from"./vendor-ui-D8j69UH4.js";import{S as r,o as i,v as a,vt as o}from"./api-GfuYYI6q.js";import{f as s,t as c}from"./useQuery-BfWNkVkT.js";import{t as l}from"./proxy-CWZabK8f.js";import{t as u}from"./AnimatePresence-BSSlw02V.js";import{u as d}from"./chunk-OE4NN4TA-DBWZidbW.js";import{C as f}from"./format-Bx7DF-TB.js";import{t as p}from"./query-fetch-error-CWLZA2L5.js";import{n as m,t as ee}from"./use-transition-navigate-aOjMH_eS.js";import{t as h}from"./badge-Bk1DaL6C.js";import{n as te}from"./transition-types-BKZuWApE.js";import{n as ne}from"./auth-screen-backdrop-CEykEbfF.js";import{n as g}from"./get-error-message-DJGhcwLn.js";import{r as re}from"./runtime-link-BRnaEnOm.js";import{a as ie,i as ae,n as oe,o as se,r as ce,s as le,t as ue}from"./combobox-B8h0-NHs.js";import{c as de,i as _,n as fe,s as pe,t as v}from"./select-BWlrSYlA.js";import{a as y,c as b,i as x,o as S,r as me,s as he,t as ge}from"./select-display-items-DN2G8DNG.js";import{a as _e,c as ve,i as ye,n as be,o as xe,r as Se,s as Ce,t as C}from"./events-format-C5HTkIsC.js";var w=e(t(),1),T=n(),E=1500;function D(){let e=s(),[t]=d(),n=t.get(`type`)??`all`,D=t.get(`assetId`)??``,[O,k]=(0,w.useState)(n),[A,j]=(0,w.useState)(D),[M,we]=(0,w.useState)(!0),N=re(o(e=>e.connectionState))===null,P=o(e=>e.events.length),F=(0,w.useRef)(!1),I=o(e=>e.assets),Te=ee(),L=c({queryKey:a.events(O,A),queryFn:()=>i(C(O,A,null),r.events),refetchInterval:M&&N?E:!1,staleTime:5e3}),[Ee,R]=(0,w.useState)([]),[De,z]=(0,w.useState)(!1),[Oe,B]=(0,w.useState)(null),V=`${O}::${A}`,H=(0,w.useRef)(V);(0,w.useEffect)(()=>{V!==H.current&&(H.current=V,R([]),B(null),W(!1))},[V]),(0,w.useEffect)(()=>{k(e=>e===n?e:n)},[n]),(0,w.useEffect)(()=>{j(e=>e===D?e:D)},[D]);let[U,W]=(0,w.useState)(()=>(L.data?.events.length??0)>0),G=L.data?[L.data,...Ee]:[],K=G.flatMap(e=>e.events).filter(e=>!ve(e)),q=G[G.length-1],ke=q?.hasMore??!1;(0,w.useEffect)(()=>{K.length>0&&!U&&W(!0)},[K.length,U]);let J=(0,w.useRef)(P);(0,w.useEffect)(()=>{P!==J.current&&(J.current=P,M&&N?(e.invalidateQueries({queryKey:a.events(O,A)}),F.current=!1):M&&(F.current=!0))},[P,M,N,e,O,A]),(0,w.useEffect)(()=>{!M||!N||!F.current||(F.current=!1,e.invalidateQueries({queryKey:a.events(O,A)}))},[M,N,e,O,A]);let[Y,Ae]=(0,w.useState)(``),X=(0,w.useMemo)(()=>Y?I.filter(e=>e.id.toLowerCase().includes(Y.toLowerCase())):I,[I,Y]),Z=L.isPending&&!L.data&&!L.isError,je=M&&!Z&&!U&&K.length===0,Q=L.error??Oe,Me=L.isError&&!L.data,$=(0,w.useCallback)(()=>{L.refetch()},[L]),Ne=async()=>{if(q?.nextCursor){z(!0),B(null);try{let e=await i(C(O,A,q.nextCursor),r.events);R(t=>[...t,e])}catch(e){B(e instanceof Error?e:Error(g(e,`Failed to fetch events.`)))}finally{z(!1)}}};if(Me)return(0,T.jsx)(ne,{className:`min-h-full`,children:(0,T.jsx)(`div`,{className:`flex min-h-[40vh] flex-col items-center justify-center p-6 sm:p-12`,children:(0,T.jsx)(`div`,{className:`w-full max-w-md`,children:(0,T.jsx)(p,{message:g(Q,`Failed to fetch events.`),onRetry:$,isRetrying:L.isFetching})})})});let Pe=new Date;return(0,T.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&&K.length>0?(0,T.jsx)(p,{message:`${g(Q,`Failed to fetch events.`)} Showing cached events.`,onRetry:$,isRetrying:L.isFetching}):null,(0,T.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,T.jsxs)(`div`,{className:`min-w-0 flex flex-col gap-1`,children:[(0,T.jsx)(`h1`,{className:`font-heading text-2xl font-semibold tracking-tight`,children:`Event Log`}),(0,T.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Real-time event stream from the engine.`}),M&&!N?(0,T.jsx)(`p`,{className:`text-xs text-warning`,role:`status`,children:`Live refresh pauses until the Miravo link is live again.`}):null]}),(0,T.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,T.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,T.jsx)(u,{mode:`wait`,initial:!1,children:M?(0,T.jsxs)(l.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,T.jsx)(`span`,{className:`size-1.5 animate-pulse rounded-full bg-success`}),(0,T.jsx)(`span`,{className:`font-medium text-success`,children:`LIVE`})]},`live`):(0,T.jsxs)(l.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,T.jsx)(`span`,{className:`size-1.5 rounded-full bg-muted-foreground`}),(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:`Paused`})]},`paused`)})}),(0,T.jsx)(`div`,{className:`min-w-0 flex-1 lg:w-48 lg:flex-none`,children:(0,T.jsxs)(ue,{value:A||null,onValueChange:e=>{j(e??``)},onInputValueChange:Ae,children:[(0,T.jsx)(ce,{placeholder:`All assets`,className:`h-8 w-full min-w-0`,showClear:!!A}),(0,T.jsx)(oe,{children:(0,T.jsxs)(ie,{children:[X.map(e=>(0,T.jsx)(ae,{value:e.id,children:(0,T.jsx)(`span`,{className:`font-mono`,children:e.id})},e.id)),X.length===0&&(0,T.jsx)(`p`,{className:`py-2 text-center text-xs text-muted-foreground`,children:`No assets found`})]})})]})}),(0,T.jsx)(`div`,{className:`min-w-0 flex-1 lg:w-48 lg:flex-none`,children:(0,T.jsxs)(v,{value:O,onValueChange:e=>{k(e??`all`)},items:ge,children:[(0,T.jsx)(pe,{className:`w-full min-w-0 lg:w-48`,"aria-label":`Event type filter`,children:(0,T.jsx)(de,{placeholder:`Filter by type`})}),(0,T.jsxs)(fe,{alignItemWithTrigger:!1,align:`start`,children:[(0,T.jsx)(_,{value:`all`,children:`All events`}),(0,T.jsx)(_,{value:`fault:triggered`,children:`Fault Triggered`}),(0,T.jsx)(_,{value:`fault:cleared`,children:`Fault Cleared`}),(0,T.jsx)(_,{value:`lifecycle:changed`,children:`Lifecycle Changed`}),(0,T.jsx)(_,{value:`asset:maintenance`,children:`Maintenance`}),(0,T.jsx)(_,{value:`asset:created`,children:`Asset Created`}),(0,T.jsx)(_,{value:`asset:removed`,children:`Asset Removed`}),(0,T.jsx)(_,{value:`engine:state-changed`,children:`Engine State`})]})]})})]})]}),(0,T.jsx)(se,{className:`min-w-0 py-0`,children:(0,T.jsx)(le,{className:`p-0`,children:(0,T.jsxs)(me,{children:[(0,T.jsx)(he,{children:(0,T.jsxs)(b,{children:[(0,T.jsx)(S,{className:`hidden w-12 sm:table-cell`,children:`#`}),(0,T.jsx)(S,{children:`Type`}),(0,T.jsx)(S,{children:`Context`}),(0,T.jsx)(S,{children:`Details`}),(0,T.jsx)(S,{className:`hidden text-right md:table-cell`,children:`Cycle #`}),(0,T.jsx)(S,{className:`hidden text-right sm:table-cell`,children:`Wall Clock`})]})}),(0,T.jsxs)(x,{children:[K.map(e=>{let t=xe(e),n=Ce(e);return(0,T.jsxs)(b,{className:t?`transition-colors`:``,onMouseEnter:t?()=>m(`/asset/${t}`):void 0,children:[(0,T.jsx)(y,{className:`hidden font-mono text-xs text-muted-foreground sm:table-cell`,children:e.id}),(0,T.jsx)(y,{children:(0,T.jsx)(h,{variant:Se(e.type),className:`text-xs ${be(e.type)}`,children:e.type})}),(0,T.jsx)(y,{className:`font-mono text-xs`,children:t?(0,T.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:()=>m(`/asset/${t}`),onClick:()=>Te(`/asset/${t}`,{transitionType:te}),children:n??t}):n??`—`}),(0,T.jsx)(y,{className:`max-w-xs truncate font-mono text-xs`,children:ye(e)||(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,T.jsx)(y,{className:`hidden text-right font-mono text-xs md:table-cell`,children:e.tick}),(0,T.jsx)(y,{className:`hidden text-right text-xs text-muted-foreground sm:table-cell`,children:_e(e.timestamp,Pe)})]},e.id)}),!Z&&K.length===0&&(0,T.jsx)(b,{children:(0,T.jsx)(y,{colSpan:6,className:`py-8 text-center text-muted-foreground`,children:je?`Listening for events…`:`No events`})})]})]})})}),ke&&(0,T.jsx)(`div`,{className:`flex justify-center border-t border-border/40 pt-4`,children:(0,T.jsx)(f,{variant:`outline`,size:`sm`,onClick:()=>void Ne(),disabled:De,children:`Load older events`})})]})}export{D as t};
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{ot as n}from"./vendor-ui-D8j69UH4.js";import{S as r,o as i,v as a,vt as o}from"./api-CtMmjN9m.js";import{f as s,t as c}from"./useQuery-Dxp3WSXF.js";import{t as l}from"./proxy-CWZabK8f.js";import{t as u}from"./AnimatePresence-BSSlw02V.js";import{u as d}from"./chunk-OE4NN4TA-DBWZidbW.js";import{C as f}from"./format-Bx7DF-TB.js";import{t as p}from"./query-fetch-error-CWLZA2L5.js";import{n as m,t as ee}from"./use-transition-navigate-5-QJHk2I.js";import{t as h}from"./badge-Bk1DaL6C.js";import{n as te}from"./transition-types-BKZuWApE.js";import{n as ne}from"./auth-screen-backdrop-CEykEbfF.js";import{n as g}from"./get-error-message-D800c4Uu.js";import{r as re}from"./runtime-link-BRnaEnOm.js";import{a as ie,i as ae,n as oe,o as se,r as ce,s as le,t as ue}from"./combobox-B8h0-NHs.js";import{c as de,i as _,n as fe,s as pe,t as v}from"./select-BWlrSYlA.js";import{a as y,c as b,i as x,o as S,r as me,s as he,t as ge}from"./select-display-items-DN2G8DNG.js";import{a as _e,c as ve,i as ye,n as be,o as xe,r as Se,s as Ce,t as C}from"./events-format-C5HTkIsC.js";var w=e(t(),1),T=n(),E=1500;function D(){let e=s(),[t]=d(),n=t.get(`type`)??`all`,D=t.get(`assetId`)??``,[O,k]=(0,w.useState)(n),[A,j]=(0,w.useState)(D),[M,we]=(0,w.useState)(!0),N=re(o(e=>e.connectionState))===null,P=o(e=>e.events.length),F=(0,w.useRef)(!1),I=o(e=>e.assets),Te=ee(),L=c({queryKey:a.events(O,A),queryFn:()=>i(C(O,A,null),r.events),refetchInterval:M&&N?E:!1,staleTime:5e3}),[Ee,R]=(0,w.useState)([]),[De,z]=(0,w.useState)(!1),[Oe,B]=(0,w.useState)(null),V=`${O}::${A}`,H=(0,w.useRef)(V);(0,w.useEffect)(()=>{V!==H.current&&(H.current=V,R([]),B(null),W(!1))},[V]),(0,w.useEffect)(()=>{k(e=>e===n?e:n)},[n]),(0,w.useEffect)(()=>{j(e=>e===D?e:D)},[D]);let[U,W]=(0,w.useState)(()=>(L.data?.events.length??0)>0),G=L.data?[L.data,...Ee]:[],K=G.flatMap(e=>e.events).filter(e=>!ve(e)),q=G[G.length-1],ke=q?.hasMore??!1;(0,w.useEffect)(()=>{K.length>0&&!U&&W(!0)},[K.length,U]);let J=(0,w.useRef)(P);(0,w.useEffect)(()=>{P!==J.current&&(J.current=P,M&&N?(e.invalidateQueries({queryKey:a.events(O,A)}),F.current=!1):M&&(F.current=!0))},[P,M,N,e,O,A]),(0,w.useEffect)(()=>{!M||!N||!F.current||(F.current=!1,e.invalidateQueries({queryKey:a.events(O,A)}))},[M,N,e,O,A]);let[Y,Ae]=(0,w.useState)(``),X=(0,w.useMemo)(()=>Y?I.filter(e=>e.id.toLowerCase().includes(Y.toLowerCase())):I,[I,Y]),Z=L.isPending&&!L.data&&!L.isError,je=M&&!Z&&!U&&K.length===0,Q=L.error??Oe,Me=L.isError&&!L.data,$=(0,w.useCallback)(()=>{L.refetch()},[L]),Ne=async()=>{if(q?.nextCursor){z(!0),B(null);try{let e=await i(C(O,A,q.nextCursor),r.events);R(t=>[...t,e])}catch(e){B(e instanceof Error?e:Error(g(e,`Failed to fetch events.`)))}finally{z(!1)}}};if(Me)return(0,T.jsx)(ne,{className:`min-h-full`,children:(0,T.jsx)(`div`,{className:`flex min-h-[40vh] flex-col items-center justify-center p-6 sm:p-12`,children:(0,T.jsx)(`div`,{className:`w-full max-w-md`,children:(0,T.jsx)(p,{message:g(Q,`Failed to fetch events.`),onRetry:$,isRetrying:L.isFetching})})})});let Pe=new Date;return(0,T.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&&K.length>0?(0,T.jsx)(p,{message:`${g(Q,`Failed to fetch events.`)} Showing cached events.`,onRetry:$,isRetrying:L.isFetching}):null,(0,T.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,T.jsxs)(`div`,{className:`min-w-0 flex flex-col gap-1`,children:[(0,T.jsx)(`h1`,{className:`font-heading text-2xl font-semibold tracking-tight`,children:`Event Log`}),(0,T.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Real-time event stream from the engine.`}),M&&!N?(0,T.jsx)(`p`,{className:`text-xs text-warning`,role:`status`,children:`Live refresh pauses until the Miravo link is live again.`}):null]}),(0,T.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,T.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,T.jsx)(u,{mode:`wait`,initial:!1,children:M?(0,T.jsxs)(l.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,T.jsx)(`span`,{className:`size-1.5 animate-pulse rounded-full bg-success`}),(0,T.jsx)(`span`,{className:`font-medium text-success`,children:`LIVE`})]},`live`):(0,T.jsxs)(l.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,T.jsx)(`span`,{className:`size-1.5 rounded-full bg-muted-foreground`}),(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:`Paused`})]},`paused`)})}),(0,T.jsx)(`div`,{className:`min-w-0 flex-1 lg:w-48 lg:flex-none`,children:(0,T.jsxs)(ue,{value:A||null,onValueChange:e=>{j(e??``)},onInputValueChange:Ae,children:[(0,T.jsx)(ce,{placeholder:`All assets`,className:`h-8 w-full min-w-0`,showClear:!!A}),(0,T.jsx)(oe,{children:(0,T.jsxs)(ie,{children:[X.map(e=>(0,T.jsx)(ae,{value:e.id,children:(0,T.jsx)(`span`,{className:`font-mono`,children:e.id})},e.id)),X.length===0&&(0,T.jsx)(`p`,{className:`py-2 text-center text-xs text-muted-foreground`,children:`No assets found`})]})})]})}),(0,T.jsx)(`div`,{className:`min-w-0 flex-1 lg:w-48 lg:flex-none`,children:(0,T.jsxs)(v,{value:O,onValueChange:e=>{k(e??`all`)},items:ge,children:[(0,T.jsx)(pe,{className:`w-full min-w-0 lg:w-48`,"aria-label":`Event type filter`,children:(0,T.jsx)(de,{placeholder:`Filter by type`})}),(0,T.jsxs)(fe,{alignItemWithTrigger:!1,align:`start`,children:[(0,T.jsx)(_,{value:`all`,children:`All events`}),(0,T.jsx)(_,{value:`fault:triggered`,children:`Fault Triggered`}),(0,T.jsx)(_,{value:`fault:cleared`,children:`Fault Cleared`}),(0,T.jsx)(_,{value:`lifecycle:changed`,children:`Lifecycle Changed`}),(0,T.jsx)(_,{value:`asset:maintenance`,children:`Maintenance`}),(0,T.jsx)(_,{value:`asset:created`,children:`Asset Created`}),(0,T.jsx)(_,{value:`asset:removed`,children:`Asset Removed`}),(0,T.jsx)(_,{value:`engine:state-changed`,children:`Engine State`})]})]})})]})]}),(0,T.jsx)(se,{className:`min-w-0 py-0`,children:(0,T.jsx)(le,{className:`p-0`,children:(0,T.jsxs)(me,{children:[(0,T.jsx)(he,{children:(0,T.jsxs)(b,{children:[(0,T.jsx)(S,{className:`hidden w-12 sm:table-cell`,children:`#`}),(0,T.jsx)(S,{children:`Type`}),(0,T.jsx)(S,{children:`Context`}),(0,T.jsx)(S,{children:`Details`}),(0,T.jsx)(S,{className:`hidden text-right md:table-cell`,children:`Cycle #`}),(0,T.jsx)(S,{className:`hidden text-right sm:table-cell`,children:`Wall Clock`})]})}),(0,T.jsxs)(x,{children:[K.map(e=>{let t=xe(e),n=Ce(e);return(0,T.jsxs)(b,{className:t?`transition-colors`:``,onMouseEnter:t?()=>m(`/asset/${t}`):void 0,children:[(0,T.jsx)(y,{className:`hidden font-mono text-xs text-muted-foreground sm:table-cell`,children:e.id}),(0,T.jsx)(y,{children:(0,T.jsx)(h,{variant:Se(e.type),className:`text-xs ${be(e.type)}`,children:e.type})}),(0,T.jsx)(y,{className:`font-mono text-xs`,children:t?(0,T.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:()=>m(`/asset/${t}`),onClick:()=>Te(`/asset/${t}`,{transitionType:te}),children:n??t}):n??`—`}),(0,T.jsx)(y,{className:`max-w-xs truncate font-mono text-xs`,children:ye(e)||(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,T.jsx)(y,{className:`hidden text-right font-mono text-xs md:table-cell`,children:e.tick}),(0,T.jsx)(y,{className:`hidden text-right text-xs text-muted-foreground sm:table-cell`,children:_e(e.timestamp,Pe)})]},e.id)}),!Z&&K.length===0&&(0,T.jsx)(b,{children:(0,T.jsx)(y,{colSpan:6,className:`py-8 text-center text-muted-foreground`,children:je?`Listening for events…`:`No events`})})]})]})})}),ke&&(0,T.jsx)(`div`,{className:`flex justify-center border-t border-border/40 pt-4`,children:(0,T.jsx)(f,{variant:`outline`,size:`sm`,onClick:()=>void Ne(),disabled:De,children:`Load older events`})})]})}export{D 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,et as c,ot as l}from"./vendor-ui-D8j69UH4.js";import{S as u,Z as d,a as f,nt as p,o as m,s as h}from"./api-GfuYYI6q.js";import{a as g,c as _,i as v,n as y,o as b,r as x,t as ee}from"./dialog-B5PqrKVw.js";import{C as S,S as C,T as w}from"./format-Bx7DF-TB.js";import{n as T,t as E}from"./utils-XFKvwlFT.js";import{t as D}from"./chevron-down-x70Pto6j.js";import{t as O}from"./download-i8CTJ7oi.js";import{n as k,t as A}from"./source-host-miravo-B8eM2IHw.js";import{t as j}from"./loader-circle-DjgHgHHl.js";import"./use-engine-command-mutation-CTbPh58S.js";import{t as M}from"./label-2sIXTEUK.js";var N=T(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),P=l();function F({...e}){return(0,P.jsx)(o,{"data-slot":`sheet`,...e})}function I({...e}){return(0,P.jsx)(a,{"data-slot":`sheet-portal`,...e})}function L({className:e,...t}){return(0,P.jsx)(c,{"data-slot":`sheet-overlay`,className:E(`fixed inset-0 z-50 bg-black/10 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs`,e),...t})}function R({className:e,children:t,side:r=`right`,showCloseButton:i=!0,...a}){return(0,P.jsxs)(I,{children:[(0,P.jsx)(L,{}),(0,P.jsxs)(s,{"data-slot":`sheet-content`,"data-side":r,className:E(`fixed z-50 flex flex-col gap-4 bg-background bg-clip-padding text-sm shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-[calc(100vw-1rem)] data-[side=left]:max-w-md data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-[calc(100vw-1rem)] data-[side=right]:max-w-xl data-[side=right]:border-l data-[side=right]:pl-1 data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem]`,e),...a,children:[t,i&&(0,P.jsxs)(n,{"data-slot":`sheet-close`,render:(0,P.jsx)(S,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`}),children:[(0,P.jsx)(w,{}),(0,P.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function z({className:e,...t}){return(0,P.jsx)(`div`,{"data-slot":`sheet-header`,className:E(`flex flex-col gap-0.5 p-2`,e),...t})}function B({className:e,...t}){return(0,P.jsx)(r,{"data-slot":`sheet-title`,className:E(`text-base font-medium text-foreground`,e),...t})}function V({className:e,...t}){return(0,P.jsx)(i,{"data-slot":`sheet-description`,className:E(`text-sm text-muted-foreground`,e),...t})}var H=e(t(),1);function U({format:e,kind:t}){return e===`source-yaml`?t===`model`?`Raw asset model definition. Edit locally, version-control, or use as input for the CLI.`:`Raw factory definition with topology and namespace. Edit, share, or apply via CLI.`:e===`litmus-edge`?t===`model`?`Litmus Edge Digital Twin JSON for manual import via the Litmus Edge UI.`:`Litmus Edge template JSON (DeviceHub devices + Digital Twins). Import directly via the Litmus Edge UI.`:`Select a format to download.`}function W({children:e,className:t}){return(0,P.jsx)(`div`,{className:E(`max-h-[min(36rem,75vh)] min-h-0 overflow-y-auto rounded-[var(--miravo-radius-stadium-sm)] border border-border/60 p-4 sm:p-5`,t),children:e})}var G=[`modbus`,`opcua`,`mqtt`],K={modbus:`Modbus`,opcua:`OPC UA`,mqtt:`MQTT`};function q(e){return e===``?null:!/^\d+$/.test(e)||!p(Number(e))?`Use a port from 1 to 65535.`:null}function J(e){return Object.fromEntries(Object.entries(e??{}).map(([e,t])=>[e,String(t)]))}function Y(e,t,n){let r={...e};for(let e of n){let n=(t[e]??``).trim();if(q(n))return null;n===``?delete r[e]:r[e]=Number(n)}return r}function X({open:e,onOpenChange:t,protocols:n,values:r,onChange:i,hint:a}){let o=(0,H.useId)();return(0,P.jsxs)(`div`,{children:[(0,P.jsxs)(`button`,{type:`button`,onClick:()=>t(!e),"aria-expanded":e,className:`flex w-full items-center gap-1 text-left text-[11px] font-medium text-muted-foreground hover:text-foreground`,children:[(0,P.jsx)(D,{className:E(`size-3 transition-transform`,!e&&`-rotate-90`),"aria-hidden":!0}),`Miravo ports remapped (Docker)?`]}),e?(0,P.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[(0,P.jsx)(`p`,{className:`text-[11px] leading-snug text-muted-foreground`,children:a}),(0,P.jsx)(`div`,{className:`flex flex-wrap gap-3`,children:n.map(e=>{let t=r[e]??``,n=q(t.trim());return(0,P.jsxs)(`div`,{className:`w-24 space-y-1`,children:[(0,P.jsx)(M,{htmlFor:`${o}-${e}`,className:`text-[11px] text-muted-foreground`,children:K[e]}),(0,P.jsx)(C,{id:`${o}-${e}`,inputMode:`numeric`,placeholder:String(d[e]),value:t,"aria-invalid":n!==null,onChange:t=>i({...r,[e]:t.currentTarget.value}),className:`h-8 font-mono text-[12px]`}),n?(0,P.jsx)(`p`,{className:`text-[10px] text-destructive`,children:n}):null]},e)})})]}):null]})}var Z=`172.17.0.1`;async function Q(e){let t=await m(`/catalog/models/${encodeURIComponent(e)}/le-dt.json`,u.catalogModelLeDt);return JSON.stringify(t,null,2)}async function te(e,t={host:Z}){let n=u.catalogTemplateLeTemplateJson.query;if(!n)throw Error(`Missing query schema for ${u.catalogTemplateLeTemplateJson.method} ${u.catalogTemplateLeTemplateJson.path}`);let r=n.safeParse({host:t.host,protocol:t.protocol,modbusPort:t.exposedPorts?.modbus,opcuaPort:t.exposedPorts?.opcua,mqttPort:t.exposedPorts?.mqtt});if(!r.success)throw Error(`Invalid request for ${u.catalogTemplateLeTemplateJson.method} ${u.catalogTemplateLeTemplateJson.path}: ${r.error.message}`);return f(ne(e,r.data),u.catalogTemplateLeTemplateJson)}function ne(e,t){return`/catalog/templates/${encodeURIComponent(e)}/le-template.json${re(t)}`}function re(e){let t=new URLSearchParams;for(let[n,r]of Object.entries(e))r!==void 0&&r!==``&&t.set(n,String(r));return t.size>0?`?${t.toString()}`:``}function $(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,r.click(),URL.revokeObjectURL(n),_.success(`Exported ${t}`)}function ie({kind:e,id:t,yamlPath:n,yamlFilename:r}){let[i,a]=(0,H.useState)(!1),[o,s]=(0,H.useState)(Z),[c,l]=(0,H.useState)(!1),[d,f]=(0,H.useState)({}),[p,m]=(0,H.useState)(!1),w=(0,H.useCallback)(async()=>{try{let t=await h(n,e===`model`?u.catalogModelYaml:u.catalogTemplateYaml);$(new Blob([t],{type:`text/yaml`}),r)}catch{_.error(`Failed to export YAML`)}},[e,n,r]),T=(0,H.useCallback)(async()=>{try{let e=await Q(t);$(new Blob([e],{type:`application/json`}),`${t}.le-dt.json`)}catch{_.error(`Failed to export integration format`)}},[t]),E=(0,H.useCallback)(async(e,n)=>{try{let r=e.trim();return $(await te(t,{host:r.length>0?r:Z,exposedPorts:n}),`${t}.le-template.json`),!0}catch{return _.error(`Failed to export integration format`),!1}},[t]),D=(0,H.useCallback)(()=>{s(Z),f({}),l(!1),a(!0)},[]),N=(0,H.useCallback)(async()=>{let e=Y(void 0,d,G);if(!e){l(!0);return}m(!0);try{await E(o,e)&&a(!1)}finally{m(!1)}},[d,o,E]);return(0,P.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto pb-2`,children:[[{key:`source-yaml`,label:e===`model`?`Source YAML (.asset.yaml)`:`Source YAML (.miravo.yaml)`,onDownload:()=>void w()},{key:`litmus-edge`,label:e===`model`?`Litmus Edge Digital Twin (JSON)`:`Litmus Edge template (JSON)`,onDownload:e===`model`?()=>void T():D}].map(t=>(0,P.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-[var(--miravo-radius-stadium-sm)] border border-border/60 p-3`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,P.jsx)(`span`,{className:`text-xs font-medium text-foreground`,children:t.label}),(0,P.jsxs)(S,{variant:`outline`,size:`sm`,className:`h-8 shrink-0 gap-1.5 text-xs`,"aria-label":`Download ${t.label}`,onClick:t.onDownload,children:[(0,P.jsx)(O,{className:`size-3.5`,"aria-hidden":!0}),`Download`]})]}),(0,P.jsx)(`p`,{className:`text-[11px] leading-snug text-foreground/70`,children:(0,P.jsx)(U,{format:t.key,kind:e})})]},t.key)),(0,P.jsx)(ee,{open:i,onOpenChange:a,children:(0,P.jsxs)(y,{className:`sm:max-w-md`,children:[(0,P.jsxs)(g,{children:[(0,P.jsx)(b,{children:`Download Litmus Edge Template`}),(0,P.jsx)(x,{children:A})]}),(0,P.jsxs)(`div`,{className:`space-y-2 py-1`,children:[(0,P.jsx)(M,{htmlFor:`export-source-host`,children:k}),(0,P.jsx)(C,{id:`export-source-host`,value:o,onChange:e=>s(e.target.value),placeholder:Z,autoComplete:`off`,className:`font-mono text-sm`}),(0,P.jsxs)(`p`,{className:`text-[11px] leading-snug text-muted-foreground`,children:[`Use an IP or hostname reachable from Litmus Edge (e.g.`,` `,(0,P.jsx)(`span`,{className:`font-mono`,children:Z}),` for Docker bridge).`]}),(0,P.jsx)(X,{open:c,onOpenChange:l,protocols:G,values:d,onChange:f,hint:`Enter the host port Litmus Edge should dial. Leave blank to use Miravo's own port.`})]}),(0,P.jsxs)(v,{className:`gap-2 sm:gap-0`,children:[(0,P.jsx)(S,{type:`button`,variant:`outline`,onClick:()=>a(!1),disabled:p,children:`Cancel`}),(0,P.jsxs)(S,{type:`button`,className:`gap-1.5`,onClick:()=>void N(),disabled:p,"aria-busy":p,children:[p?(0,P.jsx)(j,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,P.jsx)(O,{className:`size-3.5`,"aria-hidden":!0}),`Download`]})]})]})})]})}export{J as a,R as c,B as d,N as f,Y as i,V as l,X as n,W as o,G as r,F as s,ie as t,z as u};
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,et as c,ot as l}from"./vendor-ui-D8j69UH4.js";import{S as u,Z as d,a as f,nt as p,o as m,s as h}from"./api-CtMmjN9m.js";import{a as g,c as _,i as v,n as y,o as b,r as x,t as ee}from"./dialog-B5PqrKVw.js";import{C as S,S as C,T as w}from"./format-Bx7DF-TB.js";import{n as T,t as E}from"./utils-XFKvwlFT.js";import{t as D}from"./chevron-down-x70Pto6j.js";import{t as O}from"./download-i8CTJ7oi.js";import{n as k,t as A}from"./source-host-miravo-B8eM2IHw.js";import{t as j}from"./loader-circle-DjgHgHHl.js";import"./use-engine-command-mutation-5q_LI_xT.js";import{t as M}from"./label-2sIXTEUK.js";var N=T(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),P=l();function F({...e}){return(0,P.jsx)(o,{"data-slot":`sheet`,...e})}function I({...e}){return(0,P.jsx)(a,{"data-slot":`sheet-portal`,...e})}function L({className:e,...t}){return(0,P.jsx)(c,{"data-slot":`sheet-overlay`,className:E(`fixed inset-0 z-50 bg-black/10 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs`,e),...t})}function R({className:e,children:t,side:r=`right`,showCloseButton:i=!0,...a}){return(0,P.jsxs)(I,{children:[(0,P.jsx)(L,{}),(0,P.jsxs)(s,{"data-slot":`sheet-content`,"data-side":r,className:E(`fixed z-50 flex flex-col gap-4 bg-background bg-clip-padding text-sm shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-[calc(100vw-1rem)] data-[side=left]:max-w-md data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-[calc(100vw-1rem)] data-[side=right]:max-w-xl data-[side=right]:border-l data-[side=right]:pl-1 data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem]`,e),...a,children:[t,i&&(0,P.jsxs)(n,{"data-slot":`sheet-close`,render:(0,P.jsx)(S,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`}),children:[(0,P.jsx)(w,{}),(0,P.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function z({className:e,...t}){return(0,P.jsx)(`div`,{"data-slot":`sheet-header`,className:E(`flex flex-col gap-0.5 p-2`,e),...t})}function B({className:e,...t}){return(0,P.jsx)(r,{"data-slot":`sheet-title`,className:E(`text-base font-medium text-foreground`,e),...t})}function V({className:e,...t}){return(0,P.jsx)(i,{"data-slot":`sheet-description`,className:E(`text-sm text-muted-foreground`,e),...t})}var H=e(t(),1);function U({format:e,kind:t}){return e===`source-yaml`?t===`model`?`Raw asset model definition. Edit locally, version-control, or use as input for the CLI.`:`Raw factory definition with topology and namespace. Edit, share, or apply via CLI.`:e===`litmus-edge`?t===`model`?`Litmus Edge Digital Twin JSON for manual import via the Litmus Edge UI.`:`Litmus Edge template JSON (DeviceHub devices + Digital Twins). Import directly via the Litmus Edge UI.`:`Select a format to download.`}function W({children:e,className:t}){return(0,P.jsx)(`div`,{className:E(`max-h-[min(36rem,75vh)] min-h-0 overflow-y-auto rounded-[var(--miravo-radius-stadium-sm)] border border-border/60 p-4 sm:p-5`,t),children:e})}var G=[`modbus`,`opcua`,`mqtt`],K={modbus:`Modbus`,opcua:`OPC UA`,mqtt:`MQTT`};function q(e){return e===``?null:!/^\d+$/.test(e)||!p(Number(e))?`Use a port from 1 to 65535.`:null}function J(e){return Object.fromEntries(Object.entries(e??{}).map(([e,t])=>[e,String(t)]))}function Y(e,t,n){let r={...e};for(let e of n){let n=(t[e]??``).trim();if(q(n))return null;n===``?delete r[e]:r[e]=Number(n)}return r}function X({open:e,onOpenChange:t,protocols:n,values:r,onChange:i,hint:a}){let o=(0,H.useId)();return(0,P.jsxs)(`div`,{children:[(0,P.jsxs)(`button`,{type:`button`,onClick:()=>t(!e),"aria-expanded":e,className:`flex w-full items-center gap-1 text-left text-[11px] font-medium text-muted-foreground hover:text-foreground`,children:[(0,P.jsx)(D,{className:E(`size-3 transition-transform`,!e&&`-rotate-90`),"aria-hidden":!0}),`Miravo ports remapped (Docker)?`]}),e?(0,P.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[(0,P.jsx)(`p`,{className:`text-[11px] leading-snug text-muted-foreground`,children:a}),(0,P.jsx)(`div`,{className:`flex flex-wrap gap-3`,children:n.map(e=>{let t=r[e]??``,n=q(t.trim());return(0,P.jsxs)(`div`,{className:`w-24 space-y-1`,children:[(0,P.jsx)(M,{htmlFor:`${o}-${e}`,className:`text-[11px] text-muted-foreground`,children:K[e]}),(0,P.jsx)(C,{id:`${o}-${e}`,inputMode:`numeric`,placeholder:String(d[e]),value:t,"aria-invalid":n!==null,onChange:t=>i({...r,[e]:t.currentTarget.value}),className:`h-8 font-mono text-[12px]`}),n?(0,P.jsx)(`p`,{className:`text-[10px] text-destructive`,children:n}):null]},e)})})]}):null]})}var Z=`172.17.0.1`;async function Q(e){let t=await m(`/catalog/models/${encodeURIComponent(e)}/le-dt.json`,u.catalogModelLeDt);return JSON.stringify(t,null,2)}async function te(e,t={host:Z}){let n=u.catalogTemplateLeTemplateJson.query;if(!n)throw Error(`Missing query schema for ${u.catalogTemplateLeTemplateJson.method} ${u.catalogTemplateLeTemplateJson.path}`);let r=n.safeParse({host:t.host,protocol:t.protocol,modbusPort:t.exposedPorts?.modbus,opcuaPort:t.exposedPorts?.opcua,mqttPort:t.exposedPorts?.mqtt});if(!r.success)throw Error(`Invalid request for ${u.catalogTemplateLeTemplateJson.method} ${u.catalogTemplateLeTemplateJson.path}: ${r.error.message}`);return f(ne(e,r.data),u.catalogTemplateLeTemplateJson)}function ne(e,t){return`/catalog/templates/${encodeURIComponent(e)}/le-template.json${re(t)}`}function re(e){let t=new URLSearchParams;for(let[n,r]of Object.entries(e))r!==void 0&&r!==``&&t.set(n,String(r));return t.size>0?`?${t.toString()}`:``}function $(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,r.click(),URL.revokeObjectURL(n),_.success(`Exported ${t}`)}function ie({kind:e,id:t,yamlPath:n,yamlFilename:r}){let[i,a]=(0,H.useState)(!1),[o,s]=(0,H.useState)(Z),[c,l]=(0,H.useState)(!1),[d,f]=(0,H.useState)({}),[p,m]=(0,H.useState)(!1),w=(0,H.useCallback)(async()=>{try{let t=await h(n,e===`model`?u.catalogModelYaml:u.catalogTemplateYaml);$(new Blob([t],{type:`text/yaml`}),r)}catch{_.error(`Failed to export YAML`)}},[e,n,r]),T=(0,H.useCallback)(async()=>{try{let e=await Q(t);$(new Blob([e],{type:`application/json`}),`${t}.le-dt.json`)}catch{_.error(`Failed to export integration format`)}},[t]),E=(0,H.useCallback)(async(e,n)=>{try{let r=e.trim();return $(await te(t,{host:r.length>0?r:Z,exposedPorts:n}),`${t}.le-template.json`),!0}catch{return _.error(`Failed to export integration format`),!1}},[t]),D=(0,H.useCallback)(()=>{s(Z),f({}),l(!1),a(!0)},[]),N=(0,H.useCallback)(async()=>{let e=Y(void 0,d,G);if(!e){l(!0);return}m(!0);try{await E(o,e)&&a(!1)}finally{m(!1)}},[d,o,E]);return(0,P.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto pb-2`,children:[[{key:`source-yaml`,label:e===`model`?`Source YAML (.asset.yaml)`:`Source YAML (.miravo.yaml)`,onDownload:()=>void w()},{key:`litmus-edge`,label:e===`model`?`Litmus Edge Digital Twin (JSON)`:`Litmus Edge template (JSON)`,onDownload:e===`model`?()=>void T():D}].map(t=>(0,P.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-[var(--miravo-radius-stadium-sm)] border border-border/60 p-3`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,P.jsx)(`span`,{className:`text-xs font-medium text-foreground`,children:t.label}),(0,P.jsxs)(S,{variant:`outline`,size:`sm`,className:`h-8 shrink-0 gap-1.5 text-xs`,"aria-label":`Download ${t.label}`,onClick:t.onDownload,children:[(0,P.jsx)(O,{className:`size-3.5`,"aria-hidden":!0}),`Download`]})]}),(0,P.jsx)(`p`,{className:`text-[11px] leading-snug text-foreground/70`,children:(0,P.jsx)(U,{format:t.key,kind:e})})]},t.key)),(0,P.jsx)(ee,{open:i,onOpenChange:a,children:(0,P.jsxs)(y,{className:`sm:max-w-md`,children:[(0,P.jsxs)(g,{children:[(0,P.jsx)(b,{children:`Download Litmus Edge Template`}),(0,P.jsx)(x,{children:A})]}),(0,P.jsxs)(`div`,{className:`space-y-2 py-1`,children:[(0,P.jsx)(M,{htmlFor:`export-source-host`,children:k}),(0,P.jsx)(C,{id:`export-source-host`,value:o,onChange:e=>s(e.target.value),placeholder:Z,autoComplete:`off`,className:`font-mono text-sm`}),(0,P.jsxs)(`p`,{className:`text-[11px] leading-snug text-muted-foreground`,children:[`Use an IP or hostname reachable from Litmus Edge (e.g.`,` `,(0,P.jsx)(`span`,{className:`font-mono`,children:Z}),` for Docker bridge).`]}),(0,P.jsx)(X,{open:c,onOpenChange:l,protocols:G,values:d,onChange:f,hint:`Enter the host port Litmus Edge should dial. Leave blank to use Miravo's own port.`})]}),(0,P.jsxs)(v,{className:`gap-2 sm:gap-0`,children:[(0,P.jsx)(S,{type:`button`,variant:`outline`,onClick:()=>a(!1),disabled:p,children:`Cancel`}),(0,P.jsxs)(S,{type:`button`,className:`gap-1.5`,onClick:()=>void N(),disabled:p,"aria-busy":p,children:[p?(0,P.jsx)(j,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,P.jsx)(O,{className:`size-3.5`,"aria-hidden":!0}),`Download`]})]})]})})]})}export{J as a,R as c,B as d,N as f,Y as i,V as l,X as n,W as o,G as r,F as s,ie as t,z as u};