@camstack/addon-admin-ui 0.1.16 → 0.1.17
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/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-DlquBRmD.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-CziSE-Do.js} +1 -1
- package/dist/assets/{devices-CVfa8e_5.js → devices-BfsgGvwu.js} +1 -1
- package/dist/assets/{hostInit-Bq0J4U4L.js → hostInit-7yPTCcmg.js} +1 -1
- package/dist/assets/{index-C5--Sp9A.js → index-BlKJSHE9.js} +2 -2
- package/dist/assets/index-C-M4yvxf.js +1 -0
- package/dist/assets/{index-BqEwAQt-.js → index-DculG9Gi.js} +2 -2
- package/dist/assets/index-DfH297U6.js +1 -0
- package/dist/assets/{index-CJH_U_aT.js → index-Dvmk3HcY.js} +1 -1
- package/dist/assets/index-K1-f6oQr.js +1 -0
- package/dist/assets/{index-Bftw8yZ0.js → index-X-IEwb-L.js} +2 -2
- package/dist/assets/index-cfq-Npln.js +1 -0
- package/dist/assets/{index-CLnkxPD7.js → index-iCcWZGKs.js} +1 -1
- package/dist/assets/index-ptcmLXsE.js +1 -0
- package/dist/assets/{remoteEntry-qFyESaJr.js → remoteEntry-Da_G1gka.js} +1 -1
- package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-cGbq1Btt.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-kSAHDLPS.js} +2 -2
- package/dist/index.html +3 -3
- package/dist/mf-entry-bootstrap-0.js +2 -2
- package/dist/sw.js +1 -1
- package/package.json +1 -1
- package/dist/assets/index-B3BmQjhl.js +0 -1
- package/dist/assets/index-BYRl5bfb.js +0 -1
- package/dist/assets/index-gZlh9vZc.js +0 -1
- package/dist/assets/index-o6URf7uT.js +0 -1
- package/dist/assets/index-otlbS_ZJ.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as t,a as l,_ as m,s as e,r as b,l as k,n,b as y,c as D,d as v,u as S,e as Je,f as R,g as St,h as B,t as Un,i as Fi,j as Hn,k as Ui,Z as Hi,m as $i,p as Wi,q as ji,v as Gi,w as Vi,x as $n,y as Ki,z as Zi}from"./schemas-XgIEoUz3.js";const Yi=["onnx","coreml","openvino","tflite","pt"],Qi=[{id:"overview",label:"Overview",icon:"layout-dashboard",order:-10},{id:"general",label:"General",icon:"settings",order:0},{id:"image",label:"Image",icon:"image",order:5},{id:"light",label:"Light",icon:"lightbulb",order:7},{id:"motion",label:"Motion",icon:"activity",order:10},{id:"audio",label:"Audio",icon:"mic",order:12},{id:"alarms",label:"Alarms",icon:"bell-ring",order:13},{id:"snapshot",label:"Snapshot",icon:"camera",order:15},{id:"osd",label:"OSD",icon:"type",order:18},{id:"stream-broker",label:"Stream Broker",icon:"radio",order:20},{id:"streaming",label:"Streaming",icon:"video",order:35},{id:"pipeline",label:"Detection Pipeline",icon:"cpu",order:39},{id:"zones",label:"Detection",icon:"shapes",order:38},{id:"live-stats",label:"Live Stats",icon:"activity",order:39},{id:"recording",label:"Recording",icon:"circle-dot",order:40},{id:"engine",label:"Inference Engine",icon:"zap",order:41},{id:"scheduler",label:"Scheduler",icon:"list-checks",order:42},{id:"decoder",label:"Decoder",icon:"film",order:43},{id:"notifications",label:"Notifications",icon:"bell",order:50},{id:"network",label:"Network",icon:"globe",order:60},{id:"storage",label:"Storage",icon:"hard-drive",order:70},{id:"advanced",label:"Advanced",icon:"wrench",order:100}],Dl=Object.fromEntries(Qi.map(s=>[s.id,s]));function Ji(s){return s.type==="separator"||s.type==="info"||s.type==="button"||s.type==="object-array"||s.type==="widget"||s.type==="addon-action-button"}function Yt(s,o){return{...s.tabs?{tabs:[...s.tabs]}:{},sections:s.sections.map(i=>({...i,fields:i.fields.map(c=>Xe(c,o))}))}}function Xe(s,o){if(Ji(s))return s;if(s.type==="group"){const h=s.fields.map(A=>Xe(A,o));return{...s,fields:h}}if(s.type==="sub-tabs"){const h=s.tabs.map(A=>({...A,fields:A.fields.map(C=>Xe(C,o))}));return{...s,tabs:h}}const i=s.key,c=Object.prototype.hasOwnProperty.call(o,i)?o[i]:void 0,u=s.default;if(s.multiple){const h=Array.isArray(c)?c:c!=null?[c]:[],I=s.multiple.itemDefault!==void 0?s.multiple.itemDefault:u!==void 0?u:Xi(s)==="string"?"":null,A=Math.max(s.multiple.min,h.length),C=[];for(let P=0;P<A;P++)C.push(P<h.length?h[P]:I);return{...s,value:C}}const g=c!==void 0?c:u!==void 0?u:null,f=s.type==="textarea"&&s.isJson&&g!==null&&typeof g=="object"?JSON.stringify(g,null,2):g;return{...s,value:f}}function Xi(s){switch(s.type){case"text":case"textarea":case"password":case"color":case"probe":return"string";case"number":case"slider":return"number";case"boolean":return"boolean";default:return"other"}}const Q=v(["data","media","recordings","recordings-high","recordings-low","recordings-clips","event-images","models","cache","logs","addons-data","backups"]),Ml={data:"singleton",media:"singleton",cache:"singleton",logs:"singleton","addons-data":"singleton",models:"singleton","event-images":"singleton",recordings:"multi","recordings-high":"multi","recordings-low":"multi","recordings-clips":"multi",backups:"multi"},q=t({id:e().regex(/^[a-z][a-z0-9-]*:[a-z0-9-]+$/),type:Q,displayName:e().min(1),providerId:e().min(1),config:b(e(),S()),isDefault:y().default(!1),isSystem:y().default(!1),createdAt:n(),updatedAt:n()}),z=R([Q,e().regex(/^[a-z][a-z0-9-]*:[a-z0-9-]+$/)]),ea=t({inputFps:n(),outputFps:n(),avgDecodeTimeMs:n(),droppedFrames:n()}),Qt=t({codec:e(),maxFps:n().default(0),outputFormat:v(["jpeg","rgb","bgr","yuv420","gray"]).default("jpeg"),scale:n().default(1),width:n().optional(),height:n().optional(),deviceId:n().int().nonnegative().optional(),tag:e().optional()});function ta(s){return s instanceof Error?s.message:typeof s=="string"?s:String(s)}const na=[{id:"speech",name:"Speech",icon:"🗣️"},{id:"scream",name:"Scream / Shout",icon:"😱"},{id:"crying",name:"Crying / Baby",icon:"😢"},{id:"laughter",name:"Laughter",icon:"😂"},{id:"music",name:"Music",icon:"🎵"},{id:"dog",name:"Dog",icon:"🐕"},{id:"cat",name:"Cat",icon:"🐈"},{id:"bird",name:"Bird",icon:"🐦"},{id:"animal",name:"Animal (other)",icon:"🐾"},{id:"alarm",name:"Alarm / Siren",icon:"🚨"},{id:"doorbell",name:"Doorbell / Knock",icon:"🔔"},{id:"glass_breaking",name:"Glass Breaking",icon:"💥"},{id:"gunshot",name:"Gunshot / Explosion",icon:"💣"},{id:"vehicle",name:"Vehicle",icon:"🚗"},{id:"siren",name:"Emergency Siren",icon:"🚑"},{id:"fire",name:"Fire / Smoke",icon:"🔥"},{id:"water",name:"Water",icon:"💧"},{id:"wind",name:"Wind / Weather",icon:"🌬️"},{id:"door",name:"Door",icon:"🚪"},{id:"footsteps",name:"Footsteps",icon:"👣"},{id:"crowd",name:"Crowd / Chatter",icon:"👥"},{id:"telephone",name:"Telephone",icon:"📞"},{id:"engine",name:"Engine / Motor",icon:"⚙️"},{id:"tools",name:"Tools / Construction",icon:"🔨"},{id:"silence",name:"Silence",icon:"🤫"}],ia={mapping:{Speech:"speech","Child speech, kid speaking":"speech",Conversation:"speech","Narration, monologue":"speech",Babbling:"speech",Whispering:"speech","Speech synthesizer":"speech",Humming:"speech",Rapping:"speech",Singing:"speech",Choir:"speech","Child singing":"speech",Shout:"scream",Bellow:"scream",Yell:"scream",Screaming:"scream","Children shouting":"scream",Whoop:"scream","Crying, sobbing":"crying","Baby cry, infant cry":"crying",Whimper:"crying","Wail, moan":"crying",Groan:"crying",Laughter:"laughter","Baby laughter":"laughter",Giggle:"laughter",Snicker:"laughter","Belly laugh":"laughter","Chuckle, chortle":"laughter",Music:"music","Musical instrument":"music",Guitar:"music",Piano:"music",Drum:"music","Drum kit":"music","Violin, fiddle":"music",Flute:"music",Saxophone:"music",Trumpet:"music",Synthesizer:"music","Pop music":"music","Rock music":"music","Hip hop music":"music","Classical music":"music",Jazz:"music","Electronic music":"music","Background music":"music",Dog:"dog",Bark:"dog",Yip:"dog",Howl:"dog","Bow-wow":"dog",Growling:"dog","Whimper (dog)":"dog",Cat:"cat",Purr:"cat",Meow:"cat",Hiss:"cat",Caterwaul:"cat",Bird:"bird","Bird vocalization, bird call, bird song":"bird","Chirp, tweet":"bird",Squawk:"bird",Crow:"bird",Owl:"bird","Pigeon, dove":"bird",Animal:"animal","Domestic animals, pets":"animal","Livestock, farm animals, working animals":"animal",Horse:"animal","Cattle, bovinae":"animal",Pig:"animal",Sheep:"animal",Goat:"animal",Frog:"animal",Insect:"animal",Cricket:"animal",Alarm:"alarm","Alarm clock":"alarm","Smoke detector, smoke alarm":"alarm","Fire alarm":"alarm",Buzzer:"alarm","Civil defense siren":"alarm","Car alarm":"alarm",Siren:"siren","Police car (siren)":"siren","Ambulance (siren)":"siren","Fire engine, fire truck (siren)":"siren","Emergency vehicle":"siren",Foghorn:"siren",Doorbell:"doorbell","Ding-dong":"doorbell",Knock:"doorbell",Tap:"doorbell",Glass:"glass_breaking",Shatter:"glass_breaking","Chink, clink":"glass_breaking","Gunshot, gunfire":"gunshot","Machine gun":"gunshot",Explosion:"gunshot",Fireworks:"gunshot",Firecracker:"gunshot","Artillery fire":"gunshot","Cap gun":"gunshot",Boom:"gunshot",Vehicle:"vehicle",Car:"vehicle",Truck:"vehicle",Bus:"vehicle",Motorcycle:"vehicle","Car passing by":"vehicle","Vehicle horn, car horn, honking":"vehicle","Traffic noise, roadway noise":"vehicle",Train:"vehicle",Aircraft:"vehicle",Helicopter:"vehicle",Bicycle:"vehicle",Skateboard:"vehicle",Fire:"fire",Crackle:"fire",Water:"water",Rain:"water",Raindrop:"water","Rain on surface":"water",Stream:"water",Waterfall:"water",Ocean:"water","Waves, surf":"water","Splash, splatter":"water",Wind:"wind",Thunderstorm:"wind",Thunder:"wind","Wind noise (microphone)":"wind","Rustling leaves":"wind",Door:"door","Sliding door":"door",Slam:"door","Cupboard open or close":"door","Walk, footsteps":"footsteps",Run:"footsteps",Shuffle:"footsteps",Crowd:"crowd",Chatter:"crowd",Cheering:"crowd",Applause:"crowd","Children playing":"crowd","Hubbub, speech noise, speech babble":"crowd",Telephone:"telephone","Telephone bell ringing":"telephone",Ringtone:"telephone","Telephone dialing, DTMF":"telephone","Busy signal":"telephone",Engine:"engine","Engine starting":"engine",Idling:"engine","Accelerating, revving, vroom":"engine","Light engine (high frequency)":"engine","Medium engine (mid frequency)":"engine","Heavy engine (low frequency)":"engine","Lawn mower":"engine",Chainsaw:"engine",Hammer:"tools",Jackhammer:"tools",Sawing:"tools","Power tool":"tools",Drill:"tools",Sanding:"tools",Silence:"silence"},preserveOriginal:!1},aa={mapping:{speech:"speech",child_speech:"speech",conversation:"speech",whispering:"speech",singing:"speech",humming:"speech",shout:"scream",yell:"scream",screaming:"scream",crying:"crying",baby_crying:"crying",sobbing:"crying",laughter:"laughter",baby_laughter:"laughter",giggling:"laughter",music:"music",guitar:"music",piano:"music",drums:"music",dog_bark:"dog",dog_bow_wow:"dog",dog_growling:"dog",dog_howl:"dog",cat_meow:"cat",cat_purr:"cat",cat_hiss:"cat",bird:"bird",bird_chirp:"bird",bird_squawk:"bird",animal:"animal",horse:"animal",cow_moo:"animal",insect:"animal",alarm:"alarm",smoke_alarm:"alarm",fire_alarm:"alarm",car_alarm:"alarm",siren:"siren",police_siren:"siren",ambulance_siren:"siren",doorbell:"doorbell",door_knock:"doorbell",knocking:"doorbell",glass_breaking:"glass_breaking",glass_shatter:"glass_breaking",gunshot:"gunshot",explosion:"gunshot",fireworks:"gunshot",car:"vehicle",truck:"vehicle",motorcycle:"vehicle",car_horn:"vehicle",vehicle_horn:"vehicle",traffic:"vehicle",fire:"fire",fire_crackle:"fire",water:"water",rain:"water",ocean:"water",splash:"water",wind:"wind",thunder:"wind",thunderstorm:"wind",door:"door",door_slam:"door",sliding_door:"door",footsteps:"footsteps",walking:"footsteps",running:"footsteps",crowd:"crowd",chatter:"crowd",cheering:"crowd",applause:"crowd",telephone_ring:"telephone",ringtone:"telephone",engine:"engine",engine_starting:"engine",lawn_mower:"engine",chainsaw:"engine",hammer:"tools",jackhammer:"tools",drill:"tools",power_tool:"tools",silence:"silence"},preserveOriginal:!1},bt=new Map;for(const[s,o]of Object.entries(ia.mapping))bt.set(s.toLowerCase(),o);for(const[s,o]of Object.entries(aa.mapping))bt.set(s.toLowerCase(),o);function Tl(s){return bt.get(s.toLowerCase())??null}function Rl(){return na.map(s=>s.id)}var w=(s=>(s.Camera="camera",s.Hub="hub",s.Light="light",s.Siren="siren",s.Switch="switch",s.Sensor="sensor",s.Thermostat="thermostat",s.Button="button",s.Generic="generic",s))(w||{}),Wn=(s=>(s.BatteryOperated="battery-operated",s.Rebootable="rebootable",s.NativeSnapshot="native-snapshot",s.DoorbellButton="doorbell-button",s.TwoWayAudio="two-way-audio",s.PanTiltZoom="pan-tilt-zoom",s.PtzAutotrack="ptz-autotrack",s.MotionTrigger="motion-trigger",s))(Wn||{}),oa=(s=>(s.ChargingDC="charging-dc",s.ChargingSolar="charging-solar",s.NotCharging="not-charging",s))(oa||{}),_=(s=>(s.Siren="siren",s.Floodlight="floodlight",s.Spotlight="spotlight",s.PirSensor="pir-sensor",s.Chime="chime",s.Autotrack="autotrack",s.Nightvision="nightvision",s.PrivacyMask="privacy-mask",s.Doorbell="doorbell",s))(_||{});const U={Siren:_.Siren,Floodlight:_.Floodlight,Spotlight:_.Spotlight,PirSensor:_.PirSensor,Chime:_.Chime,Autotrack:_.Autotrack,Nightvision:_.Nightvision,PrivacyMask:_.PrivacyMask},El={[U.Siren]:"Siren",[U.Floodlight]:"Floodlight",[U.Spotlight]:"Spotlight",[U.PirSensor]:"PIR",[U.Chime]:"Chime",[U.Autotrack]:"Autotracking",[U.Nightvision]:"Night Vision",[U.PrivacyMask]:"Privacy Mask"};function ql(s,o,i){const c=`${s}:${o}`;return typeof i=="number"?`${c}:${i}`:c}function sa(s,o){return!s||s.length===0?!1:s.includes(o.when.hasFeature)}const ra={id:"battery",label:"Battery-operated camera",when:{hasFeature:Wn.BatteryOperated},defaults:{audioMode:"disabled",detectionMode:"on-motion"},settings:{"snapshot.minRefreshIntervalSec":3600,"streamBroker.preBufferEnabled":!1}},da=[ra];function Bl(s){for(const o of da)if(sa(s,o))return o;return null}const qe=t({online:y(),lastChangedAt:n()}),It={name:"device-status",scope:"device",mode:"singleton",methods:{},events:{onStatusChanged:{data:t({deviceId:n(),status:qe})}},status:{schema:qe,kind:"push"},runtimeState:qe},Be=t({flags:b(e(),S()),deviceType:e().nullable(),model:e().nullable(),channelCount:n().nullable(),lastProbedAt:n(),lastFetchedAt:n()}),kt={name:"feature-probe",scope:"device",mode:"singleton",methods:{},events:{onProbeChanged:{data:t({deviceId:n(),status:Be})}},status:{schema:Be,kind:"push"},runtimeState:Be},ca=t({id:e(),title:e(),description:e().optional(),style:v(["card","accordion"]).optional(),defaultCollapsed:y().optional(),columns:R([k(1),k(2),k(3),k(4)]).optional(),tab:e().optional(),location:v(["settings","top-tab"]).optional(),order:n().optional(),fields:l(Hn())}),la=t({id:e(),label:e(),icon:e(),order:n().optional()}),ua=t({tabs:l(la).optional(),sections:l(ca)}),Jt=ua.nullable(),ma={getDeviceSettingsContribution:{input:t({deviceId:n()}),output:Jt,kind:"query",auth:"protected"},getDeviceLiveContribution:{input:t({deviceId:n()}),output:Jt,kind:"query",auth:"protected"},applyDeviceSettingsPatch:{input:t({deviceId:n(),patch:b(e(),S())}),output:t({success:k(!0)}),kind:"mutation",auth:"admin"}},pa={getStatus:{input:t({deviceId:n()}),output:S().nullable(),kind:"query",auth:"protected"}};function xl(s){let o=s.methods;return s.exposesDeviceSettings&&(o={...ma,...o}),s.status&&(o={...pa,...o}),o}function r(s,o,i){return{input:s,output:o,kind:i?.kind??"query",auth:i?.auth??"protected",timeoutMs:i?.timeoutMs}}function G(s){return{data:s}}const ga=t({className:e(),hits:n().int().nonnegative(),avgScore:n().min(0).max(1),peakScore:n().min(0).max(1)}),Xt=t({ts:n().int(),windowSec:n().int().positive(),level:t({rms:n(),dbfs:n()}),peakDbfs:n(),avgDbfs:n(),current:t({className:e(),score:n().min(0).max(1),timestamp:n().int()}).nullable(),byClass:l(ga).readonly()}),ha=t({ts:n().int(),dbfs:n().nullable(),peakDbfs:n(),avgDbfs:n(),topClass:e().nullable(),topScore:n().min(0).max(1).nullable()}),ya=t({points:l(ha).readonly(),effectiveSampleEveryMs:n().int().positive(),windowMsActual:n().int().nonnegative()}),jn={name:"audio-metrics",scope:"device",mode:"singleton",deviceTypes:[w.Camera],methods:{getCurrentSnapshot:r(t({deviceId:n()}),Xt.nullable()),getHistory:r(t({deviceId:n(),windowSec:n().int().positive().optional(),sampleEveryMs:n().int().positive().optional()}),ya)},runtimeState:Xt},xe=t({percentage:n().min(0).max(100),charging:v(["dc","solar","none"]),sleeping:y(),lastUpdated:n()}),Gn={name:"battery",scope:"device",mode:"singleton",deviceTypes:[w.Camera,w.Sensor,w.Button,w.Switch],methods:{},events:{onStatusChanged:{data:t({deviceId:n(),status:xe})}},status:{schema:xe,kind:"push"},runtimeState:xe},en=t({percentage:n().min(0).max(100),lastChangedAt:n()}),Vn={name:"brightness",scope:"device",mode:"singleton",deviceTypes:[w.Light],methods:{setBrightness:r(t({deviceId:n().int().nonnegative(),percentage:n().min(0).max(100)}),m(),{kind:"mutation",auth:"admin"})},events:{onBrightnessChanged:{data:t({deviceId:n(),percentage:n().min(0).max(100),lastChangedAt:n()})}},status:{schema:en,kind:"command-driven"},runtimeState:en},$=v(["high","mid","low"]),Ol=["high","mid","low"],Kn=v(["pull-rtsp","pull-rtmp","pull-http","pull-rfc4571","push-annexb"]),At=t({width:n().int().positive(),height:n().int().positive()}),et=t({camStreamId:e().min(1),deviceId:n().int().nonnegative(),kind:Kn,url:e().optional(),codec:e().optional(),resolution:At.optional(),fps:n().positive().optional(),label:e().optional(),deviceFeatures:l(e()).optional(),autoEligible:y().optional(),metadata:b(e(),S()).optional()}),Se=v(["unassigned","idle","connecting","streaming","error"]),tt=t({deviceId:n().int().nonnegative(),profile:$,brokerId:e(),sourceCamStreamId:e().nullable(),status:Se,resolution:At.optional(),codec:e().optional(),preBufferSec:n().nonnegative().optional(),errorMessage:e().optional()}),fa=t({id:e(),label:e(),protocol:v(["rtsp","rtmp","annexb","http-mjpeg","webrtc","custom"]),url:e().optional(),resolution:t({width:n(),height:n()}).readonly().optional(),fps:n().optional(),bitrate:n().optional(),codec:e().optional(),profileHint:v(["high","mid","low"]).optional()}),Nl=t({type:e(),url:e(),videoCodec:e().optional(),audioCodec:e().optional(),metadata:b(e(),S()).readonly().optional()}),va=t({type:v(["video","audio"]),data:D(Uint8Array),pts:n(),dts:n(),keyframe:y(),codec:e()}),Sa=t({data:D(Uint8Array),width:n(),height:n(),format:v(["jpeg","rgb","bgr","yuv420","gray"]),timestamp:n()}),ba=v(["idle","connecting","streaming","error","stopped"]),Ia=t({status:ba,inputFps:n(),decodeFps:n(),encodedSubscribers:n(),decodedSubscribers:n(),uptimeMs:n(),bitrateKbps:n(),idrIntervalMs:n(),codec:e().optional(),totalBytes:n(),packetCount:n(),rtspClients:n(),pipeClients:n(),preBufferSec:n(),preBufferMs:n(),preBufferPackets:n(),decoderNodeId:e().nullable(),audio:t({codec:e(),sampleRate:n(),channels:n(),supported:y()}).nullable().optional()}),Ct=v(["webrtc","hls","mjpeg","rtsp"]),ka=t({streamId:e(),format:Ct,url:e().nullable(),active:y()}),Aa={name:"streaming-engine",scope:"system",mode:"singleton",internal:!0,methods:{registerStream:r(t({streamId:e(),sourceUrl:e(),codec:e().optional()}),m(),{kind:"mutation"}),unregisterStream:r(t({streamId:e()}),m(),{kind:"mutation"}),getStreamUrl:r(t({streamId:e(),format:Ct}),e().nullable()),listStreams:r(m(),l(ka))}},nt=t({brokerId:e(),url:e(),mutedUrl:e(),enabled:y()}),Ca=t({sessionId:e(),remoteAddr:e(),playing:y(),muted:y(),connectedAt:n(),lastRtpAt:n(),bytesSent:n()}),wa=t({tag:e(),subscribedAt:n(),maxFps:n(),framesDelivered:n(),framesDropped:n()}),Pa=t({tag:e(),subscribedAt:n(),chunksDelivered:n()}),Da=t({rtsp:l(Ca).readonly(),decoded:l(wa).readonly(),audio:l(Pa).readonly(),pipeClients:n(),encodedSubscribers:n()}),Ll=v(["reconnecting","sleeping","offline","disabled","waking"]),Ma={name:"stream-broker",scope:"system",mode:"singleton",exposesDeviceSettings:!0,methods:{publishCameraStream:r(t({deviceId:n().int().nonnegative(),camStreamId:e().min(1),kind:Kn,url:e().optional(),codec:e().optional(),resolution:At.optional(),fps:n().positive().optional(),label:e().optional(),deviceFeatures:l(e()).optional(),autoEligible:y().optional(),metadata:b(e(),S()).optional()}),t({success:k(!0)}),{kind:"mutation",auth:"admin"}),retractCameraStream:r(t({deviceId:n().int().nonnegative(),camStreamId:e().min(1)}),t({success:k(!0)}),{kind:"mutation",auth:"admin"}),assignProfile:r(t({deviceId:n().int().nonnegative(),profile:$,camStreamId:e().min(1)}),t({success:k(!0)}),{kind:"mutation",auth:"admin"}),unassignProfile:r(t({deviceId:n().int().nonnegative(),profile:$}),t({success:k(!0)}),{kind:"mutation",auth:"admin"}),listAllCameraStreams:r(m(),l(et).readonly()),listAllProfileSlots:r(m(),l(tt).readonly()),getBrokerStats:r(t({brokerId:e()}),Ia),listClients:r(t({brokerId:e()}),Da),killClient:r(t({brokerId:e(),channel:v(["rtsp","decoded","audio"]),handle:e()}),t({killed:y()}),{kind:"mutation",auth:"admin"}),restartProfile:r(t({deviceId:n().int().nonnegative(),profile:$}),t({success:y()}),{kind:"mutation",auth:"admin"}),getStreamUrl:r(t({streamId:e(),format:Ct}),t({url:e()})),getBroker:r(t({brokerId:e()}),B()),setPreBufferDuration:r(t({brokerId:e(),seconds:n().min(0).max(30)}),m(),{kind:"mutation",auth:"admin"}),getPreBufferInfo:r(t({brokerId:e()}),t({configuredSec:n(),bufferedMs:n(),packetCount:n()})),getRtspPort:r(m(),n()),getAllRtspEntries:r(t({hostname:e().optional()}),l(nt).readonly()),getRtspEntry:r(t({brokerId:e(),hostname:e().optional()}),nt.nullable()),regenerateRtspToken:r(t({brokerId:e()}),e().nullable(),{kind:"mutation",auth:"admin"}),setRtspEnabled:r(t({brokerId:e(),enabled:y()}),m(),{kind:"mutation",auth:"admin"}),isRtspEnabled:r(t({brokerId:e()}),y())},events:{onCamStreamDemand:G(t({deviceId:n().int().nonnegative(),camStreamId:e(),profile:$})),onCamStreamIdle:G(t({deviceId:n().int().nonnegative(),camStreamId:e()})),onRequestStreamSourceRefresh:G(t({deviceId:n().int().nonnegative(),camStreamId:e(),brokerId:e()}))}},Zn={name:"camera-streams",scope:"device",mode:"singleton",deviceTypes:[w.Camera],methods:{getCameraStreams:r(t({deviceId:n().int().nonnegative()}),l(et).readonly()),getBrokerStreams:r(t({deviceId:n().int().nonnegative()}),l(tt).readonly()),getRtspEntries:r(t({deviceId:n().int().nonnegative(),hostname:e().optional()}),l(nt).readonly())},events:{onCamStreamsChanged:G(t({deviceId:n().int().nonnegative(),camStreams:l(et).readonly()})),onProfileSlotsChanged:G(t({deviceId:n().int().nonnegative(),profileSlots:l(tt).readonly()}))},runtimeState:t({online:y(),slotStatuses:t({high:Se.optional(),mid:Se.optional(),low:Se.optional()}),slotErrors:t({high:e().optional(),mid:e().optional(),low:e().optional()}),lastChangedAt:n()})},Ta=v(["online","sleeping","offline","unknown"]),it=t({childNativeId:e(),name:e(),type:v(w),status:Ta,metadata:t({model:e().optional(),serialNumber:e().optional(),uid:e().optional(),rtspChannel:n().int().nonnegative().optional(),isBattery:y().optional(),isDoorbell:y().optional(),isMultifocal:y().optional()}).default({}),alreadyAdopted:y(),adoptedDeviceId:n().int().nonnegative().nullable()}),tn=t({discovered:l(it),lastDiscoveryAt:n().int().nonnegative().nullable(),lastError:e().nullable()}),Yn={name:"device-discovery",scope:"device",mode:"singleton",deviceTypes:[w.Hub],status:{schema:tn,kind:"poll"},runtimeState:tn.extend({lastFetchedAt:n().int().nonnegative()}),methods:{listDiscovered:r(t({deviceId:n().int().nonnegative()}),l(it).readonly()),refreshDiscovery:r(t({deviceId:n().int().nonnegative()}),l(it).readonly(),{kind:"mutation",auth:"admin"}),adoptDevice:r(t({deviceId:n().int().nonnegative(),childNativeId:e(),name:e().optional()}),t({deviceId:n().int().nonnegative(),stableId:e()}),{kind:"mutation",auth:"admin"}),releaseDevice:r(t({deviceId:n().int().nonnegative(),childDeviceId:n().int().nonnegative()}),m(),{kind:"mutation",auth:"admin"})}},nn=t({lastPressedAt:n().nullable(),pressCountSinceStart:n()}),Ra=t({deviceId:n(),timestamp:n()}),Qn={name:"doorbell",scope:"device",mode:"singleton",deviceTypes:[w.Button],methods:{},events:{onPressed:{data:Ra}},status:{schema:nn,kind:"push"},runtimeState:nn},Ea=v(["jpeg","rgb","bgr","yuv420","gray"]),be=t({data:B(),format:Ea,width:n(),height:n(),timestamp:n()}),X=t({x:n(),y:n(),w:n(),h:n()}),qa=t({class:e(),originalClass:e(),score:n(),bbox:X}),an=t({data:D(Float32Array),sampleRate:n(),channels:n(),timestamp:n(),deviceId:n().optional()}),Ba=t({rms:n(),dbfs:n()}),at=t({className:e(),originalClass:e().optional(),score:n()}),we=t({bbox:X,pixelCount:n(),intensity:n()}),xa=t({detected:y(),regionCount:n(),regions:l(we).readonly(),rawRegions:l(we).readonly(),frameWidth:n(),frameHeight:n(),analysisMs:n()}),Oa={name:"motion-detection",scope:"device",mode:"singleton",exposesDeviceSettings:!0,methods:{analyze:r(t({deviceId:n(),frame:be}),xa,{kind:"mutation"}),removeCamera:r(t({deviceId:n()}),m(),{kind:"mutation"}),reset:r(m(),m(),{kind:"mutation"})},events:{onMotion:{data:t({deviceId:n(),detected:y(),regionCount:n()})}}},zl=t({activeCameras:n(),throttledCameras:n(),avgInferenceTimeMs:n(),queueDepth:n()}),wt=t({detectionMode:v(["disabled","always-on","on-motion"]),configuredFps:n(),actualFps:n(),queueDepth:n(),avgInferenceTimeMs:n(),droppedFrames:n(),phase:v(["idle","watching","active"])}),Na=wt.extend({deviceId:n()}),ot=v(["onnx","coreml","openvino","tflite","pt"]),ue=v(["detector","cropper","classifier","refiner","audio-classifier"]),M=t({runtime:v(["node","python"]),backend:e(),format:ot,device:e().optional()}),La=t({id:e(),label:e(),description:e().optional()}),za=t({engine:M,devices:l(La).readonly(),defaultDevice:e()}),st=St(()=>t({addonId:e(),addonName:e(),slot:ue,inputClasses:l(e()).readonly(),outputClasses:l(e()).readonly(),enabled:y(),modelId:e(),children:l(st).readonly(),engine:M.optional(),group:e().optional(),settings:b(e(),S()).optional()})),Pe=St(()=>t({addonId:e(),enabled:y(),modelId:e(),children:l(Pe).readonly(),settings:b(e(),S()).optional()})),Oe=t({id:e(),name:e(),createdAt:e(),updatedAt:e(),engine:M,steps:l(Pe).readonly()}),_a=t({id:e(),name:e(),formats:b(e(),t({downloaded:y(),sizeMB:n()}))}),Fa=B(),Ua=t({id:e(),name:e(),slot:ue,inputClasses:l(e()).readonly(),outputClasses:l(e()).readonly(),childSlots:l(ue).readonly(),models:l(_a).readonly(),defaultModelId:e(),defaultModelIdByFormat:b(e(),e()).optional(),enabledByDefault:y().optional(),defaultConfidence:n(),group:e().optional(),configSchema:l(Fa).readonly().optional()}),Ha=t({id:ue,label:e(),priority:n(),parentSlot:ue.nullable(),addons:l(Ua).readonly()}),$a=t({availableEngines:l(za).readonly(),selectedEngine:M,slots:l(Ha).readonly()}),Wa=t({detections:l(qa).readonly(),inferenceMs:n(),modelId:e()}),J=St(()=>t({addonId:e(),modelId:e(),enabled:y().default(!0),children:l(J).optional(),settings:b(e(),S()).optional()})),ja=t({filename:e(),stepIds:l(e()).readonly().optional()}),Ga=t({base64:e(),filename:e()}),Va=t({filename:e(),sizeKb:n()}),Ka=t({base64:e()}),Za=t({id:e(),name:e(),description:e(),available:y(),rawLabels:l(e()).readonly().optional()}),Ya=t({activeBackend:e(),availableBackends:l(Za).readonly(),sampleRate:n(),chunkDurationMs:n()}),Qa=t({filePath:e(),sizeMB:n(),durationMs:n()}),Ja=t({success:y(),error:e().optional(),frame:B().optional()}),Xa=B(),eo=B(),to=B(),no=B(),io=B(),on=B(),ao={name:"pipeline-executor",scope:"system",mode:"singleton",methods:{getAvailableEngines:r(m(),l(M)),getSelectedEngine:r(m(),M),getDefaultSteps:r(M,l(st)),reprobeEngine:r(m(),M,{kind:"mutation",auth:"admin"}),getVideoPipelineSteps:r(m(),b(e(),t({modelId:e(),settings:b(e(),S()).readonly()}))),setVideoPipelineSteps:r(t({steps:b(e(),t({modelId:e(),settings:b(e(),S()).readonly()}))}),t({success:k(!0)}),{kind:"mutation",auth:"admin"}),getSchema:r(m(),$a),getGlobalSteps:r(m(),l(st).readonly().nullable()),getGlobalPipelineConfig:r(m(),Xa),getOrchestratorConfigSchema:r(m(),eo),listTemplates:r(m(),l(Oe).readonly()),saveTemplate:r(t({name:e(),steps:l(Pe).readonly(),engine:M}),Oe,{kind:"mutation"}),updateTemplate:r(t({id:e(),name:e().optional(),steps:l(Pe).readonly().optional()}),Oe,{kind:"mutation"}),deleteTemplate:r(t({id:e()}),m(),{kind:"mutation"}),getCapabilities:r(m(),no),getAddonModels:r(t({addonId:e()}),io),downloadModel:r(t({addonId:e(),modelId:e(),format:ot}),Qa,{kind:"mutation"}),deleteModel:r(t({addonId:e(),modelId:e(),format:ot}),t({success:k(!0)}),{kind:"mutation"}),detect:r(t({addonId:e(),frame:be,config:b(e(),S()).optional()}),Wa),runPipeline:r(t({engine:M.optional(),steps:l(J).min(1),frame:be.optional(),imageBase64:e().optional(),image:D(Uint8Array).optional(),referenceImage:e().optional(),deviceId:n().optional(),sessionId:e().optional()}),on,{kind:"mutation"}),runPipelineBatch:r(t({engine:M.optional(),steps:l(J).min(1),frames:l(be).min(1).max(255),deviceId:n().optional(),sessionId:e().optional()}),t({results:l(on).readonly()}),{kind:"mutation"}),cacheFrameInPool:r(t({data:D(Uint8Array),width:n().int().positive(),height:n().int().positive(),format:v(["rgb","bgr","gray"])}),t({frameId:n(),width:n(),height:n()}),{kind:"mutation"}),inferCached:r(t({stepId:e(),frameId:n().int()}),b(e(),S()),{kind:"mutation"}),uncacheFrame:r(t({frameId:n().int()}),m(),{kind:"mutation"}),getEffectiveTuning:r(m(),t({batchMode:e(),windowMs:n(),maxBatchSize:n(),concurrency:n()})),listLoadedEngines:r(m(),l(t({engineKey:e(),engine:M,modelsLoaded:l(e()).readonly(),inUseByCameras:l(n()).readonly(),kind:v(["runtime","warm-override"]),poolPid:n().nullable(),idleMs:n().nullable(),idleTtlMs:n().nullable()})).readonly()),spinEngine:r(t({engine:M}),t({success:k(!0)}),{kind:"mutation",auth:"admin"}),killEngine:r(t({engine:M,force:y().optional()}),t({success:y(),reason:e().optional()}),{kind:"mutation",auth:"admin"}),listReferenceImages:r(m(),l(ja).readonly()),getReferenceImage:r(t({filename:e()}),Ga.nullable()),getReferenceAudioFiles:r(m(),l(Va).readonly()),getReferenceAudio:r(t({filename:e()}),Ka.nullable()),getAudioCapabilities:r(m(),Ya),runAudioTest:r(t({addonId:e(),modelId:e(),filename:e().optional(),settings:b(e(),S()).optional()}),Ja,{kind:"mutation"}),getDetectionConfigSchema:r(m(),to)}},oo=v(["polygon","tripwire"]),so=t({x:n(),y:n()}),se=t({id:e(),name:e(),kind:oo.default("polygon"),polygon:l(so).readonly(),color:e().default("#3b82f6")}),Jn={name:"zones",scope:"device",mode:"singleton",deviceTypes:[w.Camera],methods:{listZones:r(t({deviceId:n()}),l(se).readonly()),addZone:r(t({deviceId:n(),zone:se}),m(),{kind:"mutation",auth:"admin"}),removeZone:r(t({deviceId:n(),zoneId:e()}),m(),{kind:"mutation",auth:"admin"}),updateZone:r(t({deviceId:n(),zone:se}),m(),{kind:"mutation",auth:"admin"})},runtimeState:t({zones:l(se).readonly()})},Z={min:0,max:6e4,default:3e4,step:500},W={min:1,max:30,default:4,step:1},j={min:1,max:30,default:10,step:1},Pt=v(["onboard","analyzer"]),ro=l(Pt),co=t({deviceId:n(),detected:y(),source:Pt.default("analyzer"),regions:l(we).readonly().optional()}),lo=t({deviceId:n(),detectionMode:v(["disabled","always-on","on-motion"]).default("on-motion"),audioMode:v(["disabled","always-on","on-motion"]).default("always-on"),motionCooldownMs:n().min(Z.min).default(Z.default),motionFps:n().min(W.min).max(W.max).default(W.default),detectionFps:n().min(j.min).max(j.max).default(j.default),motionStreamId:e(),detectionStreamId:e(),motionSources:ro.default(["analyzer"]),pipelineEnabled:y().default(!0),engine:M.optional(),steps:l(J).readonly().optional(),audio:t({engine:M,modelId:e(),enabled:y()}).nullable().optional(),zones:l(se).readonly().default([])}),_l=[{key:"motionSources",type:"multiselect",label:"Motion Sources",default:["analyzer"],options:[{value:"analyzer",label:"Frame-diff Analyzer (motion addon)"},{value:"onboard",label:"Camera Onboard Sensor"}]},{key:"motionFps",type:"slider",label:"Motion FPS (analyzer)",min:W.min,max:W.max,step:W.step,default:W.default,showValue:!0,unit:"fps",showWhen:{field:"motionSources",includes:"analyzer"}},{key:"detectionFps",type:"slider",label:"Detection FPS",min:j.min,max:j.max,step:j.step,default:j.default,showValue:!0,unit:"fps"},{key:"motionCooldownMs",type:"slider",label:"Motion Cooldown",description:"Time without a fresh motion event before the active phase ends. Applies to all motion sources — every motion event re-arms the timer.",min:Z.min,max:Z.max,step:Z.step,default:Z.default,showValue:!0,unit:"s",displayScale:1e3}],Xn=t({nodeId:e(),attachedCameras:n(),activeCameras:n(),avgInferenceFps:n(),avgInferenceTimeMs:n(),queueDepthTotal:n(),hardware:t({hasGpu:y(),inferenceBackend:e().optional(),cpuCores:n().optional()})}),uo=t({nodeId:e(),activeCameras:n(),throttledCameras:n(),avgInferenceTimeMs:n(),queueDepth:n()}),mo={name:"pipeline-runner",scope:"system",mode:"singleton",methods:{attachCamera:r(lo,t({success:k(!0)}),{kind:"mutation"}),detachCamera:r(t({deviceId:n()}),t({success:k(!0)}),{kind:"mutation"}),reportMotion:r(co,t({success:k(!0)}),{kind:"mutation"}),getLocalLoad:r(m(),Xn),getLocalMetrics:r(m(),uo),getCameraMetrics:r(t({deviceId:n()}),wt.nullable()),getAllCameraMetrics:r(m(),l(Na).readonly()),getLocalCameras:r(m(),l(n()).readonly())}},sn=t({detected:y(),lastDetectedAt:n().nullable(),autoClearAfterMs:n().nullable()}),po=t({deviceId:n(),detected:y(),timestamp:n(),source:Pt,regions:l(we).readonly().optional()}),ei={name:"motion",scope:"device",mode:"singleton",deviceTypes:[w.Camera,w.Sensor],methods:{isDetected:r(t({deviceId:n()}),y())},events:{onMotionChanged:{data:po}},status:{schema:sn,kind:"push"},runtimeState:sn},ti=t({enabled:y(),lastChangedAt:n()}),go=ti.extend({lastFetchedAt:n()}),ni={name:"motion-trigger",scope:"device",mode:"singleton",deviceTypes:[w.Light,w.Siren,w.Switch],methods:{setMotionTrigger:r(t({deviceId:n().int().nonnegative(),enabled:y()}),m(),{kind:"mutation",auth:"admin"})},events:{onMotionTriggerChanged:{data:t({deviceId:n(),enabled:y(),lastChangedAt:n()})}},status:{schema:ti,kind:"command-driven"},runtimeState:go},ho=e().describe("Vendor target string (people/vehicle/pet); empty = camera default"),rt=t({targetType:ho,stopDelaySeconds:n().int().min(0).max(300),disappearDelaySeconds:n().int().min(0).max(300)}),yo=t({value:e(),label:e()}),Ie=t({enabled:y(),lastChangedAt:n(),currentSettings:rt.nullable(),supportedTargetTypes:l(yo)}),fo=Ie.extend({lastFetchedAt:n()}),ii={name:"ptz-autotrack",scope:"device",mode:"singleton",deviceTypes:[w.Camera],methods:{getStatus:r(t({deviceId:n()}),Ie),setEnabled:r(t({deviceId:n(),enabled:y()}),m(),{kind:"mutation"}),getSettings:r(t({deviceId:n()}),rt.nullable()),setSettings:r(t({deviceId:n(),settings:rt.partial()}),m(),{kind:"mutation"})},events:{onStatusChanged:{data:t({deviceId:n(),status:Ie})}},status:{schema:Ie,kind:"command-driven"},runtimeState:fo},rn=t({on:y(),lastChangedAt:n()}),ai={name:"switch",scope:"device",mode:"singleton",deviceTypes:[w.Switch,w.Siren,w.Light],methods:{setState:r(t({deviceId:n(),on:y()}),m(),{kind:"mutation",auth:"admin"})},events:{onStateChanged:{data:t({deviceId:n(),on:y(),lastChangedAt:n()})}},status:{schema:rn,kind:"command-driven"},runtimeState:rn,settings:{bindings:[{kind:"scalar",statusPath:"on",method:"setState",valueArg:"on",field:{label:"On",kind:"boolean"}}]}},dt=t({totalObjects:n().int().nonnegative(),byClass:b(e(),n().int().nonnegative())}),vo=dt.extend({zoneId:e(),zoneName:e(),trackIds:l(e()).readonly()}),dn=t({ts:n().int(),frameWidth:n().int().nonnegative(),frameHeight:n().int().nonnegative(),zones:l(vo).readonly(),frame:dt,unzoned:dt}),So=v(["minute","5min","hour"]),Ne=t({from:n().int(),to:n().int(),resolution:So}),Le=t({ts:n().int(),count:n().int().nonnegative()}),oi={name:"zone-analytics",scope:"device",mode:"singleton",deviceTypes:[w.Camera],methods:{getCurrentSnapshot:r(t({deviceId:n()}),dn.nullable()),getZoneHistory:r(t({deviceId:n(),zoneId:e(),className:e().optional()}).extend(Ne.shape),l(Le).readonly()),getCameraHistory:r(t({deviceId:n(),className:e().optional()}).extend(Ne.shape),l(Le).readonly()),getUnzonedHistory:r(t({deviceId:n(),className:e().optional()}).extend(Ne.shape),l(Le).readonly())},runtimeState:dn},bo=v(["include","exclude"]),re=t({id:e(),name:e().optional(),zoneIds:l(e()).min(1).readonly(),mode:bo,classFilter:l(e()).readonly().optional(),overlapThreshold:n().min(0).max(1).optional(),bboxInclusionPct:n().min(0).max(100).optional(),preferMask:y().optional(),enabled:y().default(!0)}),Fl=l(re).readonly(),cn=v(["motion","detection"]),si={name:"zone-rules",scope:"device",mode:"singleton",deviceTypes:[w.Camera],methods:{listRules:r(t({deviceId:n(),stage:cn}),l(re).readonly()),setRules:r(t({deviceId:n(),stage:cn,rules:l(re).readonly()}),m(),{kind:"mutation",auth:"admin"})},runtimeState:t({motion:l(re).readonly(),detection:l(re).readonly()})},Io=t({connected:y(),deviceCount:n(),error:e().optional()}),Ul=t({externalId:e(),name:e(),type:e(),metadata:b(e(),S()).optional()}),De=t({stableId:e(),type:v(w),suggestedName:e(),prefilledConfig:b(e(),S())}),Me=t({id:n(),stableId:e(),addonId:e(),type:e(),name:e(),parentDeviceId:n().nullable(),online:y(),features:l(e()),config:b(e(),S())}),ct=t({status:v(["ok","error"]),labels:l(e()).optional(),error:e().optional()}),ko=S(),ri={name:"device-provider",scope:"system",mode:"collection",methods:{start:r(m(),m(),{kind:"mutation"}),stop:r(m(),m(),{kind:"mutation"}),getStatus:r(m(),Io),getDevices:r(m(),l(t({id:e(),name:e(),type:e()}))),supportsDiscovery:r(t({}),y()),discoverDevices:r(t({}),l(De),{kind:"mutation",auth:"admin"}),adoptDiscoveredDevice:r(t({candidate:De}),Me,{kind:"mutation",auth:"admin"}),supportsManualCreation:r(t({}),y()),getChildCreationSchema:r(t({type:v(w)}),ko),createDevice:r(t({type:v(w),config:b(e(),S())}),Me,{kind:"mutation",auth:"admin"}),testCreationField:r(t({type:v(w),key:e(),value:S(),formValues:b(e(),S()).optional()}),ct,{kind:"mutation",auth:"admin"})}},Ao=t({id:e(),label:e(),icon:e(),order:n().optional()}),Co=t({id:e(),title:e(),description:e().optional(),style:v(["card","accordion"]).optional(),defaultCollapsed:y().optional(),columns:R([k(1),k(2),k(3),k(4)]).optional(),tab:e().optional(),location:v(["settings","top-tab"]).optional(),order:n().optional(),fields:l(Hn())}),Y=t({tabs:l(Ao).optional(),sections:l(Co)}),ln=b(e(),S()),un=t({success:k(!0)}),wo={name:"addon-settings",scope:"system",mode:"singleton",nodeIdMode:"data",methods:{getGlobalSettings:r(t({addonId:e(),nodeId:e().optional(),overlay:b(e(),S()).optional()}),Y.nullable()),updateGlobalSettings:r(t({addonId:e(),nodeId:e().optional(),patch:ln}),un,{kind:"mutation",auth:"admin"}),getDeviceSettings:r(t({addonId:e(),deviceId:n(),nodeId:e().optional()}),Y.nullable()),updateDeviceSettings:r(t({addonId:e(),deviceId:n(),nodeId:e().optional(),patch:ln}),un,{kind:"mutation",auth:"admin"})}},Po=v(["info","success","warning","error"]),Do=v(["active","in-progress","completed","failed","dismissed"]),Mo=t({type:e(),id:e()}),ze=t({id:e(),category:e(),severity:Po,title:e(),message:e(),status:Do,progress:n().optional(),read:y(),createdAt:n(),updatedAt:n(),source:Mo.optional(),metadata:b(e(),S()).optional()}),To={name:"alerts",scope:"system",mode:"singleton",methods:{emit:r(ze,m(),{kind:"mutation"}),update:r(t({alertId:e(),patch:ze.partial()}),m(),{kind:"mutation"}),list:r(t({unreadOnly:y().optional(),limit:n().optional()}).optional(),l(ze).readonly()),getUnreadCount:r(m(),n()),markRead:r(t({alertId:e()}),m(),{kind:"mutation"}),markAllRead:r(m(),m(),{kind:"mutation"}),dismiss:r(t({alertId:e()}),m(),{kind:"mutation"})}},Ro={name:"storage",scope:"system",mode:"singleton",methods:{resolve:r(t({location:z,relativePath:e()}),e()),write:r(t({location:z,relativePath:e(),data:D(Uint8Array)}),m(),{kind:"mutation"}),read:r(t({location:z,relativePath:e()}),D(Uint8Array)),exists:r(t({location:z,relativePath:e()}),y()),list:r(t({location:z,prefix:e().optional()}),l(e()).readonly()),delete:r(t({location:z,relativePath:e()}),m(),{kind:"mutation"}),getAvailableSpace:r(t({location:z}),n().nullable()),beginUpload:r(t({location:z,relativePath:e(),sizeBytes:n().optional()}),t({uploadId:e()}),{kind:"mutation"}),writeChunk:r(t({uploadId:e(),offset:n(),data:D(Uint8Array)}),m(),{kind:"mutation"}),finalizeUpload:r(t({uploadId:e()}),m(),{kind:"mutation"}),abortUpload:r(t({uploadId:e()}),m(),{kind:"mutation"}),beginDownload:r(t({location:z,relativePath:e()}),t({downloadId:e(),sizeBytes:n()}),{kind:"mutation"}),readChunk:r(t({downloadId:e(),offset:n(),length:n()}),D(Uint8Array)),endDownload:r(t({downloadId:e()}),m(),{kind:"mutation"}),listLocations:r(t({type:Q.optional()}),l(q).readonly()),getDefaultLocation:r(t({type:Q}),q.nullable()),upsertLocation:r(q.omit({createdAt:!0,updatedAt:!0}),q,{kind:"mutation",auth:"superAdmin"}),deleteLocation:r(t({id:e()}),m(),{kind:"mutation",auth:"superAdmin"}),testLocation:r(t({id:e()}),t({ok:y(),error:e().optional()}),{auth:"superAdmin"}),listProviders:r(m(),l(t({providerId:e(),displayName:e(),supportedLocationTypes:l(Q).readonly(),configSchema:S()})).readonly()),testConfig:r(t({providerId:e(),config:b(e(),S())}),t({ok:y(),error:e().optional()}),{auth:"superAdmin"})}},Eo=t({providerId:e().min(1),displayName:e().min(1),supportedLocationTypes:l(Q).readonly(),configSchema:S()}),qo=t({ok:y(),error:e().optional()}),Bo=t({location:q,relativePath:e(),sizeBytes:n().optional()}),xo=t({uploadId:e()}),Oo=t({uploadId:e(),offset:n(),data:D(Uint8Array)}),No=t({uploadId:e()}),Lo=t({uploadId:e()}),zo=t({location:q,relativePath:e()}),_o=t({downloadId:e(),sizeBytes:n()}),Fo=t({downloadId:e(),offset:n(),length:n()}),Uo=t({downloadId:e()}),Ho={name:"storage-provider",scope:"system",mode:"collection",internal:!0,methods:{getProviderInfo:r(m(),Eo),testLocation:r(t({config:b(e(),S())}),qo,{auth:"superAdmin"}),resolve:r(t({location:q,relativePath:e()}),e()),write:r(t({location:q,relativePath:e(),data:D(Uint8Array)}),m(),{kind:"mutation"}),read:r(t({location:q,relativePath:e()}),D(Uint8Array)),exists:r(t({location:q,relativePath:e()}),y()),list:r(t({location:q,prefix:e().optional()}),l(e()).readonly()),delete:r(t({location:q,relativePath:e()}),m(),{kind:"mutation"}),getAvailableSpace:r(t({location:q}),n().nullable()),beginUpload:r(Bo,xo,{kind:"mutation"}),writeChunk:r(Oo,m(),{kind:"mutation"}),finalizeUpload:r(No,m(),{kind:"mutation"}),abortUpload:r(Lo,m(),{kind:"mutation"}),beginDownload:r(zo,_o,{kind:"mutation"}),readChunk:r(Fo,D(Uint8Array)),endDownload:r(Uo,m(),{kind:"mutation"})}},$o=t({subId:e(),displayName:e(),description:e().optional(),kind:e(),triggerSupported:y(),restoreSupported:y()}),Wo=$o.extend({id:e(),addonId:e(),enabled:y(),retentionCount:n(),label:e().optional(),lastSuccessAt:n().optional(),lastSuccessSizeBytes:n().optional(),cron:e().optional(),nextRunAt:n().optional(),lastRunAt:n().optional()}),jo=t({id:e(),filename:e(),createdAt:n(),sizeBytes:n(),label:e().optional(),locations:l(e()).readonly()}),mn=t({id:e(),destinationId:e().optional(),label:e().optional(),createdAt:n(),sizeBytes:n(),locations:l(e()).optional()}),Go=t({path:e(),kind:v(["file","dir","symlink"]),sizeBytes:n(),mtime:n()}),Vo=t({archiveVersion:k(1),createdAt:n(),dataDir:e(),locations:l(e()),entries:l(Go),totalBytes:n(),totalFiles:n()}),Ko=t({name:e(),sizeBytes:n(),fileCount:n(),present:y()}),Zo={name:"backup",scope:"system",mode:"singleton",methods:{listDestinations:r(m(),l(Wo).readonly(),{auth:"superAdmin"}),trigger:r(t({destinations:l(e()).optional(),locations:l(e()).optional(),label:e().optional()}).optional(),l(mn).readonly(),{kind:"mutation",auth:"superAdmin"}),list:r(m(),l(mn).readonly(),{auth:"superAdmin"}),listLocations:r(m(),l(Ko).readonly(),{auth:"superAdmin"}),getEntries:r(t({destinationId:e(),backupId:e()}),Vo.nullable(),{auth:"superAdmin"}),restore:r(t({destinationId:e(),backupId:e(),locations:l(e()).optional()}),m(),{kind:"mutation",auth:"superAdmin"}),delete:r(t({destinationId:e(),backupId:e()}),m(),{kind:"mutation",auth:"superAdmin"}),listArchives:r(t({destinationId:e()}),l(jo).readonly(),{auth:"superAdmin"}),upsertDestinationPolicy:r(t({locationId:e(),enabled:y(),retentionCount:n().int().min(1).max(1e3),label:e().optional(),cron:e().optional()}),m(),{kind:"mutation",auth:"superAdmin"}),previewSchedule:r(t({cron:e(),count:n().int().min(1).max(20).optional()}),t({ok:y(),error:e().optional(),nextRuns:l(n()).readonly()}))}},pn=t({where:b(e(),S()).optional(),whereIn:b(e(),l(S())).optional(),whereBetween:b(e(),Un([S(),S()])).optional(),orderBy:t({field:e(),direction:v(["asc","desc"])}).optional(),limit:n().optional(),offset:n().optional()}),gn=t({id:e(),data:b(e(),S())}),Yo=t({name:e(),type:v(["TEXT","INTEGER","REAL","JSON"]),primaryKey:y().optional(),notNull:y().optional(),unique:y().optional()}),Qo=t({name:e(),columns:l(e()).readonly(),unique:y().optional()}),Jo={name:"settings-store",scope:"system",mode:"singleton",methods:{get:r(t({namespace:e().optional(),collection:e(),key:e()}),S()),set:r(t({namespace:e().optional(),collection:e(),key:e(),value:S()}),m(),{kind:"mutation"}),query:r(t({namespace:e().optional(),collection:e(),filter:pn.optional()}),l(gn).readonly()),insert:r(t({namespace:e().optional(),collection:e(),record:gn}),m(),{kind:"mutation"}),update:r(t({namespace:e().optional(),collection:e(),id:e(),data:b(e(),S())}),m(),{kind:"mutation"}),delete:r(t({namespace:e().optional(),collection:e(),key:e()}),m(),{kind:"mutation"}),count:r(t({namespace:e().optional(),collection:e(),filter:pn.optional()}),n()),isEmpty:r(t({namespace:e().optional(),collection:e()}),y()),declareCollection:r(t({namespace:e().optional(),collection:e(),columns:l(Yo).readonly(),indexes:l(Qo).readonly().optional()}),m(),{kind:"mutation"})}},di=v(["debug","info","warn","error"]),hn=t({timestamp:Je(),level:di,scope:l(e()),message:e(),meta:b(e(),S()).optional(),tags:b(e(),e()).optional()}),Xo={name:"log-destination",scope:"system",mode:"collection",internal:!0,methods:{write:r(hn,m(),{kind:"mutation"}),query:r(t({scope:l(e()).optional(),level:di.optional(),since:Je().optional(),until:Je().optional(),limit:n().optional(),tags:b(e(),e()).optional()}),l(hn).readonly())}},es={name:"admin-ui",scope:"system",mode:"singleton",internal:!0,methods:{getStaticDir:r(m(),e()),getVersion:r(m(),e())}},ts=t({id:e(),label:e(),icon:e(),path:e(),remoteName:e(),bundle:e()}),ns=t({addonId:e(),page:ts,bundleUrl:e()}),is={name:"addon-pages",scope:"system",mode:"singleton",methods:{listPages:r(m(),l(ns).readonly())}},as=t({id:e(),label:e(),icon:e(),path:e(),remoteName:e(),bundle:e()}),os={name:"addon-pages-source",scope:"system",mode:"collection",internal:!0,methods:{listPages:r(m(),l(as).readonly())}},ss=v(["device-tab","dashboard","integration-detail"]),yn=v(["xs","sm","md","lg","xl"]),ci=t({stableId:e(),label:e(),description:e().optional(),icon:e().optional(),remoteName:e(),bundle:e(),hosts:l(ss).readonly(),requires:t({deviceContext:y().default(!1),integrationContext:y().default(!1)}),defaultSize:yn.default("md"),allowedSizes:l(yn).readonly().default(["sm","md","lg"]),defaultColumns:n().int().min(1).max(12).default(6),defaultRows:n().int().min(1).max(12).default(1)}),rs={name:"addon-widgets-source",scope:"system",mode:"collection",internal:!0,methods:{listWidgets:r(m(),l(ci).readonly())}},ds=ci.extend({addonId:e(),bundleUrl:e()}),cs={name:"addon-widgets",scope:"system",mode:"singleton",methods:{listWidgets:r(m(),l(ds).readonly())}},ls=t({method:v(["GET","POST","PUT","DELETE","PATCH"]),path:e()}),us={name:"addon-routes",scope:"system",mode:"collection",internal:!0,methods:{getRoutes:r(m(),l(ls))}},Hl=[{value:"auto",label:"Auto (defer to probed best)"},{value:"none",label:"Off (software)"},{value:"videotoolbox",label:"VideoToolbox (macOS)"},{value:"cuda",label:"CUDA (NVIDIA)"},{value:"nvdec",label:"NVDEC (NVIDIA legacy)"},{value:"vaapi",label:"VAAPI (Linux Intel/AMD)"},{value:"qsv",label:"QuickSync (Intel)"},{value:"d3d11va",label:"D3D11VA (Windows)"},{value:"dxva2",label:"DXVA2 (Windows legacy)"},{value:"amf",label:"AMF (AMD)"},{value:"vdpau",label:"VDPAU (Linux NVIDIA legacy)"},{value:"drm",label:"DRM (Linux generic)"}],$l={hwaccel:"auto",probedBestHwaccel:""},ms={name:"decoder",scope:"system",mode:"singleton",methods:{supportsCodec:r(t({codec:e()}),y()),getInfo:r(m(),t({id:e(),name:e(),isPullMode:y().optional(),priority:n().optional()})),createSession:r(Qt,t({sessionId:e(),nodeId:e()})),destroySession:r(t({sessionId:e()}),m()),pushPacket:r(t({sessionId:e(),packet:va}),m()),openStream:r(t({sessionId:e(),url:e()}),m()),pullFrames:r(t({sessionId:e(),maxCount:n().default(1)}),l(Sa)),updateConfig:r(t({sessionId:e(),config:Qt.partial()}),m()),getStats:r(t({sessionId:e()}),ea),listActiveSessions:r(m(),l(t({sessionId:e(),codec:e(),outputFormat:e(),createdAtMs:n()})).readonly()),reprobeHwaccel:r(m(),t({backend:e()}),{kind:"mutation",auth:"admin"})}},ps=t({streamId:e(),label:e().optional(),codec:e(),type:v(["video","audio"]),sourceUrl:e()}),gs=t({streamId:e(),format:e(),value:e()}),hs={name:"restreamer",scope:"system",mode:"collection",internal:!0,methods:{registerDevice:r(t({deviceId:n(),streams:l(ps).readonly()}),m(),{kind:"mutation"}),unregisterDevice:r(t({deviceId:n()}),m(),{kind:"mutation"}),getExposedResources:r(t({deviceId:n()}),l(gs).readonly())}},li=t({viewportWidth:n().int().positive().optional(),viewportHeight:n().int().positive().optional(),devicePixelRatio:n().positive().optional(),downlinkMbps:n().nonnegative().optional(),prefersTier:e().optional()}).partial(),ys={name:"webrtc",scope:"system",mode:"collection",internal:!0,methods:{handleOffer:r(t({streamId:e(),sdpOffer:e()}),e(),{kind:"mutation"}),supportsStream:r(t({streamId:e()}),y()),registerStream:r(t({streamId:e(),codec:e()}),m(),{kind:"mutation"}),unregisterStream:r(t({streamId:e()}),m(),{kind:"mutation"}),createSession:r(t({streamId:e(),hints:li.optional()}),t({sessionId:e(),sdpOffer:e()}),{kind:"mutation"}),handleAnswer:r(t({sessionId:e(),sdpAnswer:e()}),m(),{kind:"mutation"}),closeSession:r(t({sessionId:e()}),m(),{kind:"mutation"}),hasAdaptiveBitrate:r(t({streamId:e()}),y())}},ui=Fi("kind",[t({kind:k("adaptive")}),t({kind:k("profile"),profile:$}),t({kind:k("cam-stream"),camStreamId:e().min(1)})]),fs=t({id:e(),label:e(),target:ui,codec:e().nullable(),resolution:t({width:n(),height:n()}).nullable(),status:v(["idle","connecting","streaming","error","stopped"]).nullable(),inputFps:n().nullable(),decodeFps:n().nullable(),bitrateKbps:n().nullable()}),vs={name:"webrtc-session",scope:"device",mode:"singleton",deviceTypes:[w.Camera],methods:{listStreams:r(t({deviceId:n().int().nonnegative()}),l(fs)),createSession:r(t({deviceId:n().int().nonnegative(),target:ui,hints:li.optional()}),t({sessionId:e(),sdpOffer:e()}),{kind:"mutation"}),handleAnswer:r(t({deviceId:n().int().nonnegative(),sessionId:e(),sdpAnswer:e()}),m(),{kind:"mutation"}),closeSession:r(t({deviceId:n().int().nonnegative(),sessionId:e()}),m(),{kind:"mutation"}),hasAdaptiveBitrate:r(t({deviceId:n().int().nonnegative(),profile:$}),y())}},ke=t({engine:M,steps:l(J).readonly(),audio:t({engine:M,modelId:e(),enabled:y(),settings:b(e(),S()).readonly().optional()}).nullable().optional()}),_e=t({id:e(),name:e(),description:e().optional(),config:ke,createdAt:e(),updatedAt:e()}),mi=t({enabled:y(),modelId:e(),settings:b(e(),S()).readonly()}),fn=t({addonDefaults:b(e(),mi).readonly()}),pi=t({steps:l(J).readonly(),audio:t({modelId:e(),enabled:y()}).nullable()}),lt=t({enabled:y().optional(),modelId:e().optional(),settings:b(e(),S()).readonly().optional()}),Ss=t({pinnedAgentNodeId:e().optional(),stepToggles:b(e(),y()).optional(),stepOverridesByAgent:b(e(),b(e(),lt)).optional(),pipelineByAgent:b(e(),pi).optional()}),vn=t({deviceId:n(),agentNodeId:e(),pinned:y(),reason:v(["manual","capacity","hardware-affinity","failover","rebalance"]),assignedAt:n()}),Sn=t({deviceId:n(),decoderNodeId:e(),pinned:y(),reason:v(["manual","co-located","capacity","hardware-affinity"])}),bs=t({nodeId:e(),online:y(),load:Xn,score:n()}),Is=t({totalAgents:n(),onlineAgents:n(),totalCameras:n(),attachedCameras:n(),activeCameras:n(),avgInferenceTimeMs:n(),queueDepth:n()}),ks=b(e(),e()),As={name:"pipeline-orchestrator",scope:"system",mode:"singleton",exposesDeviceSettings:!0,methods:{assignPipeline:r(t({deviceId:n(),agentNodeId:e()}),t({success:k(!0)}),{kind:"mutation",auth:"admin"}),unassignPipeline:r(t({deviceId:n()}),t({success:k(!0)}),{kind:"mutation",auth:"admin"}),rebalance:r(m(),t({migrated:n()}),{kind:"mutation",auth:"admin"}),getPipelineAssignments:r(m(),l(vn).readonly()),getPipelineAssignment:r(t({deviceId:n()}),vn.nullable()),getAgentLoad:r(m(),l(bs).readonly()),getGlobalMetrics:r(m(),Is),getCameraMetrics:r(t({deviceId:n()}),wt.nullable()),getCapabilityBindings:r(t({nodeId:e()}),ks),setCapabilityBinding:r(t({nodeId:e(),capName:e(),addonId:e()}),t({success:k(!0)}),{kind:"mutation",auth:"admin"}),assignDecoder:r(t({deviceId:n(),nodeId:e()}),m(),{kind:"mutation",auth:"admin"}),unassignDecoder:r(t({deviceId:n()}),m(),{kind:"mutation",auth:"admin"}),getDecoderAssignments:r(m(),l(Sn).readonly()),assignAudio:r(t({deviceId:n(),nodeId:e()}),t({success:k(!0)}),{kind:"mutation",auth:"admin"}),unassignAudio:r(t({deviceId:n()}),t({success:k(!0)}),{kind:"mutation",auth:"admin"}),getAudioAssignment:r(t({deviceId:n()}),t({nodeId:e(),pinned:y(),assignedAt:n()}).nullable()),getAudioNodeLoad:r(m(),l(t({nodeId:e(),deviceCount:n()}))),getAudioAssignments:r(m(),l(t({deviceId:n(),nodeId:e(),pinned:y(),assignedAt:n()}))),getDecoderAssignment:r(t({deviceId:n(),pipelineNodeId:e().optional()}),Sn),getAgentSettings:r(t({agentNodeId:e()}),fn.nullable()),listAgentSettings:r(m(),l(t({nodeId:e(),settings:fn})).readonly()),setAgentAddonDefaults:r(t({agentNodeId:e(),defaults:b(e(),mi)}),t({success:k(!0)}),{kind:"mutation",auth:"admin"}),removeAgentSettings:r(t({agentNodeId:e()}),t({success:y(),removed:y()}),{kind:"mutation",auth:"admin"}),getCameraSettings:r(t({deviceId:n()}),Ss.nullable()),setCameraStepToggle:r(t({deviceId:n(),addonId:e(),enabled:y().nullable()}),t({success:k(!0)}),{kind:"mutation",auth:"admin"}),getCameraStepOverrides:r(t({deviceId:n()}),b(e(),b(e(),lt)).nullable()),setCameraStepOverride:r(t({deviceId:n(),agentNodeId:e(),addonId:e(),patch:lt.nullable()}),t({success:k(!0)}),{kind:"mutation",auth:"admin"}),setCameraPipelineForAgent:r(t({deviceId:n(),agentNodeId:e(),pipeline:pi.nullable()}),t({success:k(!0)}),{kind:"mutation",auth:"admin"}),resolvePipeline:r(t({deviceId:n(),agentNodeId:e().optional()}),ke),listTemplates:r(m(),l(_e).readonly()),saveTemplate:r(t({name:e(),description:e().optional(),config:ke}),_e,{kind:"mutation",auth:"admin"}),updateTemplate:r(t({id:e(),name:e().optional(),description:e().optional(),config:ke.optional()}),_e,{kind:"mutation",auth:"admin"}),deleteTemplate:r(t({id:e()}),t({success:k(!0)}),{kind:"mutation",auth:"admin"})}},Cs=t({level:Ba,classification:t({labels:l(at).readonly(),inferenceMs:n()}).optional(),timestamp:n()}),ws=t({minConfidence:n().min(0).max(1).default(.3),allowedClasses:l(e()).default([])}),Ps=t({labels:l(at).readonly(),rawLabels:l(at).readonly().optional(),inferenceMs:n()}),Wl=[{value:"auto",label:"Auto (platform default)"},{value:"apple-soundanalysis",label:"Apple SoundAnalysis (macOS 12+)"},{value:"yamnet-onnx",label:"YAMNet ONNX (cross-platform)"}],jl={audioBackend:"auto",probedBestAudioBackend:"",selectedAudioModel:""},Ds={name:"audio-analyzer",scope:"system",mode:"singleton",methods:{analyseChunk:r(t({chunk:an,settings:ws}),Cs.nullable(),{kind:"mutation"}),classify:r(an,Ps,{timeoutMs:3e4}),isReady:r(m(),y()),dispose:r(m(),m(),{kind:"mutation"}),reprobeAudioEngine:r(m(),t({backend:e()}),{kind:"mutation",auth:"admin"})}},Ms={name:"audio-analysis",scope:"device",mode:"singleton",deviceTypes:[w.Camera],exposesDeviceSettings:!0,methods:{resolveDeviceSettings:r(t({deviceId:n()}),B())},events:{onAudioLevel:G(t({deviceId:n(),rms:n(),dbfs:n()}))}},Te=v(["f32le","s16le"]),Ts=t({codec:e(),canDecode:y(),canEncode:y(),label:e().optional()}),Rs=t({codec:e(),sourceSampleRate:n().int().positive(),sourceChannels:n().int().positive(),extraData:D(Uint8Array).optional(),targetSampleRate:n().int().positive(),targetChannels:n().int().positive(),targetFormat:Te.optional(),idleMs:n().int().positive().optional(),tag:e().optional()}),Es=t({codec:e(),sourceSampleRate:n().int().positive(),sourceChannels:n().int().positive(),sourceFormat:Te.optional(),targetSampleRate:n().int().positive(),targetChannels:n().int().positive(),bitrateKbps:n().int().positive().optional(),idleMs:n().int().positive().optional(),tag:e().optional()}),qs=t({data:D(Uint8Array),sampleRate:n().int().positive(),channels:n().int().positive(),format:Te,pts:n()}),bn=t({data:D(Uint8Array),codec:e(),pts:n(),frameComplete:y()}),Bs=t({sessionId:e(),kind:v(["decode","encode"]),codec:e(),sourceSampleRate:n(),sourceChannels:n(),targetSampleRate:n(),targetChannels:n(),format:Te,tag:e().optional(),createdAtMs:n(),lastActivityMs:n(),framesIn:n(),framesOut:n()}),xs={name:"audio-codec",scope:"system",mode:"singleton",methods:{listSupportedCodecs:r(m(),l(Ts).readonly()),canHandle:r(t({codec:e(),kind:v(["decode","encode"])}),y()),createDecodeSession:r(Rs,t({sessionId:e(),nodeId:e()}),{kind:"mutation"}),createEncodeSession:r(Es,t({sessionId:e(),nodeId:e()}),{kind:"mutation"}),closeSession:r(t({sessionId:e(),nodeId:e().optional()}),m(),{kind:"mutation"}),pushEncodedFrame:r(t({sessionId:e(),nodeId:e().optional(),data:D(Uint8Array),pts:n().optional()}),m(),{kind:"mutation"}),pullPcm:r(t({sessionId:e(),nodeId:e().optional(),maxCount:n().int().positive().default(8)}),l(qs)),pushPcm:r(t({sessionId:e(),nodeId:e().optional(),data:D(Uint8Array),pts:n().optional()}),m(),{kind:"mutation"}),pullEncoded:r(t({sessionId:e(),nodeId:e().optional(),maxCount:n().int().positive().default(8)}),l(bn)),flushEncode:r(t({sessionId:e(),nodeId:e().optional()}),l(bn),{kind:"mutation"}),listActiveSessions:r(m(),l(Bs).readonly())}},In=t({embedding:l(n()),dimensions:n()}),Os=t({modelId:e(),dimensions:n(),inputSize:n()}),Ns={name:"embedding-encoder",scope:"system",mode:"collection",internal:!0,methods:{encode:r(t({crop:D(Uint8Array),width:n(),height:n()}),In),encodeText:r(t({text:e()}),In),getInfo:r(m(),Os)}},Fe=t({id:n(),stableId:e(),addonId:e(),type:v(w),name:e(),location:e().nullable(),disabled:y(),parentDeviceId:n().nullable(),role:e().nullable().optional(),online:y(),features:l(e()),isCamera:y(),config:b(e(),S()),metadata:b(e(),S()).nullable().optional()}),Ls=t({key:e(),value:S(),description:e().optional()}),zs=t({id:n(),stableId:e(),type:e(),name:e(),location:e().nullable(),disabled:y(),parentDeviceId:n().nullable(),role:e().nullable().optional()}),_s=t({id:n(),stableId:e(),addonId:e(),type:e(),name:e(),location:e().nullable(),disabled:y(),parentDeviceId:n().nullable(),metadata:b(e(),S()).nullable().optional()}),Fs=S().nullable(),Us=t({streamId:e(),width:n().optional(),height:n().optional(),codec:e().optional(),fps:n().optional(),bitrateKbps:n().optional()}),Hs=t({addonId:e(),stableId:e(),id:n(),type:e(),name:e(),location:e().nullable().optional(),disabled:y().optional(),parentDeviceId:n().nullable(),role:e().nullable().optional(),features:l(e()).optional(),config:b(e(),S())}),$s=t({deviceId:n()}),Ws=t({deviceId:n(),data:b(e(),S())}),js={name:"device-manager",scope:"system",mode:"singleton",methods:{allocateDeviceId:r(t({addonId:e(),stableId:e()}),t({id:n()}),{kind:"mutation"}),registerDevice:r(Hs,m(),{kind:"mutation"}),removeDevice:r($s,m(),{kind:"mutation"}),persistConfig:r(Ws,m(),{kind:"mutation"}),loadConfig:r(t({deviceId:n()}),b(e(),S())),loadRuntimeState:r(t({deviceId:n()}),b(e(),S())),loadMeta:r(t({deviceId:n()}),_s.nullable()),setName:r(t({deviceId:n(),name:e()}),m(),{kind:"mutation",auth:"admin"}),setLocation:r(t({deviceId:n(),location:e().nullable()}),m(),{kind:"mutation",auth:"admin"}),setMetadata:r(t({deviceId:n(),patch:b(e(),S())}),m(),{kind:"mutation",auth:"admin"}),listLocations:r(m(),l(e())),addLocation:r(t({name:e()}),m(),{kind:"mutation",auth:"admin"}),removeLocation:r(t({name:e(),cascade:y().optional()}),m(),{kind:"mutation",auth:"admin"}),setDisabled:r(t({deviceId:n(),disabled:y()}),m(),{kind:"mutation",auth:"admin"}),listPersistedByAddon:r(t({addonId:e()}),l(zs)),listAll:r(t({addonId:e().optional()}),l(Fe)),getDevice:r(t({deviceId:n()}),Fe.nullable()),getChildren:r(t({parentDeviceId:n()}),l(Fe)),getStreamSources:r(t({deviceId:n()}),l(fa)),getConfigSchema:r(t({deviceId:n()}),l(Ls)),getSettingsSchema:r(t({deviceId:n()}),Fs),updateConfig:r(t({deviceId:n(),values:b(e(),S())}),t({success:k(!0)}),{kind:"mutation",auth:"admin"}),enable:r(t({deviceId:n()}),t({success:k(!0)}),{kind:"mutation",auth:"admin"}),disable:r(t({deviceId:n()}),t({success:k(!0)}),{kind:"mutation",auth:"admin"}),remove:r(t({deviceId:n()}),t({success:k(!0)}),{kind:"mutation",auth:"admin"}),getStreamProfileMap:r(t({deviceId:n()}),b(e(),e().nullable())),setStreamProfileMap:r(t({deviceId:n(),profileMap:b(e(),e().nullable())}),t({success:k(!0)}),{kind:"mutation",auth:"admin"}),probeStreams:r(t({deviceId:n()}),l(Us),{kind:"mutation",auth:"admin"}),getBindings:r(t({deviceId:n()}),t({deviceId:n(),entries:l(t({capName:e(),kind:v(["native","wrapped"]),providerAddonId:e(),providerNodeId:e(),nativeAddonId:e()}))})),getAllBindings:r(t({}),l(t({deviceId:n(),entries:l(t({capName:e(),kind:v(["native","wrapped"]),providerAddonId:e(),providerNodeId:e(),nativeAddonId:e()}))}))),setWrapperActive:r(t({deviceId:n(),capName:e(),wrapperAddonId:e(),active:y()}),m(),{kind:"mutation",auth:"admin"}),listWrappersForCap:r(t({capName:e()}),l(e())),listBindableCapsForDeviceType:r(t({deviceType:e()}),l(t({capName:e(),wrappers:l(e())}))),getDeviceSettingsAggregate:r(t({deviceId:n()}),Y.nullable()),getDeviceLiveInfoAggregate:r(t({deviceId:n()}),Y.nullable()),getDeviceAggregate:r(t({deviceId:n()}),t({settings:Y.nullable(),live:Y.nullable()})),updateDeviceField:r(t({deviceId:n(),writerCapName:e(),writerAddonId:e(),key:e(),value:S()}),t({success:k(!0)}),{kind:"mutation",auth:"admin"}),updateDeviceFieldsBatch:r(t({deviceId:n(),changes:l(t({writerCapName:e(),writerAddonId:e(),key:e(),value:S()}))}),t({success:k(!0),failures:l(t({writerCapName:e(),writerAddonId:e(),error:e()}))}),{kind:"mutation",auth:"admin"}),discoverDevices:r(t({addonId:e()}),l(De),{kind:"mutation",auth:"admin"}),adoptDevice:r(t({addonId:e(),candidate:De}),Me,{kind:"mutation",auth:"admin"}),getCreationSchema:r(t({addonId:e(),type:v(w)}),S().nullable()),createDevice:r(t({addonId:e(),type:v(w),config:b(e(),S())}),Me,{kind:"mutation",auth:"admin"}),testCreationField:r(t({addonId:e(),type:v(w),key:e(),value:S(),formValues:b(e(),S()).optional()}),ct,{kind:"mutation",auth:"admin"}),testField:r(t({deviceId:n(),key:e(),value:S()}),ct,{kind:"mutation",auth:"admin"}),getDeviceStatusAggregate:r(t({deviceId:n(),caps:l(e()).readonly().optional()}),b(e(),S().nullable()))}},Gs={name:"device-state",scope:"system",mode:"singleton",methods:{getSnapshot:r(t({deviceId:n()}),b(e(),b(e(),S()))),getCapSlice:r(t({deviceId:n(),capName:e()}),b(e(),S()).nullable()),getAllSnapshots:r(t({}),b(e(),b(e(),b(e(),S())))),setCapSlice:r(t({deviceId:n(),capName:e(),slice:b(e(),S())}),m(),{kind:"mutation"})},events:{onChanged:G(t({deviceId:n(),capName:e(),slice:b(e(),S())}))}},Ue=t({userId:e(),username:e(),email:e().optional(),displayName:e().optional(),roles:l(e()).optional()}),Vs={name:"auth-provider",scope:"system",mode:"collection",internal:!0,methods:{validateCredentials:r(t({username:e(),password:e()}),Ue.nullable(),{kind:"mutation"}),getLoginUrl:r(t({state:e()}),e()),handleCallback:r(b(e(),e()),Ue,{kind:"mutation"}),validateToken:r(t({token:e()}),Ue.nullable())}},Ks=t({addonId:e(),displayName:e(),kind:v(["local","oidc","saml","ldap","other"]),icon:e().optional(),hasRedirectFlow:y(),hasCredentialFlow:y(),status:e().optional(),enabled:y()}),Zs={name:"authentication",scope:"system",mode:"singleton",methods:{listProviders:r(m(),l(Ks).readonly()),setProviderEnabled:r(t({addonId:e(),enabled:y()}),t({success:k(!0)}),{kind:"mutation",auth:"superAdmin"})}},ut=t({url:e(),hostname:e(),port:n(),protocol:v(["http","https"])}),Ys=t({connected:y(),endpoint:ut.nullable(),error:e().optional()}),Qs={name:"network-access",scope:"system",mode:"collection",internal:!0,methods:{start:r(m(),ut,{kind:"mutation"}),stop:r(m(),m(),{kind:"mutation"}),getEndpoint:r(m(),ut.nullable()),getStatus:r(m(),Ys)}},gi=t({url:e(),hostname:e(),port:n(),protocol:v(["http","https"])}),Js=t({addonId:e(),displayName:e(),kind:v(["cloudflare-tunnel","ngrok","tailscale","other"]),enabled:y(),connected:y(),endpoint:gi.nullable(),error:e().optional()}),Xs={name:"remote-access",scope:"system",mode:"singleton",methods:{listProviders:r(m(),l(Js).readonly()),startProvider:r(t({addonId:e()}),gi,{kind:"mutation",auth:"superAdmin"}),stopProvider:r(t({addonId:e()}),t({success:k(!0)}),{kind:"mutation",auth:"superAdmin"})}},hi=t({urls:R([e(),l(e())]),username:e().optional(),credential:e().optional()}),er={name:"turn-provider",scope:"system",mode:"collection",methods:{getTurnServers:r(m(),l(hi).readonly())}},tr=t({addonId:e(),displayName:e(),kind:v(["cloudflare","coturn","twilio","other"]),enabled:y(),serverCount:n(),error:e().optional()}),nr={name:"turn-orchestrator",scope:"system",mode:"singleton",methods:{listProviders:r(m(),l(tr).readonly()),getAllServers:r(m(),l(hi).readonly()),setProviderEnabled:r(t({addonId:e(),enabled:y()}),t({success:k(!0)}),{kind:"mutation",auth:"superAdmin"})}},yi=t({base64:e(),contentType:e()}),ir=t({lastCapturedAt:n().nullable(),cacheAgeMs:n().nullable(),lastBytes:n().nullable(),lastStreamId:e().nullable()}),ar={name:"snapshot",scope:"device",mode:"singleton",deviceTypes:[w.Camera],exposesDeviceSettings:!0,methods:{getSnapshot:r(t({deviceId:n(),streamId:e().optional(),force:y().optional()}),yi.nullable()),invalidateCache:r(t({deviceId:n()}),m(),{kind:"mutation",auth:"admin"})},status:{schema:ir,kind:"poll"}},or={name:"snapshot-provider",scope:"system",mode:"collection",methods:{supportsDevice:r(t({deviceId:n()}),y()),getSnapshot:r(t({deviceId:n(),streamId:e().optional()}),yi.nullable())}},sr=t({title:e(),body:e(),imageUrl:e().optional(),deviceId:n().optional(),eventId:e().optional(),priority:v(["low","normal","high","critical"]).default("normal"),metadata:b(e(),S()).optional()}),rr={name:"notification-output",scope:"system",mode:"collection",methods:{send:r(sr,m(),{kind:"mutation"}),sendTest:r(m(),t({success:y(),error:e().optional()}),{kind:"mutation"})}},kn=t({id:e(),name:e(),enabled:y(),conditions:b(e(),S()),actions:l(b(e(),S()))}),dr=t({id:e(),ruleId:e(),timestamp:n(),deviceId:n().optional(),success:y(),error:e().optional()}),cr={name:"advanced-notifier",scope:"system",mode:"singleton",internal:!0,methods:{getRules:r(m(),l(kn).readonly()),upsertRule:r(kn,m(),{kind:"mutation"}),deleteRule:r(t({ruleId:e()}),m(),{kind:"mutation"}),testRule:r(t({ruleId:e(),lookbackMinutes:n()}),l(b(e(),S())),{kind:"mutation"}),getHistory:r(t({ruleId:e().optional(),limit:n().optional()}),l(dr))}},fi=v(["continuous","motion","scheduled","composite"]),lr=t({streamId:e(),mode:v(["always","inherit"])}),ur=t({days:l(n()).readonly(),startTime:e(),endTime:e(),mode:v(["continuous","motion"])}),me=t({deviceId:n(),mode:fi,streams:l(lr).readonly(),enabled:y(),preBufferSec:n(),postBufferSec:n(),scheduleRules:l(ur).readonly().optional()}),vi=v(["recording:main","recording:mid","recording:sub","thumbnail:scrub","thumbnail:event"]),mt=t({deviceId:n(),dataCategory:vi,storageName:e(),subDirectory:e(),retentionDays:n().nullable(),retentionGb:n().nullable()}),mr=t({id:e(),deviceId:n(),streamId:e(),startTime:n(),endTime:n(),duration:n(),path:e(),storageName:e(),subDirectory:e(),sizeBytes:n(),codec:v(["h264","h265"]),hasAudio:y()}),pr=t({deviceId:n(),timestamp:n(),path:e(),storageName:e(),subDirectory:e(),sizeBytes:n(),category:v(["scrub","event"])}),gr=t({startTime:n(),endTime:n(),streams:l(e()).readonly()}),hr=t({totalBytes:n(),segmentCount:n()}),yr=t({bitrateKbps:n(),retentionDays:n().nullable(),retentionGb:n().nullable(),estimatedGb:n(),estimatedDaysAtCapacity:n().nullable()}),An=t({perStream:b(e(),yr),thumbnails:t({estimatedGb:n()}),totalEstimatedGb:n(),motionEstimate:t({avgEventsPerDay:n(),avgDurationSec:n(),dutyCyclePercent:n()}).optional()}),fr=t({totalEvents:n(),avgDurationSec:n(),avgEventsPerDay:n(),dutyCyclePercent:n()}),fe=t({deviceId:n()}),vr=t({deviceId:n(),policy:me.omit({deviceId:!0}),storageOverrides:l(mt.omit({deviceId:!0})).readonly().optional(),ffmpegOverrides:b(e(),S()).optional()}),Cn=t({deviceId:n(),startTime:n(),endTime:n()}),Sr=t({deviceId:n(),streamId:e(),startTime:n(),endTime:n()}),br=t({deviceId:n(),streamId:e(),startTime:n(),endTime:n(),live:y().optional()}),Ir=t({deviceId:n(),timestamp:n(),category:e().optional()}),kr=t({deviceId:n(),streamId:e()}),Ar=t({deviceId:n(),motionInput:t({avgEventsPerDay:n(),avgDurationSec:n()}).optional()}),Cr=t({deviceId:n(),dataCategory:vi}),wr=t({deviceId:n(),policy:me.omit({deviceId:!0})}),Pr=t({deviceId:n(),policy:me.omit({deviceId:!0}),ffmpegOverrides:b(e(),S()).optional()}),Dr={name:"recording-engine",scope:"system",mode:"singleton",methods:{getStatus:r(m(),t({activeRecordings:n(),totalSegments:n(),totalSizeMB:n()})),enable:r(vr,m(),{kind:"mutation",auth:"admin"}),disable:r(fe,m(),{kind:"mutation",auth:"admin"}),getConfig:r(fe,me.nullable()),updateConfig:r(Pr,m(),{kind:"mutation",auth:"admin"}),getPlaylist:r(br,e()),getThumbnail:r(Ir,pr.nullable()),getSegments:r(Sr,l(mr).readonly()),getAvailability:r(Cn,l(gr).readonly()),estimateStorage:r(Ar,An),estimateGlobalStorage:r(m(),An),getStorageUsage:r(kr,hr),setPolicy:r(wr,m(),{kind:"mutation",auth:"admin"}),getPolicy:r(fe,me.nullable()),getPolicyStatus:r(fe,t({deviceId:n(),enabled:y(),mode:fi,activeStreams:n()}).nullable()),getRetentionConfig:r(Cr,mt.nullable()),updateRetentionConfig:r(mt,m(),{kind:"mutation",auth:"admin"}),getMotionStats:r(Cn,fr)}},Mr={name:"detection-pipeline",scope:"device",mode:"singleton",deviceTypes:[w.Camera],exposesDeviceSettings:!0,methods:{}},Dt=v(["new","entered","left","moving","idle"]),Tr=v(["motion","object","audio"]),Si=t({x:n(),y:n(),timestamp:n(),bbox:X}),Rr=t({timestamp:n(),position:Si,mediaKey:e()}),He=t({trackId:e(),deviceId:n(),className:e(),label:e().optional(),firstSeen:n(),lastSeen:n(),positions:l(Si).readonly(),snapshots:l(Rr).readonly(),zonesVisited:l(e()).readonly(),totalDistance:n(),state:Dt,active:y()}),Mt={id:e(),deviceId:n(),timestamp:n()},Er=t({...Mt,kind:k("motion"),regionCount:n(),regions:l(t({bbox:X,pixelCount:n(),intensity:n()})).readonly(),frameWidth:n(),frameHeight:n()}),qr=t({...Mt,kind:k("object"),trackId:e(),className:e(),label:e().optional(),confidence:n(),bbox:X,zones:l(e()).readonly(),state:Dt,mediaKey:e().optional()}),Br=t({...Mt,kind:k("audio"),rms:n(),dbfs:n(),classification:t({className:e(),originalClass:e().optional(),score:n()}).optional()}),wn=t({key:e(),kind:v(["crop","thumbnail","snapshot"]),base64:e(),sizeBytes:n(),timestamp:n()}),xr=1e3,Or=5e3,pt=t({deviceId:n(),since:n().optional(),until:n().optional(),limit:n().int().min(1).max(Or).default(xr)}),Nr=pt.extend({classFilter:e().optional()}),Lr=t({trackId:e(),className:e(),confidence:n(),bbox:X,zones:l(e()).readonly(),state:Dt}),zr={name:"pipeline-analytics",scope:"device",mode:"singleton",deviceTypes:[w.Camera],exposesDeviceSettings:!0,methods:{getActiveTracks:r(t({deviceId:n()}),l(He).readonly()),getTrack:r(t({deviceId:n(),trackId:e()}),He.nullable()),listTracks:r(t({deviceId:n(),since:n().optional(),until:n().optional(),limit:n().optional()}),l(He).readonly()),clearTracks:r(t({deviceId:n()}),m(),{kind:"mutation",auth:"admin"}),getMotionEvents:r(pt,l(Er).readonly()),getObjectEvents:r(Nr,l(qr).readonly()),getAudioEvents:r(pt,l(Br).readonly()),getEventMedia:r(t({eventId:e()}),l(wn).readonly()),getTrackMedia:r(t({trackId:e()}),l(wn).readonly())},events:{onFrameTracked:{data:t({deviceId:n(),timestamp:n(),frameWidth:n(),frameHeight:n(),detections:l(Lr).readonly()})},onTrackStarted:{data:t({deviceId:n(),trackId:e(),className:e()})},onTrackEnded:{data:t({deviceId:n(),trackId:e(),className:e(),durationMs:n()})},onDetectionEvent:{data:t({deviceId:n(),kind:Tr,eventId:e(),timestamp:n()})}}},_r=t({total:n(),user:n(),system:n(),irq:n(),nice:n(),loadAvg:Un([n(),n(),n()]),cores:n()}),Fr=t({percent:n(),totalBytes:n(),usedBytes:n(),availableBytes:n(),swapUsedBytes:n(),swapTotalBytes:n()}),Ur=t({readBytes:n(),writeBytes:n(),readOps:n(),writeOps:n(),timestampMs:n()}),Hr=t({rxBytes:n(),txBytes:n(),rxPackets:n(),txPackets:n(),rxErrors:n(),txErrors:n(),timestampMs:n()}),bi=t({utilization:n(),model:e(),memoryUsedBytes:n(),memoryTotalBytes:n(),temperature:n().nullable()}),$r=t({openFds:n(),threadCount:n(),activeHandles:n(),activeRequests:n()}),Pn=t({avg10:n(),avg60:n(),avg300:n()}),$e=t({some:Pn,full:Pn.nullable()}),Dn=t({cpu:_r,memory:Fr,gpu:bi.nullable(),network:Hr,disk:Ur,pressure:t({cpu:$e.nullable(),memory:$e.nullable(),io:$e.nullable()}),process:$r,cpuTemperature:n().nullable(),timestampMs:n()}),Wr=t({path:e(),totalBytes:n(),usedBytes:n(),availableBytes:n(),percent:n()}),Mn=t({pid:n(),cpu:n(),memory:n()}),jr=t({addonId:e(),nodeId:e(),role:v(["hub","worker"]),pid:n(),state:v(["starting","running","stopping","stopped","crashed"]),uptimeSec:n()}),Gr=t({pid:n(),ppid:n(),pgid:n(),classification:v(["root","managed","system","ghost"]),addonId:e().nullable(),nodeId:e().nullable(),command:e(),cpuPercent:n(),memoryRssBytes:n(),uptimeSec:n(),orphaned:y()}),Vr=t({pid:n(),force:y().optional()}),Kr=t({success:y(),reason:e().optional(),signal:v(["SIGTERM","SIGKILL"]).optional()}),Zr=t({cpuPercent:n(),memoryPercent:n(),memoryUsedMB:n(),memoryTotalMB:n(),diskPercent:n().optional(),temperature:n().optional(),gpuPercent:n().optional(),gpuMemoryPercent:n().optional()}),Yr={name:"metrics-provider",scope:"system",mode:"singleton",methods:{collectSnapshot:r(m(),Dn),getCached:r(m(),Dn.nullable()),getCurrent:r(m(),Zr),getDiskSpace:r(t({dirPath:e()}),Wr),getGpuInfo:r(m(),bi.nullable()),getCpuTemperature:r(m(),n().nullable()),getProcessStats:r(t({pids:l(n())}),l(Mn)),listAddonInstances:r(m(),l(jr).readonly()),getAddonStats:r(t({addonId:e()}),Mn.nullable()),listNodeProcesses:r(m(),l(Gr).readonly()),killProcess:r(Vr,Kr,{kind:"mutation",auth:"admin"})}},Qr=t({id:e(),name:e()}),Tn=t({pan:n(),tilt:n(),zoom:n()}),Rn=t({pan:n().optional(),tilt:n().optional(),zoom:n().optional(),speed:n().optional()}),Jr={name:"ptz",scope:"device",mode:"singleton",deviceTypes:[w.Camera],methods:{move:r(Rn.extend({deviceId:n()}),m(),{kind:"mutation"}),continuousMove:r(Rn.extend({deviceId:n()}),m(),{kind:"mutation"}),stop:r(t({deviceId:n()}),m(),{kind:"mutation"}),getPresets:r(t({deviceId:n()}),l(Qr)),goToPreset:r(t({deviceId:n(),presetId:e()}),m(),{kind:"mutation"}),goHome:r(t({deviceId:n()}),m(),{kind:"mutation"}),getPosition:r(t({deviceId:n()}),Tn)},status:{schema:Tn,kind:"command-driven"}},Xr=t({id:e(),type:e(),timestamp:n(),label:e().optional(),thumbnailUrl:e().optional(),clipUrl:e().optional(),metadata:b(e(),S()).optional()}),ed={name:"events",scope:"device",mode:"singleton",deviceTypes:[w.Camera],methods:{getEvents:r(t({deviceId:n(),from:n().optional(),to:n().optional(),limit:n().optional()}),l(Xr)),getEventThumbnail:r(t({deviceId:n(),eventId:e()}),t({base64:e(),contentType:e()}).nullable()),getEventClipUrl:r(t({deviceId:n(),eventId:e()}),e().nullable())}},td=t({id:e(),startTs:n(),endTs:n(),durationSec:n(),sizeBytes:n().optional()}),nd={name:"recording",scope:"device",mode:"singleton",deviceTypes:[w.Camera],methods:{getSegments:r(t({deviceId:n(),from:n().optional(),to:n().optional()}),l(td)),getPlaybackUrl:r(t({deviceId:n(),segmentId:e()}),e().nullable()),getThumbnailAt:r(t({deviceId:n(),timestamp:n()}),t({base64:e(),contentType:e()}).nullable())}},id=t({id:e(),label:e(),protocol:v(["rtsp","rtmp","annexb","http-mjpeg","webrtc","custom"]),url:e().optional(),resolution:t({width:n(),height:n()}).optional(),fps:n().optional(),bitrate:n().optional(),codec:e().optional(),profileHint:v(["high","mid","low"]).optional(),sdp:e().optional()}),ad=t({key:e(),value:S()}),od={name:"device-ops",scope:"device",mode:"singleton",methods:{getStreamSources:r(t({deviceId:n()}),l(id)),getConfigEntries:r(t({deviceId:n()}),l(ad)),setConfig:r(t({deviceId:n(),values:b(e(),S())}),m(),{kind:"mutation"}),removeDevice:r(t({deviceId:n()}),m(),{kind:"mutation"}),getSettingsSchema:r(t({deviceId:n()}),S().nullable())}},sd=t({host:e(),port:n().int().positive().optional(),onvifPort:n().int().positive().optional(),rtspPort:n().int().positive().optional(),https:y().optional(),username:e().optional(),password:e().optional(),onvifProfile:e().optional()}),rd=t({host:e(),port:n().int().positive().nullable(),onvifPort:n().int().positive().nullable(),rtspPort:n().int().positive().nullable(),https:y().nullable(),hasUsername:y(),hasPassword:y(),onvifProfile:e().nullable()}),dd={name:"camera-credentials",scope:"device",mode:"singleton",deviceTypes:[w.Camera],methods:{getCredentials:r(t({deviceId:n()}),sd.nullable(),{kind:"query",auth:"admin"})},status:{schema:rd,kind:"command-driven"}},cd={name:"reboot",scope:"device",mode:"singleton",deviceTypes:[w.Camera,w.Sensor,w.Switch],methods:{reboot:r(t({deviceId:n().int().nonnegative()}),t({success:k(!0)}),{kind:"mutation",auth:"admin"})}},ld=v(["text","timestamp","watermark"]),gt=v(["top-left","top-center","top-right","bottom-left","bottom-center","bottom-right","custom"]),ud=t({id:e(),kind:ld,enabled:y(),text:e().optional(),position:gt.optional(),availablePositions:l(gt).readonly(),readOnly:y().optional()}),En=t({overlays:l(ud).readonly()}),md=t({enabled:y().optional(),text:e().optional(),position:gt.optional()}).partial(),pd={name:"osd",scope:"device",mode:"singleton",deviceTypes:[w.Camera],methods:{setOverlay:r(t({deviceId:n(),overlayId:e(),patch:md}),m(),{kind:"mutation",auth:"admin"})},events:{onStatusChanged:{data:t({deviceId:n(),status:En})}},status:{schema:En,kind:"command-driven"},settings:{bindings:[{kind:"array",statusPath:"overlays",idField:"id",method:"setOverlay",idArg:"overlayId",patchArg:"patch",sectionId:"osd",sectionTitle:"Video overlays",itemFields:{enabled:{label:s=>`${String(s.id)} enabled`,kind:"boolean"},text:{label:s=>`${String(s.id)} text`,kind:"text",when:s=>s.kind!=="timestamp"&&!s.readOnly},position:{label:s=>`${String(s.id)} position`,kind:"select",options:s=>s.availablePositions??[],when:s=>Array.isArray(s.availablePositions)&&s.availablePositions.length>0}}}]}},gd=t({childDeviceIds:l(n()).readonly()}),hd={name:"accessories",scope:"device",mode:"singleton",deviceTypes:[w.Camera,w.Hub],methods:{},events:{onAccessoriesChanged:{data:t({deviceId:n(),childDeviceIds:l(n()).readonly()})}},status:{schema:gd,kind:"command-driven"}},yd=t({codecs:l(e()),sampleRate:n(),duplex:v(["half","full"]),maxBacklogMs:n()}),qn=t({talking:y(),lastSessionAt:n().nullable(),ability:yd.nullable()}),fd={name:"intercom",scope:"device",mode:"singleton",deviceTypes:[w.Camera],methods:{startSession:r(t({deviceId:n()}),t({sessionId:e(),sdpOffer:e()}),{kind:"mutation",auth:"admin"}),handleAnswer:r(t({deviceId:n(),sessionId:e(),sdpAnswer:e()}),m(),{kind:"mutation",auth:"admin"}),stopSession:r(t({deviceId:n(),sessionId:e()}),m(),{kind:"mutation",auth:"admin"})},events:{onStatusChanged:{data:t({deviceId:n(),status:qn})}},status:{schema:qn,kind:"command-driven"}},ht=v(["person","vehicle","animal","face","package","other"]),Ii=t({class:ht,timestamp:n(),confidence:n().min(0).max(1).optional()}),vd=t({lastByClass:b(ht,Ii.nullable()),supportedClasses:l(ht).readonly()}),Sd={name:"native-object-detection",scope:"device",mode:"singleton",deviceTypes:[w.Camera],methods:{},events:{onDetected:{data:t({deviceId:n(),detection:Ii})}},status:{schema:vd,kind:"push"}},bd=v(Yi),Id=v(["videotoolbox","cuda","nvdec","vaapi","qsv","d3d11va","dxva2","amf","vdpau","drm","coreml","tensorrt","openvino","directml","webgpu","none"]).nullable().optional(),kd=t({preferred:l(e()).readonly()}),Ad=v(["darwin","linux","win32"]),Cd=v(["arm64","x64"]),wd=t({type:v(["nvidia","amd","intel","apple"]),name:e(),memoryMB:n().optional()}),Pd=t({type:v(["apple-ane","intel-npu"])}),ki=t({platform:Ad,arch:Cd,cpuModel:e(),cpuCores:n(),totalRAM_MB:n(),availableRAM_MB:n(),gpu:wd.nullable(),npu:Pd.nullable()}),Bn=t({runtime:v(["node","python"]),backend:e(),format:v(["onnx","coreml","openvino"]),score:n(),reason:e(),available:y()}),Dd=t({hardware:ki,scores:l(Bn).readonly(),bestScore:Bn,pythonPath:e().nullable()}),Md=t({modelId:e(),name:e(),minRAM_MB:n(),accuracyScore:n(),formats:l(e()).readonly()}),Td=t({modelId:e(),runtime:v(["node","python"]),backend:e(),format:bd,reason:e()}),Rd={name:"platform-probe",scope:"system",mode:"singleton",methods:{getCapabilities:r(m(),Dd),getHardware:r(m(),ki),resolveInferenceConfig:r(t({requirements:l(Md).readonly()}),Td),resolveHwAccel:r(t({prefer:Id,nodeId:e().optional()}),kd)}},Ed=v(["lan","wifi","docker","vpn","loopback","other"]),Ai=t({name:e(),family:v(["IPv4","IPv6"]),address:e(),cidr:e(),netmask:e(),internal:y(),mac:e(),kind:Ed,preferred:y(),plausible:y(),plausibleReason:e()}),qd=t({interfaces:l(Ai).readonly(),probedAt:n()}),Bd=Ai.nullable(),xd=t({label:e(),baseUrl:e(),kind:v(["lan-ipv4","lan-ipv6","public","loopback"]),interfaceKind:v(["lan","wifi","docker","vpn","other","loopback","public"]),plausible:y(),plausibleReason:e(),priority:n()}),Od=t({endpoints:l(xd).readonly()}),We=t({addresses:l(e()).readonly()}),Nd={name:"local-network",scope:"system",mode:"singleton",methods:{list:r(m(),qd),getPreferred:r(m(),Bd),getConnectionEndpoints:r(t({port:n().int().min(1).max(65535),includeLoopback:y().optional(),ipv4Only:y().optional(),scheme:v(["http","https"]).optional()}),Od),getAllowedAddresses:r(m(),We),setAllowedAddresses:r(We,t({success:k(!0)}),{kind:"mutation"}),resetAllowlistToBestMatch:r(m(),We,{kind:"mutation"})}},Ld=t({id:e(),label:e(),scope:v(["mesh","public"]),url:e(),hostname:e(),port:n(),protocol:v(["http","https"])}),zd=t({id:e(),hostname:e(),addresses:l(e()).readonly(),os:e().optional(),online:y(),lastSeenMs:n(),isSelf:y()}),_d=t({joined:y(),meshIp:e(),magicDnsHostname:e(),peerCount:n(),endpoints:l(Ld).readonly(),error:e().optional()}),Fd=t({enabled:y(),port:n().int().min(1).max(65535).optional()}),Ud=t({enabled:y(),port:n().int().min(1).max(65535).optional()}),Hd={name:"mesh-network",scope:"system",mode:"collection",methods:{getStatus:r(m(),_d),join:r(t({authKey:e().min(8),hostname:e().optional()}),t({joined:k(!0)}),{kind:"mutation"}),leave:r(m(),t({left:k(!0)}),{kind:"mutation"}),listPeers:r(m(),t({peers:l(zd).readonly()})),setPublicIngress:r(Fd,t({success:k(!0)}),{kind:"mutation"}),setMeshIngress:r(Ud,t({success:k(!0)}),{kind:"mutation"})}},$d=t({id:e(),label:e(),scope:v(["mesh","public"]),url:e(),hostname:e(),port:n(),protocol:v(["http","https"])}),Wd=t({addonId:e(),displayName:e(),kind:v(["tailscale","headscale","zerotier","other"]),joined:y(),meshIp:e(),magicDnsHostname:e(),peerCount:n(),endpoints:l($d).readonly(),error:e().optional()}),jd={name:"mesh-orchestrator",scope:"system",mode:"singleton",methods:{listProviders:r(m(),l(Wd).readonly()),joinProvider:r(t({addonId:e(),authKey:e().min(8),hostname:e().optional()}),t({joined:k(!0)}),{kind:"mutation"}),leaveProvider:r(t({addonId:e()}),t({success:k(!0)}),{kind:"mutation"})}},pe=v(["super_admin","admin","viewer","agent"]),je=t({id:e(),username:e(),role:pe,allowedProviders:R([l(e()),k("*")]),allowedDevices:b(e(),R([l(e()),k("*")])),createdAt:n(),updatedAt:n()}),Gd=t({username:e(),password:e().min(6),role:pe,allowedProviders:R([l(e()),k("*")]).optional(),allowedDevices:b(e(),R([l(e()),k("*")])).optional()}),Vd=t({id:e(),role:pe.optional(),allowedProviders:R([l(e()),k("*")]).optional(),allowedDevices:b(e(),R([l(e()),k("*")])).optional()}),yt=t({id:e(),label:e(),role:pe,allowedProviders:R([l(e()),k("*")]).optional(),allowedDevices:b(e(),R([l(e()),k("*")])).optional(),tokenPrefix:e(),createdAt:n(),lastUsedAt:n().optional()}),Kd=t({label:e(),role:pe,allowedProviders:R([l(e()),k("*")]).optional(),allowedDevices:b(e(),R([l(e()),k("*")])).optional()}),Zd=t({token:e(),record:yt}),Ci=t({type:v(["addon","route-prefix","capability"]),target:e()}),ft=t({id:e(),userId:e(),name:e(),tokenPrefix:e(),scopes:l(Ci),expiresAt:n().optional(),lastUsedAt:n().optional(),createdAt:n()}),Yd=t({name:e(),scopes:l(Ci),expiresAt:n().optional()}),Qd=t({token:e(),record:ft}),Jd={name:"user-management",scope:"system",mode:"singleton",methods:{listUsers:r(m(),l(je),{auth:"admin"}),createUser:r(Gd,je,{kind:"mutation",auth:"superAdmin"}),updateUser:r(Vd,t({success:k(!0)}),{kind:"mutation",auth:"superAdmin"}),deleteUser:r(t({id:e()}),t({success:k(!0)}),{kind:"mutation",auth:"superAdmin"}),resetPassword:r(t({id:e(),newPassword:e().min(6)}),t({success:k(!0)}),{kind:"mutation",auth:"superAdmin"}),validateCredentials:r(t({username:e(),password:e()}),je.extend({passwordHash:e()}).nullable(),{kind:"mutation"}),listApiKeys:r(m(),l(yt),{auth:"admin"}),createApiKey:r(Kd,Zd,{kind:"mutation",auth:"admin"}),revokeApiKey:r(t({id:e()}),t({success:k(!0)}),{kind:"mutation",auth:"admin"}),validateApiKey:r(t({token:e()}),yt.nullable(),{kind:"mutation"}),createScopedToken:r(Yd,Qd,{kind:"mutation",auth:"admin"}),revokeScopedToken:r(t({id:e()}),t({success:k(!0)}),{kind:"mutation",auth:"admin"}),validateScopedToken:r(t({token:e()}),ft.nullable()),listScopedTokens:r(t({userId:e()}),l(ft),{auth:"admin"})}},xn=t({streaming:y(),notifications:y(),objectDetection:y(),remoteAccess:y(),agentCluster:y(),smartHome:y(),recordings:y(),backup:y(),repl:y()}),Xd=t({status:k("ok"),uptime:n()}),ec=t({name:e(),address:e(),family:e(),internal:y()}),tc={name:"system",scope:"system",mode:"singleton",methods:{info:r(m(),xn),health:r(m(),Xd),featureFlags:r(m(),xn),networkAddresses:r(m(),l(ec).readonly()),getRetentionConfig:r(m(),S().nullable(),{auth:"admin"}),setRetentionConfig:r(b(e(),S()),Ui(),{kind:"mutation",auth:"superAdmin"}),forceRetentionCleanup:r(m(),m(),{kind:"mutation",auth:"superAdmin"})}},nc=t({nominalBitrateKbps:n(),observedBitrateKbps:n(),peakBitrateKbps:n(),packetLossPercent:n(),lastUpdated:n()}),ic=t({rttMs:n(),jitterMs:n(),estimatedBandwidthKbps:n(),lastUpdated:n()}),On=t({deviceId:n(),streams:b(e(),nc),client:ic.optional()}),ac={name:"network-quality",scope:"system",mode:"singleton",methods:{getDeviceStats:r(t({deviceId:n()}),On.nullable()),getAllStats:r(m(),l(On).readonly()),reportClientStats:r(t({deviceId:n(),rttMs:n().min(0).max(6e4),jitterMs:n().min(0).max(1e4),estimatedBandwidthKbps:n().min(0).max(1e6)}),m(),{kind:"mutation"})}},oc=t({title:e(),message:e(),severity:v(["info","warning","critical"]),duration:n().optional(),action:t({label:e(),url:e()}).optional()}),sc={name:"toast",scope:"system",mode:"singleton",methods:{onToast:r(m(),oc,{kind:"subscription"})}},rc=t({addonId:e(),capabilities:l(e()).readonly(),status:e()}),dc=t({pid:n(),name:e(),state:e(),cpuPercent:n(),memoryRss:n(),uptimeSeconds:n(),services:l(rc).readonly(),groupId:e().optional()}),cc=t({id:e(),name:e(),hostname:e(),platform:e(),arch:e(),cpuModel:e().nullable(),cpuCores:n(),memoryMB:n(),engines:l(e()).readonly(),isHub:y(),isOnline:y(),cpuPercent:n(),memoryPercent:n(),uptime:n(),lastSeen:e(),localIps:l(e()).readonly(),addons:l(t({id:e(),capabilities:l(e()).readonly(),status:e()})).readonly(),processes:l(dc).readonly()}),lc=t({nodeId:e(),name:e(),version:e(),status:e(),synced:y()}),uc=t({hubVersion:e(),nodes:l(lc)}),Ge=t({nodeId:e(),addonId:e()}),oe=t({success:y()}),mc=t({success:y(),reason:e().optional()}),pc=t({restarted:l(e()).readonly(),failed:l(e()).readonly()}),gc=t({nodeId:e(),name:e()}),hc={name:"nodes",scope:"system",mode:"singleton",methods:{topology:r(m(),l(cc).readonly(),{auth:"admin"}),deployAddon:r(Ge,oe,{kind:"mutation",auth:"superAdmin"}),undeployAddon:r(Ge,oe,{kind:"mutation",auth:"superAdmin"}),restartAddon:r(Ge,oe,{kind:"mutation",auth:"superAdmin"}),restartProcess:r(t({nodeId:e(),processName:e()}),mc,{kind:"mutation",auth:"superAdmin"}),restartNode:r(t({nodeId:e()}),pc,{kind:"mutation",auth:"superAdmin"}),shutdownNode:r(t({nodeId:e()}),oe,{kind:"mutation",auth:"superAdmin"}),renameNode:r(t({nodeId:e(),name:e().min(1).max(64)}),gc,{kind:"mutation",auth:"superAdmin"}),clusterAddonStatus:r(m(),b(e(),uc),{auth:"superAdmin"}),setProcessLogLevel:r(t({nodeId:e(),level:e()}),oe,{kind:"mutation",auth:"superAdmin"}),executeQuery:r(t({nodeId:e(),addonId:e(),queryName:e(),params:b(e(),S()).optional()}),S(),{kind:"mutation",auth:"superAdmin"})}},Nn=t({id:e(),addonId:e(),name:e(),enabled:y(),info:b(e(),S()).readonly(),createdAt:n(),updatedAt:n(),processState:e()}),Ve=t({id:e(),addonId:e(),name:e(),enabled:y(),info:b(e(),S()).readonly(),createdAt:n(),updatedAt:n()}),yc=t({addonId:e(),name:e(),description:e(),iconUrl:e().nullable(),color:e(),instanceMode:e(),discoveryMode:e(),existingInstances:l(t({id:e(),name:e()})),canAdd:y()}),fc=t({success:y(),error:e().optional()}),vc=t({addonId:e(),name:e(),enabled:y().optional(),info:b(e(),S()).optional(),settings:b(e(),S()).optional(),skipRestart:y().optional()}),Sc=t({id:e(),name:e().optional(),enabled:y().optional(),info:b(e(),S()).optional()}),bc=t({success:y(),deletedId:e()}),Ic={name:"integrations",scope:"system",mode:"singleton",methods:{list:r(m(),l(Nn)),get:r(t({id:e()}),Nn),getByAddonId:r(t({addonId:e()}),Ve.nullable()),create:r(vc,Ve,{kind:"mutation",auth:"admin"}),update:r(Sc,Ve,{kind:"mutation",auth:"superAdmin"}),delete:r(t({id:e()}),bc,{kind:"mutation",auth:"superAdmin"}),getSettings:r(t({id:e()}),b(e(),S()),{auth:"admin"}),setSettings:r(t({id:e(),settings:b(e(),S())}),t({success:y()}),{kind:"mutation",auth:"superAdmin"}),getAvailableTypes:r(m(),l(yc),{auth:"admin"}),testConnection:r(t({addonId:e(),settings:b(e(),S())}),fc,{kind:"mutation",auth:"admin"})}},Ln=v(["debug","info","warn","error"]),vt=v(["off","latest","beta"]),wi=v(["off","latest","beta","inherit"]),kc=t({id:e(),name:e().optional(),version:e().optional(),description:e().optional(),icon:e().optional(),color:e().optional(),capabilities:l(S()).readonly().optional(),packageName:e(),packageVersion:e(),packageDisplayName:e().optional(),bundle:t({displayName:e(),description:e().optional(),icon:e().optional()}).optional(),protected:y().optional(),removable:y().optional()}),Ac=t({pid:n().optional(),mode:e(),state:e()}),Cc=t({phase:v(["pending","healthy","failed"]),retryCount:n(),firstFailureAt:n().nullable(),lastAttemptAt:n().nullable(),lastError:t({message:e(),stack:e().optional()}).nullable(),nextRetryAt:n().nullable(),alertEmitted:y(),retrying:y(),inGracePeriod:y()}),wc=t({manifest:kc,declaration:S().optional(),source:e(),installSource:e().optional(),process:Ac.optional(),hasBackup:y().optional(),health:Cc.nullable().optional()}),Pc=t({name:e(),version:e(),dir:e(),installSource:e().optional()}),Dc=t({name:e(),currentVersion:e(),latestVersion:e(),category:v(["addon","core"]),requiresRestart:y()}),Mc=t({version:e(),publishedAt:e(),deprecated:e().optional(),distTags:l(e()).readonly()}),Tc=t({name:e(),version:e(),description:e(),keywords:l(e()).readonly(),publishedAt:e(),author:e(),installed:y(),installedVersion:e().optional()}),Rc=t({channel:vt,intervalSeconds:n()}),Ec=wi,qc=S(),zn=S(),Bc=S(),xc=t({timestamp:e(),level:e(),message:e(),scope:e().optional()}),Oc=S(),Nc=t({addonId:e().min(1),action:e().min(1),input:S()}),Lc={name:"addons",scope:"system",mode:"singleton",methods:{list:r(m(),l(wc).readonly()),getLogs:r(t({addonId:e(),limit:n().min(1).max(500).default(100),level:Ln.optional()}),l(Oc),{auth:"admin"}),listPackages:r(m(),l(Pc).readonly()),installPackage:r(t({packageName:e(),version:e().optional()}),zn,{kind:"mutation",auth:"superAdmin"}),installFromWorkspace:r(t({packageName:e()}),zn,{kind:"mutation",auth:"admin"}),isWorkspaceAvailable:r(m(),y()),listWorkspacePackages:r(m(),l(S()).readonly()),uninstallPackage:r(t({packageName:e()}),S(),{kind:"mutation",auth:"superAdmin"}),reloadPackages:r(m(),Bc,{kind:"mutation",auth:"admin"}),searchAvailable:r(t({query:e().optional()}),l(Tc)),listUpdates:r(m(),l(Dc).readonly(),{auth:"admin"}),updatePackage:r(t({name:e().min(1),version:e().optional()}),S(),{kind:"mutation",auth:"superAdmin"}),rollbackPackage:r(t({name:e().min(1)}),t({rolledBackTo:e().nullable()}),{kind:"mutation",auth:"superAdmin"}),forceRefresh:r(m(),S(),{kind:"mutation",auth:"admin"}),restartServer:r(t({confirm:k(!0)}),S(),{kind:"mutation",auth:"superAdmin"}),getVersions:r(t({name:e()}),l(Mc).readonly()),restartAddon:r(t({addonId:e()}),qc,{kind:"mutation",auth:"superAdmin"}),retryLoad:r(t({packageName:e()}),t({success:k(!0)}),{kind:"mutation",auth:"superAdmin"}),getAutoUpdateSettings:r(m(),Rc,{auth:"admin"}),setAutoUpdateSettings:r(t({channel:vt,intervalSeconds:n().min(300).max(86400).optional()}),S(),{kind:"mutation",auth:"superAdmin"}),getAddonAutoUpdate:r(t({addonId:e()}),Ec,{auth:"admin"}),setAddonAutoUpdate:r(t({addonId:e(),channel:wi}),S(),{kind:"mutation",auth:"admin"}),applyAutoUpdateToAll:r(t({channel:vt}),t({success:k(!0)}),{kind:"mutation",auth:"superAdmin"}),custom:r(Nc,S(),{kind:"mutation"}),onAddonLogs:r(t({addonId:e(),level:Ln.optional()}),xc,{kind:"subscription"})}},zc=["decoder","motion-detection","pipeline-executor","audio-analyzer","pipeline-analytics","notification-output"],Gl=[...zc,"pipeline-orchestrator","pipeline-runner"],Pi=v(["super_admin","admin","viewer","agent"]),Di=R([k("*"),l(e())]),Mi=b(e(),R([k("*"),l(e())])),Vl=t({id:e(),username:e(),passwordHash:e(),role:Pi,allowedProviders:Di,allowedDevices:Mi,createdAt:n(),updatedAt:n()}),Kl=t({id:e(),label:e(),role:Pi,allowedProviders:Di,allowedDevices:Mi,tokenHash:e(),tokenPrefix:e(),createdAt:n(),lastUsedAt:n().optional()}),_c=t({type:v(["addon","route-prefix","capability"]),target:e()}),Zl=t({id:e(),userId:e(),name:e(),tokenHash:e(),tokenPrefix:e(),scopes:l(_c),expiresAt:n().optional(),lastUsedAt:n().optional(),createdAt:n()});class Yl{disposers=[];disposed=!1;onError;constructor(o={}){this.onError=o.onError??((i,c)=>{console.error(`[DisposerChain] disposer #${c} threw`,i)})}add(o){if(this.disposed){try{const i=o();i&&typeof i.then=="function"&&i.catch(c=>this.onError(c,-1))}catch(i){this.onError(i,-1)}return()=>{}}return this.disposers.push(o),()=>{const i=this.disposers.indexOf(o);i>=0&&this.disposers.splice(i,1)}}get isDisposed(){return this.disposed}get size(){return this.disposers.length}async dispose(){if(this.disposed)return;this.disposed=!0;const o=this.disposers.slice().reverse();this.disposers=[];for(let i=0;i<o.length;i++){const c=o[i];try{const u=c();u&&typeof u.then=="function"&&await u}catch(u){this.onError(u,o.length-1-i)}}}}const Fc="main-group",Uc="hub-only";function Re(s){return{placement:s.execution?.placement??Uc,group:s.execution?.group??Fc}}function Ql(s){const o=Re(s).placement;return o==="any-node"||o==="agent-only"}function Jl(s){return Re(s).placement==="agent-only"}function Xl(s){return Re(s).group}function eu(s){return Re(s).placement}var Ae=(s=>(s.SystemBoot="system.boot",s.SystemAddonsReady="system.addons-ready",s.SystemRestarting="system.restarting",s.SystemReadyState="system.ready-state",s.AddonStarted="addon.started",s.AddonStopped="addon.stopped",s.AddonRestarted="addon.restarted",s.AddonUpdated="addon.updated",s.AddonInstalled="addon.installed",s.AddonUninstalled="addon.uninstalled",s.AddonCrashed="addon.crashed",s.AddonError="addon.error",s.AddonPageReady="addon.page-ready",s.AddonWidgetReady="addon.widget-ready",s.AddonLoadFailed="addon.load-failed",s.AddonLoadRecovered="addon.load-recovered",s.AddonRetryScheduled="addon.retry-scheduled",s.AddonRetryAttempting="addon.retry-attempting",s.DeviceRegistered="device.registered",s.DeviceUnregistered="device.unregistered",s.DeviceEnabled="device.enabled",s.DeviceDisabled="device.disabled",s.DeviceSettingsUpdated="device.settings-updated",s.DeviceBindingsChanged="device.bindings-changed",s.DeviceMetaChanged="device.meta-changed",s.DeviceStreamsRegistered="device.streams-registered",s.IntegrationEnabled="integration.enabled",s.IntegrationDisabled="integration.disabled",s.IntegrationDeleted="integration.deleted",s.ProviderStarted="provider.started",s.ProviderStopped="provider.stopped",s.ProcessCrashed="process.crashed",s.ProcessRestartScheduled="process.restart_scheduled",s.ProcessRestarted="process.restarted",s.RecordingStarted="recording.started",s.RecordingStopped="recording.stopped",s.RecordingError="recording.error",s.RecordingHealthDegraded="recording.health.degraded",s.RecordingStorageCritical="recording.storage.critical",s.RecordingSegmentWritten="recording.segment.written",s.RecordingPolicyFallback="recording.policy.fallback",s.RecordingRetentionCompleted="recording.retention.completed",s.DetectionEvent="detection.event",s.SessionTrackNew="session.track.new",s.SessionTrackExpired="session.track.expired",s.BenchmarkProgress="benchmark.progress",s.PlatformProbePhase="platform-probe.phase",s.PipelineProgress="pipeline.progress",s.PipelineTrace="pipeline.trace",s.PipelineInferenceResult="pipeline.inference-result",s.PipelineCameraAssigned="pipeline.camera-assigned",s.PipelineCameraUnassigned="pipeline.camera-unassigned",s.PipelineCameraUpdated="pipeline.camera-updated",s.PipelineRunnerLoadSnapshot="pipeline.runner-load-snapshot",s.PipelineCameraMetricsSnapshot="pipeline.camera-metrics-snapshot",s.StreamBrokerMetricsSnapshot="stream-broker.metrics-snapshot",s.StreamBrokerOnCamStreamDemand="stream-broker.onCamStreamDemand",s.StreamBrokerOnCamStreamIdle="stream-broker.onCamStreamIdle",s.StreamBrokerOnRequestStreamSourceRefresh="stream-broker.onRequestStreamSourceRefresh",s.DeviceStateChanged="device.state-changed",s.BatteryOnStatusChanged="battery.onStatusChanged",s.DoorbellOnPressed="doorbell.onPressed",s.PipelineEngineMetricsSnapshot="pipeline.engine-metrics-snapshot",s.ClusterTopologySnapshot="cluster.topology-snapshot",s.MetricsNodeResourcesSnapshot="metrics.node-resources-snapshot",s.MetricsNodeProcessesSnapshot="metrics.node-processes-snapshot",s.CapabilityBindingChanged="capability.binding-changed",s.ModelDownloadProgress="model.download.progress",s.AgentRegistered="agent.registered",s.AgentUnregistered="agent.unregistered",s.AgentOnline="agent.online",s.AgentOffline="agent.offline",s.WorkerOnline="worker.online",s.WorkerOffline="worker.offline",s.AgentTaskDispatched="agent.task.dispatched",s.AgentTaskAssigned="agent.task.assigned",s.AgentTrpcConnected="agent.trpc.connected",s.AgentWsConnected="agent.ws.connected",s.AgentWsDisconnected="agent.ws.disconnected",s.AgentBackupActivated="agent.backup.activated",s.OrchestrationSettingsUpdated="orchestration.settings-updated",s.PipelineAgentHwaccelChanged="pipeline.agent-hwaccel-changed",s.MotionAnalysis="detection.motion-analysis",s.MotionZonesRaw="detection.motion-zones-raw",s.MotionOnMotionChanged="motion.on-motion-changed",s.DetectionResult="detection.result",s.DetectionRaw="detection.raw",s.DetectionCameraNative="detection.camera-native",s.PipelineAudioInferenceResult="pipeline.audio-inference-result",s.DetectionPhaseTransition="detection.phase-transition",s.ProviderMotion="provider.motion",s.ProviderDetection="provider.detection",s.EnrichmentEmbeddingStored="enrichment.embedding.stored",s.EnrichmentSceneStateChanged="enrichment.scene.state-changed",s.EnrichmentActivitySummary="enrichment.activity.summary",s.PipelineAnalyticsTrackStarted="pipeline-analytics.track-started",s.PipelineAnalyticsTrackEnded="pipeline-analytics.track-ended",s.PipelineAnalyticsDetectionEvent="pipeline-analytics.detection-event",s.PipelineAnalyticsFrameTracked="pipeline-analytics.frame-tracked",s.FrigateLiveEvent="frigate.live-event",s.CameraStreamsProfileSlotsChanged="camera-streams.onProfileSlotsChanged",s.StreamOnline="stream.online",s.StreamOffline="stream.offline",s.NetworkTunnelStarted="network.tunnel.started",s.NetworkTunnelStopped="network.tunnel.stopped",s.LocalNetworkChanged="network.local.changed",s.BackupCompleted="backup.completed",s.BackupRestored="backup.restored",s.NotificationDispatched="notification.dispatched",s.NotificationFailed="notification.failed",s.DeviceUpdated="device.updated",s.DeviceOnline="device.online",s.DeviceOffline="device.offline",s.DeviceAwake="device.awake",s.DeviceSleeping="device.sleeping",s.RetentionCleanup="retention.cleanup",s))(Ae||{});function tu(s,o){return s.category===o}function Ti(s,o,i){return{id:typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():Math.random().toString(36).slice(2),timestamp:new Date,source:o,category:s,data:i}}function Hc(s,o){const i=o.ts??Date.now();s.emit(Ti("system.ready-state",{type:"capability",id:o.capName,nodeId:o.sourceNodeId},{capName:o.capName,scope:o.scope,state:o.state,generation:o.generation,sourceNodeId:o.sourceNodeId,ts:i}))}class $c{_ctx=null;_config;_readinessGeneration=typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():Math.random().toString(36).slice(2,14);_registeredCapNames=[];defaults;constructor(o){this.defaults=o,this._config={...o}}get autoEmitReadiness(){return!0}get ctx(){if(!this._ctx)throw new Error(`${this.constructor.name}: ctx accessed before initialize()`);return this._ctx}get ctxIfReady(){return this._ctx}get config(){return this._config}async initialize(o){this._ctx=o,await this.resolveConfig();const i=await this.onInitialize();this.emitLifecycle(Ae.AddonStarted);const c=Wc(i),u=c&&"providers"in c&&c.providers?c.providers:[];return this._registeredCapNames=u.map(g=>g.capability.name),c}postBrokerStart(){this.autoEmitReadiness&&this._registeredCapNames.length>0&&this.emitReadinessForProviders("ready")}async onHubReachable(){}async shutdown(){this.emitLifecycle(Ae.AddonStopped),this.autoEmitReadiness&&this.emitReadinessForProviders("down"),await this.onShutdown();for(const o of this._subscriptions)o();this._subscriptions=[],this._ctx=null}async onShutdown(){}async onConfigChanged(){}field(o){return o}schema(o){return o}globalSettingsSchema(){return null}deviceSettingsSchema(){return null}async getGlobalSettings(o){const i=this.globalSettingsSchema();if(!i)return{sections:[]};const c=await this._ctx?.settings?.readAddonStore()??{};return Yt(i,o?{...c,...o}:c)}async updateGlobalSettings(o){await this._ctx?.settings?.writeAddonStore(o),await this.resolveConfig(),await this.onConfigChanged(),this.emitLifecycle(Ae.AddonUpdated,{level:"global"}),this.maybeAutoRestart(o,this.globalSettingsSchema())}maybeAutoRestart(o,i){if(!i)return;const c=new Set;for(const p of i.sections)for(const h of p.fields)h.type==="separator"||h.type==="info"||h.requiresRestart&&c.add(h.key);if(c.size===0||!Object.keys(o).some(p=>c.has(p)))return;const g=this._ctx;if(!g)return;const f=g.id;setImmediate(()=>{g.api.addons?.restartAddon?.mutate({addonId:f}).then(()=>{g.logger.info("addon auto-restart triggered by restart-required setting change",{meta:{changedFields:Object.keys(o).filter(h=>c.has(h))}})}).catch(h=>{g.logger.error("addon auto-restart failed",{meta:{error:h instanceof Error?h.message:String(h)}})})})}async getDeviceSettings(o){const i=this.deviceSettingsSchema();if(!i)return{sections:[]};const c=await this._ctx?.settings?.readDeviceStore(o)??{};return Yt(i,c)}async updateDeviceSettings(o,i){await this._ctx?.settings?.writeDeviceStore(o,i)}_subscriptions=[];watchCapability(o,i){const c=Array.isArray(o)?o:[o],u=new Set(c);this.subscribe({category:"system.ready-state"},g=>{const f=g.data;if(typeof f.capName!="string"||!u.has(f.capName)||f.scope?.type!=="node")return;const p=f.scope.nodeId;if(typeof p!="string"||p.length===0)return;const h=f.capName;f.state==="down"?i.onDown?.(p,h):f.state==="ready"&&i.onReady?.(p,h)})}subscribe(o,i){const c=this.ctx.eventBus.subscribe(o,i);this._subscriptions.push(c)}emitLifecycle(o,i){try{this._ctx?.eventBus.emit({id:`${this._ctx.id}-${Date.now()}`,timestamp:new Date,source:{type:"addon",id:this._ctx.id,nodeId:this._ctx.kernel.localNodeId??"hub"},category:o,data:i??{}})}catch{}}emitReadinessForProviders(o){const i=this._ctx;if(!i||this._registeredCapNames.length===0)return;const c=i.kernel?.localNodeId??"hub",u=c.includes("/")?c.split("/")[0]:c;for(const g of this._registeredCapNames)try{Hc(i.eventBus,{capName:g,scope:{type:"node",nodeId:u},state:o,generation:this._readinessGeneration,sourceNodeId:u})}catch{}}async resolveModelsDir(){return this.ctx.api.storage.resolve.query({location:"models",relativePath:""}).catch(()=>"camstack-data/models")}get capabilities(){return this.ctx.capabilities??null}async resolveConfig(){const o=await this._ctx?.settings?.readAddonStore()??{},i={...this.defaults};for(const c of Object.keys(this.defaults)){const u=o[c];if(u!=null){const g=typeof this.defaults[c];typeof u===g&&(i[c]=u)}}this._config=i}}function Wc(s){if(s!=null)return Array.isArray(s)?{providers:s}:s}class jc extends Error{capName;scope;waitedMs;constructor(o,i,c){super(`Timed out waiting for ${o} (${de(i)}) to become ready after ${c}ms`),this.name="ReadinessTimeoutError",this.capName=o,this.scope=i,this.waitedMs=c}}function Ke(s,o){return`${s}|${de(o)}`}function de(s){switch(s.type){case"global":return"global";case"node":return`node:${s.nodeId}`;case"device":return`device:${s.deviceId}`}}function Ze(s,o){return s.type!==o.type?!1:s.type==="global"||o.type==="global"?!0:s.type==="node"&&o.type==="node"?s.nodeId===o.nodeId:s.type==="device"&&o.type==="device"?s.deviceId===o.deviceId:!1}class nu{bus;sourceNodeId;logger;now;generation;snapshot=new Map;subscriptions=new Set;unsubscribeBus;unsubscribeAgentOffline;constructor(o){if(this.bus=o.eventBus,this.sourceNodeId=o.sourceNodeId,this.logger=o.logger,this.now=o.now??(()=>Date.now()),this.generation=o.generation??Gc(),this.unsubscribeBus=this.bus.subscribe({category:"system.ready-state"},i=>this.ingest(i.data)),this.unsubscribeAgentOffline=this.bus.subscribe({category:"agent.offline"},i=>this.synthesizeDownForNode(i.data.agentId)),typeof this.bus.getRecent=="function")try{const i=this.bus.getRecent({category:"system.ready-state"});for(const c of i)this.ingest(c.data)}catch{}}close(){this.unsubscribeBus(),this.unsubscribeAgentOffline(),this.subscriptions.clear()}get(o,i){return this.snapshot.get(Ke(o,i))??null}getSnapshotForTransport(){return Array.from(this.snapshot.values())}hydrate(o){const i=this.now();for(const c of o){const u=Ke(c.capName,c.scope);if(this.snapshot.has(u))continue;const g={capName:c.capName,scope:c.scope,state:c.state,generation:c.generation,epoch:1,lastChange:i,sourceNodeId:c.sourceNodeId};this.snapshot.set(u,g),this.logger&&this.logger.debug(`readiness: ${c.capName} (${de(c.scope)}) → ${c.state} (hydrated, gen=${c.generation.slice(0,6)})`);const f={capName:c.capName,scope:c.scope,state:c.state,epoch:1,generation:c.generation,sourceNodeId:"hydrated",ts:i,durationInPrevState:0};for(const p of this.subscriptions)if(p.capName===c.capName&&Ze(p.scope,c.scope))try{p.handler(f)}catch(h){this.logger?.warn(`readiness hydrate handler threw for ${c.capName}: ${h.message??String(h)}`)}}}getAll(){return new Map(this.snapshot)}emitReady(o,i){this.emitTransition(o,i,"ready")}emitStarting(o,i){this.emitTransition(o,i,"starting")}emitDown(o,i){this.emitTransition(o,i,"down")}awaitReady(o,i,c={}){const u=c.timeoutMs??Number.POSITIVE_INFINITY,g=this.now();return this.get(o,i)?.state==="ready"?Promise.resolve():c.signal?.aborted?Promise.reject(c.signal.reason??new Error("aborted")):new Promise((p,h)=>{let I=!1;const A=this.onReadyState(o,i,V=>{V.state==="ready"&&(I||(I=!0,O(),p()))}),P=!Number.isFinite(u)?null:setTimeout(()=>{I||(I=!0,O(),h(new jc(o,i,this.now()-g)))},u),T=()=>{I||(I=!0,O(),h(c.signal?.reason??new Error("aborted")))};c.signal?.addEventListener("abort",T,{once:!0});function O(){A(),P!==null&&clearTimeout(P),c.signal?.removeEventListener("abort",T)}})}onReadyState(o,i,c){const u={capName:o,scope:i,handler:c};this.subscriptions.add(u);const g=this.get(o,i);return g!==null&&queueMicrotask(()=>{this.subscriptions.has(u)&&c({capName:o,scope:i,state:g.state,epoch:g.epoch,generation:g.generation,sourceNodeId:this.sourceNodeId,ts:g.lastChange,durationInPrevState:0})}),()=>{this.subscriptions.delete(u)}}emitTransition(o,i,c){const u=this.now();this.bus.emit(Ti("system.ready-state",{type:"capability",id:o,nodeId:this.sourceNodeId},{capName:o,scope:i,state:c,generation:this.generation,sourceNodeId:this.sourceNodeId,ts:u}))}ingest(o){if(typeof o?.capName!="string"||o.state!=="ready"&&o.state!=="starting"&&o.state!=="down"||typeof o.generation!="string"||o.scope?.type!=="global"&&o.scope?.type!=="node"&&o.scope?.type!=="device")return;const i=Ke(o.capName,o.scope),c=this.snapshot.get(i)??null,u=this.now();let g;if(c===null?g=o.state==="ready"?1:0:c.generation!==o.generation&&o.state==="ready"?g=c.epoch+1:g=c.epoch,c!==null&&c.generation===o.generation&&c.state===o.state)return;const f=c===null?0:Math.max(0,u-c.lastChange),p={capName:o.capName,scope:o.scope,state:o.state,generation:o.generation,epoch:g,lastChange:u,sourceNodeId:o.sourceNodeId};this.snapshot.set(i,p);const h={capName:o.capName,scope:o.scope,state:o.state,epoch:g,generation:o.generation,sourceNodeId:o.sourceNodeId,ts:o.ts,durationInPrevState:f};this.logger&&this.logger.debug(`readiness: ${o.capName} (${de(o.scope)}) → ${o.state} epoch=${g} gen=${o.generation.slice(0,6)} (prev ${f}ms)`);for(const I of this.subscriptions)if(I.capName===o.capName&&Ze(I.scope,o.scope))try{I.handler(h)}catch(A){this.logger?.warn(`readiness handler threw for ${o.capName}: ${A.message??String(A)}`)}}synthesizeDownForNode(o){const i=this.now();for(const[c,u]of this.snapshot){if(u.state==="down"||!(u.scope.type==="node"&&u.scope.nodeId===o||u.scope.type==="device"&&u.sourceNodeId===o))continue;const f=Math.max(0,i-u.lastChange),p={...u,state:"down",lastChange:i};this.snapshot.set(c,p);const h={capName:u.capName,scope:u.scope,state:"down",epoch:u.epoch,generation:u.generation,sourceNodeId:this.sourceNodeId,ts:i,durationInPrevState:f};this.logger&&this.logger.debug(`readiness: ${u.capName} (${de(u.scope)}) → down (synthesized from agent.offline ${o})`);for(const I of this.subscriptions)if(I.capName===u.capName&&Ze(I.scope,u.scope))try{I.handler(h)}catch(A){this.logger?.warn(`readiness handler threw during agent.offline demux for ${u.capName}: ${A.message??String(A)}`)}}}}function Gc(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():Math.random().toString(36).slice(2,14)}function iu(s,o){for(const{capName:i,scope:c}of o)s.emitDown(i,c)}const au=["data","media","recordings","recordings-high","recordings-low","recordings-clips","event-images","models","addons-data","cache","logs","backups"],ou={data:"db",media:"media",recordings:"recordings","recordings-high":"recordings-high","recordings-low":"recordings-low","recordings-clips":"recordings-clips","event-images":"event-images",models:"models","addons-data":"addons-data",cache:"/tmp/camstack-cache",logs:"logs",backups:"backups"},Vc={high:"High",mid:"Mid",low:"Low"};function su(s){return Vc[s]??s.charAt(0).toUpperCase()+s.slice(1)}function Kc(s){return(s.width??0)*(s.height??0)}function Zc(s){if(s.length===0)return[];const o=s.map((c,u)=>({s:c,i:u,px:Kc(c.metadata??{})})).sort((c,u)=>u.px-c.px),i=Array.from({length:s.length});for(let c=0;c<o.length;c++){const{s:u,i:g}=o[c];let f;c===0?f="high":c===o.length-1?f="low":f="mid",i[g]={...u,quality:f}}return i}function ru(s){const o=s.height??0,i=s.width??0;return o>=1080||i>=1920?"high":o>=480||i>=640?"mid":"low"}function du(s){const o=s.protocols.find(u=>u.type==="rtsp"&&u.url)??s.protocols.find(u=>u.url),i=o?.type,c=i==="rtsp"?"rtsp":i==="http"||i==="flv"?"http-mjpeg":"custom";return{id:s.id,label:s.label??s.id,protocol:c,url:o?.url,profileHint:s.quality}}function x(s){return typeof s=="string"}function Yc(s){return typeof s=="object"&&s!==null&&!Array.isArray(s)}function Qc(s){return x(s)&&s.trim()?{url:s}:Yc(s)&&x(s.url)&&s.url.trim()?{url:s.url,label:x(s.label)?s.label:void 0}:null}function cu(s){const o=x(s.snapshot_url)?s.snapshot_url:void 0;if(Array.isArray(s.streams)){const f=[];for(const p of s.streams){const h=Qc(p);h&&f.push(h)}return{streams:f,snapshot_url:o}}const i=[],c=x(s.main_stream_url)?s.main_stream_url:void 0;c&&i.push({url:c,label:x(s.main_stream_name)?s.main_stream_name:void 0});const u=x(s.sub_stream_url)?s.sub_stream_url:void 0;u&&i.push({url:u,label:x(s.sub_stream_name)?s.sub_stream_name:void 0});const g=x(s.third_stream_url)?s.third_stream_url:void 0;return g&&i.push({url:g,label:x(s.third_stream_name)?s.third_stream_name:void 0}),{streams:i,snapshot_url:o}}function lu(s){if(s.length===0)return{};const o=Zc(s),i={},c=o.find(p=>p.quality==="high"),u=o.find(p=>p.quality==="mid"),g=o.find(p=>p.quality==="low");c&&(i.high=c.id),u&&(i.mid=u.id),g&&(i.low=g.id);const f=c??u??g??o[0];return f&&(i.high||(i.high=f.id),i.mid||(i.mid=f.id),i.low||(i.low=f.id)),i}const uu={streaming:!0,notifications:!0,objectDetection:!1,remoteAccess:!0,agentCluster:!1,smartHome:!0,recordings:!0,backup:!0,repl:!0},mu=["face","plate"],pu=["face","plate","clip","custom"],gu={cleanupIntervalMs:3600*1e3,detectionEventsDays:30,audioLevelsDays:7,snapshotsDays:14};var Jc=(s=>(s.Addon="addon",s.Core="core",s.Device="device",s.Provider="provider",s.System="system",s))(Jc||{});const Xc="camstack/camstack-models",hu=`https://huggingface.co/${Xc}/resolve/main`,yu={"features.streaming":!0,"features.notifications":!0,"features.objectDetection":!1,"features.remoteAccess":!0,"features.agentCluster":!1,"features.smartHome":!0,"features.recordings":!0,"features.backup":!0,"features.repl":!0,"retention.detectionEventsDays":30,"retention.audioLevelsDays":7,"logging.level":"info","logging.retentionDays":30,"eventBus.ringBufferSize":1e4,"storage.provider":"sqlite-storage","storage.locations":{data:"camstack-data/data",media:"camstack-data/media",recordings:"camstack-data/recordings",cache:"/tmp/camstack-cache",logs:"camstack-data/logs",models:"camstack-data/models"},providers:[],"recording.segmentDurationSeconds":4,"recording.defaultRetentionDays":30,"ffmpeg.binaryPath":"ffmpeg","ffmpeg.hwAccel":"auto","ffmpeg.threadCount":0,"auth.tokenExpiry":"24h"};function Ri(s){return JSON.parse(s)}function el(s){return s===null||typeof s!="object"||Array.isArray(s)?null:{...s}}function fu(s){return Array.isArray(s)?s:[]}function vu(s,o=""){return typeof s=="string"?s:o}function Su(s,o=0){return typeof s=="number"?s:o}function bu(s,o=!1){return typeof s=="boolean"?s:o}function Iu(s){try{return el(Ri(s))}catch{return null}}function ku(s){try{const o=Ri(s);return Array.isArray(o)?o:null}catch{return null}}function Au(s,o){return`https://huggingface.co/${s}/resolve/main/${o}`}function Cu(s,o){if(s.length!==o.length)return 0;let i=0,c=0,u=0;for(let f=0;f<s.length;f++)i+=s[f]*o[f],c+=s[f]*s[f],u+=o[f]*o[f];const g=Math.sqrt(c)*Math.sqrt(u);return g===0?0:i/g}class wu{constructor(o,i){this.elementId=o,this.getBackend=typeof i=="function"?i:()=>i}cache={};listeners=new Set;loaded=!1;getBackend;async ensureLoaded(){if(this.loaded)return;const o=this.getBackend();if(!o)throw new Error(`ElementConfigStore(${this.elementId}): settings backend not available`);const i=await o.query({collection:"config",filter:{where:{id:this.elementId},limit:1}});i.length>0&&(this.cache=i[0].data??{}),this.loaded=!0}getAll(){return{...this.cache}}get(o){const i=o.split(".");let c=this.cache;for(const u of i){if(c===null||typeof c!="object"||Array.isArray(c))return;c=Reflect.get(c,u)}return c}async set(o,i){await this.ensureLoaded(),tl(this.cache,o,i),await this.persist(),this.notifyListeners()}async setAll(o){await this.ensureLoaded(),this.cache={...o},await this.persist(),this.notifyListeners()}onChange(o){return this.listeners.add(o),()=>{this.listeners.delete(o)}}async load(){await this.ensureLoaded()}async loadDefaults(o){await this.ensureLoaded(),Object.keys(this.cache).length===0&&(this.cache={...o},await this.persist())}async persist(){const o=this.getBackend();if(!o)throw new Error(`ElementConfigStore(${this.elementId}): settings backend not available — cannot persist config`);await o.set({collection:"config",key:this.elementId,value:this.cache})}notifyListeners(){const o=this.getAll();for(const i of this.listeners)try{i(o)}catch{}}}function tl(s,o,i){const c=o.split(".");let u=s;for(let g=0;g<c.length-1;g++){const f=c[g],p=u[f];if(p===null||typeof p!="object"||Array.isArray(p)){const h={};u[f]=h,u=h}else u=p}u[c[c.length-1]]=i}const Ei={cpu:"onnx",coreml:"onnx",cuda:"onnx",tensorrt:"onnx","onnx-py":"onnx",pytorch:"pt",openvino:"openvino"},nl={onnx:"onnx",coreml:"coreml",openvino:"openvino",tflite:"tflite",pytorch:"pt"},il={coreml:"coreml_inference.py",pytorch:"pytorch_inference.py",openvino:"openvino_inference.py"};function al(s,o){return s==="node"?"onnx":{coreml:"coreml",openvino:"openvino",pytorch:"pytorch","onnx-py":"onnx",cpu:"onnx"}[o]??o}function Pu(s,o){return s==="node"?Ei[o]??"onnx":{coreml:"coreml",openvino:"openvino",pytorch:"pt","onnx-py":"onnx",cpu:"onnx"}[o]??"onnx"}function Du(s,o){return!s||s==="auto"?"auto":al(s,o??"cpu")}function Mu(s){return Ei[s]??"onnx"}function Tu(s){return nl[s]}function Ru(s){return il[s]}function Eu(s){return s==="coreml"||s==="pytorch"||s==="openvino"}async function qu(s,o){const i=performance.now();try{return{output:o!==void 0?await ol(s(),o):await s(),durationMs:_n(performance.now()-i),ok:!0}}catch(c){return{output:void 0,durationMs:_n(performance.now()-i),ok:!1,error:ta(c)}}}function _n(s){return Math.round(s*100)/100}function ol(s,o){return new Promise((i,c)=>{const u=setTimeout(()=>c(new Error(`Inference timeout after ${o}ms`)),o);s.then(g=>{clearTimeout(u),i(g)}).catch(g=>{clearTimeout(u),c(g)})})}const Bu=[{id:"person",name:"Person"},{id:"bicycle",name:"Bicycle"},{id:"car",name:"Car"},{id:"motorcycle",name:"Motorcycle"},{id:"airplane",name:"Airplane"},{id:"bus",name:"Bus"},{id:"train",name:"Train"},{id:"truck",name:"Truck"},{id:"boat",name:"Boat"},{id:"traffic light",name:"Traffic Light"},{id:"fire hydrant",name:"Fire Hydrant"},{id:"stop sign",name:"Stop Sign"},{id:"parking meter",name:"Parking Meter"},{id:"bench",name:"Bench"},{id:"bird",name:"Bird"},{id:"cat",name:"Cat"},{id:"dog",name:"Dog"},{id:"horse",name:"Horse"},{id:"sheep",name:"Sheep"},{id:"cow",name:"Cow"},{id:"elephant",name:"Elephant"},{id:"bear",name:"Bear"},{id:"zebra",name:"Zebra"},{id:"giraffe",name:"Giraffe"},{id:"backpack",name:"Backpack"},{id:"umbrella",name:"Umbrella"},{id:"handbag",name:"Handbag"},{id:"tie",name:"Tie"},{id:"suitcase",name:"Suitcase"},{id:"frisbee",name:"Frisbee"},{id:"skis",name:"Skis"},{id:"snowboard",name:"Snowboard"},{id:"sports ball",name:"Sports Ball"},{id:"kite",name:"Kite"},{id:"baseball bat",name:"Baseball Bat"},{id:"baseball glove",name:"Baseball Glove"},{id:"skateboard",name:"Skateboard"},{id:"surfboard",name:"Surfboard"},{id:"tennis racket",name:"Tennis Racket"},{id:"bottle",name:"Bottle"},{id:"wine glass",name:"Wine Glass"},{id:"cup",name:"Cup"},{id:"fork",name:"Fork"},{id:"knife",name:"Knife"},{id:"spoon",name:"Spoon"},{id:"bowl",name:"Bowl"},{id:"banana",name:"Banana"},{id:"apple",name:"Apple"},{id:"sandwich",name:"Sandwich"},{id:"orange",name:"Orange"},{id:"broccoli",name:"Broccoli"},{id:"carrot",name:"Carrot"},{id:"hot dog",name:"Hot Dog"},{id:"pizza",name:"Pizza"},{id:"donut",name:"Donut"},{id:"cake",name:"Cake"},{id:"chair",name:"Chair"},{id:"couch",name:"Couch"},{id:"potted plant",name:"Potted Plant"},{id:"bed",name:"Bed"},{id:"dining table",name:"Dining Table"},{id:"toilet",name:"Toilet"},{id:"tv",name:"TV"},{id:"laptop",name:"Laptop"},{id:"mouse",name:"Mouse"},{id:"remote",name:"Remote"},{id:"keyboard",name:"Keyboard"},{id:"cell phone",name:"Cell Phone"},{id:"microwave",name:"Microwave"},{id:"oven",name:"Oven"},{id:"toaster",name:"Toaster"},{id:"sink",name:"Sink"},{id:"refrigerator",name:"Refrigerator"},{id:"book",name:"Book"},{id:"clock",name:"Clock"},{id:"vase",name:"Vase"},{id:"scissors",name:"Scissors"},{id:"teddy bear",name:"Teddy Bear"},{id:"hair drier",name:"Hair Drier"},{id:"toothbrush",name:"Toothbrush"}],xu=[{id:"person",name:"Person"},{id:"vehicle",name:"Vehicle"},{id:"animal",name:"Animal"}],Ou={mapping:{person:"person",bicycle:"vehicle",car:"vehicle",motorcycle:"vehicle",airplane:"vehicle",bus:"vehicle",train:"vehicle",truck:"vehicle",boat:"vehicle",bird:"animal",cat:"animal",dog:"animal",horse:"animal",sheep:"animal",cow:"animal",elephant:"animal",bear:"animal",zebra:"animal",giraffe:"animal"},preserveOriginal:!1},Nu={camera:{type:"camera",label:"Camera",icon:"camera"}};class ce{schema;data;persistFn;constructor(o,i,c){this.schema=o,this.data=i,this.persistFn=c}static fromSchema(o,i,c={},u){const g=o.safeParse(c);if(g.success)return new ce(o,g.data,i);const f=new Set;for(const A of g.error.issues){const C=A.path[0];typeof C=="string"&&f.add(C)}const p={...c};for(const A of f)delete p[A];const h=o.safeParse(p);if(u?.({droppedKeys:[...f],issues:g.error.issues}),h.success)return i(h.data).catch(()=>{}),new ce(o,h.data,i);const I=o.parse({});return new ce(o,I,i)}get values(){return this.data}get(o){return this.data[o]}async set(o,i){const c=this.schema.parse({...this.data,[o]:i});this.data=c,await this.persistFn(this.data)}async setAll(o){const i=this.schema.parse({...this.data,...o});this.data=i,await this.persistFn(this.data)}async deleteKey(o){const{[o]:i,...c}=this.data,u=this.schema.parse(c);this.data=u,await this.persistFn(this.data)}entries(){const o=this.schema.shape;return Object.entries(o).map(([i,c])=>({key:i,schema:c,value:this.data[i],description:c.description}))}}class Tt{writer;pendingWrites=new Set;slices;schemas=new Map;listeners=new Set;capListeners=new Map;constructor(o,i){this.writer=i,this.slices=new Map;for(const[c,u]of Object.entries(o))u&&typeof u=="object"&&!Array.isArray(u)&&this.slices.set(c,{...u})}static fromInitial(o,i){return new Tt(o,i)}installCapSchema(o,i){const c=this.schemas.get(o);if(c){if(c!==i)throw new Error(`[DeviceRuntimeState] capability "${o}" registered a different runtime-state schema; each cap must declare ONE shape across every provider`);return}this.schemas.set(o,i);const u=this.slices.get(o);if(u){const g=i.safeParse(u);g.success?this.slices.set(o,g.data):this.slices.delete(o)}}getCapState(o){const i=this.slices.get(o);if(i)return Object.freeze({...i})}getCapField(o,i){return this.slices.get(o)?.[i]}setCapState(o,i){this.applyCapWrite(o,i,!1)}patchCapState(o,i){this.applyCapWrite(o,i,!0)}applyCapWrite(o,i,c){const u=this.schemas.get(o);if(!u)throw new Error(`[DeviceRuntimeState] no schema registered for cap "${o}" — did the device register it via ctx.registerNativeCap before writing?`);const g=this.slices.get(o)??{},f=c?{...g,...i}:{...i},p=u.parse(f);if(sl(g,p))return;this.slices.set(o,p),this.fireListeners([o]);const h=this.writer(o,{...p}).catch(()=>{});this.pendingWrites.add(h),h.finally(()=>{this.pendingWrites.delete(h)})}fireListeners(o){const i=this.snapshot();for(const c of this.listeners)try{c(o,i)}catch{}for(const c of o){const u=this.capListeners.get(c);if(!u)continue;const g=this.getCapState(c);for(const f of u)try{f(g)}catch{}}}subscribe(o){return this.listeners.add(o),()=>{this.listeners.delete(o)}}subscribeCap(o,i){let c=this.capListeners.get(o);c||(c=new Set,this.capListeners.set(o,c));const u=g=>{i(g)};return c.add(u),()=>{const g=this.capListeners.get(o);g&&(g.delete(u),g.size===0&&this.capListeners.delete(o))}}snapshot(){const o={};for(const[i,c]of this.slices)o[i]=Object.freeze({...c});return Object.freeze(o)}async flush(){if(this.pendingWrites.size===0)return;const o=[...this.pendingWrites];await Promise.allSettled(o)}}function sl(s,o){const i=Object.keys(s),c=Object.keys(o);if(i.length!==c.length)return!1;for(const u of i)if(s[u]!==o[u])return!1;return!0}const Ye="lastFetchedAt";function Lu(s){const{runtimeState:o,cap:i,ownDeviceId:c,refresh:u,staleMs:g,empty:f}=s,p=async()=>{const A=o.getCapState(i.name),C=typeof A?.[Ye]=="number"?A[Ye]:0;(!A||Date.now()-C>g)&&await u()},h=()=>{const A=o.getCapState(i.name);if(!A)return f();const{[Ye]:C,...P}=A;return P};return{ensureFresh:p,getStatus:async({deviceId:A})=>{if(A!==c)throw new Error(`${i.name}: deviceId mismatch, expected ${c}, got ${A}`);return await p(),h()}}}const rl={audioMetrics:jn,battery:Gn,brightness:Vn,cameraStreams:Zn,deviceDiscovery:Yn,deviceStatus:It,doorbell:Qn,featureProbe:kt,motion:ei,motionTrigger:ni,ptzAutotrack:ii,switch:ai,zoneAnalytics:oi,zoneRules:si,zones:Jn};class zu{id;stableId;type;name;parentDeviceId;role;get online(){return this.runtimeState.getCapState("device-status")?.online??!1}set online(o){this.markOnline(o)}get state(){if(!this._stateProxyCache){const o={},i={get:(c,u)=>{const g=u;if(g in o)return o[g];const f=rl[g];if(!f)return;const p=this.sliceProxy(f);return o[g]=p,p}};this._stateProxyCache=new Proxy(o,i)}return this._stateProxyCache}_stateProxyCache;config;runtimeState;ctx;location;disabled;constructor(o,i,c){if(this.ctx=o,this.id=o.id,this.stableId=o.stableId,this.type=c.type,!o.deviceMeta)throw new Error(`BaseDevice constructor: ctx.deviceMeta is required (id=${o.id} stableId=${o.stableId})`);this.name=o.deviceMeta.name,this.location=o.deviceMeta.location,this.disabled=o.deviceMeta.disabled,this.role=c.role,this.parentDeviceId=o.parentDeviceId;const u=o.persistedConfig??{};this.config=ce.fromSchema(i,A=>o.persistConfig(A),u,({droppedKeys:A,issues:C})=>{o.logger.warn("Device config recovery: dropping invalid persisted fields",{tags:{deviceId:o.id,stableId:o.stableId},meta:{droppedKeys:[...A],firstIssue:C[0]?.message??null}})});let g=null;const f=async(A,C)=>{g||(g=o.fetchDevice(o.id)),await(await g).deviceState.setCapSlice({capName:A,slice:C})},p=o.initialRuntimeState??{};this.runtimeState=Tt.fromInitial(p,f),o.bindRuntimeState?.(this.runtimeState),o.registerNativeCap?.(It,{});const h={online:!1,lastChangedAt:Date.now()};this.runtimeState.setCapState("device-status",h),o.registerNativeCap?.(kt,{});const I={flags:{},deviceType:null,model:null,channelCount:null,lastProbedAt:0,lastFetchedAt:0};this.runtimeState.setCapState("feature-probe",I)}async removeDevice(){}markOnline(o){if(this.online===o)return;const i={online:o,lastChangedAt:Date.now()};this.runtimeState.setCapState("device-status",i)}async refreshFeatures(){const i=this.ctx.api?.deviceManager?.registerDevice;if(i)try{await i.mutate({addonId:this.ctx.deviceMeta.addonId,stableId:this.stableId,id:this.id,type:this.type,name:this.name,parentDeviceId:this.parentDeviceId,features:[...this.features],config:{}})}catch{}}getCapSlice(o){return this.runtimeState.getCapState(o.name)??null}setCapSlice(o,i){this.runtimeState.setCapState(o.name,i)}sliceProxy(o){const i={},c={get:(u,g)=>this.runtimeState.getCapState(o.name)?.[g],set:(u,g,f)=>(this.runtimeState.patchCapState(o.name,{[g]:f}),!0),has:(u,g)=>{const f=this.runtimeState.getCapState(o.name);return f?g in f:!1},ownKeys:()=>{const u=this.runtimeState.getCapState(o.name);return u?Object.keys(u):[]},getOwnPropertyDescriptor:(u,g)=>{const f=this.runtimeState.getCapState(o.name);if(!(!f||!(g in f)))return{configurable:!0,enumerable:!0,value:f[g]}}};return new Proxy(i,c)}getSettingsUISchema(){return{sections:[]}}async applySettingsPatch(o){await this.config.setAll(o)}async onProbe(){}async onActivate(){}async reprobe(){this._kernelReprobe?await this._kernelReprobe():await this.onProbe()}_kernelReprobe;getAccessoryChildren(){return[]}getProbeFlags(){return this.runtimeState.getCapState("feature-probe")?.flags??{}}hasProbed(){return(this.runtimeState.getCapState("feature-probe")?.lastProbedAt??0)>0}}function dl(s,o){const i={};for(const c of s.config.entries())i[c.key]=c.value;return{id:s.id,stableId:s.stableId,addonId:o,type:String(s.type),name:s.name,parentDeviceId:s.parentDeviceId,online:s.online,features:[...s.features],config:i}}class _u extends $c{async onInitialize(){return this.ctx.logger.info(`${this.providerName} Provider initialized`),[{capability:ri,provider:this}]}async onShutdown(){const o=await this.ctx.kernel.devices?.getAll()??[];for(const i of o)try{await this.ctx.kernel.devices?.decommission(i.id)}catch(c){this.ctx.logger.warn(`${this.providerName}: decommission failed`,{tags:{deviceId:i.id,stableId:i.stableId},meta:{error:c instanceof Error?c.message:String(c)}})}this.ctx.logger.info(`${this.providerName} Provider shut down`,{meta:{decommissionedCount:o.length}})}async start(){}async stop(){}async getStatus(){return{connected:!0,deviceCount:(await this.ctx.kernel.devices?.getAll()??[]).length}}async getDevices(){return(await this.ctx.kernel.devices?.getAll()??[]).map(i=>({id:i.stableId,name:i.name,type:String(i.type)}))}async supportsDiscovery(){return!1}async discoverDevices(){return[]}async adoptDiscoveredDevice(o){throw new Error(`${this.providerName} provider does not support discovery-based adoption`)}async supportsManualCreation(){return!0}async getChildCreationSchema(o){return this.onGetCreationSchema(o.type)}async createDevice(o){const i=await this.onCreateDevice(o.type,o.config),c=this.deviceClasses[i.meta.type];if(!c)throw new Error(`${this.providerName} provider: no device class registered for type "${i.meta.type}" — add it to the deviceClasses map`);const u=this.generateStableId(i.meta.type,i.config),g=await this.ctx.kernel.devices.create(u,c,i.config,null,i.meta);if(i.onAfterCreate)try{await i.onAfterCreate(g)}catch(f){this.ctx.logger.warn("createDevice: onAfterCreate hook threw — device is already registered",{tags:{deviceId:g.id,stableId:u},meta:{error:f instanceof Error?f.message:String(f)}})}return this.toSummary(g)}generateStableId(o,i){return`${this.addonId}-${Date.now()}`}async testCreationField(o){return{status:"ok",labels:["probe not implemented"]}}async restoreDevices(o){await this.onRestoreDevices(o),o.length>0&&this.ctx.logger.info(`Restored ${o.length} ${this.providerName} device(s)`)}async onRestoreDevices(o){const i=new Set;for(const u of o){if(u.parentDeviceId!==null)continue;const g=this.deviceClasses[u.type];if(!g){this.ctx.logger.warn("No device class registered for restored type — skipping",{tags:{stableId:u.stableId},meta:{type:u.type}});continue}try{await this.ctx.kernel.devices.create(u.stableId,g,{}),i.add(u.id)}catch(f){this.ctx.logger.warn("Failed to restore device",{tags:{stableId:u.stableId},meta:{type:u.type,error:f instanceof Error?f.message:String(f)}})}}const c=o.filter(u=>u.parentDeviceId!==null);for(const u of c){const g=this.deviceClasses[u.type];if(g&&u.parentDeviceId!==null&&i.has(u.parentDeviceId))try{await this.ctx.kernel.devices.create(u.stableId,g,{},u.parentDeviceId),i.add(u.id)}catch(f){this.ctx.logger.warn("Failed to restore hub-adopted child",{tags:{stableId:u.stableId,parentDeviceId:u.parentDeviceId},meta:{type:u.type,error:f instanceof Error?f.message:String(f)}})}}}toSummary(o){return dl(o,this.addonId)}}function le(s){return s.def}function Fu(s,o="Configuration",i="main"){const c=s.map(u=>cl(u.key,u.schema,u.description));return{sections:[{id:i,title:o,fields:c}]}}function cl(s,o,i){const c=Ce(o),u=gl(o),g=i??qi(s),f={key:s,label:g,description:i,default:u};return c instanceof Hi?ll(s,f):c instanceof $i?ul(c,f):c instanceof Wi?{...f,type:"boolean"}:c instanceof ji?pl(c,f):c instanceof Gi||c instanceof Vi?{...f,type:"textarea",rows:6,isJson:!0}:{...f,type:"text"}}function ll(s,o){const i=s.toLowerCase();return i.includes("password")||i.includes("secret")||i.includes("token")||i.includes("apikey")||i.includes("api_key")?{...o,type:"password",showToggle:!0}:{...o,type:"text"}}function ul(s,o){const i=s,c=i.minValue,u=i.maxValue,g=c!=null&&isFinite(c)?c:void 0,f=u!=null&&isFinite(u)?u:void 0,p=ml(s);return{...o,type:"number",...g!==void 0?{min:g}:{},...f!==void 0?{max:f}:{},...p!==void 0?{step:p}:{}}}function ml(s){const i=le(s).checks??[];for(const c of i)if(c._zod?.def?.check==="multiple_of"&&c._zod.def.value!==void 0)return c._zod.def.value}function pl(s,o){const i=s.options.map(u=>String(u));return{...o,type:"select",options:i.map(u=>({label:qi(u),value:u}))}}function Ce(s){return s instanceof $n||s instanceof Ki||s instanceof Zi?Ce(le(s).innerType):s}function gl(s){if(s instanceof $n)return le(s).defaultValue}function qi(s){return s.replace(/([A-Z])/g," $1").replace(/[_-]/g," ").replace(/^\w/,o=>o.toUpperCase()).trim()}const hl="device.state-changed";function Bi(s){const o=new Map,i=new Map;let c=null;const u=(p,h)=>`${p}:${h}`,g=()=>{c||s.live?.onEvent&&(c=s.live.onEvent.subscribe({category:hl},{onData:p=>{const h=p.data;if(!h||typeof h.deviceId!="number"||typeof h.capName!="string")return;const I=u(h.deviceId,h.capName);o.set(I,h.slice);const A=i.get(I);if(A)for(const C of A)try{C(h.slice)}catch{}}}))},f=()=>{c&&(i.size>0||(c.unsubscribe(),c=null))};return{read(p,h){return o.get(u(p,h))},async refresh(p,h){const I=await s.deviceState.getCapSlice.query({deviceId:p,capName:h}),A=u(p,h);o.set(A,I??void 0);const C=i.get(A);if(C)for(const P of C)try{P(I??void 0)}catch{}},watch(p,h,I){const A=u(p,h);let C=i.get(A);return C||(C=new Set,i.set(A,C)),C.add(I),g(),()=>{C.delete(I),C.size===0&&i.delete(A),f()}},async write(p,h,I){await s.deviceState.setCapSlice.mutate({deviceId:p,capName:h,slice:I})}}}function yl(s,o,i){const c=(u,g)=>`${u}:${g}`;return{read(u,g){return s.get(u)?.get(g)},async refresh(){},watch(u,g,f){const p=c(u,g);let h=o.get(p);return h||(h=new Set,o.set(p,h)),h.add(f),()=>{h.delete(f),h.size===0&&o.delete(p)}},async write(u,g,f){if(!i)throw new Error("createMirrorSource: write requires an api reference — pass it as the third argument when constructing the source");await i.deviceState.setCapSlice.mutate({deviceId:u,capName:g,slice:f})}}}function E(s,o,i){const c=fl(s)?s:Bi(s);return{get value(){return c.read(o,i)},refresh(){return c.refresh(o,i)},subscribe(u){const g=c.watch(o,i,f=>{try{u(f)}catch{}});try{u(c.read(o,i))}catch{}return c.read(o,i)===void 0&&c.refresh(o,i).catch(()=>{}),g},async set(u){await c.write(o,i,u)},async patch(u){const f={...c.read(o,i)??{},...u};await c.write(o,i,f)}}}function fl(s){return typeof s.read=="function"&&typeof s.watch=="function"}function vl(s,o,i){const c=s,u=i?.stateSource??Bi(s);function g(d,N){const L=typeof d=="object"&&d!==null?d:{};return N!==void 0?{...L,deviceId:o.deviceId,nodeId:N}:{...L,deviceId:o.deviceId}}function f(d,N,L,H,ie){const ye=c[d]?.[N];if(!ye)throw new Error(`DeviceProxy: api has no '${d}.${N}'`);const ae=ye;return L==="mutation"?ae.mutate(H):L==="subscription"?ae.subscribe(H,ie):ae.query(H)}function p(d,N,L,H,ie,ye){const ae=o.entries.find(_i=>_i.capName===d);return f(N,L,H,g(ie,ae?.providerNodeId),ye)}function h(d,N,L,H,ie){return f(d,N,L,g(H,void 0),ie)}const I={getStatus:d=>p("accessories","accessories","getStatus","query",d)},A={resolveDeviceSettings:d=>p("audio-analysis","audioAnalysis","resolveDeviceSettings","query",d),getDeviceSettingsContribution:d=>p("audio-analysis","audioAnalysis","getDeviceSettingsContribution","query",d),getDeviceLiveContribution:d=>p("audio-analysis","audioAnalysis","getDeviceLiveContribution","query",d),applyDeviceSettingsPatch:d=>p("audio-analysis","audioAnalysis","applyDeviceSettingsPatch","mutation",d)},C={getCurrentSnapshot:d=>p("audio-metrics","audioMetrics","getCurrentSnapshot","query",d),getHistory:d=>p("audio-metrics","audioMetrics","getHistory","query",d)},P={getStatus:d=>p("battery","battery","getStatus","query",d)},T={setBrightness:d=>p("brightness","brightness","setBrightness","mutation",d),getStatus:d=>p("brightness","brightness","getStatus","query",d)},O={getCredentials:d=>p("camera-credentials","cameraCredentials","getCredentials","query",d),getStatus:d=>p("camera-credentials","cameraCredentials","getStatus","query",d)},V={getCameraStreams:d=>p("camera-streams","cameraStreams","getCameraStreams","query",d),getBrokerStreams:d=>p("camera-streams","cameraStreams","getBrokerStreams","query",d),getRtspEntries:d=>p("camera-streams","cameraStreams","getRtspEntries","query",d)},ee={getDeviceSettingsContribution:d=>p("detection-pipeline","detectionPipeline","getDeviceSettingsContribution","query",d),getDeviceLiveContribution:d=>p("detection-pipeline","detectionPipeline","getDeviceLiveContribution","query",d),applyDeviceSettingsPatch:d=>p("detection-pipeline","detectionPipeline","applyDeviceSettingsPatch","mutation",d)},K={listDiscovered:d=>p("device-discovery","deviceDiscovery","listDiscovered","query",d),refreshDiscovery:d=>p("device-discovery","deviceDiscovery","refreshDiscovery","mutation",d),adoptDevice:d=>p("device-discovery","deviceDiscovery","adoptDevice","mutation",d),releaseDevice:d=>p("device-discovery","deviceDiscovery","releaseDevice","mutation",d),getStatus:d=>p("device-discovery","deviceDiscovery","getStatus","query",d)},Rt={getStreamSources:d=>p("device-ops","deviceOps","getStreamSources","query",d),getConfigEntries:d=>p("device-ops","deviceOps","getConfigEntries","query",d),setConfig:d=>p("device-ops","deviceOps","setConfig","mutation",d),removeDevice:d=>p("device-ops","deviceOps","removeDevice","mutation",d),getSettingsSchema:d=>p("device-ops","deviceOps","getSettingsSchema","query",d)},Et={getStatus:d=>p("device-status","deviceStatus","getStatus","query",d)},qt={getStatus:d=>p("doorbell","doorbell","getStatus","query",d)},Bt={getEvents:d=>p("events","events","getEvents","query",d),getEventThumbnail:d=>p("events","events","getEventThumbnail","query",d),getEventClipUrl:d=>p("events","events","getEventClipUrl","query",d)},xt={getStatus:d=>p("feature-probe","featureProbe","getStatus","query",d)},Ot={startSession:d=>p("intercom","intercom","startSession","mutation",d),handleAnswer:d=>p("intercom","intercom","handleAnswer","mutation",d),stopSession:d=>p("intercom","intercom","stopSession","mutation",d),getStatus:d=>p("intercom","intercom","getStatus","query",d)},Nt={isDetected:d=>p("motion","motion","isDetected","query",d),getStatus:d=>p("motion","motion","getStatus","query",d)},Lt={analyze:d=>p("motion-detection","motionDetection","analyze","mutation",d),removeCamera:d=>p("motion-detection","motionDetection","removeCamera","mutation",d),reset:d=>p("motion-detection","motionDetection","reset","mutation",d),getDeviceSettingsContribution:d=>p("motion-detection","motionDetection","getDeviceSettingsContribution","query",d),getDeviceLiveContribution:d=>p("motion-detection","motionDetection","getDeviceLiveContribution","query",d),applyDeviceSettingsPatch:d=>p("motion-detection","motionDetection","applyDeviceSettingsPatch","mutation",d)},zt={setMotionTrigger:d=>p("motion-trigger","motionTrigger","setMotionTrigger","mutation",d),getStatus:d=>p("motion-trigger","motionTrigger","getStatus","query",d)},_t={getStatus:d=>p("native-object-detection","nativeObjectDetection","getStatus","query",d)},Ft={setOverlay:d=>p("osd","osd","setOverlay","mutation",d),getStatus:d=>p("osd","osd","getStatus","query",d)},Ut={getActiveTracks:d=>p("pipeline-analytics","pipelineAnalytics","getActiveTracks","query",d),getTrack:d=>p("pipeline-analytics","pipelineAnalytics","getTrack","query",d),listTracks:d=>p("pipeline-analytics","pipelineAnalytics","listTracks","query",d),clearTracks:d=>p("pipeline-analytics","pipelineAnalytics","clearTracks","mutation",d),getMotionEvents:d=>p("pipeline-analytics","pipelineAnalytics","getMotionEvents","query",d),getObjectEvents:d=>p("pipeline-analytics","pipelineAnalytics","getObjectEvents","query",d),getAudioEvents:d=>p("pipeline-analytics","pipelineAnalytics","getAudioEvents","query",d),getEventMedia:d=>p("pipeline-analytics","pipelineAnalytics","getEventMedia","query",d),getTrackMedia:d=>p("pipeline-analytics","pipelineAnalytics","getTrackMedia","query",d),getDeviceSettingsContribution:d=>p("pipeline-analytics","pipelineAnalytics","getDeviceSettingsContribution","query",d),getDeviceLiveContribution:d=>p("pipeline-analytics","pipelineAnalytics","getDeviceLiveContribution","query",d),applyDeviceSettingsPatch:d=>p("pipeline-analytics","pipelineAnalytics","applyDeviceSettingsPatch","mutation",d)},Ht={move:d=>p("ptz","ptz","move","mutation",d),continuousMove:d=>p("ptz","ptz","continuousMove","mutation",d),stop:d=>p("ptz","ptz","stop","mutation",d),getPresets:d=>p("ptz","ptz","getPresets","query",d),goToPreset:d=>p("ptz","ptz","goToPreset","mutation",d),goHome:d=>p("ptz","ptz","goHome","mutation",d),getPosition:d=>p("ptz","ptz","getPosition","query",d),getStatus:d=>p("ptz","ptz","getStatus","query",d)},$t={getStatus:d=>p("ptz-autotrack","ptzAutotrack","getStatus","query",d),setEnabled:d=>p("ptz-autotrack","ptzAutotrack","setEnabled","mutation",d),getSettings:d=>p("ptz-autotrack","ptzAutotrack","getSettings","query",d),setSettings:d=>p("ptz-autotrack","ptzAutotrack","setSettings","mutation",d)},Wt={reboot:d=>p("reboot","reboot","reboot","mutation",d)},jt={getSegments:d=>p("recording","recording","getSegments","query",d),getPlaybackUrl:d=>p("recording","recording","getPlaybackUrl","query",d),getThumbnailAt:d=>p("recording","recording","getThumbnailAt","query",d)},Gt={getSnapshot:d=>p("snapshot","snapshot","getSnapshot","query",d),invalidateCache:d=>p("snapshot","snapshot","invalidateCache","mutation",d),getStatus:d=>p("snapshot","snapshot","getStatus","query",d),getDeviceSettingsContribution:d=>p("snapshot","snapshot","getDeviceSettingsContribution","query",d),getDeviceLiveContribution:d=>p("snapshot","snapshot","getDeviceLiveContribution","query",d),applyDeviceSettingsPatch:d=>p("snapshot","snapshot","applyDeviceSettingsPatch","mutation",d)},Vt={setState:d=>p("switch","switch","setState","mutation",d),getStatus:d=>p("switch","switch","getStatus","query",d)},Kt={listStreams:d=>p("webrtc-session","webrtcSession","listStreams","query",d),createSession:d=>p("webrtc-session","webrtcSession","createSession","mutation",d),handleAnswer:d=>p("webrtc-session","webrtcSession","handleAnswer","mutation",d),closeSession:d=>p("webrtc-session","webrtcSession","closeSession","mutation",d),hasAdaptiveBitrate:d=>p("webrtc-session","webrtcSession","hasAdaptiveBitrate","query",d)},Zt={getCurrentSnapshot:d=>p("zone-analytics","zoneAnalytics","getCurrentSnapshot","query",d),getZoneHistory:d=>p("zone-analytics","zoneAnalytics","getZoneHistory","query",d),getCameraHistory:d=>p("zone-analytics","zoneAnalytics","getCameraHistory","query",d),getUnzonedHistory:d=>p("zone-analytics","zoneAnalytics","getUnzonedHistory","query",d)},a={listRules:d=>p("zone-rules","zoneRules","listRules","query",d),setRules:d=>p("zone-rules","zoneRules","setRules","mutation",d)},F={listZones:d=>p("zones","zones","listZones","query",d),addZone:d=>p("zones","zones","addZone","mutation",d),removeZone:d=>p("zones","zones","removeZone","mutation",d),updateZone:d=>p("zones","zones","updateZone","mutation",d)},ge={getDeviceSettings:d=>h("addonSettings","getDeviceSettings","query",d),updateDeviceSettings:d=>h("addonSettings","updateDeviceSettings","mutation",d)},te={loadConfig:d=>h("deviceManager","loadConfig","query",d),loadRuntimeState:d=>h("deviceManager","loadRuntimeState","query",d),loadMeta:d=>h("deviceManager","loadMeta","query",d),setName:d=>h("deviceManager","setName","mutation",d),setLocation:d=>h("deviceManager","setLocation","mutation",d),setMetadata:d=>h("deviceManager","setMetadata","mutation",d),setDisabled:d=>h("deviceManager","setDisabled","mutation",d),getDevice:d=>h("deviceManager","getDevice","query",d),getStreamSources:d=>h("deviceManager","getStreamSources","query",d),getConfigSchema:d=>h("deviceManager","getConfigSchema","query",d),getSettingsSchema:d=>h("deviceManager","getSettingsSchema","query",d),updateConfig:d=>h("deviceManager","updateConfig","mutation",d),enable:d=>h("deviceManager","enable","mutation",d),disable:d=>h("deviceManager","disable","mutation",d),remove:d=>h("deviceManager","remove","mutation",d),getStreamProfileMap:d=>h("deviceManager","getStreamProfileMap","query",d),setStreamProfileMap:d=>h("deviceManager","setStreamProfileMap","mutation",d),probeStreams:d=>h("deviceManager","probeStreams","mutation",d),getBindings:d=>h("deviceManager","getBindings","query",d),getAllBindings:d=>h("deviceManager","getAllBindings","query",d),setWrapperActive:d=>h("deviceManager","setWrapperActive","mutation",d),getDeviceSettingsAggregate:d=>h("deviceManager","getDeviceSettingsAggregate","query",d),getDeviceLiveInfoAggregate:d=>h("deviceManager","getDeviceLiveInfoAggregate","query",d),getDeviceAggregate:d=>h("deviceManager","getDeviceAggregate","query",d),updateDeviceField:d=>h("deviceManager","updateDeviceField","mutation",d),updateDeviceFieldsBatch:d=>h("deviceManager","updateDeviceFieldsBatch","mutation",d),testField:d=>h("deviceManager","testField","mutation",d),getDeviceStatusAggregate:d=>h("deviceManager","getDeviceStatusAggregate","query",d)},Ee={getSnapshot:d=>h("deviceState","getSnapshot","query",d),getCapSlice:d=>h("deviceState","getCapSlice","query",d),setCapSlice:d=>h("deviceState","setCapSlice","mutation",d)},he={getDeviceStats:d=>h("networkQuality","getDeviceStats","query",d),reportClientStats:d=>h("networkQuality","reportClientStats","mutation",d)},ne={runPipeline:d=>h("pipelineExecutor","runPipeline","mutation",d),runPipelineBatch:d=>h("pipelineExecutor","runPipelineBatch","mutation",d)},xi={assignPipeline:d=>h("pipelineOrchestrator","assignPipeline","mutation",d),unassignPipeline:d=>h("pipelineOrchestrator","unassignPipeline","mutation",d),getPipelineAssignment:d=>h("pipelineOrchestrator","getPipelineAssignment","query",d),getCameraMetrics:d=>h("pipelineOrchestrator","getCameraMetrics","query",d),assignDecoder:d=>h("pipelineOrchestrator","assignDecoder","mutation",d),unassignDecoder:d=>h("pipelineOrchestrator","unassignDecoder","mutation",d),assignAudio:d=>h("pipelineOrchestrator","assignAudio","mutation",d),unassignAudio:d=>h("pipelineOrchestrator","unassignAudio","mutation",d),getAudioAssignment:d=>h("pipelineOrchestrator","getAudioAssignment","query",d),getAudioAssignments:d=>h("pipelineOrchestrator","getAudioAssignments","query",d),getDecoderAssignment:d=>h("pipelineOrchestrator","getDecoderAssignment","query",d),getCameraSettings:d=>h("pipelineOrchestrator","getCameraSettings","query",d),setCameraStepToggle:d=>h("pipelineOrchestrator","setCameraStepToggle","mutation",d),getCameraStepOverrides:d=>h("pipelineOrchestrator","getCameraStepOverrides","query",d),setCameraStepOverride:d=>h("pipelineOrchestrator","setCameraStepOverride","mutation",d),setCameraPipelineForAgent:d=>h("pipelineOrchestrator","setCameraPipelineForAgent","mutation",d),resolvePipeline:d=>h("pipelineOrchestrator","resolvePipeline","query",d),getDeviceSettingsContribution:d=>h("pipelineOrchestrator","getDeviceSettingsContribution","query",d),getDeviceLiveContribution:d=>h("pipelineOrchestrator","getDeviceLiveContribution","query",d),applyDeviceSettingsPatch:d=>h("pipelineOrchestrator","applyDeviceSettingsPatch","mutation",d)},Oi={detachCamera:d=>h("pipelineRunner","detachCamera","mutation",d),getCameraMetrics:d=>h("pipelineRunner","getCameraMetrics","query",d)},Ni={getPolicyStatus:d=>h("recordingEngine","getPolicyStatus","query",d)},Li={supportsDevice:d=>h("snapshotProvider","supportsDevice","query",d),getSnapshot:d=>h("snapshotProvider","getSnapshot","query",d)},zi={publishCameraStream:d=>h("streamBroker","publishCameraStream","mutation",d),retractCameraStream:d=>h("streamBroker","retractCameraStream","mutation",d),assignProfile:d=>h("streamBroker","assignProfile","mutation",d),unassignProfile:d=>h("streamBroker","unassignProfile","mutation",d),restartProfile:d=>h("streamBroker","restartProfile","mutation",d),getDeviceSettingsContribution:d=>h("streamBroker","getDeviceSettingsContribution","query",d),getDeviceLiveContribution:d=>h("streamBroker","getDeviceLiveContribution","query",d),applyDeviceSettingsPatch:d=>h("streamBroker","applyDeviceSettingsPatch","mutation",d)};return{deviceId:o.deviceId,binding:o,state:{audioMetrics:E(u,o.deviceId,"audio-metrics"),battery:E(u,o.deviceId,"battery"),brightness:E(u,o.deviceId,"brightness"),cameraStreams:E(u,o.deviceId,"camera-streams"),deviceDiscovery:E(u,o.deviceId,"device-discovery"),deviceStatus:E(u,o.deviceId,"device-status"),doorbell:E(u,o.deviceId,"doorbell"),featureProbe:E(u,o.deviceId,"feature-probe"),motion:E(u,o.deviceId,"motion"),motionTrigger:E(u,o.deviceId,"motion-trigger"),ptzAutotrack:E(u,o.deviceId,"ptz-autotrack"),switch:E(u,o.deviceId,"switch"),zoneAnalytics:E(u,o.deviceId,"zone-analytics"),zoneRules:E(u,o.deviceId,"zone-rules"),zones:E(u,o.deviceId,"zones")},accessories:I,audioAnalysis:A,audioMetrics:C,battery:P,brightness:T,cameraCredentials:O,cameraStreams:V,detectionPipeline:ee,deviceDiscovery:K,deviceOps:Rt,deviceStatus:Et,doorbell:qt,events:Bt,featureProbe:xt,intercom:Ot,motion:Nt,motionDetection:Lt,motionTrigger:zt,nativeObjectDetection:_t,osd:Ft,pipelineAnalytics:Ut,ptz:Ht,ptzAutotrack:$t,reboot:Wt,recording:jt,snapshot:Gt,switch:Vt,webrtcSession:Kt,zoneAnalytics:Zt,zoneRules:a,zones:F,addonSettings:ge,deviceManager:te,deviceState:Ee,networkQuality:he,pipelineExecutor:ne,pipelineOrchestrator:xi,pipelineRunner:Oi,recordingEngine:Ni,snapshotProvider:Li,streamBroker:zi}}function Uu(s,o,i,c,u){if(i.length===0||o.length===0)return{passed:s,excluded:[]};const g=i.filter(P=>P.enabled!==!1),f=g.filter(P=>P.mode==="include"),p=g.filter(P=>P.mode==="exclude"),h=f.length>0,I=new Map(o.map(P=>[P.id,P])),A=[],C=[];for(const P of s){const T=c(P),O=u?.(P),V=f.some(K=>Fn(K,T,O,I)),ee=p.some(K=>Fn(K,T,O,I));h?V&&!ee?A.push(P):C.push(P):ee?C.push(P):A.push(P)}return{passed:A,excluded:C}}function Fn(s,o,i,c){if(s.classFilter&&s.classFilter.length>0&&i!==void 0&&!s.classFilter.includes(i))return!1;for(const u of s.zoneIds){const g=c.get(u);if(g&&Sl(o,g.polygon))return!0}return!1}function Sl(s,o){if(o.length<3)return!1;let i=!1;const{x:c,y:u}=s;for(let g=0,f=o.length-1;g<o.length;f=g++){const p=o[g],h=o[f];p.y>u!=h.y>u&&c<(h.x-p.x)*(u-p.y)/(h.y-p.y||Number.EPSILON)+p.x&&(i=!i)}return i}function Hu(s){const o=s;function i(a,F,ge,te,Ee){const he=o[a]?.[F];if(!he)throw new Error(`SystemProxy: api has no '${a}.${F}'`);const ne=he;return ge==="mutation"?ne.mutate(te):ge==="subscription"?ne.subscribe(te,Ee):ne.query(te)}return{addonPages:{listPages:a=>i("addonPages","listPages","query",a)},addons:{list:a=>i("addons","list","query",a),getLogs:a=>i("addons","getLogs","query",a),listPackages:a=>i("addons","listPackages","query",a),installPackage:a=>i("addons","installPackage","mutation",a),installFromWorkspace:a=>i("addons","installFromWorkspace","mutation",a),isWorkspaceAvailable:a=>i("addons","isWorkspaceAvailable","query",a),listWorkspacePackages:a=>i("addons","listWorkspacePackages","query",a),uninstallPackage:a=>i("addons","uninstallPackage","mutation",a),reloadPackages:a=>i("addons","reloadPackages","mutation",a),searchAvailable:a=>i("addons","searchAvailable","query",a),listUpdates:a=>i("addons","listUpdates","query",a),updatePackage:a=>i("addons","updatePackage","mutation",a),rollbackPackage:a=>i("addons","rollbackPackage","mutation",a),forceRefresh:a=>i("addons","forceRefresh","mutation",a),restartServer:a=>i("addons","restartServer","mutation",a),getVersions:a=>i("addons","getVersions","query",a),restartAddon:a=>i("addons","restartAddon","mutation",a),retryLoad:a=>i("addons","retryLoad","mutation",a),getAutoUpdateSettings:a=>i("addons","getAutoUpdateSettings","query",a),setAutoUpdateSettings:a=>i("addons","setAutoUpdateSettings","mutation",a),getAddonAutoUpdate:a=>i("addons","getAddonAutoUpdate","query",a),setAddonAutoUpdate:a=>i("addons","setAddonAutoUpdate","mutation",a),applyAutoUpdateToAll:a=>i("addons","applyAutoUpdateToAll","mutation",a),custom:a=>i("addons","custom","mutation",a),onAddonLogs:(a,F)=>i("addons","onAddonLogs","subscription",a,F)},addonSettings:{getGlobalSettings:a=>i("addonSettings","getGlobalSettings","query",a),updateGlobalSettings:a=>i("addonSettings","updateGlobalSettings","mutation",a)},addonWidgets:{listWidgets:a=>i("addonWidgets","listWidgets","query",a)},alerts:{emit:a=>i("alerts","emit","mutation",a),update:a=>i("alerts","update","mutation",a),list:a=>i("alerts","list","query",a),getUnreadCount:a=>i("alerts","getUnreadCount","query",a),markRead:a=>i("alerts","markRead","mutation",a),markAllRead:a=>i("alerts","markAllRead","mutation",a),dismiss:a=>i("alerts","dismiss","mutation",a)},audioAnalyzer:{analyseChunk:a=>i("audioAnalyzer","analyseChunk","mutation",a),classify:a=>i("audioAnalyzer","classify","query",a),isReady:a=>i("audioAnalyzer","isReady","query",a),dispose:a=>i("audioAnalyzer","dispose","mutation",a),reprobeAudioEngine:a=>i("audioAnalyzer","reprobeAudioEngine","mutation",a)},audioCodec:{listSupportedCodecs:a=>i("audioCodec","listSupportedCodecs","query",a),canHandle:a=>i("audioCodec","canHandle","query",a),createDecodeSession:a=>i("audioCodec","createDecodeSession","mutation",a),createEncodeSession:a=>i("audioCodec","createEncodeSession","mutation",a),closeSession:a=>i("audioCodec","closeSession","mutation",a),pushEncodedFrame:a=>i("audioCodec","pushEncodedFrame","mutation",a),pullPcm:a=>i("audioCodec","pullPcm","query",a),pushPcm:a=>i("audioCodec","pushPcm","mutation",a),pullEncoded:a=>i("audioCodec","pullEncoded","query",a),flushEncode:a=>i("audioCodec","flushEncode","mutation",a),listActiveSessions:a=>i("audioCodec","listActiveSessions","query",a)},authentication:{listProviders:a=>i("authentication","listProviders","query",a),setProviderEnabled:a=>i("authentication","setProviderEnabled","mutation",a)},backup:{listDestinations:a=>i("backup","listDestinations","query",a),trigger:a=>i("backup","trigger","mutation",a),list:a=>i("backup","list","query",a),listLocations:a=>i("backup","listLocations","query",a),getEntries:a=>i("backup","getEntries","query",a),restore:a=>i("backup","restore","mutation",a),delete:a=>i("backup","delete","mutation",a),listArchives:a=>i("backup","listArchives","query",a),upsertDestinationPolicy:a=>i("backup","upsertDestinationPolicy","mutation",a),previewSchedule:a=>i("backup","previewSchedule","query",a)},decoder:{supportsCodec:a=>i("decoder","supportsCodec","query",a),getInfo:a=>i("decoder","getInfo","query",a),createSession:a=>i("decoder","createSession","query",a),destroySession:a=>i("decoder","destroySession","query",a),pushPacket:a=>i("decoder","pushPacket","query",a),openStream:a=>i("decoder","openStream","query",a),pullFrames:a=>i("decoder","pullFrames","query",a),updateConfig:a=>i("decoder","updateConfig","query",a),getStats:a=>i("decoder","getStats","query",a),listActiveSessions:a=>i("decoder","listActiveSessions","query",a),reprobeHwaccel:a=>i("decoder","reprobeHwaccel","mutation",a)},deviceManager:{allocateDeviceId:a=>i("deviceManager","allocateDeviceId","mutation",a),registerDevice:a=>i("deviceManager","registerDevice","mutation",a),removeDevice:a=>i("deviceManager","removeDevice","mutation",a),persistConfig:a=>i("deviceManager","persistConfig","mutation",a),listLocations:a=>i("deviceManager","listLocations","query",a),addLocation:a=>i("deviceManager","addLocation","mutation",a),removeLocation:a=>i("deviceManager","removeLocation","mutation",a),listPersistedByAddon:a=>i("deviceManager","listPersistedByAddon","query",a),listAll:a=>i("deviceManager","listAll","query",a),getChildren:a=>i("deviceManager","getChildren","query",a),listWrappersForCap:a=>i("deviceManager","listWrappersForCap","query",a),listBindableCapsForDeviceType:a=>i("deviceManager","listBindableCapsForDeviceType","query",a),discoverDevices:a=>i("deviceManager","discoverDevices","mutation",a),adoptDevice:a=>i("deviceManager","adoptDevice","mutation",a),getCreationSchema:a=>i("deviceManager","getCreationSchema","query",a),createDevice:a=>i("deviceManager","createDevice","mutation",a),testCreationField:a=>i("deviceManager","testCreationField","mutation",a)},deviceProvider:{start:a=>i("deviceProvider","start","mutation",a),stop:a=>i("deviceProvider","stop","mutation",a),getStatus:a=>i("deviceProvider","getStatus","query",a),getDevices:a=>i("deviceProvider","getDevices","query",a),supportsDiscovery:a=>i("deviceProvider","supportsDiscovery","query",a),discoverDevices:a=>i("deviceProvider","discoverDevices","mutation",a),adoptDiscoveredDevice:a=>i("deviceProvider","adoptDiscoveredDevice","mutation",a),supportsManualCreation:a=>i("deviceProvider","supportsManualCreation","query",a),getChildCreationSchema:a=>i("deviceProvider","getChildCreationSchema","query",a),createDevice:a=>i("deviceProvider","createDevice","mutation",a),testCreationField:a=>i("deviceProvider","testCreationField","mutation",a)},deviceState:{getAllSnapshots:a=>i("deviceState","getAllSnapshots","query",a)},integrations:{list:a=>i("integrations","list","query",a),get:a=>i("integrations","get","query",a),getByAddonId:a=>i("integrations","getByAddonId","query",a),create:a=>i("integrations","create","mutation",a),update:a=>i("integrations","update","mutation",a),delete:a=>i("integrations","delete","mutation",a),getSettings:a=>i("integrations","getSettings","query",a),setSettings:a=>i("integrations","setSettings","mutation",a),getAvailableTypes:a=>i("integrations","getAvailableTypes","query",a),testConnection:a=>i("integrations","testConnection","mutation",a)},localNetwork:{list:a=>i("localNetwork","list","query",a),getPreferred:a=>i("localNetwork","getPreferred","query",a),getConnectionEndpoints:a=>i("localNetwork","getConnectionEndpoints","query",a),getAllowedAddresses:a=>i("localNetwork","getAllowedAddresses","query",a),setAllowedAddresses:a=>i("localNetwork","setAllowedAddresses","mutation",a),resetAllowlistToBestMatch:a=>i("localNetwork","resetAllowlistToBestMatch","mutation",a)},meshNetwork:{getStatus:a=>i("meshNetwork","getStatus","query",a),join:a=>i("meshNetwork","join","mutation",a),leave:a=>i("meshNetwork","leave","mutation",a),listPeers:a=>i("meshNetwork","listPeers","query",a),setPublicIngress:a=>i("meshNetwork","setPublicIngress","mutation",a),setMeshIngress:a=>i("meshNetwork","setMeshIngress","mutation",a)},meshOrchestrator:{listProviders:a=>i("meshOrchestrator","listProviders","query",a),joinProvider:a=>i("meshOrchestrator","joinProvider","mutation",a),leaveProvider:a=>i("meshOrchestrator","leaveProvider","mutation",a)},metricsProvider:{collectSnapshot:a=>i("metricsProvider","collectSnapshot","query",a),getCached:a=>i("metricsProvider","getCached","query",a),getCurrent:a=>i("metricsProvider","getCurrent","query",a),getDiskSpace:a=>i("metricsProvider","getDiskSpace","query",a),getGpuInfo:a=>i("metricsProvider","getGpuInfo","query",a),getCpuTemperature:a=>i("metricsProvider","getCpuTemperature","query",a),getProcessStats:a=>i("metricsProvider","getProcessStats","query",a),listAddonInstances:a=>i("metricsProvider","listAddonInstances","query",a),getAddonStats:a=>i("metricsProvider","getAddonStats","query",a),listNodeProcesses:a=>i("metricsProvider","listNodeProcesses","query",a),killProcess:a=>i("metricsProvider","killProcess","mutation",a)},networkQuality:{getAllStats:a=>i("networkQuality","getAllStats","query",a)},nodes:{topology:a=>i("nodes","topology","query",a),deployAddon:a=>i("nodes","deployAddon","mutation",a),undeployAddon:a=>i("nodes","undeployAddon","mutation",a),restartAddon:a=>i("nodes","restartAddon","mutation",a),restartProcess:a=>i("nodes","restartProcess","mutation",a),restartNode:a=>i("nodes","restartNode","mutation",a),shutdownNode:a=>i("nodes","shutdownNode","mutation",a),renameNode:a=>i("nodes","renameNode","mutation",a),clusterAddonStatus:a=>i("nodes","clusterAddonStatus","query",a),setProcessLogLevel:a=>i("nodes","setProcessLogLevel","mutation",a),executeQuery:a=>i("nodes","executeQuery","mutation",a)},notificationOutput:{send:a=>i("notificationOutput","send","mutation",a),sendTest:a=>i("notificationOutput","sendTest","mutation",a)},pipelineExecutor:{getAvailableEngines:a=>i("pipelineExecutor","getAvailableEngines","query",a),getSelectedEngine:a=>i("pipelineExecutor","getSelectedEngine","query",a),getDefaultSteps:a=>i("pipelineExecutor","getDefaultSteps","query",a),reprobeEngine:a=>i("pipelineExecutor","reprobeEngine","mutation",a),getVideoPipelineSteps:a=>i("pipelineExecutor","getVideoPipelineSteps","query",a),setVideoPipelineSteps:a=>i("pipelineExecutor","setVideoPipelineSteps","mutation",a),getSchema:a=>i("pipelineExecutor","getSchema","query",a),getGlobalSteps:a=>i("pipelineExecutor","getGlobalSteps","query",a),getGlobalPipelineConfig:a=>i("pipelineExecutor","getGlobalPipelineConfig","query",a),getOrchestratorConfigSchema:a=>i("pipelineExecutor","getOrchestratorConfigSchema","query",a),listTemplates:a=>i("pipelineExecutor","listTemplates","query",a),saveTemplate:a=>i("pipelineExecutor","saveTemplate","mutation",a),updateTemplate:a=>i("pipelineExecutor","updateTemplate","mutation",a),deleteTemplate:a=>i("pipelineExecutor","deleteTemplate","mutation",a),getCapabilities:a=>i("pipelineExecutor","getCapabilities","query",a),getAddonModels:a=>i("pipelineExecutor","getAddonModels","query",a),downloadModel:a=>i("pipelineExecutor","downloadModel","mutation",a),deleteModel:a=>i("pipelineExecutor","deleteModel","mutation",a),detect:a=>i("pipelineExecutor","detect","query",a),cacheFrameInPool:a=>i("pipelineExecutor","cacheFrameInPool","mutation",a),inferCached:a=>i("pipelineExecutor","inferCached","mutation",a),uncacheFrame:a=>i("pipelineExecutor","uncacheFrame","mutation",a),getEffectiveTuning:a=>i("pipelineExecutor","getEffectiveTuning","query",a),listLoadedEngines:a=>i("pipelineExecutor","listLoadedEngines","query",a),spinEngine:a=>i("pipelineExecutor","spinEngine","mutation",a),killEngine:a=>i("pipelineExecutor","killEngine","mutation",a),listReferenceImages:a=>i("pipelineExecutor","listReferenceImages","query",a),getReferenceImage:a=>i("pipelineExecutor","getReferenceImage","query",a),getReferenceAudioFiles:a=>i("pipelineExecutor","getReferenceAudioFiles","query",a),getReferenceAudio:a=>i("pipelineExecutor","getReferenceAudio","query",a),getAudioCapabilities:a=>i("pipelineExecutor","getAudioCapabilities","query",a),runAudioTest:a=>i("pipelineExecutor","runAudioTest","mutation",a),getDetectionConfigSchema:a=>i("pipelineExecutor","getDetectionConfigSchema","query",a)},pipelineOrchestrator:{rebalance:a=>i("pipelineOrchestrator","rebalance","mutation",a),getPipelineAssignments:a=>i("pipelineOrchestrator","getPipelineAssignments","query",a),getAgentLoad:a=>i("pipelineOrchestrator","getAgentLoad","query",a),getGlobalMetrics:a=>i("pipelineOrchestrator","getGlobalMetrics","query",a),getCapabilityBindings:a=>i("pipelineOrchestrator","getCapabilityBindings","query",a),setCapabilityBinding:a=>i("pipelineOrchestrator","setCapabilityBinding","mutation",a),getDecoderAssignments:a=>i("pipelineOrchestrator","getDecoderAssignments","query",a),getAudioNodeLoad:a=>i("pipelineOrchestrator","getAudioNodeLoad","query",a),getAgentSettings:a=>i("pipelineOrchestrator","getAgentSettings","query",a),listAgentSettings:a=>i("pipelineOrchestrator","listAgentSettings","query",a),setAgentAddonDefaults:a=>i("pipelineOrchestrator","setAgentAddonDefaults","mutation",a),removeAgentSettings:a=>i("pipelineOrchestrator","removeAgentSettings","mutation",a),listTemplates:a=>i("pipelineOrchestrator","listTemplates","query",a),saveTemplate:a=>i("pipelineOrchestrator","saveTemplate","mutation",a),updateTemplate:a=>i("pipelineOrchestrator","updateTemplate","mutation",a),deleteTemplate:a=>i("pipelineOrchestrator","deleteTemplate","mutation",a)},pipelineRunner:{attachCamera:a=>i("pipelineRunner","attachCamera","mutation",a),reportMotion:a=>i("pipelineRunner","reportMotion","mutation",a),getLocalLoad:a=>i("pipelineRunner","getLocalLoad","query",a),getLocalMetrics:a=>i("pipelineRunner","getLocalMetrics","query",a),getAllCameraMetrics:a=>i("pipelineRunner","getAllCameraMetrics","query",a),getLocalCameras:a=>i("pipelineRunner","getLocalCameras","query",a)},platformProbe:{getCapabilities:a=>i("platformProbe","getCapabilities","query",a),getHardware:a=>i("platformProbe","getHardware","query",a),resolveInferenceConfig:a=>i("platformProbe","resolveInferenceConfig","query",a),resolveHwAccel:a=>i("platformProbe","resolveHwAccel","query",a)},recordingEngine:{getStatus:a=>i("recordingEngine","getStatus","query",a),enable:a=>i("recordingEngine","enable","mutation",a),disable:a=>i("recordingEngine","disable","mutation",a),getConfig:a=>i("recordingEngine","getConfig","query",a),updateConfig:a=>i("recordingEngine","updateConfig","mutation",a),getPlaylist:a=>i("recordingEngine","getPlaylist","query",a),getThumbnail:a=>i("recordingEngine","getThumbnail","query",a),getSegments:a=>i("recordingEngine","getSegments","query",a),getAvailability:a=>i("recordingEngine","getAvailability","query",a),estimateStorage:a=>i("recordingEngine","estimateStorage","query",a),estimateGlobalStorage:a=>i("recordingEngine","estimateGlobalStorage","query",a),getStorageUsage:a=>i("recordingEngine","getStorageUsage","query",a),setPolicy:a=>i("recordingEngine","setPolicy","mutation",a),getPolicy:a=>i("recordingEngine","getPolicy","query",a),getRetentionConfig:a=>i("recordingEngine","getRetentionConfig","query",a),updateRetentionConfig:a=>i("recordingEngine","updateRetentionConfig","mutation",a),getMotionStats:a=>i("recordingEngine","getMotionStats","query",a)},remoteAccess:{listProviders:a=>i("remoteAccess","listProviders","query",a),startProvider:a=>i("remoteAccess","startProvider","mutation",a),stopProvider:a=>i("remoteAccess","stopProvider","mutation",a)},settingsStore:{get:a=>i("settingsStore","get","query",a),set:a=>i("settingsStore","set","mutation",a),query:a=>i("settingsStore","query","query",a),insert:a=>i("settingsStore","insert","mutation",a),update:a=>i("settingsStore","update","mutation",a),delete:a=>i("settingsStore","delete","mutation",a),count:a=>i("settingsStore","count","query",a),isEmpty:a=>i("settingsStore","isEmpty","query",a),declareCollection:a=>i("settingsStore","declareCollection","mutation",a)},storage:{resolve:a=>i("storage","resolve","query",a),write:a=>i("storage","write","mutation",a),read:a=>i("storage","read","query",a),exists:a=>i("storage","exists","query",a),list:a=>i("storage","list","query",a),delete:a=>i("storage","delete","mutation",a),getAvailableSpace:a=>i("storage","getAvailableSpace","query",a),beginUpload:a=>i("storage","beginUpload","mutation",a),writeChunk:a=>i("storage","writeChunk","mutation",a),finalizeUpload:a=>i("storage","finalizeUpload","mutation",a),abortUpload:a=>i("storage","abortUpload","mutation",a),beginDownload:a=>i("storage","beginDownload","mutation",a),readChunk:a=>i("storage","readChunk","query",a),endDownload:a=>i("storage","endDownload","mutation",a),listLocations:a=>i("storage","listLocations","query",a),getDefaultLocation:a=>i("storage","getDefaultLocation","query",a),upsertLocation:a=>i("storage","upsertLocation","mutation",a),deleteLocation:a=>i("storage","deleteLocation","mutation",a),testLocation:a=>i("storage","testLocation","query",a),listProviders:a=>i("storage","listProviders","query",a),testConfig:a=>i("storage","testConfig","query",a)},streamBroker:{listAllCameraStreams:a=>i("streamBroker","listAllCameraStreams","query",a),listAllProfileSlots:a=>i("streamBroker","listAllProfileSlots","query",a),getBrokerStats:a=>i("streamBroker","getBrokerStats","query",a),listClients:a=>i("streamBroker","listClients","query",a),killClient:a=>i("streamBroker","killClient","mutation",a),getStreamUrl:a=>i("streamBroker","getStreamUrl","query",a),getBroker:a=>i("streamBroker","getBroker","query",a),setPreBufferDuration:a=>i("streamBroker","setPreBufferDuration","mutation",a),getPreBufferInfo:a=>i("streamBroker","getPreBufferInfo","query",a),getRtspPort:a=>i("streamBroker","getRtspPort","query",a),getAllRtspEntries:a=>i("streamBroker","getAllRtspEntries","query",a),getRtspEntry:a=>i("streamBroker","getRtspEntry","query",a),regenerateRtspToken:a=>i("streamBroker","regenerateRtspToken","mutation",a),setRtspEnabled:a=>i("streamBroker","setRtspEnabled","mutation",a),isRtspEnabled:a=>i("streamBroker","isRtspEnabled","query",a)},system:{info:a=>i("system","info","query",a),health:a=>i("system","health","query",a),featureFlags:a=>i("system","featureFlags","query",a),networkAddresses:a=>i("system","networkAddresses","query",a),getRetentionConfig:a=>i("system","getRetentionConfig","query",a),setRetentionConfig:a=>i("system","setRetentionConfig","mutation",a),forceRetentionCleanup:a=>i("system","forceRetentionCleanup","mutation",a)},toast:{onToast:(a,F)=>i("toast","onToast","subscription",a,F)},turnOrchestrator:{listProviders:a=>i("turnOrchestrator","listProviders","query",a),getAllServers:a=>i("turnOrchestrator","getAllServers","query",a),setProviderEnabled:a=>i("turnOrchestrator","setProviderEnabled","mutation",a)},turnProvider:{getTurnServers:a=>i("turnProvider","getTurnServers","query",a)},userManagement:{listUsers:a=>i("userManagement","listUsers","query",a),createUser:a=>i("userManagement","createUser","mutation",a),updateUser:a=>i("userManagement","updateUser","mutation",a),deleteUser:a=>i("userManagement","deleteUser","mutation",a),resetPassword:a=>i("userManagement","resetPassword","mutation",a),validateCredentials:a=>i("userManagement","validateCredentials","mutation",a),listApiKeys:a=>i("userManagement","listApiKeys","query",a),createApiKey:a=>i("userManagement","createApiKey","mutation",a),revokeApiKey:a=>i("userManagement","revokeApiKey","mutation",a),validateApiKey:a=>i("userManagement","validateApiKey","mutation",a),createScopedToken:a=>i("userManagement","createScopedToken","mutation",a),revokeScopedToken:a=>i("userManagement","revokeScopedToken","mutation",a),validateScopedToken:a=>i("userManagement","validateScopedToken","query",a),listScopedTokens:a=>i("userManagement","listScopedTokens","query",a)}}}const bl="device.state-changed",Il="capability.binding-changed",kl="device.registered",Al="device.unregistered",Cl="device.updated";class $u{constructor(o){this.api=o,this.stateSource=yl(this.stateMirror,this.handleListeners,this.api)}stateMirror=new Map;bindings=new Map;devices=new Map;handleListeners=new Map;globalStateListeners=new Set;capListeners=new Map;deviceListeners=new Map;addedListeners=new Set;removedListeners=new Set;pendingWaits=new Set;stateSource;bridges=[];initialized=!1;initPromise=null;async init(o=15e3){if(!this.initialized){if(this.initPromise)return this.initPromise;this.initPromise=(async()=>{const i=(f,p)=>Number.isFinite(o)?new Promise((h,I)=>{const A=setTimeout(()=>I(new Error(`SystemMirror.init: '${p}' timed out after ${o}ms`)),o);f.then(C=>{clearTimeout(A),h(C)},C=>{clearTimeout(A),I(C)})}):f,[c,u,g]=await Promise.all([i(this.api.deviceManager.getAllBindings.query({}),"deviceManager.getAllBindings"),i(this.api.deviceState.getAllSnapshots.query({}),"deviceState.getAllSnapshots"),i(this.api.deviceManager.listAll.query({}),"deviceManager.listAll")]);for(const f of c)this.bindings.set(f.deviceId,f);for(const[f,p]of Object.entries(u)){const h=Number(f);if(!Number.isFinite(h))continue;const I=new Map;for(const[A,C]of Object.entries(p))I.set(A,C);this.stateMirror.set(h,I)}for(const f of g)this.devices.set(f.id,f);try{this.subscribeBus()}catch{}this.initialized=!0})();try{await this.initPromise}finally{this.initPromise=null}}}isReady(){return this.initialized}async awaitReady(){if(!this.initialized)return this.initPromise?this.initPromise:this.init()}dispose(){for(const o of this.bridges)try{o.unsubscribe()}catch{}this.bridges=[],this.handleListeners.clear(),this.globalStateListeners.clear(),this.capListeners.clear(),this.deviceListeners.clear(),this.addedListeners.clear(),this.removedListeners.clear(),this.pendingWaits.clear(),this.initialized=!1}getDeviceById(o){const i=this.bindings.get(o);return i?vl(this.api,i,{stateSource:this.stateSource}):null}getDeviceByName(o){for(const i of this.devices.values())if(i.name===o)return this.getDeviceById(i.id);return null}getDeviceByStableId(o){for(const i of this.devices.values())if(i.stableId===o)return this.getDeviceById(i.id);return null}getDevicesByAddon(o){return this.query({addonId:o})}getDevicesByType(o){return this.query({type:o})}getDeviceInfo(o){return this.devices.get(o)??null}getAllDevices(){const o=[];for(const i of this.bindings.keys()){const c=this.getDeviceById(i);c&&o.push(c)}return o}filterByCap(o){return this.query({caps:o})}query(o={}){const i=[];for(const[c,u]of this.bindings){const g=this.devices.get(c);if(o.id!==void 0&&!ve(c,o.id)||o.stableId!==void 0&&(!g||!ve(g.stableId,o.stableId))||o.addonId!==void 0&&(!g||!ve(g.addonId,o.addonId))||o.type!==void 0&&(!g||!ve(g.type,o.type)))continue;if(o.caps!==void 0){const p=Qe(o.caps),h=new Set(u.entries.map(I=>I.capName));if(!p.every(I=>h.has(I)))continue}if(o.anyCap!==void 0){const p=Qe(o.anyCap),h=new Set(u.entries.map(I=>I.capName));if(!p.some(I=>h.has(I)))continue}if(o.name!==void 0&&(!g||!wl(g.name,o.name))||o.online!==void 0&&(!g||g.online!==o.online))continue;if(o.parentDeviceId!==void 0){if(!g)continue;const p=o.parentDeviceId;if((g.parentDeviceId??null)!==p)continue}if(o.feature!==void 0&&(!g||!Qe(o.feature).every(h=>g.features.includes(h)))||o.isCamera!==void 0&&(!g||g.isCamera!==o.isCamera))continue;const f=this.getDeviceById(c);if(f){if(o.where&&g){if(!o.where(g,f))continue}else if(o.where&&!g)continue;i.push(f)}}return i}whereState(o,i){const c=[];for(const[u,g]of this.stateMirror){const f=g.get(o);if(!f||!i(f,u))continue;const p=this.getDeviceById(u);p&&c.push(p)}return c}mapState(o,i){const c=[];for(const[u,g]of this.stateMirror){const f=g.get(o);f&&c.push(i(f,u))}return c}findState(o,i){for(const[c,u]of this.stateMirror){const g=u.get(o);if(g&&i(g,c))return this.getDeviceById(c)}return null}countByCap(o){let i=0;for(const c of this.bindings.values())c.entries.some(u=>u.capName===o)&&i++;return i}countByState(o,i){let c=0;for(const[u,g]of this.stateMirror){const f=g.get(o);f&&i(f,u)&&c++}return c}listen(o){return this.globalStateListeners.add(o),()=>{this.globalStateListeners.delete(o)}}listenCap(o,i){let c=this.capListeners.get(o);return c||(c=new Set,this.capListeners.set(o,c)),c.add(i),()=>{c.delete(i),c.size===0&&this.capListeners.delete(o)}}listenDevice(o,i){let c=this.deviceListeners.get(o);return c||(c=new Set,this.deviceListeners.set(o,c)),c.add(i),()=>{c.delete(i),c.size===0&&this.deviceListeners.delete(o)}}onDeviceAdded(o){return this.addedListeners.add(o),()=>{this.addedListeners.delete(o)}}onDeviceRemoved(o){return this.removedListeners.add(o),()=>{this.removedListeners.delete(o)}}waitForState(o,i,c,u=3e4){return new Promise((g,f)=>{const h=(()=>{const C=this.stateMirror.get(o)?.get(i);return C&&c(C)?C:null})();if(h){g(h);return}let I=null;const A=this.listenDevice(o,(C,P,T)=>{P===i&&T&&c(T)&&(I&&clearTimeout(I),A(),g(T))});Number.isFinite(u)&&(I=setTimeout(()=>{A(),f(new Error(`waitForState timed out after ${u}ms (deviceId=${o}, capName=${i})`))},u))})}waitForDevice(o,i=3e4){return new Promise((c,u)=>{const g=this.getDeviceById(o);if(g){c(g);return}let f=null;const p=this.onDeviceAdded(h=>{if(h!==o)return;const I=this.getDeviceById(h);I&&(f&&clearTimeout(f),p(),c(I))});Number.isFinite(i)&&(f=setTimeout(()=>{p(),u(new Error(`waitForDevice timed out after ${i}ms (deviceId=${o})`))},i))})}async forEachCap(o,i){for(const c of this.filterByCap(o))await i(c)}async invokeCap(o,i,c,u={}){const g=this.filterByCap(o),f=Math.max(1,u.parallelism??g.length),p=[];for(let h=0;h<g.length;h+=f){const I=g.slice(h,h+f),A=await Promise.allSettled(I.map(async C=>{const P=C[o];if(!P||typeof P[i]!="function")throw new Error(`device '${C.deviceId}' does not expose '${o}.${i}'`);return await P[i](c)}));for(let C=0;C<A.length;C++){const P=I[C],T=A[C];T.status==="fulfilled"?p.push({deviceId:P.deviceId,ok:!0,result:T.value}):p.push({deviceId:P.deviceId,ok:!1,error:T.reason})}}return p}summary(){const o={},i={},c={};let u=0,g=0;for(const f of this.bindings.values())for(const p of f.entries)o[p.capName]=(o[p.capName]??0)+1;for(const f of this.devices.values())i[f.addonId]=(i[f.addonId]??0)+1,c[f.type]=(c[f.type]??0)+1,f.online?u++:g++;return{totalDevices:this.bindings.size,online:u,offline:g,byCap:o,byAddon:i,byType:c,statedDevices:this.stateMirror.size}}dump(o){const i=u=>{const g=this.devices.get(u)??null,f=this.bindings.get(u)??null,p={},h=this.stateMirror.get(u);if(h)for(const[I,A]of h)p[I]={...A};return{deviceId:u,info:g,binding:f?{...f,entries:f.entries.map(I=>({...I}))}:null,state:p}};if(o!==void 0)return i(o);const c=[];for(const u of this.bindings.keys())c.push(i(u));return c}getRawMirror(){return this.stateMirror}getSystemState(){const o=new Map;for(const[i,c]of this.stateMirror){const u=new Map;for(const[g,f]of c)u.set(g,{...f});o.set(i,u)}return o}subscribeBus(){if(!this.api.live?.onEvent)return;const o=this.api.live.onEvent;this.bridges.push(o.subscribe({category:bl},{onData:i=>{const c=i.data;!c||typeof c.deviceId!="number"||typeof c.capName!="string"||this.applyStateUpdate(c.deviceId,c.capName,c.slice)}})),this.bridges.push(o.subscribe({category:Il},{onData:i=>{const c=i.data,u=typeof c?.deviceId=="number"?c.deviceId:c?.source?.type==="device"&&typeof c.source.id=="number"?c.source.id:null;u!==null&&this.refreshBinding(u)}})),this.bridges.push(o.subscribe({category:kl},{onData:i=>{const c=i.data;typeof c?.deviceId=="number"&&this.refreshDeviceMetadata(c.deviceId,"added")}})),this.bridges.push(o.subscribe({category:Al},{onData:i=>{const c=i.data;typeof c?.deviceId=="number"&&this.applyDeviceRemoval(c.deviceId)}})),this.bridges.push(o.subscribe({category:Cl},{onData:i=>{const c=i.data;typeof c?.deviceId=="number"&&this.refreshDeviceMetadata(c.deviceId,"updated")}}))}applyStateUpdate(o,i,c){let u=this.stateMirror.get(o);u||(u=new Map,this.stateMirror.set(o,u)),c===void 0?u.delete(i):u.set(i,c);const g=`${o}:${i}`,f=this.handleListeners.get(g);if(f)for(const I of f)try{I(c)}catch{}for(const I of this.globalStateListeners)try{I(o,i,c)}catch{}const p=this.capListeners.get(i);if(p)for(const I of p)try{I(o,c)}catch{}const h=this.deviceListeners.get(o);if(h)for(const I of h)try{I(o,i,c)}catch{}}applyDeviceRemoval(o){const i=this.devices.get(o)??null;this.bindings.delete(o),this.devices.delete(o),this.stateMirror.delete(o);for(const c of this.removedListeners)try{c(o,i)}catch{}}async refreshBinding(o){try{const c=(await this.api.deviceManager.getAllBindings.query({})).find(u=>u.deviceId===o);c?this.bindings.set(o,c):this.applyDeviceRemoval(o)}catch{}}async refreshDeviceMetadata(o,i){try{const u=(await this.api.deviceManager.listAll.query({})).find(f=>f.id===o);if(!u)return;const g=!this.devices.has(o);if(this.devices.set(o,u),i==="added"&&g){await this.refreshBinding(o);for(const f of this.addedListeners)try{f(o,u)}catch{}}}catch{}}}function ve(s,o){return Array.isArray(o)?o.includes(s):s===o}function Qe(s){return Array.isArray(s)?s:[s]}function wl(s,o){return typeof o=="string"?s===o:o instanceof RegExp?o.test(s):"exact"in o?s===o.exact:"contains"in o?s.toLowerCase().includes(o.contains.toLowerCase()):!1}function Wu(s){return s}function ju(s,o,i){return{input:s,output:o,kind:i?.kind??"query",auth:i?.auth??"protected",scope:i?.scope??{kind:"system"}}}const Gu={accessories:"accessories",addonPages:"addon-pages",addonPagesSource:"addon-pages-source",addonRoutes:"addon-routes",addonSettings:"addon-settings",addonWidgets:"addon-widgets",addonWidgetsSource:"addon-widgets-source",addons:"addons",adminUi:"admin-ui",advancedNotifier:"advanced-notifier",alerts:"alerts",audioAnalysis:"audio-analysis",audioAnalyzer:"audio-analyzer",audioCodec:"audio-codec",audioMetrics:"audio-metrics",authProvider:"auth-provider",authentication:"authentication",backup:"backup",battery:"battery",brightness:"brightness",cameraCredentials:"camera-credentials",cameraStreams:"camera-streams",decoder:"decoder",detectionPipeline:"detection-pipeline",deviceDiscovery:"device-discovery",deviceManager:"device-manager",deviceOps:"device-ops",deviceProvider:"device-provider",deviceState:"device-state",deviceStatus:"device-status",doorbell:"doorbell",embeddingEncoder:"embedding-encoder",events:"events",featureProbe:"feature-probe",integrations:"integrations",intercom:"intercom",localNetwork:"local-network",logDestination:"log-destination",meshNetwork:"mesh-network",meshOrchestrator:"mesh-orchestrator",metricsProvider:"metrics-provider",motion:"motion",motionDetection:"motion-detection",motionTrigger:"motion-trigger",nativeObjectDetection:"native-object-detection",networkAccess:"network-access",networkQuality:"network-quality",nodes:"nodes",notificationOutput:"notification-output",osd:"osd",pipelineAnalytics:"pipeline-analytics",pipelineExecutor:"pipeline-executor",pipelineOrchestrator:"pipeline-orchestrator",pipelineRunner:"pipeline-runner",platformProbe:"platform-probe",ptz:"ptz",ptzAutotrack:"ptz-autotrack",reboot:"reboot",recording:"recording",recordingEngine:"recording-engine",remoteAccess:"remote-access",restreamer:"restreamer",settingsStore:"settings-store",snapshot:"snapshot",snapshotProvider:"snapshot-provider",storage:"storage",storageProvider:"storage-provider",streamBroker:"stream-broker",streamingEngine:"streaming-engine",switch:"switch",system:"system",toast:"toast",turnOrchestrator:"turn-orchestrator",turnProvider:"turn-provider",userManagement:"user-management",webrtc:"webrtc",webrtcSession:"webrtc-session",zoneAnalytics:"zone-analytics",zoneRules:"zone-rules",zones:"zones"},Vu=[{key:"accessories",name:"accessories"},{key:"addonPages",name:"addon-pages"},{key:"addonPagesSource",name:"addon-pages-source"},{key:"addonRoutes",name:"addon-routes"},{key:"addonSettings",name:"addon-settings"},{key:"addonWidgets",name:"addon-widgets"},{key:"addonWidgetsSource",name:"addon-widgets-source"},{key:"addons",name:"addons"},{key:"adminUi",name:"admin-ui"},{key:"advancedNotifier",name:"advanced-notifier"},{key:"alerts",name:"alerts"},{key:"audioAnalysis",name:"audio-analysis"},{key:"audioAnalyzer",name:"audio-analyzer"},{key:"audioCodec",name:"audio-codec"},{key:"audioMetrics",name:"audio-metrics"},{key:"authProvider",name:"auth-provider"},{key:"authentication",name:"authentication"},{key:"backup",name:"backup"},{key:"battery",name:"battery"},{key:"brightness",name:"brightness"},{key:"cameraCredentials",name:"camera-credentials"},{key:"cameraStreams",name:"camera-streams"},{key:"decoder",name:"decoder"},{key:"detectionPipeline",name:"detection-pipeline"},{key:"deviceDiscovery",name:"device-discovery"},{key:"deviceManager",name:"device-manager"},{key:"deviceOps",name:"device-ops"},{key:"deviceProvider",name:"device-provider"},{key:"deviceState",name:"device-state"},{key:"deviceStatus",name:"device-status"},{key:"doorbell",name:"doorbell"},{key:"embeddingEncoder",name:"embedding-encoder"},{key:"events",name:"events"},{key:"featureProbe",name:"feature-probe"},{key:"integrations",name:"integrations"},{key:"intercom",name:"intercom"},{key:"localNetwork",name:"local-network"},{key:"logDestination",name:"log-destination"},{key:"meshNetwork",name:"mesh-network"},{key:"meshOrchestrator",name:"mesh-orchestrator"},{key:"metricsProvider",name:"metrics-provider"},{key:"motion",name:"motion"},{key:"motionDetection",name:"motion-detection"},{key:"motionTrigger",name:"motion-trigger"},{key:"nativeObjectDetection",name:"native-object-detection"},{key:"networkAccess",name:"network-access"},{key:"networkQuality",name:"network-quality"},{key:"nodes",name:"nodes"},{key:"notificationOutput",name:"notification-output"},{key:"osd",name:"osd"},{key:"pipelineAnalytics",name:"pipeline-analytics"},{key:"pipelineExecutor",name:"pipeline-executor"},{key:"pipelineOrchestrator",name:"pipeline-orchestrator"},{key:"pipelineRunner",name:"pipeline-runner"},{key:"platformProbe",name:"platform-probe"},{key:"ptz",name:"ptz"},{key:"ptzAutotrack",name:"ptz-autotrack"},{key:"reboot",name:"reboot"},{key:"recording",name:"recording"},{key:"recordingEngine",name:"recording-engine"},{key:"remoteAccess",name:"remote-access"},{key:"restreamer",name:"restreamer"},{key:"settingsStore",name:"settings-store"},{key:"snapshot",name:"snapshot"},{key:"snapshotProvider",name:"snapshot-provider"},{key:"storage",name:"storage"},{key:"storageProvider",name:"storage-provider"},{key:"streamBroker",name:"stream-broker"},{key:"streamingEngine",name:"streaming-engine"},{key:"switch",name:"switch"},{key:"system",name:"system"},{key:"toast",name:"toast"},{key:"turnOrchestrator",name:"turn-orchestrator"},{key:"turnProvider",name:"turn-provider"},{key:"userManagement",name:"user-management"},{key:"webrtc",name:"webrtc"},{key:"webrtcSession",name:"webrtc-session"},{key:"zoneAnalytics",name:"zone-analytics"},{key:"zoneRules",name:"zone-rules"},{key:"zones",name:"zones"}],Ku=[hd,is,os,us,wo,cs,rs,Lc,es,cr,To,Ms,Ds,xs,jn,Vs,Zs,Zo,Gn,Vn,dd,Zn,ms,Mr,Yn,js,od,ri,Gs,It,Qn,Ns,ed,kt,Ic,fd,Nd,Xo,Hd,jd,Yr,ei,Oa,ni,Sd,Qs,ac,hc,rr,pd,zr,ao,As,mo,Rd,Jr,ii,cd,nd,Dr,Xs,hs,Jo,ar,or,Ro,Ho,Ma,Aa,ai,tc,sc,nr,er,Jd,ys,vs,oi,si,Jn],Zu=["accessories","battery","brightness","camera-credentials","device-discovery","device-status","doorbell","feature-probe","intercom","motion","motion-trigger","native-object-detection","osd","ptz","ptz-autotrack","snapshot","switch"];function Yu(s){try{const o=new URL(s);return!o.username&&!o.password?s:(o.username="",o.password="",o.toString())}catch{return s}}class Qu{constructor(o){this.capacity=o,this.items=Array.from({length:o})}items;head=0;tail=0;count=0;get size(){return this.count}push(o){this.items[this.tail]=o,this.tail=(this.tail+1)%this.capacity,this.count<this.capacity?this.count++:this.head=(this.head+1)%this.capacity}drain(o){const i=[],c=Math.min(o,this.count);for(let u=0;u<c;u++)i.push(this.items[this.head]),this.items[this.head]=void 0,this.head=(this.head+1)%this.capacity;return this.count-=c,i}}function Ju(s,o,i){const c={};for(const u of Object.keys(i))c[u]=g=>s.addons.custom.mutate({addonId:o,action:u,input:g});return c}export{El as ACCESSORY_LABEL,Ku as ALL_CAPABILITY_DEFINITIONS,aa as APPLE_SA_TO_MACRO,Wl as AUDIO_BACKEND_CHOICES,na as AUDIO_MACRO_LABELS,gd as AccessoriesStatusSchema,U as AccessoryKind,Ec as AddonAutoUpdateSchema,wc as AddonListItemSchema,as as AddonPageDeclarationSchema,ns as AddonPageInfoSchema,bs as AgentLoadSummarySchema,ze as AlertSchema,Po as AlertSeveritySchema,Mo as AlertSourceSchema,Do as AlertStatusSchema,Kl as ApiKeyRecordSchema,yt as ApiKeySummarySchema,Go as ArchiveEntrySchema,Vo as ArchiveManifestSchema,Cs as AudioAnalysisResultSchema,ws as AudioAnalysisSettingsSchema,an as AudioChunkInputSchema,ga as AudioClassSummarySchema,at as AudioClassificationLabelSchema,Ps as AudioClassificationResultSchema,Ts as AudioCodecInfoSchema,Rs as AudioDecodeSessionConfigSchema,Es as AudioEncodeSessionConfigSchema,bn as AudioEncodedChunkSchema,Br as AudioEventSchema,Ba as AudioLevelSchema,ha as AudioMetricsHistoryPointSchema,ya as AudioMetricsHistorySchema,Xt as AudioMetricsSnapshotSchema,qs as AudioPcmChunkSchema,Ks as AuthProviderInfoSchema,Ue as AuthResultSchema,Rc as AutoUpdateSettingsSchema,yc as AvailableIntegrationTypeSchema,Ei as BACKEND_TO_FORMAT,ra as BATTERY_DEVICE_PROFILE,Wo as BackupDestinationInfoSchema,mn as BackupEntrySchema,$c as BaseAddon,zu as BaseDevice,_u as BaseDeviceProvider,xe as BatteryStatusSchema,X as BoundingBoxSchema,en as BrightnessStatusSchema,Pa as BrokerAudioClientSchema,Da as BrokerClientsSchema,wa as BrokerDecodedClientSchema,Ca as BrokerRtspClientSchema,Ia as BrokerStatsSchema,ba as BrokerStatusSchema,Ol as CAM_PROFILE_ORDER,Gu as CAPABILITY_NAMES,Vu as CAPABILITY_ROUTER_KEYS,Zu as CAP_NAMES_WITH_STATUS,Bu as COCO_80_LABELS,Ou as COCO_TO_MACRO,$ as CamProfileSchema,Kn as CamStreamKindSchema,At as CamStreamResolutionSchema,sd as CameraCredentialsSchema,rd as CameraCredentialsStatusSchema,wt as CameraMetricsSchema,Na as CameraMetricsWithDeviceIdSchema,et as CameraStreamSchema,ks as CapabilityBindingsSchema,oa as ChargingStatus,ic as ClientNetworkStatsSchema,lc as ClusterAddonNodeDeploymentSchema,uc as ClusterAddonStatusEntrySchema,Yo as CollectionColumnSchema,Qo as CollectionIndexSchema,Ls as ConfigEntrySchema,Co as ConfigSectionWithValuesSchema,Ao as ConfigTabDeclarationSchema,Kd as CreateApiKeyInputSchema,Zd as CreateApiKeyResultSchema,vc as CreateIntegrationInputSchema,Yd as CreateScopedTokenInputSchema,Qd as CreateScopedTokenResultSchema,Gd as CreateUserInputSchema,Nc as CustomActionInputSchema,Fc as DEFAULT_ADDON_GROUP,Uc as DEFAULT_ADDON_PLACEMENT,jl as DEFAULT_AUDIO_ANALYZER_CONFIG,$l as DEFAULT_DECODER_HWACCEL_CONFIG,uu as DEFAULT_FEATURES,ou as DEFAULT_LOCATION_SUBDIRS,gu as DEFAULT_RETENTION,da as DEVICE_PROFILES,ma as DEVICE_SETTINGS_CONTRIBUTION_METHODS,pa as DEVICE_STATUS_METHOD,Nu as DEVICE_TYPE_INFO,Sa as DecodedFrameSchema,Sn as DecoderAssignmentSchema,Qt as DecoderSessionConfigSchema,ea as DecoderStatsSchema,bc as DeleteIntegrationResultSchema,Wa as DetectorOutputSchema,ce as DeviceConfig,tn as DeviceDiscoveryStatusSchema,Wn as DeviceFeature,Fe as DeviceInfoSchema,On as DeviceNetworkStatsSchema,_ as DeviceRole,Tt as DeviceRuntimeState,qe as DeviceStatusSchema,w as DeviceType,it as DiscoveredChildDeviceSchema,Ta as DiscoveredChildStatusSchema,Ul as DiscoveredDeviceSchema,Yl as DisposerChain,Ra as DoorbellPressEventSchema,nn as DoorbellStatusSchema,wu as ElementConfigStore,Os as EmbeddingInfoSchema,In as EmbeddingResultSchema,va as EncodedPacketSchema,ds as EnrichedWidgetMetadataSchema,Ae as EventCategory,Xr as EventItemSchema,Tr as EventKindSchema,Jc as EventSourceType,gs as ExposedResourceSchema,xn as FeatureManifestSchema,Be as FeatureProbeStatusSchema,be as FrameInputSchema,Is as GlobalMetricsSchema,hu as HF_BASE_URL,Xc as HF_REPO,Hl as HWACCEL_OPTIONS,Xd as HealthStatusSchema,Le as HistoryPointSchema,So as HistoryResolutionEnum,Pc as InstalledPackageSchema,Ve as IntegrationLiteSchema,Nn as IntegrationWithStateSchema,yd as IntercomAbilitySchema,qn as IntercomStatusSchema,Ko as LocationStatSchema,hn as LogEntrySchema,di as LogLevelSchema,xc as LogStreamEntrySchema,xu as MACRO_LABELS,Yi as MODEL_FORMATS,wn as MediaFileSchema,xa as MotionAnalysisResultSchema,Er as MotionEventSchema,po as MotionOnMotionChangedDataSchema,we as MotionRegionSchema,Pt as MotionSourceEnum,ro as MotionSourcesSchema,sn as MotionStatusSchema,go as MotionTriggerRuntimeStateSchema,ti as MotionTriggerStatusSchema,Ii as NativeDetectionSchema,ht as NativeObjectClassEnum,vd as NativeObjectDetectionStatusSchema,Ys as NetworkAccessStatusSchema,ec as NetworkAddressSchema,ut as NetworkEndpointSchema,dr as NotificationHistoryEntrySchema,kn as NotificationRuleSchema,sr as NotificationSchema,qr as ObjectEventSchema,zl as OrchestratorMetricsSchema,ld as OsdOverlayKindEnum,md as OsdOverlayPatchSchema,ud as OsdOverlaySchema,gt as OsdPositionEnum,En as OsdStatusSchema,zc as PIPELINE_FLOW_CAPABILITY_NAMES,Gl as PIPELINE_OWNER_CAPABILITY_NAMES,il as PYTHON_SCRIPT,Dc as PackageUpdateSchema,Mc as PackageVersionInfoSchema,Te as PcmSampleFormatSchema,dt as PerScopeBreakdownSchema,vn as PipelineAssignmentSchema,st as PipelineDefaultStepSchema,M as PipelineEngineChoiceSchema,on as PipelineRunResultBridge,J as PipelineStepInputSchema,Ll as PlaceholderReasonSchema,so as PolygonPointSchema,tt as ProfileSlotSchema,Se as ProfileSlotStatusSchema,Io as ProviderStatusSchema,fo as PtzAutotrackRuntimeStateSchema,rt as PtzAutotrackSettingsSchema,Ie as PtzAutotrackStatusSchema,yo as PtzAutotrackTargetOptionSchema,Rn as PtzMoveCommandSchema,Tn as PtzPositionSchema,Qr as PtzPresetSchema,pn as QueryFilterSchema,pu as RECOGNITION_TYPES,yu as RUNTIME_DEFAULTS,nl as RUNTIME_TO_FORMAT,nu as ReadinessRegistry,jc as ReadinessTimeoutError,ps as RegisteredStreamSchema,gi as RemoteAccessEndpointSchema,Js as RemoteAccessProviderInfoSchema,co as ReportMotionInputSchema,Qu as RingBuffer,nt as RtspRestreamEntrySchema,lo as RunnerCameraConfigSchema,_l as RunnerCameraDeviceUIFields,Xn as RunnerLocalLoadSchema,uo as RunnerLocalMetricsSchema,Ml as STORAGE_LOCATION_CARDINALITY,au as STORAGE_LOCATION_TYPES,Vc as STREAM_QUALITY_LABELS,mu as SUB_DETECTION_TYPES,Zl as ScopedTokenSchema,ft as ScopedTokenSummarySchema,Tc as SearchResultSchema,td as SegmentSchema,ln as SettingsPatchSchema,gn as SettingsRecordSchema,Y as SettingsSchemaWithValuesSchema,un as SettingsUpdateResultSchema,yi as SnapshotImageSchema,qa as SpatialDetectionSchema,Lo as StorageAbortUploadInputSchema,zo as StorageBeginDownloadInputSchema,_o as StorageBeginDownloadResultSchema,Bo as StorageBeginUploadInputSchema,xo as StorageBeginUploadResultSchema,Uo as StorageEndDownloadInputSchema,No as StorageFinalizeUploadInputSchema,z as StorageLocationRefSchema,q as StorageLocationSchema,Q as StorageLocationTypeSchema,Eo as StorageProviderInfoSchema,Fo as StorageReadChunkInputSchema,qo as StorageTestLocationResultSchema,Oo as StorageWriteChunkInputSchema,Ct as StreamFormatSchema,ka as StreamInfoSchema,nc as StreamNetworkStatsSchema,fa as StreamSourceEntrySchema,Nl as StreamSourceSchema,rn as SwitchStatusSchema,Zr as SystemMetricsSchema,$u as SystemMirror,fc as TestConnectionResultSchema,oc as ToastSchema,_c as TokenScopeSchema,cc as TopologyNodeSchema,dc as TopologyProcessSchema,rc as TopologyServiceSchema,He as TrackSchema,Dt as TrackStateSchema,Lr as TrackedDetectionSchema,tr as TurnProviderInfoSchema,hi as TurnServerSchema,Sc as UpdateIntegrationInputSchema,Vd as UpdateUserInputSchema,Vl as UserRecordSchema,Pi as UserRoleSchema,je as UserSummarySchema,Qi as WELL_KNOWN_TABS,Dl as WELL_KNOWN_TAB_MAP,fs as WebrtcStreamChoiceSchema,ui as WebrtcStreamTargetSchema,ss as WidgetHostEnum,ci as WidgetMetadataSchema,yn as WidgetSizeEnum,ia as YAMNET_TO_MACRO,oo as ZoneKindEnum,bo as ZoneRuleModeEnum,re as ZoneRuleSchema,cn as ZoneRuleStageEnum,Fl as ZoneRulesArraySchema,se as ZoneSchema,vo as ZoneScopeBreakdownSchema,hd as accessoriesCapability,ql as accessoryStableId,is as addonPagesCapability,os as addonPagesSourceCapability,us as addonRoutesCapability,wo as addonSettingsCapability,cs as addonWidgetsCapability,rs as addonWidgetsSourceCapability,Lc as addonsCapability,es as adminUiCapability,cr as advancedNotifierCapability,To as alertsCapability,bu as asBoolean,fu as asJsonArray,el as asJsonObject,Su as asNumber,vu as asString,Ms as audioAnalysisCapability,Ds as audioAnalyzerCapability,xs as audioCodecCapability,jn as audioMetricsCapability,Vs as authProviderCapability,Zs as authenticationCapability,lu as autoAssignProfiles,Zo as backupCapability,Gn as batteryCapability,Ju as bindAddonActions,Vn as brightnessCapability,dd as cameraCredentialsCapability,Zn as cameraStreamsCapability,ru as classifyStream,Zc as classifyStreams,Cu as cosineSimilarity,vl as createDeviceProxy,Ti as createEvent,Bi as createLazyTrpcSource,yl as createMirrorSource,Lu as createRuntimeStateBridge,E as createSliceHandle,Hu as createSystemProxy,ju as customAction,ms as decoderCapability,Wu as defineCustomActions,Mr as detectionPipelineCapability,Yn as deviceDiscoveryCapability,js as deviceManagerCapability,sa as deviceMatchesProfile,od as deviceOpsCapability,ri as deviceProviderCapability,Gs as deviceStateCapability,It as deviceStatusCapability,Qn as doorbellCapability,Ns as embeddingEncoderCapability,iu as emitDownForOwnedCaps,Hc as emitReadiness,ta as errMsg,Uu as evaluateZoneRules,G as event,ed as eventsCapability,xl as expandCapMethods,kt as featureProbeCapability,Mu as formatForBackend,Tu as formatForRuntime,Rl as getAudioMacroClassIds,Au as hfModelUrl,Yt as hydrateSchema,Ic as integrationsCapability,fd as intercomCapability,Jl as isAgentOnlyPlacement,Ql as isDeployableToAgent,tu as isEvent,Nd as localNetworkCapability,Xo as logDestinationCapability,Tl as mapAudioLabelToMacro,Yu as maskUrlCredentials,Hd as meshNetworkCapability,jd as meshOrchestratorCapability,r as method,Yr as metricsProviderCapability,ei as motionCapability,Oa as motionDetectionCapability,ni as motionTriggerCapability,Sd as nativeObjectDetectionCapability,Qs as networkAccessCapability,ac as networkQualityCapability,hc as nodesCapability,Wc as normalizeAddonInitResult,rr as notificationOutputCapability,pd as osdCapability,cu as parseCameraStreamConfig,ku as parseJsonArray,Iu as parseJsonObject,Ri as parseJsonUnknown,zr as pipelineAnalyticsCapability,ao as pipelineExecutorCapability,As as pipelineOrchestratorCapability,mo as pipelineRunnerCapability,Rd as platformProbeCapability,ii as ptzAutotrackCapability,Jr as ptzCapability,Ru as pythonScriptForBackend,Ke as readinessKey,cd as rebootCapability,nd as recordingCapability,Dr as recordingEngineCapability,Xs as remoteAccessCapability,Eu as requiresPython,Re as resolveAddonExecution,Xl as resolveAddonGroup,eu as resolveAddonPlacement,Du as resolveAddonRuntime,al as resolveDetectionRuntime,Bl as resolveDeviceProfile,Pu as resolveModelFormat,hs as restreamerCapability,qu as runInferenceStep,de as scopeKey,Jo as settingsStoreCapability,ar as snapshotCapability,or as snapshotProviderCapability,Ro as storageCapability,Ho as storageProviderCapability,Ma as streamBrokerCapability,Kc as streamPixels,su as streamQualityLabel,Aa as streamingEngineCapability,ai as switchCapability,tc as systemCapability,dl as toDeviceSummary,du as toStreamSourceEntry,sc as toastCapability,nr as turnOrchestratorCapability,er as turnProviderCapability,Jd as userManagementCapability,ys as webrtcCapability,li as webrtcClientHintsSchema,vs as webrtcSessionCapability,Fu as zodEntriesToConfigUI,oi as zoneAnalyticsCapability,si as zoneRulesCapability,Jn as zonesCapability};
|