@camstack/addon-pipeline-orchestrator 1.2.60 → 1.2.61

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 (18) hide show
  1. package/assets/viewer/.viewer-version +1 -1
  2. package/assets/viewer/_expo/static/js/web/{index-4af7b8d0114d963dd9578bbf3568891c.js → index-730abbb8a79157d1249d632482ab964c.js} +1 -1
  3. package/assets/viewer/embed/assets/{MaskShapeCanvas-DI4BY7W2-CH_Hz6Y9.js → MaskShapeCanvas-DI4BY7W2-xjPWPmCZ.js} +1 -1
  4. package/assets/viewer/embed/assets/{MotionZonesSettings-NcxxQN8r-DQ3omOYy.js → MotionZonesSettings-NcxxQN8r-DYLpogPU.js} +1 -1
  5. package/assets/viewer/embed/assets/{PrivacyMaskSettings-APgPLF7p-Dwhzj08g.js → PrivacyMaskSettings-APgPLF7p-B5FCvu8Y.js} +1 -1
  6. package/assets/viewer/embed/assets/index-Bxt7VgaT.js +115 -0
  7. package/assets/viewer/embed/index.html +1 -1
  8. package/assets/viewer/index.html +1 -1
  9. package/dist/_stub.js +1 -1
  10. package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_orchestrator_widgets-6Cqy6Gr0.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_orchestrator_widgets-B36q5PAB.mjs} +2 -2
  11. package/dist/_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-C9lde2Rn.mjs +26 -0
  12. package/dist/{hostInit-D4A-CyJ9.mjs → hostInit-DsJazuAQ.mjs} +2 -2
  13. package/dist/index.js +29 -0
  14. package/dist/index.mjs +29 -0
  15. package/dist/remoteEntry.js +1 -1
  16. package/package.json +1 -1
  17. package/assets/viewer/embed/assets/index-aNvo_Arz.js +0 -116
  18. package/dist/_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-OD4Dg1hS.mjs +0 -26
@@ -1 +1 @@
1
- 1.0.321+e348a84
1
+ 1.0.322+0b82850
@@ -405,7 +405,7 @@ __d(function(g,r,i,_a,m,_e,_d){'use strict';m.exports=function(e,n,o,t,a,f,s,d){
405
405
  __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});var t={}},324,[]);
406
406
  __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.installOnUIRuntime=function(t){const o=globalThis?.expo?.installOnUIRuntime;if(!o)throw Error("Native method to install Expo Modules on the worklets UI runtime wasn't found in `expo-modules-core`.");o(t)}},325,[]);
407
407
  __d(function(g,r,i,a,m,e,d){"use strict";var t,n,o;Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AppOwnership",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ExecutionEnvironment",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"UserInterfaceIdiom",{enumerable:!0,get:function(){return o}}),(function(t){t.Expo="expo"})(t||(t={})),(function(t){t.Bare="bare",t.Standalone="standalone",t.StoreClient="storeClient"})(n||(n={})),(function(t){t.Handset="handset",t.Tablet="tablet",t.Desktop="desktop",t.TV="tv",t.Unsupported="unsupported"})(o||(o={}))},326,[]);
408
- __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return s}});var t=r(d[0]);const n=(Date.now()+'-'+Math.floor(1e9*Math.random())).toString();function o(){if('undefined'!=typeof navigator&&'string'==typeof navigator.userAgent){const t=navigator.userAgent.toLowerCase();if(t.includes('edge'))return'Edge';if(t.includes('edg'))return'Chromium Edge';if(t.includes('opr')&&'opr'in window&&window.opr)return'Opera';if(t.includes('chrome')&&'chrome'in window&&window.chrome)return'Chrome';if(t.includes('trident'))return'IE';if(t.includes('firefox'))return'Firefox';if(t.includes('safari'))return'Safari'}}var s={get appOwnership(){return null},get executionEnvironment(){return t.ExecutionEnvironment.Bare},get sessionId(){return n},get isHeadless(){return'undefined'==typeof navigator||/\bHeadlessChrome\//.test(navigator.userAgent)},get expoVersion(){return this.manifest.sdkVersion||null},get linkingUri(){return'undefined'!=typeof location?location.origin:''},get expoRuntimeVersion(){return this.expoVersion},get deviceName(){return o()},get systemFonts(){return[]},get statusBarHeight(){return 0},get deviceYearClass(){return null},get manifest(){return"{\"name\":\"CamStack\",\"slug\":\"camstack\",\"version\":\"1.0.321\",\"sdkVersion\":\"57.0.0\",\"platforms\":[\"ios\",\"android\",\"web\"],\"runtimeVersion\":\"1.0.171\",\"orientation\":\"default\",\"icon\":\"./assets/images/icon.png\",\"scheme\":\"camstack\",\"userInterfaceStyle\":\"automatic\",\"web\":{\"output\":\"single\",\"favicon\":\"./assets/images/favicon.png\",\"shortName\":\"CamStack\",\"backgroundColor\":\"#e67e22\",\"name\":\"CamStack\"},\"experiments\":{\"typedRoutes\":true,\"reactCompiler\":true,\"baseUrl\":\"/viewer/camstack\"},\"extra\":{\"router\":{\"root\":\"app\"},\"eas\":{\"projectId\":\"8fb06894-6375-41ff-959f-1a22a03dbd73\"}},\"updates\":{\"url\":\"https://u.expo.dev/8fb06894-6375-41ff-959f-1a22a03dbd73\"},\"owner\":\"zentik-notifier\"}"},get manifest2(){return null},get experienceUrl(){return'undefined'!=typeof location?location.origin:''},get debugMode(){return!1},getWebViewUserAgentAsync:async()=>'undefined'!=typeof navigator?navigator.userAgent:null}},327,[326]);
408
+ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return s}});var t=r(d[0]);const n=(Date.now()+'-'+Math.floor(1e9*Math.random())).toString();function o(){if('undefined'!=typeof navigator&&'string'==typeof navigator.userAgent){const t=navigator.userAgent.toLowerCase();if(t.includes('edge'))return'Edge';if(t.includes('edg'))return'Chromium Edge';if(t.includes('opr')&&'opr'in window&&window.opr)return'Opera';if(t.includes('chrome')&&'chrome'in window&&window.chrome)return'Chrome';if(t.includes('trident'))return'IE';if(t.includes('firefox'))return'Firefox';if(t.includes('safari'))return'Safari'}}var s={get appOwnership(){return null},get executionEnvironment(){return t.ExecutionEnvironment.Bare},get sessionId(){return n},get isHeadless(){return'undefined'==typeof navigator||/\bHeadlessChrome\//.test(navigator.userAgent)},get expoVersion(){return this.manifest.sdkVersion||null},get linkingUri(){return'undefined'!=typeof location?location.origin:''},get expoRuntimeVersion(){return this.expoVersion},get deviceName(){return o()},get systemFonts(){return[]},get statusBarHeight(){return 0},get deviceYearClass(){return null},get manifest(){return"{\"name\":\"CamStack\",\"slug\":\"camstack\",\"version\":\"1.0.322\",\"sdkVersion\":\"57.0.0\",\"platforms\":[\"ios\",\"android\",\"web\"],\"runtimeVersion\":\"1.0.171\",\"orientation\":\"default\",\"icon\":\"./assets/images/icon.png\",\"scheme\":\"camstack\",\"userInterfaceStyle\":\"automatic\",\"web\":{\"output\":\"single\",\"favicon\":\"./assets/images/favicon.png\",\"shortName\":\"CamStack\",\"backgroundColor\":\"#e67e22\",\"name\":\"CamStack\"},\"experiments\":{\"typedRoutes\":true,\"reactCompiler\":true,\"baseUrl\":\"/viewer/camstack\"},\"extra\":{\"router\":{\"root\":\"app\"},\"eas\":{\"projectId\":\"8fb06894-6375-41ff-959f-1a22a03dbd73\"}},\"updates\":{\"url\":\"https://u.expo.dev/8fb06894-6375-41ff-959f-1a22a03dbd73\"},\"owner\":\"zentik-notifier\"}"},get manifest2(){return null},get experienceUrl(){return'undefined'!=typeof location?location.origin:''},get debugMode(){return!1},getWebViewUserAgentAsync:async()=>'undefined'!=typeof navigator?navigator.userAgent:null}},327,[326]);
409
409
  __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SITEMAP_ROUTE_NAME=e.NOT_FOUND_ROUTE_NAME=e.INTERNAL_SLOT_NAME=void 0,e.INTERNAL_SLOT_NAME='__root',e.NOT_FOUND_ROUTE_NAME='+not-found',e.SITEMAP_ROUTE_NAME='_sitemap'},328,[]);
410
410
  __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.useCurrentRouteInfo=function(){const n=(0,u.useStateForPath)();return(0,t.useMemo)(()=>n?(0,o.getCachedRouteInfo)(n):void 0,[n])};const t=r(d[0]),o=r(d[1]),u=r(d[2])},329,[17,330,338]);
411
411
  __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.routeInfoSubscribe=e.routeInfoSubscribers=void 0,e.getCachedRouteInfo=function(s){let u=o.get(s);if(!u){u=(0,t.getRouteInfoFromState)(s);const f=JSON.stringify(u),c=n.get(f);c?u=c:n.set(f,u),o.set(s,u)}return u},e.setCachedRouteInfo=function(t,s){o.set(t,s),n.set(JSON.stringify(s),s)};const t=r(d[0]),o=new WeakMap,n=new Map;e.routeInfoSubscribers=new Set;e.routeInfoSubscribe=t=>(e.routeInfoSubscribers.add(t),()=>{e.routeInfoSubscribers.delete(t)})},330,[331]);
@@ -1,4 +1,4 @@
1
- import{e as Cd,f as h0,g as Ed,R as Ft,r as _t,j as Tt}from"./index-aNvo_Arz.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.
1
+ import{e as Cd,f as h0,g as Ed,R as Ft,r as _t,j as Tt}from"./index-Bxt7VgaT.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-aNvo_Arz.js";import{MaskShapeCanvas as ne}from"./MaskShapeCanvas-DI4BY7W2-CH_Hz6Y9.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
+ 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-Bxt7VgaT.js";import{MaskShapeCanvas as ne}from"./MaskShapeCanvas-DI4BY7W2-xjPWPmCZ.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 G,a as Q,r as s,i as ee,b as te,j as t,W as se,T as N,S as ne,d as ae,E as re,c as oe}from"./index-aNvo_Arz.js";import{MaskShapeCanvas as le}from"./MaskShapeCanvas-DI4BY7W2-CH_Hz6Y9.js";var ie=oe("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"}]]),de=120,ce="privacy-mask",C="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 Y(i){return i.kind==="rect"||i.kind==="polygon"?i:null}function ue(i){const l=new Set(i.map(k=>k.id));let a=0;for(;l.has(a);)a+=1;return a}function ge(i,l){if(i.length!==l.length)return!1;for(let a=0;a<i.length;a+=1)if(JSON.stringify(i[a])!==JSON.stringify(l[a]))return!1;return!0}function fe({deviceId:i}){const l=G(Q().trpcClient,i),[a,k]=s.useState(null),[v,P]=s.useState(!1),[r,u]=s.useState(null),[g,R]=s.useState(null),[c,z]=s.useState(!1),[x,S]=s.useState(!1),[M,p]=s.useState(null),[b,f]=s.useState(null),w=s.useRef(!1);s.useEffect(()=>{if(!l)return;let e=!1;return w.current=!1,k(null),P(!1),u(null),R(null),S(!1),p(null),f(null),(async()=>{try{const n=await l.privacyMask?.getOptions({});if(e)return;if(!n)throw new Error("device proxy not ready");if(k(n),w.current)return;const o=await l.privacyMask?.getStatus({});if(e)return;if(!o)throw new Error("device proxy not ready");w.current=!0;const d={enabled:o.enabled,regions:o.regions};R(d),u(d)}catch(n){if(e)return;ee(n)?P(!0):console.error("Privacy Mask load failed",n)}})(),()=>{e=!0}},[l]);const A=s.useMemo(()=>r!==null&&g!==null&&(r.enabled!==g.enabled||!ge(r.regions,g.regions)),[r,g]),E=r?r.regions.length:0,h=a?a.maxRegions:0,D=s.useRef(0);s.useEffect(()=>{D.current=h},[h]);const j=h>0&&E>=h,K=s.useCallback(()=>{u(e=>e&&{...e,enabled:!e.enabled})},[]),T=s.useCallback(e=>{p(typeof e=="number"?e:null)},[]),I=s.useMemo(()=>r?r.regions.map(e=>({id:e.id,shape:e.shape,enabled:e.enabled,label:`Zone ${String(e.id)}`})):[],[r]),O=s.useCallback((e,n)=>{const o=Y(n);o&&u(d=>d&&{...d,regions:d.regions.map(m=>m.id===e?{...m,shape:o}:m)})},[]),_=s.useCallback(e=>{const n=Y(e);n&&(f(null),u(o=>{if(!o)return o;const d=D.current;if(d>0&&o.regions.length>=d)return o;const m=ue(o.regions),X={id:m,enabled:!0,shape:n};return p(m),{...o,regions:[...o.regions,X]}}))},[]),$=s.useCallback(e=>{S(!0),p(null),f(e)},[]),q=s.useCallback(e=>{S(!0),f(null),p(e)},[]),B=s.useCallback(e=>{p(n=>n===e?null:n),u(n=>n&&{...n,regions:n.regions.filter(o=>o.id!==e)})},[]),H=s.useCallback(()=>{f(null),p(null),g&&u({enabled:g.enabled,regions:g.regions})},[g]),J=s.useCallback(async()=>{if(!(!l||!r)){z(!0);try{await l.privacyMask?.setMask({patch:{enabled:r.enabled,regions:[...r.regions]}});const e=await l.privacyMask?.getStatus({});if(e){const n={enabled:e.enabled,regions:e.regions};R(n),u(n)}}catch(e){console.error("Privacy Mask save failed",e)}finally{z(!1)}}},[l,r]),U=s.useCallback(()=>{S(e=>(e&&(f(null),p(null)),!e))},[]),L=a?.supportedShapes??[];te(s.useMemo(()=>x&&!v&&a&&r?{id:ce,order:de,node:t.jsx(le,{transparent:!0,items:I,supportedShapes:L,polygonVertices:a.polygonVertices,selectedId:M,onSelect:T,onShapeChange:O,onDrawComplete:_,drawingKind:b})}:null,[x,v,a,r,I,L,M,T,O,_,b]));const W=a?.supportedShapes.includes("rect")??!1,Z=a?.supportedShapes.includes("polygon")??!1,V=a!==null&&(a.maxRegions<=0||a.supportedShapes.length===0),F=!v&&!V&&a!==null&&r!==null;return l?t.jsx(se,{title:"Privacy Mask",icon:t.jsx(re,{className:"h-3.5 w-3.5 text-foreground-subtle"}),children:t.jsx("div",{className:"flex flex-col gap-3",children:v||V?t.jsx("p",{className:`${N} leading-relaxed`,children:"This camera doesn't support an on-board privacy mask."}):F?t.jsxs(t.Fragment,{children:[t.jsxs("p",{className:`${N} leading-relaxed`,children:["Toggle ",t.jsx("strong",{className:"text-foreground",children:"Edit mask"})," to draw blanked-out zones on the live frame, then ",t.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."]}),t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsx("button",{type:"button",onClick:U,disabled:c,"aria-pressed":x,className:x?y:C,children:x?"Done editing":"Edit mask"}),t.jsx("button",{type:"button",onClick:K,disabled:c,"aria-pressed":r.enabled,className:r.enabled?y:C,children:r.enabled?"Mask on":"Mask off"}),W&&t.jsx("button",{type:"button",onClick:()=>$("rect"),disabled:c||j,"aria-pressed":b==="rect",className:b==="rect"?y:C,title:j?"Maximum zones reached":"Add a rectangle zone",children:"+ Rect"}),Z&&t.jsx("button",{type:"button",onClick:()=>$("polygon"),disabled:c||j,"aria-pressed":b==="polygon",className:b==="polygon"?y:C,title:j?"Maximum zones reached":"Add a polygon zone",children:"+ Polygon"}),t.jsxs("span",{className:`${N} ml-1 tabular-nums`,children:[E," / ",h," zones"]}),t.jsx("span",{className:"flex-1"}),t.jsx("button",{type:"button",onClick:H,disabled:c||!A,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"}),t.jsx("button",{type:"button",onClick:()=>{J()},disabled:c||!A,className:y,children:c?"Saving…":"Save"})]}),E>0?t.jsx("div",{className:"flex flex-col gap-1",children:r.regions.map(e=>{const n=M===e.id,o=e.shape.kind==="polygon"?ie:ne;return t.jsxs("div",{className:`flex items-center gap-2 rounded-md border px-2 py-1 transition-colors ${n?"border-primary/50 bg-primary/10":"border-border bg-surface"}`,children:[t.jsxs("button",{type:"button",onClick:()=>q(e.id),disabled:c,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:[t.jsx(o,{className:"h-3.5 w-3.5 shrink-0"}),t.jsxs("span",{children:["Zone ",e.id]}),t.jsx("span",{className:"text-foreground-faint capitalize",children:e.shape.kind})]}),t.jsx("button",{type:"button",onClick:()=>B(e.id),disabled:c,"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:t.jsx(ae,{className:"h-3.5 w-3.5"})})]},e.id)})}):null]}):t.jsx("p",{className:`${N} leading-relaxed`,children:"Loading the camera's privacy mask…"})})}):null}export{fe as PrivacyMaskSettings};
1
+ import{u as G,a as Q,r as s,i as ee,b as te,j as t,W as se,T as N,S as ne,d as ae,E as re,c as oe}from"./index-Bxt7VgaT.js";import{MaskShapeCanvas as le}from"./MaskShapeCanvas-DI4BY7W2-xjPWPmCZ.js";var ie=oe("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"}]]),de=120,ce="privacy-mask",C="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 Y(i){return i.kind==="rect"||i.kind==="polygon"?i:null}function ue(i){const l=new Set(i.map(k=>k.id));let a=0;for(;l.has(a);)a+=1;return a}function ge(i,l){if(i.length!==l.length)return!1;for(let a=0;a<i.length;a+=1)if(JSON.stringify(i[a])!==JSON.stringify(l[a]))return!1;return!0}function fe({deviceId:i}){const l=G(Q().trpcClient,i),[a,k]=s.useState(null),[v,P]=s.useState(!1),[r,u]=s.useState(null),[g,R]=s.useState(null),[c,z]=s.useState(!1),[x,S]=s.useState(!1),[M,p]=s.useState(null),[b,f]=s.useState(null),w=s.useRef(!1);s.useEffect(()=>{if(!l)return;let e=!1;return w.current=!1,k(null),P(!1),u(null),R(null),S(!1),p(null),f(null),(async()=>{try{const n=await l.privacyMask?.getOptions({});if(e)return;if(!n)throw new Error("device proxy not ready");if(k(n),w.current)return;const o=await l.privacyMask?.getStatus({});if(e)return;if(!o)throw new Error("device proxy not ready");w.current=!0;const d={enabled:o.enabled,regions:o.regions};R(d),u(d)}catch(n){if(e)return;ee(n)?P(!0):console.error("Privacy Mask load failed",n)}})(),()=>{e=!0}},[l]);const A=s.useMemo(()=>r!==null&&g!==null&&(r.enabled!==g.enabled||!ge(r.regions,g.regions)),[r,g]),E=r?r.regions.length:0,h=a?a.maxRegions:0,D=s.useRef(0);s.useEffect(()=>{D.current=h},[h]);const j=h>0&&E>=h,K=s.useCallback(()=>{u(e=>e&&{...e,enabled:!e.enabled})},[]),T=s.useCallback(e=>{p(typeof e=="number"?e:null)},[]),I=s.useMemo(()=>r?r.regions.map(e=>({id:e.id,shape:e.shape,enabled:e.enabled,label:`Zone ${String(e.id)}`})):[],[r]),O=s.useCallback((e,n)=>{const o=Y(n);o&&u(d=>d&&{...d,regions:d.regions.map(m=>m.id===e?{...m,shape:o}:m)})},[]),_=s.useCallback(e=>{const n=Y(e);n&&(f(null),u(o=>{if(!o)return o;const d=D.current;if(d>0&&o.regions.length>=d)return o;const m=ue(o.regions),X={id:m,enabled:!0,shape:n};return p(m),{...o,regions:[...o.regions,X]}}))},[]),$=s.useCallback(e=>{S(!0),p(null),f(e)},[]),q=s.useCallback(e=>{S(!0),f(null),p(e)},[]),B=s.useCallback(e=>{p(n=>n===e?null:n),u(n=>n&&{...n,regions:n.regions.filter(o=>o.id!==e)})},[]),H=s.useCallback(()=>{f(null),p(null),g&&u({enabled:g.enabled,regions:g.regions})},[g]),J=s.useCallback(async()=>{if(!(!l||!r)){z(!0);try{await l.privacyMask?.setMask({patch:{enabled:r.enabled,regions:[...r.regions]}});const e=await l.privacyMask?.getStatus({});if(e){const n={enabled:e.enabled,regions:e.regions};R(n),u(n)}}catch(e){console.error("Privacy Mask save failed",e)}finally{z(!1)}}},[l,r]),U=s.useCallback(()=>{S(e=>(e&&(f(null),p(null)),!e))},[]),L=a?.supportedShapes??[];te(s.useMemo(()=>x&&!v&&a&&r?{id:ce,order:de,node:t.jsx(le,{transparent:!0,items:I,supportedShapes:L,polygonVertices:a.polygonVertices,selectedId:M,onSelect:T,onShapeChange:O,onDrawComplete:_,drawingKind:b})}:null,[x,v,a,r,I,L,M,T,O,_,b]));const W=a?.supportedShapes.includes("rect")??!1,Z=a?.supportedShapes.includes("polygon")??!1,V=a!==null&&(a.maxRegions<=0||a.supportedShapes.length===0),F=!v&&!V&&a!==null&&r!==null;return l?t.jsx(se,{title:"Privacy Mask",icon:t.jsx(re,{className:"h-3.5 w-3.5 text-foreground-subtle"}),children:t.jsx("div",{className:"flex flex-col gap-3",children:v||V?t.jsx("p",{className:`${N} leading-relaxed`,children:"This camera doesn't support an on-board privacy mask."}):F?t.jsxs(t.Fragment,{children:[t.jsxs("p",{className:`${N} leading-relaxed`,children:["Toggle ",t.jsx("strong",{className:"text-foreground",children:"Edit mask"})," to draw blanked-out zones on the live frame, then ",t.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."]}),t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsx("button",{type:"button",onClick:U,disabled:c,"aria-pressed":x,className:x?y:C,children:x?"Done editing":"Edit mask"}),t.jsx("button",{type:"button",onClick:K,disabled:c,"aria-pressed":r.enabled,className:r.enabled?y:C,children:r.enabled?"Mask on":"Mask off"}),W&&t.jsx("button",{type:"button",onClick:()=>$("rect"),disabled:c||j,"aria-pressed":b==="rect",className:b==="rect"?y:C,title:j?"Maximum zones reached":"Add a rectangle zone",children:"+ Rect"}),Z&&t.jsx("button",{type:"button",onClick:()=>$("polygon"),disabled:c||j,"aria-pressed":b==="polygon",className:b==="polygon"?y:C,title:j?"Maximum zones reached":"Add a polygon zone",children:"+ Polygon"}),t.jsxs("span",{className:`${N} ml-1 tabular-nums`,children:[E," / ",h," zones"]}),t.jsx("span",{className:"flex-1"}),t.jsx("button",{type:"button",onClick:H,disabled:c||!A,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"}),t.jsx("button",{type:"button",onClick:()=>{J()},disabled:c||!A,className:y,children:c?"Saving…":"Save"})]}),E>0?t.jsx("div",{className:"flex flex-col gap-1",children:r.regions.map(e=>{const n=M===e.id,o=e.shape.kind==="polygon"?ie:ne;return t.jsxs("div",{className:`flex items-center gap-2 rounded-md border px-2 py-1 transition-colors ${n?"border-primary/50 bg-primary/10":"border-border bg-surface"}`,children:[t.jsxs("button",{type:"button",onClick:()=>q(e.id),disabled:c,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:[t.jsx(o,{className:"h-3.5 w-3.5 shrink-0"}),t.jsxs("span",{children:["Zone ",e.id]}),t.jsx("span",{className:"text-foreground-faint capitalize",children:e.shape.kind})]}),t.jsx("button",{type:"button",onClick:()=>B(e.id),disabled:c,"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:t.jsx(ae,{className:"h-3.5 w-3.5"})})]},e.id)})}):null]}):t.jsx("p",{className:`${N} leading-relaxed`,children:"Loading the camera's privacy mask…"})})}):null}export{fe as PrivacyMaskSettings};