1import{j as e}from"./vendor-puck-lPnaRYA0.js";import{d as v,L as T,r as b}from"./vendor-react-TOOSQ9Q-.js";import{b as g,cE as d,n as u,cF as x,cG as F,cH as P,cI as R,cJ as L,g as f,aW as k,cK as I,au as w,P as C}from"./index-wdjyQqoD.js";import{u as S,t as m}from"./vendor-i18n-eTj0Pfmx.js";import{A as V}from"./ArkTabs-y6EejGCn.js";import{N as h,c as y}from"./vendor-bootstrap-fxQA9rHL.js";import{L as D}from"./LinkWrapper-wAzZCb1c.js";import{N as O}from"./NoResults-biNBPluZ.js";import{D as j}from"./vendor-luxon-2n2xc3QM.js";import{A as E}from"./ActivitySectionLayout-Ue8FYAhm.js";import{s as H}from"./scrollToTop-xXR16Nar.js";import"./vendor-calendar-WlMSM93F.js";import"./vendor-motion-BX6prKAE.js";const A=t=>{const{data:s}=t,{getRoutePath:r}=g(),{routeKey:o}=t,[a]=v(),i=a.get("type");return e.jsx(V,{children:s.sensorTypeValues.map(n=>e.jsx(h.Item,{children:e.jsx(h.Link,{as:T,active:n.key===i,to:r(o,void 0,{type:n.key}),children:n.label})},n.key))})},N=t=>{const{sensor:s,url:r,isFavourite:o,addToFavourites:a,removeFromFavourites:i}=t,{t:n}=S(),c=o?R:L,l=s.SensorType!=d.PresenceDetection&&s.SensorType!=d.Touch&&s.SensorType!=d.OpenClosed;return e.jsx(D,{url:r,children:e.jsxs(y,{className:u(["border-0 flex-grow-1 rounded-3 p-3 position-relative",`bg-${x(s.SensorType,s.LastReceivedValue)}-subtle`,`border-${x(s.SensorType,s.LastReceivedValue)}`]),style:{height:"100%"},children:[e.jsx(c,{className:"position-absolute top-0 end-0 m-3",style:{cursor:"pointer",fontSize:"0.875rem"},onClick:p=>{p.preventDefault(),p.stopPropagation(),o?i(s.Id):a(s.Id)}}),e.jsx(y.Body,{className:"p-0",children:e.jsxs("div",{className:"d-flex gap-2",children:[e.jsx("div",{className:"flex-grow-0 fs-5",children:F(s,n)}),e.jsxs("div",{className:"flex-grow-1 d-flex flex-column gap-1",children:[e.jsx("span",{className:`truncate one-line ${l?"":"order-1 fw-bolder"}`,children:s.Name}),e.jsx("div",{children:e.jsx("span",{className:u([,l&&"fs-4 fw-bolder",!l&&"fs-base"]),children:P(s.SensorType,s.LastReceivedValue,s.Unit||"",n)})})]})]})})]})})},B=()=>e.jsx("div",{className:"mt-3",style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gap:"1rem"},children:Array.from({length:8},(t,s)=>e.jsx("div",{className:"card rounded-2 border-1 placeholder-glow",style:{minHeight:"75px"},children:e.jsxs("div",{className:"card-body p-2",children:[e.jsx("h5",{className:"card-title placeholder col-9"}),e.jsxs("p",{className:"card-text ",children:[e.jsx("span",{className:"placeholder col-2 me-2"}),e.jsx("span",{className:"placeholder col-5"})]})]})},s))}),_=()=>e.jsx("div",{className:"text-center py-4",children:e.jsx("p",{className:"text-secondary",children:e.jsx(O,{subtitle:m("No sensors found for the selected category")})})}),G=t=>{const{sensors:s,data:r}=t,{getRoutePath:o}=g();return e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gap:"1rem"},children:s.map(a=>e.jsx(N,{url:a.Resources?.length?o(f.public_booking_edit,void 0,{resource_id:a.Resources[0].Id,start:j.now().startOf("hour").toISO(),end:j.now().startOf("hour").plus({hours:1}).toISO()}):void 0,sensor:a,isFavourite:r.isFavourite(a.Id),addToFavourites:r.addToFavourites,removeFromFavourites:r.removeFromFavourites},a.Id))})},K=t=>{const{sensors:s,data:r}=t;return e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gap:"1rem"},children:k.orderBy(s,o=>o.Name).map(o=>e.jsx(N,{sensor:o,isFavourite:r.isFavourite(o.Id),addToFavourites:r.addToFavourites,removeFromFavourites:r.removeFromFavourites},o.Id))})},$=t=>{const{groupName:s,sensors:r,data:o}=t,a=[d.PresenceDetection,d.PeopleCounter],i=r.filter(c=>a.includes(c.SensorType)),n=r.filter(c=>!a.includes(c.SensorType));return e.jsxs("div",{className:"bg-body rounded-3 p-3 mb-4",children:[e.jsx("h5",{className:"fs-lg fw-bolder",children:s}),n.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"mb-3",children:m("Climate overview")}),e.jsx(G,{sensors:n,data:o})]}),i.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"my-3",children:m("Occupancy")}),e.jsx(K,{sensors:i,data:o})]})]},s)},U=t=>{const{data:s}=t,r=Object.keys(s.sensorData).length>0;return e.jsx(E,{title:m("Building environment"),prewrapperContent:e.jsx("div",{className:"mb-3",children:e.jsx(A,{data:s,routeKey:f.building_sensors})}),children:e.jsxs("div",{children:[s.isLoading&&e.jsx(B,{}),!s.isLoading&&e.jsxs(e.Fragment,{children:[!r&&e.jsx(_,{}),r&&e.jsx("div",{className:"mb-3 mt-3",children:Object.entries(s.sensorData).map(([o,a])=>e.jsx($,{groupName:o,sensors:a,data:s},o))})]})]})})};function te(t){const[s]=v(),r=I(),{updateQuerystring:o}=w(),a=s.get("type");H(),b.useEffect(()=>{i()},[a,r.sensorTypeValues.length,r.isLoading]);const i=()=>
1{if(r.isLoading)return;if(!r.sensorTypeValues.some(l=>l.key===a)||!a&&r.sensorTypeValues.length>0){const l=r.sensorTypeValues[0].key;o([{name:"type",value:`${l}`}])}};return e.jsx(W,{data:r})}function W(t){const{data:s}=t,{t:r}=S();return e.jsxs(e.Fragment,{children:[e.jsx(C,{title:r("Environment")}),e.jsx(U,{data:s})]})}export{te as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.