@camstack/addon-pipeline-orchestrator 1.2.85 → 1.2.86
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.
- package/assets/viewer/.viewer-current-files.json +11 -11
- package/assets/viewer/.viewer-version +1 -1
- package/assets/viewer/_expo/static/js/web/{Clipboard-f18577b4a294413498c81380901ed038.js → Clipboard-b493c462f406087ad9239d964c04daa4.js} +8 -8
- package/assets/viewer/_expo/static/js/web/Clipboard-dbfb8d2b9b663367bf606c4e4156c5ed.js +8 -0
- package/assets/viewer/_expo/static/js/web/{Haptics-9949b397ca9e92d93a6407e7d6365160.js → Haptics-3613723d421a096726c7771e59487833.js} +3 -3
- package/assets/viewer/_expo/static/js/web/Haptics-575f417f8ab751744aefb2524eaf2683.js +3 -0
- package/assets/viewer/_expo/static/js/web/{index-c1ecd087d9dabede863be706efa6e58e.js → index-7bbff8f1469773286edb838f304a97e5.js} +1449 -1445
- package/assets/viewer/_expo/static/js/web/{index-12ad3050f5d1f4eae147097a862e0272.js → index-975974cc04d339416e7cc055be163ac2.js} +1448 -1445
- package/assets/viewer/_expo/static/js/web/{node-fs-0e1ce70c9ba2f1206c991758cb58d198.js → node-fs-3444d48a73ceb72dd0e6a45d4ba686f4.js} +1 -1
- package/assets/viewer/_expo/static/js/web/node-fs-946f88ca6e61401f6e74a97eb8ab9475.js +1 -0
- package/assets/viewer/_expo/static/js/web/{node-path-38a844643044c35be301228867d84093.js → node-path-31d2d4f03c0bb8e91685e0b2170248e7.js} +1 -1
- package/assets/viewer/_expo/static/js/web/node-path-d78161f939e2464dff3ec493389653bf.js +1 -0
- package/assets/viewer/embed/assets/{MaskShapeCanvas-DI4BY7W2-BjlEmX8b.js → MaskShapeCanvas-DI4BY7W2-CAhI6HPA.js} +1 -1
- package/assets/viewer/embed/assets/{MotionZonesSettings-DNdnFHso-D_PVfCj5.js → MotionZonesSettings-DNdnFHso-ClgHPzRm.js} +1 -1
- package/assets/viewer/embed/assets/{PrivacyMaskSettings-DNSLc6ww-CDMF3qEB.js → PrivacyMaskSettings-DNSLc6ww-Cnj4pd4U.js} +1 -1
- package/assets/viewer/embed/assets/{SceneMonitorEditor-d_A4kO-M-DwhAKo3A.js → SceneMonitorEditor-d_A4kO-M-D602gNI8.js} +1 -1
- package/assets/viewer/embed/assets/{index-CyhdNw82.css → index-0taReYko.css} +1 -1
- package/assets/viewer/embed/assets/{index-CGip4s6a.js → index-CmR3pWbl.js} +18 -18
- package/assets/viewer/embed/index.html +2 -2
- package/assets/viewer/index.html +1 -1
- package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_orchestrator_widgets-B0iBfXjU.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_orchestrator_widgets-C165HjCc.mjs} +1 -1
- package/dist/{hostInit-BFq3E6iz.mjs → hostInit-AIA70Kgy.mjs} +1 -1
- package/dist/index.js +10 -1
- package/dist/index.mjs +10 -1
- package/dist/remoteEntry.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
__d(function(g,r,i,a,m,e,d){function n(){throw new Error("node:fs is unavailable in the Viewer runtime")}m.exports={chmodSync:n,createWriteStream:n,existsSync:n,mkdirSync:n,promises:new Proxy({},{get:()=>n}),readFileSync:n,readdirSync:n,renameSync:n,rmSync:n,unlinkSync:n,writeFileSync:n}},
|
|
1
|
+
__d(function(g,r,i,a,m,e,d){function n(){throw new Error("node:fs is unavailable in the Viewer runtime")}m.exports={chmodSync:n,createWriteStream:n,existsSync:n,mkdirSync:n,promises:new Proxy({},{get:()=>n}),readFileSync:n,readdirSync:n,renameSync:n,rmSync:n,unlinkSync:n,writeFileSync:n}},2220,[]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__d(function(g,r,i,a,m,e,d){function n(){throw new Error("node:fs is unavailable in the Viewer runtime")}m.exports={chmodSync:n,createWriteStream:n,existsSync:n,mkdirSync:n,promises:new Proxy({},{get:()=>n}),readFileSync:n,readdirSync:n,renameSync:n,rmSync:n,unlinkSync:n,writeFileSync:n}},2221,[]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
__d(function(g,r,i,a,m,e,d){function n(){throw new Error("node:path is unavailable in the Viewer runtime")}m.exports={basename:n,join:n}},
|
|
1
|
+
__d(function(g,r,i,a,m,e,d){function n(){throw new Error("node:path is unavailable in the Viewer runtime")}m.exports={basename:n,join:n}},2219,[]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__d(function(g,r,i,a,m,e,d){function n(){throw new Error("node:path is unavailable in the Viewer runtime")}m.exports={basename:n,join:n}},2220,[]);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{m as Cd,n as h0,o as Ed,p as Ft,r as _t,j as Tt}from"./index-
|
|
1
|
+
import{m as Cd,n as h0,o as Ed,p as Ft,r as _t,j as Tt}from"./index-CmR3pWbl.js";const bd=Math.PI/180;function xd(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}const aa=typeof global<"u"?global:typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{},J={_global:aa,version:"10.3.0",isBrowser:xd(),isUnminified:/param/.test((function(o){}).toString()),dblClickWindow:400,getAngle(o){return J.angleDeg?o*bd:o},enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,_renderBackend:"web",legacyTextRendering:!1,pixelRatio:typeof window<"u"&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging(){return J.DD.isDragging},isTransforming(){var o,e;return(e=(o=J.Transformer)===null||o===void 0?void 0:o.isTransforming())!==null&&e!==void 0?e:!1},isDragReady(){return!!J.DD.node},releaseCanvasOnDestroy:!0,document:aa.document,_injectGlobal(o){typeof aa.Konva<"u"&&console.error("Several Konva instances detected. It is not recommended to use multiple Konva instances in the same environment."),aa.Konva=o}},Lt=o=>{J[o.prototype.getClassName()]=o};J._injectGlobal(J);const Td=`Konva.js unsupported environment.
|
|
2
2
|
|
|
3
3
|
Looks like you are trying to use Konva.js in Node.js environment. because "document" object is undefined.
|
|
4
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as J,a as Q,r as i,i as ee,b as te,j as s,W as re,T as S,c as se}from"./index-
|
|
1
|
+
import{u as J,a as Q,r as i,i as ee,b as te,j as s,W as re,T as S,c as se}from"./index-CmR3pWbl.js";import{MaskShapeCanvas as ne}from"./MaskShapeCanvas-DI4BY7W2-CAhI6HPA.js";var ie=se("grid-2x2",[["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M3 12h18",key:"1i2n21"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]),oe=110,ae="motion-zones",$=0,le=[1,2,3],L=1,w="rounded-md border border-border bg-surface px-2 py-1 text-[11px] font-medium text-foreground-subtle hover:bg-surface-hover disabled:opacity-40 transition-colors",O="rounded-md border border-primary/50 bg-primary/15 px-2.5 py-1 text-[11px] font-medium text-primary hover:bg-primary/25 disabled:opacity-40 transition-colors";function H(l,r,e){const h=r*e,c=Array.from({length:h});for(let g=0;g<h;g+=1)c[g]=l[g]===!0;return c}function de(l,r){if(l.length!==r.length)return!1;for(let e=0;e<l.length;e+=1)if(l[e]!==r[e])return!1;return!0}function b(l,r){return Math.ceil(l/r)}function R(l,r,e){return Math.min(e-1,Math.floor((l+.5)/r*e))}function E(l,r,e,h){const c=b(r,h),g=b(e,h),o=Array.from({length:c*g},()=>!1);for(let a=0;a<e;a+=1){const p=R(a,e,g);for(let u=0;u<r;u+=1)l[a*r+u]===!0&&(o[p*c+R(u,r,c)]=!0)}return o}function Z(l,r,e,h){const c=b(r,h),g=b(e,h),o=Array.from({length:r*e},()=>!1);for(let a=0;a<e;a+=1){const p=R(a,e,g);for(let u=0;u<r;u+=1)o[a*r+u]=l[p*c+R(u,r,c)]===!0}return o}function ge({deviceId:l}){const r=J(Q().trpcClient,l),[e,h]=i.useState(null),[c,g]=i.useState(!1),[o,a]=i.useState(null),[p,u]=i.useState(null),[d,T]=i.useState(L),[x,D]=i.useState(!1),[k,P]=i.useState(!1),I=i.useRef(!1);i.useEffect(()=>{if(!r)return;let t=!1;return I.current=!1,h(null),g(!1),a(null),u(null),T(L),P(!1),(async()=>{try{const n=await r.motionZones?.getOptions({});if(t)return;if(!n)throw new Error("device proxy not ready");if(h(n),I.current)return;const y=await r.motionZones?.getStatus({});if(t)return;if(!y)throw new Error("device proxy not ready");I.current=!0;const j=y.regions.find(_=>_.shape.kind==="grid"),M=H(j?j.shape.cells:[],n.grid.width,n.grid.height);u(M),a(E(M,n.grid.width,n.grid.height,L))}catch(n){if(t)return;ee(n)?g(!0):console.error("Motion Zones load failed",n)}})(),()=>{t=!0}},[r]);const f=e?e.grid.width:0,m=e?e.grid.height:0,v=b(f,d),C=b(m,d),N=i.useMemo(()=>o&&e?Z(o,f,m,d):null,[o,e,f,m,d]),U=i.useMemo(()=>N!==null&&p!==null&&!de(N,p),[N,p]),Y=i.useMemo(()=>N?N.reduce((t,n)=>n?t+1:t,0):0,[N]),q=f*m,A=v*C,z=i.useCallback(t=>{A>0&&a(Array.from({length:A},()=>t))},[A]),B=i.useCallback(()=>{a(t=>t&&t.map(n=>!n))},[]),F=i.useCallback(()=>{p&&e&&a(E(p,f,m,d))},[p,e,f,m,d]),V=i.useCallback(t=>{t===d||!e||a(n=>{if(!n)return T(t),n;const y=E(Z(n,f,m,d),f,m,t);return T(t),y})},[d,e,f,m]),W=i.useMemo(()=>e&&o?[{id:$,shape:{kind:"grid",gridWidth:v,gridHeight:C,cells:[...o]}}]:[],[e,o,v,C]),G=i.useCallback((t,n)=>{n.kind==="grid"&&a(n.cells)},[]),K=i.useCallback(async()=>{if(!(!r||!o||!e)){D(!0);try{const t=Z(o,e.grid.width,e.grid.height,d),n={kind:"grid",gridWidth:e.grid.width,gridHeight:e.grid.height,cells:t};await r.motionZones?.setZone({patch:{regions:[{id:$,enabled:!0,shape:n}]}});const y=await r.motionZones?.getStatus({});if(y){const j=y.regions.find(_=>_.shape.kind==="grid"),M=H(j?j.shape.cells:[],e.grid.width,e.grid.height);u(M),a(E(M,e.grid.width,e.grid.height,d))}}catch(t){console.error("Motion Zones save failed",t)}finally{D(!1)}}},[r,o,e,d]);te(i.useMemo(()=>k&&!c&&e&&o?{id:ae,order:oe,node:s.jsx(ne,{transparent:!0,items:W,supportedShapes:["grid"],grid:{width:v,height:C},selectedId:$,onSelect:()=>{},onShapeChange:G,onDrawComplete:()=>{},drawingKind:null})}:null,[k,c,e,o,W,G,v,C]));const X=!c&&e!==null&&o!==null;return r?s.jsx(re,{title:"Motion Zones",icon:s.jsx(ie,{className:"h-3.5 w-3.5 text-foreground-subtle"}),children:s.jsx("div",{className:"flex flex-col gap-3",children:c?s.jsx("p",{className:`${S} leading-relaxed`,children:"This camera doesn't expose an on-board motion zones grid."}):X?s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:`${S} leading-relaxed`,children:["Toggle ",s.jsx("strong",{className:"text-foreground",children:"Edit grid"})," to paint the region directly on the live frame, then ",s.jsx("strong",{className:"text-foreground",children:"Save"})," to push the mask to the camera. Pick a bigger"," ",s.jsx("strong",{className:"text-foreground",children:"Cell size"})," for quicker, broad-stroke painting — it's resampled to the camera's native ",e.grid.width,"×",e.grid.height," grid on save (×1 is the finest)."]}),s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("button",{type:"button",onClick:()=>P(t=>!t),disabled:x,"aria-pressed":k,className:k?O:w,children:k?"Done editing":"Edit grid"}),s.jsx("button",{type:"button",onClick:()=>z(!0),disabled:x,className:w,children:"All on"}),s.jsx("button",{type:"button",onClick:()=>z(!1),disabled:x,className:w,children:"All off"}),s.jsx("button",{type:"button",onClick:B,disabled:x,className:w,children:"Invert"}),s.jsxs("div",{className:"flex items-center gap-1 ml-1",role:"group","aria-label":"Cell size",children:[s.jsx("span",{className:`${S} mr-0.5`,children:"Cell size"}),le.map(t=>s.jsxs("button",{type:"button",onClick:()=>V(t),disabled:x,"aria-pressed":d===t,title:t===1?`Camera grid ${f}×${m} (finest)`:`${b(f,t)}×${b(m,t)} painting grid · cells ×${t} bigger`,className:d===t?O:w,children:["×",t]},t))]}),s.jsxs("span",{className:`${S} ml-1 tabular-nums`,children:[Y," / ",q," cells · ",e.grid.width,"×",e.grid.height,d!==1?` · paint ${v}×${C}`:""]}),s.jsx("span",{className:"flex-1"}),s.jsx("button",{type:"button",onClick:F,disabled:x||!U,className:"rounded-md border border-border bg-surface px-2 py-1 text-[11px] text-foreground-subtle hover:bg-surface-hover disabled:opacity-40 transition-colors",children:"Revert"}),s.jsx("button",{type:"button",onClick:()=>{K()},disabled:x||!U,className:O,children:x?"Saving…":"Save"})]})]}):s.jsx("p",{className:`${S} leading-relaxed`,children:"Loading the camera's grid…"})})}):null}export{ge as MotionZonesSettings};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as le,a as ie,r as a,i as de,b as ce,j as n,W as ue,T as w,S as pe,d as ge,M as fe,E as be,c as J}from"./index-
|
|
1
|
+
import{u as le,a as ie,r as a,i as de,b as ce,j as n,W as ue,T as w,S as pe,d as ge,M as fe,E as be,c as J}from"./index-CmR3pWbl.js";import{MaskShapeCanvas as he}from"./MaskShapeCanvas-DI4BY7W2-CAhI6HPA.js";var me=J("hexagon",[["path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z",key:"yt0hxn"}]]);var xe=J("mic-off",[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M15 9.34V5a3 3 0 0 0-5.68-1.33",key:"1gzdoj"}],["path",{d:"M16.95 16.95A7 7 0 0 1 5 12v-2",key:"cqa7eg"}],["path",{d:"M18.89 13.23A7 7 0 0 0 19 12v-2",key:"16hl24"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12",key:"r2i35w"}]]),ye="Microphone",ke="The camera encodes no audio at all — live view, recordings, exports and the audio analyzer are all silent.";function ve(l){const r=l.supportsAudioMute===!0,s=r?l.audioEnabled:null,b=l.pendingOn??null;return{label:ye,supported:r,on:s===null?null:b??s,available:r&&s!==null,costWhenOff:ke}}function Me(l){return!l.available||l.on===null?null:{enabled:!l.on}}var Se=120,je="privacy-mask",M="rounded-md border border-border bg-surface px-2 py-1 text-[11px] font-medium text-foreground-subtle hover:bg-surface-hover disabled:opacity-40 transition-colors",y="rounded-md border border-primary/50 bg-primary/15 px-2.5 py-1 text-[11px] font-medium text-primary hover:bg-primary/25 disabled:opacity-40 transition-colors";function K(l){return l.kind==="rect"||l.kind==="polygon"?l:null}function Ne(l){const r=new Set(l.map(b=>b.id));let s=0;for(;r.has(s);)s+=1;return s}function we(l,r){if(l.length!==r.length)return!1;for(let s=0;s<l.length;s+=1)if(JSON.stringify(l[s])!==JSON.stringify(r[s]))return!1;return!0}function Re({deviceId:l}){const r=le(ie().trpcClient,l),[s,b]=a.useState(null),[S,z]=a.useState(!1),[o,p]=a.useState(null),[g,C]=a.useState(null),[u,D]=a.useState(!1),[k,j]=a.useState(!1),[E,f]=a.useState(null),[h,m]=a.useState(null),[U,R]=a.useState(null),[_,A]=a.useState(null),[I,O]=a.useState(null),P=a.useRef(!1);a.useEffect(()=>{if(!r)return;let e=!1;return P.current=!1,b(null),z(!1),p(null),C(null),j(!1),f(null),m(null),R(null),A(null),O(null),(async()=>{try{const t=await r.privacyMask?.getOptions({});if(e)return;if(!t)throw new Error("device proxy not ready");if(b(t),P.current)return;const i=await r.privacyMask?.getStatus({});if(e)return;if(!i)throw new Error("device proxy not ready");P.current=!0;const c={enabled:i.enabled,regions:i.regions};C(c),p(c),R(i.audioEnabled)}catch(t){if(e)return;de(t)?z(!0):console.error("Privacy Mask load failed",t)}})(),()=>{e=!0}},[r]);const $=a.useMemo(()=>o!==null&&g!==null&&(o.enabled!==g.enabled||!we(o.regions,g.regions)),[o,g]),T=o?o.regions.length:0,v=s?s.maxRegions:0,W=a.useRef(0);a.useEffect(()=>{W.current=v},[v]);const N=v>0&&T>=v,Z=a.useCallback(()=>{p(e=>e&&{...e,enabled:!e.enabled})},[]),L=a.useCallback(e=>{f(typeof e=="number"?e:null)},[]),V=a.useMemo(()=>o?o.regions.map(e=>({id:e.id,shape:e.shape,enabled:e.enabled,label:`Zone ${String(e.id)}`})):[],[o]),F=a.useCallback((e,t)=>{const i=K(t);i&&p(c=>c&&{...c,regions:c.regions.map(x=>x.id===e?{...x,shape:i}:x)})},[]),H=a.useCallback(e=>{const t=K(e);t&&(m(null),p(i=>{if(!i)return i;const c=W.current;if(c>0&&i.regions.length>=c)return i;const x=Ne(i.regions),oe={id:x,enabled:!0,shape:t};return f(x),{...i,regions:[...i.regions,oe]}}))},[]),Y=a.useCallback(e=>{j(!0),f(null),m(e)},[]),X=a.useCallback(e=>{j(!0),m(null),f(e)},[]),G=a.useCallback(e=>{f(t=>t===e?null:t),p(t=>t&&{...t,regions:t.regions.filter(i=>i.id!==e)})},[]),Q=a.useCallback(()=>{m(null),f(null),g&&p({enabled:g.enabled,regions:g.regions})},[g]),ee=a.useCallback(async()=>{if(!(!r||!o)){D(!0);try{await r.privacyMask?.setMask({patch:{enabled:o.enabled,regions:[...o.regions]}});const e=await r.privacyMask?.getStatus({});if(e){const t={enabled:e.enabled,regions:e.regions};C(t),p(t)}}catch(e){console.error("Privacy Mask save failed",e)}finally{D(!1)}}},[r,o]),d=ve({supportsAudioMute:s===null?null:s.supportsAudioMute,audioEnabled:U,pendingOn:_}),ne=a.useCallback(async()=>{const e=Me(d);if(!(!r||e===null)){A(e.enabled),O(null);try{await r.privacyMask?.setAudioEnabled(e);const t=await r.privacyMask?.getStatus({});t&&R(t.audioEnabled)}catch(t){console.error("Privacy microphone write failed — reverting",t),O(t instanceof Error?t.message:String(t))}finally{A(null)}}},[r,d]),te=a.useCallback(()=>{j(e=>(e&&(m(null),f(null)),!e))},[]),q=s?.supportedShapes??[];ce(a.useMemo(()=>k&&!S&&s&&o?{id:je,order:Se,node:n.jsx(he,{transparent:!0,items:V,supportedShapes:q,polygonVertices:s.polygonVertices,selectedId:E,onSelect:L,onShapeChange:F,onDrawComplete:H,drawingKind:h})}:null,[k,S,s,o,V,q,E,L,F,H,h]));const ae=s?.supportedShapes.includes("rect")??!1,se=s?.supportedShapes.includes("polygon")??!1,B=s!==null&&(s.maxRegions<=0||s.supportedShapes.length===0),re=!S&&!B&&s!==null&&o!==null;return r?n.jsx(ue,{title:"Privacy Mask",icon:n.jsx(be,{className:"h-3.5 w-3.5 text-foreground-subtle"}),children:n.jsxs("div",{className:"flex flex-col gap-3",children:[S||B?n.jsx("p",{className:`${w} leading-relaxed`,children:"This camera doesn't support an on-board privacy mask."}):re?n.jsxs(n.Fragment,{children:[n.jsxs("p",{className:`${w} leading-relaxed`,children:["Toggle ",n.jsx("strong",{className:"text-foreground",children:"Edit mask"})," to draw blanked-out zones on the live frame, then ",n.jsx("strong",{className:"text-foreground",children:"Save"})," to push them to the camera. Drag a rectangle to move, its corner to resize; drag polygon vertices, click an edge midpoint to add one, or right-click a vertex to remove it."]}),n.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[n.jsx("button",{type:"button",onClick:te,disabled:u,"aria-pressed":k,className:k?y:M,children:k?"Done editing":"Edit mask"}),n.jsx("button",{type:"button",onClick:Z,disabled:u,"aria-pressed":o.enabled,className:o.enabled?y:M,children:o.enabled?"Mask on":"Mask off"}),ae&&n.jsx("button",{type:"button",onClick:()=>Y("rect"),disabled:u||N,"aria-pressed":h==="rect",className:h==="rect"?y:M,title:N?"Maximum zones reached":"Add a rectangle zone",children:"+ Rect"}),se&&n.jsx("button",{type:"button",onClick:()=>Y("polygon"),disabled:u||N,"aria-pressed":h==="polygon",className:h==="polygon"?y:M,title:N?"Maximum zones reached":"Add a polygon zone",children:"+ Polygon"}),n.jsxs("span",{className:`${w} ml-1 tabular-nums`,children:[T," / ",v," zones"]}),n.jsx("span",{className:"flex-1"}),n.jsx("button",{type:"button",onClick:Q,disabled:u||!$,className:"rounded-md border border-border bg-surface px-2 py-1 text-[11px] text-foreground-subtle hover:bg-surface-hover disabled:opacity-40 transition-colors",children:"Revert"}),n.jsx("button",{type:"button",onClick:()=>{ee()},disabled:u||!$,className:y,children:u?"Saving…":"Save"})]}),T>0?n.jsx("div",{className:"flex flex-col gap-1",children:o.regions.map(e=>{const t=E===e.id,i=e.shape.kind==="polygon"?me:pe;return n.jsxs("div",{className:`flex items-center gap-2 rounded-md border px-2 py-1 transition-colors ${t?"border-primary/50 bg-primary/10":"border-border bg-surface"}`,children:[n.jsxs("button",{type:"button",onClick:()=>X(e.id),disabled:u,className:"flex flex-1 items-center gap-2 text-left text-[11px] font-medium text-foreground-subtle hover:text-foreground disabled:opacity-40 transition-colors",children:[n.jsx(i,{className:"h-3.5 w-3.5 shrink-0"}),n.jsxs("span",{children:["Zone ",e.id]}),n.jsx("span",{className:"text-foreground-faint capitalize",children:e.shape.kind})]}),n.jsx("button",{type:"button",onClick:()=>G(e.id),disabled:u,"aria-label":`Delete zone ${String(e.id)}`,title:"Delete zone",className:"inline-flex h-6 w-6 items-center justify-center rounded border border-border bg-surface text-foreground-subtle hover:border-red-400/40 hover:bg-red-500/10 hover:text-red-400 disabled:opacity-40 transition-colors",children:n.jsx(ge,{className:"h-3.5 w-3.5"})})]},e.id)})}):null]}):n.jsx("p",{className:`${w} leading-relaxed`,children:"Loading the camera's privacy mask…"}),d.supported&&n.jsxs("div",{className:"flex items-start gap-3 rounded-md border border-border bg-surface px-2 py-2",children:[n.jsx("button",{type:"button",role:"switch","aria-label":d.label,"aria-checked":d.on===!0,disabled:!d.available||_!==null,onClick:()=>{ne()},title:d.on===null?"Microphone — state unknown; the camera did not answer.":d.on?`The camera is capturing sound. Turning it off: ${d.costWhenOff}`:`The camera is silent. ${d.costWhenOff}`,className:d.on===!1||d.on===null?M:y,children:n.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[d.on===!1?n.jsx(xe,{className:"h-3.5 w-3.5"}):n.jsx(fe,{className:"h-3.5 w-3.5"}),d.on===null?"Microphone unknown":d.on?"Microphone on":"Microphone off"]})}),n.jsx("p",{className:"text-[10px] text-foreground-subtle flex-1 leading-relaxed",children:I!==null?`Write failed: ${I}`:d.on===null?"The camera did not report its microphone, so this state is unknown.":d.costWhenOff})]})]})}):null}export{Re as PrivacyMaskSettings};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as Q,a as Z,e as ee,f as te,r as i,i as se,j as e,T as p,g as ae,h as ne,s as re,k as le,l as oe,C as ie,v as D,R as ce,d as W,c as de,I as he}from"./index-CGip4s6a.js";import{MaskShapeCanvas as ue}from"./MaskShapeCanvas-DI4BY7W2-BjlEmX8b.js";var pe=de("settings-2",[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]),ge="/addon/pipeline-analytics/event-media";function fe(a){const n=new Map;for(const h of a.states)h.references.forEach((r,g)=>{const x=n.get(r.condition)??[];x.push({stateId:h.id,index:g,reference:r}),n.set(r.condition,x)});return[...n.entries()].map(([h,r])=>({condition:h,tiles:[...r].sort((g,x)=>x.reference.capturedAt-g.reference.capturedAt)})).sort((h,r)=>h.condition.localeCompare(r.condition))}function me(a){return a.states.reduce((n,h)=>n+h.references.length,0)}var xe="rounded border border-danger/50 bg-danger/10 px-1 py-0.5 text-[10px] font-medium text-danger hover:bg-danger/20 disabled:opacity-40 transition-colors";function be({monitor:a,disabled:n,onDelete:h}){const r=fe(a),g=me(a),[x,d]=i.useState(null);return r.length===0?e.jsx("p",{className:`${p} leading-relaxed`,children:"No photographs captured yet. Press “Capture daylight” to take the one this scene will judge everything against."}):e.jsx("div",{className:"flex flex-col gap-2",children:r.map(o=>e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("p",{className:"text-[10px] font-semibold uppercase tracking-wide text-foreground-subtle",children:[D(o.condition)," · ",o.tiles.length]}),e.jsx("ul",{className:"flex flex-wrap gap-1.5",children:o.tiles.map(c=>{const N=`${c.stateId}:${String(c.index)}`,v=g===1,t=x===N;return e.jsxs("li",{className:"flex w-24 flex-col gap-1 rounded-md border border-border p-1",children:[e.jsx(ye,{reference:c.reference}),e.jsx("span",{className:`${p} tabular-nums`,children:B(c.reference.capturedAt)}),e.jsxs("button",{type:"button",className:xe,disabled:n,"aria-label":`Delete the ${D(o.condition).toLowerCase()} photograph from ${B(c.reference.capturedAt)}`,onClick:()=>{if(v&&!t){d(N);return}d(null),h({stateId:c.stateId,index:c.index})},children:[e.jsx(W,{className:"mr-1 inline h-3 w-3"}),t?"Confirm":"Delete"]}),t&&e.jsx("p",{className:"text-[10px] leading-snug text-warning",children:"This is the only photograph this scene has. Delete it and the scene no longer knows what normal looks like — it stops judging until you capture again."})]},N)})})]},o.condition))})}function ye({reference:a}){const[n,h]=i.useState(!1),r=a.thumbnailMediaId;return r===void 0||n?e.jsxs("div",{className:"flex h-16 w-full flex-col items-center justify-center gap-0.5 rounded bg-surface text-foreground-subtle",title:"The picture for this reference is no longer stored. The reference itself is intact and still being scored against.",children:[e.jsx(he,{className:"h-4 w-4"}),e.jsx("span",{className:"text-[9px]",children:"no picture"})]}):e.jsx("img",{src:`${ge}/${encodeURIComponent(r)}`,alt:"",loading:"lazy",className:"h-16 w-full rounded object-cover",onError:()=>h(!0)})}function B(a){const n=new Date(a);return`${n.toLocaleDateString()} ${n.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}`}var j="rounded-md border border-border bg-surface px-2 py-1 text-[11px] text-foreground focus:border-primary focus:outline-none disabled:opacity-50",m="text-[10px] font-medium text-foreground-subtle",I="flex flex-col gap-2 rounded-md border border-border bg-surface/40 p-2",T="text-[10px] font-semibold uppercase tracking-wide text-foreground-subtle",U=5,q=3600,Ne={periodic:"Only on the clock. Predictable, and it notices a change even on a camera nothing ever moves in front of.","on-motion":"Only after the camera has been still again for the quiet window below. Cheapest, but a change nobody walks past is never seen.",both:"Both — the clock is the safety net that lets the motion path miss. This is the right answer for almost every scene."},je={skip:"Sit that light out. No verdict, no alarm, no flag touched — it picks itself back up when a light it knows returns. This is why the night capture is optional.","judge-anyway":"Compare against the references you do have. Only correct when the two lights genuinely look alike (a floodlit driveway, an indoor lamp) — against a real infrared frame it will report a change that did not happen."};function H(a){return{label:a.label,checkIntervalSec:a.checkIntervalSec??60,threshold:a.check.mode==="similarity"?a.check.threshold:.8,hysteresisCount:a.check.hysteresisCount,quietSeconds:a.quietSeconds,minObservationSpacingSec:a.minObservationSpacingSec,confirmPrompt:a.confirm?.prompt??""}}function ve({monitor:a,disabled:n,onPatch:h}){const[r,g]=i.useState(()=>H(a)),[x,d]=i.useState(!1);i.useEffect(()=>{x||g(H(a))},[a,x]);const o=t=>{d(!1),h(t)},c=t=>a.check.mode==="similarity"?{mode:"similarity",threshold:t.threshold??a.check.threshold,hysteresisCount:t.hysteresisCount??a.check.hysteresisCount}:{...a.check,hysteresisCount:t.hysteresisCount??a.check.hysteresisCount},N=a.confirm?.enabled===!0,v=a.check.mode==="similarity"?a.check.threshold:null;return e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:I,children:[e.jsx("p",{className:T,children:"What it watches"}),e.jsxs("label",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:m,children:"Name"}),e.jsx("input",{type:"text",value:r.label,disabled:n,className:j,onFocus:()=>d(!0),onChange:t=>g(l=>({...l,label:t.target.value})),onBlur:()=>{const t=r.label.trim();t.length>0&&t!==a.label?o({label:t}):d(!1)}})]}),e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",checked:a.enabled,disabled:n,onChange:t=>o({enabled:t.target.checked})}),e.jsx("span",{className:m,children:"Watching"})]}),e.jsx("p",{className:p,children:"Turned off, the scene keeps its region, its references and its flag — it simply stops checking. Nothing is lost by pausing one for a while."}),e.jsxs("label",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:m,children:"When to look"}),e.jsxs("select",{value:a.triggerMode,disabled:n,className:j,onChange:t=>{const l=t.target.value;(l==="periodic"||l==="on-motion"||l==="both")&&o({triggerMode:l})},children:[e.jsx("option",{value:"both",children:"On the clock and after motion settles"}),e.jsx("option",{value:"periodic",children:"On the clock only"}),e.jsx("option",{value:"on-motion",children:"After motion settles only"})]})]}),e.jsx("p",{className:p,children:Ne[a.triggerMode]}),e.jsxs("label",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:m,children:"Check every (seconds)"}),e.jsx("input",{type:"number",min:U,max:q,value:r.checkIntervalSec,disabled:n,className:j,onFocus:()=>d(!0),onChange:t=>g(l=>({...l,checkIntervalSec:Number(t.target.value)||0})),onBlur:()=>{const t=$(r.checkIntervalSec,U,q);t!==a.checkIntervalSec?o({checkIntervalSec:t}):d(!1)}})]}),e.jsx("p",{className:p,children:"60 s suits “is the bin still out”. Every check costs one photograph and one encode, so going below about 30 s buys latency you almost never need and multiplies the cost by the number of scenes you own."})]}),e.jsxs("div",{className:I,children:[e.jsx("p",{className:T,children:"How sure it has to be"}),a.check.mode==="similarity"&&e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"flex flex-col gap-1",children:[e.jsxs("span",{className:m,children:["Match threshold — ",e.jsx("span",{className:"tabular-nums",children:r.threshold.toFixed(2)})]}),e.jsx("input",{type:"range",min:.3,max:.99,step:.01,value:r.threshold,disabled:n,onFocus:()=>d(!0),onChange:t=>g(l=>({...l,threshold:Number(t.target.value)})),onMouseUp:()=>{r.threshold!==v?o({check:c({threshold:r.threshold})}):d(!1)},onBlur:()=>{r.threshold!==v?o({check:c({threshold:r.threshold})}):d(!1)}})]}),e.jsx("p",{className:"text-[10px] text-foreground-subtle",children:"How closely the region still has to resemble the photograph to count as unchanged. Higher means fussier: at 0.95 a passing cloud can read as a change; at 0.60 the bin can be taken and the scene will shrug. 0.80 is a sensible start — if it cries wolf, lower it; if it misses the thing you care about, raise it."})]}),e.jsxs("label",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:m,children:"Agreeing checks before it changes its mind"}),e.jsx("input",{type:"number",min:1,max:10,value:r.hysteresisCount,disabled:n,className:j,onFocus:()=>d(!0),onChange:t=>g(l=>({...l,hysteresisCount:Number(t.target.value)||1})),onBlur:()=>{const t=$(r.hysteresisCount,1,10);t!==a.check.hysteresisCount?o({check:c({hysteresisCount:t})}):d(!1)}})]}),e.jsx("p",{className:p,children:"One bad photograph must never be able to flip a scene. 3 agreeing checks at 60 s is about four minutes of latency and is what makes the answer trustworthy — leaving a state costs exactly the same as entering one."}),e.jsxs("label",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:m,children:"Quiet for (seconds) before a check counts"}),e.jsx("input",{type:"number",min:0,max:3600,value:r.quietSeconds,disabled:n,className:j,onFocus:()=>d(!0),onChange:t=>g(l=>({...l,quietSeconds:Number(t.target.value)||0})),onBlur:()=>{const t=$(r.quietSeconds,0,3600);t!==a.quietSeconds?o({quietSeconds:t}):d(!1)}})]}),e.jsx("p",{className:p,children:"A check taken while something is moving is a photograph of the van parked in front of the bin, so it is discarded rather than merely delayed. 0 disables the gate."}),e.jsxs("label",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:m,children:"Minimum gap between counted checks (seconds)"}),e.jsx("input",{type:"number",min:0,max:3600,value:r.minObservationSpacingSec,disabled:n,className:j,onFocus:()=>d(!0),onChange:t=>g(l=>({...l,minObservationSpacingSec:Number(t.target.value)||0})),onBlur:()=>{const t=$(r.minObservationSpacingSec,0,3600);t!==a.minObservationSpacingSec?o({minObservationSpacingSec:t}):d(!1)}})]}),e.jsx("p",{className:p,children:"Spreads the agreeing checks over real time instead of letting three adjacent polls inside one long occlusion be mistaken for three independent opinions."})]}),e.jsxs("div",{className:I,children:[e.jsx("p",{className:T,children:"Lighting"}),e.jsxs("label",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:m,children:"When a light has no reference of its own"}),e.jsxs("select",{value:a.onUncoveredCondition,disabled:n,className:j,onChange:t=>{const l=t.target.value;(l==="skip"||l==="judge-anyway")&&o({onUncoveredCondition:l})},children:[e.jsx("option",{value:"skip",children:"Skip the check (recommended)"}),e.jsx("option",{value:"judge-anyway",children:"Judge against the other light anyway"})]})]}),e.jsx("p",{className:p,children:je[a.onUncoveredCondition]})]}),e.jsxs("div",{className:I,children:[e.jsx("p",{className:T,children:"What you get told"}),e.jsxs("label",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:m,children:"Notifications follow"}),e.jsxs("select",{value:a.emit,disabled:n,className:j,onChange:t=>{const l=t.target.value;(l==="latched"||l==="live")&&o({emit:l})},children:[e.jsx("option",{value:"latched",children:"The flag — told once, still visible at breakfast"}),e.jsx("option",{value:"live",children:"The live state — follows the region as it changes"})]})]}),e.jsx("p",{className:p,children:"“Is the bin gone” is a flag: you want to be told once and still see it later. “Is the gate open” is a live state."}),e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",checked:a.autoRestore,disabled:n,onChange:t=>o({autoRestore:t.target.checked})}),e.jsx("span",{className:m,children:"Clear the flag by itself when things look normal again"})]}),e.jsx("p",{className:p,children:"Off by default, so an alarm never silently clears itself. The “back to normal” moment is recorded either way, so an automation can still react to it."})]}),e.jsxs("div",{className:I,children:[e.jsx("p",{className:T,children:"AI double-check"}),e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",checked:N,disabled:n||r.confirmPrompt.trim().length===0,onChange:t=>o(t.target.checked?{confirm:{...G(r.confirmPrompt.trim()),enabled:!0}}:{confirm:null})}),e.jsx("span",{className:m,children:"Ask a vision model before changing the answer"})]}),e.jsxs("label",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:m,children:"The question to ask"}),e.jsx("input",{type:"text",value:r.confirmPrompt,placeholder:"e.g. Is the wheelie bin still there?",disabled:n,className:j,onFocus:()=>d(!0),onChange:t=>g(l=>({...l,confirmPrompt:t.target.value})),onBlur:()=>{const t=r.confirmPrompt.trim();t.length>0&&t!==a.confirm?.prompt?o({confirm:{...G(t),enabled:N}}):d(!1)}})]}),e.jsxs("p",{className:p,children:["The model is asked ",e.jsx("strong",{children:"only"})," when the region has already changed enough to flip the answer — roughly twice a week for a bin, not once a minute. It reasons about the object rather than the pixels, so rain, shadows and a repositioned bin stop counting as the thing being taken. If it cannot be reached, the change is held rather than announced."]})]})]})}function $(a,n,h){return Math.min(h,Math.max(n,a))}function G(a){return{enabled:!1,prompt:a,timeoutMs:8e3,maxImagePx:448,onTimeout:"hold"}}var E="rounded-md border border-border bg-surface px-2 py-1 text-[11px] font-medium text-foreground-subtle hover:bg-surface-hover disabled:opacity-40 transition-colors",A="rounded-md border border-primary/50 bg-primary/15 px-2.5 py-1 text-[11px] font-medium text-primary hover:bg-primary/25 disabled:opacity-40 transition-colors",ke="rounded-md border border-danger/50 bg-danger/10 px-2 py-1 text-[11px] font-medium text-danger hover:bg-danger/20 disabled:opacity-40 transition-colors",we={alarm:"border-danger/50 bg-danger/15 text-danger",ok:"border-success/50 bg-success/15 text-success",unknown:"border-border bg-surface text-foreground-subtle"},Se=.8,Ce=3;function Ee({deviceId:a}){const n=Q(Z().trpcClient,a),h=ee(n?.state.sceneMonitor),r=te(a,{width:640}),[g,x]=i.useState(null),[d,o]=i.useState(!1),[c,N]=i.useState(null),[v,t]=i.useState(null),[l,O]=i.useState(null),[L,V]=i.useState(null),[w,F]=i.useState(!1),[b,R]=i.useState(null),[S,P]=i.useState(""),k=i.useRef(!0);i.useEffect(()=>(k.current=!0,()=>{k.current=!1}),[]);const _=i.useCallback(async()=>{if(n)try{const s=await n.sceneMonitor?.listScenes({});if(!k.current)return;s&&x(s)}catch(s){if(!k.current)return;se(s)?o(!0):t(s instanceof Error?s.message:String(s))}},[n]);i.useEffect(()=>{x(null),o(!1),t(null),_()},[_]);const M=h?.monitors??g?.monitors??[],Y=Date.now(),y=i.useCallback(async(s,f)=>{N(s),t(null);try{await f(),await _()}catch(u){k.current&&t(u instanceof Error?u.message:String(u))}finally{k.current&&N(null)}},[_]),z=i.useMemo(()=>{const s=M.map(f=>({id:f.id,shape:f.roi,label:f.label,enabled:f.enabled}));return b!==null?[...s,{id:"__draft__",shape:b,label:"New scene"}]:s},[M,b]),X=i.useCallback((s,f)=>{if(f.kind==="rect"){if(s==="__draft__"){R(f);return}y(`roi-${String(s)}`,async()=>n?.sceneMonitor?.updateScene({monitorId:String(s),patch:{roi:f}}))}},[n,y]),J=i.useCallback(s=>{s.kind==="rect"&&R(s)},[]),K=i.useCallback(async()=>{b===null||S.trim().length===0||(await y("create",async()=>{await n?.sceneMonitor?.createScene({label:S.trim(),roi:b,check:{mode:"similarity",threshold:Se,hysteresisCount:Ce}})}),R(null),P(""),F(!1))},[n,b,S,y]);return n?e.jsx("div",{className:"flex flex-col gap-3",children:d?e.jsx("p",{className:`${p} leading-relaxed`,children:"Scene monitoring is not available for this camera."}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:`${p} leading-relaxed`,children:"A scene watches one region of this camera and tells you when it stops looking like the picture you captured. Draw a box around the thing you care about — a wheelie bin, a gate, a parking space — then capture what “normal” looks like. Daylight is enough to start: the night reference is optional, and without it the scene simply sits the infrared hours out instead of reporting a problem."}),e.jsx("div",{className:"relative overflow-hidden rounded-md border border-border",children:e.jsx(ue,{items:z,supportedShapes:["rect"],selectedId:l??(b!==null?"__draft__":null),onSelect:s=>O(s===null?null:String(s)),onShapeChange:X,onDrawComplete:J,drawingKind:w&&b===null?"rect":null,backdrop:r.src!==null?e.jsx("img",{src:r.src,alt:"",className:"h-full w-full object-contain",draggable:!1}):null})}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("button",{type:"button",className:w?A:E,"aria-pressed":w,onClick:()=>{F(s=>!s),R(null)},disabled:c!==null,children:w?"Cancel":"+ New scene"}),e.jsx("button",{type:"button",className:E,onClick:r.refresh,disabled:c!==null,children:"Refresh frame"})]}),w&&e.jsxs("div",{className:"flex flex-col gap-2 rounded-md border border-border bg-surface p-2",children:[e.jsx("p",{className:"text-[10px] text-foreground-subtle",children:b===null?"Click on the frame to drop a box, then drag its corner to fit it around the thing you want watched.":"Name it, then create. You capture what “normal” looks like next."}),b!==null&&ae(b)&&e.jsx("p",{className:"text-[11px] leading-relaxed text-warning",children:"That box covers most of the frame. A scene that big is dominated by the weather, the sky and passing cars — it will quietly stop noticing the thing you actually care about. Draw it tighter."}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"text",value:S,onChange:s=>P(s.target.value),placeholder:"e.g. Immondizia prelevata",className:"flex-1 rounded-md border border-border bg-surface px-2 py-1 text-[12px] text-foreground"}),e.jsx("button",{type:"button",className:A,onClick:()=>{K()},disabled:b===null||S.trim().length===0||c!==null,children:"Create"})]})]}),v!==null&&e.jsx("p",{className:"text-[11px] leading-relaxed text-danger",children:v}),M.length===0?e.jsx("p",{className:`${p} leading-relaxed`,children:"No scenes on this camera yet."}):e.jsx("ul",{className:"flex flex-col gap-2",children:M.map(s=>{const f=ne(s);return e.jsxs("li",{className:`flex flex-col gap-1.5 rounded-md border p-2 ${l===s.id?"border-primary/50":"border-border"}`,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button",className:"flex-1 text-left text-[12px] font-medium text-foreground",onClick:()=>O(s.id),children:s.label}),e.jsx("span",{className:`rounded border px-1.5 py-0.5 text-[10px] font-medium ${we[f.tone]}`,children:f.text})]}),e.jsx("p",{className:`${p} leading-relaxed`,children:re(s,Y)}),e.jsx("p",{className:`${p} tabular-nums`,children:le(s)}),e.jsx(be,{monitor:s,disabled:c!==null,onDelete:({stateId:u,index:C})=>{y(`refdel-${s.id}-${u}-${String(C)}`,async()=>n.sceneMonitor?.deleteReference({monitorId:s.id,stateId:u,index:C}))}}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[oe.map(u=>{const C=u==="ir";return e.jsxs("button",{type:"button",className:E,disabled:c!==null,title:C?"Optional. Without a night reference the checks in infrared are simply skipped — the scene keeps working in daylight and nothing is reported as broken.":`Take a fresh photo now and store it as the ${D(u).toLowerCase()} reference`,onClick:()=>{y(`cap-${s.id}-${u}`,async()=>n.sceneMonitor?.captureReference({monitorId:s.id,condition:u}))},children:[e.jsx(ie,{className:"mr-1 inline h-3 w-3"}),"Capture ",D(u).toLowerCase(),C&&e.jsx("span",{className:"ml-1 text-foreground-subtle/70",children:"(optional)"})]},u)}),e.jsxs("button",{type:"button",className:A,disabled:c!==null||s.states.length===0,title:"Clear the flag and re-photograph what normal looks like right now",onClick:()=>{y(`reset-${s.id}`,async()=>n.sceneMonitor?.resetScene({monitorId:s.id}))},children:[e.jsx(ce,{className:"mr-1 inline h-3 w-3"}),"Reset"]}),e.jsx("button",{type:"button",className:E,disabled:c!==null,onClick:()=>{y(`check-${s.id}`,async()=>n.sceneMonitor?.recheckNow({monitorId:s.id}))},children:"Check now"}),e.jsxs("button",{type:"button",className:L===s.id?A:E,"aria-pressed":L===s.id,"aria-label":`Settings for ${s.label}`,disabled:c!==null,onClick:()=>V(u=>u===s.id?null:s.id),children:[e.jsx(pe,{className:"mr-1 inline h-3 w-3"}),"Settings"]}),e.jsx("button",{type:"button",className:ke,disabled:c!==null,onClick:()=>{y(`del-${s.id}`,async()=>n.sceneMonitor?.deleteScene({monitorId:s.id}))},children:e.jsx(W,{className:"h-3 w-3"})})]}),L===s.id&&e.jsx(ve,{monitor:s,disabled:c!==null,onPatch:u=>{y(`tune-${s.id}`,async()=>n.sceneMonitor?.updateScene({monitorId:s.id,patch:u}))}})]},s.id)})})]})}):null}export{Ee as SceneMonitorEditor};
|
|
1
|
+
import{u as Q,a as Z,e as ee,f as te,r as i,i as se,j as e,T as p,g as ae,h as ne,s as re,k as le,l as oe,C as ie,v as D,R as ce,d as W,c as de,I as he}from"./index-CmR3pWbl.js";import{MaskShapeCanvas as ue}from"./MaskShapeCanvas-DI4BY7W2-CAhI6HPA.js";var pe=de("settings-2",[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]),ge="/addon/pipeline-analytics/event-media";function fe(a){const n=new Map;for(const h of a.states)h.references.forEach((r,g)=>{const x=n.get(r.condition)??[];x.push({stateId:h.id,index:g,reference:r}),n.set(r.condition,x)});return[...n.entries()].map(([h,r])=>({condition:h,tiles:[...r].sort((g,x)=>x.reference.capturedAt-g.reference.capturedAt)})).sort((h,r)=>h.condition.localeCompare(r.condition))}function me(a){return a.states.reduce((n,h)=>n+h.references.length,0)}var xe="rounded border border-danger/50 bg-danger/10 px-1 py-0.5 text-[10px] font-medium text-danger hover:bg-danger/20 disabled:opacity-40 transition-colors";function be({monitor:a,disabled:n,onDelete:h}){const r=fe(a),g=me(a),[x,d]=i.useState(null);return r.length===0?e.jsx("p",{className:`${p} leading-relaxed`,children:"No photographs captured yet. Press “Capture daylight” to take the one this scene will judge everything against."}):e.jsx("div",{className:"flex flex-col gap-2",children:r.map(o=>e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("p",{className:"text-[10px] font-semibold uppercase tracking-wide text-foreground-subtle",children:[D(o.condition)," · ",o.tiles.length]}),e.jsx("ul",{className:"flex flex-wrap gap-1.5",children:o.tiles.map(c=>{const N=`${c.stateId}:${String(c.index)}`,v=g===1,t=x===N;return e.jsxs("li",{className:"flex w-24 flex-col gap-1 rounded-md border border-border p-1",children:[e.jsx(ye,{reference:c.reference}),e.jsx("span",{className:`${p} tabular-nums`,children:B(c.reference.capturedAt)}),e.jsxs("button",{type:"button",className:xe,disabled:n,"aria-label":`Delete the ${D(o.condition).toLowerCase()} photograph from ${B(c.reference.capturedAt)}`,onClick:()=>{if(v&&!t){d(N);return}d(null),h({stateId:c.stateId,index:c.index})},children:[e.jsx(W,{className:"mr-1 inline h-3 w-3"}),t?"Confirm":"Delete"]}),t&&e.jsx("p",{className:"text-[10px] leading-snug text-warning",children:"This is the only photograph this scene has. Delete it and the scene no longer knows what normal looks like — it stops judging until you capture again."})]},N)})})]},o.condition))})}function ye({reference:a}){const[n,h]=i.useState(!1),r=a.thumbnailMediaId;return r===void 0||n?e.jsxs("div",{className:"flex h-16 w-full flex-col items-center justify-center gap-0.5 rounded bg-surface text-foreground-subtle",title:"The picture for this reference is no longer stored. The reference itself is intact and still being scored against.",children:[e.jsx(he,{className:"h-4 w-4"}),e.jsx("span",{className:"text-[9px]",children:"no picture"})]}):e.jsx("img",{src:`${ge}/${encodeURIComponent(r)}`,alt:"",loading:"lazy",className:"h-16 w-full rounded object-cover",onError:()=>h(!0)})}function B(a){const n=new Date(a);return`${n.toLocaleDateString()} ${n.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}`}var j="rounded-md border border-border bg-surface px-2 py-1 text-[11px] text-foreground focus:border-primary focus:outline-none disabled:opacity-50",m="text-[10px] font-medium text-foreground-subtle",I="flex flex-col gap-2 rounded-md border border-border bg-surface/40 p-2",T="text-[10px] font-semibold uppercase tracking-wide text-foreground-subtle",U=5,q=3600,Ne={periodic:"Only on the clock. Predictable, and it notices a change even on a camera nothing ever moves in front of.","on-motion":"Only after the camera has been still again for the quiet window below. Cheapest, but a change nobody walks past is never seen.",both:"Both — the clock is the safety net that lets the motion path miss. This is the right answer for almost every scene."},je={skip:"Sit that light out. No verdict, no alarm, no flag touched — it picks itself back up when a light it knows returns. This is why the night capture is optional.","judge-anyway":"Compare against the references you do have. Only correct when the two lights genuinely look alike (a floodlit driveway, an indoor lamp) — against a real infrared frame it will report a change that did not happen."};function H(a){return{label:a.label,checkIntervalSec:a.checkIntervalSec??60,threshold:a.check.mode==="similarity"?a.check.threshold:.8,hysteresisCount:a.check.hysteresisCount,quietSeconds:a.quietSeconds,minObservationSpacingSec:a.minObservationSpacingSec,confirmPrompt:a.confirm?.prompt??""}}function ve({monitor:a,disabled:n,onPatch:h}){const[r,g]=i.useState(()=>H(a)),[x,d]=i.useState(!1);i.useEffect(()=>{x||g(H(a))},[a,x]);const o=t=>{d(!1),h(t)},c=t=>a.check.mode==="similarity"?{mode:"similarity",threshold:t.threshold??a.check.threshold,hysteresisCount:t.hysteresisCount??a.check.hysteresisCount}:{...a.check,hysteresisCount:t.hysteresisCount??a.check.hysteresisCount},N=a.confirm?.enabled===!0,v=a.check.mode==="similarity"?a.check.threshold:null;return e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:I,children:[e.jsx("p",{className:T,children:"What it watches"}),e.jsxs("label",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:m,children:"Name"}),e.jsx("input",{type:"text",value:r.label,disabled:n,className:j,onFocus:()=>d(!0),onChange:t=>g(l=>({...l,label:t.target.value})),onBlur:()=>{const t=r.label.trim();t.length>0&&t!==a.label?o({label:t}):d(!1)}})]}),e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",checked:a.enabled,disabled:n,onChange:t=>o({enabled:t.target.checked})}),e.jsx("span",{className:m,children:"Watching"})]}),e.jsx("p",{className:p,children:"Turned off, the scene keeps its region, its references and its flag — it simply stops checking. Nothing is lost by pausing one for a while."}),e.jsxs("label",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:m,children:"When to look"}),e.jsxs("select",{value:a.triggerMode,disabled:n,className:j,onChange:t=>{const l=t.target.value;(l==="periodic"||l==="on-motion"||l==="both")&&o({triggerMode:l})},children:[e.jsx("option",{value:"both",children:"On the clock and after motion settles"}),e.jsx("option",{value:"periodic",children:"On the clock only"}),e.jsx("option",{value:"on-motion",children:"After motion settles only"})]})]}),e.jsx("p",{className:p,children:Ne[a.triggerMode]}),e.jsxs("label",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:m,children:"Check every (seconds)"}),e.jsx("input",{type:"number",min:U,max:q,value:r.checkIntervalSec,disabled:n,className:j,onFocus:()=>d(!0),onChange:t=>g(l=>({...l,checkIntervalSec:Number(t.target.value)||0})),onBlur:()=>{const t=$(r.checkIntervalSec,U,q);t!==a.checkIntervalSec?o({checkIntervalSec:t}):d(!1)}})]}),e.jsx("p",{className:p,children:"60 s suits “is the bin still out”. Every check costs one photograph and one encode, so going below about 30 s buys latency you almost never need and multiplies the cost by the number of scenes you own."})]}),e.jsxs("div",{className:I,children:[e.jsx("p",{className:T,children:"How sure it has to be"}),a.check.mode==="similarity"&&e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"flex flex-col gap-1",children:[e.jsxs("span",{className:m,children:["Match threshold — ",e.jsx("span",{className:"tabular-nums",children:r.threshold.toFixed(2)})]}),e.jsx("input",{type:"range",min:.3,max:.99,step:.01,value:r.threshold,disabled:n,onFocus:()=>d(!0),onChange:t=>g(l=>({...l,threshold:Number(t.target.value)})),onMouseUp:()=>{r.threshold!==v?o({check:c({threshold:r.threshold})}):d(!1)},onBlur:()=>{r.threshold!==v?o({check:c({threshold:r.threshold})}):d(!1)}})]}),e.jsx("p",{className:"text-[10px] text-foreground-subtle",children:"How closely the region still has to resemble the photograph to count as unchanged. Higher means fussier: at 0.95 a passing cloud can read as a change; at 0.60 the bin can be taken and the scene will shrug. 0.80 is a sensible start — if it cries wolf, lower it; if it misses the thing you care about, raise it."})]}),e.jsxs("label",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:m,children:"Agreeing checks before it changes its mind"}),e.jsx("input",{type:"number",min:1,max:10,value:r.hysteresisCount,disabled:n,className:j,onFocus:()=>d(!0),onChange:t=>g(l=>({...l,hysteresisCount:Number(t.target.value)||1})),onBlur:()=>{const t=$(r.hysteresisCount,1,10);t!==a.check.hysteresisCount?o({check:c({hysteresisCount:t})}):d(!1)}})]}),e.jsx("p",{className:p,children:"One bad photograph must never be able to flip a scene. 3 agreeing checks at 60 s is about four minutes of latency and is what makes the answer trustworthy — leaving a state costs exactly the same as entering one."}),e.jsxs("label",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:m,children:"Quiet for (seconds) before a check counts"}),e.jsx("input",{type:"number",min:0,max:3600,value:r.quietSeconds,disabled:n,className:j,onFocus:()=>d(!0),onChange:t=>g(l=>({...l,quietSeconds:Number(t.target.value)||0})),onBlur:()=>{const t=$(r.quietSeconds,0,3600);t!==a.quietSeconds?o({quietSeconds:t}):d(!1)}})]}),e.jsx("p",{className:p,children:"A check taken while something is moving is a photograph of the van parked in front of the bin, so it is discarded rather than merely delayed. 0 disables the gate."}),e.jsxs("label",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:m,children:"Minimum gap between counted checks (seconds)"}),e.jsx("input",{type:"number",min:0,max:3600,value:r.minObservationSpacingSec,disabled:n,className:j,onFocus:()=>d(!0),onChange:t=>g(l=>({...l,minObservationSpacingSec:Number(t.target.value)||0})),onBlur:()=>{const t=$(r.minObservationSpacingSec,0,3600);t!==a.minObservationSpacingSec?o({minObservationSpacingSec:t}):d(!1)}})]}),e.jsx("p",{className:p,children:"Spreads the agreeing checks over real time instead of letting three adjacent polls inside one long occlusion be mistaken for three independent opinions."})]}),e.jsxs("div",{className:I,children:[e.jsx("p",{className:T,children:"Lighting"}),e.jsxs("label",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:m,children:"When a light has no reference of its own"}),e.jsxs("select",{value:a.onUncoveredCondition,disabled:n,className:j,onChange:t=>{const l=t.target.value;(l==="skip"||l==="judge-anyway")&&o({onUncoveredCondition:l})},children:[e.jsx("option",{value:"skip",children:"Skip the check (recommended)"}),e.jsx("option",{value:"judge-anyway",children:"Judge against the other light anyway"})]})]}),e.jsx("p",{className:p,children:je[a.onUncoveredCondition]})]}),e.jsxs("div",{className:I,children:[e.jsx("p",{className:T,children:"What you get told"}),e.jsxs("label",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:m,children:"Notifications follow"}),e.jsxs("select",{value:a.emit,disabled:n,className:j,onChange:t=>{const l=t.target.value;(l==="latched"||l==="live")&&o({emit:l})},children:[e.jsx("option",{value:"latched",children:"The flag — told once, still visible at breakfast"}),e.jsx("option",{value:"live",children:"The live state — follows the region as it changes"})]})]}),e.jsx("p",{className:p,children:"“Is the bin gone” is a flag: you want to be told once and still see it later. “Is the gate open” is a live state."}),e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",checked:a.autoRestore,disabled:n,onChange:t=>o({autoRestore:t.target.checked})}),e.jsx("span",{className:m,children:"Clear the flag by itself when things look normal again"})]}),e.jsx("p",{className:p,children:"Off by default, so an alarm never silently clears itself. The “back to normal” moment is recorded either way, so an automation can still react to it."})]}),e.jsxs("div",{className:I,children:[e.jsx("p",{className:T,children:"AI double-check"}),e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",checked:N,disabled:n||r.confirmPrompt.trim().length===0,onChange:t=>o(t.target.checked?{confirm:{...G(r.confirmPrompt.trim()),enabled:!0}}:{confirm:null})}),e.jsx("span",{className:m,children:"Ask a vision model before changing the answer"})]}),e.jsxs("label",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:m,children:"The question to ask"}),e.jsx("input",{type:"text",value:r.confirmPrompt,placeholder:"e.g. Is the wheelie bin still there?",disabled:n,className:j,onFocus:()=>d(!0),onChange:t=>g(l=>({...l,confirmPrompt:t.target.value})),onBlur:()=>{const t=r.confirmPrompt.trim();t.length>0&&t!==a.confirm?.prompt?o({confirm:{...G(t),enabled:N}}):d(!1)}})]}),e.jsxs("p",{className:p,children:["The model is asked ",e.jsx("strong",{children:"only"})," when the region has already changed enough to flip the answer — roughly twice a week for a bin, not once a minute. It reasons about the object rather than the pixels, so rain, shadows and a repositioned bin stop counting as the thing being taken. If it cannot be reached, the change is held rather than announced."]})]})]})}function $(a,n,h){return Math.min(h,Math.max(n,a))}function G(a){return{enabled:!1,prompt:a,timeoutMs:8e3,maxImagePx:448,onTimeout:"hold"}}var E="rounded-md border border-border bg-surface px-2 py-1 text-[11px] font-medium text-foreground-subtle hover:bg-surface-hover disabled:opacity-40 transition-colors",A="rounded-md border border-primary/50 bg-primary/15 px-2.5 py-1 text-[11px] font-medium text-primary hover:bg-primary/25 disabled:opacity-40 transition-colors",ke="rounded-md border border-danger/50 bg-danger/10 px-2 py-1 text-[11px] font-medium text-danger hover:bg-danger/20 disabled:opacity-40 transition-colors",we={alarm:"border-danger/50 bg-danger/15 text-danger",ok:"border-success/50 bg-success/15 text-success",unknown:"border-border bg-surface text-foreground-subtle"},Se=.8,Ce=3;function Ee({deviceId:a}){const n=Q(Z().trpcClient,a),h=ee(n?.state.sceneMonitor),r=te(a,{width:640}),[g,x]=i.useState(null),[d,o]=i.useState(!1),[c,N]=i.useState(null),[v,t]=i.useState(null),[l,O]=i.useState(null),[L,V]=i.useState(null),[w,F]=i.useState(!1),[b,R]=i.useState(null),[S,P]=i.useState(""),k=i.useRef(!0);i.useEffect(()=>(k.current=!0,()=>{k.current=!1}),[]);const _=i.useCallback(async()=>{if(n)try{const s=await n.sceneMonitor?.listScenes({});if(!k.current)return;s&&x(s)}catch(s){if(!k.current)return;se(s)?o(!0):t(s instanceof Error?s.message:String(s))}},[n]);i.useEffect(()=>{x(null),o(!1),t(null),_()},[_]);const M=h?.monitors??g?.monitors??[],Y=Date.now(),y=i.useCallback(async(s,f)=>{N(s),t(null);try{await f(),await _()}catch(u){k.current&&t(u instanceof Error?u.message:String(u))}finally{k.current&&N(null)}},[_]),z=i.useMemo(()=>{const s=M.map(f=>({id:f.id,shape:f.roi,label:f.label,enabled:f.enabled}));return b!==null?[...s,{id:"__draft__",shape:b,label:"New scene"}]:s},[M,b]),X=i.useCallback((s,f)=>{if(f.kind==="rect"){if(s==="__draft__"){R(f);return}y(`roi-${String(s)}`,async()=>n?.sceneMonitor?.updateScene({monitorId:String(s),patch:{roi:f}}))}},[n,y]),J=i.useCallback(s=>{s.kind==="rect"&&R(s)},[]),K=i.useCallback(async()=>{b===null||S.trim().length===0||(await y("create",async()=>{await n?.sceneMonitor?.createScene({label:S.trim(),roi:b,check:{mode:"similarity",threshold:Se,hysteresisCount:Ce}})}),R(null),P(""),F(!1))},[n,b,S,y]);return n?e.jsx("div",{className:"flex flex-col gap-3",children:d?e.jsx("p",{className:`${p} leading-relaxed`,children:"Scene monitoring is not available for this camera."}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:`${p} leading-relaxed`,children:"A scene watches one region of this camera and tells you when it stops looking like the picture you captured. Draw a box around the thing you care about — a wheelie bin, a gate, a parking space — then capture what “normal” looks like. Daylight is enough to start: the night reference is optional, and without it the scene simply sits the infrared hours out instead of reporting a problem."}),e.jsx("div",{className:"relative overflow-hidden rounded-md border border-border",children:e.jsx(ue,{items:z,supportedShapes:["rect"],selectedId:l??(b!==null?"__draft__":null),onSelect:s=>O(s===null?null:String(s)),onShapeChange:X,onDrawComplete:J,drawingKind:w&&b===null?"rect":null,backdrop:r.src!==null?e.jsx("img",{src:r.src,alt:"",className:"h-full w-full object-contain",draggable:!1}):null})}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("button",{type:"button",className:w?A:E,"aria-pressed":w,onClick:()=>{F(s=>!s),R(null)},disabled:c!==null,children:w?"Cancel":"+ New scene"}),e.jsx("button",{type:"button",className:E,onClick:r.refresh,disabled:c!==null,children:"Refresh frame"})]}),w&&e.jsxs("div",{className:"flex flex-col gap-2 rounded-md border border-border bg-surface p-2",children:[e.jsx("p",{className:"text-[10px] text-foreground-subtle",children:b===null?"Click on the frame to drop a box, then drag its corner to fit it around the thing you want watched.":"Name it, then create. You capture what “normal” looks like next."}),b!==null&&ae(b)&&e.jsx("p",{className:"text-[11px] leading-relaxed text-warning",children:"That box covers most of the frame. A scene that big is dominated by the weather, the sky and passing cars — it will quietly stop noticing the thing you actually care about. Draw it tighter."}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"text",value:S,onChange:s=>P(s.target.value),placeholder:"e.g. Immondizia prelevata",className:"flex-1 rounded-md border border-border bg-surface px-2 py-1 text-[12px] text-foreground"}),e.jsx("button",{type:"button",className:A,onClick:()=>{K()},disabled:b===null||S.trim().length===0||c!==null,children:"Create"})]})]}),v!==null&&e.jsx("p",{className:"text-[11px] leading-relaxed text-danger",children:v}),M.length===0?e.jsx("p",{className:`${p} leading-relaxed`,children:"No scenes on this camera yet."}):e.jsx("ul",{className:"flex flex-col gap-2",children:M.map(s=>{const f=ne(s);return e.jsxs("li",{className:`flex flex-col gap-1.5 rounded-md border p-2 ${l===s.id?"border-primary/50":"border-border"}`,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button",className:"flex-1 text-left text-[12px] font-medium text-foreground",onClick:()=>O(s.id),children:s.label}),e.jsx("span",{className:`rounded border px-1.5 py-0.5 text-[10px] font-medium ${we[f.tone]}`,children:f.text})]}),e.jsx("p",{className:`${p} leading-relaxed`,children:re(s,Y)}),e.jsx("p",{className:`${p} tabular-nums`,children:le(s)}),e.jsx(be,{monitor:s,disabled:c!==null,onDelete:({stateId:u,index:C})=>{y(`refdel-${s.id}-${u}-${String(C)}`,async()=>n.sceneMonitor?.deleteReference({monitorId:s.id,stateId:u,index:C}))}}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[oe.map(u=>{const C=u==="ir";return e.jsxs("button",{type:"button",className:E,disabled:c!==null,title:C?"Optional. Without a night reference the checks in infrared are simply skipped — the scene keeps working in daylight and nothing is reported as broken.":`Take a fresh photo now and store it as the ${D(u).toLowerCase()} reference`,onClick:()=>{y(`cap-${s.id}-${u}`,async()=>n.sceneMonitor?.captureReference({monitorId:s.id,condition:u}))},children:[e.jsx(ie,{className:"mr-1 inline h-3 w-3"}),"Capture ",D(u).toLowerCase(),C&&e.jsx("span",{className:"ml-1 text-foreground-subtle/70",children:"(optional)"})]},u)}),e.jsxs("button",{type:"button",className:A,disabled:c!==null||s.states.length===0,title:"Clear the flag and re-photograph what normal looks like right now",onClick:()=>{y(`reset-${s.id}`,async()=>n.sceneMonitor?.resetScene({monitorId:s.id}))},children:[e.jsx(ce,{className:"mr-1 inline h-3 w-3"}),"Reset"]}),e.jsx("button",{type:"button",className:E,disabled:c!==null,onClick:()=>{y(`check-${s.id}`,async()=>n.sceneMonitor?.recheckNow({monitorId:s.id}))},children:"Check now"}),e.jsxs("button",{type:"button",className:L===s.id?A:E,"aria-pressed":L===s.id,"aria-label":`Settings for ${s.label}`,disabled:c!==null,onClick:()=>V(u=>u===s.id?null:s.id),children:[e.jsx(pe,{className:"mr-1 inline h-3 w-3"}),"Settings"]}),e.jsx("button",{type:"button",className:ke,disabled:c!==null,onClick:()=>{y(`del-${s.id}`,async()=>n.sceneMonitor?.deleteScene({monitorId:s.id}))},children:e.jsx(W,{className:"h-3 w-3"})})]}),L===s.id&&e.jsx(ve,{monitor:s,disabled:c!==null,onPatch:u=>{y(`tune-${s.id}`,async()=>n.sceneMonitor?.updateScene({monitorId:s.id,patch:u}))}})]},s.id)})})]})}):null}export{Ee as SceneMonitorEditor};
|