diff --git a/behavision/api.py b/behavision/api.py index ad79b77..d35a0bb 100644 --- a/behavision/api.py +++ b/behavision/api.py @@ -332,6 +332,17 @@ def create_app(engine: Engine) -> FastAPI: worker.commission.cancel() return {"cancelled": camera_id} + @app.get("/api/cameras/discover") + def discover_cameras() -> dict: + """Cameras on this PC's network, for the add-camera form to pick from. + + A sync def so FastAPI runs it in the threadpool: it holds a socket + open for a couple of seconds and sweeps a /24, and the event loop + must keep serving the live picture meanwhile. + """ + from .discover import discover + return discover() + @app.post("/api/cameras/test") def test_camera(payload: CameraPayload) -> dict: """Try a camera WITHOUT saving it - the UI's Test button. diff --git a/behavision/discover.py b/behavision/discover.py new file mode 100644 index 0000000..89a986b --- /dev/null +++ b/behavision/discover.py @@ -0,0 +1,206 @@ +"""Find the cameras on the shop's network, so nobody has to type an address. + +The add-camera form asked for an IP address, and a shop owner does not know +their camera's IP address. It is on a sticker under the camera, if at all, or +inside the camera's own app under a menu called something different for every +make. That one field is where onboarding stopped for anyone who was not an +installer. + +Two probes, merged: + +- **WS-Discovery** (ONVIF's discovery protocol): one multicast to + 239.255.255.250:3702 and every ONVIF camera on the LAN answers with its + address and, usually, its make and model. Cheap, fast, and names the device + - but only cameras that speak ONVIF answer, and some cheap ones do not. +- **A TCP sweep of port 554** across the local /24: anything listening on the + RTSP port is very probably a camera or a recorder. Names nothing, misses + nothing that streams. + +A host found by either is a candidate; one found by both is a camera with a +name. The result is a list to pick from, not a decision: the person still +supplies the password, and Test still proves the stream opens. + +Stdlib only. This runs inside the engine, which ships as a small wheel, and a +network-scanning dependency would be a large thing to add for two sockets. +""" +from __future__ import annotations + +import ipaddress +import re +import socket +import uuid +from concurrent.futures import ThreadPoolExecutor +from dataclasses import dataclass, field, asdict +from typing import Iterable + +# ONVIF WS-Discovery probe. The MessageID must be unique per probe; devices +# ignore a repeat. +_PROBE = ( + '' + '' + 'uuid:{mid}' + 'urn:schemas-xmlsoap-org:ws:2005:04:discovery' + 'http://schemas.xmlsoap.org/ws/2005/04/discovery/Probe' + 'dn:NetworkVideoTransmitter' + '' +) +_MCAST = ("239.255.255.250", 3702) + +# Makes we can name from an ONVIF scope or hostname, mapped to the ids the +# camera-make picker uses so the form can preselect the stream path. +_MAKES = ( + ("hikvision", "hikvision"), ("hik", "hikvision"), ("dahua", "dahua"), + ("cp plus", "cpplus"), ("cpplus", "cpplus"), ("cp-plus", "cpplus"), + ("uniview", "uniview"), ("unv", "uniview"), ("tapo", "tplink"), + ("tp-link", "tplink"), ("reolink", "reolink"), ("amcrest", "amcrest"), + ("axis", "axis"), +) + + +@dataclass +class Found: + host: str + rtsp: bool = False # port 554 answered + onvif: bool = False # answered WS-Discovery + name: str = "" # from ONVIF scopes, e.g. "Hikvision DS-2CD2043" + make: str = "" # picker id, when it can be guessed + onvif_url: str = "" + sources: list[str] = field(default_factory=list) + + +def local_networks() -> list[ipaddress.IPv4Network]: + """The /24s this machine sits on, best effort and without dependencies. + + Interface masks are not portable in the stdlib, so this assumes /24 - the + shape of nearly every shop's router - for each local IPv4 address it can + find. A bigger network would need a scan anyway that this should not run + unasked. + """ + addrs: set[str] = set() + try: + # The address the OS would use to reach the internet: the LAN we care about. + s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + s.settimeout(0.5) + s.connect(("8.8.8.8", 80)) + addrs.add(s.getsockname()[0]) + s.close() + except OSError: + pass + try: + for a in socket.gethostbyname_ex(socket.gethostname())[2]: + addrs.add(a) + except OSError: + pass + nets = [] + for a in addrs: + try: + ip = ipaddress.IPv4Address(a) + except ValueError: + continue + if ip.is_loopback or ip.is_link_local: + continue + nets.append(ipaddress.IPv4Network(f"{a}/24", strict=False)) + return sorted(set(nets), key=str) + + +def ws_discover(timeout: float = 2.5) -> list[Found]: + """One ONVIF probe, every answer within `timeout` seconds.""" + out: dict[str, Found] = {} + try: + sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP) + sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) + sock.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, 2) + sock.settimeout(timeout) + sock.sendto(_PROBE.format(mid=uuid.uuid4()).encode(), _MCAST) + except OSError: + return [] + import time + deadline = time.monotonic() + timeout + while time.monotonic() < deadline: + try: + data, (host, _) = sock.recvfrom(65535) + except socket.timeout: + break + except OSError: + break + f = parse_probe_match(data.decode("utf-8", "replace"), host) + if f: + out[f.host] = f + sock.close() + return list(out.values()) + + +_XADDR = re.compile(r"<[^>]*XAddrs[^>]*>([^<]+)<") +_SCOPES = re.compile(r"<[^>]*Scopes[^>]*>([^<]+)<") + + +def parse_probe_match(xml: str, host: str) -> Found | None: + """Pull the address and the human-readable scopes out of a ProbeMatch. + + A regex rather than an XML parser on purpose: cameras emit every namespace + prefix imaginable and some emit XML that is not quite well-formed, and the + two fields wanted are flat text. + """ + xaddrs = _XADDR.search(xml) + scopes = _SCOPES.search(xml) + if not xaddrs and not scopes: + return None + url = xaddrs.group(1).split()[0] if xaddrs else "" + # Prefer the host from the XAddrs URL: a device with several interfaces + # answers from the one it heard us on, which is the one we can reach. + m = re.match(r"https?://([^/:]+)", url) + ip = m.group(1) if m else host + f = Found(host=ip, onvif=True, onvif_url=url, sources=["onvif"]) + if scopes: + words = [] + for s in scopes.group(1).split(): + if "/name/" in s or "/hardware/" in s: + from urllib.parse import unquote + words.append(unquote(s.rsplit("/", 1)[-1])) + f.name = " ".join(dict.fromkeys(words)) # dedupe, keep order + f.make = guess_make(f.name) + return f + + +def guess_make(text: str) -> str: + low = text.lower() + for needle, make in _MAKES: + if needle in low: + return make + return "" + + +def rtsp_sweep(nets: Iterable[ipaddress.IPv4Network], timeout: float = 0.5, + workers: int = 128) -> list[str]: + """Every host in `nets` with port 554 open. ~254 hosts in about a second.""" + def probe(ip: str) -> str | None: + s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + s.settimeout(timeout) + try: + return ip if s.connect_ex((ip, 554)) == 0 else None + except OSError: + return None + finally: + s.close() + hosts = [str(h) for n in nets for h in n.hosts()] + with ThreadPoolExecutor(max_workers=workers) as ex: + return [ip for ip in ex.map(probe, hosts) if ip] + + +def discover(timeout: float = 2.5) -> dict: + """Both probes, merged, as the API returns it.""" + nets = local_networks() + found: dict[str, Found] = {f.host: f for f in ws_discover(timeout)} + for ip in rtsp_sweep(nets): + f = found.setdefault(ip, Found(host=ip)) + f.rtsp = True + f.sources.append("rtsp") + cams = sorted(found.values(), key=lambda f: (not (f.rtsp and f.onvif), not f.rtsp, + ipaddress.IPv4Address(f.host))) + return { + "networks": [str(n) for n in nets], + "cameras": [asdict(c) for c in cams], + } diff --git a/desktop/app.go b/desktop/app.go index 383aead..b113938 100644 --- a/desktop/app.go +++ b/desktop/app.go @@ -609,6 +609,14 @@ func (a *App) Cameras() ([]map[string]any, error) { return a.local.Cameras(ctx) } +// DiscoverCameras lists the cameras on this PC's network, so the add-camera +// form is a pick-list and not a request for an IP address nobody knows. +func (a *App) DiscoverCameras() (map[string]any, error) { + ctx, cancel := context.WithTimeout(a.ctx, 30*time.Second) + defer cancel() + return a.local.DiscoverCameras(ctx) +} + func (a *App) TestCamera(cam map[string]any) (map[string]any, error) { ctx, cancel := context.WithTimeout(a.ctx, 60*time.Second) defer cancel() diff --git a/desktop/frontend/dist/assets/index-C-oYbwC6.js b/desktop/frontend/dist/assets/index-C-oYbwC6.js deleted file mode 100644 index 72cdbb2..0000000 --- a/desktop/frontend/dist/assets/index-C-oYbwC6.js +++ /dev/null @@ -1,40 +0,0 @@ -(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))r(l);new MutationObserver(l=>{for(const i of l)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(l){const i={};return l.integrity&&(i.integrity=l.integrity),l.referrerPolicy&&(i.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?i.credentials="include":l.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(l){if(l.ep)return;l.ep=!0;const i=n(l);fetch(l.href,i)}})();function _c(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var sa={exports:{}},cl={},oa={exports:{}},R={};/** - * @license React - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var nr=Symbol.for("react.element"),Pc=Symbol.for("react.portal"),zc=Symbol.for("react.fragment"),Lc=Symbol.for("react.strict_mode"),Tc=Symbol.for("react.profiler"),Mc=Symbol.for("react.provider"),Rc=Symbol.for("react.context"),Dc=Symbol.for("react.forward_ref"),Oc=Symbol.for("react.suspense"),Fc=Symbol.for("react.memo"),Ic=Symbol.for("react.lazy"),Qs=Symbol.iterator;function $c(e){return e===null||typeof e!="object"?null:(e=Qs&&e[Qs]||e["@@iterator"],typeof e=="function"?e:null)}var aa={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},ua=Object.assign,ca={};function pn(e,t,n){this.props=e,this.context=t,this.refs=ca,this.updater=n||aa}pn.prototype.isReactComponent={};pn.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};pn.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function da(){}da.prototype=pn.prototype;function Xi(e,t,n){this.props=e,this.context=t,this.refs=ca,this.updater=n||aa}var Zi=Xi.prototype=new da;Zi.constructor=Xi;ua(Zi,pn.prototype);Zi.isPureReactComponent=!0;var Ks=Array.isArray,fa=Object.prototype.hasOwnProperty,Ji={current:null},pa={key:!0,ref:!0,__self:!0,__source:!0};function ha(e,t,n){var r,l={},i=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(i=""+t.key),t)fa.call(t,r)&&!pa.hasOwnProperty(r)&&(l[r]=t[r]);var a=arguments.length-2;if(a===1)l.children=n;else if(1>>1,q=E[Y];if(0>>1;Yl(Pl,T))ktl(ar,Pl)?(E[Y]=ar,E[kt]=T,Y=kt):(E[Y]=Pl,E[jt]=T,Y=jt);else if(ktl(ar,T))E[Y]=ar,E[kt]=T,Y=kt;else break e}}return L}function l(E,L){var T=E.sortIndex-L.sortIndex;return T!==0?T:E.id-L.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var o=Date,a=o.now();e.unstable_now=function(){return o.now()-a}}var u=[],c=[],p=1,v=null,h=3,g=!1,w=!1,x=!1,z=typeof setTimeout=="function"?setTimeout:null,f=typeof clearTimeout=="function"?clearTimeout:null,d=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function m(E){for(var L=n(c);L!==null;){if(L.callback===null)r(c);else if(L.startTime<=E)r(c),L.sortIndex=L.expirationTime,t(u,L);else break;L=n(c)}}function y(E){if(x=!1,m(E),!w)if(n(u)!==null)w=!0,El(k);else{var L=n(c);L!==null&&_l(y,L.startTime-E)}}function k(E,L){w=!1,x&&(x=!1,f(_),_=-1),g=!0;var T=h;try{for(m(L),v=n(u);v!==null&&(!(v.expirationTime>L)||E&&!Te());){var Y=v.callback;if(typeof Y=="function"){v.callback=null,h=v.priorityLevel;var q=Y(v.expirationTime<=L);L=e.unstable_now(),typeof q=="function"?v.callback=q:v===n(u)&&r(u),m(L)}else r(u);v=n(u)}if(v!==null)var or=!0;else{var jt=n(c);jt!==null&&_l(y,jt.startTime-L),or=!1}return or}finally{v=null,h=T,g=!1}}var N=!1,S=null,_=-1,V=5,M=-1;function Te(){return!(e.unstable_now()-ME||125Y?(E.sortIndex=T,t(c,E),n(u)===null&&E===n(c)&&(x?(f(_),_=-1):x=!0,_l(y,T-Y))):(E.sortIndex=q,t(u,E),w||g||(w=!0,El(k))),E},e.unstable_shouldYield=Te,e.unstable_wrapCallback=function(E){var L=h;return function(){var T=h;h=L;try{return E.apply(this,arguments)}finally{h=T}}}})(xa);ya.exports=xa;var Zc=ya.exports;/** - * @license React - * react-dom.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Jc=P,ke=Zc;function j(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ni=Object.prototype.hasOwnProperty,qc=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Gs={},Xs={};function bc(e){return ni.call(Xs,e)?!0:ni.call(Gs,e)?!1:qc.test(e)?Xs[e]=!0:(Gs[e]=!0,!1)}function ed(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function td(e,t,n,r){if(t===null||typeof t>"u"||ed(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function fe(e,t,n,r,l,i,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=l,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=o}var le={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){le[e]=new fe(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];le[t]=new fe(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){le[e]=new fe(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){le[e]=new fe(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){le[e]=new fe(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){le[e]=new fe(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){le[e]=new fe(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){le[e]=new fe(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){le[e]=new fe(e,5,!1,e.toLowerCase(),null,!1,!1)});var bi=/[\-:]([a-z])/g;function es(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(bi,es);le[t]=new fe(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(bi,es);le[t]=new fe(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(bi,es);le[t]=new fe(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){le[e]=new fe(e,1,!1,e.toLowerCase(),null,!1,!1)});le.xlinkHref=new fe("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){le[e]=new fe(e,1,!1,e.toLowerCase(),null,!0,!0)});function ts(e,t,n,r){var l=le.hasOwnProperty(t)?le[t]:null;(l!==null?l.type!==0:r||!(2a||l[o]!==i[a]){var u=` -`+l[o].replace(" at new "," at ");return e.displayName&&u.includes("")&&(u=u.replace("",e.displayName)),u}while(1<=o&&0<=a);break}}}finally{Tl=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?En(e):""}function nd(e){switch(e.tag){case 5:return En(e.type);case 16:return En("Lazy");case 13:return En("Suspense");case 19:return En("SuspenseList");case 0:case 2:case 15:return e=Ml(e.type,!1),e;case 11:return e=Ml(e.type.render,!1),e;case 1:return e=Ml(e.type,!0),e;default:return""}}function si(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case At:return"Fragment";case Ut:return"Portal";case ri:return"Profiler";case ns:return"StrictMode";case li:return"Suspense";case ii:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case ka:return(e.displayName||"Context")+".Consumer";case ja:return(e._context.displayName||"Context")+".Provider";case rs:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ls:return t=e.displayName||null,t!==null?t:si(e.type)||"Memo";case nt:t=e._payload,e=e._init;try{return si(e(t))}catch{}}return null}function rd(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return si(t);case 8:return t===ns?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function vt(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Na(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function ld(e){var t=Na(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var l=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(o){r=""+o,i.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function dr(e){e._valueTracker||(e._valueTracker=ld(e))}function Ca(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Na(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Ar(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function oi(e,t){var n=t.checked;return Q({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Js(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=vt(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Ea(e,t){t=t.checked,t!=null&&ts(e,"checked",t,!1)}function ai(e,t){Ea(e,t);var n=vt(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?ui(e,t.type,n):t.hasOwnProperty("defaultValue")&&ui(e,t.type,vt(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function qs(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function ui(e,t,n){(t!=="number"||Ar(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var _n=Array.isArray;function Jt(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=fr.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function An(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ln={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},id=["Webkit","ms","Moz","O"];Object.keys(Ln).forEach(function(e){id.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Ln[t]=Ln[e]})});function La(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Ln.hasOwnProperty(e)&&Ln[e]?(""+t).trim():t+"px"}function Ta(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=La(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var sd=Q({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function fi(e,t){if(t){if(sd[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(j(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(j(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(j(61))}if(t.style!=null&&typeof t.style!="object")throw Error(j(62))}}function pi(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var hi=null;function is(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var mi=null,qt=null,bt=null;function to(e){if(e=ir(e)){if(typeof mi!="function")throw Error(j(280));var t=e.stateNode;t&&(t=ml(t),mi(e.stateNode,e.type,t))}}function Ma(e){qt?bt?bt.push(e):bt=[e]:qt=e}function Ra(){if(qt){var e=qt,t=bt;if(bt=qt=null,to(e),t)for(e=0;e>>=0,e===0?32:31-(gd(e)/yd|0)|0}var pr=64,hr=4194304;function Pn(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Wr(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,i=e.pingedLanes,o=n&268435455;if(o!==0){var a=o&~l;a!==0?r=Pn(a):(i&=o,i!==0&&(r=Pn(i)))}else o=n&~l,o!==0?r=Pn(o):i!==0&&(r=Pn(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&l)&&(l=r&-r,i=t&-t,l>=i||l===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function rr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Fe(t),e[t]=n}function kd(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Mn),co=" ",fo=!1;function ba(e,t){switch(e){case"keyup":return Zd.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function eu(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Bt=!1;function qd(e,t){switch(e){case"compositionend":return eu(t);case"keypress":return t.which!==32?null:(fo=!0,co);case"textInput":return e=t.data,e===co&&fo?null:e;default:return null}}function bd(e,t){if(Bt)return e==="compositionend"||!ps&&ba(e,t)?(e=Ja(),Tr=cs=st=null,Bt=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=vo(n)}}function lu(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?lu(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function iu(){for(var e=window,t=Ar();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ar(e.document)}return t}function hs(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function uf(e){var t=iu(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&lu(n.ownerDocument.documentElement,n)){if(r!==null&&hs(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var l=n.textContent.length,i=Math.min(r.start,l);r=r.end===void 0?i:Math.min(r.end,l),!e.extend&&i>r&&(l=r,r=i,i=l),l=go(n,i);var o=go(n,r);l&&o&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Vt=null,ji=null,Dn=null,ki=!1;function yo(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ki||Vt==null||Vt!==Ar(r)||(r=Vt,"selectionStart"in r&&hs(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Dn&&Kn(Dn,r)||(Dn=r,r=Yr(ji,"onSelect"),0Qt||(e.current=Pi[Qt],Pi[Qt]=null,Qt--)}function I(e,t){Qt++,Pi[Qt]=e.current,e.current=t}var gt={},ae=xt(gt),me=xt(!1),Lt=gt;function on(e,t){var n=e.type.contextTypes;if(!n)return gt;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},i;for(i in n)l[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function ve(e){return e=e.childContextTypes,e!=null}function Xr(){A(me),A(ae)}function Co(e,t,n){if(ae.current!==gt)throw Error(j(168));I(ae,t),I(me,n)}function hu(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var l in r)if(!(l in t))throw Error(j(108,rd(e)||"Unknown",l));return Q({},n,r)}function Zr(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||gt,Lt=ae.current,I(ae,e),I(me,me.current),!0}function Eo(e,t,n){var r=e.stateNode;if(!r)throw Error(j(169));n?(e=hu(e,t,Lt),r.__reactInternalMemoizedMergedChildContext=e,A(me),A(ae),I(ae,e)):A(me),I(me,n)}var Ke=null,vl=!1,Kl=!1;function mu(e){Ke===null?Ke=[e]:Ke.push(e)}function jf(e){vl=!0,mu(e)}function wt(){if(!Kl&&Ke!==null){Kl=!0;var e=0,t=F;try{var n=Ke;for(F=1;e>=o,l-=o,Ye=1<<32-Fe(t)+l|n<_?(V=S,S=null):V=S.sibling;var M=h(f,S,m[_],y);if(M===null){S===null&&(S=V);break}e&&S&&M.alternate===null&&t(f,S),d=i(M,d,_),N===null?k=M:N.sibling=M,N=M,S=V}if(_===m.length)return n(f,S),B&&St(f,_),k;if(S===null){for(;__?(V=S,S=null):V=S.sibling;var Te=h(f,S,M.value,y);if(Te===null){S===null&&(S=V);break}e&&S&&Te.alternate===null&&t(f,S),d=i(Te,d,_),N===null?k=Te:N.sibling=Te,N=Te,S=V}if(M.done)return n(f,S),B&&St(f,_),k;if(S===null){for(;!M.done;_++,M=m.next())M=v(f,M.value,y),M!==null&&(d=i(M,d,_),N===null?k=M:N.sibling=M,N=M);return B&&St(f,_),k}for(S=r(f,S);!M.done;_++,M=m.next())M=g(S,f,_,M.value,y),M!==null&&(e&&M.alternate!==null&&S.delete(M.key===null?_:M.key),d=i(M,d,_),N===null?k=M:N.sibling=M,N=M);return e&&S.forEach(function(vn){return t(f,vn)}),B&&St(f,_),k}function z(f,d,m,y){if(typeof m=="object"&&m!==null&&m.type===At&&m.key===null&&(m=m.props.children),typeof m=="object"&&m!==null){switch(m.$$typeof){case cr:e:{for(var k=m.key,N=d;N!==null;){if(N.key===k){if(k=m.type,k===At){if(N.tag===7){n(f,N.sibling),d=l(N,m.props.children),d.return=f,f=d;break e}}else if(N.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===nt&&zo(k)===N.type){n(f,N.sibling),d=l(N,m.props),d.ref=Sn(f,N,m),d.return=f,f=d;break e}n(f,N);break}else t(f,N);N=N.sibling}m.type===At?(d=zt(m.props.children,f.mode,y,m.key),d.return=f,f=d):(y=Ur(m.type,m.key,m.props,null,f.mode,y),y.ref=Sn(f,d,m),y.return=f,f=y)}return o(f);case Ut:e:{for(N=m.key;d!==null;){if(d.key===N)if(d.tag===4&&d.stateNode.containerInfo===m.containerInfo&&d.stateNode.implementation===m.implementation){n(f,d.sibling),d=l(d,m.children||[]),d.return=f,f=d;break e}else{n(f,d);break}else t(f,d);d=d.sibling}d=ei(m,f.mode,y),d.return=f,f=d}return o(f);case nt:return N=m._init,z(f,d,N(m._payload),y)}if(_n(m))return w(f,d,m,y);if(yn(m))return x(f,d,m,y);jr(f,m)}return typeof m=="string"&&m!==""||typeof m=="number"?(m=""+m,d!==null&&d.tag===6?(n(f,d.sibling),d=l(d,m),d.return=f,f=d):(n(f,d),d=bl(m,f.mode,y),d.return=f,f=d),o(f)):n(f,d)}return z}var un=xu(!0),wu=xu(!1),br=xt(null),el=null,Gt=null,ys=null;function xs(){ys=Gt=el=null}function ws(e){var t=br.current;A(br),e._currentValue=t}function Ti(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function tn(e,t){el=e,ys=Gt=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(he=!0),e.firstContext=null)}function ze(e){var t=e._currentValue;if(ys!==e)if(e={context:e,memoizedValue:t,next:null},Gt===null){if(el===null)throw Error(j(308));Gt=e,el.dependencies={lanes:0,firstContext:e}}else Gt=Gt.next=e;return t}var Et=null;function js(e){Et===null?Et=[e]:Et.push(e)}function ju(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,js(t)):(n.next=l.next,l.next=n),t.interleaved=n,qe(e,r)}function qe(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var rt=!1;function ks(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function ku(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Xe(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function ft(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,D&2){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,qe(e,n)}return l=r.interleaved,l===null?(t.next=t,js(r)):(t.next=l.next,l.next=t),r.interleaved=t,qe(e,n)}function Rr(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,os(e,n)}}function Lo(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var l=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?l=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?l=i=t:i=i.next=t}else l=i=t;n={baseState:r.baseState,firstBaseUpdate:l,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function tl(e,t,n,r){var l=e.updateQueue;rt=!1;var i=l.firstBaseUpdate,o=l.lastBaseUpdate,a=l.shared.pending;if(a!==null){l.shared.pending=null;var u=a,c=u.next;u.next=null,o===null?i=c:o.next=c,o=u;var p=e.alternate;p!==null&&(p=p.updateQueue,a=p.lastBaseUpdate,a!==o&&(a===null?p.firstBaseUpdate=c:a.next=c,p.lastBaseUpdate=u))}if(i!==null){var v=l.baseState;o=0,p=c=u=null,a=i;do{var h=a.lane,g=a.eventTime;if((r&h)===h){p!==null&&(p=p.next={eventTime:g,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var w=e,x=a;switch(h=t,g=n,x.tag){case 1:if(w=x.payload,typeof w=="function"){v=w.call(g,v,h);break e}v=w;break e;case 3:w.flags=w.flags&-65537|128;case 0:if(w=x.payload,h=typeof w=="function"?w.call(g,v,h):w,h==null)break e;v=Q({},v,h);break e;case 2:rt=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,h=l.effects,h===null?l.effects=[a]:h.push(a))}else g={eventTime:g,lane:h,tag:a.tag,payload:a.payload,callback:a.callback,next:null},p===null?(c=p=g,u=v):p=p.next=g,o|=h;if(a=a.next,a===null){if(a=l.shared.pending,a===null)break;h=a,a=h.next,h.next=null,l.lastBaseUpdate=h,l.shared.pending=null}}while(!0);if(p===null&&(u=v),l.baseState=u,l.firstBaseUpdate=c,l.lastBaseUpdate=p,t=l.shared.interleaved,t!==null){l=t;do o|=l.lane,l=l.next;while(l!==t)}else i===null&&(l.shared.lanes=0);Rt|=o,e.lanes=o,e.memoizedState=v}}function To(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Gl.transition;Gl.transition={};try{e(!1),t()}finally{F=n,Gl.transition=r}}function Uu(){return Le().memoizedState}function Cf(e,t,n){var r=ht(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Au(e))Bu(t,n);else if(n=ju(e,t,n,r),n!==null){var l=ce();Ie(n,e,r,l),Vu(n,t,r)}}function Ef(e,t,n){var r=ht(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Au(e))Bu(t,l);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,a=i(o,n);if(l.hasEagerState=!0,l.eagerState=a,$e(a,o)){var u=t.interleaved;u===null?(l.next=l,js(t)):(l.next=u.next,u.next=l),t.interleaved=l;return}}catch{}finally{}n=ju(e,t,l,r),n!==null&&(l=ce(),Ie(n,e,r,l),Vu(n,t,r))}}function Au(e){var t=e.alternate;return e===W||t!==null&&t===W}function Bu(e,t){On=rl=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Vu(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,os(e,n)}}var ll={readContext:ze,useCallback:ie,useContext:ie,useEffect:ie,useImperativeHandle:ie,useInsertionEffect:ie,useLayoutEffect:ie,useMemo:ie,useReducer:ie,useRef:ie,useState:ie,useDebugValue:ie,useDeferredValue:ie,useTransition:ie,useMutableSource:ie,useSyncExternalStore:ie,useId:ie,unstable_isNewReconciler:!1},_f={readContext:ze,useCallback:function(e,t){return Be().memoizedState=[e,t===void 0?null:t],e},useContext:ze,useEffect:Ro,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Or(4194308,4,Du.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Or(4194308,4,e,t)},useInsertionEffect:function(e,t){return Or(4,2,e,t)},useMemo:function(e,t){var n=Be();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Be();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Cf.bind(null,W,e),[r.memoizedState,e]},useRef:function(e){var t=Be();return e={current:e},t.memoizedState=e},useState:Mo,useDebugValue:Ls,useDeferredValue:function(e){return Be().memoizedState=e},useTransition:function(){var e=Mo(!1),t=e[0];return e=Nf.bind(null,e[1]),Be().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=W,l=Be();if(B){if(n===void 0)throw Error(j(407));n=n()}else{if(n=t(),ee===null)throw Error(j(349));Mt&30||Eu(r,t,n)}l.memoizedState=n;var i={value:n,getSnapshot:t};return l.queue=i,Ro(Pu.bind(null,r,i,e),[e]),r.flags|=2048,er(9,_u.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Be(),t=ee.identifierPrefix;if(B){var n=Ge,r=Ye;n=(r&~(1<<32-Fe(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=qn++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[Ve]=t,e[Xn]=r,qu(e,t,!1,!1),t.stateNode=e;e:{switch(o=pi(n,r),n){case"dialog":U("cancel",e),U("close",e),l=r;break;case"iframe":case"object":case"embed":U("load",e),l=r;break;case"video":case"audio":for(l=0;lfn&&(t.flags|=128,r=!0,Nn(i,!1),t.lanes=4194304)}else{if(!r)if(e=nl(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Nn(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!B)return se(t),null}else 2*G()-i.renderingStartTime>fn&&n!==1073741824&&(t.flags|=128,r=!0,Nn(i,!1),t.lanes=4194304);i.isBackwards?(o.sibling=t.child,t.child=o):(n=i.last,n!==null?n.sibling=o:t.child=o,i.last=o)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=G(),t.sibling=null,n=H.current,I(H,r?n&1|2:n&1),t):(se(t),null);case 22:case 23:return Fs(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?xe&1073741824&&(se(t),t.subtreeFlags&6&&(t.flags|=8192)):se(t),null;case 24:return null;case 25:return null}throw Error(j(156,t.tag))}function Of(e,t){switch(vs(t),t.tag){case 1:return ve(t.type)&&Xr(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return cn(),A(me),A(ae),Cs(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Ns(t),null;case 13:if(A(H),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(j(340));an()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return A(H),null;case 4:return cn(),null;case 10:return ws(t.type._context),null;case 22:case 23:return Fs(),null;case 24:return null;default:return null}}var Sr=!1,oe=!1,Ff=typeof WeakSet=="function"?WeakSet:Set,C=null;function Xt(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){K(e,t,r)}else n.current=null}function Ai(e,t,n){try{n()}catch(r){K(e,t,r)}}var Wo=!1;function If(e,t){if(Si=Qr,e=iu(),hs(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var l=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,a=-1,u=-1,c=0,p=0,v=e,h=null;t:for(;;){for(var g;v!==n||l!==0&&v.nodeType!==3||(a=o+l),v!==i||r!==0&&v.nodeType!==3||(u=o+r),v.nodeType===3&&(o+=v.nodeValue.length),(g=v.firstChild)!==null;)h=v,v=g;for(;;){if(v===e)break t;if(h===n&&++c===l&&(a=o),h===i&&++p===r&&(u=o),(g=v.nextSibling)!==null)break;v=h,h=v.parentNode}v=g}n=a===-1||u===-1?null:{start:a,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(Ni={focusedElem:e,selectionRange:n},Qr=!1,C=t;C!==null;)if(t=C,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,C=e;else for(;C!==null;){t=C;try{var w=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(w!==null){var x=w.memoizedProps,z=w.memoizedState,f=t.stateNode,d=f.getSnapshotBeforeUpdate(t.elementType===t.type?x:Re(t.type,x),z);f.__reactInternalSnapshotBeforeUpdate=d}break;case 3:var m=t.stateNode.containerInfo;m.nodeType===1?m.textContent="":m.nodeType===9&&m.documentElement&&m.removeChild(m.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(j(163))}}catch(y){K(t,t.return,y)}if(e=t.sibling,e!==null){e.return=t.return,C=e;break}C=t.return}return w=Wo,Wo=!1,w}function Fn(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var i=l.destroy;l.destroy=void 0,i!==void 0&&Ai(t,n,i)}l=l.next}while(l!==r)}}function xl(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Bi(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function tc(e){var t=e.alternate;t!==null&&(e.alternate=null,tc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Ve],delete t[Xn],delete t[_i],delete t[xf],delete t[wf])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function nc(e){return e.tag===5||e.tag===3||e.tag===4}function Qo(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||nc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Vi(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Gr));else if(r!==4&&(e=e.child,e!==null))for(Vi(e,t,n),e=e.sibling;e!==null;)Vi(e,t,n),e=e.sibling}function Hi(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Hi(e,t,n),e=e.sibling;e!==null;)Hi(e,t,n),e=e.sibling}var ne=null,De=!1;function tt(e,t,n){for(n=n.child;n!==null;)rc(e,t,n),n=n.sibling}function rc(e,t,n){if(He&&typeof He.onCommitFiberUnmount=="function")try{He.onCommitFiberUnmount(dl,n)}catch{}switch(n.tag){case 5:oe||Xt(n,t);case 6:var r=ne,l=De;ne=null,tt(e,t,n),ne=r,De=l,ne!==null&&(De?(e=ne,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):ne.removeChild(n.stateNode));break;case 18:ne!==null&&(De?(e=ne,n=n.stateNode,e.nodeType===8?Ql(e.parentNode,n):e.nodeType===1&&Ql(e,n),Wn(e)):Ql(ne,n.stateNode));break;case 4:r=ne,l=De,ne=n.stateNode.containerInfo,De=!0,tt(e,t,n),ne=r,De=l;break;case 0:case 11:case 14:case 15:if(!oe&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var i=l,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&Ai(n,t,o),l=l.next}while(l!==r)}tt(e,t,n);break;case 1:if(!oe&&(Xt(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){K(n,t,a)}tt(e,t,n);break;case 21:tt(e,t,n);break;case 22:n.mode&1?(oe=(r=oe)||n.memoizedState!==null,tt(e,t,n),oe=r):tt(e,t,n);break;default:tt(e,t,n)}}function Ko(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Ff),t.forEach(function(r){var l=Kf.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function Me(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=o),r&=~i}if(r=l,r=G()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Uf(r/1960))-r,10e?16:e,ot===null)var r=!1;else{if(e=ot,ot=null,ol=0,D&6)throw Error(j(331));var l=D;for(D|=4,C=e.current;C!==null;){var i=C,o=i.child;if(C.flags&16){var a=i.deletions;if(a!==null){for(var u=0;uG()-Ds?Pt(e,0):Rs|=n),ge(e,t)}function dc(e,t){t===0&&(e.mode&1?(t=hr,hr<<=1,!(hr&130023424)&&(hr=4194304)):t=1);var n=ce();e=qe(e,t),e!==null&&(rr(e,t,n),ge(e,n))}function Qf(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),dc(e,n)}function Kf(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(j(314))}r!==null&&r.delete(t),dc(e,n)}var fc;fc=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||me.current)he=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return he=!1,Rf(e,t,n);he=!!(e.flags&131072)}else he=!1,B&&t.flags&1048576&&vu(t,qr,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Fr(e,t),e=t.pendingProps;var l=on(t,ae.current);tn(t,n),l=_s(null,t,r,e,l,n);var i=Ps();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,ve(r)?(i=!0,Zr(t)):i=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,ks(t),l.updater=yl,t.stateNode=l,l._reactInternals=t,Ri(t,r,e,n),t=Fi(null,t,r,!0,i,n)):(t.tag=0,B&&i&&ms(t),ue(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Fr(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=Gf(r),e=Re(r,e),l){case 0:t=Oi(null,t,r,e,n);break e;case 1:t=Bo(null,t,r,e,n);break e;case 11:t=Uo(null,t,r,e,n);break e;case 14:t=Ao(null,t,r,Re(r.type,e),n);break e}throw Error(j(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Re(r,l),Oi(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Re(r,l),Bo(e,t,r,l,n);case 3:e:{if(Xu(t),e===null)throw Error(j(387));r=t.pendingProps,i=t.memoizedState,l=i.element,ku(e,t),tl(t,r,null,n);var o=t.memoizedState;if(r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){l=dn(Error(j(423)),t),t=Vo(e,t,r,n,l);break e}else if(r!==l){l=dn(Error(j(424)),t),t=Vo(e,t,r,n,l);break e}else for(we=dt(t.stateNode.containerInfo.firstChild),je=t,B=!0,Oe=null,n=wu(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(an(),r===l){t=be(e,t,n);break e}ue(e,t,r,n)}t=t.child}return t;case 5:return Su(t),e===null&&Li(t),r=t.type,l=t.pendingProps,i=e!==null?e.memoizedProps:null,o=l.children,Ci(r,l)?o=null:i!==null&&Ci(r,i)&&(t.flags|=32),Gu(e,t),ue(e,t,o,n),t.child;case 6:return e===null&&Li(t),null;case 13:return Zu(e,t,n);case 4:return Ss(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=un(t,null,r,n):ue(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Re(r,l),Uo(e,t,r,l,n);case 7:return ue(e,t,t.pendingProps,n),t.child;case 8:return ue(e,t,t.pendingProps.children,n),t.child;case 12:return ue(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,i=t.memoizedProps,o=l.value,I(br,r._currentValue),r._currentValue=o,i!==null)if($e(i.value,o)){if(i.children===l.children&&!me.current){t=be(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var a=i.dependencies;if(a!==null){o=i.child;for(var u=a.firstContext;u!==null;){if(u.context===r){if(i.tag===1){u=Xe(-1,n&-n),u.tag=2;var c=i.updateQueue;if(c!==null){c=c.shared;var p=c.pending;p===null?u.next=u:(u.next=p.next,p.next=u),c.pending=u}}i.lanes|=n,u=i.alternate,u!==null&&(u.lanes|=n),Ti(i.return,n,t),a.lanes|=n;break}u=u.next}}else if(i.tag===10)o=i.type===t.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(j(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),Ti(o,n,t),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===t){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}ue(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,tn(t,n),l=ze(l),r=r(l),t.flags|=1,ue(e,t,r,n),t.child;case 14:return r=t.type,l=Re(r,t.pendingProps),l=Re(r.type,l),Ao(e,t,r,l,n);case 15:return Ku(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Re(r,l),Fr(e,t),t.tag=1,ve(r)?(e=!0,Zr(t)):e=!1,tn(t,n),Hu(t,r,l),Ri(t,r,l,n),Fi(null,t,r,!0,e,n);case 19:return Ju(e,t,n);case 22:return Yu(e,t,n)}throw Error(j(156,t.tag))};function pc(e,t){return Aa(e,t)}function Yf(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function _e(e,t,n,r){return new Yf(e,t,n,r)}function $s(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Gf(e){if(typeof e=="function")return $s(e)?1:0;if(e!=null){if(e=e.$$typeof,e===rs)return 11;if(e===ls)return 14}return 2}function mt(e,t){var n=e.alternate;return n===null?(n=_e(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Ur(e,t,n,r,l,i){var o=2;if(r=e,typeof e=="function")$s(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case At:return zt(n.children,l,i,t);case ns:o=8,l|=8;break;case ri:return e=_e(12,n,t,l|2),e.elementType=ri,e.lanes=i,e;case li:return e=_e(13,n,t,l),e.elementType=li,e.lanes=i,e;case ii:return e=_e(19,n,t,l),e.elementType=ii,e.lanes=i,e;case Sa:return jl(n,l,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case ja:o=10;break e;case ka:o=9;break e;case rs:o=11;break e;case ls:o=14;break e;case nt:o=16,r=null;break e}throw Error(j(130,e==null?e:typeof e,""))}return t=_e(o,n,t,l),t.elementType=e,t.type=r,t.lanes=i,t}function zt(e,t,n,r){return e=_e(7,e,r,t),e.lanes=n,e}function jl(e,t,n,r){return e=_e(22,e,r,t),e.elementType=Sa,e.lanes=n,e.stateNode={isHidden:!1},e}function bl(e,t,n){return e=_e(6,e,null,t),e.lanes=n,e}function ei(e,t,n){return t=_e(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Xf(e,t,n,r,l){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Dl(0),this.expirationTimes=Dl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Dl(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function Us(e,t,n,r,l,i,o,a,u){return e=new Xf(e,t,n,a,u),t===1?(t=1,i===!0&&(t|=8)):t=0,i=_e(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},ks(i),e}function Zf(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(gc)}catch(e){console.error(e)}}gc(),ga.exports=Se;var tp=ga.exports,yc,ea=tp;yc=ea.createRoot,ea.hydrateRoot;const xc=()=>{var e,t;return(t=(e=window==null?void 0:window.go)==null?void 0:e.main)==null?void 0:t.App},np=()=>!!xc();async function O(e,...t){const n=xc();if(!n||typeof n[e]!="function")throw new Error(`${e} is unavailable — run this inside the Behavision app`);return n[e](...t)}const $={session:()=>O("Session"),login:(e,t)=>O("Login",e,t),logout:()=>O("Logout"),claim:e=>O("Claim",e),runStandalone:()=>O("RunStandalone"),engineStatus:()=>O("EngineStatus"),startEngine:()=>O("StartEngine"),stopEngine:()=>O("StopEngine"),cameras:()=>O("Cameras"),testCamera:e=>O("TestCamera",e),saveCamera:(e,t)=>O("SaveCamera",e,t),deleteCamera:e=>O("DeleteCamera",e),startPlacement:(e,t)=>O("StartPlacementCheck",e,t),placementResult:e=>O("PlacementResult",e),streamURL:e=>O("StreamURL",e),live:()=>O("Live"),pipelineStatus:()=>O("PipelineStatus"),localIdentities:e=>O("LocalIdentities",e),localSightings:e=>O("LocalSightings",e),footfall:(e,t,n)=>O("Footfall",e,t,n),sites:()=>O("Sites"),visitorHistory:(e,t)=>O("VisitorHistory",e,t),visitorPhoto:e=>O("VisitorPhoto",e),forgetCustomer:e=>O("ForgetCustomer",e),sales:(e,t)=>O("Sales",e,t),customers:(e,t)=>O("Customers",e,t),saveProfile:e=>O("SaveProfile",e),ask:e=>O("Ask",e),recordPurchase:(e,t,n,r)=>O("RecordPurchase",e,t,n,r)};function ye(e){return e?typeof e=="string"?e:e.message||String(e):"Something went wrong."}function Ot(e,t,n=[]){const[r,l]=P.useState(null),[i,o]=P.useState(null),[a,u]=P.useState(!0),c=P.useRef(!0),p=P.useRef(!1),v=P.useCallback(async()=>{if(!p.current){p.current=!0;try{const h=await e();if(!c.current)return;l(h),o(null)}catch(h){c.current&&o(ye(h))}finally{p.current=!1,c.current&&u(!1)}}},n);return P.useEffect(()=>{if(c.current=!0,v(),!t)return()=>{c.current=!1};const h=setInterval(v,t);return()=>{c.current=!1,clearInterval(h)}},[v,t]),{data:r,error:i,loading:a,reload:v}}function rp(e){if(!e)return"—";const t=typeof e=="number"?new Date(e*1e3):new Date(e);return isNaN(t)?"—":t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function ta(e){if(!e)return"—";const t=typeof e=="number"?new Date(e*1e3):new Date(e);return isNaN(t)?"—":t.toLocaleDateString([],{day:"numeric",month:"short"})}const ti={width:18,height:18,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false"};function te({size:e,children:t,...n}){return s.jsx("svg",{...ti,...n,width:e??ti.width,height:e??ti.height,children:t})}const lp=e=>s.jsxs(te,{...e,children:[s.jsx("circle",{cx:"12",cy:"12",r:"3.2"}),s.jsx("path",{d:"M5.6 5.6a9 9 0 0 0 0 12.8M18.4 18.4a9 9 0 0 0 0-12.8"})]}),ip=e=>s.jsxs(te,{...e,children:[s.jsx("circle",{cx:"9",cy:"8.5",r:"3.2"}),s.jsx("path",{d:"M2.8 19.5a6.4 6.4 0 0 1 12.4 0"}),s.jsx("path",{d:"M16.5 6.2a3.2 3.2 0 0 1 0 6.1M18 19.5a6 6 0 0 0-1.6-4"})]}),sp=e=>s.jsxs(te,{...e,children:[s.jsx("path",{d:"M3 8.5h3.4L8 6h8l1.6 2.5H21v10.2H3z"}),s.jsx("circle",{cx:"12",cy:"13.2",r:"3.1"})]}),op=e=>s.jsxs(te,{...e,children:[s.jsx("circle",{cx:"11",cy:"11",r:"6.4"}),s.jsx("path",{d:"M15.8 15.8 20.5 20.5"})]}),na=e=>s.jsx(te,{...e,children:s.jsx("path",{d:"M12 5.5v13M5.5 12h13"})}),Hs=e=>s.jsx(te,{...e,children:s.jsx("path",{d:"M6.5 6.5l11 11M17.5 6.5l-11 11"})}),wc=e=>s.jsx(te,{...e,children:s.jsx("path",{d:"M5 12.8l4.4 4.2L19 7"})}),jc=e=>s.jsx(te,{...e,children:s.jsx("path",{d:"M8 5.6v12.8L18.5 12z"})}),ap=e=>s.jsx(te,{...e,children:s.jsx("rect",{x:"7",y:"7",width:"10",height:"10",rx:"1.6"})}),Ue=e=>s.jsxs(te,{...e,children:[s.jsx("path",{d:"M12 4.6 21 19.4H3z"}),s.jsx("path",{d:"M12 10v4.1"}),s.jsx("path",{d:"M12 17.1v.01"})]}),ra=e=>s.jsx(te,{...e,children:s.jsx("path",{d:"M5 19.4v-4.2M10.3 19.4v-7.6M15.7 19.4v-11M21 19.4V4.6"})}),up=e=>s.jsx(te,{...e,children:s.jsx("path",{d:"M7.2 18.4a4.2 4.2 0 0 1-.6-8.35A6.2 6.2 0 0 1 18.4 9a4.2 4.2 0 0 1 .3 9.4z"})}),kc=e=>s.jsxs(te,{...e,children:[s.jsx("path",{d:"M7.2 18.4a4.2 4.2 0 0 1-.6-8.35 6.2 6.2 0 0 1 2-3.2M10.6 5.2A6.2 6.2 0 0 1 18.4 9a4.2 4.2 0 0 1 1.9 7.6"}),s.jsx("path",{d:"M3.6 3.6l16.8 16.8"})]}),cp=e=>s.jsxs(te,{...e,children:[s.jsx("path",{d:"M10.2 13.8a3.6 3.6 0 0 0 5.2 0l2.8-2.8a3.7 3.7 0 0 0-5.2-5.2l-1.3 1.3"}),s.jsx("path",{d:"M13.8 10.2a3.6 3.6 0 0 0-5.2 0l-2.8 2.8a3.7 3.7 0 0 0 5.2 5.2l1.3-1.3"})]}),dp=e=>s.jsxs(te,{...e,children:[s.jsx("path",{d:"M14.4 7.6V5.4H4.6v13.2h9.8v-2.2"}),s.jsx("path",{d:"M10 12h9.4M16.4 8.8 19.8 12l-3.4 3.2"})]}),fp=e=>s.jsx(te,{...e,children:s.jsx("path",{d:"M9.4 5.6 16 12l-6.6 6.4"})}),Sc=e=>s.jsxs(te,{...e,strokeWidth:"1.2",children:[s.jsx("path",{d:"M3 8.5h3.4L8 6h8l1.6 2.5H21v10.2H3z"}),s.jsx("circle",{cx:"12",cy:"13.2",r:"3.1"}),s.jsx("path",{d:"M3.6 3.6l16.8 16.8"})]}),Nc=e=>s.jsxs(te,{...e,strokeWidth:"1.2",children:[s.jsx("circle",{cx:"12",cy:"9",r:"3.4"}),s.jsx("path",{d:"M5.4 20a6.8 6.8 0 0 1 13.2 0"})]}),rn=""+new URL("loyaly-mark-Ch-P3VSF.png",import.meta.url).href;function pp({onDone:e}){const[t,n]=P.useState(""),[r,l]=P.useState(""),[i,o]=P.useState(!1),[a,u]=P.useState(null);async function c(p){p.preventDefault(),o(!0),u(null);try{e(await $.login(t.trim(),r))}catch(v){u(ye(v))}finally{o(!1)}}return s.jsx("div",{className:"login",children:s.jsxs("div",{className:"box",children:[s.jsx("span",{className:"mark",children:s.jsx("img",{src:rn,alt:""})}),s.jsx("h1",{children:"Behavision"}),s.jsx("p",{className:"lead",children:"Sign in to connect this PC to your store."}),s.jsxs("form",{onSubmit:c,children:[a&&s.jsxs("div",{className:"err",children:[s.jsx(Ue,{size:15}),a]}),s.jsxs("label",{className:"field",children:[s.jsx("span",{children:"Email"}),s.jsx("input",{type:"email",value:t,autoComplete:"username",required:!0,autoFocus:!0,onChange:p=>n(p.target.value)})]}),s.jsxs("label",{className:"field",children:[s.jsx("span",{children:"Password"}),s.jsx("input",{type:"password",value:r,autoComplete:"current-password",required:!0,onChange:p=>l(p.target.value)})]}),s.jsx("button",{className:"btn primary",disabled:i||!t||!r,children:i?"Signing in…":"Sign in"})]}),s.jsx("p",{className:"foot",children:"Signing in downloads this store's recognition models and connects it to your account. Nothing is sent until a camera is set up."})]})})}function la({onDone:e,onCancel:t}){const[n,r]=P.useState(""),[l,i]=P.useState(null),[o,a]=P.useState(null),[u,c]=P.useState(!1);async function p(h){h.preventDefault(),i("claim"),a(null);try{e(await $.claim(n))}catch(g){a(ye(g))}finally{i(null)}}async function v(){i("alone"),a(null);try{e(await $.runStandalone())}catch(h){a(ye(h))}finally{i(null)}}return s.jsx("div",{className:"login",children:s.jsxs("div",{className:"box",children:[s.jsx("span",{className:"mark",children:s.jsx("img",{src:rn,alt:""})}),s.jsx("h1",{children:t?"Link to head office":"Set up this PC"}),s.jsx("p",{className:"lead",children:"Type the installation code for this shop. You only do this once."}),s.jsxs("form",{onSubmit:p,children:[o&&s.jsxs("div",{className:"err",children:[s.jsx(Ue,{size:15}),o]}),s.jsxs("label",{className:"field",children:[s.jsx("span",{children:"Installation code"}),s.jsx("input",{value:n,autoFocus:!0,required:!0,placeholder:"ABCDEF-123456-GHIJKL-789012",autoComplete:"off",spellCheck:"false",style:{textTransform:"uppercase",letterSpacing:".06em"},onChange:h=>r(h.target.value)})]}),s.jsx("button",{className:"btn primary",disabled:!!l||n.trim().length<6,children:l==="claim"?"Linking…":"Link this PC"})]}),s.jsx("p",{className:"foot",children:"The code works once. Ask whoever manages your shops for it — they can create one from the Behavision platform, under the shop."}),s.jsx("div",{className:"alt",children:t?s.jsx("button",{type:"button",className:"linkbtn",onClick:t,children:"Not now — go back"}):u?s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"note",children:"This PC will watch its cameras and recognise returning customers on its own. Nothing is sent anywhere. You can link it to head office later without losing anything recorded here."}),s.jsx("button",{type:"button",className:"btn",disabled:!!l,onClick:v,children:l==="alone"?"Setting up…":"Use this PC on its own"})]}):s.jsx("button",{type:"button",className:"linkbtn",onClick:()=>c(!0),children:"No head office — set this PC up on its own"})})]})})}function Cc(){var p,v;const{data:e,error:t}=Ot(()=>$.live(),3e3),{data:n}=Ot(()=>$.pipelineStatus(),5e3),r=((p=e==null?void 0:e.stats)==null?void 0:p.cameras)??[],l=((v=e==null?void 0:e.stats)==null?void 0:v.gallery)??{},i=(e==null?void 0:e.events)??[],o=r.reduce((h,g)=>{var x,z;const w=(z=(x=g==null?void 0:g.pipeline)==null?void 0:x.best_quality)==null?void 0:z.fraction_below_gate;return typeof w=="number"&&w>h?w:h},0),a=r.filter(h=>h.connected).length,u=i.filter(h=>h.type==="person.new"||h.type==="person.seen"),c=gp(u[0]);return s.jsxs("div",{className:"page",children:[s.jsxs("header",{children:[s.jsx("h2",{children:"Live"}),s.jsx("p",{children:"Who is in the shop, and whether it is reaching head office."})]}),t&&s.jsxs("div",{className:"err",children:[s.jsx(Ue,{size:15}),t]}),s.jsx(vp,{pipe:n,cameras:r,up:a}),s.jsxs("div",{className:"panel arrivals-panel",children:[s.jsxs("div",{className:"panelhead",children:[s.jsx("h3",{children:"Who just walked in"}),u.length>0&&s.jsxs("span",{className:"note",children:[u.length," today"]})]}),s.jsx("div",{className:"panelbody flush",children:u.length===0?s.jsxs("div",{className:"empty",children:[s.jsx(Nc,{size:34}),s.jsx("b",{children:"Nobody yet"}),s.jsx("p",{children:"Customers appear here the moment a camera recognises a face."})]}):s.jsx("div",{className:"arrivals",children:u.slice(0,30).map((h,g)=>s.jsx(hp,{e:h,fresh:g===0&&c},`${h.ts}-${g}`))})})]}),s.jsxs("div",{className:"metrics",style:{marginTop:"var(--sp-4)"},children:[s.jsx(Er,{k:"People known",v:l.identities??"—"}),s.jsx(Er,{k:"Sightings",v:l.sightings??"—"}),s.jsx(Er,{k:"Cameras live",v:r.length?`${a}/${r.length}`:"—",tone:r.length?a===0?"bad":a.5?"bad":o>.2?"warn":"ok",s:o>.5?"Most visitors are being missed — move the camera":"Share of faces below the enrolment gate"})]})]})}function hp({e,fresh:t}){var o,a,u,c,p,v;const n=e.type==="person.new",r=((o=e.data)==null?void 0:o.label)||"Unrecognised",l=[(a=e.data)==null?void 0:a.gender,((u=e.data)==null?void 0:u.age)??((c=e.data)==null?void 0:c.age_range),(p=e.data)==null?void 0:p.emotion].filter(Boolean),i=typeof((v=e.data)==null?void 0:v.similarity)=="number"?e.data.similarity:null;return s.jsxs("article",{className:`arrival ${n?"is-new":"is-seen"} ${t?"fresh":""}`,children:[s.jsx("div",{className:"avatar",children:mp(r)}),s.jsxs("div",{className:"who",children:[s.jsx("div",{className:"name",children:r}),s.jsxs("div",{className:"meta",children:[e.camera_id,l.length>0&&s.jsxs(s.Fragment,{children:[" · ",l.join(", ")]}),i!==null&&!n&&s.jsxs(s.Fragment,{children:[" · match ",i.toFixed(2)]})]})]}),s.jsxs("div",{className:"right",children:[s.jsx("span",{className:`tag ${n?"new":"seen"}`,children:n?"new":"returning"}),s.jsx("span",{className:"when",children:rp(e.ts)})]})]})}function mp(e){var r;const t=/^Visitor (\d+)$/.exec(String(e).trim());if(t)return t[1];const n=String(e).trim().split(/\s+/).filter(Boolean);return n.length?(n[0][0]+(((r=n[1])==null?void 0:r[0])??"")).toUpperCase():"?"}function vp({pipe:e,cameras:t,up:n}){if(!e)return null;if(e.standalone)return s.jsxs("div",{className:"statusbar",children:[s.jsxs("span",{className:"item",children:[s.jsx("i",{className:"dot ok"}),s.jsx("b",{children:"Running on this PC only"})]}),s.jsx("span",{className:"sep"}),s.jsx("span",{className:"item note",children:"Recognition and customers stay here."}),s.jsx("span",{className:"grow"}),s.jsxs("span",{className:"item note",children:[s.jsx(ra,{size:14}),n," of ",t.length," cameras"]})]});const r=e.claimed&&!e.broker_up,l=e.claimed?e.broker_up?"ok":"bad":"idle",i=e.claimed?e.broker_up?"Sending to head office":"Offline — saving locally":"Not linked to head office";return s.jsxs("div",{className:"statusbar",children:[s.jsxs("span",{className:"item",children:[e.broker_up?s.jsx(up,{size:15}):s.jsx(kc,{size:15}),s.jsx("i",{className:`dot ${l}`}),s.jsx("b",{children:i})]}),s.jsx("span",{className:"sep"}),s.jsxs("span",{className:"item note",children:[e.accepted," recorded today"]}),e.queued>0&&s.jsxs("span",{className:`item note ${r?"warn":""}`,children:[e.queued," waiting to send"]}),e.dropped>0&&s.jsxs("span",{className:"item note bad",children:[s.jsx(Ue,{size:14}),e.dropped," lost — this PC was offline too long"]}),s.jsx("span",{className:"grow"}),s.jsxs("span",{className:"item note",children:[s.jsx(ra,{size:14}),n," of ",t.length," cameras"]})]})}function Er({k:e,v:t,s:n,tone:r}){return s.jsxs("div",{className:`metric ${r??""}`,children:[s.jsx("div",{className:"metric-k",children:e}),s.jsx("div",{className:"metric-v",children:t}),n&&s.jsx("div",{className:"metric-s",children:n})]})}function gp(e){const[t,n]=P.useState(!1),r=P.useRef(null);return P.useEffect(()=>{if(!e||e.ts===r.current)return;const l=r.current===null;if(r.current=e.ts,l)return;n(!0);const i=setTimeout(()=>n(!1),1200);return()=>clearTimeout(i)},[e==null?void 0:e.ts]),t}function yp(e){const[t,n]=P.useState(null);return P.useEffect(()=>{let r=!0;return n(null),$.visitorPhoto(e).then(l=>{r&&n(l)}).catch(()=>{r&&n({available:!1,reason:""})}),()=>{r=!1}},[e]),t}function xp({photo:e,name:t,customerRef:n,onBroken:r}){return e!=null&&e.available?s.jsx("img",{className:"avatar",src:e.url,alt:`Photo of ${t}`,onError:r}):s.jsx("div",{className:"avatar none",role:"img","aria-label":`No photo of ${t}`,children:s.jsx("span",{children:wp(t,n)})})}function wp(e,t){const n=/^Visitor (\d+)$/.exec(String(e||"").trim());if(n)return n[1];const r=/^V-(\d+)$/.exec(String(t||""));return r?r[1]:String(e||"").split(/\s+/).filter(Boolean).slice(0,2).map(l=>l[0].toUpperCase()).join("")||"?"}function jp({customer:e}){const{data:t,error:n,loading:r}=Ot(()=>$.visitorHistory(e.id,50),0,[e.id]);if(r)return s.jsx("p",{className:"note",children:"Loading visits…"});if(n)return s.jsxs("p",{className:"note",children:["Could not load visits: ",n]});const l=t??[];return l.length===0?s.jsx("p",{className:"note",children:"No recorded visits yet."}):s.jsx("ul",{className:"timeline",children:l.map(i=>s.jsxs("li",{children:[s.jsx("span",{className:"when",children:kp(i.occurred_at)}),s.jsxs("span",{className:"where",children:[i.site||"this store",i.camera_id?s.jsxs("span",{className:"note",children:[" · ",i.camera_id]}):null]}),i.is_new_visitor&&s.jsx("span",{className:"tag new",children:"first visit"})]},i.id))})}function kp(e){const t=new Date(e);return isNaN(t)?"—":t.toLocaleString([],{day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"})}function Sp({customer:e,onCancel:t,onDone:n}){const r=e.full_name||e.label,[l,i]=P.useState(""),[o,a]=P.useState(!1),[u,c]=P.useState(null),p=l.trim().toLowerCase()===r.trim().toLowerCase();async function v(){a(!0),c(null);try{await $.forgetCustomer(e.id),n()}catch(h){c(ye(h)),a(!1)}}return s.jsxs("div",{className:"confirm",children:[s.jsxs("h4",{children:["Erase ",r,"?"]}),s.jsxs("div",{className:"cols",children:[s.jsxs("div",{children:[s.jsx("p",{className:"lbl bad",children:"Deleted for good"}),s.jsxs("ul",{children:[s.jsx("li",{children:"Their face data — they will not be recognised again"}),s.jsx("li",{children:"Their photo"}),s.jsx("li",{children:"Their name, phone, email and notes"})]})]}),s.jsxs("div",{children:[s.jsx("p",{className:"lbl",children:"Kept"}),s.jsxs("ul",{children:[s.jsx("li",{children:"Past visits, with their name removed — your footfall figures do not change"}),s.jsx("li",{children:"The consent record, marked withdrawn, as proof of what was agreed"})]})]})]}),s.jsx("p",{className:"note",children:"This cannot be undone. If they come back they will be recorded as a new customer."}),u&&s.jsx("div",{className:"err",children:u}),s.jsxs("label",{className:"field",children:[s.jsxs("span",{children:["Type ",s.jsx("b",{children:r})," to confirm"]}),s.jsx("input",{value:l,onChange:h=>i(h.target.value),autoFocus:!0,autoComplete:"off",spellCheck:"false","aria-label":`Type ${r} to confirm erasure`})]}),s.jsxs("div",{className:"row",children:[s.jsx("button",{type:"button",className:"btn danger",disabled:!p||o,onClick:v,children:o?"Erasing…":"Erase permanently"}),s.jsx("button",{type:"button",className:"btn",onClick:t,disabled:o,children:"Cancel"})]})]})}function Np({customer:e,session:t,onClose:n,onSaved:r}){var N;const[l,i]=P.useState({full_name:e.full_name??"",phone:e.phone??"",email:e.email??"",gender:"",date_of_birth:"",notes:"",consent:e.has_consent??!1}),[o,a]=P.useState({amount:"",items:"",notes:""}),[u,c]=P.useState(!1),[p,v]=P.useState(null),[h,g]=P.useState(!1),[w,x]=P.useState(null),z=yp(e.id),f=w??z,d=(N=t==null?void 0:t.user)==null?void 0:N.role,m=["admin","owner","manager"].includes(d),y=S=>_=>i({...l,[S]:_.target.value});async function k(S){S.preventDefault(),c(!0),v(null);try{await $.saveProfile({visitor_id:e.id,...l});const _=parseFloat(o.amount);if(!isNaN(_)&&_>0){const V=o.items.split(",").map(M=>M.trim()).filter(Boolean);await $.recordPurchase(e.id,_,V,o.notes)}r()}catch(_){v(ye(_))}finally{c(!1)}}return s.jsx("div",{className:"drawer",onMouseDown:S=>S.target===S.currentTarget&&n(),children:s.jsxs("div",{className:"sheet",children:[s.jsxs("div",{className:"sheethead who",children:[s.jsx(xp,{photo:f,name:e.full_name||e.label,customerRef:e.ref,onBroken:()=>x({available:!1,reason:"The photo could not be loaded."})}),s.jsxs("div",{className:"grow",children:[s.jsx("h2",{children:e.full_name||e.label}),s.jsxs("p",{className:"note",children:[e.visit_count," visit",e.visit_count===1?"":"s",e.last_seen_at&&` · last seen ${new Date(e.last_seen_at).toLocaleDateString()}`,f&&!f.available&&f.reason&&` · ${f.reason}`]})]}),s.jsx("button",{type:"button",className:"close",onClick:n,"aria-label":"Close",children:"✕"})]}),s.jsxs("form",{className:"sheetbody",onSubmit:k,children:[p&&s.jsx("div",{className:"err",children:p}),s.jsxs("section",{className:"formsection",children:[s.jsx("h4",{children:"Customer details"}),s.jsxs("label",{className:"field",children:[s.jsx("span",{children:"Full name"}),s.jsx("input",{value:l.full_name,onChange:y("full_name"),autoFocus:!0})]}),s.jsxs("div",{className:"fieldrow",children:[s.jsxs("label",{className:"field",children:[s.jsx("span",{children:"Phone"}),s.jsx("input",{value:l.phone,onChange:y("phone"),inputMode:"tel"})]}),s.jsxs("label",{className:"field",children:[s.jsx("span",{children:"Email"}),s.jsx("input",{value:l.email,onChange:y("email"),type:"email"})]})]}),s.jsxs("div",{className:"fieldrow",children:[s.jsxs("label",{className:"field",children:[s.jsx("span",{children:"Gender"}),s.jsxs("select",{value:l.gender,onChange:y("gender"),children:[s.jsx("option",{value:"",children:"Not recorded"}),s.jsx("option",{children:"Female"}),s.jsx("option",{children:"Male"}),s.jsx("option",{children:"Other"})]})]}),s.jsxs("label",{className:"field",children:[s.jsx("span",{children:"Date of birth"}),s.jsx("input",{type:"date",value:l.date_of_birth,onChange:y("date_of_birth")})]})]}),s.jsxs("label",{className:"field",children:[s.jsx("span",{children:"Notes"}),s.jsx("textarea",{value:l.notes,onChange:y("notes"),placeholder:"Preferences, sizes, anything worth remembering"})]})]}),s.jsxs("section",{className:"formsection",children:[s.jsx("h4",{children:"Purchase (optional)"}),s.jsxs("div",{className:"fieldrow",children:[s.jsxs("label",{className:"field",children:[s.jsx("span",{children:"Amount"}),s.jsx("input",{value:o.amount,inputMode:"decimal",placeholder:"0.00",onChange:S=>a({...o,amount:S.target.value})})]}),s.jsxs("label",{className:"field",children:[s.jsx("span",{children:"Items"}),s.jsx("input",{value:o.items,placeholder:"shirt, belt",onChange:S=>a({...o,items:S.target.value})})]})]}),s.jsx("p",{className:"note",children:"Leave the amount blank if they did not buy anything — a visit without a sale is still worth recording."})]}),s.jsxs("section",{className:"formsection",children:[s.jsx("h4",{children:"Consent"}),s.jsxs("label",{style:{display:"flex",gap:10,alignItems:"flex-start",fontSize:13,cursor:"pointer"},children:[s.jsx("input",{type:"checkbox",checked:l.consent,style:{marginTop:3},onChange:S=>i({...l,consent:S.target.checked})}),s.jsx("span",{children:"This customer agreed to us keeping their details and recognising them on future visits."})]}),s.jsx("p",{className:"note",style:{marginTop:10},children:"Recorded with the date and who collected it. They can withdraw it at any time, which erases their face data."})]}),s.jsxs("section",{className:"formsection",children:[s.jsx("h4",{children:"Visits"}),s.jsx(jp,{customer:e})]}),s.jsxs("div",{className:"sheetactions",children:[s.jsx("button",{type:"button",className:"btn",onClick:n,children:"Cancel"}),s.jsx("button",{className:"btn primary",disabled:u,children:u?"Saving…":"Save"})]}),m&&s.jsxs("section",{className:"formsection dangerzone",children:[s.jsx("h4",{children:"At the customer's request"}),h?s.jsx(Sp,{customer:e,onCancel:()=>g(!1),onDone:r}):s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"note",children:"Erase this person's face data, photo and details. Their past visits stay in your footfall figures, without their name."}),s.jsx("button",{type:"button",className:"btn danger",onClick:()=>g(!0),children:"Erase this customer…"})]})]})]})]})})}function Cp({session:e}){const[t,n]=P.useState(""),[r,l]=P.useState(null),{data:i,error:o,reload:a}=Ot(()=>$.customers(t,200),3e4,[t]),u=i??[],c=u.filter(p=>p.has_profile).length;return s.jsxs("div",{className:"page",children:[s.jsxs("header",{className:"pagehead",children:[s.jsxs("div",{children:[s.jsx("h2",{children:"Customers"}),s.jsx("p",{children:"Everyone this business has recognised. Fill in details once and they are known at every store."})]}),s.jsxs("label",{className:"search",children:[s.jsx(op,{size:15}),s.jsx("input",{placeholder:"Search by name or phone",value:t,onChange:p=>n(p.target.value)})]})]}),o&&s.jsxs("div",{className:"err",children:[s.jsx(Ue,{size:15}),o]}),s.jsxs("div",{className:"metrics",style:{marginBottom:"var(--sp-4)"},children:[s.jsx(_r,{k:"Known people",v:u.length||"—"}),s.jsx(_r,{k:"With details",v:c||"—",s:u.length?`${Math.round(100*c/u.length)}% captured`:null}),s.jsx(_r,{k:"Returning",v:u.filter(p=>p.visit_count>1).length||"—"}),s.jsx(_r,{k:"With consent",v:u.filter(p=>p.has_consent).length||"—"})]}),s.jsx("div",{className:"panel",children:u.length===0?s.jsxs("div",{className:"empty tall",children:[s.jsx(Nc,{size:34}),s.jsx("b",{children:"No customers yet"}),s.jsx("p",{children:"They appear here the first time a camera recognises them. Click one to add a name and phone number."})]}):s.jsx("div",{className:"tablewrap",children:s.jsxs("table",{children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Customer"}),s.jsx("th",{children:"Phone"}),s.jsx("th",{className:"num",children:"Visits"}),s.jsx("th",{children:"First seen"}),s.jsx("th",{children:"Last seen"}),s.jsx("th",{children:"Details"})]})}),s.jsx("tbody",{children:u.map(p=>s.jsxs("tr",{className:"click",onClick:()=>l(p),children:[s.jsxs("td",{children:[p.full_name||s.jsx("span",{className:"note",children:p.label}),p.full_name&&p.ref&&s.jsxs("span",{className:"note",children:[" · ",p.ref]})]}),s.jsx("td",{className:"mono",children:p.phone||"—"}),s.jsx("td",{className:"num",children:p.visit_count}),s.jsx("td",{children:ta(p.first_seen_at)}),s.jsx("td",{children:ta(p.last_seen_at)}),s.jsx("td",{children:p.has_profile?s.jsxs("span",{className:"pill ok",children:[s.jsx("i",{className:"dot ok"}),"captured"]}):s.jsxs("span",{className:"pill warn",children:[s.jsx("i",{className:"dot warn"}),"needed"]})})]},p.id))})]})})}),r&&s.jsx(Np,{customer:r,session:e,onClose:()=>l(null),onSaved:()=>{l(null),a()}})]})}function _r({k:e,v:t,s:n}){return s.jsxs("div",{className:"metric",children:[s.jsx("div",{className:"metric-k",children:e}),s.jsx("div",{className:"metric-v",children:t}),n&&s.jsx("div",{className:"metric-s",children:n})]})}const ln=[{id:"hikvision",label:"Hikvision",path:"/Streaming/Channels/101",note:"Channel 1, main stream. Use /Streaming/Channels/102 for the lower-quality sub stream."},{id:"dahua",label:"Dahua",path:"/cam/realmonitor?channel=1&subtype=0",note:"Channel 1, main stream. subtype=1 is the sub stream."},{id:"cpplus",label:"CP Plus",path:"/cam/realmonitor?channel=1&subtype=0",note:"CP Plus cameras use the Dahua stream path."},{id:"uniview",label:"Uniview",path:"/media/video1",note:"Some older Uniview models use /video1 instead."},{id:"tplink",label:"TP-Link / Tapo",path:"/stream1",note:"Tapo cameras need a separate camera account created in the Tapo app — your Tapo login will not work."},{id:"reolink",label:"Reolink",path:"/h264Preview_01_main",note:"Use /h264Preview_01_sub for the lower-quality stream."},{id:"amcrest",label:"Amcrest",path:"/cam/realmonitor?channel=1&subtype=0",note:"Amcrest cameras use the Dahua stream path."},{id:"axis",label:"Axis",path:"/axis-media/media.amp",note:""},{id:"onvif",label:"Other (ONVIF)",path:"/onvif1",note:"Many generic cameras answer here. If it does not work, look for “RTSP” in the camera’s own app."},{id:"manual",label:"I know the path",path:"",note:""}],ia=e=>ln.find(t=>t.id===e)||ln[ln.length-1],Gi={id:"",host:"",port:554,path:"",username:"",password:"",max_width:1280};function Ep(){const{data:e,error:t,reload:n}=Ot(()=>$.cameras(),8e3),[r,l]=P.useState(null),[i,o]=P.useState(null),a=e??[],u=Pp(a);async function c(p){if(confirm(`Remove ${p.id}? Recognition from it stops immediately.`))try{await $.deleteCamera(p.id),n()}catch(v){alert(ye(v))}}return s.jsxs("div",{className:"page",children:[s.jsxs("header",{className:"pagehead",children:[s.jsxs("div",{children:[s.jsx("h2",{children:"Cameras"}),s.jsx("p",{children:"Add a camera, then prove it can see faces with a walk-past. Only then is it working."})]}),s.jsxs("button",{className:"btn primary",onClick:()=>l({...Gi}),children:[s.jsx(na,{size:15}),"Add camera"]})]}),t&&s.jsxs("div",{className:"err",children:[s.jsx(Ue,{size:15}),t]}),a.length===0?s.jsx("div",{className:"panel",children:s.jsxs("div",{className:"empty tall",children:[s.jsx(Sc,{size:40}),s.jsx("b",{children:"No cameras yet"}),s.jsx("p",{children:"Add the camera by its address. Most cameras print it on a label underneath, or show it in their own app."}),s.jsxs("button",{className:"btn primary",onClick:()=>l({...Gi}),children:[s.jsx(na,{size:15}),"Add your first camera"]})]})}):s.jsx("div",{className:"camgrid",children:a.map(p=>s.jsx(_p,{cam:p,stream:u[p.id],onEdit:()=>l(p),onCheck:()=>o(p.id),onRemove:()=>c(p)},p.id))}),r&&s.jsx(zp,{cam:r,onClose:()=>l(null),onSaved:()=>{l(null),n()}}),i&&s.jsx(Lp,{id:i,onClose:()=>o(null)})]})}function _p({cam:e,stream:t,onEdit:n,onCheck:r,onRemove:l}){const i=e.connected===void 0?{tone:"idle",label:"Engine stopped"}:e.connected?{tone:"ok",label:"Connected"}:{tone:"bad",label:"Not connecting"},{data:o}=Ot(()=>$.placementResult(e.id),15e3,[e.id]),a=!o||o.running||!o.verdict||o.verdict==="starting"?{tone:"miss",label:"Not yet proven",text:"Walk past it once and Behavision will tell you if the placement works."}:o.verdict==="good"?{tone:"seen",label:"Proven",text:o.headline||"Faces recognised on a walk-past."}:{tone:"miss",label:"Not proven",text:o.headline||"Move the camera and check again."};return s.jsxs("article",{className:"camcard",children:[s.jsxs("div",{className:"camview",children:[t?s.jsx("img",{src:t,alt:e.id}):s.jsx("div",{className:"placeholder",children:s.jsx(Sc,{size:34})}),s.jsxs("span",{className:`pill ${i.tone==="idle"?"":i.tone} over`,children:[s.jsx("i",{className:`dot ${i.tone}`}),i.label]})]}),s.jsxs("div",{className:"cambody",children:[s.jsxs("div",{className:"camtitle",children:[s.jsxs("div",{children:[s.jsx("h3",{children:e.id}),s.jsxs("span",{className:"mono note",children:[e.host||e.url,e.path?` · ${e.path}`:""]})]}),s.jsxs("div",{className:"camactions",children:[s.jsx("button",{className:"btn sm",onClick:n,children:"Edit"}),s.jsx("button",{className:"btn sm danger",onClick:l,children:"Remove"})]})]}),s.jsxs("div",{className:"camproof",children:[s.jsx("span",{className:`tag ${a.tone}`,children:a.label}),s.jsx("span",{className:"note",children:a.text}),s.jsxs("button",{className:`btn sm ${a.tone==="seen"?"":"primary"}`,onClick:r,children:[s.jsx(jc,{size:13}),a.tone==="seen"?"Check again":"Check placement"]})]})]})]})}function Pp(e){const[t,n]=P.useState({});return P.useEffect(()=>{let r=!0;const l=e.filter(i=>!(i.id in t));if(l.length)return(async()=>{const i={};for(const o of l)try{i[o.id]=await $.streamURL(o.id)}catch{i[o.id]=""}r&&n(o=>({...o,...i}))})(),()=>{r=!1}},[e.map(r=>r.id).join("|")]),t}function zp({cam:e,onClose:t,onSaved:n}){const r=!e.id,[l,i]=P.useState({...Gi,...e,password:"",path:e.path||(r?ln[0].path:"")}),[o,a]=P.useState(r?ln[0].id:"manual"),[u,c]=P.useState(null),[p,v]=P.useState(null),[h,g]=P.useState(null),w=y=>k=>i({...l,[y]:k.target.value});function x(y){const k=ia(y.target.value);a(k.id),i(N=>({...N,path:k.path||N.path}))}function z(){const y={};for(const[k,N]of Object.entries(l))N===""||N===null||N===void 0||(y[k]=k==="port"||k==="max_width"?Number(N):N);return y}async function f(){v("test"),g(null),c(null);try{c(await $.testCamera(z()))}catch(y){g(ye(y))}finally{v(null)}}async function d(y){y.preventDefault(),v("save"),g(null);try{await $.saveCamera(r?"":e.id,z()),n()}catch(k){g(ye(k))}finally{v(null)}}const m=ia(o);return s.jsx("div",{className:"drawer",onMouseDown:y=>y.target===y.currentTarget&&t(),children:s.jsxs("div",{className:"sheet",children:[s.jsxs("div",{className:"sheethead",children:[s.jsx("h2",{children:r?"Add a camera":`Edit ${e.id}`}),s.jsx("button",{className:"close",onClick:t,"aria-label":"Close",children:s.jsx(Hs,{size:16})})]}),s.jsxs("form",{className:"sheetbody",onSubmit:d,autoComplete:"off",children:[s.jsx("p",{className:"lead",children:"Three things from the camera: its address, its make, and its password. Test before you save — a wrong address is the most common mistake."}),h&&s.jsxs("div",{className:"err",children:[s.jsx(Ue,{size:15}),h]}),s.jsxs("section",{className:"formsection",children:[s.jsx("h4",{children:"The camera"}),r&&s.jsxs("label",{className:"field",children:[s.jsx("span",{children:"Name"}),s.jsx("input",{value:l.id,onChange:w("id"),placeholder:"entrance",required:!0,autoFocus:!0}),s.jsx("em",{className:"hint",children:"Short, no spaces. It names this camera everywhere and cannot be changed later."})]}),s.jsxs("div",{className:"fieldrow",children:[s.jsxs("label",{className:"field",children:[s.jsx("span",{children:"Address"}),s.jsx("input",{value:l.host,onChange:w("host"),placeholder:"192.168.1.20",inputMode:"decimal"}),s.jsx("em",{className:"hint",children:"On a label on the camera, or in its own app under “network”."})]}),s.jsxs("label",{className:"field narrow",children:[s.jsx("span",{children:"Port"}),s.jsx("input",{value:l.port,onChange:w("port"),inputMode:"numeric"})]})]})]}),s.jsxs("section",{className:"formsection",children:[s.jsx("h4",{children:"The stream"}),s.jsxs("label",{className:"field",children:[s.jsx("span",{children:"Make of camera"}),s.jsx("select",{value:o,onChange:x,children:ln.map(y=>s.jsx("option",{value:y.id,children:y.label},y.id))}),m.note&&s.jsx("em",{className:"hint",children:m.note})]}),s.jsxs("label",{className:"field",children:[s.jsx("span",{children:"Stream path"}),s.jsx("input",{className:"mono",value:l.path,onChange:w("path"),placeholder:"/Streaming/Channels/101"}),s.jsx("em",{className:"hint",children:"Filled in from the make. Change it only if the camera’s own app says something else."})]})]}),s.jsxs("section",{className:"formsection",children:[s.jsx("h4",{children:"Sign-in to the camera"}),s.jsxs("div",{className:"fieldrow",children:[s.jsxs("label",{className:"field",children:[s.jsx("span",{children:"Username"}),s.jsx("input",{name:"rtsp-account",autoComplete:"off",value:l.username,onChange:w("username"),placeholder:"admin"})]}),s.jsxs("label",{className:"field",children:[s.jsx("span",{children:"Password"}),s.jsx("input",{type:"password",name:"rtsp-secret",autoComplete:"new-password",value:l.password,onChange:w("password"),placeholder:e.has_password?"(unchanged)":""})]})]})]}),u&&(u.ok?s.jsxs("div",{className:"testresult ok",children:[s.jsx(wc,{size:16}),s.jsxs("div",{children:[s.jsxs("b",{children:["Connected — ",u.width,"×",u.height,u.codec?` · ${String(u.codec).toUpperCase()}`:""]}),u.snapshot&&s.jsx("img",{alt:"Camera preview",src:`data:image/jpeg;base64,${u.snapshot}`})]})]}):s.jsxs("div",{className:"testresult bad",children:[s.jsx(Ue,{size:16}),s.jsxs("div",{children:[s.jsx("b",{children:"Could not connect"}),s.jsx("span",{children:u.error})]})]})),s.jsxs("div",{className:"sheetactions",children:[s.jsx("button",{type:"button",className:"btn",onClick:f,disabled:!!p||!l.host,children:p==="test"?"Connecting…":"Test connection"}),s.jsx("button",{className:"btn primary",disabled:!!p||!l.id||!l.host,children:p==="save"?"Saving…":r?"Add camera":"Save changes"})]})]})]})})}function Lp({id:e,onClose:t}){var p,v;const[n,r]=P.useState({verdict:"starting",advice:[]}),[l,i]=P.useState(null),o=P.useRef(null);P.useEffect(()=>{let h=!0;return(async()=>{try{r(await $.startPlacement(e,25)),o.current=setInterval(async()=>{try{const g=await $.placementResult(e);if(!h)return;r(g),g.running||clearInterval(o.current)}catch(g){h&&i(ye(g))}},1e3)}catch(g){h&&i(ye(g))}})(),()=>{h=!1,clearInterval(o.current)}},[e]);const a={good:"ok",marginal:"warn",poor:"bad",artifact:"bad",no_faces:"warn",inconclusive:"warn",no_completed_passes:"warn"}[n.verdict],u=n.seconds?Math.min(100,n.elapsed/n.seconds*100):0,c=n.running||n.verdict==="starting";return s.jsx("div",{className:"drawer",onMouseDown:h=>h.target===h.currentTarget&&t(),children:s.jsxs("div",{className:"sheet",children:[s.jsxs("div",{className:"sheethead",children:[s.jsxs("h2",{children:["Check placement · ",e]}),s.jsx("button",{className:"close",onClick:t,"aria-label":"Close",children:s.jsx(Hs,{size:16})})]}),s.jsxs("div",{className:"sheetbody",children:[l&&s.jsxs("div",{className:"err",children:[s.jsx(Ue,{size:15}),l]}),s.jsxs("ol",{className:"steps",children:[s.jsxs("li",{className:c?"now":"done",children:[s.jsx("b",{children:"Walk past the camera"}),s.jsx("span",{children:"The way a customer would — in through the door, not looking at the lens. Two or three times, for about 25 seconds."}),c&&s.jsx("div",{className:"progress",children:s.jsx("div",{style:{width:`${u}%`}})})]}),s.jsxs("li",{className:c?"":"now",children:[s.jsx("b",{children:"Behavision judges what it saw"}),s.jsx("span",{children:"Not “were the frames sharp”, but “did a person walking past produce a face worth recognising”."})]})]}),s.jsxs("div",{className:`verdict ${a??""}`,children:[s.jsxs("div",{className:"verdict-head",children:[c?s.jsx("span",{className:"spinner"}):a==="ok"?s.jsx(wc,{size:18}):s.jsx(Ue,{size:18}),s.jsx("b",{children:n.headline||"Watching…"})]}),((p=n.advice)==null?void 0:p.length)>0&&s.jsx("ul",{children:n.advice.map((h,g)=>s.jsx("li",{children:h},g))}),((v=n.quality)==null?void 0:v.n)>0&&s.jsxs("p",{className:"note",children:[n.quality.n," face",n.quality.n===1?"":"s"," seen · median quality ",n.quality.p50," ·"," ",Math.round((n.quality.fraction_below_gate??0)*100),"% too poor to use"]})]}),!c&&s.jsxs("div",{className:"sheetactions",children:[s.jsx("button",{className:"btn",onClick:t,children:"Close"}),s.jsx("button",{className:"btn primary",onClick:()=>{r({verdict:"starting",advice:[]}),$.startPlacement(e,25).then(r).catch(h=>i(ye(h)))},children:"Run again"})]})]})]})})}const Tp=["Is my shop working right now?","How do I add my camera?","Why has nobody been recognised today?","Who came in this morning?"];function Mp({session:e,onClose:t}){const[n,r]=P.useState([]),[l,i]=P.useState(""),[o,a]=P.useState(!1),[u,c]=P.useState(null),p=P.useRef(null),v=e==null?void 0:e.standalone;P.useEffect(()=>{var g;(g=p.current)==null||g.scrollTo({top:1e9,behavior:"smooth"})},[n,o]);async function h(g){const w=(g??l).trim();if(!w||o)return;const x=[...n,{role:"user",text:w}];r(x),i(""),a(!0),c(null);try{const z=await $.ask(x.map(f=>({role:f.role,text:f.text})));r([...x,{role:"assistant",text:z.text,used:z.used??[]}])}catch(z){const f=ye(z);c(/session expired|unauthori[sz]ed/i.test(f)?"You’re signed out of head office, so I can’t look anything up. Sign in again and ask me once more.":f),r(n),i(w)}finally{a(!1)}}return s.jsxs("aside",{className:"helper",role:"dialog","aria-label":"Loya",children:[s.jsxs("header",{className:"helperhead",children:[s.jsx("img",{src:rn,alt:""}),s.jsxs("div",{children:[s.jsx("b",{children:"Loya"}),s.jsx("span",{children:"Your Behavision buddy — knows your cameras, your customers and your numbers."})]}),s.jsx("button",{className:"close",onClick:t,"aria-label":"Close",children:s.jsx(Hs,{size:16})})]}),s.jsxs("div",{className:"helperbody",ref:p,children:[v&&s.jsxs("div",{className:"helpernote",children:[s.jsx(kc,{size:16}),s.jsxs("div",{children:[s.jsx("b",{children:"This PC runs on its own"}),s.jsx("span",{children:"Loya lives at head office. Link this PC to a shop to talk to her; the basics are below."})]})]}),n.length===0&&s.jsxs("div",{className:"helperintro",children:[s.jsx("div",{className:"turn assistant",children:s.jsxs("div",{className:"bubble",children:[Rp(e)," Ask me anything about ",(e==null?void 0:e.site_name)||"this shop"," — what’s happening now, or how to set something up."]})}),s.jsx("div",{className:"chips",children:Tp.map(g=>s.jsx("button",{className:"chip",onClick:()=>h(g),disabled:o||v,children:g},g))}),v&&s.jsx(Dp,{})]}),n.map((g,w)=>{var x;return s.jsxs("div",{className:`turn ${g.role}`,children:[s.jsx("div",{className:"bubble",children:g.text}),((x=g.used)==null?void 0:x.length)>0&&s.jsxs("span",{className:"used",children:["Looked at: ",g.used.join(", ")]})]},w)}),o&&s.jsx("div",{className:"turn assistant",children:s.jsxs("div",{className:"bubble thinking",children:[s.jsx("span",{}),s.jsx("span",{}),s.jsx("span",{})]})}),u&&s.jsxs("div",{className:"err",children:[s.jsx(Ue,{size:15}),u]})]}),s.jsxs("form",{className:"helperask",onSubmit:g=>{g.preventDefault(),h()},children:[s.jsx("input",{value:l,onChange:g=>i(g.target.value),disabled:o||v,placeholder:v?"Link this PC to head office to talk to Loya":"Ask Loya…"}),s.jsx("button",{className:"btn primary",disabled:o||v||!l.trim(),"aria-label":"Ask",children:s.jsx(fp,{size:16})})]})]})}function Rp(e){var l,i;const t=new Date().getHours(),n=t<12?"Morning":t<17?"Afternoon":"Evening",r=(i=(l=e==null?void 0:e.user)==null?void 0:l.full_name)==null?void 0:i.split(" ")[0];return r?`${n}, ${r}.`:`${n}.`}function Dp(){return s.jsxs("dl",{className:"quickhelp",children:[s.jsx("dt",{children:"Adding a camera"}),s.jsx("dd",{children:"Cameras → Add camera. The address is on a label on the camera; pick the make and the stream path fills itself in. Test, then save."}),s.jsx("dt",{children:"Proving it works"}),s.jsx("dd",{children:"Press Check placement and walk past the camera like a customer for 25 seconds. Only “good” means it can recognise faces — otherwise move it to head height, facing the way people approach."}),s.jsx("dt",{children:"Nothing showing on Live"}),s.jsx("dd",{children:"Check the camera is Connected and Proven. A camera aimed from above or the side streams fine and recognises nobody."}),s.jsx("dt",{children:"Linking to head office later"}),s.jsx("dd",{children:"Use the link button at the bottom of the sidebar and type an installation code from head office. Nothing recorded here is lost."})]})}const Op=[{id:"live",label:"Live",Glyph:lp,View:Cc},{id:"customers",label:"Customers",Glyph:ip,View:Cp,cloud:!0},{id:"cameras",label:"Cameras",Glyph:sp,View:Ep}];function Fp(){var h,g,w;const[e,t]=P.useState(null),[n,r]=P.useState("live"),[l,i]=P.useState(!0),[o,a]=P.useState(!1),[u,c]=P.useState(!1);if(P.useEffect(()=>{let x=!0;const z=async()=>{try{const d=await $.session();x&&t(m=>JSON.stringify(m)===JSON.stringify(d)?m:d)}catch{x&&t(null)}x&&i(!1)};z();const f=setInterval(z,8e3);return()=>{x=!1,clearInterval(f)}},[]),!np())return s.jsx("div",{className:"login",children:s.jsxs("div",{className:"box",children:[s.jsx("span",{className:"mark",children:s.jsx("img",{src:rn,alt:""})}),s.jsx("h1",{children:"Behavision"}),s.jsx("p",{className:"lead",children:"This is the Behavision window running outside the app, so it has no connection to the recognition engine. Launch the Behavision application instead."})]})});if(l)return s.jsx("div",{className:"login",children:s.jsx("p",{className:"note",children:"Starting…"})});if(!(e!=null&&e.claimed)&&!(e!=null&&e.standalone))return s.jsx(la,{onDone:t});if(!(e!=null&&e.standalone)&&!(e!=null&&e.logged_in))return s.jsx(pp,{onDone:t});const p=Op.filter(x=>!x.cloud||!e.standalone),v=((h=p.find(x=>x.id===n))==null?void 0:h.View)??Cc;return o?s.jsx(la,{onDone:x=>{a(!1),t(x)},onCancel:()=>a(!1)}):s.jsxs("div",{className:"shell",children:[s.jsxs("aside",{className:"side",children:[s.jsxs("div",{className:"brand",children:[s.jsx("span",{className:"mark",children:s.jsx("img",{src:rn,alt:""})}),s.jsxs("div",{className:"id",children:[s.jsx("h1",{children:"Behavision"}),s.jsx("p",{children:e.site_name||((g=e.user)==null?void 0:g.client_name)||"This shop"})]})]}),s.jsx("nav",{className:"nav",children:p.map(({id:x,label:z,Glyph:f})=>s.jsxs("button",{onClick:()=>r(x),"aria-current":x===n?"page":void 0,children:[s.jsx(f,{size:17}),z]},x))}),s.jsx(Ip,{}),s.jsx("div",{className:"who",children:e.standalone?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"id",children:[s.jsx("b",{children:"On its own"}),s.jsx("span",{children:"No head office"})]}),s.jsx("button",{className:"btn sm icon",title:"Link to head office",onClick:()=>a(!0),children:s.jsx(cp,{size:15})})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"id",children:[s.jsx("b",{children:"Signed in"}),s.jsx("span",{children:(w=e.user)==null?void 0:w.email})]}),s.jsx("button",{className:"btn sm icon",title:"Sign out",onClick:async()=>t(await $.logout()),children:s.jsx(dp,{size:15})})]})})]}),s.jsxs("main",{className:"main",children:[s.jsx(v,{session:e}),!u&&s.jsxs("button",{className:"loya-fab",onClick:()=>c(!0),"aria-label":"Ask Loya",title:"Ask Loya",children:[s.jsx("img",{src:rn,alt:""}),s.jsx("span",{children:"Loya"})]})]}),u&&s.jsx(Mp,{session:e,onClose:()=>c(!1)})]})}function Ip(){const{data:e,reload:t}=Ot(()=>$.engineStatus(),5e3),[n,r]=P.useState(!1),l=e??{state:"stopped"},i=P.useCallback(async v=>{r(!0);try{await v()}catch(h){alert(ye(h))}finally{r(!1),t()}},[t]),o=l.state==="running",a=Object.values(l.cameras??{}),u=a.filter(Boolean).length;let c="idle",p="Stopped";return!o&&l.reachable?(c="warn",p="Running outside the app"):l.state==="failed"||l.state==="backoff"?(c="bad",p="Not running"):o&&!l.reachable?(c="warn",p="Starting…"):o&&a.length===0?(c="warn",p="No cameras"):o&&u===0?(c="bad",p="No camera connected"):o&&ui($.startEngine),children:[s.jsx(jc,{size:13}),"Start"]}),s.jsxs("button",{className:"btn sm",disabled:n||!o,onClick:()=>i($.stopEngine),children:[s.jsx(ap,{size:13}),"Stop"]})]})]})}yc(document.getElementById("root")).render(s.jsx(Hc.StrictMode,{children:s.jsx(Fp,{})})); diff --git a/desktop/frontend/dist/assets/index-Z_jL3Bie.css b/desktop/frontend/dist/assets/index-CGAmTH1J.css similarity index 96% rename from desktop/frontend/dist/assets/index-Z_jL3Bie.css rename to desktop/frontend/dist/assets/index-CGAmTH1J.css index 1e4b09c..67fd711 100644 --- a/desktop/frontend/dist/assets/index-Z_jL3Bie.css +++ b/desktop/frontend/dist/assets/index-CGAmTH1J.css @@ -1 +1 @@ -:root{--bg: #0A0F13;--s1: #111A20;--s2: #17232B;--s3: #1E2D37;--line: #223038;--line-2: #1A252C;--ink: #ECF3F7;--ink-2: #A3B6C2;--ink-3: #6C808D;--accent: #40C4DC;--accent-2: #0F3B47;--accent-3: #0B2A33;--ok: #48C78E;--ok-2: #102E22;--warn: #EAAA3D;--warn-2: #31260F;--bad: #EC6A5C;--bad-2: #331815;--r-sm: 6px;--r: 10px;--r-lg: 14px;--sp-1: 4px;--sp-2: 8px;--sp-3: 12px;--sp-4: 16px;--sp-5: 20px;--sp-6: 24px;--sp-7: 32px;--sp-8: 40px;--shadow: 0 1px 2px rgb(0 0 0 / .4), 0 8px 24px -12px rgb(0 0 0 / .6);--shadow-lg: 0 2px 4px rgb(0 0 0 / .4), 0 24px 48px -16px rgb(0 0 0 / .7);--font: "Segoe UI Variable Text", "Segoe UI", Inter, -apple-system, BlinkMacSystemFont, system-ui, "Helvetica Neue", Arial, sans-serif;--font-display: "Segoe UI Variable Display", var(--font);--mono: "Cascadia Mono", "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;--ground: var(--bg);--surface: var(--s1);--surface-2: var(--s2);--line-soft: var(--line-2);--muted: var(--ink-3);--radius: var(--r);--accent-dim: var(--accent-3)}*{box-sizing:border-box;margin:0}html,body,#root{height:100%}body{background:var(--bg);color:var(--ink);font-family:var(--font);font-size:14px;line-height:1.5;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;overflow:hidden;-webkit-user-select:none;user-select:none}button,input,select,textarea{font:inherit;color:inherit}input,textarea{-webkit-user-select:text;user-select:text}:focus-visible{outline:2px solid var(--accent);outline-offset:2px;border-radius:3px}::selection{background:var(--accent-2);color:var(--ink)}.num,.value,.metric-v,.when,.mono,.code,td{font-variant-numeric:tabular-nums}.mono,.code{font-family:var(--mono)}*{scrollbar-width:thin;scrollbar-color:var(--s3) transparent}*::-webkit-scrollbar{width:10px;height:10px}*::-webkit-scrollbar-track{background:transparent}*::-webkit-scrollbar-thumb{background:var(--s3);border-radius:99px;border:3px solid var(--bg)}*::-webkit-scrollbar-thumb:hover{background:#2a3d49}.shell{display:grid;grid-template-columns:232px 1fr auto;height:100%}.side{background:var(--s1);border-right:1px solid var(--line);display:flex;flex-direction:column;min-height:0}.side .brand{display:flex;align-items:center;gap:var(--sp-3);padding:var(--sp-5) var(--sp-5) var(--sp-4)}.side .brand .mark{width:30px;height:30px;flex:none;display:grid;place-items:center}.side .brand .mark img,.login .mark img{width:100%;height:100%;object-fit:contain;display:block}.side .brand .id{min-width:0}.side .brand h1{font-family:var(--font-display);font-size:15px;font-weight:600;letter-spacing:-.012em;line-height:1.2}.side .brand p{font-size:11.5px;color:var(--ink-3);margin-top:1px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.nav{padding:var(--sp-2) var(--sp-3);display:flex;flex-direction:column;gap:2px;flex:1}.nav button{position:relative;display:flex;align-items:center;gap:var(--sp-3);width:100%;background:none;border:0;border-radius:var(--r-sm);padding:9px var(--sp-3);color:var(--ink-2);cursor:pointer;text-align:left;font-size:13.5px;font-weight:450;transition:background .12s ease,color .12s ease}.nav button svg{flex:none;opacity:.9}.nav button:hover{background:var(--s2);color:var(--ink)}.nav button[aria-current=page]{background:var(--accent-3);color:var(--accent);font-weight:550}.nav button[aria-current=page]:before{content:"";position:absolute;left:-12px;top:7px;bottom:7px;width:2.5px;border-radius:0 2px 2px 0;background:var(--accent)}.enginebox{margin:var(--sp-3);padding:var(--sp-3) var(--sp-4) var(--sp-4);border:1px solid var(--line);border-radius:var(--r);background:var(--s2)}.enginebox .row{display:flex;align-items:center;gap:var(--sp-2)}.enginebox .state{font-size:12.5px;font-weight:600;letter-spacing:-.005em}.enginebox .label{display:block;color:var(--ink-3);font-size:11px;line-height:1.45;margin-top:3px;font-variant-numeric:tabular-nums}.enginebox .actions,.enginebox .controls{display:flex;gap:var(--sp-2);margin-top:var(--sp-3)}.enginebox .actions .btn,.enginebox .controls .btn{flex:1;justify-content:center;padding:6px 8px;font-size:12px}.side .who{padding:var(--sp-3) var(--sp-5) var(--sp-5);border-top:1px solid var(--line-2);display:flex;align-items:center;gap:var(--sp-3)}.side .who .id{min-width:0;flex:1}.side .who .id b{display:block;font-size:12.5px;font-weight:550}.side .who .id span{display:block;font-size:11px;color:var(--ink-3);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.main{min-width:0;min-height:0;overflow:auto;position:relative}.page{padding:var(--sp-6) var(--sp-7) var(--sp-8);max-width:1500px}.page>header{margin-bottom:var(--sp-5)}.page>header h2,.page h2{font-family:var(--font-display);font-size:22px;font-weight:600;letter-spacing:-.02em;line-height:1.2}.page>header p,.page header p{color:var(--ink-3);font-size:13px;margin-top:3px}.pagehead{display:flex;align-items:flex-start;justify-content:space-between;gap:var(--sp-4);margin-bottom:var(--sp-5);flex-wrap:wrap}h3{font-size:11px;font-weight:600;letter-spacing:.085em;text-transform:uppercase;color:var(--ink-3)}.card{background:var(--s1);border:1px solid var(--line);border-radius:var(--r);padding:var(--sp-4)}.card>h3{margin-bottom:var(--sp-3)}.card.flush{padding:0;overflow:hidden}.panel{background:var(--s1);border:1px solid var(--line);border-radius:var(--r-lg);overflow:hidden;display:flex;flex-direction:column;min-height:0}.panel>.panelhead{display:flex;align-items:center;justify-content:space-between;gap:var(--sp-3);padding:var(--sp-3) var(--sp-4);border-bottom:1px solid var(--line-2);background:linear-gradient(var(--s2),var(--s1));flex:none}.panel>.panelhead h3{margin:0}.panel>.panelbody{padding:var(--sp-4);min-height:0;overflow:auto}.panel>.panelbody.flush{padding:0}.grid{display:grid;gap:var(--sp-4)}.cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}@media (max-width: 1180px){.cols-4{grid-template-columns:repeat(2,minmax(0,1fr))}}@media (max-width: 980px){.cols-2,.cols-3{grid-template-columns:minmax(0,1fr)}}.metrics{display:grid;grid-template-columns:repeat(auto-fit,minmax(152px,1fr));gap:1px;background:var(--line);border:1px solid var(--line);border-radius:var(--r);overflow:hidden}.metric{background:var(--s1);padding:var(--sp-3) var(--sp-4) var(--sp-4)}.metric .metric-k{font-size:10.5px;font-weight:600;letter-spacing:.085em;text-transform:uppercase;color:var(--ink-3)}.metric .metric-v{font-family:var(--font-display);font-size:26px;font-weight:600;letter-spacing:-.025em;line-height:1.1;margin-top:5px}.metric .metric-s{font-size:11.5px;color:var(--ink-3);margin-top:3px;line-height:1.4}.metric.ok .metric-v{color:var(--ok)}.metric.warn .metric-v{color:var(--warn)}.metric.bad .metric-v{color:var(--bad)}.stat h3{margin-bottom:var(--sp-2)}.stat .value{font-family:var(--font-display);font-size:26px;font-weight:600;letter-spacing:-.025em;line-height:1.1}.stat .unit{font-size:15px;color:var(--ink-3);margin-left:3px}.stat .sub{font-size:11.5px;color:var(--ink-3);margin-top:4px;line-height:1.4}.dot{width:7px;height:7px;border-radius:99px;flex:none;background:var(--ink-3)}.dot.ok{background:var(--ok);box-shadow:0 0 0 3px color-mix(in srgb,var(--ok) 18%,transparent)}.dot.warn{background:var(--warn);box-shadow:0 0 0 3px color-mix(in srgb,var(--warn) 18%,transparent)}.dot.bad{background:var(--bad);box-shadow:0 0 0 3px color-mix(in srgb,var(--bad) 18%,transparent)}.dot.idle{background:var(--ink-3)}.dot.live{background:var(--ok);animation:pulse 2.4s ease-in-out infinite}@keyframes pulse{0%,to{box-shadow:0 0 color-mix(in srgb,var(--ok) 55%,transparent)}70%{box-shadow:0 0 0 6px color-mix(in srgb,var(--ok) 0%,transparent)}}.pill{display:inline-flex;align-items:center;gap:6px;padding:3px 9px 3px 7px;border-radius:99px;font-size:11px;font-weight:600;letter-spacing:.02em;background:var(--s3);color:var(--ink-2);border:1px solid var(--line);white-space:nowrap}.pill.ok{background:var(--ok-2);color:var(--ok);border-color:color-mix(in srgb,var(--ok) 28%,transparent)}.pill.warn{background:var(--warn-2);color:var(--warn);border-color:color-mix(in srgb,var(--warn) 28%,transparent)}.pill.bad{background:var(--bad-2);color:var(--bad);border-color:color-mix(in srgb,var(--bad) 28%,transparent)}.pill.accent{background:var(--accent-3);color:var(--accent);border-color:color-mix(in srgb,var(--accent) 30%,transparent)}.tag{display:inline-flex;align-items:center;padding:2px 7px;border-radius:var(--r-sm);font-size:10.5px;font-weight:600;letter-spacing:.04em;text-transform:uppercase;background:var(--s3);color:var(--ink-2)}.tag.new{background:var(--accent-3);color:var(--accent)}.tag.seen{background:var(--ok-2);color:var(--ok)}.tag.miss{background:var(--warn-2);color:var(--warn)}.statusbar{display:flex;align-items:center;gap:var(--sp-5);flex-wrap:wrap;padding:var(--sp-3) var(--sp-4);background:var(--s1);border:1px solid var(--line);border-radius:var(--r);margin-bottom:var(--sp-4)}.statusbar .item{display:flex;align-items:center;gap:var(--sp-2);font-size:12.5px}.statusbar .item b{font-weight:600;letter-spacing:-.005em}.statusbar .item svg{color:var(--ink-3)}.statusbar .sep{width:1px;align-self:stretch;background:var(--line)}.statusbar .grow{flex:1}.arrivals{display:flex;flex-direction:column;gap:var(--sp-2);padding:var(--sp-3)}.arrival{display:grid;grid-template-columns:46px 1fr auto;gap:var(--sp-3);align-items:center;padding:var(--sp-3);border-radius:var(--r);background:var(--s2);border:1px solid var(--line-2);position:relative;overflow:hidden}.arrival:before{content:"";position:absolute;left:0;top:0;bottom:0;width:2.5px;background:var(--ink-3)}.arrival.is-new:before{background:var(--accent)}.arrival.is-seen:before{background:var(--ok)}.arrival.is-miss:before{background:var(--warn)}.arrival.fresh{animation:slidein .28s cubic-bezier(.2,.8,.3,1)}@keyframes slidein{0%{opacity:0;transform:translateY(-6px)}to{opacity:1;transform:none}}.arrival .avatar{width:46px;height:46px;border-radius:var(--r-sm);display:grid;place-items:center;overflow:hidden;background:var(--s3);border:1px solid var(--line);font-family:var(--font-display);font-size:15px;font-weight:600;color:var(--ink-2);letter-spacing:-.01em;font-variant-numeric:tabular-nums}.arrival .avatar img{width:100%;height:100%;object-fit:cover}.arrival.is-new .avatar{background:var(--accent-3);color:var(--accent);border-color:color-mix(in srgb,var(--accent) 25%,transparent)}.arrival .who{min-width:0}.arrival .who .name{font-size:14.5px;font-weight:600;letter-spacing:-.01em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.arrival .who .meta{font-size:11.5px;color:var(--ink-3);margin-top:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.arrival .right{text-align:right;display:flex;flex-direction:column;align-items:flex-end;gap:5px}.arrival .right .when{font-size:11.5px;color:var(--ink-3)}.feeds{display:grid;gap:var(--sp-3);grid-template-columns:repeat(auto-fit,minmax(300px,1fr));padding:var(--sp-3)}.feed{position:relative;border-radius:var(--r);overflow:hidden;background:#05090c;border:1px solid var(--line);aspect-ratio:16 / 9}.feed img{width:100%;height:100%;object-fit:cover;display:block}.feed .placeholder{width:100%;height:100%;display:grid;place-items:center;color:var(--ink-3)}.feed .cap{position:absolute;left:0;right:0;bottom:0;display:flex;align-items:center;justify-content:space-between;gap:var(--sp-2);padding:var(--sp-5) var(--sp-3) var(--sp-3);background:linear-gradient(transparent,#000c);font-size:12.5px;font-weight:600;letter-spacing:-.005em}.events,.timeline{list-style:none;padding:0;display:flex;flex-direction:column}.events li{display:flex;align-items:center;gap:var(--sp-3);padding:9px var(--sp-4);border-bottom:1px solid var(--line-2);font-size:13px}.timeline li{display:flex;align-items:center;gap:var(--sp-3);padding:9px 0;border-bottom:1px solid var(--line-2);font-size:13px}.events li:last-child,.timeline li:last-child{border-bottom:0}.events .when,.timeline .when{font-size:11.5px;color:var(--ink-3);width:46px;flex:none}.empty{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--sp-3);padding:var(--sp-8) var(--sp-5);color:var(--ink-3);text-align:center;font-size:12.5px}.empty svg{opacity:.35}.empty b{display:block;color:var(--ink-2);font-size:13.5px;font-weight:550}.empty p{max-width:34ch;line-height:1.5}.tablewrap{overflow:auto}table{border-collapse:collapse;width:100%;font-size:13px}th{text-align:left;padding:9px var(--sp-4);font-size:10.5px;font-weight:600;letter-spacing:.085em;text-transform:uppercase;color:var(--ink-3);background:var(--s2);border-bottom:1px solid var(--line);position:sticky;top:0;z-index:1}td{padding:10px var(--sp-4);border-bottom:1px solid var(--line-2)}tbody tr:last-child td{border-bottom:0}tbody tr[role=button],tbody tr.clickable{cursor:pointer}tbody tr[role=button]:hover,tbody tr.clickable:hover{background:var(--s2)}.btn{display:inline-flex;align-items:center;gap:7px;padding:8px 14px;border-radius:var(--r-sm);background:var(--s3);color:var(--ink);border:1px solid var(--line);cursor:pointer;font-size:13px;font-weight:550;letter-spacing:-.005em;white-space:nowrap;transition:background .12s ease,border-color .12s ease,transform .06s ease}.btn:hover:not(:disabled){background:#253643;border-color:#2e414e}.btn:active:not(:disabled){transform:translateY(.5px)}.btn:disabled{opacity:.45;cursor:not-allowed}.btn svg{flex:none}.btn.primary{background:var(--accent);color:#04171c;border-color:transparent;font-weight:600}.btn.primary:hover:not(:disabled){background:#55d0e6}.btn.danger{background:var(--bad-2);color:var(--bad);border-color:color-mix(in srgb,var(--bad) 32%,transparent)}.btn.danger:hover:not(:disabled){background:#43201c}.btn.ghost{background:transparent}.btn.ghost:hover:not(:disabled){background:var(--s2)}.btn.sm{padding:5px 10px;font-size:12px}.btn.icon{padding:7px}.linkbtn{background:none;border:0;color:var(--accent);cursor:pointer;font-size:12.5px;padding:2px 0;text-align:left}.linkbtn:hover{text-decoration:underline}.seg{display:inline-flex;background:var(--s2);border:1px solid var(--line);border-radius:var(--r-sm);padding:2px;gap:2px}.seg button{background:none;border:0;border-radius:4px;padding:5px 11px;color:var(--ink-3);cursor:pointer;font-size:12.5px;font-weight:500}.seg button[aria-pressed=true]{background:var(--s3);color:var(--ink)}.field{display:block;margin-bottom:var(--sp-4)}.field>span{display:block;font-size:11.5px;font-weight:550;color:var(--ink-2);margin-bottom:6px}.field input,.field select,.field textarea{width:100%;padding:9px 11px;background:var(--s2);color:var(--ink);border:1px solid var(--line);border-radius:var(--r-sm);transition:border-color .12s ease,background .12s ease,box-shadow .12s ease}.field input::placeholder{color:var(--ink-3)}.field input:hover,.field select:hover,.field textarea:hover{border-color:#2c3d49}.field input:focus,.field select:focus,.field textarea:focus{outline:none;border-color:var(--accent);background:var(--s1);box-shadow:0 0 0 3px var(--accent-3)}.field .hint{display:block;font-size:11.5px;color:var(--ink-3);margin-top:5px;line-height:1.45}.fieldrow{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:var(--sp-3)}.fieldrow.three{grid-template-columns:repeat(3,minmax(0,1fr))}.err{display:flex;align-items:flex-start;gap:var(--sp-2);background:var(--bad-2);color:var(--bad);border:1px solid color-mix(in srgb,var(--bad) 30%,transparent);border-radius:var(--r-sm);padding:9px 11px;font-size:12.5px;line-height:1.45;margin-bottom:var(--sp-4)}.err svg{flex:none;margin-top:1px}.note{color:var(--ink-3);font-size:12px;line-height:1.5}.note.warn{color:var(--warn)}.note.bad{color:var(--bad)}.lead{color:var(--ink-2);font-size:13.5px;line-height:1.55}.sm{font-size:12px}.lbl,.key{color:var(--ink-3);font-size:11.5px}.grow{flex:1}.row{display:flex;align-items:center;gap:var(--sp-3)}.login{height:100%;display:grid;place-items:center;padding:var(--sp-6);overflow:auto;background:radial-gradient(900px 480px at 50% -10%,#10303A 0%,transparent 62%),var(--bg)}.login .box{width:100%;max-width:396px;background:var(--s1);border:1px solid var(--line);border-radius:var(--r-lg);padding:var(--sp-7);box-shadow:var(--shadow-lg)}.login .mark{width:44px;height:44px;margin-bottom:var(--sp-4);display:grid;place-items:center}.login h1{font-family:var(--font-display);font-size:21px;font-weight:600;letter-spacing:-.022em}.login .lead{margin:6px 0 var(--sp-5)}.login .btn{width:100%;justify-content:center;margin-top:var(--sp-1)}.login .foot{font-size:11.5px;color:var(--ink-3);line-height:1.55;margin-top:var(--sp-5);padding-top:var(--sp-4);border-top:1px solid var(--line-2)}.login .alt{margin-top:var(--sp-4);display:flex;flex-direction:column;gap:var(--sp-3)}.login .alt .btn{margin-top:0}.login .note{margin:0}.drawer{position:fixed;top:0;right:0;bottom:0;left:0;z-index:40;background:#04080b99;display:flex;justify-content:flex-end;animation:fade .16s ease}@keyframes fade{0%{opacity:0}to{opacity:1}}.drawer .sheet{width:min(540px,100%);height:100%;overflow:auto;background:var(--s1);border-left:1px solid var(--line);box-shadow:var(--shadow-lg);animation:slidein-r .2s cubic-bezier(.2,.8,.3,1)}@keyframes slidein-r{0%{transform:translate(16px);opacity:.6}to{transform:none;opacity:1}}.drawer .sheethead{position:sticky;top:0;z-index:1;display:flex;align-items:center;justify-content:space-between;gap:var(--sp-3);padding:var(--sp-4) var(--sp-5);background:var(--s1);border-bottom:1px solid var(--line)}.drawer .sheethead h2{font-family:var(--font-display);font-size:17px;font-weight:600;letter-spacing:-.015em}.drawer .sheetbody{padding:var(--sp-5)}.drawer .close{background:none;border:0;color:var(--ink-3);cursor:pointer;padding:6px;border-radius:var(--r-sm);display:grid;place-items:center}.drawer .close:hover{background:var(--s2);color:var(--ink)}.avatar{width:44px;height:44px;border-radius:var(--r-sm);flex:none;display:grid;place-items:center;overflow:hidden;background:var(--s3);border:1px solid var(--line);font-weight:600;color:var(--ink-2);font-variant-numeric:tabular-nums}.avatar img{width:100%;height:100%;object-fit:cover}@media (prefers-reduced-motion: reduce){*,*:before,*:after{animation:none!important;transition:none!important}}.live-split{display:grid;gap:var(--sp-4);grid-template-columns:minmax(0,1.35fr) minmax(0,1fr);align-items:stretch;min-height:420px}.live-split>.panel{max-height:62vh}@media (max-width: 1100px){.live-split{grid-template-columns:minmax(0,1fr)}.live-split>.panel{max-height:none}}.arrivals-panel{max-height:64vh;margin-bottom:var(--sp-4)}.arrivals-panel .arrivals{display:grid;grid-template-columns:repeat(auto-fill,minmax(340px,1fr));gap:var(--sp-2)}.pagehead{display:flex;justify-content:space-between;align-items:flex-end;gap:var(--sp-4)}.page>header.pagehead{margin-bottom:var(--sp-5)}.camgrid{display:grid;gap:var(--sp-4);grid-template-columns:repeat(auto-fill,minmax(440px,1fr))}.camcard{background:var(--s1);border:1px solid var(--line);border-radius:var(--r-lg);overflow:hidden;display:flex;flex-direction:column}.camview{position:relative;aspect-ratio:16 / 9;background:#05090c}.camview img{width:100%;height:100%;object-fit:cover;display:block}.camview .placeholder{width:100%;height:100%;display:grid;place-items:center;color:var(--ink-3)}.camview .pill.over{position:absolute;top:10px;right:10px;-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px)}.cambody{padding:var(--sp-4);display:flex;flex-direction:column;gap:var(--sp-3)}.camtitle{display:flex;justify-content:space-between;align-items:flex-start;gap:var(--sp-3)}.camtitle h3{font-family:var(--font-display);font-size:16px;font-weight:600;letter-spacing:-.012em;text-transform:none;color:var(--ink);margin:0 0 2px}.camtitle .note{font-size:12px}.camactions{display:flex;gap:6px;flex:none}.camproof{display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:var(--sp-3);padding:var(--sp-3);border-radius:var(--r);background:var(--s2);border:1px solid var(--line-2)}.camproof .note{font-size:12px;line-height:1.45}@media (max-width: 640px){.camproof{grid-template-columns:1fr}}.empty.tall{padding:var(--sp-8) var(--sp-6)}.empty.tall .btn{margin-top:var(--sp-3)}.drawer .sheet{width:min(600px,100%)}.sheetbody .lead{color:var(--ink-2);font-size:13.5px;line-height:1.55;margin-bottom:var(--sp-5)}.formsection{margin-bottom:var(--sp-5)}.formsection h4{font-size:11px;font-weight:600;letter-spacing:.09em;text-transform:uppercase;color:var(--ink-3);margin:0 0 var(--sp-3);padding-bottom:6px;border-bottom:1px solid var(--line-2)}.field .hint{font-style:normal}.fieldrow{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}.fieldrow .field.narrow{max-width:140px}.fieldrow:has(.field.narrow){grid-template-columns:minmax(0,1fr) 140px}.field input.mono{font-family:var(--font-mono);font-size:12.5px}.sheetactions{display:flex;gap:var(--sp-2);justify-content:flex-end;padding-top:var(--sp-4);border-top:1px solid var(--line-2);margin-top:var(--sp-2)}.testresult{display:flex;gap:var(--sp-3);align-items:flex-start;padding:var(--sp-3) var(--sp-4);border-radius:var(--r);margin-bottom:var(--sp-4);border:1px solid;font-size:13px}.testresult.ok{background:var(--ok-2);border-color:color-mix(in srgb,var(--ok) 30%,transparent);color:var(--ok)}.testresult.bad{background:var(--bad-2);border-color:color-mix(in srgb,var(--bad) 30%,transparent);color:var(--bad)}.testresult b{display:block}.testresult span{display:block;color:var(--ink-2);margin-top:2px}.testresult img{width:100%;margin-top:var(--sp-3);border-radius:var(--r-sm);border:1px solid var(--line);display:block}.steps{list-style:none;counter-reset:step;margin:0 0 var(--sp-5);padding:0;display:grid;gap:var(--sp-3)}.steps li{counter-increment:step;position:relative;padding:var(--sp-3) var(--sp-4) var(--sp-3) 52px;border-radius:var(--r);border:1px solid var(--line-2);background:var(--s2);opacity:.55}.steps li.now,.steps li.done{opacity:1}.steps li:before{content:counter(step);position:absolute;left:16px;top:14px;width:24px;height:24px;border-radius:50%;display:grid;place-items:center;font-size:12px;font-weight:600;background:var(--s3);color:var(--ink-2);border:1px solid var(--line)}.steps li.now:before{background:var(--accent);color:#041014;border-color:transparent}.steps li.done:before{content:"✓";background:var(--ok-2);color:var(--ok)}.steps b{display:block;font-size:14px}.steps span{display:block;font-size:12.5px;color:var(--ink-2);line-height:1.5;margin-top:2px}.progress{height:4px;background:var(--s3);border-radius:2px;overflow:hidden;margin-top:var(--sp-3)}.progress>div{height:100%;background:var(--accent);transition:width .4s linear}.verdict{padding:var(--sp-4);border-radius:var(--r);border:1px solid var(--line);background:var(--s2)}.verdict.ok{border-color:color-mix(in srgb,var(--ok) 35%,transparent);background:var(--ok-2)}.verdict.warn{border-color:color-mix(in srgb,var(--warn) 35%,transparent);background:var(--warn-2)}.verdict.bad{border-color:color-mix(in srgb,var(--bad) 35%,transparent);background:var(--bad-2)}.verdict-head{display:flex;align-items:center;gap:var(--sp-2);font-size:15px}.verdict.ok .verdict-head{color:var(--ok)}.verdict.warn .verdict-head{color:var(--warn)}.verdict.bad .verdict-head{color:var(--bad)}.verdict ul{margin:var(--sp-3) 0 0 18px;font-size:13px;color:var(--ink);line-height:1.5}.verdict ul li{margin-bottom:5px}.verdict .note{margin-top:var(--sp-3)}.spinner{width:16px;height:16px;border-radius:50%;border:2px solid var(--line);border-top-color:var(--accent);animation:spin .8s linear infinite;display:inline-block}@keyframes spin{to{transform:rotate(360deg)}}.helpbtn{display:flex;align-items:center;gap:9px;margin:0 var(--sp-3) var(--sp-3);padding:9px 10px;border-radius:var(--r);border:1px solid var(--line);background:var(--s2);color:var(--ink);cursor:pointer;font-size:12.5px;font-weight:550;text-align:left}.helpbtn img{width:18px;height:18px;object-fit:contain}.helpbtn span{flex:1}.helpbtn:hover,.helpbtn[aria-pressed=true]{border-color:color-mix(in srgb,var(--accent) 45%,transparent);background:var(--accent-3)}.helper{width:380px;height:100%;display:flex;flex-direction:column;min-height:0;background:var(--s1);border-left:1px solid var(--line);animation:slidein-r .2s cubic-bezier(.2,.8,.3,1)}.helperhead{display:flex;align-items:center;gap:var(--sp-3);padding:var(--sp-4);border-bottom:1px solid var(--line)}.helperhead img{width:26px;height:26px;object-fit:contain}.helperhead div{flex:1;min-width:0}.helperhead b{display:block;font-family:var(--font-display);font-size:14.5px}.helperhead span{display:block;font-size:11.5px;color:var(--ink-3);margin-top:1px}.helperhead .close{background:none;border:0;color:var(--ink-3);cursor:pointer;padding:6px;border-radius:var(--r-sm);display:grid;place-items:center}.helperhead .close:hover{background:var(--s2);color:var(--ink)}.helperbody{flex:1;overflow:auto;padding:var(--sp-4);display:flex;flex-direction:column;gap:var(--sp-3)}.helperintro p{color:var(--ink-2);font-size:13px;line-height:1.55;margin-bottom:var(--sp-3)}.chips{display:flex;flex-wrap:wrap;gap:6px}.chip{border:1px solid var(--line);background:var(--s2);color:var(--ink);border-radius:99px;padding:6px 11px;font-size:12px;cursor:pointer;text-align:left}.chip:hover{border-color:var(--accent);color:var(--accent)}.chip:disabled{opacity:.5;cursor:default}.helpernote{display:flex;gap:var(--sp-3);padding:var(--sp-3);border-radius:var(--r);background:var(--warn-2);border:1px solid color-mix(in srgb,var(--warn) 30%,transparent);color:var(--warn);font-size:12.5px}.helpernote b{display:block}.helpernote span{display:block;color:var(--ink-2);margin-top:2px;line-height:1.45}.turn{display:flex;flex-direction:column;gap:4px}.turn.user{align-items:flex-end}.bubble{max-width:92%;padding:10px 13px;border-radius:14px;font-size:13.5px;line-height:1.5;white-space:pre-wrap}.turn.user .bubble{background:var(--accent);color:#041014;border-bottom-right-radius:4px}.turn.assistant .bubble{background:var(--s2);border:1px solid var(--line);border-bottom-left-radius:4px}.turn .used{font-size:11px;color:var(--ink-3);padding:0 4px}.bubble.thinking{display:flex;gap:4px;padding:12px 14px}.bubble.thinking span{width:6px;height:6px;border-radius:50%;background:var(--ink-3);animation:blink 1.2s infinite ease-in-out}.bubble.thinking span:nth-child(2){animation-delay:.2s}.bubble.thinking span:nth-child(3){animation-delay:.4s}@keyframes blink{0%,80%,to{opacity:.25}40%{opacity:1}}.helperask{display:flex;gap:var(--sp-2);padding:var(--sp-3) var(--sp-4);border-top:1px solid var(--line)}.helperask input{flex:1;min-width:0;background:var(--s2);border:1px solid var(--line);border-radius:var(--r);padding:10px 12px;font-size:13.5px;color:var(--ink)}.helperask input:focus{outline:none;border-color:var(--accent)}.helperask .btn{padding:0 12px}.quickhelp{margin-top:var(--sp-5);border-top:1px solid var(--line-2);padding-top:var(--sp-4)}.quickhelp dt{font-size:12.5px;font-weight:600;margin-top:var(--sp-3)}.quickhelp dd{font-size:12.5px;color:var(--ink-2);line-height:1.5;margin:3px 0 0}@media (max-width: 1100px){.helper{position:fixed;right:0;top:0;bottom:0;z-index:30;box-shadow:var(--shadow-lg)}}.search{display:flex;align-items:center;gap:8px;background:var(--s1);border:1px solid var(--line);border-radius:var(--r);padding:0 12px;height:36px;width:min(340px,100%);color:var(--ink-3)}.search input{flex:1;min-width:0;background:none;border:0;outline:none;color:var(--ink);font-size:13.5px}.search:focus-within{border-color:var(--accent)}.sheethead.who{align-items:center;gap:var(--sp-3)}.sheethead.who .grow{flex:1;min-width:0}.sheethead.who .note{margin-top:2px;font-size:12px}.sheethead .close{font-size:14px;line-height:1}.formsection .field:last-child{margin-bottom:0}.formsection.dangerzone{margin-top:var(--sp-6);padding:var(--sp-4);border:1px solid color-mix(in srgb,var(--bad) 30%,transparent);border-radius:var(--r);background:var(--bad-2)}.formsection.dangerzone h4{color:var(--bad);border-color:color-mix(in srgb,var(--bad) 30%,transparent)}tr.click{cursor:pointer}tr.click:hover td{background:var(--s2)}.loya-fab{position:fixed;top:var(--sp-4);right:var(--sp-5);z-index:20;display:flex;align-items:center;gap:8px;padding:8px 14px 8px 10px;border-radius:99px;border:1px solid color-mix(in srgb,var(--accent) 40%,transparent);background:var(--s1);color:var(--ink);box-shadow:var(--shadow-lg);cursor:pointer;font-size:13px;font-weight:600}.loya-fab img{width:20px;height:20px;object-fit:contain}.loya-fab:hover{background:var(--accent-3);border-color:var(--accent)} +:root{--bg: #0A0F13;--s1: #111A20;--s2: #17232B;--s3: #1E2D37;--line: #223038;--line-2: #1A252C;--ink: #ECF3F7;--ink-2: #A3B6C2;--ink-3: #6C808D;--accent: #40C4DC;--accent-2: #0F3B47;--accent-3: #0B2A33;--ok: #48C78E;--ok-2: #102E22;--warn: #EAAA3D;--warn-2: #31260F;--bad: #EC6A5C;--bad-2: #331815;--r-sm: 6px;--r: 10px;--r-lg: 14px;--sp-1: 4px;--sp-2: 8px;--sp-3: 12px;--sp-4: 16px;--sp-5: 20px;--sp-6: 24px;--sp-7: 32px;--sp-8: 40px;--shadow: 0 1px 2px rgb(0 0 0 / .4), 0 8px 24px -12px rgb(0 0 0 / .6);--shadow-lg: 0 2px 4px rgb(0 0 0 / .4), 0 24px 48px -16px rgb(0 0 0 / .7);--font: "Segoe UI Variable Text", "Segoe UI", Inter, -apple-system, BlinkMacSystemFont, system-ui, "Helvetica Neue", Arial, sans-serif;--font-display: "Segoe UI Variable Display", var(--font);--mono: "Cascadia Mono", "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;--ground: var(--bg);--surface: var(--s1);--surface-2: var(--s2);--line-soft: var(--line-2);--muted: var(--ink-3);--radius: var(--r);--accent-dim: var(--accent-3)}*{box-sizing:border-box;margin:0}html,body,#root{height:100%}body{background:var(--bg);color:var(--ink);font-family:var(--font);font-size:14px;line-height:1.5;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;overflow:hidden;-webkit-user-select:none;user-select:none}button,input,select,textarea{font:inherit;color:inherit}input,textarea{-webkit-user-select:text;user-select:text}:focus-visible{outline:2px solid var(--accent);outline-offset:2px;border-radius:3px}::selection{background:var(--accent-2);color:var(--ink)}.num,.value,.metric-v,.when,.mono,.code,td{font-variant-numeric:tabular-nums}.mono,.code{font-family:var(--mono)}*{scrollbar-width:thin;scrollbar-color:var(--s3) transparent}*::-webkit-scrollbar{width:10px;height:10px}*::-webkit-scrollbar-track{background:transparent}*::-webkit-scrollbar-thumb{background:var(--s3);border-radius:99px;border:3px solid var(--bg)}*::-webkit-scrollbar-thumb:hover{background:#2a3d49}.shell{display:grid;grid-template-columns:232px 1fr auto;height:100%}.side{background:var(--s1);border-right:1px solid var(--line);display:flex;flex-direction:column;min-height:0}.side .brand{display:flex;align-items:center;gap:var(--sp-3);padding:var(--sp-5) var(--sp-5) var(--sp-4)}.side .brand .mark{width:30px;height:30px;flex:none;display:grid;place-items:center}.side .brand .mark img,.login .mark img{width:100%;height:100%;object-fit:contain;display:block}.side .brand .id{min-width:0}.side .brand h1{font-family:var(--font-display);font-size:15px;font-weight:600;letter-spacing:-.012em;line-height:1.2}.side .brand p{font-size:11.5px;color:var(--ink-3);margin-top:1px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.nav{padding:var(--sp-2) var(--sp-3);display:flex;flex-direction:column;gap:2px;flex:1}.nav button{position:relative;display:flex;align-items:center;gap:var(--sp-3);width:100%;background:none;border:0;border-radius:var(--r-sm);padding:9px var(--sp-3);color:var(--ink-2);cursor:pointer;text-align:left;font-size:13.5px;font-weight:450;transition:background .12s ease,color .12s ease}.nav button svg{flex:none;opacity:.9}.nav button:hover{background:var(--s2);color:var(--ink)}.nav button[aria-current=page]{background:var(--accent-3);color:var(--accent);font-weight:550}.nav button[aria-current=page]:before{content:"";position:absolute;left:-12px;top:7px;bottom:7px;width:2.5px;border-radius:0 2px 2px 0;background:var(--accent)}.enginebox{margin:var(--sp-3);padding:var(--sp-3) var(--sp-4) var(--sp-4);border:1px solid var(--line);border-radius:var(--r);background:var(--s2)}.enginebox .row{display:flex;align-items:center;gap:var(--sp-2)}.enginebox .state{font-size:12.5px;font-weight:600;letter-spacing:-.005em}.enginebox .label{display:block;color:var(--ink-3);font-size:11px;line-height:1.45;margin-top:3px;font-variant-numeric:tabular-nums}.enginebox .actions,.enginebox .controls{display:flex;gap:var(--sp-2);margin-top:var(--sp-3)}.enginebox .actions .btn,.enginebox .controls .btn{flex:1;justify-content:center;padding:6px 8px;font-size:12px}.side .who{padding:var(--sp-3) var(--sp-5) var(--sp-5);border-top:1px solid var(--line-2);display:flex;align-items:center;gap:var(--sp-3)}.side .who .id{min-width:0;flex:1}.side .who .id b{display:block;font-size:12.5px;font-weight:550}.side .who .id span{display:block;font-size:11px;color:var(--ink-3);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.main{min-width:0;min-height:0;overflow:auto;position:relative}.page{padding:var(--sp-6) var(--sp-7) var(--sp-8);max-width:1500px}.page>header{margin-bottom:var(--sp-5)}.page>header h2,.page h2{font-family:var(--font-display);font-size:22px;font-weight:600;letter-spacing:-.02em;line-height:1.2}.page>header p,.page header p{color:var(--ink-3);font-size:13px;margin-top:3px}.pagehead{display:flex;align-items:flex-start;justify-content:space-between;gap:var(--sp-4);margin-bottom:var(--sp-5);flex-wrap:wrap}h3{font-size:11px;font-weight:600;letter-spacing:.085em;text-transform:uppercase;color:var(--ink-3)}.card{background:var(--s1);border:1px solid var(--line);border-radius:var(--r);padding:var(--sp-4)}.card>h3{margin-bottom:var(--sp-3)}.card.flush{padding:0;overflow:hidden}.panel{background:var(--s1);border:1px solid var(--line);border-radius:var(--r-lg);overflow:hidden;display:flex;flex-direction:column;min-height:0}.panel>.panelhead{display:flex;align-items:center;justify-content:space-between;gap:var(--sp-3);padding:var(--sp-3) var(--sp-4);border-bottom:1px solid var(--line-2);background:linear-gradient(var(--s2),var(--s1));flex:none}.panel>.panelhead h3{margin:0}.panel>.panelbody{padding:var(--sp-4);min-height:0;overflow:auto}.panel>.panelbody.flush{padding:0}.grid{display:grid;gap:var(--sp-4)}.cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}@media (max-width: 1180px){.cols-4{grid-template-columns:repeat(2,minmax(0,1fr))}}@media (max-width: 980px){.cols-2,.cols-3{grid-template-columns:minmax(0,1fr)}}.metrics{display:grid;grid-template-columns:repeat(auto-fit,minmax(152px,1fr));gap:1px;background:var(--line);border:1px solid var(--line);border-radius:var(--r);overflow:hidden}.metric{background:var(--s1);padding:var(--sp-3) var(--sp-4) var(--sp-4)}.metric .metric-k{font-size:10.5px;font-weight:600;letter-spacing:.085em;text-transform:uppercase;color:var(--ink-3)}.metric .metric-v{font-family:var(--font-display);font-size:26px;font-weight:600;letter-spacing:-.025em;line-height:1.1;margin-top:5px}.metric .metric-s{font-size:11.5px;color:var(--ink-3);margin-top:3px;line-height:1.4}.metric.ok .metric-v{color:var(--ok)}.metric.warn .metric-v{color:var(--warn)}.metric.bad .metric-v{color:var(--bad)}.stat h3{margin-bottom:var(--sp-2)}.stat .value{font-family:var(--font-display);font-size:26px;font-weight:600;letter-spacing:-.025em;line-height:1.1}.stat .unit{font-size:15px;color:var(--ink-3);margin-left:3px}.stat .sub{font-size:11.5px;color:var(--ink-3);margin-top:4px;line-height:1.4}.dot{width:7px;height:7px;border-radius:99px;flex:none;background:var(--ink-3)}.dot.ok{background:var(--ok);box-shadow:0 0 0 3px color-mix(in srgb,var(--ok) 18%,transparent)}.dot.warn{background:var(--warn);box-shadow:0 0 0 3px color-mix(in srgb,var(--warn) 18%,transparent)}.dot.bad{background:var(--bad);box-shadow:0 0 0 3px color-mix(in srgb,var(--bad) 18%,transparent)}.dot.idle{background:var(--ink-3)}.dot.live{background:var(--ok);animation:pulse 2.4s ease-in-out infinite}@keyframes pulse{0%,to{box-shadow:0 0 color-mix(in srgb,var(--ok) 55%,transparent)}70%{box-shadow:0 0 0 6px color-mix(in srgb,var(--ok) 0%,transparent)}}.pill{display:inline-flex;align-items:center;gap:6px;padding:3px 9px 3px 7px;border-radius:99px;font-size:11px;font-weight:600;letter-spacing:.02em;background:var(--s3);color:var(--ink-2);border:1px solid var(--line);white-space:nowrap}.pill.ok{background:var(--ok-2);color:var(--ok);border-color:color-mix(in srgb,var(--ok) 28%,transparent)}.pill.warn{background:var(--warn-2);color:var(--warn);border-color:color-mix(in srgb,var(--warn) 28%,transparent)}.pill.bad{background:var(--bad-2);color:var(--bad);border-color:color-mix(in srgb,var(--bad) 28%,transparent)}.pill.accent{background:var(--accent-3);color:var(--accent);border-color:color-mix(in srgb,var(--accent) 30%,transparent)}.tag{display:inline-flex;align-items:center;padding:2px 7px;border-radius:var(--r-sm);font-size:10.5px;font-weight:600;letter-spacing:.04em;text-transform:uppercase;background:var(--s3);color:var(--ink-2)}.tag.new{background:var(--accent-3);color:var(--accent)}.tag.seen{background:var(--ok-2);color:var(--ok)}.tag.miss{background:var(--warn-2);color:var(--warn)}.statusbar{display:flex;align-items:center;gap:var(--sp-5);flex-wrap:wrap;padding:var(--sp-3) var(--sp-4);background:var(--s1);border:1px solid var(--line);border-radius:var(--r);margin-bottom:var(--sp-4)}.statusbar .item{display:flex;align-items:center;gap:var(--sp-2);font-size:12.5px}.statusbar .item b{font-weight:600;letter-spacing:-.005em}.statusbar .item svg{color:var(--ink-3)}.statusbar .sep{width:1px;align-self:stretch;background:var(--line)}.statusbar .grow{flex:1}.arrivals{display:flex;flex-direction:column;gap:var(--sp-2);padding:var(--sp-3)}.arrival{display:grid;grid-template-columns:46px 1fr auto;gap:var(--sp-3);align-items:center;padding:var(--sp-3);border-radius:var(--r);background:var(--s2);border:1px solid var(--line-2);position:relative;overflow:hidden}.arrival:before{content:"";position:absolute;left:0;top:0;bottom:0;width:2.5px;background:var(--ink-3)}.arrival.is-new:before{background:var(--accent)}.arrival.is-seen:before{background:var(--ok)}.arrival.is-miss:before{background:var(--warn)}.arrival.fresh{animation:slidein .28s cubic-bezier(.2,.8,.3,1)}@keyframes slidein{0%{opacity:0;transform:translateY(-6px)}to{opacity:1;transform:none}}.arrival .avatar{width:46px;height:46px;border-radius:var(--r-sm);display:grid;place-items:center;overflow:hidden;background:var(--s3);border:1px solid var(--line);font-family:var(--font-display);font-size:15px;font-weight:600;color:var(--ink-2);letter-spacing:-.01em;font-variant-numeric:tabular-nums}.arrival .avatar img{width:100%;height:100%;object-fit:cover}.arrival.is-new .avatar{background:var(--accent-3);color:var(--accent);border-color:color-mix(in srgb,var(--accent) 25%,transparent)}.arrival .who{min-width:0}.arrival .who .name{font-size:14.5px;font-weight:600;letter-spacing:-.01em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.arrival .who .meta{font-size:11.5px;color:var(--ink-3);margin-top:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.arrival .right{text-align:right;display:flex;flex-direction:column;align-items:flex-end;gap:5px}.arrival .right .when{font-size:11.5px;color:var(--ink-3)}.feeds{display:grid;gap:var(--sp-3);grid-template-columns:repeat(auto-fit,minmax(300px,1fr));padding:var(--sp-3)}.feed{position:relative;border-radius:var(--r);overflow:hidden;background:#05090c;border:1px solid var(--line);aspect-ratio:16 / 9}.feed img{width:100%;height:100%;object-fit:cover;display:block}.feed .placeholder{width:100%;height:100%;display:grid;place-items:center;color:var(--ink-3)}.feed .cap{position:absolute;left:0;right:0;bottom:0;display:flex;align-items:center;justify-content:space-between;gap:var(--sp-2);padding:var(--sp-5) var(--sp-3) var(--sp-3);background:linear-gradient(transparent,#000c);font-size:12.5px;font-weight:600;letter-spacing:-.005em}.events,.timeline{list-style:none;padding:0;display:flex;flex-direction:column}.events li{display:flex;align-items:center;gap:var(--sp-3);padding:9px var(--sp-4);border-bottom:1px solid var(--line-2);font-size:13px}.timeline li{display:flex;align-items:center;gap:var(--sp-3);padding:9px 0;border-bottom:1px solid var(--line-2);font-size:13px}.events li:last-child,.timeline li:last-child{border-bottom:0}.events .when,.timeline .when{font-size:11.5px;color:var(--ink-3);width:46px;flex:none}.empty{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--sp-3);padding:var(--sp-8) var(--sp-5);color:var(--ink-3);text-align:center;font-size:12.5px}.empty svg{opacity:.35}.empty b{display:block;color:var(--ink-2);font-size:13.5px;font-weight:550}.empty p{max-width:34ch;line-height:1.5}.tablewrap{overflow:auto}table{border-collapse:collapse;width:100%;font-size:13px}th{text-align:left;padding:9px var(--sp-4);font-size:10.5px;font-weight:600;letter-spacing:.085em;text-transform:uppercase;color:var(--ink-3);background:var(--s2);border-bottom:1px solid var(--line);position:sticky;top:0;z-index:1}td{padding:10px var(--sp-4);border-bottom:1px solid var(--line-2)}tbody tr:last-child td{border-bottom:0}tbody tr[role=button],tbody tr.clickable{cursor:pointer}tbody tr[role=button]:hover,tbody tr.clickable:hover{background:var(--s2)}.btn{display:inline-flex;align-items:center;gap:7px;padding:8px 14px;border-radius:var(--r-sm);background:var(--s3);color:var(--ink);border:1px solid var(--line);cursor:pointer;font-size:13px;font-weight:550;letter-spacing:-.005em;white-space:nowrap;transition:background .12s ease,border-color .12s ease,transform .06s ease}.btn:hover:not(:disabled){background:#253643;border-color:#2e414e}.btn:active:not(:disabled){transform:translateY(.5px)}.btn:disabled{opacity:.45;cursor:not-allowed}.btn svg{flex:none}.btn.primary{background:var(--accent);color:#04171c;border-color:transparent;font-weight:600}.btn.primary:hover:not(:disabled){background:#55d0e6}.btn.danger{background:var(--bad-2);color:var(--bad);border-color:color-mix(in srgb,var(--bad) 32%,transparent)}.btn.danger:hover:not(:disabled){background:#43201c}.btn.ghost{background:transparent}.btn.ghost:hover:not(:disabled){background:var(--s2)}.btn.sm{padding:5px 10px;font-size:12px}.btn.icon{padding:7px}.linkbtn{background:none;border:0;color:var(--accent);cursor:pointer;font-size:12.5px;padding:2px 0;text-align:left}.linkbtn:hover{text-decoration:underline}.seg{display:inline-flex;background:var(--s2);border:1px solid var(--line);border-radius:var(--r-sm);padding:2px;gap:2px}.seg button{background:none;border:0;border-radius:4px;padding:5px 11px;color:var(--ink-3);cursor:pointer;font-size:12.5px;font-weight:500}.seg button[aria-pressed=true]{background:var(--s3);color:var(--ink)}.field{display:block;margin-bottom:var(--sp-4)}.field>span{display:block;font-size:11.5px;font-weight:550;color:var(--ink-2);margin-bottom:6px}.field input,.field select,.field textarea{width:100%;padding:9px 11px;background:var(--s2);color:var(--ink);border:1px solid var(--line);border-radius:var(--r-sm);transition:border-color .12s ease,background .12s ease,box-shadow .12s ease}.field input::placeholder{color:var(--ink-3)}.field input:hover,.field select:hover,.field textarea:hover{border-color:#2c3d49}.field input:focus,.field select:focus,.field textarea:focus{outline:none;border-color:var(--accent);background:var(--s1);box-shadow:0 0 0 3px var(--accent-3)}.field .hint{display:block;font-size:11.5px;color:var(--ink-3);margin-top:5px;line-height:1.45}.fieldrow{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:var(--sp-3)}.fieldrow.three{grid-template-columns:repeat(3,minmax(0,1fr))}.err{display:flex;align-items:flex-start;gap:var(--sp-2);background:var(--bad-2);color:var(--bad);border:1px solid color-mix(in srgb,var(--bad) 30%,transparent);border-radius:var(--r-sm);padding:9px 11px;font-size:12.5px;line-height:1.45;margin-bottom:var(--sp-4)}.err svg{flex:none;margin-top:1px}.note{color:var(--ink-3);font-size:12px;line-height:1.5}.note.warn{color:var(--warn)}.note.bad{color:var(--bad)}.lead{color:var(--ink-2);font-size:13.5px;line-height:1.55}.sm{font-size:12px}.lbl,.key{color:var(--ink-3);font-size:11.5px}.grow{flex:1}.row{display:flex;align-items:center;gap:var(--sp-3)}.login{height:100%;display:grid;place-items:center;padding:var(--sp-6);overflow:auto;background:radial-gradient(900px 480px at 50% -10%,#10303A 0%,transparent 62%),var(--bg)}.login .box{width:100%;max-width:396px;background:var(--s1);border:1px solid var(--line);border-radius:var(--r-lg);padding:var(--sp-7);box-shadow:var(--shadow-lg)}.login .mark{width:44px;height:44px;margin-bottom:var(--sp-4);display:grid;place-items:center}.login h1{font-family:var(--font-display);font-size:21px;font-weight:600;letter-spacing:-.022em}.login .lead{margin:6px 0 var(--sp-5)}.login .btn{width:100%;justify-content:center;margin-top:var(--sp-1)}.login .foot{font-size:11.5px;color:var(--ink-3);line-height:1.55;margin-top:var(--sp-5);padding-top:var(--sp-4);border-top:1px solid var(--line-2)}.login .alt{margin-top:var(--sp-4);display:flex;flex-direction:column;gap:var(--sp-3)}.login .alt .btn{margin-top:0}.login .note{margin:0}.drawer{position:fixed;top:0;right:0;bottom:0;left:0;z-index:40;background:#04080b99;display:flex;justify-content:flex-end;animation:fade .16s ease}@keyframes fade{0%{opacity:0}to{opacity:1}}.drawer .sheet{width:min(540px,100%);height:100%;overflow:auto;background:var(--s1);border-left:1px solid var(--line);box-shadow:var(--shadow-lg);animation:slidein-r .2s cubic-bezier(.2,.8,.3,1)}@keyframes slidein-r{0%{transform:translate(16px);opacity:.6}to{transform:none;opacity:1}}.drawer .sheethead{position:sticky;top:0;z-index:1;display:flex;align-items:center;justify-content:space-between;gap:var(--sp-3);padding:var(--sp-4) var(--sp-5);background:var(--s1);border-bottom:1px solid var(--line)}.drawer .sheethead h2{font-family:var(--font-display);font-size:17px;font-weight:600;letter-spacing:-.015em}.drawer .sheetbody{padding:var(--sp-5)}.drawer .close{background:none;border:0;color:var(--ink-3);cursor:pointer;padding:6px;border-radius:var(--r-sm);display:grid;place-items:center}.drawer .close:hover{background:var(--s2);color:var(--ink)}.avatar{width:44px;height:44px;border-radius:var(--r-sm);flex:none;display:grid;place-items:center;overflow:hidden;background:var(--s3);border:1px solid var(--line);font-weight:600;color:var(--ink-2);font-variant-numeric:tabular-nums}.avatar img{width:100%;height:100%;object-fit:cover}@media (prefers-reduced-motion: reduce){*,*:before,*:after{animation:none!important;transition:none!important}}.live-split{display:grid;gap:var(--sp-4);grid-template-columns:minmax(0,1.35fr) minmax(0,1fr);align-items:stretch;min-height:420px}.live-split>.panel{max-height:62vh}@media (max-width: 1100px){.live-split{grid-template-columns:minmax(0,1fr)}.live-split>.panel{max-height:none}}.arrivals-panel{max-height:64vh;margin-bottom:var(--sp-4)}.arrivals-panel .arrivals{display:grid;grid-template-columns:repeat(auto-fill,minmax(340px,1fr));gap:var(--sp-2)}.pagehead{display:flex;justify-content:space-between;align-items:flex-end;gap:var(--sp-4)}.page>header.pagehead{margin-bottom:var(--sp-5)}.camgrid{display:grid;gap:var(--sp-4);grid-template-columns:repeat(auto-fill,minmax(440px,1fr))}.camcard{background:var(--s1);border:1px solid var(--line);border-radius:var(--r-lg);overflow:hidden;display:flex;flex-direction:column}.camview{position:relative;aspect-ratio:16 / 9;background:#05090c}.camview img{width:100%;height:100%;object-fit:cover;display:block}.camview .placeholder{width:100%;height:100%;display:grid;place-items:center;color:var(--ink-3)}.camview .pill.over{position:absolute;top:10px;right:10px;-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px)}.cambody{padding:var(--sp-4);display:flex;flex-direction:column;gap:var(--sp-3)}.camtitle{display:flex;justify-content:space-between;align-items:flex-start;gap:var(--sp-3)}.camtitle h3{font-family:var(--font-display);font-size:16px;font-weight:600;letter-spacing:-.012em;text-transform:none;color:var(--ink);margin:0 0 2px}.camtitle .note{font-size:12px}.camactions{display:flex;gap:6px;flex:none}.camproof{display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:var(--sp-3);padding:var(--sp-3);border-radius:var(--r);background:var(--s2);border:1px solid var(--line-2)}.camproof .note{font-size:12px;line-height:1.45}@media (max-width: 640px){.camproof{grid-template-columns:1fr}}.empty.tall{padding:var(--sp-8) var(--sp-6)}.empty.tall .btn{margin-top:var(--sp-3)}.drawer .sheet{width:min(600px,100%)}.sheetbody .lead{color:var(--ink-2);font-size:13.5px;line-height:1.55;margin-bottom:var(--sp-5)}.formsection{margin-bottom:var(--sp-5)}.formsection h4{font-size:11px;font-weight:600;letter-spacing:.09em;text-transform:uppercase;color:var(--ink-3);margin:0 0 var(--sp-3);padding-bottom:6px;border-bottom:1px solid var(--line-2)}.field .hint{font-style:normal}.fieldrow{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}.fieldrow .field.narrow{max-width:140px}.fieldrow:has(.field.narrow){grid-template-columns:minmax(0,1fr) 140px}.field input.mono{font-family:var(--font-mono);font-size:12.5px}.sheetactions{display:flex;gap:var(--sp-2);justify-content:flex-end;padding-top:var(--sp-4);border-top:1px solid var(--line-2);margin-top:var(--sp-2)}.testresult{display:flex;gap:var(--sp-3);align-items:flex-start;padding:var(--sp-3) var(--sp-4);border-radius:var(--r);margin-bottom:var(--sp-4);border:1px solid;font-size:13px}.testresult.ok{background:var(--ok-2);border-color:color-mix(in srgb,var(--ok) 30%,transparent);color:var(--ok)}.testresult.bad{background:var(--bad-2);border-color:color-mix(in srgb,var(--bad) 30%,transparent);color:var(--bad)}.testresult b{display:block}.testresult span{display:block;color:var(--ink-2);margin-top:2px}.testresult img{width:100%;margin-top:var(--sp-3);border-radius:var(--r-sm);border:1px solid var(--line);display:block}.steps{list-style:none;counter-reset:step;margin:0 0 var(--sp-5);padding:0;display:grid;gap:var(--sp-3)}.steps li{counter-increment:step;position:relative;padding:var(--sp-3) var(--sp-4) var(--sp-3) 52px;border-radius:var(--r);border:1px solid var(--line-2);background:var(--s2);opacity:.55}.steps li.now,.steps li.done{opacity:1}.steps li:before{content:counter(step);position:absolute;left:16px;top:14px;width:24px;height:24px;border-radius:50%;display:grid;place-items:center;font-size:12px;font-weight:600;background:var(--s3);color:var(--ink-2);border:1px solid var(--line)}.steps li.now:before{background:var(--accent);color:#041014;border-color:transparent}.steps li.done:before{content:"✓";background:var(--ok-2);color:var(--ok)}.steps b{display:block;font-size:14px}.steps span{display:block;font-size:12.5px;color:var(--ink-2);line-height:1.5;margin-top:2px}.progress{height:4px;background:var(--s3);border-radius:2px;overflow:hidden;margin-top:var(--sp-3)}.progress>div{height:100%;background:var(--accent);transition:width .4s linear}.verdict{padding:var(--sp-4);border-radius:var(--r);border:1px solid var(--line);background:var(--s2)}.verdict.ok{border-color:color-mix(in srgb,var(--ok) 35%,transparent);background:var(--ok-2)}.verdict.warn{border-color:color-mix(in srgb,var(--warn) 35%,transparent);background:var(--warn-2)}.verdict.bad{border-color:color-mix(in srgb,var(--bad) 35%,transparent);background:var(--bad-2)}.verdict-head{display:flex;align-items:center;gap:var(--sp-2);font-size:15px}.verdict.ok .verdict-head{color:var(--ok)}.verdict.warn .verdict-head{color:var(--warn)}.verdict.bad .verdict-head{color:var(--bad)}.verdict ul{margin:var(--sp-3) 0 0 18px;font-size:13px;color:var(--ink);line-height:1.5}.verdict ul li{margin-bottom:5px}.verdict .note{margin-top:var(--sp-3)}.spinner{width:16px;height:16px;border-radius:50%;border:2px solid var(--line);border-top-color:var(--accent);animation:spin .8s linear infinite;display:inline-block}@keyframes spin{to{transform:rotate(360deg)}}.helpbtn{display:flex;align-items:center;gap:9px;margin:0 var(--sp-3) var(--sp-3);padding:9px 10px;border-radius:var(--r);border:1px solid var(--line);background:var(--s2);color:var(--ink);cursor:pointer;font-size:12.5px;font-weight:550;text-align:left}.helpbtn img{width:18px;height:18px;object-fit:contain}.helpbtn span{flex:1}.helpbtn:hover,.helpbtn[aria-pressed=true]{border-color:color-mix(in srgb,var(--accent) 45%,transparent);background:var(--accent-3)}.helper{width:380px;height:100%;display:flex;flex-direction:column;min-height:0;background:var(--s1);border-left:1px solid var(--line);animation:slidein-r .2s cubic-bezier(.2,.8,.3,1)}.helperhead{display:flex;align-items:center;gap:var(--sp-3);padding:var(--sp-4);border-bottom:1px solid var(--line)}.helperhead img{width:26px;height:26px;object-fit:contain}.helperhead div{flex:1;min-width:0}.helperhead b{display:block;font-family:var(--font-display);font-size:14.5px}.helperhead span{display:block;font-size:11.5px;color:var(--ink-3);margin-top:1px}.helperhead .close{background:none;border:0;color:var(--ink-3);cursor:pointer;padding:6px;border-radius:var(--r-sm);display:grid;place-items:center}.helperhead .close:hover{background:var(--s2);color:var(--ink)}.helperbody{flex:1;overflow:auto;padding:var(--sp-4);display:flex;flex-direction:column;gap:var(--sp-3)}.helperintro p{color:var(--ink-2);font-size:13px;line-height:1.55;margin-bottom:var(--sp-3)}.chips{display:flex;flex-wrap:wrap;gap:6px}.chip{border:1px solid var(--line);background:var(--s2);color:var(--ink);border-radius:99px;padding:6px 11px;font-size:12px;cursor:pointer;text-align:left}.chip:hover{border-color:var(--accent);color:var(--accent)}.chip:disabled{opacity:.5;cursor:default}.helpernote{display:flex;gap:var(--sp-3);padding:var(--sp-3);border-radius:var(--r);background:var(--warn-2);border:1px solid color-mix(in srgb,var(--warn) 30%,transparent);color:var(--warn);font-size:12.5px}.helpernote b{display:block}.helpernote span{display:block;color:var(--ink-2);margin-top:2px;line-height:1.45}.turn{display:flex;flex-direction:column;gap:4px}.turn.user{align-items:flex-end}.bubble{max-width:92%;padding:10px 13px;border-radius:14px;font-size:13.5px;line-height:1.5;white-space:pre-wrap}.turn.user .bubble{background:var(--accent);color:#041014;border-bottom-right-radius:4px}.turn.assistant .bubble{background:var(--s2);border:1px solid var(--line);border-bottom-left-radius:4px}.turn .used{font-size:11px;color:var(--ink-3);padding:0 4px}.bubble.thinking{display:flex;gap:4px;padding:12px 14px}.bubble.thinking span{width:6px;height:6px;border-radius:50%;background:var(--ink-3);animation:blink 1.2s infinite ease-in-out}.bubble.thinking span:nth-child(2){animation-delay:.2s}.bubble.thinking span:nth-child(3){animation-delay:.4s}@keyframes blink{0%,80%,to{opacity:.25}40%{opacity:1}}.helperask{display:flex;gap:var(--sp-2);padding:var(--sp-3) var(--sp-4);border-top:1px solid var(--line)}.helperask input{flex:1;min-width:0;background:var(--s2);border:1px solid var(--line);border-radius:var(--r);padding:10px 12px;font-size:13.5px;color:var(--ink)}.helperask input:focus{outline:none;border-color:var(--accent)}.helperask .btn{padding:0 12px}.quickhelp{margin-top:var(--sp-5);border-top:1px solid var(--line-2);padding-top:var(--sp-4)}.quickhelp dt{font-size:12.5px;font-weight:600;margin-top:var(--sp-3)}.quickhelp dd{font-size:12.5px;color:var(--ink-2);line-height:1.5;margin:3px 0 0}@media (max-width: 1100px){.helper{position:fixed;right:0;top:0;bottom:0;z-index:30;box-shadow:var(--shadow-lg)}}.search{display:flex;align-items:center;gap:8px;background:var(--s1);border:1px solid var(--line);border-radius:var(--r);padding:0 12px;height:36px;width:min(340px,100%);color:var(--ink-3)}.search input{flex:1;min-width:0;background:none;border:0;outline:none;color:var(--ink);font-size:13.5px}.search:focus-within{border-color:var(--accent)}.sheethead.who{align-items:center;gap:var(--sp-3)}.sheethead.who .grow{flex:1;min-width:0}.sheethead.who .note{margin-top:2px;font-size:12px}.sheethead .close{font-size:14px;line-height:1}.formsection .field:last-child{margin-bottom:0}.formsection.dangerzone{margin-top:var(--sp-6);padding:var(--sp-4);border:1px solid color-mix(in srgb,var(--bad) 30%,transparent);border-radius:var(--r);background:var(--bad-2)}.formsection.dangerzone h4{color:var(--bad);border-color:color-mix(in srgb,var(--bad) 30%,transparent)}tr.click{cursor:pointer}tr.click:hover td{background:var(--s2)}.loya-fab{position:fixed;top:var(--sp-4);right:var(--sp-5);z-index:20;display:flex;align-items:center;gap:8px;padding:8px 14px 8px 10px;border-radius:99px;border:1px solid color-mix(in srgb,var(--accent) 40%,transparent);background:var(--s1);color:var(--ink);box-shadow:var(--shadow-lg);cursor:pointer;font-size:13px;font-weight:600}.loya-fab img{width:20px;height:20px;object-fit:contain}.loya-fab:hover{background:var(--accent-3);border-color:var(--accent)}.finder{display:flex;flex-direction:column;gap:var(--sp-3);align-items:flex-start;padding:var(--sp-3) var(--sp-4);border:1px dashed var(--line);border-radius:var(--r);background:var(--s2)}.finder p{font-size:13px;color:var(--ink-2);line-height:1.5;margin:0}.finder.busy{flex-direction:row;align-items:center;color:var(--ink-2);font-size:13px;border-style:solid}.foundlist{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:6px}.foundlist li button{width:100%;display:flex;align-items:center;gap:var(--sp-3);padding:10px 12px;border-radius:var(--r);border:1px solid var(--line);background:var(--s2);color:var(--ink);cursor:pointer;text-align:left;font-size:13px}.foundlist li button:hover{border-color:var(--accent)}.foundlist li.picked button{border-color:var(--accent);background:var(--accent-3)}.foundlist .mono{font-family:var(--font-mono);font-size:12.5px;min-width:120px}.foundlist .what{flex:1;color:var(--ink-2)}.foundlist li.rescan button{width:auto;border:0;background:none;padding:4px 0;color:var(--ink-3)} diff --git a/desktop/frontend/dist/assets/index-uOKaPIDr.js b/desktop/frontend/dist/assets/index-uOKaPIDr.js new file mode 100644 index 0000000..7126980 --- /dev/null +++ b/desktop/frontend/dist/assets/index-uOKaPIDr.js @@ -0,0 +1,40 @@ +(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))r(l);new MutationObserver(l=>{for(const s of l)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(l){const s={};return l.integrity&&(s.integrity=l.integrity),l.referrerPolicy&&(s.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?s.credentials="include":l.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(l){if(l.ep)return;l.ep=!0;const s=n(l);fetch(l.href,s)}})();function Pc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var oa={exports:{}},dl={},aa={exports:{}},D={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var nr=Symbol.for("react.element"),zc=Symbol.for("react.portal"),Lc=Symbol.for("react.fragment"),Tc=Symbol.for("react.strict_mode"),Mc=Symbol.for("react.profiler"),Rc=Symbol.for("react.provider"),Dc=Symbol.for("react.context"),Oc=Symbol.for("react.forward_ref"),Fc=Symbol.for("react.suspense"),Ic=Symbol.for("react.memo"),$c=Symbol.for("react.lazy"),Yi=Symbol.iterator;function Uc(e){return e===null||typeof e!="object"?null:(e=Yi&&e[Yi]||e["@@iterator"],typeof e=="function"?e:null)}var ua={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},ca=Object.assign,da={};function pn(e,t,n){this.props=e,this.context=t,this.refs=da,this.updater=n||ua}pn.prototype.isReactComponent={};pn.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};pn.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function fa(){}fa.prototype=pn.prototype;function Js(e,t,n){this.props=e,this.context=t,this.refs=da,this.updater=n||ua}var qs=Js.prototype=new fa;qs.constructor=Js;ca(qs,pn.prototype);qs.isPureReactComponent=!0;var Gi=Array.isArray,pa=Object.prototype.hasOwnProperty,bs={current:null},ha={key:!0,ref:!0,__self:!0,__source:!0};function ma(e,t,n){var r,l={},s=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(s=""+t.key),t)pa.call(t,r)&&!ha.hasOwnProperty(r)&&(l[r]=t[r]);var a=arguments.length-2;if(a===1)l.children=n;else if(1>>1,b=_[G];if(0>>1;Gl(zl,R))ktl(ar,zl)?(_[G]=ar,_[kt]=R,G=kt):(_[G]=zl,_[jt]=R,G=jt);else if(ktl(ar,R))_[G]=ar,_[kt]=R,G=kt;else break e}}return M}function l(_,M){var R=_.sortIndex-M.sortIndex;return R!==0?R:_.id-M.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();e.unstable_now=function(){return o.now()-a}}var u=[],c=[],p=1,v=null,h=3,g=!1,w=!1,x=!1,T=typeof setTimeout=="function"?setTimeout:null,f=typeof clearTimeout=="function"?clearTimeout:null,d=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function m(_){for(var M=n(c);M!==null;){if(M.callback===null)r(c);else if(M.startTime<=_)r(c),M.sortIndex=M.expirationTime,t(u,M);else break;M=n(c)}}function y(_){if(x=!1,m(_),!w)if(n(u)!==null)w=!0,_l(S);else{var M=n(c);M!==null&&Pl(y,M.startTime-_)}}function S(_,M){w=!1,x&&(x=!1,f(E),E=-1),g=!0;var R=h;try{for(m(M),v=n(u);v!==null&&(!(v.expirationTime>M)||_&&!V());){var G=v.callback;if(typeof G=="function"){v.callback=null,h=v.priorityLevel;var b=G(v.expirationTime<=M);M=e.unstable_now(),typeof b=="function"?v.callback=b:v===n(u)&&r(u),m(M)}else r(u);v=n(u)}if(v!==null)var or=!0;else{var jt=n(c);jt!==null&&Pl(y,jt.startTime-M),or=!1}return or}finally{v=null,h=R,g=!1}}var C=!1,k=null,E=-1,z=5,L=-1;function V(){return!(e.unstable_now()-L_||125<_?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):z=0<_?Math.floor(1e3/_):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_getFirstCallbackNode=function(){return n(u)},e.unstable_next=function(_){switch(h){case 1:case 2:case 3:var M=3;break;default:M=h}var R=h;h=M;try{return _()}finally{h=R}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(_,M){switch(_){case 1:case 2:case 3:case 4:case 5:break;default:_=3}var R=h;h=_;try{return M()}finally{h=R}},e.unstable_scheduleCallback=function(_,M,R){var G=e.unstable_now();switch(typeof R=="object"&&R!==null?(R=R.delay,R=typeof R=="number"&&0G?(_.sortIndex=R,t(c,_),n(u)===null&&_===n(c)&&(x?(f(E),E=-1):x=!0,Pl(y,R-G))):(_.sortIndex=b,t(u,_),w||g||(w=!0,_l(S))),_},e.unstable_shouldYield=V,e.unstable_wrapCallback=function(_){var M=h;return function(){var R=h;h=M;try{return _.apply(this,arguments)}finally{h=R}}}})(wa);xa.exports=wa;var Jc=xa.exports;/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var qc=P,Se=Jc;function j(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),rs=Object.prototype.hasOwnProperty,bc=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Zi={},Ji={};function ed(e){return rs.call(Ji,e)?!0:rs.call(Zi,e)?!1:bc.test(e)?Ji[e]=!0:(Zi[e]=!0,!1)}function td(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function nd(e,t,n,r){if(t===null||typeof t>"u"||td(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function he(e,t,n,r,l,s,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=l,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=o}var se={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){se[e]=new he(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];se[t]=new he(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){se[e]=new he(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){se[e]=new he(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){se[e]=new he(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){se[e]=new he(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){se[e]=new he(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){se[e]=new he(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){se[e]=new he(e,5,!1,e.toLowerCase(),null,!1,!1)});var ti=/[\-:]([a-z])/g;function ni(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(ti,ni);se[t]=new he(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(ti,ni);se[t]=new he(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(ti,ni);se[t]=new he(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){se[e]=new he(e,1,!1,e.toLowerCase(),null,!1,!1)});se.xlinkHref=new he("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){se[e]=new he(e,1,!1,e.toLowerCase(),null,!0,!0)});function ri(e,t,n,r){var l=se.hasOwnProperty(t)?se[t]:null;(l!==null?l.type!==0:r||!(2a||l[o]!==s[a]){var u=` +`+l[o].replace(" at new "," at ");return e.displayName&&u.includes("")&&(u=u.replace("",e.displayName)),u}while(1<=o&&0<=a);break}}}finally{Ml=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?En(e):""}function rd(e){switch(e.tag){case 5:return En(e.type);case 16:return En("Lazy");case 13:return En("Suspense");case 19:return En("SuspenseList");case 0:case 2:case 15:return e=Rl(e.type,!1),e;case 11:return e=Rl(e.type.render,!1),e;case 1:return e=Rl(e.type,!0),e;default:return""}}function os(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case At:return"Fragment";case Ut:return"Portal";case ls:return"Profiler";case li:return"StrictMode";case ss:return"Suspense";case is:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Sa:return(e.displayName||"Context")+".Consumer";case ka:return(e._context.displayName||"Context")+".Provider";case si:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ii:return t=e.displayName||null,t!==null?t:os(e.type)||"Memo";case nt:t=e._payload,e=e._init;try{return os(e(t))}catch{}}return null}function ld(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return os(t);case 8:return t===li?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function vt(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Ca(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function sd(e){var t=Ca(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var l=n.get,s=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(o){r=""+o,s.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function dr(e){e._valueTracker||(e._valueTracker=sd(e))}function Ea(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Ca(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Br(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function as(e,t){var n=t.checked;return K({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function bi(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=vt(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function _a(e,t){t=t.checked,t!=null&&ri(e,"checked",t,!1)}function us(e,t){_a(e,t);var n=vt(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?cs(e,t.type,n):t.hasOwnProperty("defaultValue")&&cs(e,t.type,vt(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function eo(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function cs(e,t,n){(t!=="number"||Br(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var _n=Array.isArray;function Jt(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=fr.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function An(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ln={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},id=["Webkit","ms","Moz","O"];Object.keys(Ln).forEach(function(e){id.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Ln[t]=Ln[e]})});function Ta(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Ln.hasOwnProperty(e)&&Ln[e]?(""+t).trim():t+"px"}function Ma(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=Ta(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var od=K({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ps(e,t){if(t){if(od[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(j(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(j(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(j(61))}if(t.style!=null&&typeof t.style!="object")throw Error(j(62))}}function hs(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var ms=null;function oi(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var vs=null,qt=null,bt=null;function ro(e){if(e=sr(e)){if(typeof vs!="function")throw Error(j(280));var t=e.stateNode;t&&(t=vl(t),vs(e.stateNode,e.type,t))}}function Ra(e){qt?bt?bt.push(e):bt=[e]:qt=e}function Da(){if(qt){var e=qt,t=bt;if(bt=qt=null,ro(e),t)for(e=0;e>>=0,e===0?32:31-(yd(e)/xd|0)|0}var pr=64,hr=4194304;function Pn(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Qr(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,s=e.pingedLanes,o=n&268435455;if(o!==0){var a=o&~l;a!==0?r=Pn(a):(s&=o,s!==0&&(r=Pn(s)))}else o=n&~l,o!==0?r=Pn(o):s!==0&&(r=Pn(s));if(r===0)return 0;if(t!==0&&t!==r&&!(t&l)&&(l=r&-r,s=t&-t,l>=s||l===16&&(s&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function rr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Ie(t),e[t]=n}function Sd(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Mn),po=" ",ho=!1;function eu(e,t){switch(e){case"keyup":return Jd.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function tu(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Bt=!1;function bd(e,t){switch(e){case"compositionend":return tu(t);case"keypress":return t.which!==32?null:(ho=!0,po);case"textInput":return e=t.data,e===po&&ho?null:e;default:return null}}function ef(e,t){if(Bt)return e==="compositionend"||!mi&&eu(e,t)?(e=qa(),Mr=fi=it=null,Bt=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=yo(n)}}function su(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?su(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function iu(){for(var e=window,t=Br();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Br(e.document)}return t}function vi(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function cf(e){var t=iu(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&su(n.ownerDocument.documentElement,n)){if(r!==null&&vi(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var l=n.textContent.length,s=Math.min(r.start,l);r=r.end===void 0?s:Math.min(r.end,l),!e.extend&&s>r&&(l=r,r=s,s=l),l=xo(n,s);var o=xo(n,r);l&&o&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),s>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Vt=null,ks=null,Dn=null,Ss=!1;function wo(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ss||Vt==null||Vt!==Br(r)||(r=Vt,"selectionStart"in r&&vi(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Dn&&Kn(Dn,r)||(Dn=r,r=Gr(ks,"onSelect"),0Qt||(e.current=zs[Qt],zs[Qt]=null,Qt--)}function U(e,t){Qt++,zs[Qt]=e.current,e.current=t}var gt={},ue=xt(gt),ge=xt(!1),Lt=gt;function on(e,t){var n=e.type.contextTypes;if(!n)return gt;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},s;for(s in n)l[s]=t[s];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function ye(e){return e=e.childContextTypes,e!=null}function Zr(){B(ge),B(ue)}function _o(e,t,n){if(ue.current!==gt)throw Error(j(168));U(ue,t),U(ge,n)}function mu(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var l in r)if(!(l in t))throw Error(j(108,ld(e)||"Unknown",l));return K({},n,r)}function Jr(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||gt,Lt=ue.current,U(ue,e),U(ge,ge.current),!0}function Po(e,t,n){var r=e.stateNode;if(!r)throw Error(j(169));n?(e=mu(e,t,Lt),r.__reactInternalMemoizedMergedChildContext=e,B(ge),B(ue),U(ue,e)):B(ge),U(ge,n)}var Ke=null,gl=!1,Yl=!1;function vu(e){Ke===null?Ke=[e]:Ke.push(e)}function kf(e){gl=!0,vu(e)}function wt(){if(!Yl&&Ke!==null){Yl=!0;var e=0,t=I;try{var n=Ke;for(I=1;e>=o,l-=o,Ye=1<<32-Ie(t)+l|n<E?(z=k,k=null):z=k.sibling;var L=h(f,k,m[E],y);if(L===null){k===null&&(k=z);break}e&&k&&L.alternate===null&&t(f,k),d=s(L,d,E),C===null?S=L:C.sibling=L,C=L,k=z}if(E===m.length)return n(f,k),H&&St(f,E),S;if(k===null){for(;EE?(z=k,k=null):z=k.sibling;var V=h(f,k,L.value,y);if(V===null){k===null&&(k=z);break}e&&k&&V.alternate===null&&t(f,k),d=s(V,d,E),C===null?S=V:C.sibling=V,C=V,k=z}if(L.done)return n(f,k),H&&St(f,E),S;if(k===null){for(;!L.done;E++,L=m.next())L=v(f,L.value,y),L!==null&&(d=s(L,d,E),C===null?S=L:C.sibling=L,C=L);return H&&St(f,E),S}for(k=r(f,k);!L.done;E++,L=m.next())L=g(k,f,E,L.value,y),L!==null&&(e&&L.alternate!==null&&k.delete(L.key===null?E:L.key),d=s(L,d,E),C===null?S=L:C.sibling=L,C=L);return e&&k.forEach(function(vn){return t(f,vn)}),H&&St(f,E),S}function T(f,d,m,y){if(typeof m=="object"&&m!==null&&m.type===At&&m.key===null&&(m=m.props.children),typeof m=="object"&&m!==null){switch(m.$$typeof){case cr:e:{for(var S=m.key,C=d;C!==null;){if(C.key===S){if(S=m.type,S===At){if(C.tag===7){n(f,C.sibling),d=l(C,m.props.children),d.return=f,f=d;break e}}else if(C.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===nt&&To(S)===C.type){n(f,C.sibling),d=l(C,m.props),d.ref=Sn(f,C,m),d.return=f,f=d;break e}n(f,C);break}else t(f,C);C=C.sibling}m.type===At?(d=zt(m.props.children,f.mode,y,m.key),d.return=f,f=d):(y=Ar(m.type,m.key,m.props,null,f.mode,y),y.ref=Sn(f,d,m),y.return=f,f=y)}return o(f);case Ut:e:{for(C=m.key;d!==null;){if(d.key===C)if(d.tag===4&&d.stateNode.containerInfo===m.containerInfo&&d.stateNode.implementation===m.implementation){n(f,d.sibling),d=l(d,m.children||[]),d.return=f,f=d;break e}else{n(f,d);break}else t(f,d);d=d.sibling}d=ts(m,f.mode,y),d.return=f,f=d}return o(f);case nt:return C=m._init,T(f,d,C(m._payload),y)}if(_n(m))return w(f,d,m,y);if(yn(m))return x(f,d,m,y);jr(f,m)}return typeof m=="string"&&m!==""||typeof m=="number"?(m=""+m,d!==null&&d.tag===6?(n(f,d.sibling),d=l(d,m),d.return=f,f=d):(n(f,d),d=es(m,f.mode,y),d.return=f,f=d),o(f)):n(f,d)}return T}var un=wu(!0),ju=wu(!1),el=xt(null),tl=null,Gt=null,wi=null;function ji(){wi=Gt=tl=null}function ki(e){var t=el.current;B(el),e._currentValue=t}function Ms(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function tn(e,t){tl=e,wi=Gt=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(ve=!0),e.firstContext=null)}function Te(e){var t=e._currentValue;if(wi!==e)if(e={context:e,memoizedValue:t,next:null},Gt===null){if(tl===null)throw Error(j(308));Gt=e,tl.dependencies={lanes:0,firstContext:e}}else Gt=Gt.next=e;return t}var Et=null;function Si(e){Et===null?Et=[e]:Et.push(e)}function ku(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,Si(t)):(n.next=l.next,l.next=n),t.interleaved=n,qe(e,r)}function qe(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var rt=!1;function Ni(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Su(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Xe(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function ft(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,O&2){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,qe(e,n)}return l=r.interleaved,l===null?(t.next=t,Si(r)):(t.next=l.next,l.next=t),r.interleaved=t,qe(e,n)}function Dr(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ui(e,n)}}function Mo(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var l=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?l=s=o:s=s.next=o,n=n.next}while(n!==null);s===null?l=s=t:s=s.next=t}else l=s=t;n={baseState:r.baseState,firstBaseUpdate:l,lastBaseUpdate:s,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function nl(e,t,n,r){var l=e.updateQueue;rt=!1;var s=l.firstBaseUpdate,o=l.lastBaseUpdate,a=l.shared.pending;if(a!==null){l.shared.pending=null;var u=a,c=u.next;u.next=null,o===null?s=c:o.next=c,o=u;var p=e.alternate;p!==null&&(p=p.updateQueue,a=p.lastBaseUpdate,a!==o&&(a===null?p.firstBaseUpdate=c:a.next=c,p.lastBaseUpdate=u))}if(s!==null){var v=l.baseState;o=0,p=c=u=null,a=s;do{var h=a.lane,g=a.eventTime;if((r&h)===h){p!==null&&(p=p.next={eventTime:g,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var w=e,x=a;switch(h=t,g=n,x.tag){case 1:if(w=x.payload,typeof w=="function"){v=w.call(g,v,h);break e}v=w;break e;case 3:w.flags=w.flags&-65537|128;case 0:if(w=x.payload,h=typeof w=="function"?w.call(g,v,h):w,h==null)break e;v=K({},v,h);break e;case 2:rt=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,h=l.effects,h===null?l.effects=[a]:h.push(a))}else g={eventTime:g,lane:h,tag:a.tag,payload:a.payload,callback:a.callback,next:null},p===null?(c=p=g,u=v):p=p.next=g,o|=h;if(a=a.next,a===null){if(a=l.shared.pending,a===null)break;h=a,a=h.next,h.next=null,l.lastBaseUpdate=h,l.shared.pending=null}}while(!0);if(p===null&&(u=v),l.baseState=u,l.firstBaseUpdate=c,l.lastBaseUpdate=p,t=l.shared.interleaved,t!==null){l=t;do o|=l.lane,l=l.next;while(l!==t)}else s===null&&(l.shared.lanes=0);Rt|=o,e.lanes=o,e.memoizedState=v}}function Ro(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Xl.transition;Xl.transition={};try{e(!1),t()}finally{I=n,Xl.transition=r}}function Au(){return Me().memoizedState}function Ef(e,t,n){var r=ht(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Bu(e))Vu(t,n);else if(n=ku(e,t,n,r),n!==null){var l=de();$e(n,e,r,l),Hu(n,t,r)}}function _f(e,t,n){var r=ht(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Bu(e))Vu(t,l);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var o=t.lastRenderedState,a=s(o,n);if(l.hasEagerState=!0,l.eagerState=a,Ue(a,o)){var u=t.interleaved;u===null?(l.next=l,Si(t)):(l.next=u.next,u.next=l),t.interleaved=l;return}}catch{}finally{}n=ku(e,t,l,r),n!==null&&(l=de(),$e(n,e,r,l),Hu(n,t,r))}}function Bu(e){var t=e.alternate;return e===Q||t!==null&&t===Q}function Vu(e,t){On=ll=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Hu(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ui(e,n)}}var sl={readContext:Te,useCallback:ie,useContext:ie,useEffect:ie,useImperativeHandle:ie,useInsertionEffect:ie,useLayoutEffect:ie,useMemo:ie,useReducer:ie,useRef:ie,useState:ie,useDebugValue:ie,useDeferredValue:ie,useTransition:ie,useMutableSource:ie,useSyncExternalStore:ie,useId:ie,unstable_isNewReconciler:!1},Pf={readContext:Te,useCallback:function(e,t){return Be().memoizedState=[e,t===void 0?null:t],e},useContext:Te,useEffect:Oo,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Fr(4194308,4,Ou.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Fr(4194308,4,e,t)},useInsertionEffect:function(e,t){return Fr(4,2,e,t)},useMemo:function(e,t){var n=Be();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Be();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Ef.bind(null,Q,e),[r.memoizedState,e]},useRef:function(e){var t=Be();return e={current:e},t.memoizedState=e},useState:Do,useDebugValue:Mi,useDeferredValue:function(e){return Be().memoizedState=e},useTransition:function(){var e=Do(!1),t=e[0];return e=Cf.bind(null,e[1]),Be().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Q,l=Be();if(H){if(n===void 0)throw Error(j(407));n=n()}else{if(n=t(),te===null)throw Error(j(349));Mt&30||_u(r,t,n)}l.memoizedState=n;var s={value:n,getSnapshot:t};return l.queue=s,Oo(zu.bind(null,r,s,e),[e]),r.flags|=2048,er(9,Pu.bind(null,r,s,n,t),void 0,null),n},useId:function(){var e=Be(),t=te.identifierPrefix;if(H){var n=Ge,r=Ye;n=(r&~(1<<32-Ie(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=qn++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[Ve]=t,e[Xn]=r,bu(e,t,!1,!1),t.stateNode=e;e:{switch(o=hs(n,r),n){case"dialog":A("cancel",e),A("close",e),l=r;break;case"iframe":case"object":case"embed":A("load",e),l=r;break;case"video":case"audio":for(l=0;lfn&&(t.flags|=128,r=!0,Nn(s,!1),t.lanes=4194304)}else{if(!r)if(e=rl(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Nn(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!H)return oe(t),null}else 2*X()-s.renderingStartTime>fn&&n!==1073741824&&(t.flags|=128,r=!0,Nn(s,!1),t.lanes=4194304);s.isBackwards?(o.sibling=t.child,t.child=o):(n=s.last,n!==null?n.sibling=o:t.child=o,s.last=o)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=X(),t.sibling=null,n=W.current,U(W,r?n&1|2:n&1),t):(oe(t),null);case 22:case 23:return $i(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?we&1073741824&&(oe(t),t.subtreeFlags&6&&(t.flags|=8192)):oe(t),null;case 24:return null;case 25:return null}throw Error(j(156,t.tag))}function Ff(e,t){switch(yi(t),t.tag){case 1:return ye(t.type)&&Zr(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return cn(),B(ge),B(ue),_i(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Ei(t),null;case 13:if(B(W),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(j(340));an()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return B(W),null;case 4:return cn(),null;case 10:return ki(t.type._context),null;case 22:case 23:return $i(),null;case 24:return null;default:return null}}var Sr=!1,ae=!1,If=typeof WeakSet=="function"?WeakSet:Set,N=null;function Xt(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Y(e,t,r)}else n.current=null}function Bs(e,t,n){try{n()}catch(r){Y(e,t,r)}}var Ko=!1;function $f(e,t){if(Ns=Kr,e=iu(),vi(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var l=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var o=0,a=-1,u=-1,c=0,p=0,v=e,h=null;t:for(;;){for(var g;v!==n||l!==0&&v.nodeType!==3||(a=o+l),v!==s||r!==0&&v.nodeType!==3||(u=o+r),v.nodeType===3&&(o+=v.nodeValue.length),(g=v.firstChild)!==null;)h=v,v=g;for(;;){if(v===e)break t;if(h===n&&++c===l&&(a=o),h===s&&++p===r&&(u=o),(g=v.nextSibling)!==null)break;v=h,h=v.parentNode}v=g}n=a===-1||u===-1?null:{start:a,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(Cs={focusedElem:e,selectionRange:n},Kr=!1,N=t;N!==null;)if(t=N,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,N=e;else for(;N!==null;){t=N;try{var w=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(w!==null){var x=w.memoizedProps,T=w.memoizedState,f=t.stateNode,d=f.getSnapshotBeforeUpdate(t.elementType===t.type?x:De(t.type,x),T);f.__reactInternalSnapshotBeforeUpdate=d}break;case 3:var m=t.stateNode.containerInfo;m.nodeType===1?m.textContent="":m.nodeType===9&&m.documentElement&&m.removeChild(m.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(j(163))}}catch(y){Y(t,t.return,y)}if(e=t.sibling,e!==null){e.return=t.return,N=e;break}N=t.return}return w=Ko,Ko=!1,w}function Fn(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var s=l.destroy;l.destroy=void 0,s!==void 0&&Bs(t,n,s)}l=l.next}while(l!==r)}}function wl(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Vs(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function nc(e){var t=e.alternate;t!==null&&(e.alternate=null,nc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Ve],delete t[Xn],delete t[Ps],delete t[wf],delete t[jf])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function rc(e){return e.tag===5||e.tag===3||e.tag===4}function Yo(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||rc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Hs(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Xr));else if(r!==4&&(e=e.child,e!==null))for(Hs(e,t,n),e=e.sibling;e!==null;)Hs(e,t,n),e=e.sibling}function Ws(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Ws(e,t,n),e=e.sibling;e!==null;)Ws(e,t,n),e=e.sibling}var re=null,Oe=!1;function tt(e,t,n){for(n=n.child;n!==null;)lc(e,t,n),n=n.sibling}function lc(e,t,n){if(He&&typeof He.onCommitFiberUnmount=="function")try{He.onCommitFiberUnmount(fl,n)}catch{}switch(n.tag){case 5:ae||Xt(n,t);case 6:var r=re,l=Oe;re=null,tt(e,t,n),re=r,Oe=l,re!==null&&(Oe?(e=re,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):re.removeChild(n.stateNode));break;case 18:re!==null&&(Oe?(e=re,n=n.stateNode,e.nodeType===8?Kl(e.parentNode,n):e.nodeType===1&&Kl(e,n),Wn(e)):Kl(re,n.stateNode));break;case 4:r=re,l=Oe,re=n.stateNode.containerInfo,Oe=!0,tt(e,t,n),re=r,Oe=l;break;case 0:case 11:case 14:case 15:if(!ae&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var s=l,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&Bs(n,t,o),l=l.next}while(l!==r)}tt(e,t,n);break;case 1:if(!ae&&(Xt(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){Y(n,t,a)}tt(e,t,n);break;case 21:tt(e,t,n);break;case 22:n.mode&1?(ae=(r=ae)||n.memoizedState!==null,tt(e,t,n),ae=r):tt(e,t,n);break;default:tt(e,t,n)}}function Go(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new If),t.forEach(function(r){var l=Yf.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function Re(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=o),r&=~s}if(r=l,r=X()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Af(r/1960))-r,10e?16:e,ot===null)var r=!1;else{if(e=ot,ot=null,al=0,O&6)throw Error(j(331));var l=O;for(O|=4,N=e.current;N!==null;){var s=N,o=s.child;if(N.flags&16){var a=s.deletions;if(a!==null){for(var u=0;uX()-Fi?Pt(e,0):Oi|=n),xe(e,t)}function fc(e,t){t===0&&(e.mode&1?(t=hr,hr<<=1,!(hr&130023424)&&(hr=4194304)):t=1);var n=de();e=qe(e,t),e!==null&&(rr(e,t,n),xe(e,n))}function Kf(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),fc(e,n)}function Yf(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(j(314))}r!==null&&r.delete(t),fc(e,n)}var pc;pc=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||ge.current)ve=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return ve=!1,Df(e,t,n);ve=!!(e.flags&131072)}else ve=!1,H&&t.flags&1048576&&gu(t,br,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Ir(e,t),e=t.pendingProps;var l=on(t,ue.current);tn(t,n),l=zi(null,t,r,e,l,n);var s=Li();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,ye(r)?(s=!0,Jr(t)):s=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,Ni(t),l.updater=xl,t.stateNode=l,l._reactInternals=t,Ds(t,r,e,n),t=Is(null,t,r,!0,s,n)):(t.tag=0,H&&s&&gi(t),ce(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Ir(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=Xf(r),e=De(r,e),l){case 0:t=Fs(null,t,r,e,n);break e;case 1:t=Ho(null,t,r,e,n);break e;case 11:t=Bo(null,t,r,e,n);break e;case 14:t=Vo(null,t,r,De(r.type,e),n);break e}throw Error(j(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:De(r,l),Fs(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:De(r,l),Ho(e,t,r,l,n);case 3:e:{if(Zu(t),e===null)throw Error(j(387));r=t.pendingProps,s=t.memoizedState,l=s.element,Su(e,t),nl(t,r,null,n);var o=t.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){l=dn(Error(j(423)),t),t=Wo(e,t,r,n,l);break e}else if(r!==l){l=dn(Error(j(424)),t),t=Wo(e,t,r,n,l);break e}else for(je=dt(t.stateNode.containerInfo.firstChild),ke=t,H=!0,Fe=null,n=ju(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(an(),r===l){t=be(e,t,n);break e}ce(e,t,r,n)}t=t.child}return t;case 5:return Nu(t),e===null&&Ts(t),r=t.type,l=t.pendingProps,s=e!==null?e.memoizedProps:null,o=l.children,Es(r,l)?o=null:s!==null&&Es(r,s)&&(t.flags|=32),Xu(e,t),ce(e,t,o,n),t.child;case 6:return e===null&&Ts(t),null;case 13:return Ju(e,t,n);case 4:return Ci(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=un(t,null,r,n):ce(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:De(r,l),Bo(e,t,r,l,n);case 7:return ce(e,t,t.pendingProps,n),t.child;case 8:return ce(e,t,t.pendingProps.children,n),t.child;case 12:return ce(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,s=t.memoizedProps,o=l.value,U(el,r._currentValue),r._currentValue=o,s!==null)if(Ue(s.value,o)){if(s.children===l.children&&!ge.current){t=be(e,t,n);break e}}else for(s=t.child,s!==null&&(s.return=t);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var u=a.firstContext;u!==null;){if(u.context===r){if(s.tag===1){u=Xe(-1,n&-n),u.tag=2;var c=s.updateQueue;if(c!==null){c=c.shared;var p=c.pending;p===null?u.next=u:(u.next=p.next,p.next=u),c.pending=u}}s.lanes|=n,u=s.alternate,u!==null&&(u.lanes|=n),Ms(s.return,n,t),a.lanes|=n;break}u=u.next}}else if(s.tag===10)o=s.type===t.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(j(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),Ms(o,n,t),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===t){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}ce(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,tn(t,n),l=Te(l),r=r(l),t.flags|=1,ce(e,t,r,n),t.child;case 14:return r=t.type,l=De(r,t.pendingProps),l=De(r.type,l),Vo(e,t,r,l,n);case 15:return Yu(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:De(r,l),Ir(e,t),t.tag=1,ye(r)?(e=!0,Jr(t)):e=!1,tn(t,n),Wu(t,r,l),Ds(t,r,l,n),Is(null,t,r,!0,e,n);case 19:return qu(e,t,n);case 22:return Gu(e,t,n)}throw Error(j(156,t.tag))};function hc(e,t){return Ba(e,t)}function Gf(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Pe(e,t,n,r){return new Gf(e,t,n,r)}function Ai(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Xf(e){if(typeof e=="function")return Ai(e)?1:0;if(e!=null){if(e=e.$$typeof,e===si)return 11;if(e===ii)return 14}return 2}function mt(e,t){var n=e.alternate;return n===null?(n=Pe(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Ar(e,t,n,r,l,s){var o=2;if(r=e,typeof e=="function")Ai(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case At:return zt(n.children,l,s,t);case li:o=8,l|=8;break;case ls:return e=Pe(12,n,t,l|2),e.elementType=ls,e.lanes=s,e;case ss:return e=Pe(13,n,t,l),e.elementType=ss,e.lanes=s,e;case is:return e=Pe(19,n,t,l),e.elementType=is,e.lanes=s,e;case Na:return kl(n,l,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case ka:o=10;break e;case Sa:o=9;break e;case si:o=11;break e;case ii:o=14;break e;case nt:o=16,r=null;break e}throw Error(j(130,e==null?e:typeof e,""))}return t=Pe(o,n,t,l),t.elementType=e,t.type=r,t.lanes=s,t}function zt(e,t,n,r){return e=Pe(7,e,r,t),e.lanes=n,e}function kl(e,t,n,r){return e=Pe(22,e,r,t),e.elementType=Na,e.lanes=n,e.stateNode={isHidden:!1},e}function es(e,t,n){return e=Pe(6,e,null,t),e.lanes=n,e}function ts(e,t,n){return t=Pe(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Zf(e,t,n,r,l){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ol(0),this.expirationTimes=Ol(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ol(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function Bi(e,t,n,r,l,s,o,a,u){return e=new Zf(e,t,n,a,u),t===1?(t=1,s===!0&&(t|=8)):t=0,s=Pe(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ni(s),e}function Jf(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(yc)}catch(e){console.error(e)}}yc(),ya.exports=Ne;var np=ya.exports,xc,na=np;xc=na.createRoot,na.hydrateRoot;const wc=()=>{var e,t;return(t=(e=window==null?void 0:window.go)==null?void 0:e.main)==null?void 0:t.App},rp=()=>!!wc();async function F(e,...t){const n=wc();if(!n||typeof n[e]!="function")throw new Error(`${e} is unavailable — run this inside the Behavision app`);return n[e](...t)}const $={session:()=>F("Session"),login:(e,t)=>F("Login",e,t),logout:()=>F("Logout"),claim:e=>F("Claim",e),runStandalone:()=>F("RunStandalone"),engineStatus:()=>F("EngineStatus"),startEngine:()=>F("StartEngine"),stopEngine:()=>F("StopEngine"),cameras:()=>F("Cameras"),testCamera:e=>F("TestCamera",e),discoverCameras:()=>F("DiscoverCameras"),saveCamera:(e,t)=>F("SaveCamera",e,t),deleteCamera:e=>F("DeleteCamera",e),startPlacement:(e,t)=>F("StartPlacementCheck",e,t),placementResult:e=>F("PlacementResult",e),streamURL:e=>F("StreamURL",e),live:()=>F("Live"),pipelineStatus:()=>F("PipelineStatus"),localIdentities:e=>F("LocalIdentities",e),localSightings:e=>F("LocalSightings",e),footfall:(e,t,n)=>F("Footfall",e,t,n),sites:()=>F("Sites"),visitorHistory:(e,t)=>F("VisitorHistory",e,t),visitorPhoto:e=>F("VisitorPhoto",e),forgetCustomer:e=>F("ForgetCustomer",e),sales:(e,t)=>F("Sales",e,t),customers:(e,t)=>F("Customers",e,t),saveProfile:e=>F("SaveProfile",e),ask:e=>F("Ask",e),recordPurchase:(e,t,n,r)=>F("RecordPurchase",e,t,n,r)};function fe(e){return e?typeof e=="string"?e:e.message||String(e):"Something went wrong."}function Ot(e,t,n=[]){const[r,l]=P.useState(null),[s,o]=P.useState(null),[a,u]=P.useState(!0),c=P.useRef(!0),p=P.useRef(!1),v=P.useCallback(async()=>{if(!p.current){p.current=!0;try{const h=await e();if(!c.current)return;l(h),o(null)}catch(h){c.current&&o(fe(h))}finally{p.current=!1,c.current&&u(!1)}}},n);return P.useEffect(()=>{if(c.current=!0,v(),!t)return()=>{c.current=!1};const h=setInterval(v,t);return()=>{c.current=!1,clearInterval(h)}},[v,t]),{data:r,error:s,loading:a,reload:v}}function lp(e){if(!e)return"—";const t=typeof e=="number"?new Date(e*1e3):new Date(e);return isNaN(t)?"—":t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function ra(e){if(!e)return"—";const t=typeof e=="number"?new Date(e*1e3):new Date(e);return isNaN(t)?"—":t.toLocaleDateString([],{day:"numeric",month:"short"})}const ns={width:18,height:18,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false"};function ne({size:e,children:t,...n}){return i.jsx("svg",{...ns,...n,width:e??ns.width,height:e??ns.height,children:t})}const sp=e=>i.jsxs(ne,{...e,children:[i.jsx("circle",{cx:"12",cy:"12",r:"3.2"}),i.jsx("path",{d:"M5.6 5.6a9 9 0 0 0 0 12.8M18.4 18.4a9 9 0 0 0 0-12.8"})]}),ip=e=>i.jsxs(ne,{...e,children:[i.jsx("circle",{cx:"9",cy:"8.5",r:"3.2"}),i.jsx("path",{d:"M2.8 19.5a6.4 6.4 0 0 1 12.4 0"}),i.jsx("path",{d:"M16.5 6.2a3.2 3.2 0 0 1 0 6.1M18 19.5a6 6 0 0 0-1.6-4"})]}),op=e=>i.jsxs(ne,{...e,children:[i.jsx("path",{d:"M3 8.5h3.4L8 6h8l1.6 2.5H21v10.2H3z"}),i.jsx("circle",{cx:"12",cy:"13.2",r:"3.1"})]}),jc=e=>i.jsxs(ne,{...e,children:[i.jsx("circle",{cx:"11",cy:"11",r:"6.4"}),i.jsx("path",{d:"M15.8 15.8 20.5 20.5"})]}),la=e=>i.jsx(ne,{...e,children:i.jsx("path",{d:"M12 5.5v13M5.5 12h13"})}),Qi=e=>i.jsx(ne,{...e,children:i.jsx("path",{d:"M6.5 6.5l11 11M17.5 6.5l-11 11"})}),Xs=e=>i.jsx(ne,{...e,children:i.jsx("path",{d:"M5 12.8l4.4 4.2L19 7"})}),kc=e=>i.jsx(ne,{...e,children:i.jsx("path",{d:"M8 5.6v12.8L18.5 12z"})}),ap=e=>i.jsx(ne,{...e,children:i.jsx("rect",{x:"7",y:"7",width:"10",height:"10",rx:"1.6"})}),Le=e=>i.jsxs(ne,{...e,children:[i.jsx("path",{d:"M12 4.6 21 19.4H3z"}),i.jsx("path",{d:"M12 10v4.1"}),i.jsx("path",{d:"M12 17.1v.01"})]}),sa=e=>i.jsx(ne,{...e,children:i.jsx("path",{d:"M5 19.4v-4.2M10.3 19.4v-7.6M15.7 19.4v-11M21 19.4V4.6"})}),up=e=>i.jsx(ne,{...e,children:i.jsx("path",{d:"M7.2 18.4a4.2 4.2 0 0 1-.6-8.35A6.2 6.2 0 0 1 18.4 9a4.2 4.2 0 0 1 .3 9.4z"})}),Sc=e=>i.jsxs(ne,{...e,children:[i.jsx("path",{d:"M7.2 18.4a4.2 4.2 0 0 1-.6-8.35 6.2 6.2 0 0 1 2-3.2M10.6 5.2A6.2 6.2 0 0 1 18.4 9a4.2 4.2 0 0 1 1.9 7.6"}),i.jsx("path",{d:"M3.6 3.6l16.8 16.8"})]}),cp=e=>i.jsxs(ne,{...e,children:[i.jsx("path",{d:"M10.2 13.8a3.6 3.6 0 0 0 5.2 0l2.8-2.8a3.7 3.7 0 0 0-5.2-5.2l-1.3 1.3"}),i.jsx("path",{d:"M13.8 10.2a3.6 3.6 0 0 0-5.2 0l-2.8 2.8a3.7 3.7 0 0 0 5.2 5.2l1.3-1.3"})]}),dp=e=>i.jsxs(ne,{...e,children:[i.jsx("path",{d:"M14.4 7.6V5.4H4.6v13.2h9.8v-2.2"}),i.jsx("path",{d:"M10 12h9.4M16.4 8.8 19.8 12l-3.4 3.2"})]}),fp=e=>i.jsx(ne,{...e,children:i.jsx("path",{d:"M9.4 5.6 16 12l-6.6 6.4"})}),Nc=e=>i.jsxs(ne,{...e,strokeWidth:"1.2",children:[i.jsx("path",{d:"M3 8.5h3.4L8 6h8l1.6 2.5H21v10.2H3z"}),i.jsx("circle",{cx:"12",cy:"13.2",r:"3.1"}),i.jsx("path",{d:"M3.6 3.6l16.8 16.8"})]}),Cc=e=>i.jsxs(ne,{...e,strokeWidth:"1.2",children:[i.jsx("circle",{cx:"12",cy:"9",r:"3.4"}),i.jsx("path",{d:"M5.4 20a6.8 6.8 0 0 1 13.2 0"})]}),rn=""+new URL("loyaly-mark-Ch-P3VSF.png",import.meta.url).href;function pp({onDone:e}){const[t,n]=P.useState(""),[r,l]=P.useState(""),[s,o]=P.useState(!1),[a,u]=P.useState(null);async function c(p){p.preventDefault(),o(!0),u(null);try{e(await $.login(t.trim(),r))}catch(v){u(fe(v))}finally{o(!1)}}return i.jsx("div",{className:"login",children:i.jsxs("div",{className:"box",children:[i.jsx("span",{className:"mark",children:i.jsx("img",{src:rn,alt:""})}),i.jsx("h1",{children:"Behavision"}),i.jsx("p",{className:"lead",children:"Sign in to connect this PC to your store."}),i.jsxs("form",{onSubmit:c,children:[a&&i.jsxs("div",{className:"err",children:[i.jsx(Le,{size:15}),a]}),i.jsxs("label",{className:"field",children:[i.jsx("span",{children:"Email"}),i.jsx("input",{type:"email",value:t,autoComplete:"username",required:!0,autoFocus:!0,onChange:p=>n(p.target.value)})]}),i.jsxs("label",{className:"field",children:[i.jsx("span",{children:"Password"}),i.jsx("input",{type:"password",value:r,autoComplete:"current-password",required:!0,onChange:p=>l(p.target.value)})]}),i.jsx("button",{className:"btn primary",disabled:s||!t||!r,children:s?"Signing in…":"Sign in"})]}),i.jsx("p",{className:"foot",children:"Signing in downloads this store's recognition models and connects it to your account. Nothing is sent until a camera is set up."})]})})}function ia({onDone:e,onCancel:t}){const[n,r]=P.useState(""),[l,s]=P.useState(null),[o,a]=P.useState(null),[u,c]=P.useState(!1);async function p(h){h.preventDefault(),s("claim"),a(null);try{e(await $.claim(n))}catch(g){a(fe(g))}finally{s(null)}}async function v(){s("alone"),a(null);try{e(await $.runStandalone())}catch(h){a(fe(h))}finally{s(null)}}return i.jsx("div",{className:"login",children:i.jsxs("div",{className:"box",children:[i.jsx("span",{className:"mark",children:i.jsx("img",{src:rn,alt:""})}),i.jsx("h1",{children:t?"Link to head office":"Set up this PC"}),i.jsx("p",{className:"lead",children:"Type the installation code for this shop. You only do this once."}),i.jsxs("form",{onSubmit:p,children:[o&&i.jsxs("div",{className:"err",children:[i.jsx(Le,{size:15}),o]}),i.jsxs("label",{className:"field",children:[i.jsx("span",{children:"Installation code"}),i.jsx("input",{value:n,autoFocus:!0,required:!0,placeholder:"ABCDEF-123456-GHIJKL-789012",autoComplete:"off",spellCheck:"false",style:{textTransform:"uppercase",letterSpacing:".06em"},onChange:h=>r(h.target.value)})]}),i.jsx("button",{className:"btn primary",disabled:!!l||n.trim().length<6,children:l==="claim"?"Linking…":"Link this PC"})]}),i.jsx("p",{className:"foot",children:"The code works once. Ask whoever manages your shops for it — they can create one from the Behavision platform, under the shop."}),i.jsx("div",{className:"alt",children:t?i.jsx("button",{type:"button",className:"linkbtn",onClick:t,children:"Not now — go back"}):u?i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"note",children:"This PC will watch its cameras and recognise returning customers on its own. Nothing is sent anywhere. You can link it to head office later without losing anything recorded here."}),i.jsx("button",{type:"button",className:"btn",disabled:!!l,onClick:v,children:l==="alone"?"Setting up…":"Use this PC on its own"})]}):i.jsx("button",{type:"button",className:"linkbtn",onClick:()=>c(!0),children:"No head office — set this PC up on its own"})})]})})}function Ec(){var p,v;const{data:e,error:t}=Ot(()=>$.live(),3e3),{data:n}=Ot(()=>$.pipelineStatus(),5e3),r=((p=e==null?void 0:e.stats)==null?void 0:p.cameras)??[],l=((v=e==null?void 0:e.stats)==null?void 0:v.gallery)??{},s=(e==null?void 0:e.events)??[],o=r.reduce((h,g)=>{var x,T;const w=(T=(x=g==null?void 0:g.pipeline)==null?void 0:x.best_quality)==null?void 0:T.fraction_below_gate;return typeof w=="number"&&w>h?w:h},0),a=r.filter(h=>h.connected).length,u=s.filter(h=>h.type==="person.new"||h.type==="person.seen"),c=gp(u[0]);return i.jsxs("div",{className:"page",children:[i.jsxs("header",{children:[i.jsx("h2",{children:"Live"}),i.jsx("p",{children:"Who is in the shop, and whether it is reaching head office."})]}),t&&i.jsxs("div",{className:"err",children:[i.jsx(Le,{size:15}),t]}),i.jsx(vp,{pipe:n,cameras:r,up:a}),i.jsxs("div",{className:"panel arrivals-panel",children:[i.jsxs("div",{className:"panelhead",children:[i.jsx("h3",{children:"Who just walked in"}),u.length>0&&i.jsxs("span",{className:"note",children:[u.length," today"]})]}),i.jsx("div",{className:"panelbody flush",children:u.length===0?i.jsxs("div",{className:"empty",children:[i.jsx(Cc,{size:34}),i.jsx("b",{children:"Nobody yet"}),i.jsx("p",{children:"Customers appear here the moment a camera recognises a face."})]}):i.jsx("div",{className:"arrivals",children:u.slice(0,30).map((h,g)=>i.jsx(hp,{e:h,fresh:g===0&&c},`${h.ts}-${g}`))})})]}),i.jsxs("div",{className:"metrics",style:{marginTop:"var(--sp-4)"},children:[i.jsx(Er,{k:"People known",v:l.identities??"—"}),i.jsx(Er,{k:"Sightings",v:l.sightings??"—"}),i.jsx(Er,{k:"Cameras live",v:r.length?`${a}/${r.length}`:"—",tone:r.length?a===0?"bad":a.5?"bad":o>.2?"warn":"ok",s:o>.5?"Most visitors are being missed — move the camera":"Share of faces below the enrolment gate"})]})]})}function hp({e,fresh:t}){var o,a,u,c,p,v;const n=e.type==="person.new",r=((o=e.data)==null?void 0:o.label)||"Unrecognised",l=[(a=e.data)==null?void 0:a.gender,((u=e.data)==null?void 0:u.age)??((c=e.data)==null?void 0:c.age_range),(p=e.data)==null?void 0:p.emotion].filter(Boolean),s=typeof((v=e.data)==null?void 0:v.similarity)=="number"?e.data.similarity:null;return i.jsxs("article",{className:`arrival ${n?"is-new":"is-seen"} ${t?"fresh":""}`,children:[i.jsx("div",{className:"avatar",children:mp(r)}),i.jsxs("div",{className:"who",children:[i.jsx("div",{className:"name",children:r}),i.jsxs("div",{className:"meta",children:[e.camera_id,l.length>0&&i.jsxs(i.Fragment,{children:[" · ",l.join(", ")]}),s!==null&&!n&&i.jsxs(i.Fragment,{children:[" · match ",s.toFixed(2)]})]})]}),i.jsxs("div",{className:"right",children:[i.jsx("span",{className:`tag ${n?"new":"seen"}`,children:n?"new":"returning"}),i.jsx("span",{className:"when",children:lp(e.ts)})]})]})}function mp(e){var r;const t=/^Visitor (\d+)$/.exec(String(e).trim());if(t)return t[1];const n=String(e).trim().split(/\s+/).filter(Boolean);return n.length?(n[0][0]+(((r=n[1])==null?void 0:r[0])??"")).toUpperCase():"?"}function vp({pipe:e,cameras:t,up:n}){if(!e)return null;if(e.standalone)return i.jsxs("div",{className:"statusbar",children:[i.jsxs("span",{className:"item",children:[i.jsx("i",{className:"dot ok"}),i.jsx("b",{children:"Running on this PC only"})]}),i.jsx("span",{className:"sep"}),i.jsx("span",{className:"item note",children:"Recognition and customers stay here."}),i.jsx("span",{className:"grow"}),i.jsxs("span",{className:"item note",children:[i.jsx(sa,{size:14}),n," of ",t.length," cameras"]})]});const r=e.claimed&&!e.broker_up,l=e.claimed?e.broker_up?"ok":"bad":"idle",s=e.claimed?e.broker_up?"Sending to head office":"Offline — saving locally":"Not linked to head office";return i.jsxs("div",{className:"statusbar",children:[i.jsxs("span",{className:"item",children:[e.broker_up?i.jsx(up,{size:15}):i.jsx(Sc,{size:15}),i.jsx("i",{className:`dot ${l}`}),i.jsx("b",{children:s})]}),i.jsx("span",{className:"sep"}),i.jsxs("span",{className:"item note",children:[e.accepted," recorded today"]}),e.queued>0&&i.jsxs("span",{className:`item note ${r?"warn":""}`,children:[e.queued," waiting to send"]}),e.dropped>0&&i.jsxs("span",{className:"item note bad",children:[i.jsx(Le,{size:14}),e.dropped," lost — this PC was offline too long"]}),i.jsx("span",{className:"grow"}),i.jsxs("span",{className:"item note",children:[i.jsx(sa,{size:14}),n," of ",t.length," cameras"]})]})}function Er({k:e,v:t,s:n,tone:r}){return i.jsxs("div",{className:`metric ${r??""}`,children:[i.jsx("div",{className:"metric-k",children:e}),i.jsx("div",{className:"metric-v",children:t}),n&&i.jsx("div",{className:"metric-s",children:n})]})}function gp(e){const[t,n]=P.useState(!1),r=P.useRef(null);return P.useEffect(()=>{if(!e||e.ts===r.current)return;const l=r.current===null;if(r.current=e.ts,l)return;n(!0);const s=setTimeout(()=>n(!1),1200);return()=>clearTimeout(s)},[e==null?void 0:e.ts]),t}function yp(e){const[t,n]=P.useState(null);return P.useEffect(()=>{let r=!0;return n(null),$.visitorPhoto(e).then(l=>{r&&n(l)}).catch(()=>{r&&n({available:!1,reason:""})}),()=>{r=!1}},[e]),t}function xp({photo:e,name:t,customerRef:n,onBroken:r}){return e!=null&&e.available?i.jsx("img",{className:"avatar",src:e.url,alt:`Photo of ${t}`,onError:r}):i.jsx("div",{className:"avatar none",role:"img","aria-label":`No photo of ${t}`,children:i.jsx("span",{children:wp(t,n)})})}function wp(e,t){const n=/^Visitor (\d+)$/.exec(String(e||"").trim());if(n)return n[1];const r=/^V-(\d+)$/.exec(String(t||""));return r?r[1]:String(e||"").split(/\s+/).filter(Boolean).slice(0,2).map(l=>l[0].toUpperCase()).join("")||"?"}function jp({customer:e}){const{data:t,error:n,loading:r}=Ot(()=>$.visitorHistory(e.id,50),0,[e.id]);if(r)return i.jsx("p",{className:"note",children:"Loading visits…"});if(n)return i.jsxs("p",{className:"note",children:["Could not load visits: ",n]});const l=t??[];return l.length===0?i.jsx("p",{className:"note",children:"No recorded visits yet."}):i.jsx("ul",{className:"timeline",children:l.map(s=>i.jsxs("li",{children:[i.jsx("span",{className:"when",children:kp(s.occurred_at)}),i.jsxs("span",{className:"where",children:[s.site||"this store",s.camera_id?i.jsxs("span",{className:"note",children:[" · ",s.camera_id]}):null]}),s.is_new_visitor&&i.jsx("span",{className:"tag new",children:"first visit"})]},s.id))})}function kp(e){const t=new Date(e);return isNaN(t)?"—":t.toLocaleString([],{day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"})}function Sp({customer:e,onCancel:t,onDone:n}){const r=e.full_name||e.label,[l,s]=P.useState(""),[o,a]=P.useState(!1),[u,c]=P.useState(null),p=l.trim().toLowerCase()===r.trim().toLowerCase();async function v(){a(!0),c(null);try{await $.forgetCustomer(e.id),n()}catch(h){c(fe(h)),a(!1)}}return i.jsxs("div",{className:"confirm",children:[i.jsxs("h4",{children:["Erase ",r,"?"]}),i.jsxs("div",{className:"cols",children:[i.jsxs("div",{children:[i.jsx("p",{className:"lbl bad",children:"Deleted for good"}),i.jsxs("ul",{children:[i.jsx("li",{children:"Their face data — they will not be recognised again"}),i.jsx("li",{children:"Their photo"}),i.jsx("li",{children:"Their name, phone, email and notes"})]})]}),i.jsxs("div",{children:[i.jsx("p",{className:"lbl",children:"Kept"}),i.jsxs("ul",{children:[i.jsx("li",{children:"Past visits, with their name removed — your footfall figures do not change"}),i.jsx("li",{children:"The consent record, marked withdrawn, as proof of what was agreed"})]})]})]}),i.jsx("p",{className:"note",children:"This cannot be undone. If they come back they will be recorded as a new customer."}),u&&i.jsx("div",{className:"err",children:u}),i.jsxs("label",{className:"field",children:[i.jsxs("span",{children:["Type ",i.jsx("b",{children:r})," to confirm"]}),i.jsx("input",{value:l,onChange:h=>s(h.target.value),autoFocus:!0,autoComplete:"off",spellCheck:"false","aria-label":`Type ${r} to confirm erasure`})]}),i.jsxs("div",{className:"row",children:[i.jsx("button",{type:"button",className:"btn danger",disabled:!p||o,onClick:v,children:o?"Erasing…":"Erase permanently"}),i.jsx("button",{type:"button",className:"btn",onClick:t,disabled:o,children:"Cancel"})]})]})}function Np({customer:e,session:t,onClose:n,onSaved:r}){var C;const[l,s]=P.useState({full_name:e.full_name??"",phone:e.phone??"",email:e.email??"",gender:"",date_of_birth:"",notes:"",consent:e.has_consent??!1}),[o,a]=P.useState({amount:"",items:"",notes:""}),[u,c]=P.useState(!1),[p,v]=P.useState(null),[h,g]=P.useState(!1),[w,x]=P.useState(null),T=yp(e.id),f=w??T,d=(C=t==null?void 0:t.user)==null?void 0:C.role,m=["admin","owner","manager"].includes(d),y=k=>E=>s({...l,[k]:E.target.value});async function S(k){k.preventDefault(),c(!0),v(null);try{await $.saveProfile({visitor_id:e.id,...l});const E=parseFloat(o.amount);if(!isNaN(E)&&E>0){const z=o.items.split(",").map(L=>L.trim()).filter(Boolean);await $.recordPurchase(e.id,E,z,o.notes)}r()}catch(E){v(fe(E))}finally{c(!1)}}return i.jsx("div",{className:"drawer",onMouseDown:k=>k.target===k.currentTarget&&n(),children:i.jsxs("div",{className:"sheet",children:[i.jsxs("div",{className:"sheethead who",children:[i.jsx(xp,{photo:f,name:e.full_name||e.label,customerRef:e.ref,onBroken:()=>x({available:!1,reason:"The photo could not be loaded."})}),i.jsxs("div",{className:"grow",children:[i.jsx("h2",{children:e.full_name||e.label}),i.jsxs("p",{className:"note",children:[e.visit_count," visit",e.visit_count===1?"":"s",e.last_seen_at&&` · last seen ${new Date(e.last_seen_at).toLocaleDateString()}`,f&&!f.available&&f.reason&&` · ${f.reason}`]})]}),i.jsx("button",{type:"button",className:"close",onClick:n,"aria-label":"Close",children:"✕"})]}),i.jsxs("form",{className:"sheetbody",onSubmit:S,children:[p&&i.jsx("div",{className:"err",children:p}),i.jsxs("section",{className:"formsection",children:[i.jsx("h4",{children:"Customer details"}),i.jsxs("label",{className:"field",children:[i.jsx("span",{children:"Full name"}),i.jsx("input",{value:l.full_name,onChange:y("full_name"),autoFocus:!0})]}),i.jsxs("div",{className:"fieldrow",children:[i.jsxs("label",{className:"field",children:[i.jsx("span",{children:"Phone"}),i.jsx("input",{value:l.phone,onChange:y("phone"),inputMode:"tel"})]}),i.jsxs("label",{className:"field",children:[i.jsx("span",{children:"Email"}),i.jsx("input",{value:l.email,onChange:y("email"),type:"email"})]})]}),i.jsxs("div",{className:"fieldrow",children:[i.jsxs("label",{className:"field",children:[i.jsx("span",{children:"Gender"}),i.jsxs("select",{value:l.gender,onChange:y("gender"),children:[i.jsx("option",{value:"",children:"Not recorded"}),i.jsx("option",{children:"Female"}),i.jsx("option",{children:"Male"}),i.jsx("option",{children:"Other"})]})]}),i.jsxs("label",{className:"field",children:[i.jsx("span",{children:"Date of birth"}),i.jsx("input",{type:"date",value:l.date_of_birth,onChange:y("date_of_birth")})]})]}),i.jsxs("label",{className:"field",children:[i.jsx("span",{children:"Notes"}),i.jsx("textarea",{value:l.notes,onChange:y("notes"),placeholder:"Preferences, sizes, anything worth remembering"})]})]}),i.jsxs("section",{className:"formsection",children:[i.jsx("h4",{children:"Purchase (optional)"}),i.jsxs("div",{className:"fieldrow",children:[i.jsxs("label",{className:"field",children:[i.jsx("span",{children:"Amount"}),i.jsx("input",{value:o.amount,inputMode:"decimal",placeholder:"0.00",onChange:k=>a({...o,amount:k.target.value})})]}),i.jsxs("label",{className:"field",children:[i.jsx("span",{children:"Items"}),i.jsx("input",{value:o.items,placeholder:"shirt, belt",onChange:k=>a({...o,items:k.target.value})})]})]}),i.jsx("p",{className:"note",children:"Leave the amount blank if they did not buy anything — a visit without a sale is still worth recording."})]}),i.jsxs("section",{className:"formsection",children:[i.jsx("h4",{children:"Consent"}),i.jsxs("label",{style:{display:"flex",gap:10,alignItems:"flex-start",fontSize:13,cursor:"pointer"},children:[i.jsx("input",{type:"checkbox",checked:l.consent,style:{marginTop:3},onChange:k=>s({...l,consent:k.target.checked})}),i.jsx("span",{children:"This customer agreed to us keeping their details and recognising them on future visits."})]}),i.jsx("p",{className:"note",style:{marginTop:10},children:"Recorded with the date and who collected it. They can withdraw it at any time, which erases their face data."})]}),i.jsxs("section",{className:"formsection",children:[i.jsx("h4",{children:"Visits"}),i.jsx(jp,{customer:e})]}),i.jsxs("div",{className:"sheetactions",children:[i.jsx("button",{type:"button",className:"btn",onClick:n,children:"Cancel"}),i.jsx("button",{className:"btn primary",disabled:u,children:u?"Saving…":"Save"})]}),m&&i.jsxs("section",{className:"formsection dangerzone",children:[i.jsx("h4",{children:"At the customer's request"}),h?i.jsx(Sp,{customer:e,onCancel:()=>g(!1),onDone:r}):i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"note",children:"Erase this person's face data, photo and details. Their past visits stay in your footfall figures, without their name."}),i.jsx("button",{type:"button",className:"btn danger",onClick:()=>g(!0),children:"Erase this customer…"})]})]})]})]})})}function Cp({session:e}){const[t,n]=P.useState(""),[r,l]=P.useState(null),{data:s,error:o,reload:a}=Ot(()=>$.customers(t,200),3e4,[t]),u=s??[],c=u.filter(p=>p.has_profile).length;return i.jsxs("div",{className:"page",children:[i.jsxs("header",{className:"pagehead",children:[i.jsxs("div",{children:[i.jsx("h2",{children:"Customers"}),i.jsx("p",{children:"Everyone this business has recognised. Fill in details once and they are known at every store."})]}),i.jsxs("label",{className:"search",children:[i.jsx(jc,{size:15}),i.jsx("input",{placeholder:"Search by name or phone",value:t,onChange:p=>n(p.target.value)})]})]}),o&&i.jsxs("div",{className:"err",children:[i.jsx(Le,{size:15}),o]}),i.jsxs("div",{className:"metrics",style:{marginBottom:"var(--sp-4)"},children:[i.jsx(_r,{k:"Known people",v:u.length||"—"}),i.jsx(_r,{k:"With details",v:c||"—",s:u.length?`${Math.round(100*c/u.length)}% captured`:null}),i.jsx(_r,{k:"Returning",v:u.filter(p=>p.visit_count>1).length||"—"}),i.jsx(_r,{k:"With consent",v:u.filter(p=>p.has_consent).length||"—"})]}),i.jsx("div",{className:"panel",children:u.length===0?i.jsxs("div",{className:"empty tall",children:[i.jsx(Cc,{size:34}),i.jsx("b",{children:"No customers yet"}),i.jsx("p",{children:"They appear here the first time a camera recognises them. Click one to add a name and phone number."})]}):i.jsx("div",{className:"tablewrap",children:i.jsxs("table",{children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{children:"Customer"}),i.jsx("th",{children:"Phone"}),i.jsx("th",{className:"num",children:"Visits"}),i.jsx("th",{children:"First seen"}),i.jsx("th",{children:"Last seen"}),i.jsx("th",{children:"Details"})]})}),i.jsx("tbody",{children:u.map(p=>i.jsxs("tr",{className:"click",onClick:()=>l(p),children:[i.jsxs("td",{children:[p.full_name||i.jsx("span",{className:"note",children:p.label}),p.full_name&&p.ref&&i.jsxs("span",{className:"note",children:[" · ",p.ref]})]}),i.jsx("td",{className:"mono",children:p.phone||"—"}),i.jsx("td",{className:"num",children:p.visit_count}),i.jsx("td",{children:ra(p.first_seen_at)}),i.jsx("td",{children:ra(p.last_seen_at)}),i.jsx("td",{children:p.has_profile?i.jsxs("span",{className:"pill ok",children:[i.jsx("i",{className:"dot ok"}),"captured"]}):i.jsxs("span",{className:"pill warn",children:[i.jsx("i",{className:"dot warn"}),"needed"]})})]},p.id))})]})})}),r&&i.jsx(Np,{customer:r,session:e,onClose:()=>l(null),onSaved:()=>{l(null),a()}})]})}function _r({k:e,v:t,s:n}){return i.jsxs("div",{className:"metric",children:[i.jsx("div",{className:"metric-k",children:e}),i.jsx("div",{className:"metric-v",children:t}),n&&i.jsx("div",{className:"metric-s",children:n})]})}const ln=[{id:"hikvision",label:"Hikvision",path:"/Streaming/Channels/101",note:"Channel 1, main stream. Use /Streaming/Channels/102 for the lower-quality sub stream."},{id:"dahua",label:"Dahua",path:"/cam/realmonitor?channel=1&subtype=0",note:"Channel 1, main stream. subtype=1 is the sub stream."},{id:"cpplus",label:"CP Plus",path:"/cam/realmonitor?channel=1&subtype=0",note:"CP Plus cameras use the Dahua stream path."},{id:"uniview",label:"Uniview",path:"/media/video1",note:"Some older Uniview models use /video1 instead."},{id:"tplink",label:"TP-Link / Tapo",path:"/stream1",note:"Tapo cameras need a separate camera account created in the Tapo app — your Tapo login will not work."},{id:"reolink",label:"Reolink",path:"/h264Preview_01_main",note:"Use /h264Preview_01_sub for the lower-quality stream."},{id:"amcrest",label:"Amcrest",path:"/cam/realmonitor?channel=1&subtype=0",note:"Amcrest cameras use the Dahua stream path."},{id:"axis",label:"Axis",path:"/axis-media/media.amp",note:""},{id:"onvif",label:"Other (ONVIF)",path:"/onvif1",note:"Many generic cameras answer here. If it does not work, look for “RTSP” in the camera’s own app."},{id:"manual",label:"I know the path",path:"",note:""}],Pr=e=>ln.find(t=>t.id===e)||ln[ln.length-1],Zs={id:"",host:"",port:554,path:"",username:"",password:"",max_width:1280};function Ep(){const{data:e,error:t,reload:n}=Ot(()=>$.cameras(),8e3),[r,l]=P.useState(null),[s,o]=P.useState(null),a=e??[],u=Pp(a);async function c(p){if(confirm(`Remove ${p.id}? Recognition from it stops immediately.`))try{await $.deleteCamera(p.id),n()}catch(v){alert(fe(v))}}return i.jsxs("div",{className:"page",children:[i.jsxs("header",{className:"pagehead",children:[i.jsxs("div",{children:[i.jsx("h2",{children:"Cameras"}),i.jsx("p",{children:"Add a camera, then prove it can see faces with a walk-past. Only then is it working."})]}),i.jsxs("button",{className:"btn primary",onClick:()=>l({...Zs}),children:[i.jsx(la,{size:15}),"Add camera"]})]}),t&&i.jsxs("div",{className:"err",children:[i.jsx(Le,{size:15}),t]}),a.length===0?i.jsx("div",{className:"panel",children:i.jsxs("div",{className:"empty tall",children:[i.jsx(Nc,{size:40}),i.jsx("b",{children:"No cameras yet"}),i.jsx("p",{children:"Add the camera by its address. Most cameras print it on a label underneath, or show it in their own app."}),i.jsxs("button",{className:"btn primary",onClick:()=>l({...Zs}),children:[i.jsx(la,{size:15}),"Add your first camera"]})]})}):i.jsx("div",{className:"camgrid",children:a.map(p=>i.jsx(_p,{cam:p,stream:u[p.id],onEdit:()=>l(p),onCheck:()=>o(p.id),onRemove:()=>c(p)},p.id))}),r&&i.jsx(zp,{cam:r,onClose:()=>l(null),onSaved:()=>{l(null),n()}}),s&&i.jsx(Lp,{id:s,onClose:()=>o(null)})]})}function _p({cam:e,stream:t,onEdit:n,onCheck:r,onRemove:l}){const s=e.connected===void 0?{tone:"idle",label:"Engine stopped"}:e.connected?{tone:"ok",label:"Connected"}:{tone:"bad",label:"Not connecting"},{data:o}=Ot(()=>$.placementResult(e.id),15e3,[e.id]),a=!o||o.running||!o.verdict||o.verdict==="starting"?{tone:"miss",label:"Not yet proven",text:"Walk past it once and Behavision will tell you if the placement works."}:o.verdict==="good"?{tone:"seen",label:"Proven",text:o.headline||"Faces recognised on a walk-past."}:{tone:"miss",label:"Not proven",text:o.headline||"Move the camera and check again."};return i.jsxs("article",{className:"camcard",children:[i.jsxs("div",{className:"camview",children:[t?i.jsx("img",{src:t,alt:e.id}):i.jsx("div",{className:"placeholder",children:i.jsx(Nc,{size:34})}),i.jsxs("span",{className:`pill ${s.tone==="idle"?"":s.tone} over`,children:[i.jsx("i",{className:`dot ${s.tone}`}),s.label]})]}),i.jsxs("div",{className:"cambody",children:[i.jsxs("div",{className:"camtitle",children:[i.jsxs("div",{children:[i.jsx("h3",{children:e.id}),i.jsxs("span",{className:"mono note",children:[e.host||e.url,e.path?` · ${e.path}`:""]})]}),i.jsxs("div",{className:"camactions",children:[i.jsx("button",{className:"btn sm",onClick:n,children:"Edit"}),i.jsx("button",{className:"btn sm danger",onClick:l,children:"Remove"})]})]}),i.jsxs("div",{className:"camproof",children:[i.jsx("span",{className:`tag ${a.tone}`,children:a.label}),i.jsx("span",{className:"note",children:a.text}),i.jsxs("button",{className:`btn sm ${a.tone==="seen"?"":"primary"}`,onClick:r,children:[i.jsx(kc,{size:13}),a.tone==="seen"?"Check again":"Check placement"]})]})]})]})}function Pp(e){const[t,n]=P.useState({});return P.useEffect(()=>{let r=!0;const l=e.filter(s=>!(s.id in t));if(l.length)return(async()=>{const s={};for(const o of l)try{s[o.id]=await $.streamURL(o.id)}catch{s[o.id]=""}r&&n(o=>({...o,...s}))})(),()=>{r=!1}},[e.map(r=>r.id).join("|")]),t}function zp({cam:e,onClose:t,onSaved:n}){var E;const r=!e.id,[l,s]=P.useState({...Zs,...e,password:"",path:e.path||(r?ln[0].path:"")}),[o,a]=P.useState(r?ln[0].id:"manual"),[u,c]=P.useState(null),[p,v]=P.useState(null),[h,g]=P.useState(null),w=z=>L=>s({...l,[z]:L.target.value});function x(z){const L=Pr(z.target.value);a(L.id),s(V=>({...V,path:L.path||V.path}))}function T(){const z={};for(const[L,V]of Object.entries(l))V===""||V===null||V===void 0||(z[L]=L==="port"||L==="max_width"?Number(V):V);return z}async function f(){v("test"),g(null),c(null);try{c(await $.testCamera(T()))}catch(z){g(fe(z))}finally{v(null)}}async function d(z){z.preventDefault(),v("save"),g(null);try{await $.saveCamera(r?"":e.id,T()),n()}catch(L){g(fe(L))}finally{v(null)}}const m=Pr(o),[y,S]=P.useState(null);async function C(){S("busy");try{S(await $.discoverCameras())}catch(z){S({error:fe(z)})}}function k(z){const L=z.make?Pr(z.make):null;s(V=>({...V,host:z.host,path:(L==null?void 0:L.path)||V.path,id:V.id||""})),L&&a(L.id),c(null)}return i.jsx("div",{className:"drawer",onMouseDown:z=>z.target===z.currentTarget&&t(),children:i.jsxs("div",{className:"sheet",children:[i.jsxs("div",{className:"sheethead",children:[i.jsx("h2",{children:r?"Add a camera":`Edit ${e.id}`}),i.jsx("button",{className:"close",onClick:t,"aria-label":"Close",children:i.jsx(Qi,{size:16})})]}),i.jsxs("form",{className:"sheetbody",onSubmit:d,autoComplete:"off",children:[i.jsx("p",{className:"lead",children:"Three things from the camera: its address, its make, and its password. Test before you save — a wrong address is the most common mistake."}),h&&i.jsxs("div",{className:"err",children:[i.jsx(Le,{size:15}),h]}),r&&i.jsxs("section",{className:"formsection",children:[i.jsx("h4",{children:"Find it"}),y===null&&i.jsxs("div",{className:"finder",children:[i.jsx("p",{children:"Behavision can look for cameras on this shop’s network."}),i.jsxs("button",{type:"button",className:"btn primary",onClick:C,children:[i.jsx(jc,{size:14}),"Find cameras on this network"]})]}),y==="busy"&&i.jsxs("div",{className:"finder busy",children:[i.jsx("span",{className:"spinner"}),"Looking on the network… a few seconds."]}),(y==null?void 0:y.error)&&i.jsxs("div",{className:"err",children:[i.jsx(Le,{size:15}),y.error]}),(y==null?void 0:y.cameras)&&(y.cameras.length===0?i.jsxs("div",{className:"finder",children:[i.jsxs("p",{children:["Nothing answered on ",((E=y.networks)==null?void 0:E.join(", "))||"this network",". The camera may be on a different network, switched off, or not yet connected — check its cable and power, then try again. You can still type its address below."]}),i.jsx("button",{type:"button",className:"btn",onClick:C,children:"Try again"})]}):i.jsxs("ul",{className:"foundlist",children:[y.cameras.map(z=>i.jsx("li",{className:l.host===z.host?"picked":"",children:i.jsxs("button",{type:"button",onClick:()=>k(z),children:[i.jsx("span",{className:"mono",children:z.host}),i.jsx("span",{className:"what",children:z.name||(z.rtsp?"Streams video (RTSP)":"Answers ONVIF")}),z.make&&i.jsx("span",{className:"tag seen",children:Pr(z.make).label}),l.host===z.host&&i.jsx(Xs,{size:16})]})},z.host)),i.jsx("li",{className:"rescan",children:i.jsx("button",{type:"button",className:"btn sm",onClick:C,children:"Scan again"})})]}))]}),i.jsxs("section",{className:"formsection",children:[i.jsx("h4",{children:"The camera"}),r&&i.jsxs("label",{className:"field",children:[i.jsx("span",{children:"Name"}),i.jsx("input",{value:l.id,onChange:w("id"),placeholder:"entrance",required:!0,autoFocus:!0}),i.jsx("em",{className:"hint",children:"Short, no spaces. It names this camera everywhere and cannot be changed later."})]}),i.jsxs("div",{className:"fieldrow",children:[i.jsxs("label",{className:"field",children:[i.jsx("span",{children:"Address"}),i.jsx("input",{value:l.host,onChange:w("host"),placeholder:"192.168.1.20",inputMode:"decimal"}),i.jsx("em",{className:"hint",children:"On a label on the camera, or in its own app under “network”."})]}),i.jsxs("label",{className:"field narrow",children:[i.jsx("span",{children:"Port"}),i.jsx("input",{value:l.port,onChange:w("port"),inputMode:"numeric"})]})]})]}),i.jsxs("section",{className:"formsection",children:[i.jsx("h4",{children:"The stream"}),i.jsxs("label",{className:"field",children:[i.jsx("span",{children:"Make of camera"}),i.jsx("select",{value:o,onChange:x,children:ln.map(z=>i.jsx("option",{value:z.id,children:z.label},z.id))}),m.note&&i.jsx("em",{className:"hint",children:m.note})]}),i.jsxs("label",{className:"field",children:[i.jsx("span",{children:"Stream path"}),i.jsx("input",{className:"mono",value:l.path,onChange:w("path"),placeholder:"/Streaming/Channels/101"}),i.jsx("em",{className:"hint",children:"Filled in from the make. Change it only if the camera’s own app says something else."})]})]}),i.jsxs("section",{className:"formsection",children:[i.jsx("h4",{children:"Sign-in to the camera"}),i.jsxs("div",{className:"fieldrow",children:[i.jsxs("label",{className:"field",children:[i.jsx("span",{children:"Username"}),i.jsx("input",{name:"rtsp-account",autoComplete:"off",value:l.username,onChange:w("username"),placeholder:"admin"})]}),i.jsxs("label",{className:"field",children:[i.jsx("span",{children:"Password"}),i.jsx("input",{type:"password",name:"rtsp-secret",autoComplete:"new-password",value:l.password,onChange:w("password"),placeholder:e.has_password?"(unchanged)":""})]})]})]}),u&&(u.ok?i.jsxs("div",{className:"testresult ok",children:[i.jsx(Xs,{size:16}),i.jsxs("div",{children:[i.jsxs("b",{children:["Connected — ",u.width,"×",u.height,u.codec?` · ${String(u.codec).toUpperCase()}`:""]}),u.snapshot&&i.jsx("img",{alt:"Camera preview",src:`data:image/jpeg;base64,${u.snapshot}`})]})]}):i.jsxs("div",{className:"testresult bad",children:[i.jsx(Le,{size:16}),i.jsxs("div",{children:[i.jsx("b",{children:"Could not connect"}),i.jsx("span",{children:u.error})]})]})),i.jsxs("div",{className:"sheetactions",children:[i.jsx("button",{type:"button",className:"btn",onClick:f,disabled:!!p||!l.host,children:p==="test"?"Connecting…":"Test connection"}),i.jsx("button",{className:"btn primary",disabled:!!p||!l.id||!l.host,children:p==="save"?"Saving…":r?"Add camera":"Save changes"})]})]})]})})}function Lp({id:e,onClose:t}){var p,v;const[n,r]=P.useState({verdict:"starting",advice:[]}),[l,s]=P.useState(null),o=P.useRef(null);P.useEffect(()=>{let h=!0;return(async()=>{try{r(await $.startPlacement(e,25)),o.current=setInterval(async()=>{try{const g=await $.placementResult(e);if(!h)return;r(g),g.running||clearInterval(o.current)}catch(g){h&&s(fe(g))}},1e3)}catch(g){h&&s(fe(g))}})(),()=>{h=!1,clearInterval(o.current)}},[e]);const a={good:"ok",marginal:"warn",poor:"bad",artifact:"bad",no_faces:"warn",inconclusive:"warn",no_completed_passes:"warn"}[n.verdict],u=n.seconds?Math.min(100,n.elapsed/n.seconds*100):0,c=n.running||n.verdict==="starting";return i.jsx("div",{className:"drawer",onMouseDown:h=>h.target===h.currentTarget&&t(),children:i.jsxs("div",{className:"sheet",children:[i.jsxs("div",{className:"sheethead",children:[i.jsxs("h2",{children:["Check placement · ",e]}),i.jsx("button",{className:"close",onClick:t,"aria-label":"Close",children:i.jsx(Qi,{size:16})})]}),i.jsxs("div",{className:"sheetbody",children:[l&&i.jsxs("div",{className:"err",children:[i.jsx(Le,{size:15}),l]}),i.jsxs("ol",{className:"steps",children:[i.jsxs("li",{className:c?"now":"done",children:[i.jsx("b",{children:"Walk past the camera"}),i.jsx("span",{children:"The way a customer would — in through the door, not looking at the lens. Two or three times, for about 25 seconds."}),c&&i.jsx("div",{className:"progress",children:i.jsx("div",{style:{width:`${u}%`}})})]}),i.jsxs("li",{className:c?"":"now",children:[i.jsx("b",{children:"Behavision judges what it saw"}),i.jsx("span",{children:"Not “were the frames sharp”, but “did a person walking past produce a face worth recognising”."})]})]}),i.jsxs("div",{className:`verdict ${a??""}`,children:[i.jsxs("div",{className:"verdict-head",children:[c?i.jsx("span",{className:"spinner"}):a==="ok"?i.jsx(Xs,{size:18}):i.jsx(Le,{size:18}),i.jsx("b",{children:n.headline||"Watching…"})]}),((p=n.advice)==null?void 0:p.length)>0&&i.jsx("ul",{children:n.advice.map((h,g)=>i.jsx("li",{children:h},g))}),((v=n.quality)==null?void 0:v.n)>0&&i.jsxs("p",{className:"note",children:[n.quality.n," face",n.quality.n===1?"":"s"," seen · median quality ",n.quality.p50," ·"," ",Math.round((n.quality.fraction_below_gate??0)*100),"% too poor to use"]})]}),!c&&i.jsxs("div",{className:"sheetactions",children:[i.jsx("button",{className:"btn",onClick:t,children:"Close"}),i.jsx("button",{className:"btn primary",onClick:()=>{r({verdict:"starting",advice:[]}),$.startPlacement(e,25).then(r).catch(h=>s(fe(h)))},children:"Run again"})]})]})]})})}const Tp=["Is my shop working right now?","How do I add my camera?","Why has nobody been recognised today?","Who came in this morning?"];function Mp({session:e,onClose:t}){const[n,r]=P.useState([]),[l,s]=P.useState(""),[o,a]=P.useState(!1),[u,c]=P.useState(null),p=P.useRef(null),v=e==null?void 0:e.standalone;P.useEffect(()=>{var g;(g=p.current)==null||g.scrollTo({top:1e9,behavior:"smooth"})},[n,o]);async function h(g){const w=(g??l).trim();if(!w||o)return;const x=[...n,{role:"user",text:w}];r(x),s(""),a(!0),c(null);try{const T=await $.ask(x.map(f=>({role:f.role,text:f.text})));r([...x,{role:"assistant",text:T.text,used:T.used??[]}])}catch(T){const f=fe(T);c(/session expired|unauthori[sz]ed/i.test(f)?"You’re signed out of head office, so I can’t look anything up. Sign in again and ask me once more.":f),r(n),s(w)}finally{a(!1)}}return i.jsxs("aside",{className:"helper",role:"dialog","aria-label":"Loya",children:[i.jsxs("header",{className:"helperhead",children:[i.jsx("img",{src:rn,alt:""}),i.jsxs("div",{children:[i.jsx("b",{children:"Loya"}),i.jsx("span",{children:"Your Behavision buddy — knows your cameras, your customers and your numbers."})]}),i.jsx("button",{className:"close",onClick:t,"aria-label":"Close",children:i.jsx(Qi,{size:16})})]}),i.jsxs("div",{className:"helperbody",ref:p,children:[v&&i.jsxs("div",{className:"helpernote",children:[i.jsx(Sc,{size:16}),i.jsxs("div",{children:[i.jsx("b",{children:"This PC runs on its own"}),i.jsx("span",{children:"Loya lives at head office. Link this PC to a shop to talk to her; the basics are below."})]})]}),n.length===0&&i.jsxs("div",{className:"helperintro",children:[i.jsx("div",{className:"turn assistant",children:i.jsxs("div",{className:"bubble",children:[Rp(e)," Ask me anything about ",(e==null?void 0:e.site_name)||"this shop"," — what’s happening now, or how to set something up."]})}),i.jsx("div",{className:"chips",children:Tp.map(g=>i.jsx("button",{className:"chip",onClick:()=>h(g),disabled:o||v,children:g},g))}),v&&i.jsx(Dp,{})]}),n.map((g,w)=>{var x;return i.jsxs("div",{className:`turn ${g.role}`,children:[i.jsx("div",{className:"bubble",children:g.text}),((x=g.used)==null?void 0:x.length)>0&&i.jsxs("span",{className:"used",children:["Looked at: ",g.used.join(", ")]})]},w)}),o&&i.jsx("div",{className:"turn assistant",children:i.jsxs("div",{className:"bubble thinking",children:[i.jsx("span",{}),i.jsx("span",{}),i.jsx("span",{})]})}),u&&i.jsxs("div",{className:"err",children:[i.jsx(Le,{size:15}),u]})]}),i.jsxs("form",{className:"helperask",onSubmit:g=>{g.preventDefault(),h()},children:[i.jsx("input",{value:l,onChange:g=>s(g.target.value),disabled:o||v,placeholder:v?"Link this PC to head office to talk to Loya":"Ask Loya…"}),i.jsx("button",{className:"btn primary",disabled:o||v||!l.trim(),"aria-label":"Ask",children:i.jsx(fp,{size:16})})]})]})}function Rp(e){var l,s;const t=new Date().getHours(),n=t<12?"Morning":t<17?"Afternoon":"Evening",r=(s=(l=e==null?void 0:e.user)==null?void 0:l.full_name)==null?void 0:s.split(" ")[0];return r?`${n}, ${r}.`:`${n}.`}function Dp(){return i.jsxs("dl",{className:"quickhelp",children:[i.jsx("dt",{children:"Adding a camera"}),i.jsx("dd",{children:"Cameras → Add camera. The address is on a label on the camera; pick the make and the stream path fills itself in. Test, then save."}),i.jsx("dt",{children:"Proving it works"}),i.jsx("dd",{children:"Press Check placement and walk past the camera like a customer for 25 seconds. Only “good” means it can recognise faces — otherwise move it to head height, facing the way people approach."}),i.jsx("dt",{children:"Nothing showing on Live"}),i.jsx("dd",{children:"Check the camera is Connected and Proven. A camera aimed from above or the side streams fine and recognises nobody."}),i.jsx("dt",{children:"Linking to head office later"}),i.jsx("dd",{children:"Use the link button at the bottom of the sidebar and type an installation code from head office. Nothing recorded here is lost."})]})}const Op=[{id:"live",label:"Live",Glyph:sp,View:Ec},{id:"customers",label:"Customers",Glyph:ip,View:Cp,cloud:!0},{id:"cameras",label:"Cameras",Glyph:op,View:Ep}];function Fp(){var h,g,w;const[e,t]=P.useState(null),[n,r]=P.useState("live"),[l,s]=P.useState(!0),[o,a]=P.useState(!1),[u,c]=P.useState(!1);if(P.useEffect(()=>{let x=!0;const T=async()=>{try{const d=await $.session();x&&t(m=>JSON.stringify(m)===JSON.stringify(d)?m:d)}catch{x&&t(null)}x&&s(!1)};T();const f=setInterval(T,8e3);return()=>{x=!1,clearInterval(f)}},[]),!rp())return i.jsx("div",{className:"login",children:i.jsxs("div",{className:"box",children:[i.jsx("span",{className:"mark",children:i.jsx("img",{src:rn,alt:""})}),i.jsx("h1",{children:"Behavision"}),i.jsx("p",{className:"lead",children:"This is the Behavision window running outside the app, so it has no connection to the recognition engine. Launch the Behavision application instead."})]})});if(l)return i.jsx("div",{className:"login",children:i.jsx("p",{className:"note",children:"Starting…"})});if(!(e!=null&&e.claimed)&&!(e!=null&&e.standalone))return i.jsx(ia,{onDone:t});if(!(e!=null&&e.standalone)&&!(e!=null&&e.logged_in))return i.jsx(pp,{onDone:t});const p=Op.filter(x=>!x.cloud||!e.standalone),v=((h=p.find(x=>x.id===n))==null?void 0:h.View)??Ec;return o?i.jsx(ia,{onDone:x=>{a(!1),t(x)},onCancel:()=>a(!1)}):i.jsxs("div",{className:"shell",children:[i.jsxs("aside",{className:"side",children:[i.jsxs("div",{className:"brand",children:[i.jsx("span",{className:"mark",children:i.jsx("img",{src:rn,alt:""})}),i.jsxs("div",{className:"id",children:[i.jsx("h1",{children:"Behavision"}),i.jsx("p",{children:e.site_name||((g=e.user)==null?void 0:g.client_name)||"This shop"})]})]}),i.jsx("nav",{className:"nav",children:p.map(({id:x,label:T,Glyph:f})=>i.jsxs("button",{onClick:()=>r(x),"aria-current":x===n?"page":void 0,children:[i.jsx(f,{size:17}),T]},x))}),i.jsx(Ip,{}),i.jsx("div",{className:"who",children:e.standalone?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"id",children:[i.jsx("b",{children:"On its own"}),i.jsx("span",{children:"No head office"})]}),i.jsx("button",{className:"btn sm icon",title:"Link to head office",onClick:()=>a(!0),children:i.jsx(cp,{size:15})})]}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"id",children:[i.jsx("b",{children:"Signed in"}),i.jsx("span",{children:(w=e.user)==null?void 0:w.email})]}),i.jsx("button",{className:"btn sm icon",title:"Sign out",onClick:async()=>t(await $.logout()),children:i.jsx(dp,{size:15})})]})})]}),i.jsxs("main",{className:"main",children:[i.jsx(v,{session:e}),!u&&i.jsxs("button",{className:"loya-fab",onClick:()=>c(!0),"aria-label":"Ask Loya",title:"Ask Loya",children:[i.jsx("img",{src:rn,alt:""}),i.jsx("span",{children:"Loya"})]})]}),u&&i.jsx(Mp,{session:e,onClose:()=>c(!1)})]})}function Ip(){const{data:e,reload:t}=Ot(()=>$.engineStatus(),5e3),[n,r]=P.useState(!1),l=e??{state:"stopped"},s=P.useCallback(async v=>{r(!0);try{await v()}catch(h){alert(fe(h))}finally{r(!1),t()}},[t]),o=l.state==="running",a=Object.values(l.cameras??{}),u=a.filter(Boolean).length;let c="idle",p="Stopped";return!o&&l.reachable?(c="warn",p="Running outside the app"):l.state==="failed"||l.state==="backoff"?(c="bad",p="Not running"):o&&!l.reachable?(c="warn",p="Starting…"):o&&a.length===0?(c="warn",p="No cameras"):o&&u===0?(c="bad",p="No camera connected"):o&&us($.startEngine),children:[i.jsx(kc,{size:13}),"Start"]}),i.jsxs("button",{className:"btn sm",disabled:n||!o,onClick:()=>s($.stopEngine),children:[i.jsx(ap,{size:13}),"Stop"]})]})]})}xc(document.getElementById("root")).render(i.jsx(Wc.StrictMode,{children:i.jsx(Fp,{})})); diff --git a/desktop/frontend/dist/index.html b/desktop/frontend/dist/index.html index 0079196..8e706fe 100644 --- a/desktop/frontend/dist/index.html +++ b/desktop/frontend/dist/index.html @@ -4,8 +4,8 @@ Behavision - - + +
diff --git a/desktop/frontend/src/bridge.js b/desktop/frontend/src/bridge.js index 0aee600..03645aa 100644 --- a/desktop/frontend/src/bridge.js +++ b/desktop/frontend/src/bridge.js @@ -32,6 +32,7 @@ export const api = { cameras: () => call('Cameras'), testCamera: (cam) => call('TestCamera', cam), + discoverCameras: () => call('DiscoverCameras'), saveCamera: (id, cam) => call('SaveCamera', id, cam), deleteCamera: (id) => call('DeleteCamera', id), startPlacement: (id, seconds) => call('StartPlacementCheck', id, seconds), diff --git a/desktop/frontend/src/mock.js b/desktop/frontend/src/mock.js index 2923ed6..eeab079 100644 --- a/desktop/frontend/src/mock.js +++ b/desktop/frontend/src/mock.js @@ -47,6 +47,11 @@ if (scenario) { StartEngine: () => delay({state: 'running', reachable: true}), StopEngine: () => delay({state: 'stopped', reachable: false}), Cameras: () => delay(st.cameras.map(c => ({...c, connected: true, frames: 1200, faces: 9}))), + DiscoverCameras: () => delay({networks: ['192.168.1.0/24'], cameras: [ + {host: '192.168.1.122', rtsp: true, onvif: true, name: 'HIKVISION DS-2CD2043G2', make: 'hikvision'}, + {host: '192.168.1.121', rtsp: true, onvif: true, name: 'IPC-model IPC', make: ''}, + {host: '192.168.1.40', rtsp: true, onvif: false, name: '', make: ''}, + ]}, 2500), TestCamera: (cam) => delay({ok: Boolean(cam.host), width: 800, height: 448, codec: 'hevc', error: cam.host ? '' : 'no host'}, 1500), SaveCamera: (id, cam) => { const c = {id: id || cam.id || 'cam' + (st.cameras.length + 1), ...cam, has_password: Boolean(cam.password)}; delete c.password; st.cameras = [...st.cameras.filter(x => x.id !== c.id), c]; return delay(c) }, DeleteCamera: (id) => { st.cameras = st.cameras.filter(c => c.id !== id); return delay(null) }, diff --git a/desktop/frontend/src/styles.css b/desktop/frontend/src/styles.css index bbeb18d..8bee73b 100644 --- a/desktop/frontend/src/styles.css +++ b/desktop/frontend/src/styles.css @@ -598,3 +598,15 @@ tr.click { cursor: pointer; } tr.click:hover td { background: var(--s2); } box-shadow: var(--shadow-lg); cursor: pointer; font-size: 13px; font-weight: 600; } .loya-fab img { width: 20px; height: 20px; object-fit: contain; } .loya-fab:hover { background: var(--accent-3); border-color: var(--accent); } + +/* Camera finder: the pick-list that replaces "type an IP address". */ +.finder { display: flex; flex-direction: column; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-3) var(--sp-4); border: 1px dashed var(--line); border-radius: var(--r); background: var(--s2); } +.finder p { font-size: 13px; color: var(--ink-2); line-height: 1.5; margin: 0; } +.finder.busy { flex-direction: row; align-items: center; color: var(--ink-2); font-size: 13px; border-style: solid; } +.foundlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; } +.foundlist li button { width: 100%; display: flex; align-items: center; gap: var(--sp-3); padding: 10px 12px; border-radius: var(--r); border: 1px solid var(--line); background: var(--s2); color: var(--ink); cursor: pointer; text-align: left; font-size: 13px; } +.foundlist li button:hover { border-color: var(--accent); } +.foundlist li.picked button { border-color: var(--accent); background: var(--accent-3); } +.foundlist .mono { font-family: var(--font-mono); font-size: 12.5px; min-width: 120px; } +.foundlist .what { flex: 1; color: var(--ink-2); } +.foundlist li.rescan button { width: auto; border: 0; background: none; padding: 4px 0; color: var(--ink-3); } diff --git a/desktop/frontend/src/views/Cameras.jsx b/desktop/frontend/src/views/Cameras.jsx index 0e19d65..6467bf4 100644 --- a/desktop/frontend/src/views/Cameras.jsx +++ b/desktop/frontend/src/views/Cameras.jsx @@ -165,6 +165,24 @@ function CameraSheet({ cam, onClose, onSaved }) { const chosen = makeById(make) + // The camera is picked from a scan of the shop's network rather than typed. + // Nobody knows their camera's address; the sticker is under the camera and + // the menu is different in every make's app. The scan names ONVIF cameras + // and lists anything with the RTSP port open; picking one fills the + // address and, when the make is recognisable, the stream path too. + const [scan, setScan] = useState(null) // null | 'busy' | {cameras, networks} | {error} + async function findCameras() { + setScan('busy') + try { setScan(await api.discoverCameras()) } catch (e) { setScan({ error: message(e) }) } + } + function pick(c) { + const m = c.make ? makeById(c.make) : null + setF(prev => ({ ...prev, host: c.host, path: m?.path || prev.path, + id: prev.id || (m ? '' : ''), })) + if (m) setMake(m.id) + setTest(null) + } + return (
e.target === e.currentTarget && onClose()}>
@@ -176,6 +194,40 @@ function CameraSheet({ cam, onClose, onSaved }) {

Three things from the camera: its address, its make, and its password. Test before you save — a wrong address is the most common mistake.

{error &&
{error}
} + {isNew && ( +
+

Find it

+ {scan === null && ( +
+

Behavision can look for cameras on this shop’s network.

+ +
+ )} + {scan === 'busy' &&
Looking on the network… a few seconds.
} + {scan?.error &&
{scan.error}
} + {scan?.cameras && ( + scan.cameras.length === 0 + ?
+

Nothing answered on {scan.networks?.join(', ') || 'this network'}. The camera may be on a different network, switched off, or not yet connected — check its cable and power, then try again. You can still type its address below.

+ +
+ :
    + {scan.cameras.map(c => ( +
  • + +
  • + ))} +
  • +
+ )} +
+ )} +

The camera

{isNew && ( diff --git a/desktop/internal/local/client.go b/desktop/internal/local/client.go index ed4030a..b650721 100644 --- a/desktop/internal/local/client.go +++ b/desktop/internal/local/client.go @@ -105,6 +105,12 @@ func (c *Client) DeleteCamera(ctx context.Context, id string) error { return c.do(ctx, http.MethodDelete, "/api/cameras/"+id, nil, nil) } +// DiscoverCameras asks the engine to scan the shop's network. A few seconds. +func (c *Client) DiscoverCameras(ctx context.Context) (map[string]any, error) { + var out map[string]any + return out, c.do(ctx, http.MethodGet, "/api/cameras/discover", nil, &out) +} + func (c *Client) TestCamera(ctx context.Context, cam map[string]any) (map[string]any, error) { var out map[string]any return out, c.do(ctx, http.MethodPost, "/api/cameras/test", cam, &out) diff --git a/tests/test_discover.py b/tests/test_discover.py new file mode 100644 index 0000000..8acd218 --- /dev/null +++ b/tests/test_discover.py @@ -0,0 +1,44 @@ +"""Discovery parsing, with no network: the two shapes cameras actually send.""" +from behavision.discover import parse_probe_match, guess_make, local_networks + +HIK = ('' + '' + 'onvif://www.onvif.org/type/video_encoder onvif://www.onvif.org/name/HIKVISION%20DS-2CD2043G2 ' + 'onvif://www.onvif.org/hardware/DS-2CD2043G2-I onvif://www.onvif.org/location/city/hangzhou' + 'http://192.168.1.122/onvif/device_service' + '') + +BARE = ('' + 'http://10.0.0.9:8080/onvif/device_service http://[fe80::1]/onvif' + '') + + +def test_hikvision_probe_match_is_named_and_recognised(): + f = parse_probe_match(HIK, "192.168.1.122") + assert f.host == "192.168.1.122" + assert f.onvif and not f.rtsp + assert "HIKVISION DS-2CD2043G2" in f.name and "DS-2CD2043G2-I" in f.name + assert f.make == "hikvision" + + +def test_a_nameless_match_still_yields_its_address(): + f = parse_probe_match(BARE, "10.0.0.9") + assert f.host == "10.0.0.9" and f.name == "" and f.make == "" + assert f.onvif_url.startswith("http://10.0.0.9:8080") + + +def test_garbage_is_not_a_camera(): + assert parse_probe_match("not soap", "1.2.3.4") is None + + +def test_make_guesses_the_common_indian_retail_brands(): + assert guess_make("CP PLUS CP-UNC-TA21L3") == "cpplus" + assert guess_make("Dahua IPC-HDW1230") == "dahua" + assert guess_make("TP-LINK Tapo C200") == "tplink" + assert guess_make("Something Else") == "" + + +def test_local_networks_are_slash_24_and_never_loopback(): + for n in local_networks(): + assert n.prefixlen == 24 + assert not n.network_address.is_loopback