From f388491530c50af765b842bbba166935dddaaf19 Mon Sep 17 00:00:00 2001 From: GitHub Actions Bot Date: Thu, 29 Jan 2026 18:42:27 +0000 Subject: [PATCH] Sync build v0.9.196 Automated sync from private repository. Commit: 260ac782eac7eef6c0c18383b51fdd55ae99e471 --- frontend/dist/VERSION | 2 +- frontend/dist/assets/BasemapLayer-S9Ush6Hh.js | 1 - frontend/dist/assets/BasemapLayer-g9CXC1Ky.js | 2 ++ frontend/dist/assets/{Card-2pQSGkKC.js => Card-CPlTPCY8.js} | 2 +- frontend/dist/assets/CollisionExplorerModal-CyK7TMsS.js | 1 + frontend/dist/assets/CollisionExplorerModal-DTnzK_xA.js | 1 - frontend/dist/assets/Configuration-BOsliPZn.js | 1 - frontend/dist/assets/Configuration-BdYZcJJF.js | 1 + frontend/dist/assets/ConfirmModal-CYXFGX_W.js | 1 - frontend/dist/assets/ConfirmModal-_bkwu5cd.js | 1 + frontend/dist/assets/Contacts-Bc9XGkC1.js | 2 ++ frontend/dist/assets/Contacts-CyyU4xmf.js | 2 -- frontend/dist/assets/ContactsMapMapLibre-ByNdgqAN.js | 1 - frontend/dist/assets/ContactsMapMapLibre-CsZGQooS.js | 1 + frontend/dist/assets/Dashboard-DdOKd_Co.js | 1 + frontend/dist/assets/Dashboard-DiETwG01.js | 1 - frontend/dist/assets/DataBox-CRX76VsB.js | 1 - frontend/dist/assets/DataBox-nCNZLfvU.js | 1 + frontend/dist/assets/DeepAnalysisModal-D4eqwCNZ.js | 1 - frontend/dist/assets/DeepAnalysisModal-Dhmx8Gh2.js | 1 + frontend/dist/assets/{Grid-BOO-7ObJ.js => Grid-DkfcBkoo.js} | 2 +- .../dist/assets/{Login-CkRuF4n8.js => Login-BM63wUrV.js} | 2 +- frontend/dist/assets/Logs-CO8l86BH.js | 1 + frontend/dist/assets/Logs-Cb5GXQFD.js | 1 - frontend/dist/assets/MeshGraph-Cn5F4qEM.js | 1 + frontend/dist/assets/MeshGraph-DfCwG9Nt.js | 1 - ...tionCard-CEW2bogB.js => NodeInformationCard-DcRtH0Bq.js} | 2 +- frontend/dist/assets/PacketList-BPeOqxkB.js | 2 -- frontend/dist/assets/PacketList-CFuBvjqk.js | 2 ++ frontend/dist/assets/Packets-BHJJxf8a.js | 1 - frontend/dist/assets/Packets-DiXDa-F_.js | 1 + .../{PageLayout-CnF5SScd.js => PageLayout-DIXn4UXM.js} | 2 +- frontend/dist/assets/PathMapMapLibre-CHzpOlxn.js | 1 + frontend/dist/assets/PathMapMapLibre-ChIFu4o3.js | 1 - frontend/dist/assets/SignalIndicator-BLrEkFNb.js | 1 - frontend/dist/assets/SignalIndicator-DWWkJgSd.js | 1 + frontend/dist/assets/Statistics-BZ42IsKT.js | 1 + frontend/dist/assets/Statistics-sXHAGtEF.js | 1 - frontend/dist/assets/System-BPwbPFCW.js | 1 - frontend/dist/assets/System-DA9azmQv.js | 1 + frontend/dist/assets/Terminal-Dv2-3e-b.js | 1 + frontend/dist/assets/Terminal-jVZnyeIH.js | 1 - frontend/dist/assets/TimeRangeSelector-DGCfekAv.js | 1 - frontend/dist/assets/TimeRangeSelector-DUE1rBOu.js | 1 + frontend/dist/assets/arrow-right-C9AHsGJs.js | 1 + frontend/dist/assets/arrow-up-ce4_7z5E.js | 1 + frontend/dist/assets/car-DXNv2W8D.js | 1 + frontend/dist/assets/check-qb29v-su.js | 1 + frontend/dist/assets/chevron-right-7sotkg9l.js | 1 + frontend/dist/assets/chevron-up-ClXInh9N.js | 1 + frontend/dist/assets/circle-check-Bd9Kbu6i.js | 1 + frontend/dist/assets/compass-DMvXEtHv.js | 1 + frontend/dist/assets/funnel-DZRnHLZd.js | 1 + frontend/dist/assets/git-branch-Sfdze11O.js | 1 + frontend/dist/assets/house-CCeK_0TO.js | 1 + frontend/dist/assets/index-BGs2yNOg.js | 2 ++ frontend/dist/assets/index-BJEgt3tp.js | 2 -- frontend/dist/assets/info-HmV1qkUD.js | 1 + frontend/dist/assets/link-scoring-Cw0dJsWv.js | 1 - frontend/dist/assets/link-scoring-DTgOSmRe.js | 1 + frontend/dist/assets/loader-circle-CwUrmZrV.js | 1 + frontend/dist/assets/map-pin-x5eP-WEg.js | 1 + frontend/dist/assets/network-DpalqfB8.js | 1 + frontend/dist/assets/{ping-DvLgBqTv.js => ping-HGVILoRV.js} | 2 +- frontend/dist/assets/recharts-6XUQYgRA.js | 1 - frontend/dist/assets/recharts-DVj1EL-m.js | 1 + frontend/dist/assets/refresh-cw-ccP9GKH1.js | 1 + frontend/dist/assets/route-DRIRJjaN.js | 1 + frontend/dist/assets/target-De7OqeGi.js | 1 + frontend/dist/assets/trending-up-2SYsZdKi.js | 1 + frontend/dist/assets/triangle-alert-2-1YN-Am.js | 1 + frontend/dist/assets/usePolling-CtRLadGa.js | 1 - frontend/dist/assets/usePolling-DIhP09j-.js | 1 + ...seThemeColors-AeHMyThq.js => useThemeColors-CGx-Jxyf.js} | 2 +- frontend/dist/assets/users-D0iUt2so.js | 1 + frontend/dist/assets/vendor-core-Dl9MTgSr.js | 1 + frontend/dist/assets/vendor-core-WoOfkQwm.js | 1 - frontend/dist/assets/vendor-react-C341c8YC.js | 2 -- frontend/dist/assets/vendor-react-DCIF8YoJ.js | 2 ++ frontend/dist/assets/webgl-device-QoBMYpnS-BJ-mjzjb.js | 1 - frontend/dist/assets/webgl-device-QoBMYpnS-DxuzMg2B.js | 1 + frontend/dist/assets/zap-CQ3I2hAj.js | 1 + frontend/dist/index.html | 6 +++--- frontend/package.json | 2 +- 84 files changed, 65 insertions(+), 42 deletions(-) delete mode 100644 frontend/dist/assets/BasemapLayer-S9Ush6Hh.js create mode 100644 frontend/dist/assets/BasemapLayer-g9CXC1Ky.js rename frontend/dist/assets/{Card-2pQSGkKC.js => Card-CPlTPCY8.js} (92%) create mode 100644 frontend/dist/assets/CollisionExplorerModal-CyK7TMsS.js delete mode 100644 frontend/dist/assets/CollisionExplorerModal-DTnzK_xA.js delete mode 100644 frontend/dist/assets/Configuration-BOsliPZn.js create mode 100644 frontend/dist/assets/Configuration-BdYZcJJF.js delete mode 100644 frontend/dist/assets/ConfirmModal-CYXFGX_W.js create mode 100644 frontend/dist/assets/ConfirmModal-_bkwu5cd.js create mode 100644 frontend/dist/assets/Contacts-Bc9XGkC1.js delete mode 100644 frontend/dist/assets/Contacts-CyyU4xmf.js delete mode 100644 frontend/dist/assets/ContactsMapMapLibre-ByNdgqAN.js create mode 100644 frontend/dist/assets/ContactsMapMapLibre-CsZGQooS.js create mode 100644 frontend/dist/assets/Dashboard-DdOKd_Co.js delete mode 100644 frontend/dist/assets/Dashboard-DiETwG01.js delete mode 100644 frontend/dist/assets/DataBox-CRX76VsB.js create mode 100644 frontend/dist/assets/DataBox-nCNZLfvU.js delete mode 100644 frontend/dist/assets/DeepAnalysisModal-D4eqwCNZ.js create mode 100644 frontend/dist/assets/DeepAnalysisModal-Dhmx8Gh2.js rename frontend/dist/assets/{Grid-BOO-7ObJ.js => Grid-DkfcBkoo.js} (90%) rename frontend/dist/assets/{Login-CkRuF4n8.js => Login-BM63wUrV.js} (79%) create mode 100644 frontend/dist/assets/Logs-CO8l86BH.js delete mode 100644 frontend/dist/assets/Logs-Cb5GXQFD.js create mode 100644 frontend/dist/assets/MeshGraph-Cn5F4qEM.js delete mode 100644 frontend/dist/assets/MeshGraph-DfCwG9Nt.js rename frontend/dist/assets/{NodeInformationCard-CEW2bogB.js => NodeInformationCard-DcRtH0Bq.js} (74%) delete mode 100644 frontend/dist/assets/PacketList-BPeOqxkB.js create mode 100644 frontend/dist/assets/PacketList-CFuBvjqk.js delete mode 100644 frontend/dist/assets/Packets-BHJJxf8a.js create mode 100644 frontend/dist/assets/Packets-DiXDa-F_.js rename frontend/dist/assets/{PageLayout-CnF5SScd.js => PageLayout-DIXn4UXM.js} (96%) create mode 100644 frontend/dist/assets/PathMapMapLibre-CHzpOlxn.js delete mode 100644 frontend/dist/assets/PathMapMapLibre-ChIFu4o3.js delete mode 100644 frontend/dist/assets/SignalIndicator-BLrEkFNb.js create mode 100644 frontend/dist/assets/SignalIndicator-DWWkJgSd.js create mode 100644 frontend/dist/assets/Statistics-BZ42IsKT.js delete mode 100644 frontend/dist/assets/Statistics-sXHAGtEF.js delete mode 100644 frontend/dist/assets/System-BPwbPFCW.js create mode 100644 frontend/dist/assets/System-DA9azmQv.js create mode 100644 frontend/dist/assets/Terminal-Dv2-3e-b.js delete mode 100644 frontend/dist/assets/Terminal-jVZnyeIH.js delete mode 100644 frontend/dist/assets/TimeRangeSelector-DGCfekAv.js create mode 100644 frontend/dist/assets/TimeRangeSelector-DUE1rBOu.js create mode 100644 frontend/dist/assets/arrow-right-C9AHsGJs.js create mode 100644 frontend/dist/assets/arrow-up-ce4_7z5E.js create mode 100644 frontend/dist/assets/car-DXNv2W8D.js create mode 100644 frontend/dist/assets/check-qb29v-su.js create mode 100644 frontend/dist/assets/chevron-right-7sotkg9l.js create mode 100644 frontend/dist/assets/chevron-up-ClXInh9N.js create mode 100644 frontend/dist/assets/circle-check-Bd9Kbu6i.js create mode 100644 frontend/dist/assets/compass-DMvXEtHv.js create mode 100644 frontend/dist/assets/funnel-DZRnHLZd.js create mode 100644 frontend/dist/assets/git-branch-Sfdze11O.js create mode 100644 frontend/dist/assets/house-CCeK_0TO.js create mode 100644 frontend/dist/assets/index-BGs2yNOg.js delete mode 100644 frontend/dist/assets/index-BJEgt3tp.js create mode 100644 frontend/dist/assets/info-HmV1qkUD.js delete mode 100644 frontend/dist/assets/link-scoring-Cw0dJsWv.js create mode 100644 frontend/dist/assets/link-scoring-DTgOSmRe.js create mode 100644 frontend/dist/assets/loader-circle-CwUrmZrV.js create mode 100644 frontend/dist/assets/map-pin-x5eP-WEg.js create mode 100644 frontend/dist/assets/network-DpalqfB8.js rename frontend/dist/assets/{ping-DvLgBqTv.js => ping-HGVILoRV.js} (94%) delete mode 100644 frontend/dist/assets/recharts-6XUQYgRA.js create mode 100644 frontend/dist/assets/recharts-DVj1EL-m.js create mode 100644 frontend/dist/assets/refresh-cw-ccP9GKH1.js create mode 100644 frontend/dist/assets/route-DRIRJjaN.js create mode 100644 frontend/dist/assets/target-De7OqeGi.js create mode 100644 frontend/dist/assets/trending-up-2SYsZdKi.js create mode 100644 frontend/dist/assets/triangle-alert-2-1YN-Am.js delete mode 100644 frontend/dist/assets/usePolling-CtRLadGa.js create mode 100644 frontend/dist/assets/usePolling-DIhP09j-.js rename frontend/dist/assets/{useThemeColors-AeHMyThq.js => useThemeColors-CGx-Jxyf.js} (98%) create mode 100644 frontend/dist/assets/users-D0iUt2so.js create mode 100644 frontend/dist/assets/vendor-core-Dl9MTgSr.js delete mode 100644 frontend/dist/assets/vendor-core-WoOfkQwm.js delete mode 100644 frontend/dist/assets/vendor-react-C341c8YC.js create mode 100644 frontend/dist/assets/vendor-react-DCIF8YoJ.js delete mode 100644 frontend/dist/assets/webgl-device-QoBMYpnS-BJ-mjzjb.js create mode 100644 frontend/dist/assets/webgl-device-QoBMYpnS-DxuzMg2B.js create mode 100644 frontend/dist/assets/zap-CQ3I2hAj.js diff --git a/frontend/dist/VERSION b/frontend/dist/VERSION index 9f3f28b1..9954292a 100644 --- a/frontend/dist/VERSION +++ b/frontend/dist/VERSION @@ -1 +1 @@ -0.9.195 +0.9.196 diff --git a/frontend/dist/assets/BasemapLayer-S9Ush6Hh.js b/frontend/dist/assets/BasemapLayer-S9Ush6Hh.js deleted file mode 100644 index 169c5aeb..00000000 --- a/frontend/dist/assets/BasemapLayer-S9Ush6Hh.js +++ /dev/null @@ -1 +0,0 @@ -import{i as t,bO as e,r}from"./vendor-react-C341c8YC.js";const a="pymc-basemap-mode",o="dark";function s(){if("undefined"==typeof window)return o;try{const t=localStorage.getItem(a);if("light"===t||"dark"===t)return t}catch{}return o}function n(t){if("undefined"!=typeof window)try{localStorage.setItem(a,t)}catch{}}const c=t(t=>({mode:s(),toggle:()=>t(t=>{const e="light"===t.mode?"dark":"light";return n(e),{mode:e}}),setMode:e=>{n(e),t({mode:e})}})),i=()=>c(t=>t.mode),l=()=>c(t=>t.toggle),u={light:"https://basemaps.cartocdn.com/gl/positron-gl-style/style.json",dark:"https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json"},d={light:"basemap-light-",dark:"basemap-dark-"},f={};function y({mode:t}){const{current:a}=e(),[o,s]=r.useState(null),n=r.useRef({light:!1,dark:!1}),c=r.useRef({light:[],dark:[]});r.useEffect(()=>{const t=()=>{var t;const e=null==(t=null==a?void 0:a.getMap)?void 0:t.call(a);e&&!o&&s(e)};t();const e=setInterval(t,50),r=setTimeout(()=>clearInterval(e),5e3);return()=>{clearInterval(e),clearTimeout(r)}},[a,o]);const i=r.useCallback(async(t,e,r)=>{var a,o;if(n.current[e])return;const s=d[e],i=await async function(t){if(f[t])return f[t];const e=await fetch(u[t]),r=await e.json();return f[t]=r,r}(e),l=[];for(const[n,c]of Object.entries(i.sources||{})){const e=s+n;t.getSource(e)||t.addSource(e,c)}const y=null==(o=((null==(a=t.getStyle())?void 0:a.layers)||[]).find(t=>!t.id.startsWith("basemap-light-")&&!t.id.startsWith("basemap-dark-")))?void 0:o.id;for(const n of i.layers||[]){const e=s+n.id;if(l.push(e),t.getLayer(e))continue;const a={...n,id:e};"source"in a&&"string"==typeof a.source&&(a.source=s+a.source),a.layout||(a.layout={}),a.layout.visibility=r?"visible":"none";try{t.addLayer(a,y)}catch(g){}}c.current[e]=l,n.current[e]=!0},[]),l=r.useCallback((t,e,r)=>{const a=c.current[e],o=r?"visible":"none";for(const s of a)if(t.getLayer(s))try{t.setLayoutProperty(s,"visibility",o)}catch{}},[]),y=r.useCallback(t=>{var e;const r=((null==(e=t.getStyle())?void 0:e.layers)||[]).filter(t=>!t.id.startsWith("basemap-light-")&&!t.id.startsWith("basemap-dark-"));for(const a of r)try{t.moveLayer(a.id)}catch{}},[]);return r.useEffect(()=>{if(!o)return;let e=!1;const r=async()=>{if(!e)try{await Promise.all([i(o,"light","light"===t),i(o,"dark","dark"===t)]),e||y(o)}catch(r){}};o.isStyleLoaded()?r():(o.once("style.load",r),o.once("load",()=>{e||n.current.light||r()}));const a=()=>{e||setTimeout(()=>{!e&&n.current.light&&n.current.dark&&y(o)},100)};return o.on("styledata",a),()=>{e=!0,o.off("styledata",a)}},[o,i,y,t]),r.useEffect(()=>{o&&n.current.light&&n.current.dark&&(l(o,"light","light"===t),l(o,"dark","dark"===t))},[o,t,l]),null}export{y as B,l as a,i as u}; diff --git a/frontend/dist/assets/BasemapLayer-g9CXC1Ky.js b/frontend/dist/assets/BasemapLayer-g9CXC1Ky.js new file mode 100644 index 00000000..4fc10e7d --- /dev/null +++ b/frontend/dist/assets/BasemapLayer-g9CXC1Ky.js @@ -0,0 +1,2 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/maplibre-gl-B1CfjdFi.css"])))=>i.map(i=>d[i]); +import{a as e,b as t}from"./vendor-react-DCIF8YoJ.js";import{c as o}from"./vendor-core-Dl9MTgSr.js";import{_ as n}from"./deckgl-DTsmDcfs.js";const r=e.createContext(null);function s(){var t;const o=null==(t=e.useContext(r))?void 0:t.maps,n=e.useContext(b);return e.useMemo(()=>({...o,current:null==n?void 0:n.map}),[o,n])}function a(e,t){if(e===t)return!0;if(!e||!t)return!1;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let o=0;o{let o=null;"interactive"in e&&(o=Object.assign({},e),delete o.interactive);const n=t[e.ref];if(n){o=o||Object.assign({},e),delete o.ref;for(const e of c)e in n&&(o[e]=n[e])}return o||e});return{...e,layers:o}}const d={version:8,sources:{},layers:[]},p={mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",click:"onClick",dblclick:"onDblClick",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mouseout:"onMouseOut",contextmenu:"onContextMenu",touchstart:"onTouchStart",touchend:"onTouchEnd",touchmove:"onTouchMove",touchcancel:"onTouchCancel"},m={movestart:"onMoveStart",move:"onMove",moveend:"onMoveEnd",dragstart:"onDragStart",drag:"onDrag",dragend:"onDragEnd",zoomstart:"onZoomStart",zoom:"onZoom",zoomend:"onZoomEnd",rotatestart:"onRotateStart",rotate:"onRotate",rotateend:"onRotateEnd",pitchstart:"onPitchStart",pitch:"onPitch",pitchend:"onPitchEnd"},f={wheel:"onWheel",boxzoomstart:"onBoxZoomStart",boxzoomend:"onBoxZoomEnd",boxzoomcancel:"onBoxZoomCancel",resize:"onResize",load:"onLoad",render:"onRender",idle:"onIdle",remove:"onRemove",data:"onData",styledata:"onStyleData",sourcedata:"onSourceData",error:"onError"},g=["minZoom","maxZoom","minPitch","maxPitch","maxBounds","projection","renderWorldCopies"],h=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate","touchPitch"];class y{constructor(e,t,o){this._map=null,this._internalUpdate=!1,this._hoveredFeatures=null,this._propsedCameraUpdate=null,this._styleComponents={},this._onEvent=e=>{const t=this.props[f[e.type]];t?t(e):e.type},this._onCameraEvent=e=>{if(this._internalUpdate)return;e.viewState=this._propsedCameraUpdate||i(this._map.transform);const t=this.props[m[e.type]];t&&t(e)},this._onCameraUpdate=e=>this._internalUpdate?e:(this._propsedCameraUpdate=i(e),l(e,this.props)),this._onPointerEvent=e=>{"mousemove"!==e.type&&"mouseout"!==e.type||this._updateHover(e);const t=this.props[p[e.type]];t&&(this.props.interactiveLayerIds&&"mouseover"!==e.type&&"mouseout"!==e.type&&(e.features=this._hoveredFeatures||this._queryRenderedFeatures(e.point)),t(e),delete e.features)},this._MapClass=e,this.props=t,this._initialize(o)}get map(){return this._map}setProps(e){const t=this.props;this.props=e;const o=this._updateSettings(e,t),n=this._updateSize(e),r=this._updateViewState(e);this._updateStyle(e,t),this._updateStyleComponents(e),this._updateHandlers(e,t),(o||n||r&&!this._map.isMoving())&&this.redraw()}static reuse(e,t){const o=y.savedMaps.pop();if(!o)return null;const n=o.map,r=n.getContainer();for(t.className=r.className;r.childNodes.length>0;)t.appendChild(r.childNodes[0]);n._container=t;const s=n._resizeObserver;s&&(s.disconnect(),s.observe(t)),o.setProps({...e,styleDiffing:!1}),n.resize();const{initialViewState:a}=e;return a&&(a.bounds?n.fitBounds(a.bounds,{...a.fitBoundsOptions,duration:0}):o._updateViewState(a)),n.isStyleLoaded()?n.fire("load"):n.once("style.load",()=>n.fire("load")),n._update(),o}_initialize(e){const{props:t}=this,{mapStyle:o=d}=t,n={...t,...t.initialViewState,container:e,style:u(o)},r=n.initialViewState||n.viewState||n;if(Object.assign(n,{center:[r.longitude||0,r.latitude||0],zoom:r.zoom||0,pitch:r.pitch||0,bearing:r.bearing||0}),t.gl){const e=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=()=>(HTMLCanvasElement.prototype.getContext=e,t.gl)}const s=new this._MapClass(n);r.padding&&s.setPadding(r.padding),t.cursor&&(s.getCanvas().style.cursor=t.cursor),s.transformCameraUpdate=this._onCameraUpdate,s.on("style.load",()=>{var e;this._styleComponents={light:s.getLight(),sky:s.getSky(),projection:null==(e=s.getProjection)?void 0:e.call(s),terrain:s.getTerrain()},this._updateStyleComponents(this.props)}),s.on("sourcedata",()=>{this._updateStyleComponents(this.props)});for(const a in p)s.on(a,this._onPointerEvent);for(const a in m)s.on(a,this._onCameraEvent);for(const a in f)s.on(a,this._onEvent);this._map=s}recycle(){const e=this.map.getContainer().querySelector("[mapboxgl-children]");null==e||e.remove(),y.savedMaps.push(this)}destroy(){this._map.remove()}redraw(){const e=this._map;e.style&&(e._frame&&(e._frame.cancel(),e._frame=null),e._render())}_updateSize(e){const{viewState:t}=e;if(t){const e=this._map;if(t.width!==e.transform.width||t.height!==e.transform.height)return e.resize(),!0}return!1}_updateViewState(e){const t=this._map,o=t.transform;if(!t.isMoving()){const n=l(o,e);if(Object.keys(n).length>0)return this._internalUpdate=!0,t.jumpTo(n),this._internalUpdate=!1,!0}return!1}_updateSettings(e,t){const o=this._map;let n=!1;for(const r of g)if(r in e&&!a(e[r],t[r])){n=!0;const t=o[`set${r[0].toUpperCase()}${r.slice(1)}`];null==t||t.call(o,e[r])}return n}_updateStyle(e,t){if(e.cursor!==t.cursor&&(this._map.getCanvas().style.cursor=e.cursor||""),e.mapStyle!==t.mapStyle){const{mapStyle:t=d,styleDiffing:o=!0}=e,n={diff:o};"localIdeographFontFamily"in e&&(n.localIdeographFontFamily=e.localIdeographFontFamily),this._map.setStyle(u(t),n)}}_updateStyleComponents({light:e,projection:t,sky:o,terrain:n}){var r,s;const i=this._map,l=this._styleComponents;i.style._loaded&&(e&&!a(e,l.light)&&(l.light=e,i.setLight(e)),t&&!a(t,l.projection)&&t!==(null==(r=l.projection)?void 0:r.type)&&(l.projection="string"==typeof t?{type:t}:t,null==(s=i.setProjection)||s.call(i,l.projection)),o&&!a(o,l.sky)&&(l.sky=o,i.setSky(o)),void 0===n||a(n,l.terrain)||n&&!i.getSource(n.source)||(l.terrain=n,i.setTerrain(n)))}_updateHandlers(e,t){const o=this._map;for(const n of h){const r=e[n]??!0;a(r,t[n]??!0)||(r?o[n].enable(r):o[n].disable())}}_queryRenderedFeatures(e){const t=this._map,{interactiveLayerIds:o=[]}=this.props;try{return t.queryRenderedFeatures(e,{layers:o.filter(t.getLayer.bind(t))})}catch{return[]}}_updateHover(e){var t;const{props:o}=this;if(o.interactiveLayerIds&&(o.onMouseMove||o.onMouseEnter||o.onMouseLeave)){const o=e.type,n=(null==(t=this._hoveredFeatures)?void 0:t.length)>0,r=this._queryRenderedFeatures(e.point),s=r.length>0;!s&&n&&(e.type="mouseleave",this._onPointerEvent(e)),this._hoveredFeatures=r,s&&!n&&(e.type="mouseenter",this._onPointerEvent(e)),e.type=o}else this._hoveredFeatures=null}}y.savedMaps=[];const v=["setMaxBounds","setMinZoom","setMaxZoom","setMinPitch","setMaxPitch","setRenderWorldCopies","setProjection","setStyle","addSource","removeSource","addLayer","removeLayer","setLayerZoomRange","setFilter","setPaintProperty","setLayoutProperty","setLight","setTerrain","setFog","remove"];const _="undefined"!=typeof document?e.useLayoutEffect:e.useEffect,b=e.createContext(null),L=e.forwardRef(function(t,o){const s=e.useContext(r),[a,i]=e.useState(null),l=e.useRef(),{current:c}=e.useRef({mapLib:null,map:null});e.useEffect(()=>{const e=t.mapLib;let o,r=!0;return Promise.resolve(e||n(()=>import("./maplibre-gl-Bk5DsYkB.js").then(e=>e.m),__vite__mapDeps([0]))).then(e=>{if(!r)return;if(!e)throw new Error("Invalid mapLib");const n="Map"in e?e:e.default;if(!n.Map)throw new Error("Invalid mapLib");!function(e,t){const{RTLTextPlugin:o,maxParallelImageRequests:n,workerCount:r,workerUrl:s}=t;if(o&&e.getRTLTextPluginStatus&&"unavailable"===e.getRTLTextPluginStatus()){const{pluginUrl:t,lazy:n=!0}="string"==typeof o?{pluginUrl:o}:o;e.setRTLTextPlugin(t,e=>{},n)}void 0!==n&&e.setMaxParallelImageRequests(n),void 0!==r&&e.setWorkerCount(r),void 0!==s&&e.setWorkerUrl(s)}(n,t),t.reuseMaps&&(o=y.reuse(t,l.current)),o||(o=new y(n.Map,t,l.current)),c.map=function(e){if(!e)return null;const t=e.map,o={getMap:()=>t};for(const n of function(e){const t=new Set;let o=e;for(;o;){for(const n of Object.getOwnPropertyNames(o))"_"!==n[0]&&"function"==typeof e[n]&&"fire"!==n&&"setEventedParent"!==n&&t.add(n);o=Object.getPrototypeOf(o)}return Array.from(t)}(t))n in o||v.includes(n)||(o[n]=t[n].bind(t));return o}(o),c.mapLib=n,i(o),null==s||s.onMapMount(c.map,t.id)}).catch(e=>{const{onError:o}=t;o&&o({type:"error",target:null,originalEvent:null,error:e})}),()=>{r=!1,o&&(null==s||s.onMapUnmount(t.id),t.reuseMaps?o.recycle():o.destroy())}},[]),_(()=>{a&&a.setProps(t)}),e.useImperativeHandle(o,()=>c.map,[a]);const u=e.useMemo(()=>({position:"relative",width:"100%",height:"100%",...t.style}),[t.style]);return e.createElement("div",{id:t.id,ref:l,style:u},a&&e.createElement(b.Provider,{value:c},e.createElement("div",{"mapboxgl-children":"",style:{height:"100%"}},t.children)))}),C=/box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;function S(e,t){if(!e||!t)return;const o=e.style;for(const n in t){const e=t[n];Number.isFinite(e)&&!C.test(n)?o[n]=`${e}px`:o[n]=e}}function E(e,t){if(e===t)return null;const o=M(e),n=M(t),r=[];for(const s of n)o.has(s)||r.push(s);for(const s of o)n.has(s)||r.push(s);return 0===r.length?null:r}function M(e){return new Set(e?e.trim().split(/\s+/):[])}const x=e.memo(e.forwardRef((o,n)=>{const{map:r,mapLib:s}=e.useContext(b),a=e.useRef({props:o}),i=e.useMemo(()=>{let t=!1;e.Children.forEach(o.children,e=>{e&&(t=!0)});const n={...o,element:t?document.createElement("div"):void 0},r=new s.Marker(n);return r.setLngLat([o.longitude,o.latitude]),r.getElement().addEventListener("click",e=>{var t,o;null==(o=(t=a.current.props).onClick)||o.call(t,{type:"click",target:r,originalEvent:e})}),r.on("dragstart",e=>{var t,o;const n=e;n.lngLat=i.getLngLat(),null==(o=(t=a.current.props).onDragStart)||o.call(t,n)}),r.on("drag",e=>{var t,o;const n=e;n.lngLat=i.getLngLat(),null==(o=(t=a.current.props).onDrag)||o.call(t,n)}),r.on("dragend",e=>{var t,o;const n=e;n.lngLat=i.getLngLat(),null==(o=(t=a.current.props).onDragEnd)||o.call(t,n)}),r},[]);e.useEffect(()=>(i.addTo(r.getMap()),()=>{i.remove()}),[]);const{longitude:l,latitude:c,offset:u,style:d,draggable:p=!1,popup:m=null,rotation:f=0,rotationAlignment:g="auto",pitchAlignment:h="auto"}=o;e.useEffect(()=>{S(i.getElement(),d)},[d]),e.useImperativeHandle(n,()=>i,[]);const y=a.current.props;i.getLngLat().lng===l&&i.getLngLat().lat===c||i.setLngLat([l,c]),u&&!function(e,t){const o=Array.isArray(e)?e[0]:e?e.x:0,n=Array.isArray(e)?e[1]:e?e.y:0,r=Array.isArray(t)?t[0]:t?t.x:0,s=Array.isArray(t)?t[1]:t?t.y:0;return o===r&&n===s}(i.getOffset(),u)&&i.setOffset(u),i.isDraggable()!==p&&i.setDraggable(p),i.getRotation()!==f&&i.setRotation(f),i.getRotationAlignment()!==g&&i.setRotationAlignment(g),i.getPitchAlignment()!==h&&i.setPitchAlignment(h),i.getPopup()!==m&&i.setPopup(m);const v=E(y.className,o.className);if(v)for(const e of v)i.toggleClassName(e);return a.current.props=o,t.createPortal(o.children,i.getElement())})),w=e.memo(e.forwardRef((o,n)=>{const{map:r,mapLib:s}=e.useContext(b),i=e.useMemo(()=>document.createElement("div"),[]),l=e.useRef({props:o}),c=e.useMemo(()=>{const e={...o},t=new s.Popup(e);return t.setLngLat([o.longitude,o.latitude]),t.once("open",e=>{var t,o;null==(o=(t=l.current.props).onOpen)||o.call(t,e)}),t},[]);if(e.useEffect(()=>{const e=e=>{var t,o;null==(o=(t=l.current.props).onClose)||o.call(t,e)};return c.on("close",e),c.setDOMContent(i).addTo(r.getMap()),()=>{c.off("close",e),c.isOpen()&&c.remove()}},[]),e.useEffect(()=>{S(c.getElement(),o.style)},[o.style]),e.useImperativeHandle(n,()=>c,[]),c.isOpen()){const e=l.current.props;c.getLngLat().lng===o.longitude&&c.getLngLat().lat===o.latitude||c.setLngLat([o.longitude,o.latitude]),o.offset&&!a(e.offset,o.offset)&&c.setOffset(o.offset),e.anchor===o.anchor&&e.maxWidth===o.maxWidth||(c.options.anchor=o.anchor,c.setMaxWidth(o.maxWidth));const t=E(e.className,o.className);if(t)for(const o of t)c.toggleClassName(o);l.current.props=o}return t.createPortal(o.children,i)}));function P(t,o,n,r){const s=e.useContext(b),a=e.useMemo(()=>t(s),[]);return e.useEffect(()=>{const e=o,t="function"==typeof o?o:null,{map:n}=s;return n.hasControl(a)||n.addControl(a,null==e?void 0:e.position),()=>{t&&t(s),n.hasControl(a)&&n.removeControl(a)}},[]),a}e.memo(function(t){const o=P(({mapLib:e})=>new e.AttributionControl(t),{position:t.position});return e.useEffect(()=>{S(o._container,t.style)},[t.style]),null}),e.memo(function(t){const o=P(({mapLib:e})=>new e.FullscreenControl({container:t.containerId&&document.getElementById(t.containerId)}),{position:t.position});return e.useEffect(()=>{S(o._controlContainer,t.style)},[t.style]),null}),e.memo(e.forwardRef(function(t,o){const n=e.useRef({props:t}),r=P(({mapLib:e})=>{const o=new e.GeolocateControl(t),r=o._setupUI;return o._setupUI=()=>{o._container.hasChildNodes()||r()},o.on("geolocate",e=>{var t,o;null==(o=(t=n.current.props).onGeolocate)||o.call(t,e)}),o.on("error",e=>{var t,o;null==(o=(t=n.current.props).onError)||o.call(t,e)}),o.on("outofmaxbounds",e=>{var t,o;null==(o=(t=n.current.props).onOutOfMaxBounds)||o.call(t,e)}),o.on("trackuserlocationstart",e=>{var t,o;null==(o=(t=n.current.props).onTrackUserLocationStart)||o.call(t,e)}),o.on("trackuserlocationend",e=>{var t,o;null==(o=(t=n.current.props).onTrackUserLocationEnd)||o.call(t,e)}),o},{position:t.position});return n.current.props=t,e.useImperativeHandle(o,()=>r,[]),e.useEffect(()=>{S(r._container,t.style)},[t.style]),null})),e.memo(function(t){const o=P(({mapLib:e})=>new e.NavigationControl(t),{position:t.position});return e.useEffect(()=>{S(o._container,t.style)},[t.style]),null});const k=e.memo(function(t){const o=P(({mapLib:e})=>new e.ScaleControl(t),{position:t.position}),n=e.useRef(t),r=n.current;n.current=t;const{style:s}=t;return void 0!==t.maxWidth&&t.maxWidth!==r.maxWidth&&(o.options.maxWidth=t.maxWidth),void 0!==t.unit&&t.unit!==r.unit&&o.setUnit(t.unit),e.useEffect(()=>{S(o._container,s)},[s]),null});function R(e,t){if(!e)throw new Error(t)}e.memo(function(t){const o=P(({mapLib:e})=>new e.TerrainControl(t),{position:t.position});return e.useEffect(()=>{S(o._container,t.style)},[t.style]),null}),e.memo(function(t){const o=P(({mapLib:e})=>new e.LogoControl(t),{position:t.position});return e.useEffect(()=>{S(o._container,t.style)},[t.style]),null});let z=0;function j(t){const o=e.useContext(b).map.getMap(),n=e.useRef(t),[,r]=e.useState(0),s=e.useMemo(()=>t.id||"jsx-source-"+z++,[]);e.useEffect(()=>{if(o){const e=()=>setTimeout(()=>r(e=>e+1),0);return o.on("styledata",e),e(),()=>{var t;if(o.off("styledata",e),o.style&&o.style._loaded&&o.getSource(s)){const e=null==(t=o.getStyle())?void 0:t.layers;if(e)for(const t of e)t.source===s&&o.removeLayer(t.id);o.removeSource(s)}}}},[o]);let i=o&&o.style&&o.getSource(s);return i?function(e,t,o){var n,r,s;R(t.id===o.id,"source id changed"),R(t.type===o.type,"source type changed");let i="",l=0;for(const u in t)"children"===u||"id"===u||a(o[u],t[u])||(i=u,l++);if(!l)return;const c=t.type;if("geojson"===c)e.setData(t.data);else if("image"===c)e.updateImage({url:t.url,coordinates:t.coordinates});else switch(i){case"coordinates":null==(n=e.setCoordinates)||n.call(e,t.coordinates);break;case"url":null==(r=e.setUrl)||r.call(e,t.url);break;case"tiles":null==(s=e.setTiles)||s.call(e,t.tiles)}}(i,t,n.current):i=function(e,t,o){if(e.style&&e.style._loaded){const n={...o};return delete n.id,delete n.children,e.addSource(t,n),e.getSource(t)}return null}(o,s,t),n.current=t,i&&e.Children.map(t.children,t=>t&&e.cloneElement(t,{source:s}))||null}let I=0;function T(t){const o=e.useContext(b).map.getMap(),n=e.useRef(t),[,r]=e.useState(0),s=e.useMemo(()=>t.id||"jsx-layer-"+I++,[]);if(e.useEffect(()=>{if(o){const e=()=>r(e=>e+1);return o.on("styledata",e),e(),()=>{o.off("styledata",e),o.style&&o.style._loaded&&o.getLayer(s)&&o.removeLayer(s)}}},[o]),o&&o.style&&o.getLayer(s))try{!function(e,t,o,n){if(R(o.id===n.id,"layer id changed"),R(o.type===n.type,"layer type changed"),"custom"===o.type||"custom"===n.type)return;const{layout:r={},paint:s={},filter:i,minzoom:l,maxzoom:c,beforeId:u}=o;if(u!==n.beforeId&&e.moveLayer(t,u),r!==n.layout){const o=n.layout||{};for(const n in r)a(r[n],o[n])||e.setLayoutProperty(t,n,r[n]);for(const n in o)r.hasOwnProperty(n)||e.setLayoutProperty(t,n,void 0)}if(s!==n.paint){const o=n.paint||{};for(const n in s)a(s[n],o[n])||e.setPaintProperty(t,n,s[n]);for(const n in o)s.hasOwnProperty(n)||e.setPaintProperty(t,n,void 0)}a(i,n.filter)||e.setFilter(t,i),l===n.minzoom&&c===n.maxzoom||e.setLayerZoomRange(t,l,c)}(o,s,t,n.current)}catch(i){}else!function(e,t,o){if(e.style&&e.style._loaded&&(!("source"in o)||e.getSource(o.source))){const n={...o,id:t};delete n.beforeId,e.addLayer(n,o.beforeId)}}(o,s,t);return n.current=t,null}const O="pymc-basemap-mode",U="dark";function A(){if("undefined"==typeof window)return U;try{const e=localStorage.getItem(O);if("light"===e||"dark"===e)return e}catch{}return U}function F(e){if("undefined"!=typeof window)try{localStorage.setItem(O,e)}catch{}}const W=o(e=>({mode:A(),toggle:()=>e(e=>{const t="light"===e.mode?"dark":"light";return F(t),{mode:t}}),setMode:t=>{F(t),e({mode:t})}})),D=()=>W(e=>e.mode),Z=()=>W(e=>e.toggle),N={light:"https://basemaps.cartocdn.com/gl/positron-gl-style/style.json",dark:"https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json"},H={light:"basemap-light-",dark:"basemap-dark-"},B={};function q({mode:t}){const{current:o}=s(),[n,r]=e.useState(null),a=e.useRef({light:!1,dark:!1}),i=e.useRef({light:[],dark:[]});e.useEffect(()=>{const e=()=>{var e;const t=null==(e=null==o?void 0:o.getMap)?void 0:e.call(o);t&&!n&&r(t)};e();const t=setInterval(e,50),s=setTimeout(()=>clearInterval(t),5e3);return()=>{clearInterval(t),clearTimeout(s)}},[o,n]);const l=e.useCallback(async(e,t,o)=>{var n,r;if(a.current[t])return;const s=H[t],l=await async function(e){if(B[e])return B[e];const t=await fetch(N[e]),o=await t.json();return B[e]=o,o}(t),c=[];for(const[a,i]of Object.entries(l.sources||{})){const t=s+a;e.getSource(t)||e.addSource(t,i)}const u=null==(r=((null==(n=e.getStyle())?void 0:n.layers)||[]).find(e=>!e.id.startsWith("basemap-light-")&&!e.id.startsWith("basemap-dark-")))?void 0:r.id;for(const a of l.layers||[]){const t=s+a.id;if(c.push(t),e.getLayer(t))continue;const n={...a,id:t};"source"in n&&"string"==typeof n.source&&(n.source=s+n.source),n.layout||(n.layout={}),n.layout.visibility=o?"visible":"none";try{e.addLayer(n,u)}catch(d){}}i.current[t]=c,a.current[t]=!0},[]),c=e.useCallback((e,t,o)=>{const n=i.current[t],r=o?"visible":"none";for(const s of n)if(e.getLayer(s))try{e.setLayoutProperty(s,"visibility",r)}catch{}},[]),u=e.useCallback(e=>{var t;const o=((null==(t=e.getStyle())?void 0:t.layers)||[]).filter(e=>!e.id.startsWith("basemap-light-")&&!e.id.startsWith("basemap-dark-"));for(const n of o)try{e.moveLayer(n.id)}catch{}},[]);return e.useEffect(()=>{if(!n)return;let e=!1;const o=async()=>{if(!e)try{await Promise.all([l(n,"light","light"===t),l(n,"dark","dark"===t)]),e||u(n)}catch(o){}};n.isStyleLoaded()?o():(n.once("style.load",o),n.once("load",()=>{e||a.current.light||o()}));const r=()=>{e||setTimeout(()=>{!e&&a.current.light&&a.current.dark&&u(n)},100)};return n.on("styledata",r),()=>{e=!0,n.off("styledata",r)}},[n,l,u,t]),e.useEffect(()=>{n&&a.current.light&&a.current.dark&&(c(n,"light","light"===t),c(n,"dark","dark"===t))},[n,t,c]),null}export{q as B,T as L,L as M,w as P,j as S,x as a,s as b,Z as c,k as d,D as u}; diff --git a/frontend/dist/assets/Card-2pQSGkKC.js b/frontend/dist/assets/Card-CPlTPCY8.js similarity index 92% rename from frontend/dist/assets/Card-2pQSGkKC.js rename to frontend/dist/assets/Card-CPlTPCY8.js index e2596716..3a23271f 100644 --- a/frontend/dist/assets/Card-2pQSGkKC.js +++ b/frontend/dist/assets/Card-CPlTPCY8.js @@ -1 +1 @@ -import{j as e}from"./vendor-react-C341c8YC.js";import{n as s}from"./recharts-6XUQYgRA.js";import{B as t}from"./index-BJEgt3tp.js";function l({title:l,icon:r,badge:i,subtitle:a,actions:c,iconColor:n="text-icon-card-title",largeTitle:x=!1,listHeader:m=!1,stackActionsOnMobile:d=!1}){return d&&c?e.jsxs("div",{className:s("flex flex-col gap-1 flex-shrink-0",m?"px-4 py-3 border-b border-border-subtle bg-bg-elevated/20":"mb-3"),children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 min-h-[32px]",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[r&&e.jsx("span",{className:s("icon-md flex items-center justify-center",n),children:r}),e.jsx("span",{className:s(x?"type-subheading text-text-primary":"type-micro"),children:l}),i&&e.jsx(t,{color:"teal",children:i})]}),e.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:c})]}),a&&e.jsx("p",{className:"type-label text-text-muted ml-8",children:a})]}):e.jsxs("div",{className:s("flex flex-col gap-1 flex-shrink-0",m?"px-4 py-3 border-b border-border-subtle bg-bg-elevated/20":"mb-3"),children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 min-h-[32px]",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[r&&e.jsx("span",{className:s("icon-md flex items-center justify-center",n),children:r}),e.jsx("span",{className:s(x?"type-subheading text-text-primary":"type-micro"),children:l}),i&&e.jsx(t,{color:"teal",children:i})]}),c&&e.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:c})]}),a&&e.jsx("p",{className:"type-label text-text-muted ml-8",children:a})]})}function r({children:t,centered:l,className:r}){return e.jsx("div",{className:s("flex-1 min-h-0",l&&"flex items-center justify-center",r),children:t})}export{l as C,r as a}; +import{j as e}from"./vendor-react-DCIF8YoJ.js";import{n as s}from"./recharts-DVj1EL-m.js";import{B as t}from"./index-BGs2yNOg.js";function l({title:l,icon:r,badge:i,subtitle:a,actions:c,iconColor:n="text-icon-card-title",largeTitle:x=!1,listHeader:m=!1,stackActionsOnMobile:d=!1}){return d&&c?e.jsxs("div",{className:s("flex flex-col gap-1 flex-shrink-0",m?"px-4 py-3 border-b border-border-subtle bg-bg-elevated/20":"mb-3"),children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 min-h-[32px]",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[r&&e.jsx("span",{className:s("icon-md flex items-center justify-center",n),children:r}),e.jsx("span",{className:s(x?"type-subheading text-text-primary":"type-micro"),children:l}),i&&e.jsx(t,{color:"teal",children:i})]}),e.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:c})]}),a&&e.jsx("p",{className:"type-label text-text-muted ml-8",children:a})]}):e.jsxs("div",{className:s("flex flex-col gap-1 flex-shrink-0",m?"px-4 py-3 border-b border-border-subtle bg-bg-elevated/20":"mb-3"),children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 min-h-[32px]",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[r&&e.jsx("span",{className:s("icon-md flex items-center justify-center",n),children:r}),e.jsx("span",{className:s(x?"type-subheading text-text-primary":"type-micro"),children:l}),i&&e.jsx(t,{color:"teal",children:i})]}),c&&e.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:c})]}),a&&e.jsx("p",{className:"type-label text-text-muted ml-8",children:a})]})}function r({children:t,centered:l,className:r}){return e.jsx("div",{className:s("flex-1 min-h-0",l&&"flex items-center justify-center",r),children:t})}export{l as C,r as a}; diff --git a/frontend/dist/assets/CollisionExplorerModal-CyK7TMsS.js b/frontend/dist/assets/CollisionExplorerModal-CyK7TMsS.js new file mode 100644 index 00000000..f647279f --- /dev/null +++ b/frontend/dist/assets/CollisionExplorerModal-CyK7TMsS.js @@ -0,0 +1 @@ +import{a as e,j as s}from"./vendor-react-DCIF8YoJ.js";import{u as t,M as a,B as o,S as i,L as n,a as l}from"./BasemapLayer-g9CXC1Ky.js";import"./maplibre-gl-Bk5DsYkB.js";import{n as r}from"./recharts-DVj1EL-m.js";import{c as d,f as c,an as h,h as u,aq as m,ar as x,ai as p,B as g}from"./index-BGs2yNOg.js";import{T as v}from"./triangle-alert-2-1YN-Am.js";import{M as f}from"./map-pin-x5eP-WEg.js";import{C as b}from"./check-qb29v-su.js";import{C as j}from"./DataBox-nCNZLfvU.js";const y=d("messages-square",[["path",{d:"M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z",key:"1n2ejm"}],["path",{d:"M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1",key:"1qfcsi"}]]),N=d("monitor-smartphone",[["path",{d:"M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8",key:"10dyio"}],["path",{d:"M10 19v-3.96 3.15",key:"1irgej"}],["path",{d:"M7 19h5",key:"qswx4l"}],["rect",{width:"6",height:"10",x:"16",y:"12",rx:"2",key:"1egngj"}]]),w=d("share-2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]),k={version:8,sources:{},layers:[],glyphs:"https://demotiles.maplibre.org/font/{fontstack}/{range}.pbf"};function M({node:t,isHovered:a,onHover:o}){const[i,n]=e.useState(!1),l=e.useCallback(e=>{var s,a;e.stopPropagation(),s=t.hash,(null==(a=navigator.clipboard)?void 0:a.writeText)&&navigator.clipboard.writeText(s).catch(()=>{}),n(!0),setTimeout(()=>n(!1),2e3)},[t.hash]),d=t.contactType.toLowerCase(),c=d.includes("room")||d.includes("server");let h=w,u="text-accent-primary";return c?(h=y,u="text-signal-fair"):"companion"===d||"client"===d?(h=N,u="text-text-muted"):t.isNeighbor&&(u="text-accent-success"),s.jsxs("div",{className:r("flex items-center gap-3 px-3 py-2.5 rounded-lg transition-colors cursor-pointer",a?"bg-accent-primary/10":"hover:bg-white/[0.03]"),onMouseEnter:()=>o(t.hash),onMouseLeave:()=>o(null),children:[s.jsx(h,{className:r("w-4 h-4 flex-shrink-0",u)}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("span",{className:"text-sm font-medium text-text-primary truncate",children:t.name}),t.isNeighbor&&s.jsx(g,{color:"green",compact:!0,children:"NBR"}),t.isRepeater&&s.jsx(g,{color:"zinc",compact:!0,children:"RPT"}),t.isHub&&s.jsx(g,{color:"purple",compact:!0,children:"HUB"})]}),s.jsxs("button",{onClick:l,className:r("mt-1 inline-flex items-center gap-1 text-[10px] font-mono px-1.5 py-0.5 rounded","border transition-all cursor-pointer",i?"border-accent-success/50 bg-accent-success/10 text-accent-success":"border-border-subtle bg-bg-subtle/50 text-text-muted hover:border-border-strong"),title:`Copy: ${t.hash}`,children:[t.hash.slice(0,12),"…",i?s.jsx(b,{className:"w-2.5 h-2.5"}):s.jsx(j,{className:"w-2.5 h-2.5 opacity-50"})]})]})]})}function H({nodes:d,hoveredHash:c,onHover:h}){const u=t(),m=e.useRef(null),x=p(),[v,b]=e.useState(!1),j=e.useMemo(()=>d.filter(e=>null!=e.latitude&&null!=e.longitude&&(0!==e.latitude||0!==e.longitude)),[d]),y=e.useMemo(()=>{if(0===j.length)return null;let e=1/0,s=-1/0,t=1/0,a=-1/0;for(const o of j)e=Math.min(e,o.longitude),s=Math.max(s,o.longitude),t=Math.min(t,o.latitude),a=Math.max(a,o.latitude);if(a-t<.01){const e=(a+t)/2;t=e-.005,a=e+.005}if(s-e<.01){const t=(s+e)/2;e=t-.005,s=t+.005}return[[e,t],[s,a]]},[j]),N=e.useMemo(()=>y?{longitude:(y[0][0]+y[1][0])/2,latitude:(y[0][1]+y[1][1])/2}:{longitude:0,latitude:0},[y]),w=e.useMemo(()=>{if(j.length<2)return null;const e=[];for(let s=0;s{var e;const s=null==(e=m.current)?void 0:e.getMap();s&&y?(s.fitBounds(y,{padding:{top:50,bottom:50,left:50,right:50},maxZoom:13,duration:0}),setTimeout(()=>b(!0),50)):b(!0)},[y]),H=x&&v;return 0===j.length?s.jsx("div",{className:"h-full flex items-center justify-center bg-bg-subtle/30 rounded-lg",children:s.jsxs("div",{className:"text-center text-text-secondary p-4",children:[s.jsx(f,{className:"w-8 h-8 mx-auto mb-2 opacity-40"}),s.jsx("p",{className:"text-sm",children:"No location data available"})]})}):s.jsxs("div",{className:"h-full w-full relative rounded-lg overflow-hidden bg-bg-elevated",children:[s.jsx("div",{className:r("absolute inset-0 flex items-center justify-center z-10","transition-opacity duration-200 pointer-events-none",H?"opacity-0":"opacity-100 bg-bg-elevated"),children:s.jsx("div",{className:"w-5 h-5 border-2 border-text-muted/30 border-t-text-muted rounded-full animate-spin"})}),s.jsx("div",{className:r("h-full w-full transition-opacity duration-200",H?"opacity-100":"opacity-0"),children:s.jsxs(a,{ref:m,initialViewState:{longitude:N.longitude,latitude:N.latitude,zoom:10},style:{height:"100%",width:"100%"},mapStyle:k,attributionControl:!1,onLoad:M,children:[s.jsx(o,{mode:u}),w&&s.jsx(i,{id:"collision-edges",type:"geojson",data:w,children:s.jsx(n,{id:"collision-edges-line",type:"line",paint:{"line-color":"#3B3F4A","line-width":2,"line-opacity":.8},layout:{"line-cap":"round","line-join":"round"}})}),j.map(e=>{const t=e.hash===c,a=e.hash.startsWith("0x")?e.hash.slice(2,4).toUpperCase():e.hash.slice(0,2).toUpperCase();return s.jsx(l,{longitude:e.longitude,latitude:e.latitude,anchor:"center",children:s.jsx("div",{className:"cursor-pointer transition-all duration-150",onMouseEnter:()=>h(e.hash),onMouseLeave:()=>h(null),style:{pointerEvents:"auto"},children:s.jsxs(g,{color:"amber",filled:!0,className:"font-mono text-[10px] shadow-lg",children:[a,t&&s.jsx("span",{className:"ml-1 opacity-75 font-sans",children:e.name})]})})},e.hash)})]})})]})}const C=e.memo(function({isOpen:t,prefix:a,candidateHashes:o,onClose:i}){const n=c(),l=h(),r=u(),[d,p]=e.useState(null),g=e.useMemo(()=>new Set(r.map(e=>e.hash)),[r]),f=(null==n?void 0:n.neighbors)??{},b=e.useMemo(()=>o.map(e=>{var s;const t=(e=>f[e]?f[e]:!e.startsWith("0x")&&f["0x"+e]?f["0x"+e]:e.startsWith("0x")&&f[e.slice(2)]?f[e.slice(2)]:void 0)(e);return{hash:e,name:(null==t?void 0:t.node_name)||(null==t?void 0:t.name)||`Unknown (${e.slice(0,8)}…)`,contactType:(null==t?void 0:t.contact_type)||"",isRepeater:(null==t?void 0:t.is_repeater)||"repeater"===(null==(s=null==t?void 0:t.contact_type)?void 0:s.toLowerCase())||!1,isNeighbor:g.has(e)||g.has("0x"+e)||g.has(e.replace(/^0x/,"")),isHub:l.has(e),latitude:null==t?void 0:t.latitude,longitude:null==t?void 0:t.longitude}}).sort((e,s)=>e.isNeighbor!==s.isNeighbor?e.isNeighbor?-1:1:e.isHub!==s.isHub?e.isHub?-1:1:e.name.localeCompare(s.name)),[o,f,g,l]),j=e.useMemo(()=>b.some(e=>null!=e.latitude&&null!=e.longitude&&(0!==e.latitude||0!==e.longitude)),[b]),y=e.useCallback(e=>{p(e)},[]),N=j?"4xl":"lg";return t?s.jsxs(m,{open:t,onClose:i,size:N,motionPlus:!0,className:j?"sm:h-[500px] sm:max-h-[600px]":"",children:[s.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border-subtle",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"p-2 rounded-lg bg-signal-fair/10",children:s.jsx(v,{className:"w-5 h-5 text-signal-fair"})}),s.jsxs("div",{children:[s.jsxs("div",{className:"text-base font-semibold text-text-primary",children:["Prefix Collision: ",s.jsx("span",{className:"font-mono text-accent-primary",children:a})]}),s.jsxs("p",{className:"text-xs text-text-secondary",children:[b.length," nodes share this prefix"]})]})]}),s.jsx("button",{onClick:i,className:"p-2 text-text-muted hover:text-text-primary transition-colors rounded-lg hover:bg-bg-subtle",children:s.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),s.jsxs(x,{className:"p-0 overflow-hidden flex-1 flex flex-col min-h-0",children:[s.jsxs("div",{className:"sm:hidden flex-1 overflow-y-auto",children:[j&&s.jsx("div",{className:"h-64 p-2 border-b border-border-subtle",children:s.jsx(H,{nodes:b,hoveredHash:d,onHover:y})}),s.jsx("div",{className:"p-2",children:b.map(e=>s.jsx(M,{node:e,isHovered:d===e.hash,onHover:y},e.hash))})]}),j?s.jsxs("div",{className:"hidden sm:grid sm:grid-cols-[280px_minmax(400px,1fr)] flex-1 overflow-hidden sm:min-w-[700px]",children:[s.jsx("div",{className:"overflow-y-auto border-r border-border-subtle",children:s.jsx("div",{className:"p-2",children:b.map(e=>s.jsx(M,{node:e,isHovered:d===e.hash,onHover:y},e.hash))})}),s.jsx("div",{className:"overflow-hidden p-2",children:s.jsx(H,{nodes:b,hoveredHash:d,onHover:y})})]}):s.jsx("div",{className:"hidden sm:block flex-1 overflow-y-auto",children:s.jsx("div",{className:"p-2",children:b.map(e=>s.jsx(M,{node:e,isHovered:d===e.hash,onHover:y},e.hash))})})]})]}):null});export{C,N as M,w as S}; diff --git a/frontend/dist/assets/CollisionExplorerModal-DTnzK_xA.js b/frontend/dist/assets/CollisionExplorerModal-DTnzK_xA.js deleted file mode 100644 index 8439d00b..00000000 --- a/frontend/dist/assets/CollisionExplorerModal-DTnzK_xA.js +++ /dev/null @@ -1 +0,0 @@ -import{r as e,j as s,at as t,ar as a,bj as o,bk as i,bl as l,bm as n,aU as r,$ as d,a0 as c,bn as u,aV as h}from"./vendor-react-C341c8YC.js";import"./maplibre-gl-Bk5DsYkB.js";import{n as m}from"./recharts-6XUQYgRA.js";import{e as x,J as p,f as v,N as b,O as g,H as f,B as j}from"./index-BJEgt3tp.js";import{u as N,B as y}from"./BasemapLayer-S9Ush6Hh.js";const w={version:8,sources:{},layers:[],glyphs:"https://demotiles.maplibre.org/font/{fontstack}/{range}.pbf"};function H({node:t,isHovered:a,onHover:o}){const[i,l]=e.useState(!1),n=e.useCallback(e=>{var s,a;e.stopPropagation(),s=t.hash,(null==(a=navigator.clipboard)?void 0:a.writeText)&&navigator.clipboard.writeText(s).catch(()=>{}),l(!0),setTimeout(()=>l(!1),2e3)},[t.hash]),x=t.contactType.toLowerCase(),p=x.includes("room")||x.includes("server");let v=r,b="text-accent-primary";return p?(v=u,b="text-signal-fair"):"companion"===x||"client"===x?(v=h,b="text-text-muted"):t.isNeighbor&&(b="text-accent-success"),s.jsxs("div",{className:m("flex items-center gap-3 px-3 py-2.5 rounded-lg transition-colors cursor-pointer",a?"bg-accent-primary/10":"hover:bg-white/[0.03]"),onMouseEnter:()=>o(t.hash),onMouseLeave:()=>o(null),children:[s.jsx(v,{className:m("w-4 h-4 flex-shrink-0",b)}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("span",{className:"text-sm font-medium text-text-primary truncate",children:t.name}),t.isNeighbor&&s.jsx(j,{color:"green",compact:!0,children:"NBR"}),t.isRepeater&&s.jsx(j,{color:"zinc",compact:!0,children:"RPT"}),t.isHub&&s.jsx(j,{color:"purple",compact:!0,children:"HUB"})]}),s.jsxs("button",{onClick:n,className:m("mt-1 inline-flex items-center gap-1 text-[10px] font-mono px-1.5 py-0.5 rounded","border transition-all cursor-pointer",i?"border-accent-success/50 bg-accent-success/10 text-accent-success":"border-border-subtle bg-bg-subtle/50 text-text-muted hover:border-border-strong"),title:`Copy: ${t.hash}`,children:[t.hash.slice(0,12),"…",i?s.jsx(d,{className:"w-2.5 h-2.5"}):s.jsx(c,{className:"w-2.5 h-2.5 opacity-50"})]})]})]})}function C({nodes:t,hoveredHash:r,onHover:d}){const c=N(),u=e.useRef(null),h=f(),[x,p]=e.useState(!1),v=e.useMemo(()=>t.filter(e=>null!=e.latitude&&null!=e.longitude&&(0!==e.latitude||0!==e.longitude)),[t]),b=e.useMemo(()=>{if(0===v.length)return null;let e=1/0,s=-1/0,t=1/0,a=-1/0;for(const o of v)e=Math.min(e,o.longitude),s=Math.max(s,o.longitude),t=Math.min(t,o.latitude),a=Math.max(a,o.latitude);if(a-t<.01){const e=(a+t)/2;t=e-.005,a=e+.005}if(s-e<.01){const t=(s+e)/2;e=t-.005,s=t+.005}return[[e,t],[s,a]]},[v]),g=e.useMemo(()=>b?{longitude:(b[0][0]+b[1][0])/2,latitude:(b[0][1]+b[1][1])/2}:{longitude:0,latitude:0},[b]),H=e.useMemo(()=>{if(v.length<2)return null;const e=[];for(let s=0;s{var e;const s=null==(e=u.current)?void 0:e.getMap();s&&b?(s.fitBounds(b,{padding:{top:50,bottom:50,left:50,right:50},maxZoom:13,duration:0}),setTimeout(()=>p(!0),50)):p(!0)},[b]),M=h&&x;return 0===v.length?s.jsx("div",{className:"h-full flex items-center justify-center bg-bg-subtle/30 rounded-lg",children:s.jsxs("div",{className:"text-center text-text-secondary p-4",children:[s.jsx(a,{className:"w-8 h-8 mx-auto mb-2 opacity-40"}),s.jsx("p",{className:"text-sm",children:"No location data available"})]})}):s.jsxs("div",{className:"h-full w-full relative rounded-lg overflow-hidden bg-bg-elevated",children:[s.jsx("div",{className:m("absolute inset-0 flex items-center justify-center z-10","transition-opacity duration-200 pointer-events-none",M?"opacity-0":"opacity-100 bg-bg-elevated"),children:s.jsx("div",{className:"w-5 h-5 border-2 border-text-muted/30 border-t-text-muted rounded-full animate-spin"})}),s.jsx("div",{className:m("h-full w-full transition-opacity duration-200",M?"opacity-100":"opacity-0"),children:s.jsxs(o,{ref:u,initialViewState:{longitude:g.longitude,latitude:g.latitude,zoom:10},style:{height:"100%",width:"100%"},mapStyle:w,attributionControl:!1,onLoad:C,children:[s.jsx(y,{mode:c}),H&&s.jsx(i,{id:"collision-edges",type:"geojson",data:H,children:s.jsx(l,{id:"collision-edges-line",type:"line",paint:{"line-color":"#3B3F4A","line-width":2,"line-opacity":.8},layout:{"line-cap":"round","line-join":"round"}})}),v.map(e=>{const t=e.hash===r,a=e.hash.startsWith("0x")?e.hash.slice(2,4).toUpperCase():e.hash.slice(0,2).toUpperCase();return s.jsx(n,{longitude:e.longitude,latitude:e.latitude,anchor:"center",children:s.jsx("div",{className:"cursor-pointer transition-all duration-150",onMouseEnter:()=>d(e.hash),onMouseLeave:()=>d(null),style:{pointerEvents:"auto"},children:s.jsxs(j,{color:"amber",filled:!0,className:"font-mono text-[10px] shadow-lg",children:[a,t&&s.jsx("span",{className:"ml-1 opacity-75 font-sans",children:e.name})]})})},e.hash)})]})})]})}const M=e.memo(function({isOpen:a,prefix:o,candidateHashes:i,onClose:l}){const n=x(),r=p(),d=v(),[c,u]=e.useState(null),h=e.useMemo(()=>new Set(d.map(e=>e.hash)),[d]),m=(null==n?void 0:n.neighbors)??{},f=e.useMemo(()=>i.map(e=>{var s;const t=(e=>m[e]?m[e]:!e.startsWith("0x")&&m["0x"+e]?m["0x"+e]:e.startsWith("0x")&&m[e.slice(2)]?m[e.slice(2)]:void 0)(e);return{hash:e,name:(null==t?void 0:t.node_name)||(null==t?void 0:t.name)||`Unknown (${e.slice(0,8)}…)`,contactType:(null==t?void 0:t.contact_type)||"",isRepeater:(null==t?void 0:t.is_repeater)||"repeater"===(null==(s=null==t?void 0:t.contact_type)?void 0:s.toLowerCase())||!1,isNeighbor:h.has(e)||h.has("0x"+e)||h.has(e.replace(/^0x/,"")),isHub:r.has(e),latitude:null==t?void 0:t.latitude,longitude:null==t?void 0:t.longitude}}).sort((e,s)=>e.isNeighbor!==s.isNeighbor?e.isNeighbor?-1:1:e.isHub!==s.isHub?e.isHub?-1:1:e.name.localeCompare(s.name)),[i,m,h,r]),j=e.useMemo(()=>f.some(e=>null!=e.latitude&&null!=e.longitude&&(0!==e.latitude||0!==e.longitude)),[f]),N=e.useCallback(e=>{u(e)},[]),y=j?"4xl":"lg";return a?s.jsxs(b,{open:a,onClose:l,size:y,motionPlus:!0,className:j?"sm:h-[500px] sm:max-h-[600px]":"",children:[s.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border-subtle",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"p-2 rounded-lg bg-signal-fair/10",children:s.jsx(t,{className:"w-5 h-5 text-signal-fair"})}),s.jsxs("div",{children:[s.jsxs("div",{className:"text-base font-semibold text-text-primary",children:["Prefix Collision: ",s.jsx("span",{className:"font-mono text-accent-primary",children:o})]}),s.jsxs("p",{className:"text-xs text-text-secondary",children:[f.length," nodes share this prefix"]})]})]}),s.jsx("button",{onClick:l,className:"p-2 text-text-muted hover:text-text-primary transition-colors rounded-lg hover:bg-bg-subtle",children:s.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),s.jsxs(g,{className:"p-0 overflow-hidden flex-1 flex flex-col min-h-0",children:[s.jsxs("div",{className:"sm:hidden flex-1 overflow-y-auto",children:[j&&s.jsx("div",{className:"h-64 p-2 border-b border-border-subtle",children:s.jsx(C,{nodes:f,hoveredHash:c,onHover:N})}),s.jsx("div",{className:"p-2",children:f.map(e=>s.jsx(H,{node:e,isHovered:c===e.hash,onHover:N},e.hash))})]}),j?s.jsxs("div",{className:"hidden sm:grid sm:grid-cols-[280px_minmax(400px,1fr)] flex-1 overflow-hidden sm:min-w-[700px]",children:[s.jsx("div",{className:"overflow-y-auto border-r border-border-subtle",children:s.jsx("div",{className:"p-2",children:f.map(e=>s.jsx(H,{node:e,isHovered:c===e.hash,onHover:N},e.hash))})}),s.jsx("div",{className:"overflow-hidden p-2",children:s.jsx(C,{nodes:f,hoveredHash:c,onHover:N})})]}):s.jsx("div",{className:"hidden sm:block flex-1 overflow-y-auto",children:s.jsx("div",{className:"p-2",children:f.map(e=>s.jsx(H,{node:e,isHovered:c===e.hash,onHover:N},e.hash))})})]})]}):null});export{M as C}; diff --git a/frontend/dist/assets/Configuration-BOsliPZn.js b/frontend/dist/assets/Configuration-BOsliPZn.js deleted file mode 100644 index 946cbe9d..00000000 --- a/frontend/dist/assets/Configuration-BOsliPZn.js +++ /dev/null @@ -1 +0,0 @@ -import{r as e,j as t,bC as s,aZ as a,X as r,aq as l,$ as n,bD as c,be as i,p as o,B as d,bE as u,C as m,E as x,bF as p,aL as b,bG as h,bH as g,bI as y,bJ as f,az as j,bK as v,at as N,am as w,a0 as k,ap as C,bL as S}from"./vendor-react-C341c8YC.js";import{n as _}from"./recharts-6XUQYgRA.js";import{aF as T,ae as F,aG as E,aH as L,aI as P,a1 as R,aJ as D,aK as I,aD as M}from"./index-BJEgt3tp.js";import{C as A}from"./ConfirmModal-CYXFGX_W.js";import{l as z}from"./font-loader-jlbdh9Fw.js";import{N as O}from"./NodeInformationCard-CEW2bogB.js";import{a as K,P as q,b as H}from"./PageLayout-CnF5SScd.js";import{C as $}from"./Card-2pQSGkKC.js";import{R as Y,C as B}from"./Grid-BOO-7ObJ.js";import"./vendor-core-WoOfkQwm.js";import"./deckgl-DTsmDcfs.js";import"./DataBox-CRX76VsB.js";async function V(e){return T("/api/update_web_config",{method:"POST",body:JSON.stringify(e)})}const J=e.memo(function(){const{theme:e}=F(),{colorScheme:s}=e,a=E.find(e=>e.colorScheme===s)??E[0],r=a.displaySize,l=`clamp(${.8*r}rem, ${.6*r}rem + 1.5vw, ${1.4*r}rem)`;return t.jsx("div",{className:"h-10 flex items-center justify-center",children:t.jsxs("span",{className:"font-medium transition-all duration-300 leading-none text-center",style:{fontFamily:a.displayFont,color:a.displayColor,fontSize:l,fontOpticalSizing:"auto",letterSpacing:"-0.03em"},children:["Theme: ",a.displayName]})})}),U=e.memo(function(){const{theme:s,setThemePreset:a,setBrightness:r}=F(),{colorScheme:l,brightness:n}=s,[c,i]=e.useState(!1),[o,d]=e.useState(!1),u=e.useRef(null),m=e.useRef(null),x=(E.find(e=>e.colorScheme===l)??E[0]).id,p=e.useCallback((e,t)=>{if(!m.current)return n;const s=(m.current.y-e)/(t?200:80)*100;return Math.round(Math.max(0,Math.min(100,m.current.brightness+s)))},[n]),b=e.useCallback(e=>{a(e),i(!0)},[a]),h=e.useCallback(e=>{r(e)},[r]),g=e.useCallback(e=>{const t=E.find(t=>t.id===e);t&&L(t.backgroundImage)},[]);return t.jsx("div",{className:"grid grid-cols-4 gap-[3%] w-full",children:E.map(e=>{const s=x===e.id,a=!e.backgroundImage,r=s&&!a&&(c||o);return t.jsxs("div",{ref:s?u:void 0,title:e.displayName,className:_("flex flex-col items-stretch rounded-sm transition-all duration-300 ease-out overflow-hidden",s?"ring-2 ring-accent-primary scale-105 "+(a?"cursor-pointer":"cursor-ns-resize"):"cursor-pointer"),onMouseEnter:()=>{s&&!a?i(!0):s||g(e.id)},onMouseLeave:()=>!o&&i(!1),onClick:()=>!s&&b(e.id),onTouchStart:e=>{if(!s||a)return;e.preventDefault();const t=e.touches[0];m.current={y:t.clientY,brightness:n},d(!0),i(!0);const r=e=>{e.preventDefault();const t=e.touches[0];h(p(t.clientY,!0))},l=()=>{document.removeEventListener("touchmove",r),document.removeEventListener("touchend",l),m.current=null,d(!1),setTimeout(()=>i(!1),1500)};document.addEventListener("touchmove",r,{passive:!1}),document.addEventListener("touchend",l)},onMouseDown:e=>{if(!s||a)return;e.preventDefault(),m.current={y:e.clientY,brightness:n},d(!0),i(!0);const t=e=>{h(p(e.clientY,!1))},r=()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",r),m.current=null,d(!1)};document.addEventListener("mousemove",t),document.addEventListener("mouseup",r)},children:[t.jsxs("div",{className:"glass-thumbnail w-full aspect-square sm:aspect-[4/3] lg:aspect-video relative !rounded-b-none",children:["kde breeze"===e.id?t.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-[#242627]",style:{opacity:r?.4:1},children:t.jsx("span",{className:"text-[#58b99d] text-[1.5em] font-bold font-mono",children:">"})}):"ribbon"===e.id?t.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-[#F5F5F5]",style:{opacity:r?.4:1},children:t.jsx("span",{className:"text-[#2D2D2D] text-[1.5em] font-bold font-mono",children:"R"})}):t.jsx("div",{className:"absolute bg-cover bg-center transition-opacity duration-200",style:{inset:0,backgroundImage:`url(${e.backgroundImage})`,opacity:r?.4:1,filter:"brightness(var(--thumbnail-brightness, 1.5))"}}),s&&t.jsxs("div",{className:_("absolute inset-0 transition-opacity duration-200",r?"opacity-100":"opacity-0"),children:[t.jsx("div",{className:"absolute inset-x-0 bottom-0 bg-black/70 transition-all duration-100 ease-out",style:{height:100-n+"%"}}),t.jsx("div",{className:"absolute inset-x-[8%] h-0.5 bg-white rounded-full shadow-lg transition-all duration-100 ease-out",style:{top:100-n+"%"}}),t.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:t.jsxs("span",{className:"text-[0.6em] font-mono font-bold text-white drop-shadow-lg",children:[n,"%"]})})]})]}),t.jsx("div",{className:"flex flex-col w-full",children:e.paletteColors.map((e,s)=>t.jsx("div",{className:"flex",children:e.map((e,s)=>t.jsx("div",{className:"flex-1 aspect-[2/1]",style:{backgroundColor:e}},s))},s))})]},e.id)})})}),G=e.memo(function({layout:s="horizontal"}){return e.useEffect(()=>{z()},[]),"logo-only"===s?t.jsx(J,{}):"thumbnails-only"===s?t.jsx(U,{}):t.jsxs("div",{className:"flex flex-col items-center gap-3",children:[t.jsx(J,{}),t.jsx(U,{})]})});function X(){const{latitude:o,longitude:d,enabled:u,setLocation:m,enable:x,disable:p,clear:b}=P(),[h,g]=e.useState(!1),[y,f]=e.useState(""),[j,v]=e.useState(""),[N,w]=e.useState("idle"),[k,C]=e.useState(null),S=e.useRef(null),T=e.useRef(null),F=e.useRef(!0);e.useEffect(()=>(F.current=!0,()=>{F.current=!1,T.current&&clearTimeout(T.current)}),[]);const E=()=>{g(!1),C(null)};e.useEffect(()=>{if(!h)return;const e=e=>{"loading"!==N&&S.current&&!S.current.contains(e.target)&&E()};return document.addEventListener("mouseup",e),()=>document.removeEventListener("mouseup",e)},[h,N]);const L=null!==o&&null!==d;return t.jsx(K,{children:t.jsxs("div",{ref:S,children:[t.jsxs("div",{className:"flex items-center justify-between mb-4",children:[t.jsx($,{icon:t.jsx(s,{}),title:"Stealth",largeTitle:!0}),t.jsxs("div",{className:"flex items-center gap-1",children:[L&&!h&&t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:()=>{u?p():x()},className:_("relative inline-flex h-6 w-11 items-center rounded-full transition-colors border-2 mr-2",u?"bg-toggle-on border-toggle-on":"bg-toggle-off border-border-subtle"),title:u?"Disable stealth location":"Enable stealth location",children:t.jsx("span",{className:_("inline-block h-4 w-4 transform rounded-full bg-white transition-transform shadow-lg",u?"translate-x-5":"translate-x-0.5")})}),t.jsx("button",{onClick:()=>{b(),g(!1)},className:"p-2 rounded-lg transition-colors text-text-muted hover:text-accent-danger hover:bg-accent-danger/10",title:"Clear stealth location",children:t.jsx(a,{className:"w-4 h-4"})})]}),h?t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:E,disabled:"loading"===N,className:_("p-2 rounded-lg transition-colors","loading"===N?"text-text-muted cursor-not-allowed":"text-text-muted hover:text-accent-danger hover:bg-accent-danger/10"),title:"Cancel",children:t.jsx(r,{className:"w-4 h-4"})}),t.jsx("button",{onClick:()=>{if("loading"===N)return;T.current&&clearTimeout(T.current);const e=((e,t)=>{const s=parseFloat(e),a=parseFloat(t);return isNaN(s)||isNaN(a)?"Please enter valid numbers":s<-90||s>90?"Latitude must be between -90 and 90":a<-180||a>180?"Longitude must be between -180 and 180":0===s&&0===a?"Coordinates (0, 0) are invalid":null})(y,j);if(e)return void C(e);w("loading"),C(null);const t=parseFloat(y),s=parseFloat(j);m(t,s),u||x(),w("success"),T.current=setTimeout(()=>{F.current&&(w("idle"),g(!1))},1e3)},disabled:"loading"===N,className:_("p-2 rounded-lg transition-colors","loading"===N?"text-accent-primary cursor-wait":"success"===N?"text-accent-success":"error"===N?"text-accent-danger":"text-accent-success hover:bg-accent-success/10"),title:"Save",children:"loading"===N?t.jsx(l,{className:"w-4 h-4 animate-spin"}):"success"===N?t.jsx(n,{className:"w-4 h-4"}):"error"===N?t.jsx(r,{className:"w-4 h-4"}):t.jsx(n,{className:"w-4 h-4"})})]}):t.jsx("button",{onClick:()=>{f((null==o?void 0:o.toFixed(6))??""),v((null==d?void 0:d.toFixed(6))??""),C(null),g(!0)},className:"p-2 rounded-lg transition-colors text-text-muted hover:text-text-primary hover:bg-bg-subtle",title:L?"Edit stealth location":"Set stealth location",children:t.jsx(c,{className:"w-4 h-4"})})]})]}),t.jsx("div",{className:"bg-accent-tertiary/5 rounded-xl p-3 mb-4",children:t.jsxs("div",{className:"flex gap-2",children:[t.jsx(i,{className:"w-4 h-4 text-accent-tertiary flex-shrink-0 mt-0.5"}),t.jsxs("p",{className:"type-body-sm text-text-muted",children:[t.jsx("span",{className:"text-text-secondary",children:"Stealth mode"})," allows you to appear on the map and in topology analysis without broadcasting your location. Coordinates are stored locally in your browser only — ",t.jsx("span",{className:"text-accent-tertiary",children:"never sent to config.yaml or the mesh"}),"."]})]})}),k&&t.jsx("div",{className:"text-xs mb-3 px-2 py-1.5 rounded-md text-accent-danger bg-accent-danger/10",children:k}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:h?"Latitude (°)":"Latitude"}),t.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors",h?"bg-white/5":"bg-white/[0.02]"),children:h?t.jsx("input",{type:"number",value:y,onChange:e=>f(e.target.value),step:"0.000001",min:"-90",max:"90",placeholder:"e.g. 34.052234",className:"w-full bg-transparent text-text-primary focus:outline-none type-data placeholder:text-text-muted/50"}):t.jsx("span",{className:_("type-data",L&&u?"text-text-primary":"text-text-muted"),children:L?o.toFixed(6):"Not set"})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:h?"Longitude (°)":"Longitude"}),t.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors",h?"bg-white/5":"bg-white/[0.02]"),children:h?t.jsx("input",{type:"number",value:j,onChange:e=>v(e.target.value),step:"0.000001",min:"-180",max:"180",placeholder:"e.g. -118.243685",className:"w-full bg-transparent text-text-primary focus:outline-none type-data placeholder:text-text-muted/50"}):t.jsx("span",{className:_("type-data",L&&u?"text-text-primary":"text-text-muted"),children:L?d.toFixed(6):"Not set"})})]})]}),L&&!h&&t.jsx("div",{className:"mt-3 pt-3 border-t border-border-subtle",children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:_("w-2 h-2 rounded-full",u?"bg-accent-success":"bg-text-muted")}),t.jsx("span",{className:"type-body-sm text-text-muted",children:u?"Stealth location active — you appear on maps with these coordinates":"Stealth location disabled — coordinates saved but not in use"})]})})]})})}const W=[{value:7.8,label:"7.8 kHz"},{value:10.4,label:"10.4 kHz"},{value:15.6,label:"15.6 kHz"},{value:20.8,label:"20.8 kHz"},{value:31.25,label:"31.25 kHz"},{value:41.7,label:"41.7 kHz"},{value:62.5,label:"62.5 kHz"},{value:125,label:"125 kHz"},{value:250,label:"250 kHz"},{value:500,label:"500 kHz"}],Z=[5,6,7,8,9,10,11,12],Q=[{value:5,label:"4/5"},{value:6,label:"4/6"},{value:7,label:"4/7"},{value:8,label:"4/8"}],ee="radioConfig",te="repeaterSettings",se="operatingMode";function ae({node:e,level:s,expandedKeys:a,selectedKeyId:r,globalFloodPolicy:l,onSelect:n,onToggle:c}){const i=a.has(e.id),o=r===e.id,d=e.children&&e.children.length>0,u="allow"===l;return t.jsxs("div",{children:[t.jsxs("div",{className:_("flex items-center gap-2 h-[36px] px-3 rounded-full cursor-pointer transition-colors",o?"bg-accent-primary/15":"hover:bg-subtle-fill",u&&"opacity-50 cursor-not-allowed"),style:{marginLeft:16*s+"px"},onClick:()=>!u&&n(e.id),children:[d?t.jsx("button",{onClick:t=>{t.stopPropagation(),c(e.id)},className:"p-1 hover:bg-subtle-fill-hover rounded-full transition-colors",children:t.jsx(C,{className:_("w-3.5 h-3.5 text-text-muted transition-transform",i&&"rotate-90")})}):t.jsx("span",{className:"w-5"}),t.jsx(S,{className:"w-4 h-4 text-accent-primary flex-shrink-0"}),t.jsx("span",{className:"type-data text-text-primary flex-1 truncate",children:e.name}),t.jsx("span",{className:_("type-data-xs px-2 py-0.5 rounded-full","allow"===e.floodPolicy?"bg-accent-success/15 text-accent-success":"bg-accent-danger/15 text-accent-danger"),children:"allow"===e.floodPolicy?"Allow":"Deny"})]}),d&&i&&t.jsx("div",{children:e.children.map(e=>t.jsx(ae,{node:e,level:s+1,expandedKeys:a,selectedKeyId:r,globalFloodPolicy:l,onSelect:n,onToggle:c},e.id))})]})}function re(){var s,C,S,F,E,L;const{stats:P,setMode:z,clearModeMutation:J,setDutyCycleConfig:U,clearDutyCycleMutation:re,fetchStats:le,startMutation:ne,clearMutation:ce}=R(),ie=null==(s=null==P?void 0:P.config)?void 0:s.radio,oe=null==(C=null==P?void 0:P.config)?void 0:C.repeater,de=null==(S=null==P?void 0:P.config)?void 0:S.duty_cycle,ue=(null==P?void 0:P.node_name)||(null==(F=null==P?void 0:P.config)?void 0:F.node_name)||"Unknown Node",me=(null==oe?void 0:oe.mode)??"forward",xe=(null==de?void 0:de.enforcement_enabled)??!1,pe=null==(E=null==P?void 0:P.config)?void 0:E.delays,[be,he]=e.useState(!1),[ge,ye]=e.useState(""),[fe,je]=e.useState(62.5),[ve,Ne]=e.useState(7),[we,ke]=e.useState(5),[Ce,Se]=e.useState(""),[_e,Te]=e.useState("idle"),[Fe,Ee]=e.useState(null),Le=e.useRef(null),Pe=e.useRef(null),[Re,De]=e.useState(!1),[Ie,Me]=e.useState(""),[Ae,ze]=e.useState(""),[Oe,Ke]=e.useState(""),[qe,He]=e.useState("idle"),$e=e.useRef(null),Ye=e.useRef(null),[Be,Ve]=e.useState(!1),[Je,Ue]=e.useState(""),[Ge,Xe]=e.useState(""),[We,Ze]=e.useState(""),[Qe,et]=e.useState(""),[tt,st]=e.useState("idle"),[at,rt]=e.useState(null),lt=e.useRef(null),nt=e.useRef(null),[ct,it]=e.useState("idle"),[ot,dt]=e.useState("idle"),[ut,mt]=e.useState(null),[xt,pt]=e.useState(null),bt=e.useRef(!0),ht=e.useRef(null),gt=e.useRef(null),yt=e.useRef(null),ft=e.useRef(null),jt=e.useRef(!1),vt=e.useRef(!1);e.useEffect(()=>(bt.current=!0,()=>{bt.current=!1,ht.current&&clearTimeout(ht.current),gt.current&&clearTimeout(gt.current),yt.current&&clearTimeout(yt.current),ft.current&&clearTimeout(ft.current),_t.current&&clearTimeout(_t.current),Tt.current&&clearTimeout(Tt.current),Pe.current&&clearTimeout(Pe.current),$e.current&&clearTimeout($e.current),nt.current&&clearTimeout(nt.current)}),[]),e.useEffect(()=>{const e=e=>{if(be||Be||Re)return e.preventDefault(),e.returnValue="You have unsaved changes. Are you sure you want to leave?",e.returnValue};return window.addEventListener("beforeunload",e),()=>window.removeEventListener("beforeunload",e)},[be,Be,Re]);const Nt=null==(L=null==P?void 0:P.config)?void 0:L.web,[wt,kt]=e.useState("idle"),[Ct,St]=e.useState(null),_t=e.useRef(null),Tt=e.useRef(null),Ft=e.useRef(!1),[Et,Lt]=e.useState([]),[Pt,Rt]=e.useState(!1),[Dt,It]=e.useState(null),[Mt,At]=e.useState(!1),[zt,Ot]=e.useState(""),[Kt,qt]=e.useState(null),[Ht,$t]=e.useState(!1),[Yt,Bt]=e.useState(null),[Vt,Jt]=e.useState(!1),[Ut,Gt]=e.useState(!1),[Xt,Wt]=e.useState(!1),[Zt,Qt]=e.useState([]),[es,ts]=e.useState(!1),[ss,as]=e.useState(null),[rs,ls]=e.useState("deny"),[ns,cs]=e.useState(!1),[is,os]=e.useState(null),[ds,us]=e.useState(new Set),[ms,xs]=e.useState(!1),[ps,bs]=e.useState(!1),[hs,gs]=e.useState(!1),[ys,fs]=e.useState(null),[js,vs]=e.useState(null),[Ns,ws]=e.useState(""),[ks,Cs]=e.useState("deny"),[Ss,_s]=e.useState(!1),[Ts,Fs]=e.useState(!0),[Es,Ls]=e.useState(!1),[Ps,Rs]=e.useState(!0),[Ds,Is]=e.useState("idle"),[Ms,As]=e.useState(!1),[zs,Os]=e.useState(!1),Ks=e.useRef(!1);e.useEffect(()=>{const e=be&&!Ks.current;Ks.current=be,ie&&e&&(ye((ie.frequency/1e6).toFixed(3)),je(ie.bandwidth/1e3),Ne(ie.spreading_factor),ke(ie.coding_rate),Se(String(ie.tx_power)))},[ie,be]);const qs=e.useMemo(()=>{if(!ie||!be)return!1;const e=ie.frequency/1e6,t=ie.bandwidth/1e3,s=parseFloat(ge)||0;return Math.abs(s-e)>1e-4||fe!==t||ve!==ie.spreading_factor||we!==ie.coding_rate||parseInt(Ce)!==ie.tx_power},[ie,be,ge,fe,ve,we,Ce]),Hs=e.useCallback(()=>{he(!1),Ee(null),ie&&(ye((ie.frequency/1e6).toFixed(3)),je(ie.bandwidth/1e3),Ne(ie.spreading_factor),ke(ie.coding_rate),Se(String(ie.tx_power)))},[ie]);e.useEffect(()=>{if(!be)return;const e=e=>{"loading"!==_e&&Le.current&&!Le.current.contains(e.target)&&Hs()};return document.addEventListener("mouseup",e),()=>{document.removeEventListener("mouseup",e)}},[be,Hs,_e]);const $s=e.useCallback(()=>{const e=null==pe?void 0:pe.tx_delay_factor;return e&&"object"==typeof e&&"parsedValue"in e?e.parsedValue??1:"number"==typeof e?e:1},[pe]),Ys=e.useCallback(()=>{const e=null==pe?void 0:pe.direct_tx_delay_factor;return"number"==typeof e?e:.5},[pe]),Bs=e.useCallback(()=>{const e=null==de?void 0:de.max_airtime_percent;return"number"==typeof e?e:e&&"object"==typeof e&&"parsedValue"in e?e.parsedValue??6:6},[de]),Vs=e.useCallback(()=>{Me($s().toFixed(2)),ze(Ys().toFixed(2)),Ke(Bs().toFixed(1)),De(!0)},[$s,Ys,Bs]),Js=e.useCallback(()=>{De(!1)},[]);e.useEffect(()=>{if(!Re)return;const e=e=>{"loading"!==qe&&Ye.current&&!Ye.current.contains(e.target)&&Js()};return document.addEventListener("mouseup",e),()=>document.removeEventListener("mouseup",e)},[Re,Js,qe]);const Us=e.useCallback(()=>{var e,t,s;Ue(ue),Xe((null==(e=null==oe?void 0:oe.latitude)?void 0:e.toString())||"0"),Ze((null==(t=null==oe?void 0:oe.longitude)?void 0:t.toString())||"0"),et((null==(s=null==oe?void 0:oe.send_advert_interval_hours)?void 0:s.toString())||"0"),rt(null),Ve(!0)},[ue,oe]),Gs=e.useCallback(()=>{Ve(!1),rt(null)},[]);e.useEffect(()=>{if(!Be)return;const e=e=>{"loading"!==tt&<.current&&!lt.current.contains(e.target)&&Gs()};return document.addEventListener("mouseup",e),()=>document.removeEventListener("mouseup",e)},[Be,Gs,tt]);const Xs=async()=>{var e;if("loading"===wt)return;const t=(null==Nt?void 0:Nt.cors_enabled)??!1,s=!t,a=t;_t.current&&clearTimeout(_t.current),Tt.current&&clearTimeout(Tt.current),Ft.current=!1,St(s),kt("loading"),_t.current=setTimeout(()=>{Ft.current||bt.current&&(St(a),kt("error"),Tt.current=setTimeout(()=>{bt.current&&(kt("idle"),St(null))},2e3))},1e4);try{const t=await V({web:{cors_enabled:s}});if(Ft.current=!0,_t.current&&clearTimeout(_t.current),!bt.current)return;t.success||(null==(e=t.data)?void 0:e.persisted)?(await le(),kt("success"),Tt.current=setTimeout(()=>{bt.current&&(kt("idle"),St(null))},2e3)):(St(a),kt("error"),Tt.current=setTimeout(()=>{bt.current&&(kt("idle"),St(null))},2e3))}catch{if(Ft.current=!0,_t.current&&clearTimeout(_t.current),!bt.current)return;St(a),kt("error"),Tt.current=setTimeout(()=>{bt.current&&(kt("idle"),St(null))},2e3)}};e.useEffect(()=>{(async()=>{Rs(!0);try{const e=await async function(){return T("/api/check_pymc_console")}();e.success&&e.data?Ls(e.data.exists):Ls(!1);const t=null==Nt?void 0:Nt.web_path;Fs(!t||""===t)}catch{Ls(!1)}finally{Rs(!1)}})()},[null==Nt?void 0:Nt.web_path]);const Ws=async e=>{var t;if("loading"!==Ds){Is("loading");try{const s=await V({web:{web_path:e?null:"/opt/pymc_console/web/html"}});if(!bt.current)return;s.success||(null==(t=s.data)?void 0:t.persisted)?(Fs(e),Is("success"),As(!0),setTimeout(()=>{bt.current&&Is("idle")},2e3)):(Is("error"),setTimeout(()=>{bt.current&&Is("idle")},2e3))}catch{if(!bt.current)return;Is("error"),setTimeout(()=>{bt.current&&Is("idle")},2e3)}}},Zs=e.useCallback(async()=>{Rt(!0),It(null);try{const e=await async function(){return T("/auth/tokens")}();Lt(e.tokens||[])}catch(e){It(e instanceof Error?e.message:"Failed to fetch tokens")}finally{Rt(!1)}},[]);e.useEffect(()=>{Zs()},[Zs]);const Qs=async()=>{if(zt.trim()){Jt(!0),It(null);try{const e=await async function(e){return T("/auth/tokens",{method:"POST",body:JSON.stringify({name:e})})}(zt.trim());qt(e.token||null),At(!1),$t(!0),Ot(""),await Zs()}catch(e){It(e instanceof Error?e.message:"Failed to create token")}finally{Jt(!1)}}else It("Token name is required")},ea=e=>e?new Date(1e3*e).toLocaleString():"Never",ta=e.useCallback(e=>{const t=new Map,s=[];return e.forEach(e=>{const s={id:e.id,name:e.name,floodPolicy:e.flood_policy,transport_key:e.transport_key,last_used:e.last_used,parent_id:e.parent_id,children:[]};t.set(e.id,s)}),t.forEach(e=>{e.parent_id&&t.has(e.parent_id)?t.get(e.parent_id).children.push(e):s.push(e)}),s},[]),sa=e.useCallback(async()=>{ts(!0),as(null);try{const e=await async function(){return T("/api/transport_keys")}();e.success&&e.data?Qt(ta(e.data)):as(e.error||"Failed to load transport keys")}catch(e){as(e instanceof Error?e.message:"Unknown error occurred")}finally{ts(!1)}},[ta]);e.useEffect(()=>{sa()},[sa]);const aa=e.useCallback((e,t)=>{for(const s of e){if(s.id===t)return s;if(s.children){const e=aa(s.children,t);if(e)return e}}return null},[]),ra=e.useCallback(()=>{if(!is)return;const e=aa(Zt,is);return null==e?void 0:e.name},[is,Zt,aa]),la=e.useCallback(e=>{us(t=>{const s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},[]),na=async e=>{cs(!0),as(null);try{const t=await async function(e){return T("/api/global_flood_policy",{method:"POST",body:JSON.stringify({global_flood_allow:e})})}("allow"===e);t.success?ls(e):as(t.error||"Failed to update global flood policy")}catch(t){as(t instanceof Error?t.message:"Failed to update global flood policy")}finally{cs(!1)}},ca=async()=>{if(Ns.trim()){_s(!0),as(null);try{const e=await async function(e){return T("/api/transport_keys",{method:"POST",body:JSON.stringify(e)})}({name:Ns.trim(),flood_policy:ks,parent_id:is??void 0});e.success?(await sa(),xs(!1),ws(""),Cs("deny")):as(e.error||"Failed to add transport key")}catch(e){as(e instanceof Error?e.message:"Failed to add transport key")}finally{_s(!1)}}else as("Key name is required")},ia=e.useCallback(()=>{if(!is)return;const e=aa(Zt,is);e&&(fs({...e}),bs(!0))},[is,Zt,aa]);e.useEffect(()=>{const e=e=>{"Escape"===e.key&&(ms&&(xs(!1),ws(""),Cs("deny")),ps&&(bs(!1),fs(null)),hs&&(gs(!1),vs(null)),Mt&&(At(!1),Ot("")),Ht&&($t(!1),qt(null)))};if(ms||ps||hs||Mt||Ht)return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[ms,ps,hs,Mt,Ht]);const oa=e.useCallback(()=>{if(!is)return;const e=aa(Zt,is);e&&(vs(e),gs(!0))},[is,Zt,aa]);return t.jsxs(q,{children:[t.jsx(H,{title:"Configuration",icon:t.jsx(o,{})}),t.jsxs(Y,{template:"standard",children:[t.jsx(B,{span:12,md:6,children:t.jsx(K,{children:t.jsxs("div",{ref:lt,children:[t.jsxs("div",{className:"flex items-center justify-between mb-4",children:[t.jsxs("h2",{className:"type-subheading text-text-primary flex items-center gap-2",children:[t.jsx(d,{className:"icon-md text-accent-primary"}),"Repeater Settings"]}),t.jsx("div",{className:"flex items-center gap-1",children:oe&&(Be?t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:Gs,disabled:"loading"===tt,className:_("p-2 rounded-lg transition-colors","loading"===tt?"text-text-muted cursor-not-allowed":"text-text-muted hover:text-accent-danger hover:bg-accent-danger/10"),title:"Cancel",children:t.jsx(r,{className:"w-4 h-4"})}),t.jsx("button",{onClick:async()=>{if("loading"!==tt){nt.current&&clearTimeout(nt.current),ne(te),st("loading"),rt(null);try{const e={};Je&&Je!==ue&&(e.node_name=Je);const t=parseFloat(Ge);isNaN(t)||t===(null==oe?void 0:oe.latitude)||(e.latitude=t);const s=parseFloat(We);isNaN(s)||s===(null==oe?void 0:oe.longitude)||(e.longitude=s);const a=parseInt(Qe);if(isNaN(a)||a===(null==oe?void 0:oe.send_advert_interval_hours)||(e.flood_advert_interval_hours=a),0===Object.keys(e).length)return rt({success:!0,message:"No changes to save"}),st("idle"),void ce(te);const r=await M(e);if(!bt.current)return void ce(te);if(r.success&&r.data){const e=r.data.applied.join(", ");rt({success:!0,message:`Updated: ${e}`}),await le({force:!0}),st("success"),nt.current=setTimeout(()=>{bt.current&&(st("idle"),Ve(!1),rt(null),ce(te))},1500)}else rt({success:!1,message:r.error||"Failed to save"}),st("error"),ce(te),nt.current=setTimeout(()=>{bt.current&&st("idle")},2e3)}catch(e){if(!bt.current)return void ce(te);rt({success:!1,message:String(e)}),st("error"),ce(te),nt.current=setTimeout(()=>{bt.current&&st("idle")},2e3)}}},disabled:"loading"===tt,className:_("p-2 rounded-lg transition-colors","loading"===tt?"text-accent-primary cursor-wait":"success"===tt?"text-accent-success":"error"===tt?"text-accent-danger":"text-accent-success hover:bg-accent-success/10"),title:"Save changes",children:"loading"===tt?t.jsx(l,{className:"w-4 h-4 animate-spin"}):"success"===tt?t.jsx(n,{className:"w-4 h-4"}):"error"===tt?t.jsx(r,{className:"w-4 h-4"}):t.jsx(n,{className:"w-4 h-4"})})]}):t.jsx("button",{onClick:Us,className:"p-2 rounded-lg transition-colors text-text-muted hover:text-text-primary hover:bg-bg-subtle",title:"Edit repeater settings",children:t.jsx(c,{className:"w-4 h-4"})}))})]}),at&&t.jsx("div",{className:_("text-xs mb-3 px-2 py-1.5 rounded-md",at.success?"text-accent-success bg-accent-success/10":"text-accent-danger bg-accent-danger/10"),children:at.message}),oe?t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"col-span-2",children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:"Node Name"}),t.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors",Be?"bg-subtle-fill-hover":"bg-subtle-fill"),children:Be?t.jsx("input",{type:"text",value:Je,onChange:e=>Ue(e.target.value),maxLength:50,className:"w-full bg-transparent text-text-primary focus:outline-none type-data",placeholder:"Enter node name"}):t.jsx("span",{className:"type-data text-text-primary",children:ue})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:Be?"Latitude (°)":"Latitude"}),t.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors",Be?"bg-subtle-fill-hover":"bg-subtle-fill"),children:Be?t.jsx("input",{type:"number",value:Ge,onChange:e=>Xe(e.target.value),step:"0.000001",min:"-90",max:"90",className:"w-full bg-transparent text-text-primary focus:outline-none type-data"}):t.jsx("span",{className:"type-data text-text-primary",children:0!==oe.latitude?oe.latitude.toFixed(6):"Not set"})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:Be?"Longitude (°)":"Longitude"}),t.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors",Be?"bg-subtle-fill-hover":"bg-subtle-fill"),children:Be?t.jsx("input",{type:"number",value:We,onChange:e=>Ze(e.target.value),step:"0.000001",min:"-180",max:"180",className:"w-full bg-transparent text-text-primary focus:outline-none type-data"}):t.jsx("span",{className:"type-data text-text-primary",children:0!==oe.longitude?oe.longitude.toFixed(6):"Not set"})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:Be?"Advert Interval (hours)":"Advert Interval"}),t.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors",Be?"bg-subtle-fill-hover":"bg-subtle-fill"),children:Be?t.jsx("input",{type:"number",value:Qe,onChange:e=>et(e.target.value),min:"0",max:"48",className:"w-full bg-transparent text-text-primary focus:outline-none type-data"}):t.jsx("span",{className:"type-data text-text-primary",children:oe.send_advert_interval_hours>0?`${oe.send_advert_interval_hours}h`:"Disabled"})}),Be&&t.jsx("p",{className:"type-data-xs text-text-muted mt-1 ml-4",children:"0 = disabled, 3-48 hours"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:"Score-based TX"}),t.jsx("div",{className:"h-[38px] rounded-full px-4 flex items-center bg-subtle-fill",children:t.jsx("span",{className:"type-data text-text-primary",children:oe.use_score_for_tx?"Enabled":"Disabled"})})]})]}):t.jsx("p",{className:"text-text-muted",children:"Loading repeater settings..."})]})})}),t.jsx(B,{span:12,md:6,children:t.jsx(K,{children:t.jsxs("div",{ref:Le,children:[t.jsxs("div",{className:"flex items-center justify-between mb-4",children:[t.jsxs("h2",{className:"type-subheading text-text-primary flex items-center gap-2",children:[t.jsx(u,{className:"icon-md text-accent-primary"}),"Radio Configuration"]}),t.jsx("div",{className:"flex items-center gap-1",children:ie&&(be?t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:Hs,disabled:"loading"===_e,className:_("p-2 rounded-lg transition-colors","loading"===_e?"text-text-muted cursor-not-allowed":"text-text-muted hover:text-accent-danger hover:bg-accent-danger/10"),title:"Cancel",children:t.jsx(r,{className:"w-4 h-4"})}),t.jsx("button",{onClick:async()=>{if("loading"!==_e){Pe.current&&clearTimeout(Pe.current),ne(ee),Te("loading"),Ee(null);try{const e={},t=parseFloat(ge),s=ie?ie.frequency/1e6:0;Math.abs(t-s)>1e-4&&(e.frequency_mhz=t);const a=ie?ie.bandwidth/1e3:0;fe!==a&&(e.bandwidth_khz=fe),ve!==(null==ie?void 0:ie.spreading_factor)&&(e.spreading_factor=ve),we!==(null==ie?void 0:ie.coding_rate)&&(e.coding_rate=we);const r=parseInt(Ce);if(r!==(null==ie?void 0:ie.tx_power)&&(e.tx_power=r),0===Object.keys(e).length)return Ee({success:!0,message:"No changes to save"}),Te("idle"),void ce(ee);const l=await M(e);if(!bt.current)return void ce(ee);if(l.success&&l.data){const e=l.data.applied.join(", "),t=l.data.live_update?" (applied live)":" (restart required)";Ee({success:!0,message:`Updated: ${e}${t}`}),await le({force:!0}),Te("success"),Pe.current=setTimeout(()=>{bt.current&&(Te("idle"),he(!1),Ee(null),ce(ee))},1500)}else Ee({success:!1,message:l.error||"Failed to save"}),Te("error"),ce(ee),Pe.current=setTimeout(()=>{bt.current&&Te("idle")},2e3)}catch(e){if(!bt.current)return void ce(ee);Ee({success:!1,message:String(e)}),Te("error"),ce(ee),Pe.current=setTimeout(()=>{bt.current&&Te("idle")},2e3)}}},disabled:"loading"===_e||!qs,className:_("p-2 rounded-lg transition-colors","loading"===_e?"text-accent-primary cursor-wait":"success"===_e?"text-accent-success":"error"===_e?"text-accent-danger":qs?"text-accent-success hover:bg-accent-success/10":"text-text-muted cursor-not-allowed"),title:qs?"Save changes":"No changes to save",children:"loading"===_e?t.jsx(l,{className:"w-4 h-4 animate-spin"}):"success"===_e?t.jsx(n,{className:"w-4 h-4"}):"error"===_e?t.jsx(r,{className:"w-4 h-4"}):t.jsx(n,{className:"w-4 h-4"})})]}):t.jsx("button",{onClick:()=>{ie&&(ye((ie.frequency/1e6).toFixed(3)),je(ie.bandwidth/1e3),Ne(ie.spreading_factor),ke(ie.coding_rate),Se(String(ie.tx_power))),Ee(null),he(!0)},className:"p-2 rounded-lg transition-colors text-text-muted hover:text-text-primary hover:bg-bg-subtle",title:"Edit radio settings",children:t.jsx(c,{className:"w-4 h-4"})}))})]}),Fe&&t.jsx("div",{className:_("text-xs mb-3 px-2 py-1.5 rounded-md",Fe.success?"text-accent-success bg-accent-success/10":"text-accent-danger bg-accent-danger/10"),children:Fe.message}),ie?t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:be?"Frequency (MHz)":"Frequency"}),t.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors",be?"bg-subtle-fill-hover":"bg-subtle-fill"),children:be?t.jsx("input",{type:"number",value:ge,onChange:e=>ye(e.target.value),step:"0.001",min:"400",max:"930",className:"w-full bg-transparent text-text-primary focus:outline-none type-data"}):t.jsx("span",{className:"type-data text-text-primary",children:D(ie.frequency)})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:be?"TX Power (dBm)":"TX Power"}),t.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors",be?"bg-subtle-fill-hover":"bg-subtle-fill"),children:be?t.jsx("input",{type:"number",value:Ce,onChange:e=>Se(e.target.value),min:"-9",max:"22",className:"w-full bg-transparent text-text-primary focus:outline-none type-data"}):t.jsxs("span",{className:"type-data text-text-primary",children:[ie.tx_power," dBm"]})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:"Bandwidth"}),t.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors relative",be?"bg-subtle-fill-hover":"bg-subtle-fill"),children:be?t.jsxs(t.Fragment,{children:[t.jsx("select",{value:fe,onChange:e=>je(parseFloat(e.target.value)),className:"w-full bg-transparent text-text-primary focus:outline-none appearance-none cursor-pointer type-data pr-6",children:W.map(e=>t.jsx("option",{value:e.value,children:e.label},e.value))}),t.jsx(m,{className:"absolute right-4 top-1/2 -translate-y-1/2 w-4 h-4 text-text-muted pointer-events-none"})]}):t.jsx("span",{className:"type-data text-text-primary",children:I(ie.bandwidth)})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:"Spreading Factor"}),t.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors relative",be?"bg-subtle-fill-hover":"bg-subtle-fill"),children:be?t.jsxs(t.Fragment,{children:[t.jsx("select",{value:ve,onChange:e=>Ne(parseInt(e.target.value)),className:"w-full bg-transparent text-text-primary focus:outline-none appearance-none cursor-pointer type-data pr-6",children:Z.map(e=>t.jsxs("option",{value:e,children:["SF",e]},e))}),t.jsx(m,{className:"absolute right-4 top-1/2 -translate-y-1/2 w-4 h-4 text-text-muted pointer-events-none"})]}):t.jsxs("span",{className:"type-data text-text-primary",children:["SF",ie.spreading_factor]})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:"Coding Rate"}),t.jsx("div",{className:_("h-[38px] rounded-full px-4 flex items-center transition-colors relative",be?"bg-subtle-fill-hover":"bg-subtle-fill"),children:be?t.jsxs(t.Fragment,{children:[t.jsx("select",{value:we,onChange:e=>ke(parseInt(e.target.value)),className:"w-full bg-transparent text-text-primary focus:outline-none appearance-none cursor-pointer type-data pr-6",children:Q.map(e=>t.jsx("option",{value:e.value,children:e.label},e.value))}),t.jsx(m,{className:"absolute right-4 top-1/2 -translate-y-1/2 w-4 h-4 text-text-muted pointer-events-none"})]}):t.jsxs("span",{className:"type-data text-text-primary",children:["4/",ie.coding_rate]})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:"Preamble"}),t.jsx("div",{className:"h-[38px] rounded-full px-4 flex items-center bg-subtle-fill",children:t.jsxs("span",{className:"type-data text-text-primary",children:[ie.preamble_length," symbols"]})})]})]}):t.jsx("p",{className:"text-text-muted",children:"Loading radio configuration..."})]})})})]}),t.jsxs(Y,{template:"standard",children:[t.jsx(B,{span:12,md:6,children:t.jsx(K,{children:t.jsxs("div",{ref:Ye,children:[t.jsxs("div",{className:"flex items-center justify-between mb-3",children:[t.jsxs("h2",{className:"type-subheading text-text-primary flex items-center gap-3",children:[t.jsx(x,{className:"icon-md text-icon-card-title"}),"Operating Mode"]}),t.jsx("div",{className:"flex items-center gap-1",children:Re?t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:async()=>{if("loading"!==qe){$e.current&&clearTimeout($e.current),ne(se),He("loading");try{const e=await M({tx_delay_factor:parseFloat(Ie),direct_tx_delay_factor:parseFloat(Ae)});if(await U({max_airtime_percent:parseFloat(Oe),enforcement_enabled:xe}),!bt.current)return void ce(se);e.success&&e.data?(await le({force:!0}),He("success"),$e.current=setTimeout(()=>{bt.current&&(He("idle"),De(!1),ce(se))},1500)):(He("error"),ce(se),$e.current=setTimeout(()=>{bt.current&&He("idle")},2e3))}catch{if(!bt.current)return void ce(se);He("error"),ce(se),$e.current=setTimeout(()=>{bt.current&&He("idle")},2e3)}}},disabled:"loading"===qe,className:_("p-2 rounded-lg transition-colors","loading"===qe?"text-accent-primary cursor-wait":"success"===qe?"text-accent-success":"error"===qe?"text-accent-danger":"text-accent-success hover:bg-accent-success/10"),title:"Save",children:"loading"===qe?t.jsx(l,{className:"w-4 h-4 animate-spin"}):"success"===qe?t.jsx(n,{className:"w-4 h-4"}):"error"===qe?t.jsx(r,{className:"w-4 h-4"}):t.jsx(n,{className:"w-4 h-4"})}),t.jsx("button",{onClick:Js,className:"p-2 rounded-lg text-text-muted hover:text-accent-danger hover:bg-accent-danger/10",title:"Cancel",children:t.jsx(r,{className:"w-4 h-4"})})]}):t.jsx("button",{onClick:Vs,className:"p-2 rounded-lg transition-colors text-text-muted hover:text-text-primary hover:bg-bg-subtle",title:"Edit settings",children:t.jsx(c,{className:"w-4 h-4"})})})]}),t.jsx("p",{className:"type-label text-text-muted mb-3",children:"Control how the repeater handles packets"}),t.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[t.jsxs("div",{className:"flex-1 space-y-4",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("label",{className:"type-label text-text-muted",children:"Repeat"}),t.jsx("div",{className:"flex items-center gap-2",children:(()=>{const e=null!==ut?ut:"forward"===me;return t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:async()=>{if("loading"===ct)return;const t=!e,s="forward"===me;ht.current&&clearTimeout(ht.current),gt.current&&clearTimeout(gt.current),jt.current=!1,mt(t),it("loading"),ht.current=setTimeout(()=>{jt.current||bt.current&&(mt(s),it("error"),gt.current=setTimeout(()=>{bt.current&&(it("idle"),mt(null))},2e3))},1e4);try{if(await z(t?"forward":"monitor"),jt.current=!0,ht.current&&clearTimeout(ht.current),!bt.current)return;it("success"),gt.current=setTimeout(()=>{bt.current&&(it("idle"),mt(null),J())},2e3)}catch{if(jt.current=!0,ht.current&&clearTimeout(ht.current),!bt.current)return;mt(s),it("error"),gt.current=setTimeout(()=>{bt.current&&(it("idle"),mt(null))},2e3)}},disabled:"loading"===ct,className:_("relative inline-flex h-6 w-11 items-center rounded-full transition-colors border-2",e?"bg-toggle-on border-toggle-on":"bg-toggle-off border-border-subtle","loading"===ct&&"opacity-70"),"aria-label":"Toggle forward mode",children:t.jsx("span",{className:_("inline-block h-4 w-4 transform rounded-full bg-white transition-transform shadow-lg",e?"translate-x-5":"translate-x-0.5")})}),t.jsx("span",{className:_("type-data text-sm w-7",e?"text-accent-success":"text-text-muted"),children:e?"On":"Off"}),"loading"===ct&&t.jsx(l,{className:"w-4 h-4 text-text-muted animate-spin"}),"success"===ct&&t.jsx(n,{className:"w-4 h-4 text-accent-success"}),"error"===ct&&t.jsx(r,{className:"w-4 h-4 text-accent-danger"})]})})()})]}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("label",{className:"type-label text-text-muted",children:"Duty Cycle"}),t.jsx("div",{className:"flex items-center gap-2",children:(()=>{const e=null!==xt?xt:xe;return t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:async()=>{if("loading"===ot)return;const t=!e,s=xe;yt.current&&clearTimeout(yt.current),ft.current&&clearTimeout(ft.current),vt.current=!1,pt(t),dt("loading"),yt.current=setTimeout(()=>{vt.current||bt.current&&(pt(s),dt("error"),ft.current=setTimeout(()=>{bt.current&&(dt("idle"),pt(null))},2e3))},1e4);try{if(await U({max_airtime_percent:Bs(),enforcement_enabled:t}),vt.current=!0,yt.current&&clearTimeout(yt.current),!bt.current)return;dt("success"),ft.current=setTimeout(()=>{bt.current&&(dt("idle"),pt(null),re())},2e3)}catch{if(vt.current=!0,yt.current&&clearTimeout(yt.current),!bt.current)return;pt(s),dt("error"),ft.current=setTimeout(()=>{bt.current&&(dt("idle"),pt(null))},2e3)}},disabled:"loading"===ot,className:_("relative inline-flex h-6 w-11 items-center rounded-full transition-colors border-2",e?"bg-toggle-on border-toggle-on":"bg-toggle-off border-border-subtle","loading"===ot&&"opacity-70"),"aria-label":"Toggle duty cycle",children:t.jsx("span",{className:_("inline-block h-4 w-4 transform rounded-full bg-white transition-transform shadow-lg",e?"translate-x-5":"translate-x-0.5")})}),t.jsx("span",{className:_("type-data text-sm w-7",e?"text-accent-success":"text-text-muted"),children:e?"On":"Off"}),"loading"===ot&&t.jsx(l,{className:"w-4 h-4 text-text-muted animate-spin"}),"success"===ot&&t.jsx(n,{className:"w-4 h-4 text-accent-success"}),"error"===ot&&t.jsx(r,{className:"w-4 h-4 text-accent-danger"})]})})()})]}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("label",{className:"type-label text-text-muted",children:"Max Airtime"}),t.jsx("div",{className:_("h-[32px] rounded-full px-3 flex items-center justify-end transition-colors min-w-[80px]",Re?"bg-subtle-fill-hover":"bg-subtle-fill"),children:Re?t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("input",{type:"number",value:Oe,onChange:e=>Ke(e.target.value),step:"0.5",min:"0.1",max:"100",className:"w-12 bg-transparent text-text-primary text-right focus:outline-none type-data"}),t.jsx("span",{className:"text-text-muted type-data",children:"%"})]}):t.jsxs("span",{className:"type-data text-text-primary",children:[Bs().toFixed(1),"%"]})})]})]}),t.jsx("div",{className:"hidden sm:block w-px bg-border-subtle"}),t.jsxs("div",{className:"flex-1 pt-4 sm:pt-0 border-t sm:border-t-0 border-border-subtle",children:[t.jsx("label",{className:"type-label text-text-muted block mb-3",children:"TX Delays"}),t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"type-label text-text-muted",children:"Flood"}),t.jsx("div",{className:_("h-[32px] rounded-full px-3 flex items-center justify-end transition-colors min-w-[80px]",Re?"bg-subtle-fill-hover":"bg-subtle-fill"),children:Re?t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("input",{type:"number",value:Ie,onChange:e=>Me(e.target.value),step:"0.1",min:"0",max:"5",className:"w-12 bg-transparent text-text-primary text-right focus:outline-none type-data"}),t.jsx("span",{className:"text-text-muted type-data",children:"x"})]}):t.jsxs("span",{className:"type-data text-text-primary",children:[$s().toFixed(2),"x"]})})]}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"type-label text-text-muted",children:"Direct"}),t.jsx("div",{className:_("h-[32px] rounded-full px-3 flex items-center justify-end transition-colors min-w-[80px]",Re?"bg-subtle-fill-hover":"bg-subtle-fill"),children:Re?t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("input",{type:"number",value:Ae,onChange:e=>ze(e.target.value),step:"0.1",min:"0",max:"5",className:"w-12 bg-transparent text-text-primary text-right focus:outline-none type-data"}),t.jsx("span",{className:"text-text-muted type-data",children:"s"})]}):t.jsxs("span",{className:"type-data text-text-primary",children:[Ys().toFixed(2),"s"]})})]})]})]})]})]})})}),t.jsx(B,{span:12,md:6,children:t.jsxs(K,{children:[t.jsx($,{icon:t.jsx(o,{}),title:"App Settings",largeTitle:!0}),t.jsx("p",{className:"type-body-sm text-text-muted mb-4",children:"Appearance and web server options."}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsxs("div",{children:[t.jsx("span",{className:"type-body text-text-primary font-medium block",children:"Enable CORS"}),t.jsx("span",{className:"type-body-sm text-text-muted",children:"Allow cross-origin API access"})]}),t.jsx("div",{className:"flex items-center gap-2",children:(()=>{const e=null!==Ct?Ct:(null==Nt?void 0:Nt.cors_enabled)??!1;return t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:Xs,disabled:"loading"===wt,className:_("relative inline-flex h-6 w-11 items-center rounded-full transition-colors border-2",e?"bg-toggle-on border-toggle-on":"bg-toggle-off border-border-subtle","loading"===wt&&"opacity-70"),title:e?"Disable CORS":"Enable CORS",children:t.jsx("span",{className:_("inline-block h-4 w-4 transform rounded-full bg-white transition-transform shadow-lg",e?"translate-x-5":"translate-x-0.5")})}),"loading"===wt&&t.jsx(l,{className:"w-4 h-4 text-text-muted animate-spin"}),"success"===wt&&t.jsx(n,{className:"w-4 h-4 text-accent-success"}),"error"===wt&&t.jsx(r,{className:"w-4 h-4 text-accent-danger"})]})})()})]}),t.jsx("div",{children:t.jsx(G,{})})]})]})})]}),t.jsx(Y,{template:"auto",children:t.jsxs(K,{children:[t.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 mb-4",children:[t.jsxs("div",{children:[t.jsxs("h2",{className:"type-heading text-text-primary flex items-center gap-2",children:[t.jsx(p,{className:"icon-md text-accent-primary"}),"Regions / Transport Keys"]}),t.jsx("p",{className:"type-body-sm text-text-muted mt-1",children:"Manage regional key hierarchy for flood control"})]}),t.jsxs("div",{className:"flex gap-2 flex-wrap",children:[t.jsxs("button",{onClick:()=>xs(!0),disabled:"allow"===rs,className:_("flex items-center gap-1.5 h-[32px] px-3 rounded-full transition-colors type-body-sm font-medium","allow"===rs?"bg-subtle-fill text-text-muted cursor-not-allowed":"bg-accent-success/10 hover:bg-accent-success/20 text-accent-success"),children:[t.jsx(b,{className:"w-3.5 h-3.5"}),"Add"]}),t.jsx("button",{onClick:ia,disabled:!is||"allow"===rs,className:_("h-[32px] px-3 rounded-full transition-colors type-body-sm font-medium",is&&"allow"!==rs?"bg-accent-primary/10 hover:bg-accent-primary/20 text-accent-primary":"bg-subtle-fill text-text-muted cursor-not-allowed"),children:"Edit"}),t.jsx("button",{onClick:oa,disabled:!is||"allow"===rs,className:_("h-[32px] px-3 rounded-full transition-colors type-body-sm font-medium",is&&"allow"!==rs?"bg-accent-danger/10 hover:bg-accent-danger/20 text-accent-danger":"bg-subtle-fill text-text-muted cursor-not-allowed"),children:"Delete"})]})]}),t.jsx("div",{className:"bg-subtle-fill rounded-2xl p-4 mb-4",children:t.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:_("w-10 h-10 rounded-full flex items-center justify-center","allow"===rs?"bg-accent-success/20":"bg-accent-danger/20"),children:"allow"===rs?t.jsx(h,{className:"w-5 h-5 text-accent-success"}):t.jsx(g,{className:"w-5 h-5 text-accent-danger"})}),t.jsxs("div",{children:[t.jsx("h4",{className:"type-body text-text-primary font-medium",children:"Global Flood Policy"}),t.jsx("p",{className:"type-body-sm text-text-muted",children:"Master control for repeater flooding"})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("div",{className:"flex bg-subtle-fill rounded-full p-1",children:[t.jsx("button",{onClick:()=>na("deny"),disabled:ns,className:_("px-4 py-1.5 rounded-full transition-colors type-body-sm font-medium","deny"===rs?"bg-accent-danger/20 text-accent-danger":"text-text-muted hover:text-text-secondary",ns&&"opacity-50"),children:"Deny"}),t.jsx("button",{onClick:()=>na("allow"),disabled:ns,className:_("px-4 py-1.5 rounded-full transition-colors type-body-sm font-medium","allow"===rs?"bg-accent-success/20 text-accent-success":"text-text-muted hover:text-text-secondary",ns&&"opacity-50"),children:"Allow"})]}),ns&&t.jsx(l,{className:"w-4 h-4 animate-spin text-text-muted"})]})]})}),ss&&t.jsx("div",{className:"type-body-sm mb-3 px-3 py-2 rounded-full text-accent-danger bg-accent-danger/10",children:ss}),t.jsx("div",{className:"bg-subtle-fill rounded-2xl p-4 min-h-[120px]",children:es?t.jsxs("div",{className:"flex items-center justify-center py-6",children:[t.jsx(l,{className:"w-5 h-5 animate-spin text-accent-primary mr-2"}),t.jsx("span",{className:"type-body-sm text-text-muted",children:"Loading transport keys..."})]}):0===Zt.length?t.jsxs("div",{className:"text-center py-6",children:[t.jsx("div",{className:"w-12 h-12 rounded-full bg-subtle-fill mx-auto mb-3 flex items-center justify-center",children:t.jsx(p,{className:"w-6 h-6 text-text-muted/50"})}),t.jsx("p",{className:"type-body text-text-muted",children:"No transport keys found"}),t.jsx("p",{className:"type-body-sm text-text-muted/70 mt-1",children:"Add your first transport key to get started"})]}):t.jsx("div",{className:"space-y-1",children:Zt.map(e=>t.jsx(ae,{node:e,level:0,expandedKeys:ds,selectedKeyId:is,globalFloodPolicy:rs,onSelect:os,onToggle:la},e.id))})})]})}),t.jsx(Y,{template:"auto",children:t.jsxs(K,{children:[t.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 mb-4",children:[t.jsxs("div",{children:[t.jsxs("h2",{className:"type-heading text-text-primary flex items-center gap-2",children:[t.jsx(y,{className:"icon-md text-accent-primary"}),"API Tokens"]}),t.jsx("p",{className:"type-body-sm text-text-muted mt-1",children:"Manage API tokens for machine-to-machine authentication"})]}),t.jsxs("button",{onClick:()=>At(!0),className:"flex items-center justify-center gap-2 h-[32px] px-4 bg-accent-primary/10 hover:bg-accent-primary/20 text-accent-primary rounded-full transition-colors type-body-sm font-medium",children:[t.jsx(b,{className:"w-4 h-4"}),"Create Token"]})]}),t.jsx("div",{className:"bg-accent-tertiary/5 rounded-2xl p-4 mb-4",children:t.jsxs("div",{className:"flex gap-3",children:[t.jsx("div",{className:"w-8 h-8 rounded-full bg-accent-tertiary/20 flex items-center justify-center flex-shrink-0",children:t.jsx(i,{className:"w-4 h-4 text-accent-tertiary"})}),t.jsxs("div",{className:"type-body-sm text-text-muted",children:[t.jsxs("p",{children:[t.jsx("span",{className:"text-text-secondary",children:"API tokens"})," are used for machine-to-machine authentication. Include the token in the ",t.jsx("code",{className:"type-code bg-accent-tertiary/20 px-1.5 py-0.5 rounded-full text-accent-tertiary",children:"X-API-Key"})," header when making API requests."]}),t.jsx("p",{className:"mt-1 text-text-muted/70",children:"Tokens are only shown once at creation. Store them securely."})]})]})}),Dt&&t.jsx("div",{className:"type-body-sm mb-3 px-3 py-2 rounded-full text-accent-danger bg-accent-danger/10",children:Dt}),Pt&&0===Et.length?t.jsxs("div",{className:"flex items-center justify-center py-6",children:[t.jsx(l,{className:"w-5 h-5 animate-spin text-accent-primary mr-2"}),t.jsx("span",{className:"type-body-sm text-text-muted",children:"Loading tokens..."})]}):Et.length>0?t.jsx("div",{className:"space-y-2",children:Et.map(e=>t.jsx("div",{className:"bg-subtle-fill hover:bg-subtle-fill-strong rounded-2xl p-4 transition-colors",children:t.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[t.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[t.jsx("div",{className:"w-10 h-10 rounded-full bg-accent-primary/10 flex items-center justify-center flex-shrink-0",children:t.jsx(y,{className:"w-5 h-5 text-accent-primary"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("h3",{className:"type-body text-text-primary font-medium truncate",children:e.name}),t.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:gap-4 mt-0.5",children:[t.jsxs("span",{className:"type-data-sm text-text-muted truncate",children:["Created: ",ea(e.created_at)]}),t.jsxs("span",{className:"type-data-sm text-text-muted truncate",children:["Last used: ",ea(e.last_used)]})]})]})]}),t.jsxs("button",{onClick:()=>Bt({id:e.id,name:e.name}),disabled:Ut,className:"h-[32px] px-4 bg-accent-danger/10 hover:bg-accent-danger/20 text-accent-danger rounded-full transition-colors disabled:opacity-50 type-body-sm font-medium flex items-center justify-center gap-1.5",children:[t.jsx(a,{className:"w-3.5 h-3.5"}),"Revoke"]})]})},e.id))}):t.jsxs("div",{className:"bg-subtle-fill rounded-2xl p-6 text-center",children:[t.jsx("div",{className:"w-14 h-14 rounded-full bg-subtle-fill mx-auto mb-4 flex items-center justify-center",children:t.jsx(y,{className:"w-7 h-7 text-text-muted/50"})}),t.jsx("h3",{className:"type-body text-text-primary font-medium mb-1",children:"No API Tokens"}),t.jsx("p",{className:"type-body-sm text-text-muted mb-4",children:"Create a token to enable API access"}),t.jsx("button",{onClick:()=>At(!0),className:"h-[32px] px-4 bg-accent-primary/10 hover:bg-accent-primary/20 text-accent-primary rounded-full transition-colors type-body-sm font-medium",children:"Create Your First Token"})]})]})}),t.jsx(Y,{template:"auto",children:t.jsxs(K,{children:[t.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 mb-4",children:t.jsxs("div",{children:[t.jsxs("h2",{className:"type-heading text-text-primary flex items-center gap-2",children:[t.jsx(f,{className:"icon-md text-accent-primary"}),"Web Frontend"]}),t.jsx("p",{className:"type-body-sm text-text-muted mt-1",children:"Choose which web interface to use"})]})}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-3",children:[t.jsxs("label",{className:_("flex items-start gap-3 p-4 bg-subtle-fill rounded-2xl border-2 cursor-pointer transition-all",Ts?"border-accent-primary bg-accent-primary/5":"border-transparent hover:border-accent-primary/30","loading"===Ds&&"opacity-50 pointer-events-none"),children:[t.jsx("input",{type:"radio",name:"frontend",checked:Ts,onChange:()=>Ws(!0),disabled:"loading"===Ds,className:"mt-1 h-4 w-4 text-accent-primary focus:ring-accent-primary focus:ring-offset-bg-elevated"}),t.jsxs("div",{className:"flex-1",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("div",{className:"type-body text-text-primary font-medium",children:"Default Frontend"}),t.jsx("a",{href:"https://github.com/rightup/pyMC_Repeater",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),className:"type-data-xs bg-accent-tertiary/15 text-accent-tertiary px-2.5 py-0.5 rounded-full font-medium hover:bg-accent-tertiary/25 transition-colors",children:"@RightUp"})]}),t.jsx("div",{className:"type-body-sm text-text-muted mt-1",children:"Built-in pyMC Repeater web interface"}),t.jsx("div",{className:"type-data-xs text-text-muted/60 mt-1 font-mono",children:"/opt/pymc_repeater/repeater/web/html"})]})]}),t.jsxs("label",{className:_("flex items-start gap-3 p-4 bg-subtle-fill rounded-2xl border-2 cursor-pointer transition-all",Ts?"border-transparent hover:border-accent-primary/30":"border-accent-primary bg-accent-primary/5","loading"===Ds&&"opacity-50 pointer-events-none"),children:[t.jsx("input",{type:"radio",name:"frontend",checked:!Ts,onChange:()=>Ws(!1),disabled:"loading"===Ds,className:"mt-1 h-4 w-4 text-accent-primary focus:ring-accent-primary focus:ring-offset-bg-elevated"}),t.jsxs("div",{className:"flex-1",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("div",{className:"type-body text-text-primary font-medium",children:"PyMC Console"}),t.jsx("span",{className:"type-data-xs bg-accent-secondary/15 text-accent-secondary px-2.5 py-0.5 rounded-full font-medium",children:"@Treehouse ⚡"})]}),t.jsx("div",{className:"type-body-sm text-text-muted mt-1",children:"Alternative web interface for pyMC Repeater"}),t.jsx("div",{className:"type-data-xs text-text-muted/60 mt-1 font-mono",children:"/opt/pymc_console/web/html"})]})]})]}),!Ps&&t.jsx("div",{className:_("bg-subtle-fill rounded-2xl p-4",Es?"border border-accent-success/20":"border border-accent-tertiary/20"),children:t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("div",{className:_("w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0",Es?"bg-accent-success/20":"bg-accent-tertiary/20"),children:Es?t.jsx(j,{className:"w-4 h-4 text-accent-success"}):t.jsx(i,{className:"w-4 h-4 text-accent-tertiary"})}),t.jsxs("div",{className:"flex-1",children:[t.jsx("h4",{className:"type-body text-text-primary font-medium",children:Es?"PyMC Console has been detected":"PyMC Console Not Installed"}),Es?t.jsxs("p",{className:"type-body-sm text-text-muted mt-1",children:["PyMC Console is installed at ",t.jsx("code",{className:"type-code bg-accent-success/10 px-1.5 py-0.5 rounded-full text-accent-success",children:"/opt/pymc_console/web/html"})]}):t.jsxs(t.Fragment,{children:[t.jsxs("p",{className:"type-body-sm text-text-muted mt-1 mb-3",children:["PyMC Console must be installed at ",t.jsx("code",{className:"type-code bg-accent-tertiary/10 px-1.5 py-0.5 rounded-full text-accent-tertiary",children:"/opt/pymc_console/web/html"})," before selecting this option."]}),t.jsxs("a",{href:"https://github.com/dmduran12/pymc_console-dist",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 h-[32px] px-4 bg-accent-tertiary/10 hover:bg-accent-tertiary/20 text-accent-tertiary rounded-full type-body-sm font-medium transition-colors",children:[t.jsx(v,{className:"w-4 h-4"}),"PyMC Console Install Instructions"]})]})]})]})}),Ms&&t.jsx("div",{className:"bg-subtle-fill rounded-2xl p-4 border border-accent-secondary/30",children:t.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[t.jsxs("div",{className:"flex items-start gap-3 flex-1",children:[t.jsx("div",{className:"w-8 h-8 rounded-full bg-accent-secondary/20 flex items-center justify-center flex-shrink-0",children:t.jsx(N,{className:"w-4 h-4 text-accent-secondary"})}),t.jsxs("div",{className:"flex-1",children:[t.jsx("h4",{className:"type-body text-text-primary font-medium",children:"Service restart required"}),t.jsx("p",{className:"type-body-sm text-text-muted mt-1",children:"Web frontend changes will take effect after restarting the pymc-repeater service."})]})]}),t.jsx("button",{onClick:async()=>{if(!zs){Os(!0);try{await async function(){return T("/api/restart_service",{method:"POST",body:"{}"})}(),As(!1),setTimeout(()=>{window.location.reload()},2e3)}catch{As(!1),setTimeout(()=>{window.location.reload()},3e3)}}},disabled:zs,className:"h-[32px] px-4 bg-accent-secondary/10 hover:bg-accent-secondary/20 text-accent-secondary rounded-full transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2 whitespace-nowrap type-body-sm font-medium",children:zs?t.jsxs(t.Fragment,{children:[t.jsx(l,{className:"w-4 h-4 animate-spin"}),"Restarting..."]}):t.jsxs(t.Fragment,{children:[t.jsx(w,{className:"w-4 h-4"}),"Restart Now"]})})]})})]})]})}),P&&t.jsx(Y,{template:"auto",children:t.jsx(O,{nodeName:ue,repeaterVersion:P.version,coreVersion:P.core_version,localHash:P.local_hash,publicKey:P.public_key})}),P&&(0===(null==oe?void 0:oe.latitude)||!(null==oe?void 0:oe.latitude))&&(0===(null==oe?void 0:oe.longitude)||!(null==oe?void 0:oe.longitude))&&t.jsx(Y,{template:"auto",children:t.jsx(X,{})}),Mt&&t.jsx("div",{className:"fixed inset-0 z-[10010] flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:e=>e.target===e.currentTarget&&At(!1),role:"dialog","aria-modal":"true","aria-labelledby":"create-token-modal-title",children:t.jsxs("div",{className:"bg-bg-elevated border border-border-subtle rounded-xl p-6 max-w-md w-full shadow-2xl",children:[t.jsx("h3",{id:"create-token-modal-title",className:"type-subheading text-text-primary mb-4",children:"Create API Token"}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Token Name"}),t.jsx("input",{type:"text",value:zt,onChange:e=>Ot(e.target.value),placeholder:"e.g., Production Server, CI/CD Pipeline",className:"w-full px-4 py-2 bg-bg-subtle border border-border-subtle rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:ring-2 focus:ring-accent-primary/50 transition-colors",onKeyDown:e=>"Enter"===e.key&&Qs(),autoFocus:!0}),t.jsx("p",{className:"text-xs text-text-muted mt-1",children:"Give your token a descriptive name to identify its purpose"})]}),t.jsxs("div",{className:"flex justify-end gap-3 mt-6",children:[t.jsx("button",{onClick:()=>{At(!1),Ot(""),It(null)},disabled:Vt,className:"px-4 py-2 bg-bg-subtle hover:bg-bg-elevated text-text-secondary rounded-lg border border-border-subtle transition-colors disabled:opacity-50",children:"Cancel"}),t.jsx("button",{onClick:Qs,disabled:Vt||!zt.trim(),className:"px-4 py-2 bg-accent-primary/20 hover:bg-accent-primary/30 text-text-primary rounded-lg border border-accent-primary/50 transition-colors disabled:opacity-50 flex items-center gap-2",children:Vt?t.jsxs(t.Fragment,{children:[t.jsx(l,{className:"w-4 h-4 animate-spin"}),"Creating..."]}):"Create Token"})]})]})]})}),Ht&&Kt&&t.jsx("div",{className:"fixed inset-0 z-[10010] flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:e=>e.target===e.currentTarget&&$t(!1),role:"dialog","aria-modal":"true","aria-labelledby":"show-token-modal-title",children:t.jsxs("div",{className:"bg-bg-elevated border border-border-subtle rounded-xl p-6 max-w-lg w-full shadow-2xl",children:[t.jsx("h3",{id:"show-token-modal-title",className:"type-subheading text-text-primary mb-4",children:"Token Created Successfully"}),t.jsxs("div",{className:"space-y-4",children:[t.jsx("div",{className:"bg-accent-secondary/10 border border-accent-secondary/30 rounded-lg p-3",children:t.jsxs("div",{className:"flex gap-2",children:[t.jsx(N,{className:"w-4 h-4 text-accent-secondary flex-shrink-0 mt-0.5"}),t.jsxs("div",{className:"text-sm text-text-secondary",children:[t.jsx("strong",{children:"Save this token now!"})," For security reasons, it will not be shown again."]})]})}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Your API Token"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx("input",{value:Kt,readOnly:!0,className:"flex-1 px-4 py-2 bg-bg-subtle border border-border-subtle rounded-lg text-text-primary font-mono text-sm"}),t.jsxs("button",{onClick:()=>{Kt&&(navigator.clipboard.writeText(Kt),Wt(!0),setTimeout(()=>Wt(!1),2e3))},className:"px-4 py-2 bg-accent-primary/20 hover:bg-accent-primary/30 text-text-primary rounded-lg border border-accent-primary/50 transition-colors flex items-center gap-2",title:"Copy to clipboard",children:[Xt?t.jsx(n,{className:"w-4 h-4 text-accent-success"}):t.jsx(k,{className:"w-4 h-4"}),Xt?"Copied!":"Copy"]})]})]}),t.jsxs("div",{className:"bg-accent-tertiary/10 border border-accent-tertiary/30 rounded-lg p-3",children:[t.jsx("p",{className:"text-sm text-text-secondary mb-2",children:t.jsx("strong",{children:"Usage Example:"})}),t.jsxs("code",{className:"block bg-accent-tertiary/20 px-3 py-2 rounded text-xs text-accent-tertiary font-mono overflow-x-auto",children:['curl -H "X-API-Key: ',Kt.slice(0,12),'..." ',window.location.origin,"/api/stats"]})]}),t.jsx("div",{className:"flex justify-end mt-6",children:t.jsx("button",{onClick:()=>{$t(!1),qt(null)},className:"px-4 py-2 bg-accent-primary/20 hover:bg-accent-primary/30 text-text-primary rounded-lg border border-accent-primary/50 transition-colors",children:"Done"})})]})]})}),t.jsx(A,{isOpen:!!Yt,title:"Revoke API Token",message:`Are you sure you want to revoke the token '${null==Yt?void 0:Yt.name}'? This action cannot be undone.`,confirmLabel:Ut?"Revoking...":"Revoke",cancelLabel:"Cancel",variant:"danger",onConfirm:async()=>{if(Yt){Gt(!0),It(null);try{await async function(e){return T(`/auth/tokens/${e}`,{method:"DELETE"})}(Yt.id),await Zs(),Bt(null)}catch(e){It(e instanceof Error?e.message:"Failed to revoke token")}finally{Gt(!1)}}},onCancel:()=>Bt(null)}),ms&&t.jsx("div",{className:"fixed inset-0 z-[10010] flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:e=>e.target===e.currentTarget&&xs(!1),role:"dialog","aria-modal":"true","aria-labelledby":"add-key-modal-title",children:t.jsxs("div",{className:"bg-bg-elevated border border-border-subtle rounded-xl p-6 max-w-md w-full shadow-2xl",children:[t.jsx("h3",{id:"add-key-modal-title",className:"type-subheading text-text-primary mb-4",children:"Add Transport Key"}),t.jsxs("div",{className:"space-y-4",children:[is&&t.jsxs("div",{className:"bg-accent-tertiary/10 border border-accent-tertiary/30 rounded-lg p-3 text-sm text-text-secondary",children:["Adding as child of: ",t.jsx("strong",{className:"text-text-primary",children:ra()})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Key Name"}),t.jsx("input",{type:"text",value:Ns,onChange:e=>ws(e.target.value),placeholder:"e.g., Region Name, Group Key",className:"w-full px-4 py-2 bg-bg-subtle border border-border-subtle rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:ring-2 focus:ring-accent-primary/50 transition-colors",onKeyDown:e=>"Enter"===e.key&&ca(),autoFocus:!0})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Flood Policy"}),t.jsxs("div",{className:"flex bg-bg-subtle rounded-lg border border-border-subtle p-1",children:[t.jsx("button",{onClick:()=>Cs("deny"),className:_("flex-1 px-3 py-2 text-sm font-medium rounded transition-colors","deny"===ks?"bg-accent-danger/20 text-accent-danger border border-accent-danger/50":"text-text-muted hover:text-text-secondary"),children:"DENY"}),t.jsx("button",{onClick:()=>Cs("allow"),className:_("flex-1 px-3 py-2 text-sm font-medium rounded transition-colors","allow"===ks?"bg-accent-success/20 text-accent-success border border-accent-success/50":"text-text-muted hover:text-text-secondary"),children:"ALLOW"})]})]}),t.jsxs("div",{className:"flex justify-end gap-3 mt-6",children:[t.jsx("button",{onClick:()=>{xs(!1),ws(""),Cs("deny")},disabled:Ss,className:"px-4 py-2 bg-bg-subtle hover:bg-bg-elevated text-text-secondary rounded-lg border border-border-subtle transition-colors disabled:opacity-50",children:"Cancel"}),t.jsx("button",{onClick:ca,disabled:Ss||!Ns.trim(),className:"px-4 py-2 bg-accent-primary/20 hover:bg-accent-primary/30 text-text-primary rounded-lg border border-accent-primary/50 transition-colors disabled:opacity-50 flex items-center gap-2",children:Ss?t.jsxs(t.Fragment,{children:[t.jsx(l,{className:"w-4 h-4 animate-spin"}),"Adding..."]}):"Add Key"})]})]})]})}),ps&&ys&&t.jsx("div",{className:"fixed inset-0 z-[10010] flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:e=>e.target===e.currentTarget&&bs(!1),role:"dialog","aria-modal":"true","aria-labelledby":"edit-key-modal-title",children:t.jsxs("div",{className:"bg-bg-elevated border border-border-subtle rounded-xl p-6 max-w-md w-full shadow-2xl",children:[t.jsx("h3",{id:"edit-key-modal-title",className:"type-subheading text-text-primary mb-4",children:"Edit Transport Key"}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Key Name"}),t.jsx("input",{type:"text",value:ys.name,onChange:e=>fs({...ys,name:e.target.value}),className:"w-full px-4 py-2 bg-bg-subtle border border-border-subtle rounded-lg text-text-primary focus:outline-none focus:ring-2 focus:ring-accent-primary/50 transition-colors",autoFocus:!0})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Flood Policy"}),t.jsxs("div",{className:"flex bg-bg-subtle rounded-lg border border-border-subtle p-1",children:[t.jsx("button",{onClick:()=>fs({...ys,floodPolicy:"deny"}),className:_("flex-1 px-3 py-2 text-sm font-medium rounded transition-colors","deny"===ys.floodPolicy?"bg-accent-danger/20 text-accent-danger border border-accent-danger/50":"text-text-muted hover:text-text-secondary"),children:"DENY"}),t.jsx("button",{onClick:()=>fs({...ys,floodPolicy:"allow"}),className:_("flex-1 px-3 py-2 text-sm font-medium rounded transition-colors","allow"===ys.floodPolicy?"bg-accent-success/20 text-accent-success border border-accent-success/50":"text-text-muted hover:text-text-secondary"),children:"ALLOW"})]})]}),ys.transport_key&&t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Transport Key"}),t.jsx("code",{className:"block bg-bg-subtle px-3 py-2 rounded-lg text-xs text-text-muted font-mono overflow-x-auto",children:ys.transport_key})]}),t.jsxs("div",{className:"flex justify-between gap-3 mt-6",children:[t.jsx("button",{onClick:()=>{bs(!1),vs(ys),gs(!0),fs(null)},disabled:Ss,className:"px-4 py-2 bg-accent-danger/20 hover:bg-accent-danger/30 text-accent-danger rounded-lg border border-accent-danger/50 transition-colors disabled:opacity-50",children:"Delete"}),t.jsxs("div",{className:"flex gap-3",children:[t.jsx("button",{onClick:()=>{bs(!1),fs(null)},disabled:Ss,className:"px-4 py-2 bg-bg-subtle hover:bg-bg-elevated text-text-secondary rounded-lg border border-border-subtle transition-colors disabled:opacity-50",children:"Cancel"}),t.jsx("button",{onClick:async()=>{if(ys){_s(!0),as(null);try{const e=await async function(e,t){return T(`/api/transport_key/${e}`,{method:"PUT",body:JSON.stringify(t)})}(ys.id,{name:ys.name,flood_policy:ys.floodPolicy});e.success?(await sa(),bs(!1),fs(null)):as(e.error||"Failed to update transport key")}catch(e){as(e instanceof Error?e.message:"Failed to update transport key")}finally{_s(!1)}}},disabled:Ss||!ys.name.trim(),className:"px-4 py-2 bg-accent-primary/20 hover:bg-accent-primary/30 text-text-primary rounded-lg border border-accent-primary/50 transition-colors disabled:opacity-50 flex items-center gap-2",children:Ss?t.jsxs(t.Fragment,{children:[t.jsx(l,{className:"w-4 h-4 animate-spin"}),"Saving..."]}):"Save"})]})]})]})]})}),hs&&js&&t.jsx("div",{className:"fixed inset-0 z-[10010] flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:e=>e.target===e.currentTarget&&gs(!1),role:"dialog","aria-modal":"true","aria-labelledby":"delete-key-modal-title",children:t.jsxs("div",{className:"bg-bg-elevated border border-border-subtle rounded-xl p-6 max-w-md w-full shadow-2xl",children:[t.jsx("h3",{id:"delete-key-modal-title",className:"type-subheading text-text-primary mb-4",children:"Delete Transport Key"}),t.jsxs("p",{className:"text-text-secondary mb-4",children:["Are you sure you want to delete ",t.jsxs("strong",{className:"text-text-primary",children:["'",js.name,"'"]}),"?"]}),js.children&&js.children.length>0&&t.jsx("div",{className:"bg-accent-secondary/10 border border-accent-secondary/30 rounded-lg p-3 mb-4",children:t.jsxs("div",{className:"flex gap-2",children:[t.jsx(N,{className:"w-4 h-4 text-accent-secondary flex-shrink-0 mt-0.5"}),t.jsxs("div",{className:"text-sm text-text-secondary",children:["This key has ",js.children.length," child key(s). Deleting will also remove all children."]})]})}),t.jsxs("div",{className:"flex justify-end gap-3",children:[t.jsx("button",{onClick:()=>{gs(!1),vs(null)},disabled:Ss,className:"px-4 py-2 bg-bg-subtle hover:bg-bg-elevated text-text-secondary rounded-lg border border-border-subtle transition-colors disabled:opacity-50",children:"Cancel"}),t.jsx("button",{onClick:async()=>{if(js){_s(!0),as(null);try{const e=await async function(e){return T(`/api/transport_key/${e}`,{method:"DELETE"})}(js.id);e.success?(await sa(),gs(!1),vs(null),os(null)):as(e.error||"Failed to delete transport key")}catch(e){as(e instanceof Error?e.message:"Failed to delete transport key")}finally{_s(!1)}}},disabled:Ss,className:"px-4 py-2 bg-accent-danger/20 hover:bg-accent-danger/30 text-accent-danger rounded-lg border border-accent-danger/50 transition-colors disabled:opacity-50 flex items-center gap-2",children:Ss?t.jsxs(t.Fragment,{children:[t.jsx(l,{className:"w-4 h-4 animate-spin"}),"Deleting..."]}):"Delete"})]})]})})]})}export{re as default}; diff --git a/frontend/dist/assets/Configuration-BdYZcJJF.js b/frontend/dist/assets/Configuration-BdYZcJJF.js new file mode 100644 index 00000000..3081ace3 --- /dev/null +++ b/frontend/dist/assets/Configuration-BdYZcJJF.js @@ -0,0 +1 @@ +import{a as e,j as t}from"./vendor-react-DCIF8YoJ.js";import{n as s}from"./recharts-DVj1EL-m.js";import{c as a,bp as r,aU as l,bq as n,br as c,bs as i,X as o,aH as d,bt as u,bu as m,bv as x,C as p,bw as b,R as h,bm as y}from"./index-BGs2yNOg.js";import{T as g,P as f,C as j}from"./ConfirmModal-_bkwu5cd.js";import{l as v}from"./font-loader-jlbdh9Fw.js";import{N}from"./NodeInformationCard-DcRtH0Bq.js";import{a as w,P as k,b as C}from"./PageLayout-DIXn4UXM.js";import{C as S}from"./Card-CPlTPCY8.js";import{L as _}from"./loader-circle-CwUrmZrV.js";import{C as T}from"./check-qb29v-su.js";import{I as F}from"./info-HmV1qkUD.js";import{R as E,C as L}from"./Grid-DkfcBkoo.js";import{C as M}from"./circle-check-Bd9Kbu6i.js";import{T as P}from"./triangle-alert-2-1YN-Am.js";import{R}from"./refresh-cw-ccP9GKH1.js";import{C as z}from"./DataBox-nCNZLfvU.js";import{C as D}from"./chevron-right-7sotkg9l.js";import"./deckgl-DTsmDcfs.js";import"./vendor-core-Dl9MTgSr.js";const A=a("antenna",[["path",{d:"M2 12 7 2",key:"117k30"}],["path",{d:"m7 12 5-10",key:"1tvx22"}],["path",{d:"m12 12 5-10",key:"ev1o1a"}],["path",{d:"m17 12 5-10",key:"1e4ti3"}],["path",{d:"M4.5 7h15",key:"vlsxkz"}],["path",{d:"M12 16v6",key:"c8a4gj"}]]),I=a("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]),O=a("folder-key",[["circle",{cx:"16",cy:"20",r:"2",key:"1vifvg"}],["path",{d:"M10 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v2",key:"3hgo9p"}],["path",{d:"m22 14-4.5 4.5",key:"1ef6z8"}],["path",{d:"m21 15 1 1",key:"1ejcpy"}]]),q=a("folder-lock",[["rect",{width:"8",height:"5",x:"14",y:"17",rx:"1",key:"19aais"}],["path",{d:"M10 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v2.5",key:"1w6v7t"}],["path",{d:"M20 17v-2a2 2 0 1 0-4 0v2",key:"pwaxnr"}]]),K=a("key-round",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]),H=a("monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]),V=a("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]),$=a("shield-check",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),Y=a("shield-x",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m14.5 9.5-5 5",key:"17q4r4"}],["path",{d:"m9.5 9.5 5 5",key:"18nt4w"}]]),U=a("triangle-dashed",[["path",{d:"M10.17 4.193a2 2 0 0 1 3.666.013",key:"pltmmw"}],["path",{d:"M14 21h2",key:"v4qezv"}],["path",{d:"m15.874 7.743 1 1.732",key:"10m0iw"}],["path",{d:"m18.849 12.952 1 1.732",key:"zadnam"}],["path",{d:"M21.824 18.18a2 2 0 0 1-1.835 2.824",key:"fvwuk4"}],["path",{d:"M4.024 21a2 2 0 0 1-1.839-2.839",key:"1e1kah"}],["path",{d:"m5.136 12.952-1 1.732",key:"1u4ldi"}],["path",{d:"M8 21h2",key:"i9zjee"}],["path",{d:"m8.102 7.743-1 1.732",key:"1zzo4u"}]]);async function B(e){return r("/api/update_web_config",{method:"POST",body:JSON.stringify(e)})}const X=e.memo(function(){const{theme:e}=l(),{colorScheme:s}=e,a=n.find(e=>e.colorScheme===s)??n[0],r=a.displaySize,c=`clamp(${.8*r}rem, ${.6*r}rem + 1.5vw, ${1.4*r}rem)`;return t.jsx("div",{className:"h-10 flex items-center justify-center",children:t.jsxs("span",{className:"font-medium transition-all duration-300 leading-none text-center",style:{fontFamily:a.displayFont,color:a.displayColor,fontSize:c,fontOpticalSizing:"auto",letterSpacing:"-0.03em"},children:["Theme: ",a.displayName]})})}),J=e.memo(function(){const{theme:a,setThemePreset:r,setBrightness:i}=l(),{colorScheme:o,brightness:d}=a,[u,m]=e.useState(!1),[x,p]=e.useState(!1),b=e.useRef(null),h=e.useRef(null),y=(n.find(e=>e.colorScheme===o)??n[0]).id,g=e.useCallback((e,t)=>{if(!h.current)return d;const s=(h.current.y-e)/(t?200:80)*100;return Math.round(Math.max(0,Math.min(100,h.current.brightness+s)))},[d]),f=e.useCallback(e=>{r(e),m(!0)},[r]),j=e.useCallback(e=>{i(e)},[i]),v=e.useCallback(e=>{const t=n.find(t=>t.id===e);t&&c(t.backgroundImage)},[]);return t.jsx("div",{className:"grid grid-cols-4 gap-[3%] w-full",children:n.map(e=>{const a=y===e.id,r=!e.backgroundImage,l=a&&!r&&(u||x);return t.jsxs("div",{ref:a?b:void 0,title:e.displayName,className:s("flex flex-col items-stretch rounded-sm transition-all duration-300 ease-out overflow-hidden",a?"ring-2 ring-accent-primary scale-105 "+(r?"cursor-pointer":"cursor-ns-resize"):"cursor-pointer"),onMouseEnter:()=>{a&&!r?m(!0):a||v(e.id)},onMouseLeave:()=>!x&&m(!1),onClick:()=>!a&&f(e.id),onTouchStart:e=>{if(!a||r)return;e.preventDefault();const t=e.touches[0];h.current={y:t.clientY,brightness:d},p(!0),m(!0);const s=e=>{e.preventDefault();const t=e.touches[0];j(g(t.clientY,!0))},l=()=>{document.removeEventListener("touchmove",s),document.removeEventListener("touchend",l),h.current=null,p(!1),setTimeout(()=>m(!1),1500)};document.addEventListener("touchmove",s,{passive:!1}),document.addEventListener("touchend",l)},onMouseDown:e=>{if(!a||r)return;e.preventDefault(),h.current={y:e.clientY,brightness:d},p(!0),m(!0);const t=e=>{j(g(e.clientY,!1))},s=()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",s),h.current=null,p(!1)};document.addEventListener("mousemove",t),document.addEventListener("mouseup",s)},children:[t.jsxs("div",{className:"glass-thumbnail w-full aspect-square sm:aspect-[4/3] lg:aspect-video relative !rounded-b-none",children:["kde breeze"===e.id?t.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-[#242627]",style:{opacity:l?.4:1},children:t.jsx("span",{className:"text-[#58b99d] text-[1.5em] font-bold font-mono",children:">"})}):"ribbon"===e.id?t.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-[#F5F5F5]",style:{opacity:l?.4:1},children:t.jsx("span",{className:"text-[#2D2D2D] text-[1.5em] font-bold font-mono",children:"R"})}):t.jsx("div",{className:"absolute bg-cover bg-center transition-opacity duration-200",style:{inset:0,backgroundImage:`url(${e.backgroundImage})`,opacity:l?.4:1,filter:"brightness(var(--thumbnail-brightness, 1.5))"}}),a&&t.jsxs("div",{className:s("absolute inset-0 transition-opacity duration-200",l?"opacity-100":"opacity-0"),children:[t.jsx("div",{className:"absolute inset-x-0 bottom-0 bg-black/70 transition-all duration-100 ease-out",style:{height:100-d+"%"}}),t.jsx("div",{className:"absolute inset-x-[8%] h-0.5 bg-white rounded-full shadow-lg transition-all duration-100 ease-out",style:{top:100-d+"%"}}),t.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:t.jsxs("span",{className:"text-[0.6em] font-mono font-bold text-white drop-shadow-lg",children:[d,"%"]})})]})]}),t.jsx("div",{className:"flex flex-col w-full",children:e.paletteColors.map((e,s)=>t.jsx("div",{className:"flex",children:e.map((e,s)=>t.jsx("div",{className:"flex-1 aspect-[2/1]",style:{backgroundColor:e}},s))},s))})]},e.id)})})}),W=e.memo(function({layout:s="horizontal"}){return e.useEffect(()=>{v()},[]),"logo-only"===s?t.jsx(X,{}):"thumbnails-only"===s?t.jsx(J,{}):t.jsxs("div",{className:"flex flex-col items-center gap-3",children:[t.jsx(X,{}),t.jsx(J,{})]})});function G(){const{latitude:a,longitude:r,enabled:l,setLocation:n,enable:c,disable:d,clear:u}=i(),[m,x]=e.useState(!1),[p,b]=e.useState(""),[h,y]=e.useState(""),[f,j]=e.useState("idle"),[v,N]=e.useState(null),k=e.useRef(null),C=e.useRef(null),E=e.useRef(!0);e.useEffect(()=>(E.current=!0,()=>{E.current=!1,C.current&&clearTimeout(C.current)}),[]);const L=()=>{x(!1),N(null)};e.useEffect(()=>{if(!m)return;const e=e=>{"loading"!==f&&k.current&&!k.current.contains(e.target)&&L()};return document.addEventListener("mouseup",e),()=>document.removeEventListener("mouseup",e)},[m,f]);const M=null!==a&&null!==r;return t.jsx(w,{children:t.jsxs("div",{ref:k,children:[t.jsxs("div",{className:"flex items-center justify-between mb-4",children:[t.jsx(S,{icon:t.jsx(U,{}),title:"Stealth",largeTitle:!0}),t.jsxs("div",{className:"flex items-center gap-1",children:[M&&!m&&t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:()=>{l?d():c()},className:s("relative inline-flex h-6 w-11 items-center rounded-full transition-colors border-2 mr-2",l?"bg-toggle-on border-toggle-on":"bg-toggle-off border-border-subtle"),title:l?"Disable stealth location":"Enable stealth location",children:t.jsx("span",{className:s("inline-block h-4 w-4 transform rounded-full bg-white transition-transform shadow-lg",l?"translate-x-5":"translate-x-0.5")})}),t.jsx("button",{onClick:()=>{u(),x(!1)},className:"p-2 rounded-lg transition-colors text-text-muted hover:text-accent-danger hover:bg-accent-danger/10",title:"Clear stealth location",children:t.jsx(g,{className:"w-4 h-4"})})]}),m?t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:L,disabled:"loading"===f,className:s("p-2 rounded-lg transition-colors","loading"===f?"text-text-muted cursor-not-allowed":"text-text-muted hover:text-accent-danger hover:bg-accent-danger/10"),title:"Cancel",children:t.jsx(o,{className:"w-4 h-4"})}),t.jsx("button",{onClick:()=>{if("loading"===f)return;C.current&&clearTimeout(C.current);const e=((e,t)=>{const s=parseFloat(e),a=parseFloat(t);return isNaN(s)||isNaN(a)?"Please enter valid numbers":s<-90||s>90?"Latitude must be between -90 and 90":a<-180||a>180?"Longitude must be between -180 and 180":0===s&&0===a?"Coordinates (0, 0) are invalid":null})(p,h);if(e)return void N(e);j("loading"),N(null);const t=parseFloat(p),s=parseFloat(h);n(t,s),l||c(),j("success"),C.current=setTimeout(()=>{E.current&&(j("idle"),x(!1))},1e3)},disabled:"loading"===f,className:s("p-2 rounded-lg transition-colors","loading"===f?"text-accent-primary cursor-wait":"success"===f?"text-accent-success":"error"===f?"text-accent-danger":"text-accent-success hover:bg-accent-success/10"),title:"Save",children:"loading"===f?t.jsx(_,{className:"w-4 h-4 animate-spin"}):"success"===f?t.jsx(T,{className:"w-4 h-4"}):"error"===f?t.jsx(o,{className:"w-4 h-4"}):t.jsx(T,{className:"w-4 h-4"})})]}):t.jsx("button",{onClick:()=>{b((null==a?void 0:a.toFixed(6))??""),y((null==r?void 0:r.toFixed(6))??""),N(null),x(!0)},className:"p-2 rounded-lg transition-colors text-text-muted hover:text-text-primary hover:bg-bg-subtle",title:M?"Edit stealth location":"Set stealth location",children:t.jsx(V,{className:"w-4 h-4"})})]})]}),t.jsx("div",{className:"bg-accent-tertiary/5 rounded-xl p-3 mb-4",children:t.jsxs("div",{className:"flex gap-2",children:[t.jsx(F,{className:"w-4 h-4 text-accent-tertiary flex-shrink-0 mt-0.5"}),t.jsxs("p",{className:"type-body-sm text-text-muted",children:[t.jsx("span",{className:"text-text-secondary",children:"Stealth mode"})," allows you to appear on the map and in topology analysis without broadcasting your location. Coordinates are stored locally in your browser only — ",t.jsx("span",{className:"text-accent-tertiary",children:"never sent to config.yaml or the mesh"}),"."]})]})}),v&&t.jsx("div",{className:"text-xs mb-3 px-2 py-1.5 rounded-md text-accent-danger bg-accent-danger/10",children:v}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:m?"Latitude (°)":"Latitude"}),t.jsx("div",{className:s("h-[38px] rounded-full px-4 flex items-center transition-colors",m?"bg-white/5":"bg-white/[0.02]"),children:m?t.jsx("input",{type:"number",value:p,onChange:e=>b(e.target.value),step:"0.000001",min:"-90",max:"90",placeholder:"e.g. 34.052234",className:"w-full bg-transparent text-text-primary focus:outline-none type-data placeholder:text-text-muted/50"}):t.jsx("span",{className:s("type-data",M&&l?"text-text-primary":"text-text-muted"),children:M?a.toFixed(6):"Not set"})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:m?"Longitude (°)":"Longitude"}),t.jsx("div",{className:s("h-[38px] rounded-full px-4 flex items-center transition-colors",m?"bg-white/5":"bg-white/[0.02]"),children:m?t.jsx("input",{type:"number",value:h,onChange:e=>y(e.target.value),step:"0.000001",min:"-180",max:"180",placeholder:"e.g. -118.243685",className:"w-full bg-transparent text-text-primary focus:outline-none type-data placeholder:text-text-muted/50"}):t.jsx("span",{className:s("type-data",M&&l?"text-text-primary":"text-text-muted"),children:M?r.toFixed(6):"Not set"})})]})]}),M&&!m&&t.jsx("div",{className:"mt-3 pt-3 border-t border-border-subtle",children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:s("w-2 h-2 rounded-full",l?"bg-accent-success":"bg-text-muted")}),t.jsx("span",{className:"type-body-sm text-text-muted",children:l?"Stealth location active — you appear on maps with these coordinates":"Stealth location disabled — coordinates saved but not in use"})]})})]})})}const Q=[{value:7.8,label:"7.8 kHz"},{value:10.4,label:"10.4 kHz"},{value:15.6,label:"15.6 kHz"},{value:20.8,label:"20.8 kHz"},{value:31.25,label:"31.25 kHz"},{value:41.7,label:"41.7 kHz"},{value:62.5,label:"62.5 kHz"},{value:125,label:"125 kHz"},{value:250,label:"250 kHz"},{value:500,label:"500 kHz"}],Z=[5,6,7,8,9,10,11,12],ee=[{value:5,label:"4/5"},{value:6,label:"4/6"},{value:7,label:"4/7"},{value:8,label:"4/8"}],te="radioConfig",se="repeaterSettings",ae="operatingMode";function re({node:e,level:a,expandedKeys:r,selectedKeyId:l,globalFloodPolicy:n,onSelect:c,onToggle:i}){const o=r.has(e.id),d=l===e.id,u=e.children&&e.children.length>0,m="allow"===n;return t.jsxs("div",{children:[t.jsxs("div",{className:s("flex items-center gap-2 h-[36px] px-3 rounded-full cursor-pointer transition-colors",d?"bg-accent-primary/15":"hover:bg-subtle-fill",m&&"opacity-50 cursor-not-allowed"),style:{marginLeft:16*a+"px"},onClick:()=>!m&&c(e.id),children:[u?t.jsx("button",{onClick:t=>{t.stopPropagation(),i(e.id)},className:"p-1 hover:bg-subtle-fill-hover rounded-full transition-colors",children:t.jsx(D,{className:s("w-3.5 h-3.5 text-text-muted transition-transform",o&&"rotate-90")})}):t.jsx("span",{className:"w-5"}),t.jsx(O,{className:"w-4 h-4 text-accent-primary flex-shrink-0"}),t.jsx("span",{className:"type-data text-text-primary flex-1 truncate",children:e.name}),t.jsx("span",{className:s("type-data-xs px-2 py-0.5 rounded-full","allow"===e.floodPolicy?"bg-accent-success/15 text-accent-success":"bg-accent-danger/15 text-accent-danger"),children:"allow"===e.floodPolicy?"Allow":"Deny"})]}),u&&o&&t.jsx("div",{children:e.children.map(e=>t.jsx(re,{node:e,level:a+1,expandedKeys:r,selectedKeyId:l,globalFloodPolicy:n,onSelect:c,onToggle:i},e.id))})]})}function le(){var a,l,n,c,i,v;const{stats:D,setMode:O,clearModeMutation:U,setDutyCycleConfig:X,clearDutyCycleMutation:J,fetchStats:le,startMutation:ne,clearMutation:ce}=d(),ie=null==(a=null==D?void 0:D.config)?void 0:a.radio,oe=null==(l=null==D?void 0:D.config)?void 0:l.repeater,de=null==(n=null==D?void 0:D.config)?void 0:n.duty_cycle,ue=(null==D?void 0:D.node_name)||(null==(c=null==D?void 0:D.config)?void 0:c.node_name)||"Unknown Node",me=(null==oe?void 0:oe.mode)??"forward",xe=(null==de?void 0:de.enforcement_enabled)??!1,pe=null==(i=null==D?void 0:D.config)?void 0:i.delays,[be,he]=e.useState(!1),[ye,ge]=e.useState(""),[fe,je]=e.useState(62.5),[ve,Ne]=e.useState(7),[we,ke]=e.useState(5),[Ce,Se]=e.useState(""),[_e,Te]=e.useState("idle"),[Fe,Ee]=e.useState(null),Le=e.useRef(null),Me=e.useRef(null),[Pe,Re]=e.useState(!1),[ze,De]=e.useState(""),[Ae,Ie]=e.useState(""),[Oe,qe]=e.useState(""),[Ke,He]=e.useState("idle"),Ve=e.useRef(null),$e=e.useRef(null),[Ye,Ue]=e.useState(!1),[Be,Xe]=e.useState(""),[Je,We]=e.useState(""),[Ge,Qe]=e.useState(""),[Ze,et]=e.useState(""),[tt,st]=e.useState("idle"),[at,rt]=e.useState(null),lt=e.useRef(null),nt=e.useRef(null),[ct,it]=e.useState("idle"),[ot,dt]=e.useState("idle"),[ut,mt]=e.useState(null),[xt,pt]=e.useState(null),bt=e.useRef(!0),ht=e.useRef(null),yt=e.useRef(null),gt=e.useRef(null),ft=e.useRef(null),jt=e.useRef(!1),vt=e.useRef(!1);e.useEffect(()=>(bt.current=!0,()=>{bt.current=!1,ht.current&&clearTimeout(ht.current),yt.current&&clearTimeout(yt.current),gt.current&&clearTimeout(gt.current),ft.current&&clearTimeout(ft.current),_t.current&&clearTimeout(_t.current),Tt.current&&clearTimeout(Tt.current),Me.current&&clearTimeout(Me.current),Ve.current&&clearTimeout(Ve.current),nt.current&&clearTimeout(nt.current)}),[]),e.useEffect(()=>{const e=e=>{if(be||Ye||Pe)return e.preventDefault(),e.returnValue="You have unsaved changes. Are you sure you want to leave?",e.returnValue};return window.addEventListener("beforeunload",e),()=>window.removeEventListener("beforeunload",e)},[be,Ye,Pe]);const Nt=null==(v=null==D?void 0:D.config)?void 0:v.web,[wt,kt]=e.useState("idle"),[Ct,St]=e.useState(null),_t=e.useRef(null),Tt=e.useRef(null),Ft=e.useRef(!1),[Et,Lt]=e.useState([]),[Mt,Pt]=e.useState(!1),[Rt,zt]=e.useState(null),[Dt,At]=e.useState(!1),[It,Ot]=e.useState(""),[qt,Kt]=e.useState(null),[Ht,Vt]=e.useState(!1),[$t,Yt]=e.useState(null),[Ut,Bt]=e.useState(!1),[Xt,Jt]=e.useState(!1),[Wt,Gt]=e.useState(!1),[Qt,Zt]=e.useState([]),[es,ts]=e.useState(!1),[ss,as]=e.useState(null),[rs,ls]=e.useState("deny"),[ns,cs]=e.useState(!1),[is,os]=e.useState(null),[ds,us]=e.useState(new Set),[ms,xs]=e.useState(!1),[ps,bs]=e.useState(!1),[hs,ys]=e.useState(!1),[gs,fs]=e.useState(null),[js,vs]=e.useState(null),[Ns,ws]=e.useState(""),[ks,Cs]=e.useState("deny"),[Ss,_s]=e.useState(!1),[Ts,Fs]=e.useState(!0),[Es,Ls]=e.useState(!1),[Ms,Ps]=e.useState(!0),[Rs,zs]=e.useState("idle"),[Ds,As]=e.useState(!1),[Is,Os]=e.useState(!1),qs=e.useRef(!1);e.useEffect(()=>{const e=be&&!qs.current;qs.current=be,ie&&e&&(ge((ie.frequency/1e6).toFixed(3)),je(ie.bandwidth/1e3),Ne(ie.spreading_factor),ke(ie.coding_rate),Se(String(ie.tx_power)))},[ie,be]);const Ks=e.useMemo(()=>{if(!ie||!be)return!1;const e=ie.frequency/1e6,t=ie.bandwidth/1e3,s=parseFloat(ye)||0;return Math.abs(s-e)>1e-4||fe!==t||ve!==ie.spreading_factor||we!==ie.coding_rate||parseInt(Ce)!==ie.tx_power},[ie,be,ye,fe,ve,we,Ce]),Hs=e.useCallback(()=>{he(!1),Ee(null),ie&&(ge((ie.frequency/1e6).toFixed(3)),je(ie.bandwidth/1e3),Ne(ie.spreading_factor),ke(ie.coding_rate),Se(String(ie.tx_power)))},[ie]);e.useEffect(()=>{if(!be)return;const e=e=>{"loading"!==_e&&Le.current&&!Le.current.contains(e.target)&&Hs()};return document.addEventListener("mouseup",e),()=>{document.removeEventListener("mouseup",e)}},[be,Hs,_e]);const Vs=e.useCallback(()=>{const e=null==pe?void 0:pe.tx_delay_factor;return e&&"object"==typeof e&&"parsedValue"in e?e.parsedValue??1:"number"==typeof e?e:1},[pe]),$s=e.useCallback(()=>{const e=null==pe?void 0:pe.direct_tx_delay_factor;return"number"==typeof e?e:.5},[pe]),Ys=e.useCallback(()=>{const e=null==de?void 0:de.max_airtime_percent;return"number"==typeof e?e:e&&"object"==typeof e&&"parsedValue"in e?e.parsedValue??6:6},[de]),Us=e.useCallback(()=>{De(Vs().toFixed(2)),Ie($s().toFixed(2)),qe(Ys().toFixed(1)),Re(!0)},[Vs,$s,Ys]),Bs=e.useCallback(()=>{Re(!1)},[]);e.useEffect(()=>{if(!Pe)return;const e=e=>{"loading"!==Ke&&$e.current&&!$e.current.contains(e.target)&&Bs()};return document.addEventListener("mouseup",e),()=>document.removeEventListener("mouseup",e)},[Pe,Bs,Ke]);const Xs=e.useCallback(()=>{var e,t,s;Xe(ue),We((null==(e=null==oe?void 0:oe.latitude)?void 0:e.toString())||"0"),Qe((null==(t=null==oe?void 0:oe.longitude)?void 0:t.toString())||"0"),et((null==(s=null==oe?void 0:oe.send_advert_interval_hours)?void 0:s.toString())||"0"),rt(null),Ue(!0)},[ue,oe]),Js=e.useCallback(()=>{Ue(!1),rt(null)},[]);e.useEffect(()=>{if(!Ye)return;const e=e=>{"loading"!==tt&<.current&&!lt.current.contains(e.target)&&Js()};return document.addEventListener("mouseup",e),()=>document.removeEventListener("mouseup",e)},[Ye,Js,tt]);const Ws=async()=>{var e;if("loading"===wt)return;const t=(null==Nt?void 0:Nt.cors_enabled)??!1,s=!t,a=t;_t.current&&clearTimeout(_t.current),Tt.current&&clearTimeout(Tt.current),Ft.current=!1,St(s),kt("loading"),_t.current=setTimeout(()=>{Ft.current||bt.current&&(St(a),kt("error"),Tt.current=setTimeout(()=>{bt.current&&(kt("idle"),St(null))},2e3))},1e4);try{const t=await B({web:{cors_enabled:s}});if(Ft.current=!0,_t.current&&clearTimeout(_t.current),!bt.current)return;t.success||(null==(e=t.data)?void 0:e.persisted)?(await le(),kt("success"),Tt.current=setTimeout(()=>{bt.current&&(kt("idle"),St(null))},2e3)):(St(a),kt("error"),Tt.current=setTimeout(()=>{bt.current&&(kt("idle"),St(null))},2e3))}catch{if(Ft.current=!0,_t.current&&clearTimeout(_t.current),!bt.current)return;St(a),kt("error"),Tt.current=setTimeout(()=>{bt.current&&(kt("idle"),St(null))},2e3)}};e.useEffect(()=>{(async()=>{Ps(!0);try{const e=await async function(){return r("/api/check_pymc_console")}();e.success&&e.data?Ls(e.data.exists):Ls(!1);const t=null==Nt?void 0:Nt.web_path;Fs(!t||""===t)}catch{Ls(!1)}finally{Ps(!1)}})()},[null==Nt?void 0:Nt.web_path]);const Gs=async e=>{var t;if("loading"!==Rs){zs("loading");try{const s=await B({web:{web_path:e?null:"/opt/pymc_console/web/html"}});if(!bt.current)return;s.success||(null==(t=s.data)?void 0:t.persisted)?(Fs(e),zs("success"),As(!0),setTimeout(()=>{bt.current&&zs("idle")},2e3)):(zs("error"),setTimeout(()=>{bt.current&&zs("idle")},2e3))}catch{if(!bt.current)return;zs("error"),setTimeout(()=>{bt.current&&zs("idle")},2e3)}}},Qs=e.useCallback(async()=>{Pt(!0),zt(null);try{const e=await async function(){return r("/auth/tokens")}();Lt(e.tokens||[])}catch(e){zt(e instanceof Error?e.message:"Failed to fetch tokens")}finally{Pt(!1)}},[]);e.useEffect(()=>{Qs()},[Qs]);const Zs=async()=>{if(It.trim()){Bt(!0),zt(null);try{const e=await async function(e){return r("/auth/tokens",{method:"POST",body:JSON.stringify({name:e})})}(It.trim());Kt(e.token||null),At(!1),Vt(!0),Ot(""),await Qs()}catch(e){zt(e instanceof Error?e.message:"Failed to create token")}finally{Bt(!1)}}else zt("Token name is required")},ea=e=>e?new Date(1e3*e).toLocaleString():"Never",ta=e.useCallback(e=>{const t=new Map,s=[];return e.forEach(e=>{const s={id:e.id,name:e.name,floodPolicy:e.flood_policy,transport_key:e.transport_key,last_used:e.last_used,parent_id:e.parent_id,children:[]};t.set(e.id,s)}),t.forEach(e=>{e.parent_id&&t.has(e.parent_id)?t.get(e.parent_id).children.push(e):s.push(e)}),s},[]),sa=e.useCallback(async()=>{ts(!0),as(null);try{const e=await async function(){return r("/api/transport_keys")}();e.success&&e.data?Zt(ta(e.data)):as(e.error||"Failed to load transport keys")}catch(e){as(e instanceof Error?e.message:"Unknown error occurred")}finally{ts(!1)}},[ta]);e.useEffect(()=>{sa()},[sa]);const aa=e.useCallback((e,t)=>{for(const s of e){if(s.id===t)return s;if(s.children){const e=aa(s.children,t);if(e)return e}}return null},[]),ra=e.useCallback(()=>{if(!is)return;const e=aa(Qt,is);return null==e?void 0:e.name},[is,Qt,aa]),la=e.useCallback(e=>{us(t=>{const s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},[]),na=async e=>{cs(!0),as(null);try{const t=await async function(e){return r("/api/global_flood_policy",{method:"POST",body:JSON.stringify({global_flood_allow:e})})}("allow"===e);t.success?ls(e):as(t.error||"Failed to update global flood policy")}catch(t){as(t instanceof Error?t.message:"Failed to update global flood policy")}finally{cs(!1)}},ca=async()=>{if(Ns.trim()){_s(!0),as(null);try{const e=await async function(e){return r("/api/transport_keys",{method:"POST",body:JSON.stringify(e)})}({name:Ns.trim(),flood_policy:ks,parent_id:is??void 0});e.success?(await sa(),xs(!1),ws(""),Cs("deny")):as(e.error||"Failed to add transport key")}catch(e){as(e instanceof Error?e.message:"Failed to add transport key")}finally{_s(!1)}}else as("Key name is required")},ia=e.useCallback(()=>{if(!is)return;const e=aa(Qt,is);e&&(fs({...e}),bs(!0))},[is,Qt,aa]);e.useEffect(()=>{const e=e=>{"Escape"===e.key&&(ms&&(xs(!1),ws(""),Cs("deny")),ps&&(bs(!1),fs(null)),hs&&(ys(!1),vs(null)),Dt&&(At(!1),Ot("")),Ht&&(Vt(!1),Kt(null)))};if(ms||ps||hs||Dt||Ht)return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[ms,ps,hs,Dt,Ht]);const oa=e.useCallback(()=>{if(!is)return;const e=aa(Qt,is);e&&(vs(e),ys(!0))},[is,Qt,aa]);return t.jsxs(k,{children:[t.jsx(C,{title:"Configuration",icon:t.jsx(u,{})}),t.jsxs(E,{template:"standard",children:[t.jsx(L,{span:12,md:6,children:t.jsx(w,{children:t.jsxs("div",{ref:lt,children:[t.jsxs("div",{className:"flex items-center justify-between mb-4",children:[t.jsxs("h2",{className:"type-subheading text-text-primary flex items-center gap-2",children:[t.jsx(m,{className:"icon-md text-accent-primary"}),"Repeater Settings"]}),t.jsx("div",{className:"flex items-center gap-1",children:oe&&(Ye?t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:Js,disabled:"loading"===tt,className:s("p-2 rounded-lg transition-colors","loading"===tt?"text-text-muted cursor-not-allowed":"text-text-muted hover:text-accent-danger hover:bg-accent-danger/10"),title:"Cancel",children:t.jsx(o,{className:"w-4 h-4"})}),t.jsx("button",{onClick:async()=>{if("loading"!==tt){nt.current&&clearTimeout(nt.current),ne(se),st("loading"),rt(null);try{const e={};Be&&Be!==ue&&(e.node_name=Be);const t=parseFloat(Je);isNaN(t)||t===(null==oe?void 0:oe.latitude)||(e.latitude=t);const s=parseFloat(Ge);isNaN(s)||s===(null==oe?void 0:oe.longitude)||(e.longitude=s);const a=parseInt(Ze);if(isNaN(a)||a===(null==oe?void 0:oe.send_advert_interval_hours)||(e.flood_advert_interval_hours=a),0===Object.keys(e).length)return rt({success:!0,message:"No changes to save"}),st("idle"),void ce(se);const r=await y(e);if(!bt.current)return void ce(se);if(r.success&&r.data){const e=r.data.applied.join(", ");rt({success:!0,message:`Updated: ${e}`}),await le({force:!0}),st("success"),nt.current=setTimeout(()=>{bt.current&&(st("idle"),Ue(!1),rt(null),ce(se))},1500)}else rt({success:!1,message:r.error||"Failed to save"}),st("error"),ce(se),nt.current=setTimeout(()=>{bt.current&&st("idle")},2e3)}catch(e){if(!bt.current)return void ce(se);rt({success:!1,message:String(e)}),st("error"),ce(se),nt.current=setTimeout(()=>{bt.current&&st("idle")},2e3)}}},disabled:"loading"===tt,className:s("p-2 rounded-lg transition-colors","loading"===tt?"text-accent-primary cursor-wait":"success"===tt?"text-accent-success":"error"===tt?"text-accent-danger":"text-accent-success hover:bg-accent-success/10"),title:"Save changes",children:"loading"===tt?t.jsx(_,{className:"w-4 h-4 animate-spin"}):"success"===tt?t.jsx(T,{className:"w-4 h-4"}):"error"===tt?t.jsx(o,{className:"w-4 h-4"}):t.jsx(T,{className:"w-4 h-4"})})]}):t.jsx("button",{onClick:Xs,className:"p-2 rounded-lg transition-colors text-text-muted hover:text-text-primary hover:bg-bg-subtle",title:"Edit repeater settings",children:t.jsx(V,{className:"w-4 h-4"})}))})]}),at&&t.jsx("div",{className:s("text-xs mb-3 px-2 py-1.5 rounded-md",at.success?"text-accent-success bg-accent-success/10":"text-accent-danger bg-accent-danger/10"),children:at.message}),oe?t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"col-span-2",children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:"Node Name"}),t.jsx("div",{className:s("h-[38px] rounded-full px-4 flex items-center transition-colors",Ye?"bg-subtle-fill-hover":"bg-subtle-fill"),children:Ye?t.jsx("input",{type:"text",value:Be,onChange:e=>Xe(e.target.value),maxLength:50,className:"w-full bg-transparent text-text-primary focus:outline-none type-data",placeholder:"Enter node name"}):t.jsx("span",{className:"type-data text-text-primary",children:ue})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:Ye?"Latitude (°)":"Latitude"}),t.jsx("div",{className:s("h-[38px] rounded-full px-4 flex items-center transition-colors",Ye?"bg-subtle-fill-hover":"bg-subtle-fill"),children:Ye?t.jsx("input",{type:"number",value:Je,onChange:e=>We(e.target.value),step:"0.000001",min:"-90",max:"90",className:"w-full bg-transparent text-text-primary focus:outline-none type-data"}):t.jsx("span",{className:"type-data text-text-primary",children:0!==oe.latitude?oe.latitude.toFixed(6):"Not set"})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:Ye?"Longitude (°)":"Longitude"}),t.jsx("div",{className:s("h-[38px] rounded-full px-4 flex items-center transition-colors",Ye?"bg-subtle-fill-hover":"bg-subtle-fill"),children:Ye?t.jsx("input",{type:"number",value:Ge,onChange:e=>Qe(e.target.value),step:"0.000001",min:"-180",max:"180",className:"w-full bg-transparent text-text-primary focus:outline-none type-data"}):t.jsx("span",{className:"type-data text-text-primary",children:0!==oe.longitude?oe.longitude.toFixed(6):"Not set"})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:Ye?"Advert Interval (hours)":"Advert Interval"}),t.jsx("div",{className:s("h-[38px] rounded-full px-4 flex items-center transition-colors",Ye?"bg-subtle-fill-hover":"bg-subtle-fill"),children:Ye?t.jsx("input",{type:"number",value:Ze,onChange:e=>et(e.target.value),min:"0",max:"48",className:"w-full bg-transparent text-text-primary focus:outline-none type-data"}):t.jsx("span",{className:"type-data text-text-primary",children:oe.send_advert_interval_hours>0?`${oe.send_advert_interval_hours}h`:"Disabled"})}),Ye&&t.jsx("p",{className:"type-data-xs text-text-muted mt-1 ml-4",children:"0 = disabled, 3-48 hours"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:"Score-based TX"}),t.jsx("div",{className:"h-[38px] rounded-full px-4 flex items-center bg-subtle-fill",children:t.jsx("span",{className:"type-data text-text-primary",children:oe.use_score_for_tx?"Enabled":"Disabled"})})]})]}):t.jsx("p",{className:"text-text-muted",children:"Loading repeater settings..."})]})})}),t.jsx(L,{span:12,md:6,children:t.jsx(w,{children:t.jsxs("div",{ref:Le,children:[t.jsxs("div",{className:"flex items-center justify-between mb-4",children:[t.jsxs("h2",{className:"type-subheading text-text-primary flex items-center gap-2",children:[t.jsx(A,{className:"icon-md text-accent-primary"}),"Radio Configuration"]}),t.jsx("div",{className:"flex items-center gap-1",children:ie&&(be?t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:Hs,disabled:"loading"===_e,className:s("p-2 rounded-lg transition-colors","loading"===_e?"text-text-muted cursor-not-allowed":"text-text-muted hover:text-accent-danger hover:bg-accent-danger/10"),title:"Cancel",children:t.jsx(o,{className:"w-4 h-4"})}),t.jsx("button",{onClick:async()=>{if("loading"!==_e){Me.current&&clearTimeout(Me.current),ne(te),Te("loading"),Ee(null);try{const e={},t=parseFloat(ye),s=ie?ie.frequency/1e6:0;Math.abs(t-s)>1e-4&&(e.frequency_mhz=t);const a=ie?ie.bandwidth/1e3:0;fe!==a&&(e.bandwidth_khz=fe),ve!==(null==ie?void 0:ie.spreading_factor)&&(e.spreading_factor=ve),we!==(null==ie?void 0:ie.coding_rate)&&(e.coding_rate=we);const r=parseInt(Ce);if(r!==(null==ie?void 0:ie.tx_power)&&(e.tx_power=r),0===Object.keys(e).length)return Ee({success:!0,message:"No changes to save"}),Te("idle"),void ce(te);const l=await y(e);if(!bt.current)return void ce(te);if(l.success&&l.data){const e=l.data.applied.join(", "),t=l.data.live_update?" (applied live)":" (restart required)";Ee({success:!0,message:`Updated: ${e}${t}`}),await le({force:!0}),Te("success"),Me.current=setTimeout(()=>{bt.current&&(Te("idle"),he(!1),Ee(null),ce(te))},1500)}else Ee({success:!1,message:l.error||"Failed to save"}),Te("error"),ce(te),Me.current=setTimeout(()=>{bt.current&&Te("idle")},2e3)}catch(e){if(!bt.current)return void ce(te);Ee({success:!1,message:String(e)}),Te("error"),ce(te),Me.current=setTimeout(()=>{bt.current&&Te("idle")},2e3)}}},disabled:"loading"===_e||!Ks,className:s("p-2 rounded-lg transition-colors","loading"===_e?"text-accent-primary cursor-wait":"success"===_e?"text-accent-success":"error"===_e?"text-accent-danger":Ks?"text-accent-success hover:bg-accent-success/10":"text-text-muted cursor-not-allowed"),title:Ks?"Save changes":"No changes to save",children:"loading"===_e?t.jsx(_,{className:"w-4 h-4 animate-spin"}):"success"===_e?t.jsx(T,{className:"w-4 h-4"}):"error"===_e?t.jsx(o,{className:"w-4 h-4"}):t.jsx(T,{className:"w-4 h-4"})})]}):t.jsx("button",{onClick:()=>{ie&&(ge((ie.frequency/1e6).toFixed(3)),je(ie.bandwidth/1e3),Ne(ie.spreading_factor),ke(ie.coding_rate),Se(String(ie.tx_power))),Ee(null),he(!0)},className:"p-2 rounded-lg transition-colors text-text-muted hover:text-text-primary hover:bg-bg-subtle",title:"Edit radio settings",children:t.jsx(V,{className:"w-4 h-4"})}))})]}),Fe&&t.jsx("div",{className:s("text-xs mb-3 px-2 py-1.5 rounded-md",Fe.success?"text-accent-success bg-accent-success/10":"text-accent-danger bg-accent-danger/10"),children:Fe.message}),ie?t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:be?"Frequency (MHz)":"Frequency"}),t.jsx("div",{className:s("h-[38px] rounded-full px-4 flex items-center transition-colors",be?"bg-subtle-fill-hover":"bg-subtle-fill"),children:be?t.jsx("input",{type:"number",value:ye,onChange:e=>ge(e.target.value),step:"0.001",min:"400",max:"930",className:"w-full bg-transparent text-text-primary focus:outline-none type-data"}):t.jsx("span",{className:"type-data text-text-primary",children:x(ie.frequency)})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:be?"TX Power (dBm)":"TX Power"}),t.jsx("div",{className:s("h-[38px] rounded-full px-4 flex items-center transition-colors",be?"bg-subtle-fill-hover":"bg-subtle-fill"),children:be?t.jsx("input",{type:"number",value:Ce,onChange:e=>Se(e.target.value),min:"-9",max:"22",className:"w-full bg-transparent text-text-primary focus:outline-none type-data"}):t.jsxs("span",{className:"type-data text-text-primary",children:[ie.tx_power," dBm"]})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:"Bandwidth"}),t.jsx("div",{className:s("h-[38px] rounded-full px-4 flex items-center transition-colors relative",be?"bg-subtle-fill-hover":"bg-subtle-fill"),children:be?t.jsxs(t.Fragment,{children:[t.jsx("select",{value:fe,onChange:e=>je(parseFloat(e.target.value)),className:"w-full bg-transparent text-text-primary focus:outline-none appearance-none cursor-pointer type-data pr-6",children:Q.map(e=>t.jsx("option",{value:e.value,children:e.label},e.value))}),t.jsx(p,{className:"absolute right-4 top-1/2 -translate-y-1/2 w-4 h-4 text-text-muted pointer-events-none"})]}):t.jsx("span",{className:"type-data text-text-primary",children:b(ie.bandwidth)})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:"Spreading Factor"}),t.jsx("div",{className:s("h-[38px] rounded-full px-4 flex items-center transition-colors relative",be?"bg-subtle-fill-hover":"bg-subtle-fill"),children:be?t.jsxs(t.Fragment,{children:[t.jsx("select",{value:ve,onChange:e=>Ne(parseInt(e.target.value)),className:"w-full bg-transparent text-text-primary focus:outline-none appearance-none cursor-pointer type-data pr-6",children:Z.map(e=>t.jsxs("option",{value:e,children:["SF",e]},e))}),t.jsx(p,{className:"absolute right-4 top-1/2 -translate-y-1/2 w-4 h-4 text-text-muted pointer-events-none"})]}):t.jsxs("span",{className:"type-data text-text-primary",children:["SF",ie.spreading_factor]})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:"Coding Rate"}),t.jsx("div",{className:s("h-[38px] rounded-full px-4 flex items-center transition-colors relative",be?"bg-subtle-fill-hover":"bg-subtle-fill"),children:be?t.jsxs(t.Fragment,{children:[t.jsx("select",{value:we,onChange:e=>ke(parseInt(e.target.value)),className:"w-full bg-transparent text-text-primary focus:outline-none appearance-none cursor-pointer type-data pr-6",children:ee.map(e=>t.jsx("option",{value:e.value,children:e.label},e.value))}),t.jsx(p,{className:"absolute right-4 top-1/2 -translate-y-1/2 w-4 h-4 text-text-muted pointer-events-none"})]}):t.jsxs("span",{className:"type-data text-text-primary",children:["4/",ie.coding_rate]})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:"Preamble"}),t.jsx("div",{className:"h-[38px] rounded-full px-4 flex items-center bg-subtle-fill",children:t.jsxs("span",{className:"type-data text-text-primary",children:[ie.preamble_length," symbols"]})})]})]}):t.jsx("p",{className:"text-text-muted",children:"Loading radio configuration..."})]})})})]}),t.jsxs(E,{template:"standard",children:[t.jsx(L,{span:12,md:6,children:t.jsx(w,{children:t.jsxs("div",{ref:$e,children:[t.jsxs("div",{className:"flex items-center justify-between mb-3",children:[t.jsxs("h2",{className:"type-subheading text-text-primary flex items-center gap-3",children:[t.jsx(h,{className:"icon-md text-icon-card-title"}),"Operating Mode"]}),t.jsx("div",{className:"flex items-center gap-1",children:Pe?t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:async()=>{if("loading"!==Ke){Ve.current&&clearTimeout(Ve.current),ne(ae),He("loading");try{const e=await y({tx_delay_factor:parseFloat(ze),direct_tx_delay_factor:parseFloat(Ae)});if(await X({max_airtime_percent:parseFloat(Oe),enforcement_enabled:xe}),!bt.current)return void ce(ae);e.success&&e.data?(await le({force:!0}),He("success"),Ve.current=setTimeout(()=>{bt.current&&(He("idle"),Re(!1),ce(ae))},1500)):(He("error"),ce(ae),Ve.current=setTimeout(()=>{bt.current&&He("idle")},2e3))}catch{if(!bt.current)return void ce(ae);He("error"),ce(ae),Ve.current=setTimeout(()=>{bt.current&&He("idle")},2e3)}}},disabled:"loading"===Ke,className:s("p-2 rounded-lg transition-colors","loading"===Ke?"text-accent-primary cursor-wait":"success"===Ke?"text-accent-success":"error"===Ke?"text-accent-danger":"text-accent-success hover:bg-accent-success/10"),title:"Save",children:"loading"===Ke?t.jsx(_,{className:"w-4 h-4 animate-spin"}):"success"===Ke?t.jsx(T,{className:"w-4 h-4"}):"error"===Ke?t.jsx(o,{className:"w-4 h-4"}):t.jsx(T,{className:"w-4 h-4"})}),t.jsx("button",{onClick:Bs,className:"p-2 rounded-lg text-text-muted hover:text-accent-danger hover:bg-accent-danger/10",title:"Cancel",children:t.jsx(o,{className:"w-4 h-4"})})]}):t.jsx("button",{onClick:Us,className:"p-2 rounded-lg transition-colors text-text-muted hover:text-text-primary hover:bg-bg-subtle",title:"Edit settings",children:t.jsx(V,{className:"w-4 h-4"})})})]}),t.jsx("p",{className:"type-label text-text-muted mb-3",children:"Control how the repeater handles packets"}),t.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[t.jsxs("div",{className:"flex-1 space-y-4",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("label",{className:"type-label text-text-muted",children:"Repeat"}),t.jsx("div",{className:"flex items-center gap-2",children:(()=>{const e=null!==ut?ut:"forward"===me;return t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:async()=>{if("loading"===ct)return;const t=!e,s="forward"===me;ht.current&&clearTimeout(ht.current),yt.current&&clearTimeout(yt.current),jt.current=!1,mt(t),it("loading"),ht.current=setTimeout(()=>{jt.current||bt.current&&(mt(s),it("error"),yt.current=setTimeout(()=>{bt.current&&(it("idle"),mt(null))},2e3))},1e4);try{if(await O(t?"forward":"monitor"),jt.current=!0,ht.current&&clearTimeout(ht.current),!bt.current)return;it("success"),yt.current=setTimeout(()=>{bt.current&&(it("idle"),mt(null),U())},2e3)}catch{if(jt.current=!0,ht.current&&clearTimeout(ht.current),!bt.current)return;mt(s),it("error"),yt.current=setTimeout(()=>{bt.current&&(it("idle"),mt(null))},2e3)}},disabled:"loading"===ct,className:s("relative inline-flex h-6 w-11 items-center rounded-full transition-colors border-2",e?"bg-toggle-on border-toggle-on":"bg-toggle-off border-border-subtle","loading"===ct&&"opacity-70"),"aria-label":"Toggle forward mode",children:t.jsx("span",{className:s("inline-block h-4 w-4 transform rounded-full bg-white transition-transform shadow-lg",e?"translate-x-5":"translate-x-0.5")})}),t.jsx("span",{className:s("type-data text-sm w-7",e?"text-accent-success":"text-text-muted"),children:e?"On":"Off"}),"loading"===ct&&t.jsx(_,{className:"w-4 h-4 text-text-muted animate-spin"}),"success"===ct&&t.jsx(T,{className:"w-4 h-4 text-accent-success"}),"error"===ct&&t.jsx(o,{className:"w-4 h-4 text-accent-danger"})]})})()})]}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("label",{className:"type-label text-text-muted",children:"Duty Cycle"}),t.jsx("div",{className:"flex items-center gap-2",children:(()=>{const e=null!==xt?xt:xe;return t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:async()=>{if("loading"===ot)return;const t=!e,s=xe;gt.current&&clearTimeout(gt.current),ft.current&&clearTimeout(ft.current),vt.current=!1,pt(t),dt("loading"),gt.current=setTimeout(()=>{vt.current||bt.current&&(pt(s),dt("error"),ft.current=setTimeout(()=>{bt.current&&(dt("idle"),pt(null))},2e3))},1e4);try{if(await X({max_airtime_percent:Ys(),enforcement_enabled:t}),vt.current=!0,gt.current&&clearTimeout(gt.current),!bt.current)return;dt("success"),ft.current=setTimeout(()=>{bt.current&&(dt("idle"),pt(null),J())},2e3)}catch{if(vt.current=!0,gt.current&&clearTimeout(gt.current),!bt.current)return;pt(s),dt("error"),ft.current=setTimeout(()=>{bt.current&&(dt("idle"),pt(null))},2e3)}},disabled:"loading"===ot,className:s("relative inline-flex h-6 w-11 items-center rounded-full transition-colors border-2",e?"bg-toggle-on border-toggle-on":"bg-toggle-off border-border-subtle","loading"===ot&&"opacity-70"),"aria-label":"Toggle duty cycle",children:t.jsx("span",{className:s("inline-block h-4 w-4 transform rounded-full bg-white transition-transform shadow-lg",e?"translate-x-5":"translate-x-0.5")})}),t.jsx("span",{className:s("type-data text-sm w-7",e?"text-accent-success":"text-text-muted"),children:e?"On":"Off"}),"loading"===ot&&t.jsx(_,{className:"w-4 h-4 text-text-muted animate-spin"}),"success"===ot&&t.jsx(T,{className:"w-4 h-4 text-accent-success"}),"error"===ot&&t.jsx(o,{className:"w-4 h-4 text-accent-danger"})]})})()})]}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("label",{className:"type-label text-text-muted",children:"Max Airtime"}),t.jsx("div",{className:s("h-[32px] rounded-full px-3 flex items-center justify-end transition-colors min-w-[80px]",Pe?"bg-subtle-fill-hover":"bg-subtle-fill"),children:Pe?t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("input",{type:"number",value:Oe,onChange:e=>qe(e.target.value),step:"0.5",min:"0.1",max:"100",className:"w-12 bg-transparent text-text-primary text-right focus:outline-none type-data"}),t.jsx("span",{className:"text-text-muted type-data",children:"%"})]}):t.jsxs("span",{className:"type-data text-text-primary",children:[Ys().toFixed(1),"%"]})})]})]}),t.jsx("div",{className:"hidden sm:block w-px bg-border-subtle"}),t.jsxs("div",{className:"flex-1 pt-4 sm:pt-0 border-t sm:border-t-0 border-border-subtle",children:[t.jsx("label",{className:"type-label text-text-muted block mb-3",children:"TX Delays"}),t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"type-label text-text-muted",children:"Flood"}),t.jsx("div",{className:s("h-[32px] rounded-full px-3 flex items-center justify-end transition-colors min-w-[80px]",Pe?"bg-subtle-fill-hover":"bg-subtle-fill"),children:Pe?t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("input",{type:"number",value:ze,onChange:e=>De(e.target.value),step:"0.1",min:"0",max:"5",className:"w-12 bg-transparent text-text-primary text-right focus:outline-none type-data"}),t.jsx("span",{className:"text-text-muted type-data",children:"x"})]}):t.jsxs("span",{className:"type-data text-text-primary",children:[Vs().toFixed(2),"x"]})})]}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"type-label text-text-muted",children:"Direct"}),t.jsx("div",{className:s("h-[32px] rounded-full px-3 flex items-center justify-end transition-colors min-w-[80px]",Pe?"bg-subtle-fill-hover":"bg-subtle-fill"),children:Pe?t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("input",{type:"number",value:Ae,onChange:e=>Ie(e.target.value),step:"0.1",min:"0",max:"5",className:"w-12 bg-transparent text-text-primary text-right focus:outline-none type-data"}),t.jsx("span",{className:"text-text-muted type-data",children:"s"})]}):t.jsxs("span",{className:"type-data text-text-primary",children:[$s().toFixed(2),"s"]})})]})]})]})]})]})})}),t.jsx(L,{span:12,md:6,children:t.jsxs(w,{children:[t.jsx(S,{icon:t.jsx(u,{}),title:"App Settings",largeTitle:!0}),t.jsx("p",{className:"type-body-sm text-text-muted mb-4",children:"Appearance and web server options."}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsxs("div",{children:[t.jsx("span",{className:"type-body text-text-primary font-medium block",children:"Enable CORS"}),t.jsx("span",{className:"type-body-sm text-text-muted",children:"Allow cross-origin API access"})]}),t.jsx("div",{className:"flex items-center gap-2",children:(()=>{const e=null!==Ct?Ct:(null==Nt?void 0:Nt.cors_enabled)??!1;return t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:Ws,disabled:"loading"===wt,className:s("relative inline-flex h-6 w-11 items-center rounded-full transition-colors border-2",e?"bg-toggle-on border-toggle-on":"bg-toggle-off border-border-subtle","loading"===wt&&"opacity-70"),title:e?"Disable CORS":"Enable CORS",children:t.jsx("span",{className:s("inline-block h-4 w-4 transform rounded-full bg-white transition-transform shadow-lg",e?"translate-x-5":"translate-x-0.5")})}),"loading"===wt&&t.jsx(_,{className:"w-4 h-4 text-text-muted animate-spin"}),"success"===wt&&t.jsx(T,{className:"w-4 h-4 text-accent-success"}),"error"===wt&&t.jsx(o,{className:"w-4 h-4 text-accent-danger"})]})})()})]}),t.jsx("div",{children:t.jsx(W,{})})]})]})})]}),t.jsx(E,{template:"auto",children:t.jsxs(w,{children:[t.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 mb-4",children:[t.jsxs("div",{children:[t.jsxs("h2",{className:"type-heading text-text-primary flex items-center gap-2",children:[t.jsx(q,{className:"icon-md text-accent-primary"}),"Regions / Transport Keys"]}),t.jsx("p",{className:"type-body-sm text-text-muted mt-1",children:"Manage regional key hierarchy for flood control"})]}),t.jsxs("div",{className:"flex gap-2 flex-wrap",children:[t.jsxs("button",{onClick:()=>xs(!0),disabled:"allow"===rs,className:s("flex items-center gap-1.5 h-[32px] px-3 rounded-full transition-colors type-body-sm font-medium","allow"===rs?"bg-subtle-fill text-text-muted cursor-not-allowed":"bg-accent-success/10 hover:bg-accent-success/20 text-accent-success"),children:[t.jsx(f,{className:"w-3.5 h-3.5"}),"Add"]}),t.jsx("button",{onClick:ia,disabled:!is||"allow"===rs,className:s("h-[32px] px-3 rounded-full transition-colors type-body-sm font-medium",is&&"allow"!==rs?"bg-accent-primary/10 hover:bg-accent-primary/20 text-accent-primary":"bg-subtle-fill text-text-muted cursor-not-allowed"),children:"Edit"}),t.jsx("button",{onClick:oa,disabled:!is||"allow"===rs,className:s("h-[32px] px-3 rounded-full transition-colors type-body-sm font-medium",is&&"allow"!==rs?"bg-accent-danger/10 hover:bg-accent-danger/20 text-accent-danger":"bg-subtle-fill text-text-muted cursor-not-allowed"),children:"Delete"})]})]}),t.jsx("div",{className:"bg-subtle-fill rounded-2xl p-4 mb-4",children:t.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:s("w-10 h-10 rounded-full flex items-center justify-center","allow"===rs?"bg-accent-success/20":"bg-accent-danger/20"),children:"allow"===rs?t.jsx($,{className:"w-5 h-5 text-accent-success"}):t.jsx(Y,{className:"w-5 h-5 text-accent-danger"})}),t.jsxs("div",{children:[t.jsx("h4",{className:"type-body text-text-primary font-medium",children:"Global Flood Policy"}),t.jsx("p",{className:"type-body-sm text-text-muted",children:"Master control for repeater flooding"})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("div",{className:"flex bg-subtle-fill rounded-full p-1",children:[t.jsx("button",{onClick:()=>na("deny"),disabled:ns,className:s("px-4 py-1.5 rounded-full transition-colors type-body-sm font-medium","deny"===rs?"bg-accent-danger/20 text-accent-danger":"text-text-muted hover:text-text-secondary",ns&&"opacity-50"),children:"Deny"}),t.jsx("button",{onClick:()=>na("allow"),disabled:ns,className:s("px-4 py-1.5 rounded-full transition-colors type-body-sm font-medium","allow"===rs?"bg-accent-success/20 text-accent-success":"text-text-muted hover:text-text-secondary",ns&&"opacity-50"),children:"Allow"})]}),ns&&t.jsx(_,{className:"w-4 h-4 animate-spin text-text-muted"})]})]})}),ss&&t.jsx("div",{className:"type-body-sm mb-3 px-3 py-2 rounded-full text-accent-danger bg-accent-danger/10",children:ss}),t.jsx("div",{className:"bg-subtle-fill rounded-2xl p-4 min-h-[120px]",children:es?t.jsxs("div",{className:"flex items-center justify-center py-6",children:[t.jsx(_,{className:"w-5 h-5 animate-spin text-accent-primary mr-2"}),t.jsx("span",{className:"type-body-sm text-text-muted",children:"Loading transport keys..."})]}):0===Qt.length?t.jsxs("div",{className:"text-center py-6",children:[t.jsx("div",{className:"w-12 h-12 rounded-full bg-subtle-fill mx-auto mb-3 flex items-center justify-center",children:t.jsx(q,{className:"w-6 h-6 text-text-muted/50"})}),t.jsx("p",{className:"type-body text-text-muted",children:"No transport keys found"}),t.jsx("p",{className:"type-body-sm text-text-muted/70 mt-1",children:"Add your first transport key to get started"})]}):t.jsx("div",{className:"space-y-1",children:Qt.map(e=>t.jsx(re,{node:e,level:0,expandedKeys:ds,selectedKeyId:is,globalFloodPolicy:rs,onSelect:os,onToggle:la},e.id))})})]})}),t.jsx(E,{template:"auto",children:t.jsxs(w,{children:[t.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 mb-4",children:[t.jsxs("div",{children:[t.jsxs("h2",{className:"type-heading text-text-primary flex items-center gap-2",children:[t.jsx(K,{className:"icon-md text-accent-primary"}),"API Tokens"]}),t.jsx("p",{className:"type-body-sm text-text-muted mt-1",children:"Manage API tokens for machine-to-machine authentication"})]}),t.jsxs("button",{onClick:()=>At(!0),className:"flex items-center justify-center gap-2 h-[32px] px-4 bg-accent-primary/10 hover:bg-accent-primary/20 text-accent-primary rounded-full transition-colors type-body-sm font-medium",children:[t.jsx(f,{className:"w-4 h-4"}),"Create Token"]})]}),t.jsx("div",{className:"bg-accent-tertiary/5 rounded-2xl p-4 mb-4",children:t.jsxs("div",{className:"flex gap-3",children:[t.jsx("div",{className:"w-8 h-8 rounded-full bg-accent-tertiary/20 flex items-center justify-center flex-shrink-0",children:t.jsx(F,{className:"w-4 h-4 text-accent-tertiary"})}),t.jsxs("div",{className:"type-body-sm text-text-muted",children:[t.jsxs("p",{children:[t.jsx("span",{className:"text-text-secondary",children:"API tokens"})," are used for machine-to-machine authentication. Include the token in the ",t.jsx("code",{className:"type-code bg-accent-tertiary/20 px-1.5 py-0.5 rounded-full text-accent-tertiary",children:"X-API-Key"})," header when making API requests."]}),t.jsx("p",{className:"mt-1 text-text-muted/70",children:"Tokens are only shown once at creation. Store them securely."})]})]})}),Rt&&t.jsx("div",{className:"type-body-sm mb-3 px-3 py-2 rounded-full text-accent-danger bg-accent-danger/10",children:Rt}),Mt&&0===Et.length?t.jsxs("div",{className:"flex items-center justify-center py-6",children:[t.jsx(_,{className:"w-5 h-5 animate-spin text-accent-primary mr-2"}),t.jsx("span",{className:"type-body-sm text-text-muted",children:"Loading tokens..."})]}):Et.length>0?t.jsx("div",{className:"space-y-2",children:Et.map(e=>t.jsx("div",{className:"bg-subtle-fill hover:bg-subtle-fill-strong rounded-2xl p-4 transition-colors",children:t.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[t.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[t.jsx("div",{className:"w-10 h-10 rounded-full bg-accent-primary/10 flex items-center justify-center flex-shrink-0",children:t.jsx(K,{className:"w-5 h-5 text-accent-primary"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("h3",{className:"type-body text-text-primary font-medium truncate",children:e.name}),t.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:gap-4 mt-0.5",children:[t.jsxs("span",{className:"type-data-sm text-text-muted truncate",children:["Created: ",ea(e.created_at)]}),t.jsxs("span",{className:"type-data-sm text-text-muted truncate",children:["Last used: ",ea(e.last_used)]})]})]})]}),t.jsxs("button",{onClick:()=>Yt({id:e.id,name:e.name}),disabled:Xt,className:"h-[32px] px-4 bg-accent-danger/10 hover:bg-accent-danger/20 text-accent-danger rounded-full transition-colors disabled:opacity-50 type-body-sm font-medium flex items-center justify-center gap-1.5",children:[t.jsx(g,{className:"w-3.5 h-3.5"}),"Revoke"]})]})},e.id))}):t.jsxs("div",{className:"bg-subtle-fill rounded-2xl p-6 text-center",children:[t.jsx("div",{className:"w-14 h-14 rounded-full bg-subtle-fill mx-auto mb-4 flex items-center justify-center",children:t.jsx(K,{className:"w-7 h-7 text-text-muted/50"})}),t.jsx("h3",{className:"type-body text-text-primary font-medium mb-1",children:"No API Tokens"}),t.jsx("p",{className:"type-body-sm text-text-muted mb-4",children:"Create a token to enable API access"}),t.jsx("button",{onClick:()=>At(!0),className:"h-[32px] px-4 bg-accent-primary/10 hover:bg-accent-primary/20 text-accent-primary rounded-full transition-colors type-body-sm font-medium",children:"Create Your First Token"})]})]})}),t.jsx(E,{template:"auto",children:t.jsxs(w,{children:[t.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 mb-4",children:t.jsxs("div",{children:[t.jsxs("h2",{className:"type-heading text-text-primary flex items-center gap-2",children:[t.jsx(H,{className:"icon-md text-accent-primary"}),"Web Frontend"]}),t.jsx("p",{className:"type-body-sm text-text-muted mt-1",children:"Choose which web interface to use"})]})}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-3",children:[t.jsxs("label",{className:s("flex items-start gap-3 p-4 bg-subtle-fill rounded-2xl border-2 cursor-pointer transition-all",Ts?"border-accent-primary bg-accent-primary/5":"border-transparent hover:border-accent-primary/30","loading"===Rs&&"opacity-50 pointer-events-none"),children:[t.jsx("input",{type:"radio",name:"frontend",checked:Ts,onChange:()=>Gs(!0),disabled:"loading"===Rs,className:"mt-1 h-4 w-4 text-accent-primary focus:ring-accent-primary focus:ring-offset-bg-elevated"}),t.jsxs("div",{className:"flex-1",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("div",{className:"type-body text-text-primary font-medium",children:"Default Frontend"}),t.jsx("a",{href:"https://github.com/rightup/pyMC_Repeater",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),className:"type-data-xs bg-accent-tertiary/15 text-accent-tertiary px-2.5 py-0.5 rounded-full font-medium hover:bg-accent-tertiary/25 transition-colors",children:"@RightUp"})]}),t.jsx("div",{className:"type-body-sm text-text-muted mt-1",children:"Built-in pyMC Repeater web interface"}),t.jsx("div",{className:"type-data-xs text-text-muted/60 mt-1 font-mono",children:"/opt/pymc_repeater/repeater/web/html"})]})]}),t.jsxs("label",{className:s("flex items-start gap-3 p-4 bg-subtle-fill rounded-2xl border-2 cursor-pointer transition-all",Ts?"border-transparent hover:border-accent-primary/30":"border-accent-primary bg-accent-primary/5","loading"===Rs&&"opacity-50 pointer-events-none"),children:[t.jsx("input",{type:"radio",name:"frontend",checked:!Ts,onChange:()=>Gs(!1),disabled:"loading"===Rs,className:"mt-1 h-4 w-4 text-accent-primary focus:ring-accent-primary focus:ring-offset-bg-elevated"}),t.jsxs("div",{className:"flex-1",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("div",{className:"type-body text-text-primary font-medium",children:"PyMC Console"}),t.jsx("span",{className:"type-data-xs bg-accent-secondary/15 text-accent-secondary px-2.5 py-0.5 rounded-full font-medium",children:"@Treehouse ⚡"})]}),t.jsx("div",{className:"type-body-sm text-text-muted mt-1",children:"Alternative web interface for pyMC Repeater"}),t.jsx("div",{className:"type-data-xs text-text-muted/60 mt-1 font-mono",children:"/opt/pymc_console/web/html"})]})]})]}),!Ms&&t.jsx("div",{className:s("bg-subtle-fill rounded-2xl p-4",Es?"border border-accent-success/20":"border border-accent-tertiary/20"),children:t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("div",{className:s("w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0",Es?"bg-accent-success/20":"bg-accent-tertiary/20"),children:Es?t.jsx(M,{className:"w-4 h-4 text-accent-success"}):t.jsx(F,{className:"w-4 h-4 text-accent-tertiary"})}),t.jsxs("div",{className:"flex-1",children:[t.jsx("h4",{className:"type-body text-text-primary font-medium",children:Es?"PyMC Console has been detected":"PyMC Console Not Installed"}),Es?t.jsxs("p",{className:"type-body-sm text-text-muted mt-1",children:["PyMC Console is installed at ",t.jsx("code",{className:"type-code bg-accent-success/10 px-1.5 py-0.5 rounded-full text-accent-success",children:"/opt/pymc_console/web/html"})]}):t.jsxs(t.Fragment,{children:[t.jsxs("p",{className:"type-body-sm text-text-muted mt-1 mb-3",children:["PyMC Console must be installed at ",t.jsx("code",{className:"type-code bg-accent-tertiary/10 px-1.5 py-0.5 rounded-full text-accent-tertiary",children:"/opt/pymc_console/web/html"})," before selecting this option."]}),t.jsxs("a",{href:"https://github.com/dmduran12/pymc_console-dist",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 h-[32px] px-4 bg-accent-tertiary/10 hover:bg-accent-tertiary/20 text-accent-tertiary rounded-full type-body-sm font-medium transition-colors",children:[t.jsx(I,{className:"w-4 h-4"}),"PyMC Console Install Instructions"]})]})]})]})}),Ds&&t.jsx("div",{className:"bg-subtle-fill rounded-2xl p-4 border border-accent-secondary/30",children:t.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[t.jsxs("div",{className:"flex items-start gap-3 flex-1",children:[t.jsx("div",{className:"w-8 h-8 rounded-full bg-accent-secondary/20 flex items-center justify-center flex-shrink-0",children:t.jsx(P,{className:"w-4 h-4 text-accent-secondary"})}),t.jsxs("div",{className:"flex-1",children:[t.jsx("h4",{className:"type-body text-text-primary font-medium",children:"Service restart required"}),t.jsx("p",{className:"type-body-sm text-text-muted mt-1",children:"Web frontend changes will take effect after restarting the pymc-repeater service."})]})]}),t.jsx("button",{onClick:async()=>{if(!Is){Os(!0);try{await async function(){return r("/api/restart_service",{method:"POST",body:"{}"})}(),As(!1),setTimeout(()=>{window.location.reload()},2e3)}catch{As(!1),setTimeout(()=>{window.location.reload()},3e3)}}},disabled:Is,className:"h-[32px] px-4 bg-accent-secondary/10 hover:bg-accent-secondary/20 text-accent-secondary rounded-full transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2 whitespace-nowrap type-body-sm font-medium",children:Is?t.jsxs(t.Fragment,{children:[t.jsx(_,{className:"w-4 h-4 animate-spin"}),"Restarting..."]}):t.jsxs(t.Fragment,{children:[t.jsx(R,{className:"w-4 h-4"}),"Restart Now"]})})]})})]})]})}),D&&t.jsx(E,{template:"auto",children:t.jsx(N,{nodeName:ue,repeaterVersion:D.version,coreVersion:D.core_version,localHash:D.local_hash,publicKey:D.public_key})}),D&&(0===(null==oe?void 0:oe.latitude)||!(null==oe?void 0:oe.latitude))&&(0===(null==oe?void 0:oe.longitude)||!(null==oe?void 0:oe.longitude))&&t.jsx(E,{template:"auto",children:t.jsx(G,{})}),Dt&&t.jsx("div",{className:"fixed inset-0 z-[10010] flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:e=>e.target===e.currentTarget&&At(!1),role:"dialog","aria-modal":"true","aria-labelledby":"create-token-modal-title",children:t.jsxs("div",{className:"bg-bg-elevated border border-border-subtle rounded-xl p-6 max-w-md w-full shadow-2xl",children:[t.jsx("h3",{id:"create-token-modal-title",className:"type-subheading text-text-primary mb-4",children:"Create API Token"}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Token Name"}),t.jsx("input",{type:"text",value:It,onChange:e=>Ot(e.target.value),placeholder:"e.g., Production Server, CI/CD Pipeline",className:"w-full px-4 py-2 bg-bg-subtle border border-border-subtle rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:ring-2 focus:ring-accent-primary/50 transition-colors",onKeyDown:e=>"Enter"===e.key&&Zs(),autoFocus:!0}),t.jsx("p",{className:"text-xs text-text-muted mt-1",children:"Give your token a descriptive name to identify its purpose"})]}),t.jsxs("div",{className:"flex justify-end gap-3 mt-6",children:[t.jsx("button",{onClick:()=>{At(!1),Ot(""),zt(null)},disabled:Ut,className:"px-4 py-2 bg-bg-subtle hover:bg-bg-elevated text-text-secondary rounded-lg border border-border-subtle transition-colors disabled:opacity-50",children:"Cancel"}),t.jsx("button",{onClick:Zs,disabled:Ut||!It.trim(),className:"px-4 py-2 bg-accent-primary/20 hover:bg-accent-primary/30 text-text-primary rounded-lg border border-accent-primary/50 transition-colors disabled:opacity-50 flex items-center gap-2",children:Ut?t.jsxs(t.Fragment,{children:[t.jsx(_,{className:"w-4 h-4 animate-spin"}),"Creating..."]}):"Create Token"})]})]})]})}),Ht&&qt&&t.jsx("div",{className:"fixed inset-0 z-[10010] flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:e=>e.target===e.currentTarget&&Vt(!1),role:"dialog","aria-modal":"true","aria-labelledby":"show-token-modal-title",children:t.jsxs("div",{className:"bg-bg-elevated border border-border-subtle rounded-xl p-6 max-w-lg w-full shadow-2xl",children:[t.jsx("h3",{id:"show-token-modal-title",className:"type-subheading text-text-primary mb-4",children:"Token Created Successfully"}),t.jsxs("div",{className:"space-y-4",children:[t.jsx("div",{className:"bg-accent-secondary/10 border border-accent-secondary/30 rounded-lg p-3",children:t.jsxs("div",{className:"flex gap-2",children:[t.jsx(P,{className:"w-4 h-4 text-accent-secondary flex-shrink-0 mt-0.5"}),t.jsxs("div",{className:"text-sm text-text-secondary",children:[t.jsx("strong",{children:"Save this token now!"})," For security reasons, it will not be shown again."]})]})}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Your API Token"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx("input",{value:qt,readOnly:!0,className:"flex-1 px-4 py-2 bg-bg-subtle border border-border-subtle rounded-lg text-text-primary font-mono text-sm"}),t.jsxs("button",{onClick:()=>{qt&&(navigator.clipboard.writeText(qt),Gt(!0),setTimeout(()=>Gt(!1),2e3))},className:"px-4 py-2 bg-accent-primary/20 hover:bg-accent-primary/30 text-text-primary rounded-lg border border-accent-primary/50 transition-colors flex items-center gap-2",title:"Copy to clipboard",children:[Wt?t.jsx(T,{className:"w-4 h-4 text-accent-success"}):t.jsx(z,{className:"w-4 h-4"}),Wt?"Copied!":"Copy"]})]})]}),t.jsxs("div",{className:"bg-accent-tertiary/10 border border-accent-tertiary/30 rounded-lg p-3",children:[t.jsx("p",{className:"text-sm text-text-secondary mb-2",children:t.jsx("strong",{children:"Usage Example:"})}),t.jsxs("code",{className:"block bg-accent-tertiary/20 px-3 py-2 rounded text-xs text-accent-tertiary font-mono overflow-x-auto",children:['curl -H "X-API-Key: ',qt.slice(0,12),'..." ',window.location.origin,"/api/stats"]})]}),t.jsx("div",{className:"flex justify-end mt-6",children:t.jsx("button",{onClick:()=>{Vt(!1),Kt(null)},className:"px-4 py-2 bg-accent-primary/20 hover:bg-accent-primary/30 text-text-primary rounded-lg border border-accent-primary/50 transition-colors",children:"Done"})})]})]})}),t.jsx(j,{isOpen:!!$t,title:"Revoke API Token",message:`Are you sure you want to revoke the token '${null==$t?void 0:$t.name}'? This action cannot be undone.`,confirmLabel:Xt?"Revoking...":"Revoke",cancelLabel:"Cancel",variant:"danger",onConfirm:async()=>{if($t){Jt(!0),zt(null);try{await async function(e){return r(`/auth/tokens/${e}`,{method:"DELETE"})}($t.id),await Qs(),Yt(null)}catch(e){zt(e instanceof Error?e.message:"Failed to revoke token")}finally{Jt(!1)}}},onCancel:()=>Yt(null)}),ms&&t.jsx("div",{className:"fixed inset-0 z-[10010] flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:e=>e.target===e.currentTarget&&xs(!1),role:"dialog","aria-modal":"true","aria-labelledby":"add-key-modal-title",children:t.jsxs("div",{className:"bg-bg-elevated border border-border-subtle rounded-xl p-6 max-w-md w-full shadow-2xl",children:[t.jsx("h3",{id:"add-key-modal-title",className:"type-subheading text-text-primary mb-4",children:"Add Transport Key"}),t.jsxs("div",{className:"space-y-4",children:[is&&t.jsxs("div",{className:"bg-accent-tertiary/10 border border-accent-tertiary/30 rounded-lg p-3 text-sm text-text-secondary",children:["Adding as child of: ",t.jsx("strong",{className:"text-text-primary",children:ra()})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Key Name"}),t.jsx("input",{type:"text",value:Ns,onChange:e=>ws(e.target.value),placeholder:"e.g., Region Name, Group Key",className:"w-full px-4 py-2 bg-bg-subtle border border-border-subtle rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:ring-2 focus:ring-accent-primary/50 transition-colors",onKeyDown:e=>"Enter"===e.key&&ca(),autoFocus:!0})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Flood Policy"}),t.jsxs("div",{className:"flex bg-bg-subtle rounded-lg border border-border-subtle p-1",children:[t.jsx("button",{onClick:()=>Cs("deny"),className:s("flex-1 px-3 py-2 text-sm font-medium rounded transition-colors","deny"===ks?"bg-accent-danger/20 text-accent-danger border border-accent-danger/50":"text-text-muted hover:text-text-secondary"),children:"DENY"}),t.jsx("button",{onClick:()=>Cs("allow"),className:s("flex-1 px-3 py-2 text-sm font-medium rounded transition-colors","allow"===ks?"bg-accent-success/20 text-accent-success border border-accent-success/50":"text-text-muted hover:text-text-secondary"),children:"ALLOW"})]})]}),t.jsxs("div",{className:"flex justify-end gap-3 mt-6",children:[t.jsx("button",{onClick:()=>{xs(!1),ws(""),Cs("deny")},disabled:Ss,className:"px-4 py-2 bg-bg-subtle hover:bg-bg-elevated text-text-secondary rounded-lg border border-border-subtle transition-colors disabled:opacity-50",children:"Cancel"}),t.jsx("button",{onClick:ca,disabled:Ss||!Ns.trim(),className:"px-4 py-2 bg-accent-primary/20 hover:bg-accent-primary/30 text-text-primary rounded-lg border border-accent-primary/50 transition-colors disabled:opacity-50 flex items-center gap-2",children:Ss?t.jsxs(t.Fragment,{children:[t.jsx(_,{className:"w-4 h-4 animate-spin"}),"Adding..."]}):"Add Key"})]})]})]})}),ps&&gs&&t.jsx("div",{className:"fixed inset-0 z-[10010] flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:e=>e.target===e.currentTarget&&bs(!1),role:"dialog","aria-modal":"true","aria-labelledby":"edit-key-modal-title",children:t.jsxs("div",{className:"bg-bg-elevated border border-border-subtle rounded-xl p-6 max-w-md w-full shadow-2xl",children:[t.jsx("h3",{id:"edit-key-modal-title",className:"type-subheading text-text-primary mb-4",children:"Edit Transport Key"}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Key Name"}),t.jsx("input",{type:"text",value:gs.name,onChange:e=>fs({...gs,name:e.target.value}),className:"w-full px-4 py-2 bg-bg-subtle border border-border-subtle rounded-lg text-text-primary focus:outline-none focus:ring-2 focus:ring-accent-primary/50 transition-colors",autoFocus:!0})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Flood Policy"}),t.jsxs("div",{className:"flex bg-bg-subtle rounded-lg border border-border-subtle p-1",children:[t.jsx("button",{onClick:()=>fs({...gs,floodPolicy:"deny"}),className:s("flex-1 px-3 py-2 text-sm font-medium rounded transition-colors","deny"===gs.floodPolicy?"bg-accent-danger/20 text-accent-danger border border-accent-danger/50":"text-text-muted hover:text-text-secondary"),children:"DENY"}),t.jsx("button",{onClick:()=>fs({...gs,floodPolicy:"allow"}),className:s("flex-1 px-3 py-2 text-sm font-medium rounded transition-colors","allow"===gs.floodPolicy?"bg-accent-success/20 text-accent-success border border-accent-success/50":"text-text-muted hover:text-text-secondary"),children:"ALLOW"})]})]}),gs.transport_key&&t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Transport Key"}),t.jsx("code",{className:"block bg-bg-subtle px-3 py-2 rounded-lg text-xs text-text-muted font-mono overflow-x-auto",children:gs.transport_key})]}),t.jsxs("div",{className:"flex justify-between gap-3 mt-6",children:[t.jsx("button",{onClick:()=>{bs(!1),vs(gs),ys(!0),fs(null)},disabled:Ss,className:"px-4 py-2 bg-accent-danger/20 hover:bg-accent-danger/30 text-accent-danger rounded-lg border border-accent-danger/50 transition-colors disabled:opacity-50",children:"Delete"}),t.jsxs("div",{className:"flex gap-3",children:[t.jsx("button",{onClick:()=>{bs(!1),fs(null)},disabled:Ss,className:"px-4 py-2 bg-bg-subtle hover:bg-bg-elevated text-text-secondary rounded-lg border border-border-subtle transition-colors disabled:opacity-50",children:"Cancel"}),t.jsx("button",{onClick:async()=>{if(gs){_s(!0),as(null);try{const e=await async function(e,t){return r(`/api/transport_key/${e}`,{method:"PUT",body:JSON.stringify(t)})}(gs.id,{name:gs.name,flood_policy:gs.floodPolicy});e.success?(await sa(),bs(!1),fs(null)):as(e.error||"Failed to update transport key")}catch(e){as(e instanceof Error?e.message:"Failed to update transport key")}finally{_s(!1)}}},disabled:Ss||!gs.name.trim(),className:"px-4 py-2 bg-accent-primary/20 hover:bg-accent-primary/30 text-text-primary rounded-lg border border-accent-primary/50 transition-colors disabled:opacity-50 flex items-center gap-2",children:Ss?t.jsxs(t.Fragment,{children:[t.jsx(_,{className:"w-4 h-4 animate-spin"}),"Saving..."]}):"Save"})]})]})]})]})}),hs&&js&&t.jsx("div",{className:"fixed inset-0 z-[10010] flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:e=>e.target===e.currentTarget&&ys(!1),role:"dialog","aria-modal":"true","aria-labelledby":"delete-key-modal-title",children:t.jsxs("div",{className:"bg-bg-elevated border border-border-subtle rounded-xl p-6 max-w-md w-full shadow-2xl",children:[t.jsx("h3",{id:"delete-key-modal-title",className:"type-subheading text-text-primary mb-4",children:"Delete Transport Key"}),t.jsxs("p",{className:"text-text-secondary mb-4",children:["Are you sure you want to delete ",t.jsxs("strong",{className:"text-text-primary",children:["'",js.name,"'"]}),"?"]}),js.children&&js.children.length>0&&t.jsx("div",{className:"bg-accent-secondary/10 border border-accent-secondary/30 rounded-lg p-3 mb-4",children:t.jsxs("div",{className:"flex gap-2",children:[t.jsx(P,{className:"w-4 h-4 text-accent-secondary flex-shrink-0 mt-0.5"}),t.jsxs("div",{className:"text-sm text-text-secondary",children:["This key has ",js.children.length," child key(s). Deleting will also remove all children."]})]})}),t.jsxs("div",{className:"flex justify-end gap-3",children:[t.jsx("button",{onClick:()=>{ys(!1),vs(null)},disabled:Ss,className:"px-4 py-2 bg-bg-subtle hover:bg-bg-elevated text-text-secondary rounded-lg border border-border-subtle transition-colors disabled:opacity-50",children:"Cancel"}),t.jsx("button",{onClick:async()=>{if(js){_s(!0),as(null);try{const e=await async function(e){return r(`/api/transport_key/${e}`,{method:"DELETE"})}(js.id);e.success?(await sa(),ys(!1),vs(null),os(null)):as(e.error||"Failed to delete transport key")}catch(e){as(e instanceof Error?e.message:"Failed to delete transport key")}finally{_s(!1)}}},disabled:Ss,className:"px-4 py-2 bg-accent-danger/20 hover:bg-accent-danger/30 text-accent-danger rounded-lg border border-accent-danger/50 transition-colors disabled:opacity-50 flex items-center gap-2",children:Ss?t.jsxs(t.Fragment,{children:[t.jsx(_,{className:"w-4 h-4 animate-spin"}),"Deleting..."]}):"Delete"})]})]})})]})}export{le as default}; diff --git a/frontend/dist/assets/ConfirmModal-CYXFGX_W.js b/frontend/dist/assets/ConfirmModal-CYXFGX_W.js deleted file mode 100644 index 426e4ce3..00000000 --- a/frontend/dist/assets/ConfirmModal-CYXFGX_W.js +++ /dev/null @@ -1 +0,0 @@ -import{r as e,j as t,at as n}from"./vendor-react-C341c8YC.js";import{n as s}from"./recharts-6XUQYgRA.js";import{N as r,aL as o,O as a,aM as c}from"./index-BJEgt3tp.js";const i={danger:{icon:"text-accent-danger",button:"bg-accent-danger hover:brightness-110 active:brightness-90"},warning:{icon:"text-accent-secondary",button:"bg-accent-secondary hover:brightness-110 active:brightness-90 text-bg-body"},default:{icon:"text-accent-primary",button:"bg-accent-primary hover:brightness-110 active:brightness-90 text-bg-body"}},l=e.memo(function({isOpen:e,title:l="Confirm",message:b,confirmLabel:d="Confirm",cancelLabel:m="Cancel",variant:x="default",onConfirm:g,onCancel:h}){const u=i[x];return t.jsxs(r,{open:e,onClose:h,size:"sm",children:[t.jsx(o,{icon:t.jsx(n,{className:s("w-5 h-5",u.icon)}),title:l,onClose:h}),t.jsx(a,{children:t.jsx("p",{className:"text-sm text-text-secondary",children:b})}),t.jsxs(c,{children:[t.jsx("button",{onClick:h,className:"flex-1 px-4 py-2.5 rounded-lg text-sm font-medium text-text-secondary bg-bg-subtle hover:bg-bg-elevated border border-border-subtle transition-colors",children:m}),t.jsx("button",{onClick:g,className:s("flex-1 px-4 py-2.5 rounded-lg text-sm font-medium text-text-primary transition-colors",u.button),children:d})]})]})});export{l as C}; diff --git a/frontend/dist/assets/ConfirmModal-_bkwu5cd.js b/frontend/dist/assets/ConfirmModal-_bkwu5cd.js new file mode 100644 index 00000000..edd4f894 --- /dev/null +++ b/frontend/dist/assets/ConfirmModal-_bkwu5cd.js @@ -0,0 +1 @@ +import{c as e,aq as t,bx as a,ar as s,by as n}from"./index-BGs2yNOg.js";import{a as r,j as o}from"./vendor-react-DCIF8YoJ.js";import{n as c}from"./recharts-DVj1EL-m.js";import{T as i}from"./triangle-alert-2-1YN-Am.js";const d=e("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),l=e("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]),m={danger:{icon:"text-accent-danger",button:"bg-accent-danger hover:brightness-110 active:brightness-90"},warning:{icon:"text-accent-secondary",button:"bg-accent-secondary hover:brightness-110 active:brightness-90 text-bg-body"},default:{icon:"text-accent-primary",button:"bg-accent-primary hover:brightness-110 active:brightness-90 text-bg-body"}},b=r.memo(function({isOpen:e,title:r="Confirm",message:d,confirmLabel:l="Confirm",cancelLabel:b="Cancel",variant:h="default",onConfirm:x,onCancel:g}){const p=m[h];return o.jsxs(t,{open:e,onClose:g,size:"sm",children:[o.jsx(a,{icon:o.jsx(i,{className:c("w-5 h-5",p.icon)}),title:r,onClose:g}),o.jsx(s,{children:o.jsx("p",{className:"text-sm text-text-secondary",children:d})}),o.jsxs(n,{children:[o.jsx("button",{onClick:g,className:"flex-1 px-4 py-2.5 rounded-lg text-sm font-medium text-text-secondary bg-bg-subtle hover:bg-bg-elevated border border-border-subtle transition-colors",children:b}),o.jsx("button",{onClick:x,className:c("flex-1 px-4 py-2.5 rounded-lg text-sm font-medium text-text-primary transition-colors",p.button),children:l})]})]})});export{b as C,d as P,l as T}; diff --git a/frontend/dist/assets/Contacts-Bc9XGkC1.js b/frontend/dist/assets/Contacts-Bc9XGkC1.js new file mode 100644 index 00000000..aa5fb711 --- /dev/null +++ b/frontend/dist/assets/Contacts-Bc9XGkC1.js @@ -0,0 +1,2 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ContactsMapMapLibre-CsZGQooS.js","assets/vendor-react-DCIF8YoJ.js","assets/BasemapLayer-g9CXC1Ky.js","assets/vendor-core-Dl9MTgSr.js","assets/link-scoring-DTgOSmRe.js","assets/index-BGs2yNOg.js","assets/ConfirmModal-_bkwu5cd.js","assets/triangle-alert-2-1YN-Am.js","assets/DeepAnalysisModal-Dhmx8Gh2.js","assets/check-qb29v-su.js","assets/git-branch-Sfdze11O.js","assets/house-CCeK_0TO.js","assets/loader-circle-CwUrmZrV.js","assets/useThemeColors-CGx-Jxyf.js","assets/refresh-cw-ccP9GKH1.js","assets/target-De7OqeGi.js","assets/trending-up-2SYsZdKi.js","assets/compass-DMvXEtHv.js","assets/zap-CQ3I2hAj.js","assets/font-loader-jlbdh9Fw.js","assets/car-DXNv2W8D.js","assets/users-D0iUt2so.js","assets/SignalIndicator-DWWkJgSd.js","assets/DataBox-nCNZLfvU.js","assets/map-pin-x5eP-WEg.js","assets/ping-HGVILoRV.js","assets/PageLayout-DIXn4UXM.js","assets/chevron-up-ClXInh9N.js","assets/funnel-DZRnHLZd.js","assets/circle-check-Bd9Kbu6i.js","assets/CollisionExplorerModal-CyK7TMsS.js","assets/network-DpalqfB8.js","assets/maplibre-gl-B1CfjdFi.css","assets/index-CIefRaAd.css"])))=>i.map(i=>d[i]); +import{j as e,a as s}from"./vendor-react-DCIF8YoJ.js";import{c as t,aA as a,aB as n,ap as l,aC as c,C as r,al as i,aD as o,aE as d,aF as x,v as m,aG as h,p,aH as u,j as g,aI as j,aJ as b,aK as N,h as v,r as f,aL as y,R as w,X as k,B as C,aM as M}from"./index-BGs2yNOg.js";import{p as S}from"./ping-HGVILoRV.js";import{P as L,b as H}from"./PageLayout-DIXn4UXM.js";import{_ as P}from"./deckgl-DTsmDcfs.js";import{G as F}from"./git-branch-Sfdze11O.js";import{T as E}from"./triangle-alert-2-1YN-Am.js";import{a as R,T,M as $}from"./trending-up-2SYsZdKi.js";import{C as A,A as O}from"./chevron-up-ClXInh9N.js";import{E as _,S as D,T as z}from"./target-De7OqeGi.js";import{Z as G,C as I}from"./zap-CQ3I2hAj.js";import{n as K,L as U,T as V,u as W}from"./recharts-DVj1EL-m.js";import{D as B}from"./DataBox-nCNZLfvU.js";import{F as q}from"./funnel-DZRnHLZd.js";import{P as Z,T as J,C as Q}from"./ConfirmModal-_bkwu5cd.js";import{C as X}from"./check-qb29v-su.js";import{U as Y}from"./users-D0iUt2so.js";import{M as ee}from"./map-pin-x5eP-WEg.js";import{C as se}from"./circle-check-Bd9Kbu6i.js";import{C as te,b as ae,c as ne}from"./SignalIndicator-DWWkJgSd.js";import{C as le,S as ce,M as re}from"./CollisionExplorerModal-CyK7TMsS.js";import{N as ie}from"./network-DpalqfB8.js";import{L as oe}from"./loader-circle-CwUrmZrV.js";const de=t("arrow-left-right",[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]]),xe=t("arrow-up-down",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]),me=t("calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]),he=t("file-digit",[["path",{d:"M4 12V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2",key:"jrl274"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 16h2v6",key:"1bxocy"}],["path",{d:"M10 22h4",key:"ceow96"}],["rect",{x:"2",y:"16",width:"4",height:"6",rx:"2",key:"r45zd0"}]]),pe=t("message-square",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]]),ue=t("ruler",[["path",{d:"M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z",key:"icamh8"}],["path",{d:"m14.5 12.5 2-2",key:"inckbg"}],["path",{d:"m11.5 9.5 2-2",key:"fmmyf7"}],["path",{d:"m8.5 6.5 2-2",key:"vc6u1g"}],["path",{d:"m17.5 15.5 2-2",key:"wo5hmg"}]]),ge=t("shield-alert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]),je=t("sparkles",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]]);class be extends s.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}render(){var s;return this.state.hasError?e.jsx("div",{className:"map-container-16-9 glass-card flex items-center justify-center",role:"alert","aria-live":"assertive",children:e.jsxs("div",{className:"text-center text-white/50 p-4",children:[e.jsx("p",{className:"text-lg mb-2",children:"Map failed to load"}),e.jsx("p",{className:"text-sm text-white/30",children:(null==(s=this.state.error)?void 0:s.message)||"Unknown error"}),e.jsx("p",{className:"text-xs text-white/20 mt-2",children:"Try refreshing the page or check your browser's WebGL support."})]})}):this.props.children}}const Ne=s.lazy(()=>P(()=>import("./ContactsMapMapLibre-CsZGQooS.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33])));function ve({neighbors:t,localNode:a,localHash:n,onRemoveNode:l,selectedNodeHash:c,onNodeSelected:r,highlightedEdgeKey:i,highlightedGhost:o}){return e.jsx(be,{children:e.jsx(s.Suspense,{fallback:e.jsx("div",{className:"map-container-16-9 glass-card flex items-center justify-center",role:"status","aria-live":"polite","aria-label":"Loading map",children:e.jsxs("div",{className:"text-white/50 flex items-center gap-3",children:[e.jsx("div",{className:"w-5 h-5 border-2 border-accent-primary border-t-transparent rounded-full animate-spin","aria-hidden":"true"}),e.jsx("span",{children:"Loading map..."})]})}),children:e.jsx(Ne,{neighbors:t,localNode:a,localHash:n,onRemoveNode:l,selectedNodeHash:c,onNodeSelected:r,highlightedEdgeKey:i,highlightedGhost:o})})})}function fe(e){return e>=.7?"text-accent-success":e>=.5?"text-accent-secondary":e>=.3?"text-signal-poor":"text-accent-danger"}function ye(e){return`${Math.round(100*e)}%`}function we(e,s){return s.has(e.toUpperCase())}const ke=s.memo(function({path:s,isHighlighted:t,onHighlight:a,ghostPrefixes:n}){const l=function(s){return s>.2?{icon:e.jsx(T,{className:"w-3 h-3"}),color:"text-accent-success"}:s<-.2?{icon:e.jsx(R,{className:"w-3 h-3"}),color:"text-accent-danger"}:{icon:e.jsx($,{className:"w-3 h-3"}),color:"text-text-muted"}}(s.observationTrend),r=s.weakestLinkKey&&s.weakestLinkConfidence<.5,i=s.hops.some(e=>we(e,n));return e.jsxs("div",{className:"flex items-center gap-3 p-2 rounded-md transition-colors cursor-pointer "+(t?"bg-accent-primary/20 border border-accent-primary/40":"hover:bg-white/5"),onClick:()=>a(t?null:s.weakestLinkKey),children:[e.jsx("div",{className:"flex-shrink-0 w-12 text-center py-1 rounded-md "+(o=s.healthScore,o>=.7?"bg-accent-success/10":o>=.5?"bg-accent-secondary/10":o>=.3?"bg-signal-poor/10":"bg-accent-danger/10"),children:e.jsx("span",{className:`text-xs font-semibold tabular-nums ${fe(s.healthScore)}`,children:ye(s.healthScore)})}),e.jsx("div",{className:"flex-1 flex items-center gap-0.5 overflow-x-auto min-w-0",children:s.hops.map((t,a)=>{var l;const i=we(t,n),o=r&&(null==(l=s.weakestLinkKey)?void 0:l.includes(t));return e.jsxs("span",{className:"flex items-center",children:[e.jsxs("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded flex items-center gap-0.5 "+(i?"bg-accent-tertiary/20 text-accent-tertiary border border-accent-tertiary/30":o?"bg-accent-danger/20 text-accent-danger":"bg-white/10 text-text-secondary"),children:[i&&e.jsx(c,{className:"w-2.5 h-2.5"}),t]}),anew Set(m.map(e=>e.prefix.toUpperCase())),[m]),g=s.useMemo(()=>d.slice(0,t),[d,t]),j=s.useMemo(()=>0===d.length?null:{avgHealth:d.reduce((e,s)=>e+s.healthScore,0)/d.length,declining:d.filter(e=>e.observationTrend<-.2).length,weakLinks:d.filter(e=>e.weakestLinkConfidence<.5).length,pathsWithGhosts:d.filter(e=>e.hops.some(e=>u.has(e.toUpperCase()))).length},[d,u]),b=e=>{null==i||i(e)};return 0===d.length?null:e.jsxs("div",{className:"chart-container",children:[e.jsxs("button",{onClick:()=>p(!h),className:"w-full chart-header hover:bg-white/5 transition-colors rounded-t-lg cursor-pointer",children:[e.jsxs("div",{className:"chart-title",children:[e.jsx(F,{className:"chart-title-icon"}),"Path Health",e.jsxs("span",{className:"ml-2 text-[10px] font-normal text-text-muted",children:["(",d.length," paths)"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[j&&e.jsxs("div",{className:"flex items-center gap-3 text-[10px]",children:[e.jsxs("span",{className:`tabular-nums ${fe(j.avgHealth)}`,children:["Avg: ",ye(j.avgHealth)]}),j.weakLinks>0&&e.jsxs("span",{className:"text-accent-danger flex items-center gap-1",children:[e.jsx(E,{className:"w-3 h-3"}),j.weakLinks," weak"]}),j.declining>0&&e.jsxs("span",{className:"text-signal-poor flex items-center gap-1",children:[e.jsx(R,{className:"w-3 h-3"}),j.declining," declining"]}),j.pathsWithGhosts>0&&e.jsxs("span",{className:"text-accent-tertiary flex items-center gap-1",children:[e.jsx(c,{className:"w-3 h-3"}),j.pathsWithGhosts," ghost"]})]}),h?e.jsx(A,{className:"w-4 h-4 text-text-muted"}):e.jsx(r,{className:"w-4 h-4 text-text-muted"})]})]}),h&&e.jsxs("div",{className:"p-3 pt-0 space-y-1",children:[x.totalPaths>0&&e.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-text-muted pb-2 border-b border-white/5",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(_,{className:"w-3 h-3 text-accent-primary"}),e.jsx("span",{className:"text-text-secondary",children:x.totalPaths.toLocaleString()})," Viterbi decoded"]}),x.observationOverrideCount>0&&e.jsxs("span",{className:"text-accent-success",children:[Math.round(x.observationOverrideCount/x.totalPaths*100),"% observation override"]}),m.length>0&&e.jsxs("span",{className:"text-accent-tertiary flex items-center gap-1",children:[e.jsx(c,{className:"w-3 h-3"}),m.length," ghost",1!==m.length?"s":""]})]}),e.jsxs("div",{className:"flex items-center gap-4 text-[10px] text-text-muted pb-2 border-b border-white/5",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-accent-success"})," Healthy (≥70%)"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-accent-secondary"})," Fair (50-70%)"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-signal-poor"})," Weak (30-50%)"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-accent-danger"})," Critical (<30%)"]}),m.length>0&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(c,{className:"w-3 h-3 text-accent-tertiary"})," Ghost"]})]}),e.jsx("div",{className:"space-y-1 max-h-64 overflow-y-auto",children:g.map(s=>e.jsx(ke,{path:s,isHighlighted:o===s.weakestLinkKey,onHighlight:b,ghostPrefixes:u},s.pathKey))}),d.length>t&&e.jsxs("div",{className:"text-center text-[10px] text-text-muted pt-2",children:["Showing top ",t," of ",d.length," paths"]})]})]})});function Me(e){switch(e){case"rf_intersection":return"RF Circle Intersection";case"weighted_centroid":return"Weighted Centroid";case"single_anchor":return"Single Anchor (less reliable)";default:return e}}const Se={confirmed:{label:"Confirmed",icon:e.jsx(je,{className:"w-3.5 h-3.5"}),borderClass:"border-accent-success/40",bgClass:"bg-accent-success/10",textClass:"text-accent-success",badgeClass:"bg-accent-success/20 text-accent-success"},likely:{label:"Likely",icon:e.jsx(X,{className:"w-3.5 h-3.5"}),borderClass:"border-accent-tertiary/30",bgClass:"bg-accent-tertiary/5",textClass:"text-accent-tertiary",badgeClass:"bg-accent-tertiary/20 text-accent-tertiary"},possible:{label:"Possible",icon:e.jsx(I,{className:"w-3.5 h-3.5"}),borderClass:"border-accent-secondary/20",bgClass:"bg-accent-secondary/5",textClass:"text-accent-secondary",badgeClass:"bg-accent-secondary/20 text-accent-secondary"},noise:{label:"Noise",icon:e.jsx(E,{className:"w-3.5 h-3.5"}),borderClass:"border-border-muted",bgClass:"bg-bg-card/30",textClass:"text-text-muted",badgeClass:"bg-bg-elevated text-text-muted"}};function Le({ghost:t,neighbors:a,isExpanded:n,onToggle:l,compact:d}){var x,m;const h=(null==(x=t.classification)?void 0:x.tier)??"noise",p=Se[h],u="clusterId"in(g=t)&&"temporal"in g;var g;const j=s.useMemo(()=>Array.from(t.commonNeighbors).map(e=>{var s;return{hash:e,name:null==(s=a[e])?void 0:s.name}}),[t.commonNeighbors,a]),b=t.estimatedLocation?t.estimatedLocation.uncertaintyM>=1e3?`±${(t.estimatedLocation.uncertaintyM/1e3).toFixed(1)}km`:`±${Math.round(t.estimatedLocation.uncertaintyM)}m`:null,N=u&&t.temporal?(v=t.temporal.consistency)>=.7?{label:"Steady",color:"text-accent-success"}:v>=.4?{label:"Regular",color:"text-accent-tertiary"}:v>=.2?{label:"Sporadic",color:"text-accent-secondary"}:{label:"Bursty",color:"text-signal-poor"}:null;var v;const f=u&&t.collisionCandidates&&t.collisionCandidates.length>0,y=f?t.collisionCandidates[0]:null;return d?e.jsxs("div",{className:"inline-flex items-center gap-1.5 px-2 py-1 rounded bg-bg-elevated/50 text-sm",children:[e.jsx("span",{className:"font-mono font-medium text-text-secondary",children:t.prefix.toUpperCase()}),e.jsx("span",{className:"text-text-muted",children:t.observationCount})]}):e.jsxs("div",{className:K("rounded-lg border transition-all duration-150",p.borderClass,p.bgClass),children:[e.jsxs("button",{onClick:l,className:"w-full flex items-center gap-3 px-3 py-2 text-left hover:bg-white/5 rounded-lg",children:[e.jsx(c,{className:K("w-5 h-5 flex-shrink-0",p.textClass)}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-mono text-sm font-semibold text-text-primary",children:t.prefix.toUpperCase()}),e.jsx("span",{className:K("px-1.5 py-0.5 rounded text-sm font-medium",p.badgeClass),children:p.label})]}),e.jsx("div",{className:K("text-sm mt-0.5",p.textClass),children:(null==(m=t.classification)?void 0:m.reason)??"Unknown"}),e.jsxs("div",{className:"flex items-center gap-3 text-sm text-text-muted mt-1",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(_,{className:"w-3 h-3"}),t.observationCount]}),e.jsxs("span",{children:[(100*t.confidence).toFixed(0),"%"]}),t.commonNeighbors.size>0&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Y,{className:"w-3 h-3"}),t.commonNeighbors.size]}),t.estimatedLocation&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ee,{className:"w-3 h-3"}),b]}),N&&e.jsxs("span",{className:K("flex items-center gap-1",N.color),children:[e.jsx(O,{className:"w-3 h-3"}),N.label]}),f&&e.jsxs("span",{className:"flex items-center gap-1 text-signal-poor",children:[e.jsx(ge,{className:"w-3 h-3"}),"Collision?"]})]})]}),n?e.jsx(A,{className:"w-4 h-4 text-text-muted"}):e.jsx(r,{className:"w-4 h-4 text-text-muted"})]}),n&&e.jsxs("div",{className:"px-3 pb-3 space-y-3 border-t border-border-muted/50 mt-1 pt-3",children:[f&&y&&e.jsx("div",{className:"p-2 rounded bg-signal-poor/10 border border-signal-poor/30",children:e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(ge,{className:"w-4 h-4 text-signal-poor flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-signal-poor font-medium",children:"Possible collision with known node"}),e.jsx("div",{className:"text-text-secondary mt-0.5",children:y.knownNodeName?e.jsxs("span",{children:["May match ",e.jsx("span",{className:"font-medium",children:y.knownNodeName})," ","(",(100*y.collisionProbability).toFixed(0),"% probability)"]}):e.jsxs("span",{children:["May match ",e.jsx(B,{copy:!0,size:"compact",className:"inline",children:y.knownNodeHash})," ","(",(100*y.collisionProbability).toFixed(0),"% probability)"]})}),y.evidence&&e.jsxs("div",{className:"text-text-muted mt-1 text-[10px]",children:[y.evidence.sharedEdgeCount>0&&e.jsxs("span",{className:"mr-2",children:[y.evidence.sharedEdgeCount," shared edges"]}),void 0!==y.evidence.distanceKm&&e.jsxs("span",{className:"mr-2",children:[y.evidence.distanceKm.toFixed(1),"km apart"]}),y.evidence.withinUncertainty&&e.jsx("span",{className:"text-accent-secondary",children:"Within uncertainty radius"})]})]})]})}),t.estimatedLocation?e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(ee,{className:"w-4 h-4 text-accent-primary mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-sm",children:[e.jsxs("div",{className:"text-text-primary font-medium",children:[t.estimatedLocation.lat.toFixed(5),", ",t.estimatedLocation.lon.toFixed(5)]}),e.jsxs("div",{className:"text-text-muted",children:["Uncertainty: ",b]}),u&&t.location&&e.jsxs("div",{className:"mt-1 text-text-muted",children:[e.jsxs("div",{children:["Method: ",Me(t.location.method)]}),t.location.anchors&&t.location.anchors.length>0&&e.jsxs("div",{children:[t.location.anchors.length," anchor",1!==t.location.anchors.length?"s":""," used"," · ",(100*t.location.locationConfidence).toFixed(0),"% confidence"]})]})]})]}):e.jsxs("div",{className:"flex items-center gap-2 text-sm text-text-muted",children:[e.jsx(E,{className:"w-4 h-4 text-signal-poor"}),"Location unknown (neighbors lack coordinates)"]}),u&&t.temporal&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(O,{className:"w-4 h-4 text-text-muted mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-sm",children:[e.jsxs("div",{className:"text-text-primary font-medium",children:["Temporal Pattern: ",e.jsx("span",{className:null==N?void 0:N.color,children:null==N?void 0:N.label})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-0.5 mt-1 text-text-muted",children:[e.jsxs("span",{children:["Distinct hours: ",t.temporal.distinctHours]}),e.jsxs("span",{children:["Distinct days: ",t.temporal.distinctDays]}),e.jsxs("span",{children:["Burstiness: ",(100*t.temporal.burstiness).toFixed(0),"%"]}),e.jsxs("span",{children:["Consistency: ",(100*t.temporal.consistency).toFixed(0),"%"]}),e.jsxs("span",{children:["Last 24h: ",t.temporal.last24HourCount," obs"]}),e.jsxs("span",{children:["Active hours: ",t.temporal.activeHoursLast24,"/24"]})]})]})]}),!u&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(i,{className:"w-4 h-4 text-text-muted mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-sm",children:[e.jsxs("div",{className:"text-text-primary",children:["First seen: ",o(t.firstSeen)," ago"]}),e.jsxs("div",{className:"text-text-muted",children:["Last seen: ",o(t.lastSeen)," ago"]})]})]}),u&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(me,{className:"w-4 h-4 text-text-muted mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-sm",children:[e.jsxs("div",{className:"text-text-primary",children:["Active period: ",o(t.firstSeen)," – ",o(t.lastSeen)," ago"]}),t.temporal&&e.jsxs("div",{className:"text-text-muted",children:["Obs/hour avg: ",t.temporal.observationsPerHour.toFixed(1)]})]})]}),j.length>0&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Y,{className:"w-4 h-4 text-text-muted mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-sm",children:[e.jsxs("div",{className:"text-text-muted mb-1",children:["Adjacent to ",j.length," known node",1!==j.length?"s":"",":"]}),e.jsxs("div",{className:"flex flex-wrap gap-1",children:[j.slice(0,5).map(({hash:s})=>e.jsx(B,{copy:!0,size:"compact",children:s},s)),j.length>5&&e.jsxs("span",{className:"text-text-muted",children:["+",j.length-5," more"]})]})]})]}),u&&t.validationStages&&e.jsxs("div",{className:"pt-2 border-t border-border-muted/30",children:[e.jsx("div",{className:"text-[10px] text-text-muted mb-1.5 uppercase tracking-wide",children:"Validation Stages"}),e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[e.jsx(He,{label:"Candidates",passed:t.validationStages.candidateExhaustion}),e.jsx(He,{label:"Temporal",passed:t.validationStages.temporalConsistency}),e.jsx(He,{label:"Topology",passed:t.validationStages.topologicalFit}),e.jsx(He,{label:"Location",passed:t.validationStages.locationPlausible})]})]}),t.classification&&!u&&e.jsx("div",{className:"pt-2 border-t border-border-muted/30",children:e.jsxs("div",{className:"flex flex-wrap gap-1",children:[t.classification.criteria.hasVeryHighObservations&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] bg-accent-success/20 text-accent-success",children:"200+ obs"}),t.classification.criteria.hasHighObservations&&!t.classification.criteria.hasVeryHighObservations&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] bg-accent-tertiary/20 text-accent-tertiary",children:"50+ obs"}),t.classification.criteria.hasHighConfidence&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] bg-accent-success/20 text-accent-success",children:"70%+ conf"}),t.classification.criteria.hasCommonNeighbors&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] bg-accent-primary/20 text-accent-primary",children:"2+ neighbors"}),t.classification.criteria.hasGoodLocation&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] bg-accent-primary/20 text-accent-primary",children:"good loc"}),t.classification.criteria.isRecent&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] bg-text-muted/20 text-text-muted",children:"recent"})]})}),u&&t.upgradeRequirements&&t.upgradeRequirements.length>0&&"confirmed"!==h&&e.jsxs("div",{className:"pt-2 border-t border-border-muted/30",children:[e.jsx("div",{className:"text-[10px] text-text-muted mb-1 uppercase tracking-wide",children:"To upgrade tier:"}),e.jsx("ul",{className:"text-xs text-text-secondary space-y-0.5",children:t.upgradeRequirements.slice(0,3).map((s,t)=>e.jsxs("li",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"text-accent-tertiary",children:"•"})," ",s]},t))})]})]})]})}function He({label:s,passed:t}){return e.jsxs("span",{className:K("inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium",t?"bg-accent-success/20 text-accent-success":"bg-bg-elevated text-text-muted"),children:[t?e.jsx(se,{className:"w-2.5 h-2.5"}):e.jsx(te,{className:"w-2.5 h-2.5"}),s]})}function Pe({neighbors:t,className:a,onGhostSelect:i}){const o=l(),d=n(),[x,m]=s.useState(new Set),[h,p]=s.useState("actionable"),[u,g]=s.useState(!1),[j,b]=s.useState(!0),[N,v]=s.useState(Date.now);s.useEffect(()=>{v(Date.now())},[o]);const f=s.useMemo(()=>o.filter(e=>!function(e,s){return s-1e3*e.lastSeen>6048e5}(e,N)),[o,N]),y=s.useMemo(()=>{const e=Array.from(x);return e.length>0?e[0]:null},[x]),w=s.useMemo(()=>y?f.find(e=>e.prefix===y)??null:null,[y,f]);s.useEffect(()=>{i&&i(w&&!j?{prefix:w.prefix,commonNeighbors:Array.from(w.commonNeighbors),estimatedLocation:w.estimatedLocation}:null)},[w,j,i]),s.useEffect(()=>{j&&m(new Set)},[j]);const{confirmed:k,likely:C,possible:M,noise:S,actionableCount:L}=s.useMemo(()=>{var e;const s=[],t=[],a=[],n=[];for(const c of f)switch((null==(e=c.classification)?void 0:e.tier)??"noise"){case"confirmed":s.push(c);break;case"likely":t.push(c);break;case"possible":a.push(c);break;case"noise":n.push(c)}const l=(e,s)=>s.observationCount-e.observationCount;return s.sort(l),t.sort(l),a.sort(l),n.sort(l),{confirmed:s,likely:t,possible:a,noise:n,actionableCount:s.length+t.length}},[f]);if(0===f.length)return null;const H=e=>{m(s=>s.has(e)?new Set:new Set([e]))},P="all"===h,F=k.length+C.length+(P?M.length:0)+(u?S.length:0);return e.jsxs("div",{className:a,children:[e.jsxs("div",{className:"chart-header",children:[e.jsxs("div",{className:"chart-title",children:[e.jsx(c,{className:"chart-title-icon"}),"Ghost Buster",L>0&&e.jsxs("span",{className:"px-2 py-0.5 rounded-full text-xs font-medium bg-accent-success/20 text-accent-success",children:[L," actionable"]}),j&&f.length>0&&e.jsxs("span",{className:"text-xs text-text-muted ml-2",children:["(",f.length," total)"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[!j&&e.jsxs("button",{onClick:()=>p(e=>"actionable"===e?"all":"actionable"),className:K("flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors","all"===h?"bg-accent-primary/20 text-accent-primary":"bg-bg-elevated text-text-muted hover:text-text-secondary"),children:[e.jsx(q,{className:"w-3 h-3"}),"actionable"===h?"Actionable":"All"]}),e.jsx("button",{onClick:()=>b(e=>!e),className:"flex items-center gap-1 px-2 py-1 rounded text-xs bg-bg-elevated text-text-muted hover:text-text-secondary transition-colors",title:j?"Expand panel":"Minimize panel",children:j?e.jsx(Z,{className:"w-3 h-3"}):e.jsx($,{className:"w-3 h-3"})})]})]}),j?e.jsxs("div",{className:"px-5 py-3 flex items-center gap-3 text-xs cursor-pointer hover:bg-white/5 transition-colors",onClick:()=>b(!1),children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[k.length>0&&e.jsxs("span",{className:"flex items-center gap-1 text-accent-success",children:[e.jsx(je,{className:"w-3 h-3"}),k.length," confirmed"]}),C.length>0&&e.jsxs("span",{className:"flex items-center gap-1 text-accent-tertiary",children:[e.jsx(X,{className:"w-3 h-3"}),C.length," likely"]}),M.length>0&&e.jsxs("span",{className:"text-accent-secondary",children:[M.length," possible"]}),S.length>0&&e.jsxs("span",{className:"text-text-muted",children:[S.length," noise"]})]}),e.jsx("span",{className:"text-text-muted ml-auto",children:"Click to expand"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"px-5 py-2 flex items-center gap-3 text-xs border-b border-border-muted/30",children:[e.jsxs("span",{className:"text-text-muted",children:[d.pathsWithGhosts.toLocaleString()," / ",d.totalPaths.toLocaleString()," paths"]}),e.jsx("span",{className:"text-text-muted",children:"•"}),e.jsxs("div",{className:"flex items-center gap-2",children:[k.length>0&&e.jsxs("span",{className:"text-accent-success",children:[k.length," confirmed"]}),C.length>0&&e.jsxs("span",{className:"text-accent-tertiary",children:[C.length," likely"]}),M.length>0&&e.jsxs("span",{className:"text-accent-secondary",children:[M.length," possible"]}),S.length>0&&e.jsxs("span",{className:"text-text-muted",children:[S.length," noise"]})]})]}),e.jsxs("div",{className:"px-5 py-4 space-y-4",children:[k.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-accent-success",children:[e.jsx(je,{className:"w-3.5 h-3.5"}),e.jsxs("span",{className:"font-medium",children:["Confirmed Repeaters (",k.length,")"]})]}),e.jsx("div",{className:"space-y-2",children:k.map(s=>e.jsx(Le,{ghost:s,neighbors:t,isExpanded:x.has(s.prefix),onToggle:()=>H(s.prefix)},s.prefix))})]}),C.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-accent-tertiary",children:[e.jsx(X,{className:"w-3.5 h-3.5"}),e.jsxs("span",{className:"font-medium",children:["Likely Repeaters (",C.length,")"]})]}),e.jsx("div",{className:"space-y-2",children:C.map(s=>e.jsx(Le,{ghost:s,neighbors:t,isExpanded:x.has(s.prefix),onToggle:()=>H(s.prefix)},s.prefix))})]}),P&&M.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-accent-secondary",children:[e.jsx(I,{className:"w-3.5 h-3.5"}),e.jsxs("span",{className:"font-medium",children:["Possible (",M.length,")"]})]}),e.jsxs("div",{className:"space-y-2",children:[M.slice(0,10).map(s=>e.jsx(Le,{ghost:s,neighbors:t,isExpanded:x.has(s.prefix),onToggle:()=>H(s.prefix)},s.prefix)),M.length>10&&e.jsxs("div",{className:"text-xs text-text-muted text-center py-1",children:["+",M.length-10," more possible nodes"]})]})]}),S.length>0&&"all"===h&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("button",{onClick:()=>g(!u),className:"flex items-center gap-2 text-xs text-text-muted hover:text-text-secondary transition-colors",children:[u?e.jsx(A,{className:"w-3.5 h-3.5"}):e.jsx(r,{className:"w-3.5 h-3.5"}),e.jsx(E,{className:"w-3.5 h-3.5"}),e.jsxs("span",{children:["Noise (",S.length,")"]})]}),u&&e.jsx("div",{className:"flex flex-wrap gap-1",children:S.map(s=>e.jsx(Le,{ghost:s,neighbors:t,isExpanded:!1,onToggle:()=>{},compact:!0},s.prefix))})]}),"actionable"===h&&0===L&&e.jsxs("div",{className:"text-center py-6 text-sm text-text-muted",children:[e.jsx(c,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:"No confirmed or likely repeaters yet."}),e.jsxs("p",{className:"text-xs mt-1",children:[M.length+S.length," prefixes need more evidence."]}),e.jsxs("button",{onClick:()=>p("all"),className:"mt-3 text-accent-primary hover:underline",children:["View all ",f.length," discovered nodes"]})]}),d.observationOverrideCount>0&&F>0&&e.jsxs("div",{className:"pt-2 border-t border-border-muted/30 text-xs text-text-muted",children:[e.jsx("span",{className:"text-accent-primary",children:d.observationOverrideCount})," observation overrides • Avg confidence: ",e.jsxs("span",{className:"text-accent-secondary",children:[(100*d.avgPathConfidence).toFixed(0),"%"]})]})]})]})]})}const Fe="var(--sparkline-critical)",Ee="var(--sparkline-poor)",Re="var(--sparkline-fair)",Te="var(--sparkline-good)",$e="var(--sparkline-excellent)";function Ae({active:s,payload:t}){if(!s||!t||!t.length)return null;const a=t[0].payload,n=new Date(a.timestamp),l=`${(n.getMonth()+1).toString().padStart(2,"0")}/${n.getDate().toString().padStart(2,"0")}`;return e.jsxs("div",{className:"bg-tooltip-bg border border-border-subtle rounded px-1.5 py-0.5 text-[10px] shadow-xl",children:[e.jsx("span",{className:"text-text-muted",children:l}),e.jsx("span",{className:"ml-1.5 font-semibold tabular-nums",children:a.count})]})}const Oe=s.memo(function({nodeHash:s,width:t=60,height:a=20,color:n,showArea:l=!0,showTooltip:c=!1,className:r=""}){const i=d(s),o=x(),h=!m().backgroundLoadComplete||o,p=n??(i.length>0?function(e){if(0===e.length)return Fe;const s=e.slice(-4),t=s.reduce((e,s)=>e+s.count,0),a=t/s.length,n=e.reduce((e,s)=>e+s.count,0)/e.length;if(0===t)return Fe;if(n>0){const e=a/n;return e>=1.2?$e:e>=.8?Te:e>=.4?Re:e>=.1?Ee:Fe}return t>=10?$e:t>=5?Te:t>=2?Re:t>=1?Ee:Fe}(i):"var(--text-muted)"),u="number"==typeof t?t:60,g=a;return h&&i.length<2?e.jsx("div",{className:`flex items-center justify-center ${r}`,style:{width:u,height:g},children:e.jsx("div",{className:"rounded animate-pulse bg-white/[0.06]",style:{width:u-8,height:g-6}})}):i.length<2?e.jsx("div",{className:`flex items-center justify-center ${r}`,style:{width:u,height:g,color:Fe},children:e.jsx("svg",{width:u,height:g,viewBox:`0 0 ${u} ${g}`,preserveAspectRatio:"none",children:e.jsx("line",{x1:4,y1:g/2,x2:u-4,y2:g/2,stroke:"currentColor",strokeWidth:1.5,strokeDasharray:"3,2"})})}):e.jsx("div",{className:r,style:{width:u,height:g},children:e.jsxs(U,{data:i,width:u,height:g,margin:{top:1,right:1,bottom:1,left:1},children:[c&&e.jsx(V,{content:e.jsx(Ae,{}),cursor:{stroke:"rgba(255,255,255,0.2)",strokeWidth:1}}),e.jsx(W,{type:"monotone",dataKey:"count",stroke:p,strokeWidth:1.5,dot:!1,isAnimationActive:!1})]})})}),_e=s.memo(function({hash:t,className:a="",size:l="sm"}){const c=h(),r=n(),[i,o]=s.useState(!1),d=s.useMemo(()=>p(t),[t]),x=s.useMemo(()=>d?c.find(e=>e.prefix===d)??null:null,[d,c]),m=r.totalPaths>0&&r.avgPathConfidence>=.7,u=s.useCallback(e=>{e.preventDefault(),e.stopPropagation(),o(!0)},[]),g=s.useCallback(()=>{o(!1)},[]);if(!x)return null;const j="sm"===l?"w-3.5 h-3.5":"w-4 h-4",b=m?"text-accent-tertiary hover:text-accent-tertiary hover:bg-accent-tertiary/10 focus:ring-accent-tertiary/50":"text-signal-fair hover:text-accent-secondary hover:bg-signal-fair/10 focus:ring-signal-fair/50",N=m?`Prefix conflict resolved by Viterbi HMM (${(100*r.avgPathConfidence).toFixed(0)}% confidence)`:`Prefix conflict: ${x.candidateCount} nodes share prefix "${d}"`;return e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:u,className:`inline-flex items-center justify-center p-0.5 rounded focus:outline-none focus:ring-2 transition-colors cursor-pointer touch-manipulation ${b} ${a}`,title:N,"aria-label":`View prefix conflict for ${d}${m?" (Viterbi resolved)":""}`,children:m?e.jsxs("span",{className:"relative",children:[e.jsx(_,{className:j}),e.jsx(X,{className:"absolute -bottom-0.5 -right-0.5 w-2 h-2 text-accent-success"})]}):e.jsx(he,{className:j})}),e.jsx(le,{isOpen:i,prefix:x.prefix,candidateHashes:x.candidateHashes,onClose:g})]})});function De(e,s,t,a){const n=(t-e)*Math.PI/180,l=(a-s)*Math.PI/180,c=Math.sin(n/2)*Math.sin(n/2)+Math.cos(e*Math.PI/180)*Math.cos(t*Math.PI/180)*Math.sin(l/2)*Math.sin(l/2);return 2*Math.atan2(Math.sqrt(c),Math.sqrt(1-c))*6371e3}const ze=Object.freeze(Object.defineProperty({__proto__:null,default:function(){const{stats:t}=u(),a=g(),n=j(),c=b(),o=N(),d=v(),x=l(),m=f(),[h,p]=s.useState(null),[P,F]=s.useState("lastHeard"),[E,R]=s.useState("desc"),[T,$]=s.useState(""),[A,_]=s.useState(!1),[G,I]=s.useState(null),[K,U]=s.useState(null),[V,W]=s.useState(null),[q,Z]=s.useState(null),[se,te]=s.useState(new Map),[le,me]=s.useState(new Map),[he,ge]=s.useState(25),[je,be]=s.useState(25),Ne=s.useRef(null),[fe,ye]=s.useState(!1),we=s.useMemo(()=>(null==t?void 0:t.neighbors)??{},[null==t?void 0:t.neighbors]),ke=s.useMemo(()=>Object.fromEntries(Object.entries(we).filter(([e])=>!a.has(e))),[we,a]),Me=y(),Se=null==t?void 0:t.local_hash,Le=s.useMemo(()=>{const e=new Map;if(!(null==Me?void 0:Me.latitude)||!(null==Me?void 0:Me.longitude))return e;for(const[s,t]of Object.entries(ke))t.latitude&&t.longitude&&0!==t.latitude&&0!==t.longitude?e.set(s,De(Me.latitude,Me.longitude,t.latitude,t.longitude)):e.set(s,null);return e},[ke,Me]),{neighborHashSet:He,neighborSignalMap:Fe}=s.useMemo(()=>{const e=new Set,s=new Map;for(const t of d)e.add(t.hash),s.set(t.hash,{avgRssi:t.avgRssi,avgSnr:t.avgSnr});return{neighborHashSet:e,neighborSignalMap:s}},[d]),Ee=s.useMemo(()=>{const e=T.toLowerCase().trim(),s="neighbor"===e||"neighbors"===e,t=A||s;return Object.fromEntries(Object.entries(ke).filter(([a,n])=>{if(t&&!He.has(a))return!1;if(s)return!0;if(!e)return!0;const l=(n.node_name||n.name||"").toLowerCase(),c=a.slice(2,4).toLowerCase();return l.includes(e)||c.includes(e)||a.toLowerCase().includes(e)}))},[ke,T,A,He]),Re=s.useMemo(()=>Object.entries(Ee).sort(([e,s],[t,a])=>{let n=0;switch(P){case"lastHeard":n=(s.last_seen||0)-(a.last_seen||0);break;case"distance":{const s=Le.get(e)??null,a=Le.get(t)??null;n=null===s&&null===a?0:null===s?1:null===a?-1:s-a;break}case"centrality":n=(o.get(e)||0)-(o.get(t)||0)}return"desc"===E?-n:n}),[Ee,P,E,Le,o]),Te=Re.filter(([,e])=>e.latitude&&e.longitude&&0!==e.latitude&&0!==e.longitude).length,$e=s.useMemo(()=>new Set(c),[c]),Ae=s.useMemo(()=>0===he?Re:Re.slice(0,je),[Re,je,he]);s.useEffect(()=>{be(he||Re.length)},[P,E,T,A,he,Re.length]),s.useEffect(()=>{if(0===he)return;const e=new IntersectionObserver(e=>{e[0].isIntersecting&&jeMath.min(e+he,Re.length))},{threshold:.1,rootMargin:"100px"});return Ne.current&&e.observe(Ne.current),()=>e.disconnect()},[he,je,Re.length]);const ze=s.useCallback(e=>{ge(e),be(e||Re.length),ye(!1)},[Re.length]),Ge=s.useCallback(e=>{P===e?R(e=>"desc"===e?"asc":"desc"):(F(e),R("desc"))},[P]),Ie=s.useCallback(e=>{const s=ke[e];(null==s?void 0:s.latitude)&&(null==s?void 0:s.longitude)&&0!==s.latitude&&0!==s.longitude&&I(e)},[ke]),Ke=s.useCallback(()=>{I(null)},[]),Ue=s.useCallback(async(e,s)=>{if(s.stopPropagation(),!q){Z(e),te(s=>{const t=new Map(s);return t.delete(e),t}),me(s=>{const t=new Map(s);return t.delete(e),t});try{const s=e.startsWith("0x")?e.slice(0,4):`0x${e.slice(0,2)}`,t=await S(s,30);t.success&&t.data?(te(s=>new Map(s).set(e,t.data)),setTimeout(()=>{te(s=>{const t=new Map(s);return t.delete(e),t})},1e4)):(me(s=>new Map(s).set(e,t.error||"Ping failed")),setTimeout(()=>{me(s=>{const t=new Map(s);return t.delete(e),t})},5e3))}catch(t){const s=t instanceof Error?t.message:"Ping failed";me(t=>new Map(t).set(e,s)),setTimeout(()=>{me(s=>{const t=new Map(s);return t.delete(e),t})},5e3)}finally{Z(null)}}},[q]);return e.jsxs(L,{children:[e.jsx(H,{title:"Contacts",icon:e.jsx(Y,{}),controls:e.jsxs("div",{className:"flex items-baseline gap-3 sm:gap-4",children:[e.jsxs("span",{className:"roster-title tabular-nums",children:[Re.length," node",1!==Re.length?"s":""]}),Te>0&&e.jsxs("span",{className:"roster-title flex items-baseline gap-1.5 tabular-nums",children:[e.jsx(ee,{className:"w-3.5 h-3.5 relative top-[2px]"}),Te," with location"]})]})}),m?e.jsx(ve,{neighbors:ke,localNode:Me??void 0,localHash:Se,onRemoveNode:n,selectedNodeHash:G,onNodeSelected:Ke,highlightedEdgeKey:K,highlightedGhost:V}):e.jsx("div",{className:"glass-card aspect-video flex items-center justify-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-3",children:[e.jsx("div",{className:"w-6 h-6 border-2 border-accent-primary border-t-transparent rounded-full animate-spin"}),e.jsx("span",{className:"text-sm text-text-muted",children:"Loading map..."})]})}),e.jsx(Ce,{maxPaths:10,highlightedEdge:K,onHighlightEdge:U}),x.length>0&&(m?e.jsx("div",{className:"chart-container",children:e.jsx(Pe,{neighbors:ke,onGhostSelect:W})}):e.jsxs("div",{className:"glass-card",children:[e.jsxs("div",{className:"chart-header",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 rounded bg-bg-elevated animate-pulse"}),e.jsx("div",{className:"w-24 h-4 rounded bg-bg-elevated animate-pulse"})]}),e.jsx("div",{className:"w-6 h-6 rounded bg-bg-elevated animate-pulse"})]}),e.jsx("div",{className:"px-5 py-3",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-20 h-4 rounded bg-bg-elevated animate-pulse"}),e.jsx("div",{className:"w-16 h-4 rounded bg-bg-elevated animate-pulse"})]})})]})),e.jsx("div",{className:"chart-container",children:m?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"chart-header",children:[e.jsxs("div",{className:"chart-title",children:[e.jsx(Y,{className:"chart-title-icon"}),"Discovered Contacts"]}),e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2",children:[He.size>0&&e.jsxs("button",{onClick:()=>_(!A),className:"flex items-center gap-1 px-1.5 sm:px-2.5 py-1.5 text-sm rounded-lg transition-colors "+(A?"bg-accent-success/20 text-accent-success border border-accent-success/30":"text-text-muted hover:text-text-secondary hover:bg-white/5 border border-transparent"),title:A?"Show all contacts":"Show only MeshCore neighbors (direct RF contact)",children:[e.jsx(w,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Neighbors"}),e.jsx("span",{className:"sm:hidden tabular-nums",children:He.size})]}),e.jsxs("div",{className:"relative",children:[e.jsx(D,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-text-muted"}),e.jsx("input",{type:"text",name:"contact-search",id:"contact-search",autoComplete:"off",value:T,onChange:e=>$(e.target.value),placeholder:"Search...",className:"w-20 sm:w-28 lg:w-32 pl-6 sm:pl-7 pr-6 py-1.5 text-sm bg-white/5 border border-white/10 rounded-lg text-text-primary placeholder:text-text-muted focus:outline-none focus:border-accent-primary/50"}),T&&e.jsx("button",{onClick:()=>{$(""),"neighbor"!==T.toLowerCase().trim()&&"neighbors"!==T.toLowerCase().trim()||_(!1)},className:"absolute right-1.5 top-1/2 -translate-y-1/2 text-text-muted hover:text-text-secondary p-0.5",children:e.jsx(k,{className:"w-3 h-3"})})]}),e.jsxs("div",{className:"flex items-center gap-0.5 sm:gap-1",children:[e.jsxs("button",{onClick:()=>Ge("lastHeard"),className:"flex items-center gap-1 p-1.5 sm:px-2 sm:py-1.5 text-sm rounded-lg transition-colors "+("lastHeard"===P?"bg-accent-primary/20 text-accent-primary":"text-text-muted hover:text-text-secondary hover:bg-white/5"),title:"Sort by last heard",children:[e.jsx(i,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Recent"}),"lastHeard"===P&&e.jsx(xe,{className:"w-3 h-3 "+("asc"===E?"rotate-180":"")})]}),e.jsxs("button",{onClick:()=>Ge("distance"),className:"flex items-center gap-1 p-1.5 sm:px-2 sm:py-1.5 text-sm rounded-lg transition-colors "+("distance"===P?"bg-accent-primary/20 text-accent-primary":"text-text-muted hover:text-text-secondary hover:bg-white/5"),title:"Sort by distance",children:[e.jsx(ue,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Distance"}),"distance"===P&&e.jsx(xe,{className:"w-3 h-3 "+("asc"===E?"rotate-180":"")})]}),e.jsxs("button",{onClick:()=>Ge("centrality"),className:"flex items-center gap-1 p-1.5 sm:px-2 sm:py-1.5 text-sm rounded-lg transition-colors "+("centrality"===P?"bg-accent-primary/20 text-accent-primary":"text-text-muted hover:text-text-secondary hover:bg-white/5"),title:"Sort by network centrality",children:[e.jsx(O,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Centrality"}),"centrality"===P&&e.jsx(xe,{className:"w-3 h-3 "+("asc"===E?"rotate-180":"")})]})]}),e.jsxs("div",{className:"relative",children:[e.jsxs("button",{onClick:()=>ye(!fe),className:"flex items-center gap-1 px-2 py-1.5 text-sm text-text-muted hover:text-text-secondary hover:bg-white/5 rounded-lg transition-colors",title:"Items per page",children:[e.jsx("span",{className:"tabular-nums",children:0===he?"All":he}),e.jsx(r,{className:"w-3 h-3 transition-transform "+(fe?"rotate-180":"")})]}),fe&&e.jsx("div",{className:"absolute right-0 top-full mt-1 z-50 bg-bg-surface border border-border-subtle rounded-lg shadow-lg py-1 min-w-[80px]",children:[25,50,100,0].map(s=>e.jsx("button",{onClick:()=>ze(s),className:"w-full px-3 py-1.5 text-sm text-left hover:bg-white/5 transition-colors "+(he===s?"text-accent-primary":"text-text-secondary"),children:0===s?"All":s},s))})]})]})]}),Re.length>0?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"hidden sm:grid contacts-grid-header border-b border-border-subtle/50 px-3 py-2 text-[10px] uppercase tracking-wider text-text-muted",children:[e.jsx("div",{className:"contacts-col-node",children:"Node"}),e.jsx("div",{className:"contacts-col-signal text-right",children:"Signal"}),e.jsx("div",{className:"contacts-col-distance text-right",children:"Distance"}),e.jsx("div",{className:"contacts-col-centrality text-right",children:"Centrality"}),e.jsx("div",{className:"contacts-col-activity text-center",children:"Activity"}),e.jsx("div",{className:"contacts-col-seen text-right",children:"Last Seen"}),e.jsx("div",{className:"contacts-col-actions"})]}),e.jsx("div",{className:"divide-y divide-border-subtle/30",children:Ae.map(([s,t])=>{var a;const n=t.latitude&&t.longitude&&0!==t.latitude&&0!==t.longitude,l=t.node_name||t.name||"Unknown",c=$e.has(s),r=He.has(s),i=Le.get(s),d=o.get(s)||0,x=r?Fe.get(s):void 0,m=r&&x,h=null==(a=t.contact_type)?void 0:a.toLowerCase(),u="room server"===h||"room_server"===h||"room"===h||"server"===h,g="companion"===h,j="client"===h||"cli"===h,b=t.is_repeater||"repeater"===h||"rep"===h,N=r?"direct":"flood",v=r?"Direct RF contact (zero-hop neighbor)":"Flood routing (multi-hop via mesh)";return e.jsxs("div",{className:`contacts-grid-row ${c?"bg-amber-500/5 border-l-2 border-l-amber-400":""} ${n?"cursor-pointer hover:bg-white/[0.02]":""}`,onClick:()=>Ie(s),children:[e.jsxs("div",{className:"contacts-col-node flex items-center gap-2 min-w-0",children:[m&&null!==(null==x?void 0:x.avgSnr)?e.jsx("div",{className:"w-2 h-2 rounded-full flex-shrink-0 self-center "+(y=x.avgSnr,void 0===y?"bg-[var(--signal-unknown)]":y>=5?"bg-[var(--signal-excellent)]":y>=0?"bg-[var(--signal-good)]":y>=-5?"bg-[var(--signal-fair)]":y>=-10?"bg-[var(--signal-poor)]":"bg-[var(--signal-critical)]")}):e.jsx("div",{className:"w-2 flex-shrink-0"}),e.jsx("div",{className:"roster-icon flex-shrink-0",title:v,children:u&&b?e.jsxs("div",{className:"relative w-5 h-5",children:[e.jsx(pe,{className:"w-5 h-5 absolute inset-0 text-sys-pink"}),e.jsx(ce,{className:"w-2.5 h-2.5 absolute -bottom-0.5 -right-0.5 text-sys-teal"})]}):u?e.jsx(pe,{className:"w-5 h-5 text-sys-pink"}):g?e.jsx(re,{className:"w-5 h-5 text-text-muted"}):b?"direct"===N?e.jsx(de,{className:"w-5 h-5 text-sys-green"}):e.jsx(ce,{className:"w-5 h-5 text-sys-cyan"}):e.jsx(re,{className:"w-5 h-5 text-text-muted"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5 overflow-hidden",children:[e.jsx("span",{className:"roster-title truncate",title:l,children:l}),r&&e.jsx(C,{color:ae.neighbor,compact:!0,className:"flex-shrink-0",children:"NBR"}),c&&e.jsxs(C,{color:ae.hub,compact:!0,className:"flex items-center gap-1 flex-shrink-0",children:[e.jsx(ie,{className:"w-3 h-3"}),"HUB"]}),b&&e.jsx(C,{color:ae.repeater,compact:!0,className:"flex-shrink-0",children:"RPT"}),u&&e.jsx(C,{color:ae.room,compact:!0,className:"flex-shrink-0",children:"ROOM"}),g&&e.jsx(C,{color:ae.companion,compact:!0,className:"flex-shrink-0",children:"COMP"}),j&&e.jsx(C,{color:ae.client,compact:!0,className:"flex-shrink-0",children:"CLIENT"})]}),e.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[e.jsx(B,{copy:!0,size:"compact",truncate:[8,6],children:s}),e.jsx(_e,{hash:s})]})]})]}),e.jsxs("div",{className:"contacts-col-signal flex items-center justify-end gap-2",children:[m&&null!==(null==x?void 0:x.avgRssi)&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(ne,{rssi:x.avgRssi,className:"w-3.5 h-3.5"}),e.jsx("span",{className:"type-data-xs tabular-nums text-text-muted",children:Math.round(x.avgRssi)})]}),m&&null!==(null==x?void 0:x.avgSnr)&&e.jsxs("span",{className:"type-data-xs tabular-nums text-text-muted",children:[x.avgSnr.toFixed(1)," dB"]})]}),e.jsx("div",{className:"contacts-col-distance flex items-center justify-end gap-1 text-text-muted",children:null!=i&&e.jsxs(e.Fragment,{children:[e.jsx(ue,{className:"w-3 h-3"}),e.jsx("span",{className:"type-data-xs tabular-nums",children:(f=i,f<1e3?`${Math.round(f)}m`:`${(f/1e3).toFixed(1)}km`)})]})}),e.jsx("div",{className:"contacts-col-centrality flex items-center justify-end gap-1",children:d>0&&e.jsxs(e.Fragment,{children:[e.jsx(O,{className:"w-3 h-3 text-accent-secondary"}),e.jsxs("span",{className:"type-data-xs tabular-nums text-text-muted",children:[(100*d).toFixed(0),"%"]})]})}),e.jsx("div",{className:"contacts-col-activity flex items-center justify-center",children:e.jsx(Oe,{nodeHash:s,width:48,height:16})}),e.jsx("div",{className:"contacts-col-seen flex items-center justify-end",children:e.jsx("span",{className:"type-data-xs tabular-nums text-text-primary whitespace-nowrap",children:t.last_seen?M(t.last_seen):"—"})}),e.jsxs("div",{className:"contacts-col-actions flex items-center justify-end gap-1",children:[r&&e.jsx(e.Fragment,{children:se.has(s)?e.jsxs("div",{className:"flex items-center gap-1 text-accent-success",title:`RTT: ${se.get(s).rtt_ms.toFixed(0)}ms`,children:[e.jsx(X,{className:"w-3.5 h-3.5"}),e.jsxs("span",{className:"type-data-xs tabular-nums hidden sm:inline",children:[se.get(s).snr_db.toFixed(1),"dB"]})]}):le.has(s)?e.jsx("span",{className:"text-red-400 text-[10px]",title:le.get(s),children:"✗"}):e.jsx("button",{onClick:e=>Ue(s,e),disabled:null!==q,className:"p-1 sm:p-1.5 rounded-lg text-text-muted/50 hover:text-accent-primary hover:bg-accent-primary/10 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:"Ping neighbor for updated signal info",children:q===s?e.jsx(oe,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4 animate-spin"}):e.jsx(z,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})})}),e.jsx("button",{onClick:e=>{e.stopPropagation(),p({hash:s,name:l})},className:"p-1 sm:p-1.5 rounded-lg text-text-muted/50 hover:text-red-400 hover:bg-red-500/10 transition-colors",title:"Remove contact",children:e.jsx(J,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})})]})]},s);var f,y})}),he>0&&je0&&jebe(e=>Math.min(e+he,Re.length)),className:"text-accent-primary hover:text-accent-primary/80 transition-colors",children:"Load more"})]})]}):e.jsxs("div",{className:"roster-empty",children:[e.jsx(Y,{className:"roster-empty-icon"}),e.jsx("div",{className:"type-label text-text-secondary",children:"No Contacts Discovered"}),e.jsx("div",{className:"type-data-xs text-text-muted mt-1",children:"Contacts will appear here as they advertise on the mesh network."})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"chart-header",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 rounded bg-bg-elevated animate-pulse"}),e.jsx("div",{className:"w-32 h-4 rounded bg-bg-elevated animate-pulse"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-16 h-6 rounded bg-bg-elevated animate-pulse"}),e.jsx("div",{className:"w-24 h-6 rounded bg-bg-elevated animate-pulse"}),e.jsx("div",{className:"w-16 h-6 rounded bg-bg-elevated animate-pulse"})]})]}),e.jsx("div",{className:"px-3 py-3 space-y-3",children:[...Array(5)].map((s,t)=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-5 h-5 rounded bg-bg-elevated animate-pulse"}),e.jsxs("div",{className:"flex-1 space-y-1.5",children:[e.jsx("div",{className:"h-4 w-32 rounded bg-bg-elevated animate-pulse"}),e.jsx("div",{className:"h-3 w-24 rounded bg-bg-elevated animate-pulse"})]}),e.jsx("div",{className:"w-12 h-4 rounded bg-bg-elevated animate-pulse"}),e.jsx("div",{className:"w-16 h-4 rounded bg-bg-elevated animate-pulse"})]},t))})]})}),e.jsx(Q,{isOpen:!!h,title:"Remove Contact",message:`Are you sure you would like to remove ${(null==h?void 0:h.name)||"this contact"}?`,confirmLabel:"Remove",cancelLabel:"Cancel",variant:"danger",onConfirm:()=>{h&&n(h.hash),p(null)},onCancel:()=>p(null)})]})}},Symbol.toStringTag,{value:"Module"}));export{ze as C,pe as M,Oe as N,_e as P,ue as R}; diff --git a/frontend/dist/assets/Contacts-CyyU4xmf.js b/frontend/dist/assets/Contacts-CyyU4xmf.js deleted file mode 100644 index d1e713aa..00000000 --- a/frontend/dist/assets/Contacts-CyyU4xmf.js +++ /dev/null @@ -1,2 +0,0 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ContactsMapMapLibre-ByNdgqAN.js","assets/vendor-react-C341c8YC.js","assets/vendor-core-WoOfkQwm.js","assets/link-scoring-Cw0dJsWv.js","assets/index-BJEgt3tp.js","assets/ConfirmModal-CYXFGX_W.js","assets/DeepAnalysisModal-D4eqwCNZ.js","assets/useThemeColors-AeHMyThq.js","assets/font-loader-jlbdh9Fw.js","assets/BasemapLayer-S9Ush6Hh.js","assets/SignalIndicator-BLrEkFNb.js","assets/ping-DvLgBqTv.js","assets/PageLayout-CnF5SScd.js","assets/DataBox-CRX76VsB.js","assets/CollisionExplorerModal-DTnzK_xA.js","assets/maplibre-gl-B1CfjdFi.css","assets/index-CIefRaAd.css"])))=>i.map(i=>d[i]); -import{j as e,r as s,aJ as t,at as a,Z as n,q as l,aH as c,C as i,aK as r,a9 as o,ax as d,Y as x,_ as m,al as h,aL as p,aM as u,$ as g,as as j,ak as N,ar as b,aN as v,D as f,aO as y,az as w,ad as k,aP as C,E as S,aQ as M,X as L,aR as P,aS as H,aT as F,aU as E,aV as R,aW as $,aX as T,aq as _,aY as O,aZ as A}from"./vendor-react-C341c8YC.js";import{X as D,Y as z,M as W,Z as G,_ as U,$ as I,r as K,a0 as B,n as V,a1 as q,h as Y,a2 as Z,a3 as X,a4 as J,f as Q,p as ee,a5 as se,B as te,a6 as ae}from"./index-BJEgt3tp.js";import{p as ne}from"./ping-DvLgBqTv.js";import{P as le,b as ce}from"./PageLayout-CnF5SScd.js";import{_ as ie}from"./deckgl-DTsmDcfs.js";import{n as re,L as oe,T as de,u as xe}from"./recharts-6XUQYgRA.js";import{D as me}from"./DataBox-CRX76VsB.js";import{C as he,a as pe}from"./SignalIndicator-BLrEkFNb.js";import{C as ue}from"./CollisionExplorerModal-DTnzK_xA.js";import{C as ge}from"./ConfirmModal-CYXFGX_W.js";class je extends s.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}render(){var s;return this.state.hasError?e.jsx("div",{className:"map-container-16-9 glass-card flex items-center justify-center",role:"alert","aria-live":"assertive",children:e.jsxs("div",{className:"text-center text-white/50 p-4",children:[e.jsx("p",{className:"text-lg mb-2",children:"Map failed to load"}),e.jsx("p",{className:"text-sm text-white/30",children:(null==(s=this.state.error)?void 0:s.message)||"Unknown error"}),e.jsx("p",{className:"text-xs text-white/20 mt-2",children:"Try refreshing the page or check your browser's WebGL support."})]})}):this.props.children}}const Ne=s.lazy(()=>ie(()=>import("./ContactsMapMapLibre-ByNdgqAN.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16])));function be({neighbors:t,localNode:a,localHash:n,onRemoveNode:l,selectedNodeHash:c,onNodeSelected:i,highlightedEdgeKey:r,highlightedGhost:o}){return e.jsx(je,{children:e.jsx(s.Suspense,{fallback:e.jsx("div",{className:"map-container-16-9 glass-card flex items-center justify-center",role:"status","aria-live":"polite","aria-label":"Loading map",children:e.jsxs("div",{className:"text-white/50 flex items-center gap-3",children:[e.jsx("div",{className:"w-5 h-5 border-2 border-accent-primary border-t-transparent rounded-full animate-spin","aria-hidden":"true"}),e.jsx("span",{children:"Loading map..."})]})}),children:e.jsx(Ne,{neighbors:t,localNode:a,localHash:n,onRemoveNode:l,selectedNodeHash:c,onNodeSelected:i,highlightedEdgeKey:r,highlightedGhost:o})})})}function ve(e){return e>=.7?"text-accent-success":e>=.5?"text-accent-secondary":e>=.3?"text-signal-poor":"text-accent-danger"}function fe(e){return`${Math.round(100*e)}%`}function ye(e,s){return s.has(e.toUpperCase())}const we=s.memo(function({path:s,isHighlighted:t,onHighlight:c,ghostPrefixes:i}){const r=function(s){return s>.2?{icon:e.jsx(x,{className:"w-3 h-3"}),color:"text-accent-success"}:s<-.2?{icon:e.jsx(n,{className:"w-3 h-3"}),color:"text-accent-danger"}:{icon:e.jsx(m,{className:"w-3 h-3"}),color:"text-text-muted"}}(s.observationTrend),h=s.weakestLinkKey&&s.weakestLinkConfidence<.5,p=s.hops.some(e=>ye(e,i));return e.jsxs("div",{className:"flex items-center gap-3 p-2 rounded-md transition-colors cursor-pointer "+(t?"bg-accent-primary/20 border border-accent-primary/40":"hover:bg-white/5"),onClick:()=>c(t?null:s.weakestLinkKey),children:[e.jsx("div",{className:"flex-shrink-0 w-12 text-center py-1 rounded-md "+(u=s.healthScore,u>=.7?"bg-accent-success/10":u>=.5?"bg-accent-secondary/10":u>=.3?"bg-signal-poor/10":"bg-accent-danger/10"),children:e.jsx("span",{className:`text-xs font-semibold tabular-nums ${ve(s.healthScore)}`,children:fe(s.healthScore)})}),e.jsx("div",{className:"flex-1 flex items-center gap-0.5 overflow-x-auto min-w-0",children:s.hops.map((t,a)=>{var n;const c=ye(t,i),r=h&&(null==(n=s.weakestLinkKey)?void 0:n.includes(t));return e.jsxs("span",{className:"flex items-center",children:[e.jsxs("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded flex items-center gap-0.5 "+(c?"bg-accent-tertiary/20 text-accent-tertiary border border-accent-tertiary/30":r?"bg-accent-danger/20 text-accent-danger":"bg-white/10 text-text-secondary"),children:[c&&e.jsx(l,{className:"w-2.5 h-2.5"}),t]}),anew Set(p.map(e=>e.prefix.toUpperCase())),[p]),N=s.useMemo(()=>m.slice(0,o),[m,o]),b=s.useMemo(()=>0===m.length?null:{avgHealth:m.reduce((e,s)=>e+s.healthScore,0)/m.length,declining:m.filter(e=>e.observationTrend<-.2).length,weakLinks:m.filter(e=>e.weakestLinkConfidence<.5).length,pathsWithGhosts:m.filter(e=>e.hops.some(e=>j.has(e.toUpperCase()))).length},[m,j]),v=e=>{null==d||d(e)};return 0===m.length?null:e.jsxs("div",{className:"chart-container",children:[e.jsxs("button",{onClick:()=>g(!u),className:"w-full chart-header hover:bg-white/5 transition-colors rounded-t-lg cursor-pointer",children:[e.jsxs("div",{className:"chart-title",children:[e.jsx(t,{className:"chart-title-icon"}),"Path Health",e.jsxs("span",{className:"ml-2 text-[10px] font-normal text-text-muted",children:["(",m.length," paths)"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[b&&e.jsxs("div",{className:"flex items-center gap-3 text-[10px]",children:[e.jsxs("span",{className:`tabular-nums ${ve(b.avgHealth)}`,children:["Avg: ",fe(b.avgHealth)]}),b.weakLinks>0&&e.jsxs("span",{className:"text-accent-danger flex items-center gap-1",children:[e.jsx(a,{className:"w-3 h-3"}),b.weakLinks," weak"]}),b.declining>0&&e.jsxs("span",{className:"text-signal-poor flex items-center gap-1",children:[e.jsx(n,{className:"w-3 h-3"}),b.declining," declining"]}),b.pathsWithGhosts>0&&e.jsxs("span",{className:"text-accent-tertiary flex items-center gap-1",children:[e.jsx(l,{className:"w-3 h-3"}),b.pathsWithGhosts," ghost"]})]}),u?e.jsx(c,{className:"w-4 h-4 text-text-muted"}):e.jsx(i,{className:"w-4 h-4 text-text-muted"})]})]}),u&&e.jsxs("div",{className:"p-3 pt-0 space-y-1",children:[h.totalPaths>0&&e.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-text-muted pb-2 border-b border-white/5",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(r,{className:"w-3 h-3 text-accent-primary"}),e.jsx("span",{className:"text-text-secondary",children:h.totalPaths.toLocaleString()})," Viterbi decoded"]}),h.observationOverrideCount>0&&e.jsxs("span",{className:"text-accent-success",children:[Math.round(h.observationOverrideCount/h.totalPaths*100),"% observation override"]}),p.length>0&&e.jsxs("span",{className:"text-accent-tertiary flex items-center gap-1",children:[e.jsx(l,{className:"w-3 h-3"}),p.length," ghost",1!==p.length?"s":""]})]}),e.jsxs("div",{className:"flex items-center gap-4 text-[10px] text-text-muted pb-2 border-b border-white/5",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-accent-success"})," Healthy (≥70%)"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-accent-secondary"})," Fair (50-70%)"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-signal-poor"})," Weak (30-50%)"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-accent-danger"})," Critical (<30%)"]}),p.length>0&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(l,{className:"w-3 h-3 text-accent-tertiary"})," Ghost"]})]}),e.jsx("div",{className:"space-y-1 max-h-64 overflow-y-auto",children:N.map(s=>e.jsx(we,{path:s,isHighlighted:x===s.weakestLinkKey,onHighlight:v,ghostPrefixes:j},s.pathKey))}),m.length>o&&e.jsxs("div",{className:"text-center text-[10px] text-text-muted pt-2",children:["Showing top ",o," of ",m.length," paths"]})]})]})});function Ce(e){switch(e){case"rf_intersection":return"RF Circle Intersection";case"weighted_centroid":return"Weighted Centroid";case"single_anchor":return"Single Anchor (less reliable)";default:return e}}const Se={confirmed:{label:"Confirmed",icon:e.jsx(u,{className:"w-3.5 h-3.5"}),borderClass:"border-accent-success/40",bgClass:"bg-accent-success/10",textClass:"text-accent-success",badgeClass:"bg-accent-success/20 text-accent-success"},likely:{label:"Likely",icon:e.jsx(g,{className:"w-3.5 h-3.5"}),borderClass:"border-accent-tertiary/30",bgClass:"bg-accent-tertiary/5",textClass:"text-accent-tertiary",badgeClass:"bg-accent-tertiary/20 text-accent-tertiary"},possible:{label:"Possible",icon:e.jsx(j,{className:"w-3.5 h-3.5"}),borderClass:"border-accent-secondary/20",bgClass:"bg-accent-secondary/5",textClass:"text-accent-secondary",badgeClass:"bg-accent-secondary/20 text-accent-secondary"},noise:{label:"Noise",icon:e.jsx(a,{className:"w-3.5 h-3.5"}),borderClass:"border-border-muted",bgClass:"bg-bg-card/30",textClass:"text-text-muted",badgeClass:"bg-bg-elevated text-text-muted"}};function Me({ghost:t,neighbors:n,isExpanded:o,onToggle:x,compact:m}){var h,p;const u=(null==(h=t.classification)?void 0:h.tier)??"noise",g=Se[u],j="clusterId"in(w=t)&&"temporal"in w;var w;const k=s.useMemo(()=>Array.from(t.commonNeighbors).map(e=>{var s;return{hash:e,name:null==(s=n[e])?void 0:s.name}}),[t.commonNeighbors,n]),C=t.estimatedLocation?t.estimatedLocation.uncertaintyM>=1e3?`±${(t.estimatedLocation.uncertaintyM/1e3).toFixed(1)}km`:`±${Math.round(t.estimatedLocation.uncertaintyM)}m`:null,S=j&&t.temporal?(M=t.temporal.consistency)>=.7?{label:"Steady",color:"text-accent-success"}:M>=.4?{label:"Regular",color:"text-accent-tertiary"}:M>=.2?{label:"Sporadic",color:"text-accent-secondary"}:{label:"Bursty",color:"text-signal-poor"}:null;var M;const L=j&&t.collisionCandidates&&t.collisionCandidates.length>0,P=L?t.collisionCandidates[0]:null;return m?e.jsxs("div",{className:"inline-flex items-center gap-1.5 px-2 py-1 rounded bg-bg-elevated/50 text-sm",children:[e.jsx("span",{className:"font-mono font-medium text-text-secondary",children:t.prefix.toUpperCase()}),e.jsx("span",{className:"text-text-muted",children:t.observationCount})]}):e.jsxs("div",{className:re("rounded-lg border transition-all duration-150",g.borderClass,g.bgClass),children:[e.jsxs("button",{onClick:x,className:"w-full flex items-center gap-3 px-3 py-2 text-left hover:bg-white/5 rounded-lg",children:[e.jsx(l,{className:re("w-5 h-5 flex-shrink-0",g.textClass)}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-mono text-sm font-semibold text-text-primary",children:t.prefix.toUpperCase()}),e.jsx("span",{className:re("px-1.5 py-0.5 rounded text-sm font-medium",g.badgeClass),children:g.label})]}),e.jsx("div",{className:re("text-sm mt-0.5",g.textClass),children:(null==(p=t.classification)?void 0:p.reason)??"Unknown"}),e.jsxs("div",{className:"flex items-center gap-3 text-sm text-text-muted mt-1",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(r,{className:"w-3 h-3"}),t.observationCount]}),e.jsxs("span",{children:[(100*t.confidence).toFixed(0),"%"]}),t.commonNeighbors.size>0&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(N,{className:"w-3 h-3"}),t.commonNeighbors.size]}),t.estimatedLocation&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(b,{className:"w-3 h-3"}),C]}),S&&e.jsxs("span",{className:re("flex items-center gap-1",S.color),children:[e.jsx(d,{className:"w-3 h-3"}),S.label]}),L&&e.jsxs("span",{className:"flex items-center gap-1 text-signal-poor",children:[e.jsx(v,{className:"w-3 h-3"}),"Collision?"]})]})]}),o?e.jsx(c,{className:"w-4 h-4 text-text-muted"}):e.jsx(i,{className:"w-4 h-4 text-text-muted"})]}),o&&e.jsxs("div",{className:"px-3 pb-3 space-y-3 border-t border-border-muted/50 mt-1 pt-3",children:[L&&P&&e.jsx("div",{className:"p-2 rounded bg-signal-poor/10 border border-signal-poor/30",children:e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(v,{className:"w-4 h-4 text-signal-poor flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-signal-poor font-medium",children:"Possible collision with known node"}),e.jsx("div",{className:"text-text-secondary mt-0.5",children:P.knownNodeName?e.jsxs("span",{children:["May match ",e.jsx("span",{className:"font-medium",children:P.knownNodeName})," ","(",(100*P.collisionProbability).toFixed(0),"% probability)"]}):e.jsxs("span",{children:["May match ",e.jsx(me,{copy:!0,size:"compact",className:"inline",children:P.knownNodeHash})," ","(",(100*P.collisionProbability).toFixed(0),"% probability)"]})}),P.evidence&&e.jsxs("div",{className:"text-text-muted mt-1 text-[10px]",children:[P.evidence.sharedEdgeCount>0&&e.jsxs("span",{className:"mr-2",children:[P.evidence.sharedEdgeCount," shared edges"]}),void 0!==P.evidence.distanceKm&&e.jsxs("span",{className:"mr-2",children:[P.evidence.distanceKm.toFixed(1),"km apart"]}),P.evidence.withinUncertainty&&e.jsx("span",{className:"text-accent-secondary",children:"Within uncertainty radius"})]})]})]})}),t.estimatedLocation?e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(b,{className:"w-4 h-4 text-accent-primary mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-sm",children:[e.jsxs("div",{className:"text-text-primary font-medium",children:[t.estimatedLocation.lat.toFixed(5),", ",t.estimatedLocation.lon.toFixed(5)]}),e.jsxs("div",{className:"text-text-muted",children:["Uncertainty: ",C]}),j&&t.location&&e.jsxs("div",{className:"mt-1 text-text-muted",children:[e.jsxs("div",{children:["Method: ",Ce(t.location.method)]}),t.location.anchors&&t.location.anchors.length>0&&e.jsxs("div",{children:[t.location.anchors.length," anchor",1!==t.location.anchors.length?"s":""," used"," · ",(100*t.location.locationConfidence).toFixed(0),"% confidence"]})]})]})]}):e.jsxs("div",{className:"flex items-center gap-2 text-sm text-text-muted",children:[e.jsx(a,{className:"w-4 h-4 text-signal-poor"}),"Location unknown (neighbors lack coordinates)"]}),j&&t.temporal&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(d,{className:"w-4 h-4 text-text-muted mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-sm",children:[e.jsxs("div",{className:"text-text-primary font-medium",children:["Temporal Pattern: ",e.jsx("span",{className:null==S?void 0:S.color,children:null==S?void 0:S.label})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-0.5 mt-1 text-text-muted",children:[e.jsxs("span",{children:["Distinct hours: ",t.temporal.distinctHours]}),e.jsxs("span",{children:["Distinct days: ",t.temporal.distinctDays]}),e.jsxs("span",{children:["Burstiness: ",(100*t.temporal.burstiness).toFixed(0),"%"]}),e.jsxs("span",{children:["Consistency: ",(100*t.temporal.consistency).toFixed(0),"%"]}),e.jsxs("span",{children:["Last 24h: ",t.temporal.last24HourCount," obs"]}),e.jsxs("span",{children:["Active hours: ",t.temporal.activeHoursLast24,"/24"]})]})]})]}),!j&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(f,{className:"w-4 h-4 text-text-muted mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-sm",children:[e.jsxs("div",{className:"text-text-primary",children:["First seen: ",G(t.firstSeen)," ago"]}),e.jsxs("div",{className:"text-text-muted",children:["Last seen: ",G(t.lastSeen)," ago"]})]})]}),j&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(y,{className:"w-4 h-4 text-text-muted mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-sm",children:[e.jsxs("div",{className:"text-text-primary",children:["Active period: ",G(t.firstSeen)," – ",G(t.lastSeen)," ago"]}),t.temporal&&e.jsxs("div",{className:"text-text-muted",children:["Obs/hour avg: ",t.temporal.observationsPerHour.toFixed(1)]})]})]}),k.length>0&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(N,{className:"w-4 h-4 text-text-muted mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-sm",children:[e.jsxs("div",{className:"text-text-muted mb-1",children:["Adjacent to ",k.length," known node",1!==k.length?"s":"",":"]}),e.jsxs("div",{className:"flex flex-wrap gap-1",children:[k.slice(0,5).map(({hash:s})=>e.jsx(me,{copy:!0,size:"compact",children:s},s)),k.length>5&&e.jsxs("span",{className:"text-text-muted",children:["+",k.length-5," more"]})]})]})]}),j&&t.validationStages&&e.jsxs("div",{className:"pt-2 border-t border-border-muted/30",children:[e.jsx("div",{className:"text-[10px] text-text-muted mb-1.5 uppercase tracking-wide",children:"Validation Stages"}),e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[e.jsx(Le,{label:"Candidates",passed:t.validationStages.candidateExhaustion}),e.jsx(Le,{label:"Temporal",passed:t.validationStages.temporalConsistency}),e.jsx(Le,{label:"Topology",passed:t.validationStages.topologicalFit}),e.jsx(Le,{label:"Location",passed:t.validationStages.locationPlausible})]})]}),t.classification&&!j&&e.jsx("div",{className:"pt-2 border-t border-border-muted/30",children:e.jsxs("div",{className:"flex flex-wrap gap-1",children:[t.classification.criteria.hasVeryHighObservations&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] bg-accent-success/20 text-accent-success",children:"200+ obs"}),t.classification.criteria.hasHighObservations&&!t.classification.criteria.hasVeryHighObservations&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] bg-accent-tertiary/20 text-accent-tertiary",children:"50+ obs"}),t.classification.criteria.hasHighConfidence&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] bg-accent-success/20 text-accent-success",children:"70%+ conf"}),t.classification.criteria.hasCommonNeighbors&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] bg-accent-primary/20 text-accent-primary",children:"2+ neighbors"}),t.classification.criteria.hasGoodLocation&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] bg-accent-primary/20 text-accent-primary",children:"good loc"}),t.classification.criteria.isRecent&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] bg-text-muted/20 text-text-muted",children:"recent"})]})}),j&&t.upgradeRequirements&&t.upgradeRequirements.length>0&&"confirmed"!==u&&e.jsxs("div",{className:"pt-2 border-t border-border-muted/30",children:[e.jsx("div",{className:"text-[10px] text-text-muted mb-1 uppercase tracking-wide",children:"To upgrade tier:"}),e.jsx("ul",{className:"text-xs text-text-secondary space-y-0.5",children:t.upgradeRequirements.slice(0,3).map((s,t)=>e.jsxs("li",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"text-accent-tertiary",children:"•"})," ",s]},t))})]})]})]})}function Le({label:s,passed:t}){return e.jsxs("span",{className:re("inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium",t?"bg-accent-success/20 text-accent-success":"bg-bg-elevated text-text-muted"),children:[t?e.jsx(w,{className:"w-2.5 h-2.5"}):e.jsx(k,{className:"w-2.5 h-2.5"}),s]})}function Pe({neighbors:t,className:n,onGhostSelect:r}){const o=W(),d=z(),[x,N]=s.useState(new Set),[b,v]=s.useState("actionable"),[f,y]=s.useState(!1),[w,k]=s.useState(!0),[C,S]=s.useState(Date.now);s.useEffect(()=>{S(Date.now())},[o]);const M=s.useMemo(()=>o.filter(e=>!function(e,s){return s-1e3*e.lastSeen>6048e5}(e,C)),[o,C]),L=s.useMemo(()=>{const e=Array.from(x);return e.length>0?e[0]:null},[x]),P=s.useMemo(()=>L?M.find(e=>e.prefix===L)??null:null,[L,M]);s.useEffect(()=>{r&&r(P&&!w?{prefix:P.prefix,commonNeighbors:Array.from(P.commonNeighbors),estimatedLocation:P.estimatedLocation}:null)},[P,w,r]),s.useEffect(()=>{w&&N(new Set)},[w]);const{confirmed:H,likely:F,possible:E,noise:R,actionableCount:$}=s.useMemo(()=>{var e;const s=[],t=[],a=[],n=[];for(const c of M)switch((null==(e=c.classification)?void 0:e.tier)??"noise"){case"confirmed":s.push(c);break;case"likely":t.push(c);break;case"possible":a.push(c);break;case"noise":n.push(c)}const l=(e,s)=>s.observationCount-e.observationCount;return s.sort(l),t.sort(l),a.sort(l),n.sort(l),{confirmed:s,likely:t,possible:a,noise:n,actionableCount:s.length+t.length}},[M]);if(0===M.length)return null;const T=e=>{N(s=>s.has(e)?new Set:new Set([e]))},_="all"===b,O=H.length+F.length+(_?E.length:0)+(f?R.length:0);return e.jsxs("div",{className:n,children:[e.jsxs("div",{className:"chart-header",children:[e.jsxs("div",{className:"chart-title",children:[e.jsx(l,{className:"chart-title-icon"}),"Ghost Buster",$>0&&e.jsxs("span",{className:"px-2 py-0.5 rounded-full text-xs font-medium bg-accent-success/20 text-accent-success",children:[$," actionable"]}),w&&M.length>0&&e.jsxs("span",{className:"text-xs text-text-muted ml-2",children:["(",M.length," total)"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[!w&&e.jsxs("button",{onClick:()=>v(e=>"actionable"===e?"all":"actionable"),className:re("flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors","all"===b?"bg-accent-primary/20 text-accent-primary":"bg-bg-elevated text-text-muted hover:text-text-secondary"),children:[e.jsx(h,{className:"w-3 h-3"}),"actionable"===b?"Actionable":"All"]}),e.jsx("button",{onClick:()=>k(e=>!e),className:"flex items-center gap-1 px-2 py-1 rounded text-xs bg-bg-elevated text-text-muted hover:text-text-secondary transition-colors",title:w?"Expand panel":"Minimize panel",children:w?e.jsx(p,{className:"w-3 h-3"}):e.jsx(m,{className:"w-3 h-3"})})]})]}),w?e.jsxs("div",{className:"px-5 py-3 flex items-center gap-3 text-xs cursor-pointer hover:bg-white/5 transition-colors",onClick:()=>k(!1),children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[H.length>0&&e.jsxs("span",{className:"flex items-center gap-1 text-accent-success",children:[e.jsx(u,{className:"w-3 h-3"}),H.length," confirmed"]}),F.length>0&&e.jsxs("span",{className:"flex items-center gap-1 text-accent-tertiary",children:[e.jsx(g,{className:"w-3 h-3"}),F.length," likely"]}),E.length>0&&e.jsxs("span",{className:"text-accent-secondary",children:[E.length," possible"]}),R.length>0&&e.jsxs("span",{className:"text-text-muted",children:[R.length," noise"]})]}),e.jsx("span",{className:"text-text-muted ml-auto",children:"Click to expand"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"px-5 py-2 flex items-center gap-3 text-xs border-b border-border-muted/30",children:[e.jsxs("span",{className:"text-text-muted",children:[d.pathsWithGhosts.toLocaleString()," / ",d.totalPaths.toLocaleString()," paths"]}),e.jsx("span",{className:"text-text-muted",children:"•"}),e.jsxs("div",{className:"flex items-center gap-2",children:[H.length>0&&e.jsxs("span",{className:"text-accent-success",children:[H.length," confirmed"]}),F.length>0&&e.jsxs("span",{className:"text-accent-tertiary",children:[F.length," likely"]}),E.length>0&&e.jsxs("span",{className:"text-accent-secondary",children:[E.length," possible"]}),R.length>0&&e.jsxs("span",{className:"text-text-muted",children:[R.length," noise"]})]})]}),e.jsxs("div",{className:"px-5 py-4 space-y-4",children:[H.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-accent-success",children:[e.jsx(u,{className:"w-3.5 h-3.5"}),e.jsxs("span",{className:"font-medium",children:["Confirmed Repeaters (",H.length,")"]})]}),e.jsx("div",{className:"space-y-2",children:H.map(s=>e.jsx(Me,{ghost:s,neighbors:t,isExpanded:x.has(s.prefix),onToggle:()=>T(s.prefix)},s.prefix))})]}),F.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-accent-tertiary",children:[e.jsx(g,{className:"w-3.5 h-3.5"}),e.jsxs("span",{className:"font-medium",children:["Likely Repeaters (",F.length,")"]})]}),e.jsx("div",{className:"space-y-2",children:F.map(s=>e.jsx(Me,{ghost:s,neighbors:t,isExpanded:x.has(s.prefix),onToggle:()=>T(s.prefix)},s.prefix))})]}),_&&E.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-accent-secondary",children:[e.jsx(j,{className:"w-3.5 h-3.5"}),e.jsxs("span",{className:"font-medium",children:["Possible (",E.length,")"]})]}),e.jsxs("div",{className:"space-y-2",children:[E.slice(0,10).map(s=>e.jsx(Me,{ghost:s,neighbors:t,isExpanded:x.has(s.prefix),onToggle:()=>T(s.prefix)},s.prefix)),E.length>10&&e.jsxs("div",{className:"text-xs text-text-muted text-center py-1",children:["+",E.length-10," more possible nodes"]})]})]}),R.length>0&&"all"===b&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("button",{onClick:()=>y(!f),className:"flex items-center gap-2 text-xs text-text-muted hover:text-text-secondary transition-colors",children:[f?e.jsx(c,{className:"w-3.5 h-3.5"}):e.jsx(i,{className:"w-3.5 h-3.5"}),e.jsx(a,{className:"w-3.5 h-3.5"}),e.jsxs("span",{children:["Noise (",R.length,")"]})]}),f&&e.jsx("div",{className:"flex flex-wrap gap-1",children:R.map(s=>e.jsx(Me,{ghost:s,neighbors:t,isExpanded:!1,onToggle:()=>{},compact:!0},s.prefix))})]}),"actionable"===b&&0===$&&e.jsxs("div",{className:"text-center py-6 text-sm text-text-muted",children:[e.jsx(l,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:"No confirmed or likely repeaters yet."}),e.jsxs("p",{className:"text-xs mt-1",children:[E.length+R.length," prefixes need more evidence."]}),e.jsxs("button",{onClick:()=>v("all"),className:"mt-3 text-accent-primary hover:underline",children:["View all ",M.length," discovered nodes"]})]}),d.observationOverrideCount>0&&O>0&&e.jsxs("div",{className:"pt-2 border-t border-border-muted/30 text-xs text-text-muted",children:[e.jsx("span",{className:"text-accent-primary",children:d.observationOverrideCount})," observation overrides • Avg confidence: ",e.jsxs("span",{className:"text-accent-secondary",children:[(100*d.avgPathConfidence).toFixed(0),"%"]})]})]})]})]})}const He="var(--sparkline-critical)",Fe="var(--sparkline-poor)",Ee="var(--sparkline-fair)",Re="var(--sparkline-good)",$e="var(--sparkline-excellent)";function Te({active:s,payload:t}){if(!s||!t||!t.length)return null;const a=t[0].payload,n=new Date(a.timestamp),l=`${(n.getMonth()+1).toString().padStart(2,"0")}/${n.getDate().toString().padStart(2,"0")}`;return e.jsxs("div",{className:"bg-tooltip-bg border border-border-subtle rounded px-1.5 py-0.5 text-[10px] shadow-xl",children:[e.jsx("span",{className:"text-text-muted",children:l}),e.jsx("span",{className:"ml-1.5 font-semibold tabular-nums",children:a.count})]})}const _e=s.memo(function({nodeHash:s,width:t=60,height:a=20,color:n,showArea:l=!0,showTooltip:c=!1,className:i=""}){const r=U(s),o=I(),d=!K().backgroundLoadComplete||o,x=n??(r.length>0?function(e){if(0===e.length)return He;const s=e.slice(-4),t=s.reduce((e,s)=>e+s.count,0),a=t/s.length,n=e.reduce((e,s)=>e+s.count,0)/e.length;if(0===t)return He;if(n>0){const e=a/n;return e>=1.2?$e:e>=.8?Re:e>=.4?Ee:e>=.1?Fe:He}return t>=10?$e:t>=5?Re:t>=2?Ee:t>=1?Fe:He}(r):"var(--text-muted)"),m="number"==typeof t?t:60,h=a;return d&&r.length<2?e.jsx("div",{className:`flex items-center justify-center ${i}`,style:{width:m,height:h},children:e.jsx("div",{className:"rounded animate-pulse bg-white/[0.06]",style:{width:m-8,height:h-6}})}):r.length<2?e.jsx("div",{className:`flex items-center justify-center ${i}`,style:{width:m,height:h,color:He},children:e.jsx("svg",{width:m,height:h,viewBox:`0 0 ${m} ${h}`,preserveAspectRatio:"none",children:e.jsx("line",{x1:4,y1:h/2,x2:m-4,y2:h/2,stroke:"currentColor",strokeWidth:1.5,strokeDasharray:"3,2"})})}):e.jsx("div",{className:i,style:{width:m,height:h},children:e.jsxs(oe,{data:r,width:m,height:h,margin:{top:1,right:1,bottom:1,left:1},children:[c&&e.jsx(de,{content:e.jsx(Te,{}),cursor:{stroke:"rgba(255,255,255,0.2)",strokeWidth:1}}),e.jsx(xe,{type:"monotone",dataKey:"count",stroke:x,strokeWidth:1.5,dot:!1,isAnimationActive:!1})]})})}),Oe=s.memo(function({hash:t,className:a="",size:n="sm"}){const l=B(),c=z(),[i,o]=s.useState(!1),d=s.useMemo(()=>V(t),[t]),x=s.useMemo(()=>d?l.find(e=>e.prefix===d)??null:null,[d,l]),m=c.totalPaths>0&&c.avgPathConfidence>=.7,h=s.useCallback(e=>{e.preventDefault(),e.stopPropagation(),o(!0)},[]),p=s.useCallback(()=>{o(!1)},[]);if(!x)return null;const u="sm"===n?"w-3.5 h-3.5":"w-4 h-4",j=m?"text-accent-tertiary hover:text-accent-tertiary hover:bg-accent-tertiary/10 focus:ring-accent-tertiary/50":"text-signal-fair hover:text-accent-secondary hover:bg-signal-fair/10 focus:ring-signal-fair/50",N=m?`Prefix conflict resolved by Viterbi HMM (${(100*c.avgPathConfidence).toFixed(0)}% confidence)`:`Prefix conflict: ${x.candidateCount} nodes share prefix "${d}"`;return e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:h,className:`inline-flex items-center justify-center p-0.5 rounded focus:outline-none focus:ring-2 transition-colors cursor-pointer touch-manipulation ${j} ${a}`,title:N,"aria-label":`View prefix conflict for ${d}${m?" (Viterbi resolved)":""}`,children:m?e.jsxs("span",{className:"relative",children:[e.jsx(r,{className:u}),e.jsx(g,{className:"absolute -bottom-0.5 -right-0.5 w-2 h-2 text-accent-success"})]}):e.jsx(C,{className:u})}),e.jsx(ue,{isOpen:i,prefix:x.prefix,candidateHashes:x.candidateHashes,onClose:p})]})});function Ae(e,s,t,a){const n=(t-e)*Math.PI/180,l=(a-s)*Math.PI/180,c=Math.sin(n/2)*Math.sin(n/2)+Math.cos(e*Math.PI/180)*Math.cos(t*Math.PI/180)*Math.sin(l/2)*Math.sin(l/2);return 2*Math.atan2(Math.sqrt(c),Math.sqrt(1-c))*6371e3}const De=Object.freeze(Object.defineProperty({__proto__:null,default:function(){const{stats:t}=q(),a=Y(),n=Z(),l=X(),c=J(),r=Q(),o=W(),x=ee(),[m,h]=s.useState(null),[p,u]=s.useState("lastHeard"),[j,v]=s.useState("desc"),[y,w]=s.useState(""),[k,C]=s.useState(!1),[D,z]=s.useState(null),[G,U]=s.useState(null),[I,K]=s.useState(null),[B,V]=s.useState(null),[ie,re]=s.useState(new Map),[oe,de]=s.useState(new Map),[xe,ue]=s.useState(25),[je,Ne]=s.useState(25),ve=s.useRef(null),[fe,ye]=s.useState(!1),we=s.useMemo(()=>(null==t?void 0:t.neighbors)??{},[null==t?void 0:t.neighbors]),Ce=s.useMemo(()=>Object.fromEntries(Object.entries(we).filter(([e])=>!a.has(e))),[we,a]),Se=se(),Me=null==t?void 0:t.local_hash,Le=s.useMemo(()=>{const e=new Map;if(!(null==Se?void 0:Se.latitude)||!(null==Se?void 0:Se.longitude))return e;for(const[s,t]of Object.entries(Ce))t.latitude&&t.longitude&&0!==t.latitude&&0!==t.longitude?e.set(s,Ae(Se.latitude,Se.longitude,t.latitude,t.longitude)):e.set(s,null);return e},[Ce,Se]),{neighborHashSet:He,neighborSignalMap:Fe}=s.useMemo(()=>{const e=new Set,s=new Map;for(const t of r)e.add(t.hash),s.set(t.hash,{avgRssi:t.avgRssi,avgSnr:t.avgSnr});return{neighborHashSet:e,neighborSignalMap:s}},[r]),Ee=s.useMemo(()=>{const e=y.toLowerCase().trim(),s="neighbor"===e||"neighbors"===e,t=k||s;return Object.fromEntries(Object.entries(Ce).filter(([a,n])=>{if(t&&!He.has(a))return!1;if(s)return!0;if(!e)return!0;const l=(n.node_name||n.name||"").toLowerCase(),c=a.slice(2,4).toLowerCase();return l.includes(e)||c.includes(e)||a.toLowerCase().includes(e)}))},[Ce,y,k,He]),Re=s.useMemo(()=>Object.entries(Ee).sort(([e,s],[t,a])=>{let n=0;switch(p){case"lastHeard":n=(s.last_seen||0)-(a.last_seen||0);break;case"distance":{const s=Le.get(e)??null,a=Le.get(t)??null;n=null===s&&null===a?0:null===s?1:null===a?-1:s-a;break}case"centrality":n=(c.get(e)||0)-(c.get(t)||0)}return"desc"===j?-n:n}),[Ee,p,j,Le,c]),$e=Re.filter(([,e])=>e.latitude&&e.longitude&&0!==e.latitude&&0!==e.longitude).length,Te=s.useMemo(()=>new Set(l),[l]),De=s.useMemo(()=>0===xe?Re:Re.slice(0,je),[Re,je,xe]);s.useEffect(()=>{Ne(xe||Re.length)},[p,j,y,k,xe,Re.length]),s.useEffect(()=>{if(0===xe)return;const e=new IntersectionObserver(e=>{e[0].isIntersecting&&jeMath.min(e+xe,Re.length))},{threshold:.1,rootMargin:"100px"});return ve.current&&e.observe(ve.current),()=>e.disconnect()},[xe,je,Re.length]);const ze=s.useCallback(e=>{ue(e),Ne(e||Re.length),ye(!1)},[Re.length]),We=s.useCallback(e=>{p===e?v(e=>"desc"===e?"asc":"desc"):(u(e),v("desc"))},[p]),Ge=s.useCallback(e=>{const s=Ce[e];(null==s?void 0:s.latitude)&&(null==s?void 0:s.longitude)&&0!==s.latitude&&0!==s.longitude&&z(e)},[Ce]),Ue=s.useCallback(()=>{z(null)},[]),Ie=s.useCallback(async(e,s)=>{if(s.stopPropagation(),!B){V(e),re(s=>{const t=new Map(s);return t.delete(e),t}),de(s=>{const t=new Map(s);return t.delete(e),t});try{const s=e.startsWith("0x")?e.slice(0,4):`0x${e.slice(0,2)}`,t=await ne(s,30);t.success&&t.data?(re(s=>new Map(s).set(e,t.data)),setTimeout(()=>{re(s=>{const t=new Map(s);return t.delete(e),t})},1e4)):(de(s=>new Map(s).set(e,t.error||"Ping failed")),setTimeout(()=>{de(s=>{const t=new Map(s);return t.delete(e),t})},5e3))}catch(t){const s=t instanceof Error?t.message:"Ping failed";de(t=>new Map(t).set(e,s)),setTimeout(()=>{de(s=>{const t=new Map(s);return t.delete(e),t})},5e3)}finally{V(null)}}},[B]);return e.jsxs(le,{children:[e.jsx(ce,{title:"Contacts",icon:e.jsx(N,{}),controls:e.jsxs("div",{className:"flex items-baseline gap-3 sm:gap-4",children:[e.jsxs("span",{className:"roster-title tabular-nums",children:[Re.length," node",1!==Re.length?"s":""]}),$e>0&&e.jsxs("span",{className:"roster-title flex items-baseline gap-1.5 tabular-nums",children:[e.jsx(b,{className:"w-3.5 h-3.5 relative top-[2px]"}),$e," with location"]})]})}),x?e.jsx(be,{neighbors:Ce,localNode:Se??void 0,localHash:Me,onRemoveNode:n,selectedNodeHash:D,onNodeSelected:Ue,highlightedEdgeKey:G,highlightedGhost:I}):e.jsx("div",{className:"glass-card aspect-video flex items-center justify-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-3",children:[e.jsx("div",{className:"w-6 h-6 border-2 border-accent-primary border-t-transparent rounded-full animate-spin"}),e.jsx("span",{className:"text-sm text-text-muted",children:"Loading map..."})]})}),e.jsx(ke,{maxPaths:10,highlightedEdge:G,onHighlightEdge:U}),o.length>0&&(x?e.jsx("div",{className:"chart-container",children:e.jsx(Pe,{neighbors:Ce,onGhostSelect:K})}):e.jsxs("div",{className:"glass-card",children:[e.jsxs("div",{className:"chart-header",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 rounded bg-bg-elevated animate-pulse"}),e.jsx("div",{className:"w-24 h-4 rounded bg-bg-elevated animate-pulse"})]}),e.jsx("div",{className:"w-6 h-6 rounded bg-bg-elevated animate-pulse"})]}),e.jsx("div",{className:"px-5 py-3",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-20 h-4 rounded bg-bg-elevated animate-pulse"}),e.jsx("div",{className:"w-16 h-4 rounded bg-bg-elevated animate-pulse"})]})})]})),e.jsx("div",{className:"chart-container",children:x?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"chart-header",children:[e.jsxs("div",{className:"chart-title",children:[e.jsx(N,{className:"chart-title-icon"}),"Discovered Contacts"]}),e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2",children:[He.size>0&&e.jsxs("button",{onClick:()=>C(!k),className:"flex items-center gap-1 px-1.5 sm:px-2.5 py-1.5 text-sm rounded-lg transition-colors "+(k?"bg-accent-success/20 text-accent-success border border-accent-success/30":"text-text-muted hover:text-text-secondary hover:bg-white/5 border border-transparent"),title:k?"Show all contacts":"Show only MeshCore neighbors (direct RF contact)",children:[e.jsx(S,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Neighbors"}),e.jsx("span",{className:"sm:hidden tabular-nums",children:He.size})]}),e.jsxs("div",{className:"relative",children:[e.jsx(M,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-text-muted"}),e.jsx("input",{type:"text",name:"contact-search",id:"contact-search",autoComplete:"off",value:y,onChange:e=>w(e.target.value),placeholder:"Search...",className:"w-20 sm:w-28 lg:w-32 pl-6 sm:pl-7 pr-6 py-1.5 text-sm bg-white/5 border border-white/10 rounded-lg text-text-primary placeholder:text-text-muted focus:outline-none focus:border-accent-primary/50"}),y&&e.jsx("button",{onClick:()=>{w(""),"neighbor"!==y.toLowerCase().trim()&&"neighbors"!==y.toLowerCase().trim()||C(!1)},className:"absolute right-1.5 top-1/2 -translate-y-1/2 text-text-muted hover:text-text-secondary p-0.5",children:e.jsx(L,{className:"w-3 h-3"})})]}),e.jsxs("div",{className:"flex items-center gap-0.5 sm:gap-1",children:[e.jsxs("button",{onClick:()=>We("lastHeard"),className:"flex items-center gap-1 p-1.5 sm:px-2 sm:py-1.5 text-sm rounded-lg transition-colors "+("lastHeard"===p?"bg-accent-primary/20 text-accent-primary":"text-text-muted hover:text-text-secondary hover:bg-white/5"),title:"Sort by last heard",children:[e.jsx(f,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Recent"}),"lastHeard"===p&&e.jsx(P,{className:"w-3 h-3 "+("asc"===j?"rotate-180":"")})]}),e.jsxs("button",{onClick:()=>We("distance"),className:"flex items-center gap-1 p-1.5 sm:px-2 sm:py-1.5 text-sm rounded-lg transition-colors "+("distance"===p?"bg-accent-primary/20 text-accent-primary":"text-text-muted hover:text-text-secondary hover:bg-white/5"),title:"Sort by distance",children:[e.jsx(H,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Distance"}),"distance"===p&&e.jsx(P,{className:"w-3 h-3 "+("asc"===j?"rotate-180":"")})]}),e.jsxs("button",{onClick:()=>We("centrality"),className:"flex items-center gap-1 p-1.5 sm:px-2 sm:py-1.5 text-sm rounded-lg transition-colors "+("centrality"===p?"bg-accent-primary/20 text-accent-primary":"text-text-muted hover:text-text-secondary hover:bg-white/5"),title:"Sort by network centrality",children:[e.jsx(d,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Centrality"}),"centrality"===p&&e.jsx(P,{className:"w-3 h-3 "+("asc"===j?"rotate-180":"")})]})]}),e.jsxs("div",{className:"relative",children:[e.jsxs("button",{onClick:()=>ye(!fe),className:"flex items-center gap-1 px-2 py-1.5 text-sm text-text-muted hover:text-text-secondary hover:bg-white/5 rounded-lg transition-colors",title:"Items per page",children:[e.jsx("span",{className:"tabular-nums",children:0===xe?"All":xe}),e.jsx(i,{className:"w-3 h-3 transition-transform "+(fe?"rotate-180":"")})]}),fe&&e.jsx("div",{className:"absolute right-0 top-full mt-1 z-50 bg-bg-surface border border-border-subtle rounded-lg shadow-lg py-1 min-w-[80px]",children:[25,50,100,0].map(s=>e.jsx("button",{onClick:()=>ze(s),className:"w-full px-3 py-1.5 text-sm text-left hover:bg-white/5 transition-colors "+(xe===s?"text-accent-primary":"text-text-secondary"),children:0===s?"All":s},s))})]})]})]}),Re.length>0?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"hidden sm:grid contacts-grid-header border-b border-border-subtle/50 px-3 py-2 text-[10px] uppercase tracking-wider text-text-muted",children:[e.jsx("div",{className:"contacts-col-node",children:"Node"}),e.jsx("div",{className:"contacts-col-signal text-right",children:"Signal"}),e.jsx("div",{className:"contacts-col-distance text-right",children:"Distance"}),e.jsx("div",{className:"contacts-col-centrality text-right",children:"Centrality"}),e.jsx("div",{className:"contacts-col-activity text-center",children:"Activity"}),e.jsx("div",{className:"contacts-col-seen text-right",children:"Last Seen"}),e.jsx("div",{className:"contacts-col-actions"})]}),e.jsx("div",{className:"divide-y divide-border-subtle/30",children:De.map(([s,t])=>{var a;const n=t.latitude&&t.longitude&&0!==t.latitude&&0!==t.longitude,l=t.node_name||t.name||"Unknown",i=Te.has(s),r=He.has(s),o=Le.get(s),x=c.get(s)||0,m=r?Fe.get(s):void 0,p=r&&m,u=null==(a=t.contact_type)?void 0:a.toLowerCase(),j="room server"===u||"room_server"===u||"room"===u||"server"===u,N="companion"===u,b="client"===u||"cli"===u,v=t.is_repeater||"repeater"===u||"rep"===u,f=r?"direct":"flood",y=r?"Direct RF contact (zero-hop neighbor)":"Flood routing (multi-hop via mesh)";return e.jsxs("div",{className:`contacts-grid-row ${i?"bg-amber-500/5 border-l-2 border-l-amber-400":""} ${n?"cursor-pointer hover:bg-white/[0.02]":""}`,onClick:()=>Ge(s),children:[e.jsxs("div",{className:"contacts-col-node flex items-center gap-2 min-w-0",children:[p&&null!==(null==m?void 0:m.avgSnr)?e.jsx("div",{className:"w-2 h-2 rounded-full flex-shrink-0 self-center "+(k=m.avgSnr,void 0===k?"bg-[var(--signal-unknown)]":k>=5?"bg-[var(--signal-excellent)]":k>=0?"bg-[var(--signal-good)]":k>=-5?"bg-[var(--signal-fair)]":k>=-10?"bg-[var(--signal-poor)]":"bg-[var(--signal-critical)]")}):e.jsx("div",{className:"w-2 flex-shrink-0"}),e.jsx("div",{className:"roster-icon flex-shrink-0",title:y,children:j&&v?e.jsxs("div",{className:"relative w-5 h-5",children:[e.jsx(F,{className:"w-5 h-5 absolute inset-0 text-sys-pink"}),e.jsx(E,{className:"w-2.5 h-2.5 absolute -bottom-0.5 -right-0.5 text-sys-teal"})]}):j?e.jsx(F,{className:"w-5 h-5 text-sys-pink"}):N?e.jsx(R,{className:"w-5 h-5 text-text-muted"}):v?"direct"===f?e.jsx($,{className:"w-5 h-5 text-sys-green"}):e.jsx(E,{className:"w-5 h-5 text-sys-cyan"}):e.jsx(R,{className:"w-5 h-5 text-text-muted"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5 overflow-hidden",children:[e.jsx("span",{className:"roster-title truncate",title:l,children:l}),r&&e.jsx(te,{color:he.neighbor,compact:!0,className:"flex-shrink-0",children:"NBR"}),i&&e.jsxs(te,{color:he.hub,compact:!0,className:"flex items-center gap-1 flex-shrink-0",children:[e.jsx(T,{className:"w-3 h-3"}),"HUB"]}),v&&e.jsx(te,{color:he.repeater,compact:!0,className:"flex-shrink-0",children:"RPT"}),j&&e.jsx(te,{color:he.room,compact:!0,className:"flex-shrink-0",children:"ROOM"}),N&&e.jsx(te,{color:he.companion,compact:!0,className:"flex-shrink-0",children:"COMP"}),b&&e.jsx(te,{color:he.client,compact:!0,className:"flex-shrink-0",children:"CLIENT"})]}),e.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[e.jsx(me,{copy:!0,size:"compact",truncate:[8,6],children:s}),e.jsx(Oe,{hash:s})]})]})]}),e.jsxs("div",{className:"contacts-col-signal flex items-center justify-end gap-2",children:[p&&null!==(null==m?void 0:m.avgRssi)&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(pe,{rssi:m.avgRssi,className:"w-3.5 h-3.5"}),e.jsx("span",{className:"type-data-xs tabular-nums text-text-muted",children:Math.round(m.avgRssi)})]}),p&&null!==(null==m?void 0:m.avgSnr)&&e.jsxs("span",{className:"type-data-xs tabular-nums text-text-muted",children:[m.avgSnr.toFixed(1)," dB"]})]}),e.jsx("div",{className:"contacts-col-distance flex items-center justify-end gap-1 text-text-muted",children:null!=o&&e.jsxs(e.Fragment,{children:[e.jsx(H,{className:"w-3 h-3"}),e.jsx("span",{className:"type-data-xs tabular-nums",children:(w=o,w<1e3?`${Math.round(w)}m`:`${(w/1e3).toFixed(1)}km`)})]})}),e.jsx("div",{className:"contacts-col-centrality flex items-center justify-end gap-1",children:x>0&&e.jsxs(e.Fragment,{children:[e.jsx(d,{className:"w-3 h-3 text-accent-secondary"}),e.jsxs("span",{className:"type-data-xs tabular-nums text-text-muted",children:[(100*x).toFixed(0),"%"]})]})}),e.jsx("div",{className:"contacts-col-activity flex items-center justify-center",children:e.jsx(_e,{nodeHash:s,width:48,height:16})}),e.jsx("div",{className:"contacts-col-seen flex items-center justify-end",children:e.jsx("span",{className:"type-data-xs tabular-nums text-text-primary whitespace-nowrap",children:t.last_seen?ae(t.last_seen):"—"})}),e.jsxs("div",{className:"contacts-col-actions flex items-center justify-end gap-1",children:[r&&e.jsx(e.Fragment,{children:ie.has(s)?e.jsxs("div",{className:"flex items-center gap-1 text-accent-success",title:`RTT: ${ie.get(s).rtt_ms.toFixed(0)}ms`,children:[e.jsx(g,{className:"w-3.5 h-3.5"}),e.jsxs("span",{className:"type-data-xs tabular-nums hidden sm:inline",children:[ie.get(s).snr_db.toFixed(1),"dB"]})]}):oe.has(s)?e.jsx("span",{className:"text-red-400 text-[10px]",title:oe.get(s),children:"✗"}):e.jsx("button",{onClick:e=>Ie(s,e),disabled:null!==B,className:"p-1 sm:p-1.5 rounded-lg text-text-muted/50 hover:text-accent-primary hover:bg-accent-primary/10 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:"Ping neighbor for updated signal info",children:B===s?e.jsx(_,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4 animate-spin"}):e.jsx(O,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})})}),e.jsx("button",{onClick:e=>{e.stopPropagation(),h({hash:s,name:l})},className:"p-1 sm:p-1.5 rounded-lg text-text-muted/50 hover:text-red-400 hover:bg-red-500/10 transition-colors",title:"Remove contact",children:e.jsx(A,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})})]})]},s);var w,k})}),xe>0&&je0&&jeNe(e=>Math.min(e+xe,Re.length)),className:"text-accent-primary hover:text-accent-primary/80 transition-colors",children:"Load more"})]})]}):e.jsxs("div",{className:"roster-empty",children:[e.jsx(N,{className:"roster-empty-icon"}),e.jsx("div",{className:"type-label text-text-secondary",children:"No Contacts Discovered"}),e.jsx("div",{className:"type-data-xs text-text-muted mt-1",children:"Contacts will appear here as they advertise on the mesh network."})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"chart-header",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 rounded bg-bg-elevated animate-pulse"}),e.jsx("div",{className:"w-32 h-4 rounded bg-bg-elevated animate-pulse"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-16 h-6 rounded bg-bg-elevated animate-pulse"}),e.jsx("div",{className:"w-24 h-6 rounded bg-bg-elevated animate-pulse"}),e.jsx("div",{className:"w-16 h-6 rounded bg-bg-elevated animate-pulse"})]})]}),e.jsx("div",{className:"px-3 py-3 space-y-3",children:[...Array(5)].map((s,t)=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-5 h-5 rounded bg-bg-elevated animate-pulse"}),e.jsxs("div",{className:"flex-1 space-y-1.5",children:[e.jsx("div",{className:"h-4 w-32 rounded bg-bg-elevated animate-pulse"}),e.jsx("div",{className:"h-3 w-24 rounded bg-bg-elevated animate-pulse"})]}),e.jsx("div",{className:"w-12 h-4 rounded bg-bg-elevated animate-pulse"}),e.jsx("div",{className:"w-16 h-4 rounded bg-bg-elevated animate-pulse"})]},t))})]})}),e.jsx(ge,{isOpen:!!m,title:"Remove Contact",message:`Are you sure you would like to remove ${(null==m?void 0:m.name)||"this contact"}?`,confirmLabel:"Remove",cancelLabel:"Cancel",variant:"danger",onConfirm:()=>{m&&n(m.hash),h(null)},onCancel:()=>h(null)})]})}},Symbol.toStringTag,{value:"Module"}));export{De as C,_e as N,Oe as P}; diff --git a/frontend/dist/assets/ContactsMapMapLibre-ByNdgqAN.js b/frontend/dist/assets/ContactsMapMapLibre-ByNdgqAN.js deleted file mode 100644 index f7fc8727..00000000 --- a/frontend/dist/assets/ContactsMapMapLibre-ByNdgqAN.js +++ /dev/null @@ -1 +0,0 @@ -import{r as A,j as e,aT as t,ab as r,q as n,am as o,aK as i,m as a,C as s,A as l,W as c,bP as u,bQ as f,bR as d,bS as g,bq as h,br as m,aL as b,_ as p,bb as v,aq as w,aJ as x,a9 as y,bT as k,i as C,bN as B,X as M,bU as D,$ as E,bV as Q,bo as j,aZ as N,bW as S,bX as F,bY as P,ak as T,bZ as L,bO as I,bk as R,bl as _,a0 as H,D as z,aS as G,ar as O,b_ as U,bM as Y,bj as W,b$ as V}from"./vendor-react-C341c8YC.js";import"./maplibre-gl-Bk5DsYkB.js";import{L as Z,c as K}from"./link-scoring-Cw0dJsWv.js";import{M as J,Y as X,T as q,y as $,Q as AA,m as eA,aN as tA,aO as rA,n as nA,aP as oA,B as iA,a6 as aA,al as sA,ak as lA,f as cA,r as uA,aQ as fA,aR as dA}from"./index-BJEgt3tp.js";import{C as gA}from"./ConfirmModal-CYXFGX_W.js";import{D as hA}from"./DeepAnalysisModal-D4eqwCNZ.js";import{i as mA,j as bA,k as pA,l as vA}from"./useThemeColors-AeHMyThq.js";import{l as wA}from"./font-loader-jlbdh9Fw.js";import{p as xA,a as yA}from"./vendor-core-WoOfkQwm.js";import{x as kA}from"./recharts-6XUQYgRA.js";import{u as CA,a as BA,B as MA}from"./BasemapLayer-S9Ush6Hh.js";import{P as DA,N as EA}from"./Contacts-CyyU4xmf.js";import{H as QA,C as jA,N as NA,b as SA}from"./SignalIndicator-BLrEkFNb.js";import"./deckgl-DTsmDcfs.js";import"./ping-DvLgBqTv.js";import"./PageLayout-CnF5SScd.js";import"./DataBox-CRX76VsB.js";import"./CollisionExplorerModal-DTnzK_xA.js";function FA(A,e,t,r){const n=(t-A)*Math.PI/180,o=(r-e)*Math.PI/180,i=Math.sin(n/2)*Math.sin(n/2)+Math.cos(A*Math.PI/180)*Math.cos(t*Math.PI/180)*Math.sin(o/2)*Math.sin(o/2);return 2*Math.atan2(Math.sqrt(i),Math.sqrt(1-i))*6371e3}function PA(A,e){const t=Math.max(5,Math.min(A,300)),r=Math.log(5),n=Math.log(300);return 1+(Math.log(t)-r)/(n-r)*5}const TA={nodeFill:"#3B82F6",nodeStroke:"rgba(255,255,255,0.9)",nodeColor:"#4338CA",localColor:"#FFB224",hubColor:"#8E4EC6",gatewayColor:"#5B5BD6",mobileColor:"#F76B15",roomServerColor:"#D6409F",neighborColor:"#FFB224",edges:{rest:"#4B4B4B",restBright:"#616161",restDim:"#3F3F3F",hoverDirect:"#6FBCBD",hoverLoop:"#8B7BAD",hoverStandard:"#8A8A8A",hoverNeighbor:"#FBBF24",neighborRest:"#6B7280",neighborHover:"#FBBF24",highlight:"#FFD700"},edgeOpacity:.82};function LA(){if("undefined"==typeof window)return TA;const A=mA(),e=bA();return{nodeFill:A.nodeFill,nodeStroke:A.nodeStroke,nodeColor:TA.nodeColor,localColor:A.localColor,hubColor:A.hubColor,gatewayColor:A.gatewayColor,mobileColor:A.mobileColor,roomServerColor:A.roomColor,neighborColor:A.neighborColor,edges:{rest:e.rest,restBright:e.restBright,restDim:e.restDim,hoverDirect:e.hoverDirect,hoverLoop:e.hoverLoop,hoverStandard:e.hoverStandard,hoverNeighbor:e.hoverNeighbor,neighborRest:TA.edges.neighborRest,neighborHover:TA.edges.neighborHover,highlight:e.highlight},edgeOpacity:TA.edgeOpacity}}const IA=2e3,RA={type:"spring",stiffness:500,damping:35};function _A({color:A,ring:t}){return e.jsx("span",{className:"shrink-0 rounded-full",style:{width:14,height:14,backgroundColor:t?"transparent":A,border:t?`4px solid ${A}`:void 0,boxSizing:"border-box"}})}function HA({color:A}){return e.jsx("span",{className:"shrink-0 rounded-sm",style:{width:16,height:3,backgroundColor:A}})}function zA({indicator:A,label:t,tooltip:r}){return e.jsxs("div",{className:"flex items-center gap-1.5",children:[A,e.jsx("span",{className:"text-text-secondary",children:t}),r&&e.jsx(q,{content:r,delay:200,children:e.jsx("span",{className:"text-text-muted cursor-help text-[10px] opacity-60 hover:opacity-100 transition-opacity",children:"ⓘ"})})]})}function GA({title:A,tooltip:t,isOpen:r,onToggle:n,showDivider:o,children:i}){return e.jsxs("div",{className:o?"mt-2 pt-2 border-t border-map-ui-border":"",children:[e.jsxs("button",{type:"button",onClick:n,className:"group w-full flex items-center justify-between py-1 text-text-secondary font-medium hover:text-text-primary transition-colors",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[A,e.jsx(q,{content:t,delay:200,children:e.jsx("span",{className:"text-text-muted cursor-help text-[10px] opacity-60 group-hover:opacity-100 transition-opacity",children:"ⓘ"})})]}),e.jsx(a.span,{animate:{rotate:r?0:-90},transition:{duration:.15},children:e.jsx(s,{className:"w-3 h-3 text-text-muted"})})]}),e.jsx(l,{initial:!1,children:r&&e.jsx(a.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:RA,className:"overflow-hidden",children:e.jsx("div",{className:"flex flex-col gap-1 pt-1.5",children:i})})})]})}function OA({label:A,value:t,color:r}){return e.jsxs("div",{className:"flex justify-between tabular-nums text-text-muted",children:[e.jsx("span",{children:A}),e.jsx("span",{className:"text-text-secondary",style:r?{color:r}:void 0,children:t})]})}function UA({icon:A,color:t,title:r,subtitle:n}){return e.jsx("div",{className:"mt-1.5 pt-1.5 border-t border-map-ui-border",children:e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"shrink-0",style:{color:t},children:A}),e.jsxs("div",{className:"flex flex-col min-w-0",children:[e.jsx("span",{className:"font-medium truncate",style:{color:t},children:r}),e.jsx("span",{className:"text-text-muted text-[10px] leading-tight",children:n})]})]})})}function YA({showTopology:a,validatedPolylineCount:s,filteredNeighborCount:l,hasLocalNode:c,meshTopology:u,zeroHopNeighbors:f,neighborsWithLocation:d}){const g=pA(),h=J(),m=X(),b=h.filter(A=>A.isLikelyReal).length,p=function(A){let e=0;for(const t of A.txDelayRecommendations.values())"backbone"===t.networkRole&&e++;return e}(u),v=f.size>0,[w,x]=A.useState(!0),[y,k]=A.useState(!0),[C,B]=A.useState(!0);return e.jsxs("div",{className:"map-control-glass p-2.5 text-xs",children:[e.jsxs(GA,{title:"Nodes",tooltip:"Node type shown by shape + color. Yellow = direct RF neighbor.",isOpen:w,onToggle:()=>x(A=>!A),children:[e.jsx(zA,{indicator:e.jsx(_A,{color:g.nodeFill}),label:"Node",tooltip:"Standard mesh node. Repeater, client, or companion device."}),e.jsx(zA,{indicator:e.jsx(_A,{color:g.hubColor}),label:"Hub",tooltip:"Network hub (≥10% of last-hop traffic)."}),(M=d,M.some(([,A])=>{var e;const t=null==(e=A.contact_type)?void 0:e.toLowerCase();return"room server"===t||"room_server"===t||"room"===t||"server"===t})&&e.jsx(zA,{indicator:e.jsx(t,{className:"w-3 h-3 shrink-0",style:{color:g.roomColor},strokeWidth:2.5}),label:"Room",tooltip:"Room Server identity for client sync."})),e.jsx(zA,{indicator:e.jsx(r,{className:"w-3 h-3 shrink-0",style:{color:g.localColor},strokeWidth:2.5}),label:"Local",tooltip:"Your repeater running pyMC_Repeater."}),v&&e.jsx(zA,{indicator:e.jsx(_A,{color:g.neighborColor}),label:"Neighbor",tooltip:"Zero-hop direct RF contact."}),u.gatewayNodes.length>0&&e.jsx(zA,{indicator:e.jsx(_A,{color:g.gatewayColor}),label:"Gateway",tooltip:"Significant forwarder (7-10% traffic)."}),p>0&&e.jsx(zA,{indicator:e.jsx(_A,{color:g.hubColor}),label:"Backbone",tooltip:"Critical relay with high centrality."}),u.mobileNodes.length>0&&e.jsx(zA,{indicator:e.jsx(_A,{color:g.mobileColor,ring:!0}),label:"Mobile",tooltip:"Volatile node that appears/disappears."}),b>0&&e.jsx(zA,{indicator:e.jsx(n,{className:"w-3 h-3 shrink-0",style:{color:g.ghostColor},strokeWidth:2.5}),label:`Ghost (${b})`,tooltip:"Unknown repeater from Viterbi analysis."})]}),v&&e.jsxs(GA,{title:"Link Quality",tooltip:"Neighbor edge colors based on bidirectional balance.",isOpen:y,onToggle:()=>k(A=>!A),showDivider:!0,children:[e.jsx(zA,{indicator:e.jsx(HA,{color:Z.YELLOW}),label:"2-Way",tooltip:"33-67% balanced. Ideal bidirectional link."}),e.jsx(zA,{indicator:e.jsx(HA,{color:Z.GREEN}),label:"Listener",tooltip:">67% listener. They hear us well."}),e.jsx(zA,{indicator:e.jsx(HA,{color:Z.RED}),label:"Loud",tooltip:"<33% listener. They route more to us."})]}),a&&s>0&&e.jsxs(GA,{title:"Topology",tooltip:"Links with 5+ validations. Thickness = strength.",isOpen:C,onToggle:()=>B(A=>!A),showDivider:!0,children:[e.jsx(OA,{label:"Nodes",value:l+(c?1:0)}),u.hubNodes.length>0&&e.jsx(OA,{label:"Hubs",value:u.hubNodes.length,color:TA.hubColor}),u.loops.length>0&&e.jsx(UA,{icon:e.jsx(o,{className:"w-3 h-3"}),color:TA.edges.hoverLoop,title:`${u.loops.length} ${1===u.loops.length?"Loop":"Loops"}`,subtitle:"Redundant paths"}),m.totalPaths>0&&e.jsx(UA,{icon:e.jsx(i,{className:"w-3 h-3"}),color:g.ghostColor,title:`${m.totalPaths.toLocaleString()} Viterbi`,subtitle:"HMM decoded paths"})]})]});var M}function WA({mapRef:A,showNeighborLines:t,onToggleNeighborLines:r,hasNeighborPolylines:n,nodeFilter:o,onNodeFilterChange:i,hasHubNodes:a,hasZeroHopNeighbors:s,showCoverage:l,onToggleCoverage:w,showMinCut:x=!1,onToggleMinCut:y,hasMinCutData:k=!1,show3DTerrain:C,onToggle3DTerrain:B,basemapMode:M,onToggleBasemap:D,isFullscreen:E,onToggleFullscreen:Q}){const j="w-4 h-4";return e.jsx(e.Fragment,{children:e.jsxs("div",{className:"absolute top-3 right-3 z-[600] flex flex-col gap-2 sm:top-4 sm:right-4",children:[e.jsxs("div",{className:"map-control-glass flex items-center gap-1 p-1",children:[n&&e.jsx($,{plain:!0,color:t?"warning":"muted",onClick:r,title:t?"Hide edge lines":"Show edge lines","aria-label":t?"Hide edge lines":"Show edge lines","aria-pressed":t,className:"!p-1.5 !rounded-md",children:e.jsx(c,{className:j})}),e.jsxs("div",{className:"flex items-center gap-0.5",children:[e.jsx(AA,{color:"all"===o?"green":"zinc",onClick:()=>i("all"),title:"Show all nodes",children:"All"}),a&&e.jsx(AA,{color:"hubs"===o?"green":"zinc",onClick:()=>i("hubs"),title:"Show only hub nodes and their connections",children:"Hubs"}),s&&e.jsx(AA,{color:"direct"===o?"green":"zinc",onClick:()=>i("direct"),title:"Show only zero-hop (direct RF) neighbors",children:"Direct"})]}),k&&y&&e.jsx($,{plain:!0,color:x?"primary":"muted",onClick:y,title:x?"Hide community partition":"Show community partition","aria-label":x?"Hide community partition":"Show community partition","aria-pressed":x,className:"!p-1.5 !rounded-md",children:e.jsx(u,{className:j})}),e.jsx($,{plain:!0,color:"light"===M?"primary":"muted",onClick:D,title:"light"===M?"Switch to dark map":"Switch to light map","aria-label":"light"===M?"Switch to dark map":"Switch to light map","aria-pressed":"light"===M,className:"!p-1.5 !rounded-md",children:"light"===M?e.jsx(f,{className:j}):e.jsx(d,{className:j})}),e.jsx($,{plain:!0,color:C?"success":"muted",onClick:B,title:C?"Disable 3D terrain":"Enable 3D terrain","aria-label":C?"Disable 3D terrain":"Enable 3D terrain","aria-pressed":C,className:"!p-1.5 !rounded-md",children:e.jsx(g,{className:j})}),e.jsx($,{plain:!0,color:"muted",onClick:Q,title:E?"Exit fullscreen":"Fullscreen","aria-label":E?"Exit fullscreen":"Enter fullscreen","aria-pressed":E,className:"!p-1.5 !rounded-md",children:E?e.jsx(h,{className:j}):e.jsx(m,{className:j})})]}),e.jsxs("div",{className:"map-control-glass flex flex-col items-stretch !overflow-hidden self-end !p-0",children:[e.jsx($,{plain:!0,color:"muted",onClick:()=>{var e,t;null==(t=null==(e=A.current)?void 0:e.getMap())||t.zoomIn()},title:"Zoom in","aria-label":"Zoom in",className:"!p-1.5 !rounded-none",children:e.jsx(b,{className:j})}),e.jsx("div",{className:"h-px bg-border-subtle"}),e.jsx($,{plain:!0,color:"muted",onClick:()=>{var e,t;null==(t=null==(e=A.current)?void 0:e.getMap())||t.zoomOut()},title:"Zoom out","aria-label":"Zoom out",className:"!p-1.5 !rounded-none",children:e.jsx(p,{className:j})}),e.jsx("div",{className:"h-px bg-border-subtle"}),e.jsx($,{plain:!0,color:"muted",onClick:()=>{var e;const t=null==(e=A.current)?void 0:e.getMap();t&&t.easeTo({bearing:0,pitch:0,duration:300})},title:"Reset bearing to north","aria-label":"Reset bearing to north",className:"!p-1.5 !rounded-none",children:e.jsx(v,{className:j})})]})]})})}const VA="#4ADE80",ZA="DeepAnalysis";function KA(){return"abcdefghijklmnopqrstuvwxyz0123456789"[Math.floor(36*Math.random())]}function JA({isActive:t,hasAnalyzed:r,isLoading:n,onClick:o}){const[i,a]=A.useState(!1),[s,l]=A.useState(ZA),c=A.useRef(!1),u=A.useRef(null),[f]=A.useState(()=>{var A;return"undefined"!=typeof window&&((null==(A=window.matchMedia)?void 0:A.call(window,"(hover: hover)").matches)??!1)}),d=i&&!t&&!n&&f;A.useEffect(()=>{if(i&&!t&&!n&&!c.current){c.current=!0;const A=performance.now(),e=t=>{const r=t-A,n=Math.min(r/700,1),o=Math.floor(12*n);let i="";for(let A=0;A<12;A++)i+=A{u.current&&cancelAnimationFrame(u.current)}},[i,t,n]);const g=n?"Analyzing...":s;return e.jsxs("button",{onClick:o,onMouseEnter:()=>f&&a(!0),onMouseLeave:()=>f&&a(!1),onPointerEnter:()=>f&&a(!0),onPointerLeave:()=>f&&a(!1),disabled:n,className:"flex items-center gap-2 w-full text-left rounded-lg transition-colors "+(n?"cursor-wait":""),style:{padding:"0.5rem 0.625rem",backgroundColor:t?"var(--sidebar-action-active-green)":"var(--map-ui-bg, var(--bg-surface))"},title:n?"Analyzing packet history...":r?t?"Hide topology edges":"Show topology edges":"Load full packet history and build topology",children:[n?e.jsx(w,{className:"w-3.5 h-3.5 flex-shrink-0 text-green-400 animate-spin"}):e.jsx(x,{className:"w-3.5 h-3.5 flex-shrink-0 transition-colors "+(t?"text-green-400":"text-text-secondary"),style:d?{color:VA}:void 0}),e.jsx("span",{className:t?"text-green-400":"text-text-secondary",style:{fontFamily:"ui-monospace, SFMono-Regular, monospace",fontSize:"0.6875rem",fontWeight:t||d?700:500,letterSpacing:"-0.01em",lineHeight:1,...d?{color:VA}:{}},children:g})]})}const XA="#12A594";function qA({isActive:t,onClick:r}){const[n,o]=A.useState(!1),[i,a]=A.useState(0),s=A.useRef(!1),l=A.useRef(null),[c,u]=A.useState(0),f=A.useRef(!1),[d]=A.useState(()=>{var A;return"undefined"!=typeof window&&((null==(A=window.matchMedia)?void 0:A.call(window,"(hover: hover)").matches)??!1)}),g=n&&!t&&d;A.useEffect(()=>{g&&!f.current&&(f.current=!0,u(1),setTimeout(()=>u(2),100),setTimeout(()=>u(3),200)),n||(f.current=!1,u(0))},[g,n]),A.useEffect(()=>{if(n&&!t&&!s.current){s.current=!0;const A=performance.now(),e=t=>{const r=t-A,n=Math.min(r/400,1);a(n),n<1&&(l.current=requestAnimationFrame(e))};l.current=requestAnimationFrame(e)}return n||(l.current&&(cancelAnimationFrame(l.current),l.current=null),s.current=!1,a(0)),()=>{l.current&&cancelAnimationFrame(l.current)}},[n,t]);const h=A=>{if(t)return;if(!g)return;const e=11*i;return A>=e-2&&Ad&&o(!0),onMouseLeave:()=>d&&o(!1),onPointerEnter:()=>d&&o(!0),onPointerLeave:()=>d&&o(!1),className:"flex items-center gap-2 w-full text-left rounded-lg transition-colors",style:{padding:"0.5rem 0.625rem",backgroundColor:t?"var(--sidebar-action-active-teal)":"var(--map-ui-bg, var(--bg-surface))"},title:t?"Disable live packet tracing (reduces CPU usage)":"Enable live packet tracing",children:[e.jsx(y,{className:"w-3.5 h-3.5 flex-shrink-0 "+(t?"text-sys-teal":"text-text-secondary"),fill:1===c?"#FFFFFF":3===c?XA:"none",stroke:1===c||2===c?"#FFFFFF":g?XA:"currentColor",style:{transition:"fill 0.05s, stroke 0.05s"}}),e.jsx("span",{className:t?"text-sys-teal":"text-text-secondary",style:{fontFamily:"ui-monospace, SFMono-Regular, monospace",fontSize:"0.6875rem",fontWeight:t||g?700:500,letterSpacing:"-0.01em",lineHeight:1},children:"LiveTrace".split("").map((A,t)=>e.jsx("span",{style:{color:h(t)||void 0},children:A},t))})]})}const $A="#fe8019";function Ae({isActive:t,onClick:r,brightness:n=.7,onBrightnessChange:o}){const[i,a]=A.useState(!1),[s,l]=A.useState(!1),[c]=A.useState(()=>{var A;return"undefined"!=typeof window&&((null==(A=window.matchMedia)?void 0:A.call(window,"(hover: hover)").matches)??!1)});A.useEffect(()=>{wA()},[]),A.useEffect(()=>{if(!i||t)return;const A=requestAnimationFrame(()=>l(!0)),e=setTimeout(()=>l(!1),80);return()=>{cancelAnimationFrame(A),clearTimeout(e)}},[i,t]);const u=Math.max(.01,Math.min(1,n)),g=u<.999,h=u>.011,m=i&&!t&&c;return e.jsxs("button",{onClick:r,onMouseEnter:()=>c&&a(!0),onMouseLeave:()=>c&&a(!1),onPointerEnter:()=>c&&a(!0),onPointerLeave:()=>c&&a(!1),className:"flex items-center gap-2 w-full text-left rounded-lg transition-colors",style:{padding:"0.5rem 0.625rem",backgroundColor:t?"var(--sidebar-action-active-amber)":"var(--map-ui-bg, var(--bg-surface))"},title:t?"Configure wardriving coverage":"Show wardriving coverage",children:[e.jsx(k,{className:"w-3.5 h-3.5 flex-shrink-0 transition-colors "+(t?"text-amber-400":"text-text-secondary"),style:m?{color:$A}:void 0}),e.jsx("span",{className:t?"text-amber-400":"text-text-secondary",style:{fontFamily:t||m?"'Jacquard 12', serif":"ui-monospace, SFMono-Regular, monospace",fontSize:t||m?"0.75rem":"0.6875rem",fontWeight:500,letterSpacing:"-0.01em",lineHeight:1,transition:"none",transform:t?"scale(1.45)":m?`scale(${s?1.595:1.45})`:void 0,transformOrigin:"left center",...m?{color:$A}:{}},children:"Wardrive"}),t&&o&&e.jsxs("div",{className:"ml-auto flex items-center gap-0.5",children:[e.jsx("button",{onClick:A=>{A.stopPropagation();const e=Math.max(.01,u-.2);null==o||o(e)},disabled:!h,className:"p-0.5 rounded transition-colors "+(h?"hover:bg-bg-elevated text-amber-400":"text-amber-400/30 cursor-not-allowed"),title:`Decrease opacity (${Math.round(100*u)}%)`,children:e.jsx(d,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:A=>{A.stopPropagation();const e=Math.min(1,u+.2);null==o||o(e)},disabled:!g,className:"p-0.5 rounded transition-colors "+(g?"hover:bg-bg-elevated text-amber-400":"text-amber-400/30 cursor-not-allowed"),title:`Increase opacity (${Math.round(100*u)}%)`,children:e.jsx(f,{className:"w-3.5 h-3.5"})})]})]})}function ee(A){let e=!0,t=-90,r=90,n=-180,o=180;for(const i of A.toLowerCase()){const A="0123456789bcdefghjkmnpqrstuvwxyz".indexOf(i);if(-1!==A)for(let i=4;i>=0;i--){const a=A>>i&1;if(e){const A=(n+o)/2;a?n=A:o=A}else{const A=(t+r)/2;a?t=A:r=A}e=!e}}return{lat:(t+r)/2,lon:(n+o)/2}}function te(A){return Math.exp(-A*Math.LN2/7)}const re="pymc-wardriving-url",ne="pymc-wardriving-enabled",oe="pymc-wardriving-brightness";function ie(A){"undefined"!=typeof localStorage&&(A?localStorage.setItem(re,A):localStorage.removeItem(re))}function ae(A){"undefined"!=typeof localStorage&&localStorage.setItem(ne,String(A))}function se(){if("undefined"==typeof localStorage)return.7;const A=localStorage.getItem(oe);if(A){const e=parseFloat(A);if(!isNaN(e)&&e>=.01&&e<=1)return e}return.7}function le(A,e=null){if(null!==A){const t=(Math.max(-12,Math.min(12,A))+12)/24;return null!==e?.8*t+(Math.max(-120,Math.min(-50,e))+120)/70*.2:t}return null!==e?(Math.max(-120,Math.min(-50,e))+120)/70:.5}const ce=C((A,e)=>({status:"idle",isVisible:"undefined"!=typeof localStorage&&"true"===localStorage.getItem(ne),coveragePoints:[],repeaters:[],error:null,stats:{coverageCount:0,repeaterCount:0,lastUpdated:null},url:"undefined"==typeof localStorage?"":localStorage.getItem(re)||"",brightness:se(),isModalOpen:!1,openModal:()=>A({isModalOpen:!0}),closeModal:()=>A({isModalOpen:!1}),setUrl:e=>A({url:e}),setBrightness:e=>{const t=Math.max(.01,Math.min(1,e));!function(A){if("undefined"==typeof localStorage)return;const e=Math.max(.01,Math.min(1,A));localStorage.setItem(oe,String(e))}(t),A({brightness:t})},toggleVisibility:()=>{const t=!e().isVisible;ae(t),A({isVisible:t})},setVisible:e=>{ae(e),A({isVisible:e})},loadCoverage:async e=>{if(!e.trim())return A({error:"Please enter a URL",status:"error"}),!1;try{new URL(e.trim())}catch{return A({error:"Invalid URL format",status:"error"}),!1}A({error:null,status:"connecting"});try{A({status:"loading"});const t=await async function(A){const e=`${A.replace(/\/+$/,"").replace(/\/get-nodes$/,"").replace(/\/get-samples$/,"")}/get-samples`,t=await async function(A,e={},t=8e3){const r=new AbortController,n=setTimeout(()=>r.abort(),t);try{return await fetch(A,{...e,signal:r.signal})}catch(o){if(o instanceof Error&&"AbortError"===o.name)throw new Error(`Connection timed out after ${t/1e3}s`);throw o}finally{clearTimeout(n)}}(e,{headers:{Accept:"application/json"}});if(!t.ok)throw new Error(`Failed to fetch precise samples: ${t.status}`);return t.json()}(e.trim());if(!t||"object"!=typeof t)throw new Error("Invalid response from server");if(!Array.isArray(t.keys))throw new Error("No sample data found in response");A({status:"processing"});const r=function(A){var e;const t=[];for(const r of A.keys){if(!r.observed)continue;const{lat:A,lon:n}=ee(r.hash),o=parseInt(r.time,10),i=isNaN(o)?30:(Date.now()-o)/864e5,a=te(i),s=le(r.snr,r.rssi)*(.3+.7*a);t.push({lat:A,lon:n,successRate:r.observed?1:0,weight:s,totalSamples:1,ageDays:i,geohash:r.hash,repeaters:(null==(e=r.path)?void 0:e.map(A=>A.toLowerCase()))||[]})}return t}(t);if(0===r.length)throw new Error("No valid coverage points found");return A({coveragePoints:r,repeaters:[],stats:{coverageCount:r.length,repeaterCount:0,lastUpdated:new Date},status:"success",isVisible:!0,url:e.trim()}),ie(e.trim()),ae(!0),!0}catch(t){const e=t instanceof Error?t.message:"Failed to load coverage data";let r=e;return e.includes("timed out")?r="Connection timed out. Server may be unreachable or slow.":e.includes("Failed to fetch")||e.includes("NetworkError")?r="Could not connect to server. Check the URL and try again.":e.includes("CORS")?r="Server does not allow cross-origin requests.":e.includes("404")?r="Coverage endpoint not found. Check the URL.":(e.includes("ERR_NAME_NOT_RESOLVED")||e.includes("DNS"))&&(r="Server not found. Check the URL for typos."),A({error:r,status:"error"}),!1}},clearCoverage:()=>{A({coveragePoints:[],repeaters:[],stats:{coverageCount:0,repeaterCount:0,lastUpdated:null},status:"idle",error:null,isVisible:!1,url:""}),ie(""),ae(!1)}})),ue={type:"spring",damping:25,stiffness:300},fe={type:"spring",damping:20,stiffness:300};function de({status:A}){if("connecting"!==A&&"loading"!==A&&"processing"!==A)return null;const t={idle:"",connecting:"Connecting to server...",loading:"Fetching coverage data...",processing:"Processing coverage points...",success:"",error:""}[A];if(!t)return null;const r="connecting"===A?30:"loading"===A?60:90;return e.jsx(a.div,{initial:{opacity:0,height:0,marginTop:0},animate:{opacity:1,height:"auto",marginTop:16},exit:{opacity:0,height:0,marginTop:0},transition:fe,className:"overflow-hidden",children:e.jsxs("div",{className:"flex items-center gap-3 p-4 bg-amber-500/10 border border-amber-500/30 rounded-xl",children:[e.jsx("div",{className:"relative",children:e.jsx(w,{className:"w-5 h-5 text-amber-400 animate-spin"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm text-amber-400 font-medium",children:t}),e.jsx("div",{className:"mt-2 h-1.5 bg-amber-500/20 rounded-full overflow-hidden",children:e.jsx(a.div,{className:"h-full bg-amber-400 rounded-full",initial:{width:0},animate:{width:`${r}%`},transition:{duration:.4,ease:"easeOut"}})})]})]})})}function ge({icon:A,title:t,description:r,variant:n}){const o={success:"bg-accent-success/10 border-accent-success/30 text-accent-success",error:"bg-accent-danger/10 border-accent-danger/30 text-accent-danger",warning:"bg-accent-secondary/10 border-accent-secondary/30 text-accent-secondary"}[n];return e.jsx(a.div,{initial:{opacity:0,height:0,marginTop:0},animate:{opacity:1,height:"auto",marginTop:16},exit:{opacity:0,height:0,marginTop:0},transition:fe,className:"overflow-hidden",children:e.jsxs("div",{className:`flex items-start gap-3 p-4 border rounded-xl ${o}`,children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:A}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium",children:t}),r&&e.jsx("p",{className:"text-xs opacity-80 mt-0.5",children:r})]})]})})}function he({icon:A,label:t,value:r,min:n,max:o,formatValue:i,onChange:s}){const l=i?i(r):`${Math.round(r)}%`;return e.jsx(a.div,{initial:{opacity:0,height:0,marginTop:0},animate:{opacity:1,height:"auto",marginTop:16},exit:{opacity:0,height:0,marginTop:0},transition:fe,className:"overflow-hidden",children:e.jsx("div",{className:"p-4 bg-bg-surface border border-border-subtle rounded-xl",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"text-text-muted",children:A}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-xs font-medium text-text-secondary",children:t}),e.jsx("span",{className:"text-xs text-text-muted font-mono tabular-nums",children:l})]}),e.jsx("input",{type:"range",min:n,max:o,value:r,onChange:A=>s(Number(A.target.value)),className:"w-full h-1.5 bg-bg-elevated rounded-full appearance-none cursor-pointer\n [&::-webkit-slider-thumb]:appearance-none\n [&::-webkit-slider-thumb]:w-3.5\n [&::-webkit-slider-thumb]:h-3.5\n [&::-webkit-slider-thumb]:rounded-full\n [&::-webkit-slider-thumb]:bg-accent-secondary\n [&::-webkit-slider-thumb]:cursor-pointer\n [&::-webkit-slider-thumb]:transition-transform\n [&::-webkit-slider-thumb]:hover:scale-110\n [&::-webkit-slider-thumb]:shadow-md"})]})]})})})}function me(){const{isModalOpen:t,closeModal:r,status:n,isVisible:o,stats:s,error:c,url:u,brightness:d,loadCoverage:g,clearCoverage:h,toggleVisibility:m,setUrl:b,setBrightness:p}=ce(),v="connecting"===n||"loading"===n||"processing"===n,[x,y]=A.useState(u),k=A.useCallback(async()=>{await g(x)},[x,g]),C=A.useCallback(()=>{y(""),h()},[h]),F=A.useCallback(A=>{"Enter"!==A.key||A.shiftKey||v||(A.preventDefault(),k())},[k,v]),P=A.useCallback(A=>{const e=A.target.value;y(e),b(e)},[b]),T=s.coverageCount>0,L=x.trim().length>0&&!v;return e.jsx(l,{children:t&&e.jsxs("div",{className:"fixed inset-0 z-[10010] flex items-center justify-center",children:[e.jsx(a.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:v?void 0:r}),e.jsx(a.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:ue,className:"relative w-full max-w-md mx-4",children:e.jsxs("div",{className:"map-control-glass rounded-2xl overflow-hidden shadow-2xl",children:[e.jsxs("div",{className:"flex items-center justify-between p-5 border-b border-border-subtle",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2.5 rounded-xl bg-accent-secondary/20",children:e.jsx(B,{className:"w-5 h-5 text-accent-secondary"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:"Wardriving Coverage"}),e.jsx("p",{className:"text-xs text-text-muted",children:"Overlay RF coverage heatmap"})]})]}),e.jsx($,{plain:!0,color:"muted",onClick:r,disabled:v,className:"!p-2 !rounded-lg","aria-label":"Close modal",children:e.jsx(M,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"p-5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-text-secondary mb-2",children:"Coverage Server URL"}),e.jsx("input",{type:"url",value:x,onChange:P,onKeyDown:F,placeholder:"https://coverage.wcmesh.com",className:"w-full px-4 py-3 bg-bg-surface border border-border-subtle rounded-xl \n text-text-primary placeholder:text-text-muted \n focus:outline-none focus:ring-2 focus:ring-accent-secondary/50 focus:border-accent-secondary/50 \n transition-all disabled:opacity-50",disabled:v}),e.jsx("p",{className:"mt-2 text-xs text-text-muted",children:"Enter the base URL of a wardriving coverage server (e.g., coverage.wcmesh.com)"})]}),e.jsxs(l,{mode:"wait",children:[v&&e.jsx(de,{status:n},"loading"),"error"===n&&c&&e.jsx(ge,{icon:e.jsx(D,{className:"w-5 h-5"}),title:"Connection Failed",description:c,variant:"error"},"error"),"success"===n&&T&&e.jsx(ge,{icon:e.jsx(E,{className:"w-5 h-5"}),title:"Data Loaded Successfully",description:`${s.coverageCount.toLocaleString()} coverage points • ${s.repeaterCount.toLocaleString()} repeaters`,variant:"success"},"success"),T&&!v&&"success"!==n&&e.jsx(ge,{icon:e.jsx(Q,{className:"w-5 h-5"}),title:"Coverage Data Loaded",description:`${s.coverageCount.toLocaleString()} points${s.lastUpdated?` • Last updated ${s.lastUpdated.toLocaleTimeString()}`:""}`,variant:"warning"},"info")]}),e.jsx(l,{children:T&&!v&&e.jsx(he,{icon:e.jsx(f,{className:"w-4 h-4 "+(d>.5?"text-accent-secondary":"text-text-muted")}),label:"Brightness",value:100*d,min:1,max:100,formatValue:A=>`${Math.round(A)}%`,onChange:A=>p(A/100)},"brightness")})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3 px-5 py-4 border-t border-border-subtle",children:[e.jsx("div",{className:"flex items-center gap-1",children:e.jsx(l,{children:T&&e.jsxs(a.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},exit:{opacity:0,x:-10},className:"flex items-center gap-1",children:[e.jsx($,{plain:!0,color:"muted",onClick:m,disabled:v,title:o?"Hide heatmap":"Show heatmap",children:o?e.jsxs(e.Fragment,{children:[e.jsx(j,{"data-slot":"icon"})," Hide"]}):e.jsxs(e.Fragment,{children:[e.jsx(i,{"data-slot":"icon"})," Show"]})}),e.jsxs($,{plain:!0,color:"danger",onClick:C,disabled:v,title:"Clear coverage data",children:[e.jsx(N,{"data-slot":"icon"})," Clear"]})]})})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx($,{plain:!0,color:"muted",onClick:r,disabled:v,children:T?"Done":"Cancel"}),e.jsx($,{color:"warning",onClick:k,disabled:!L,children:v?e.jsxs(e.Fragment,{children:[e.jsx(w,{"data-slot":"icon",className:"animate-spin"}),"Loading..."]}):T?e.jsxs(e.Fragment,{children:[e.jsx(S,{"data-slot":"icon"}),"Refresh"]}):e.jsxs(e.Fragment,{children:[e.jsx(S,{"data-slot":"icon"}),"Connect"]})})]})]})]})})]})})}const be={bandwidth:.07,threshold:.1,opacity:1,strokeWidth:4.5};function pe({label:A,value:t,min:r,max:n,step:o,unit:i,formatValue:a,onChange:s}){const l=a?a(t):t.toFixed(2);return e.jsxs("div",{className:"flex items-center gap-2 sm:gap-2",children:[e.jsx("span",{className:"text-[11px] sm:text-[11px] text-text-secondary w-14 sm:w-16 flex-shrink-0",children:A}),e.jsx("input",{type:"range",min:r,max:n,step:o,value:t,onChange:A=>s(parseFloat(A.target.value)),className:"flex-1 h-1.5 sm:h-1 bg-bg-elevated rounded-full appearance-none cursor-pointer\n [&::-webkit-slider-thumb]:appearance-none\n [&::-webkit-slider-thumb]:w-4\n [&::-webkit-slider-thumb]:h-4\n [&::-webkit-slider-thumb]:sm:w-2.5\n [&::-webkit-slider-thumb]:sm:h-2.5\n [&::-webkit-slider-thumb]:rounded-full\n [&::-webkit-slider-thumb]:bg-accent-primary\n [&::-webkit-slider-thumb]:cursor-pointer\n [&::-webkit-slider-thumb]:shadow-md"}),e.jsxs("span",{className:"text-[11px] sm:text-[11px] text-text-primary font-mono tabular-nums w-12 sm:w-14 text-right flex-shrink-0",children:[l,i&&e.jsx("span",{className:"text-text-muted ml-0.5 hidden sm:inline",children:i})]})]})}function ve({icon:A,label:t,value:r,subtext:n}){return e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 py-0.5 sm:py-1",children:[e.jsx("div",{className:"text-text-muted",children:A}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx("div",{className:"text-[10px] sm:text-[11px] text-text-secondary truncate",children:t})}),e.jsxs("div",{className:"text-right",children:[e.jsx("div",{className:"text-[11px] sm:text-xs font-mono text-text-primary",children:r}),n&&e.jsx("div",{className:"text-[8px] sm:text-[9px] text-text-muted leading-tight",children:n})]})]})}function we({visible:t,onClose:r,settings:n,onSettingsChange:o,partition:i,totalNodes:s}){const c=F(),f=A.useRef(null),d=A.useMemo(()=>{if(!i)return{numCommunities:0,avgCommunitySize:0,minCommunitySize:0,maxCommunitySize:0,fiedlerValue:0,modularity:0,coveragePercent:0};const A=Array.from(i.communities.values()).map(A=>A.length),e=A.reduce((A,e)=>A+e,0);return{numCommunities:i.numCommunities,avgCommunitySize:A.length>0?Math.round(e/A.length):0,minCommunitySize:A.length>0?Math.min(...A):0,maxCommunitySize:A.length>0?Math.max(...A):0,fiedlerValue:i.fiedlerValue,modularity:0,coveragePercent:s>0?Math.round(e/s*100):0}},[i,s]),g=(A,e)=>{o({...n,[A]:e})},h=(111*n.bandwidth).toFixed(1);return e.jsx("div",{ref:f,className:"absolute inset-0 z-[600] pointer-events-none",children:e.jsx(l,{children:t&&e.jsx(a.div,{drag:!0,dragControls:c,dragConstraints:f,dragElastic:.1,dragMomentum:!1,initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},transition:{type:"spring",damping:25,stiffness:300},className:"\n absolute pointer-events-auto\n /* Mobile: bottom sheet style, full width with margins */\n bottom-2 left-2 right-2\n /* sm+: floating panel in bottom-right */\n sm:bottom-16 sm:left-auto sm:right-3 sm:w-64\n /* md+: slightly wider */\n md:w-72\n ",style:{touchAction:"none"},children:e.jsxs("div",{className:"\n map-control-glass rounded-lg overflow-hidden shadow-lg\n /* Mobile: limit height, allow scroll */\n max-h-[45vh] sm:max-h-[calc(100vh-180px)] overflow-y-auto\n /* iOS momentum scrolling */\n overscroll-contain\n ",children:[e.jsxs("div",{className:"\n flex items-center justify-between \n px-3 py-2 sm:px-2.5 sm:py-1.5 \n border-b border-border-subtle \n cursor-grab active:cursor-grabbing\n /* Larger touch target on mobile */\n min-h-[44px] sm:min-h-0\n ",onPointerDown:A=>c.start(A),children:[e.jsxs("div",{className:"flex items-center gap-2 sm:gap-1.5",children:[e.jsx(P,{className:"w-4 h-4 sm:w-3 sm:h-3 text-text-muted"}),e.jsx(u,{className:"w-4 h-4 sm:w-3.5 sm:h-3.5 text-accent-primary"}),e.jsx("span",{className:"text-sm sm:text-xs font-medium text-text-primary",children:"Partition"})]}),e.jsx($,{plain:!0,color:"muted",onClick:r,className:"!p-1.5 sm:!p-0.5 !rounded min-w-[44px] min-h-[44px] sm:min-w-0 sm:min-h-0 flex items-center justify-center","aria-label":"Close toolbox",children:e.jsx(M,{className:"w-4 h-4 sm:w-3 sm:h-3"})})]}),e.jsx("div",{className:"px-3 py-2 sm:px-2.5 sm:py-1.5 border-b border-border-subtle",children:e.jsxs("div",{className:"grid grid-cols-2 gap-x-4 sm:gap-x-3 gap-y-1 sm:gap-y-0.5",children:[e.jsx(ve,{icon:e.jsx(u,{className:"w-3.5 h-3.5 sm:w-3 sm:h-3"}),label:"Communities",value:d.numCommunities}),e.jsx(ve,{icon:e.jsx(T,{className:"w-3.5 h-3.5 sm:w-3 sm:h-3"}),label:"Avg Size",value:d.avgCommunitySize,subtext:`${d.minCommunitySize}–${d.maxCommunitySize}`}),e.jsx(ve,{icon:e.jsx(L,{className:"w-3.5 h-3.5 sm:w-3 sm:h-3"}),label:"Fiedler λ₂",value:d.fiedlerValue.toFixed(3)}),e.jsx(ve,{icon:e.jsx(T,{className:"w-3.5 h-3.5 sm:w-3 sm:h-3"}),label:"Coverage",value:`${d.coveragePercent}%`,subtext:`of ${s}`})]})}),e.jsx("div",{className:"px-3 py-2 sm:px-2.5 sm:py-1.5",children:e.jsxs("div",{className:"space-y-3 sm:space-y-1.5",children:[e.jsx(pe,{label:"Bandwidth",value:n.bandwidth,min:.01,max:.15,step:.005,formatValue:()=>h,unit:"km",onChange:A=>g("bandwidth",A)}),e.jsx(pe,{label:"Threshold",value:n.threshold,min:.05,max:.5,step:.01,formatValue:A=>`${Math.round(100*(1-A))}%`,unit:"cov",onChange:A=>g("threshold",A)}),e.jsx(pe,{label:"Opacity",value:n.opacity,min:.1,max:1,step:.05,formatValue:A=>`${Math.round(100*A)}%`,onChange:A=>g("opacity",A)}),e.jsx(pe,{label:"Stroke",value:n.strokeWidth,min:0,max:5,step:.5,unit:"px",formatValue:A=>A.toFixed(1),onChange:A=>g("strokeWidth",A)})]})})]})})})})}const xe={getItem:A=>{try{return localStorage.getItem(A)}catch{return null}},setItem:(A,e)=>{try{localStorage.setItem(A,e)}catch{}},removeItem:A=>{try{localStorage.removeItem(A)}catch{}}},ye=C()(xA(A=>({isEnabled:!1,toggle:()=>A(A=>({isEnabled:!A.isEnabled})),setEnabled:e=>A({isEnabled:e})}),{name:"pymc-live-trace",storage:yA(()=>xe)}));var ke=function(A){var e,t=void 0!==(A=A||{})?A:{},r={};for(e in t)t.hasOwnProperty(e)&&(r[e]=t[e]);var n,o="";"undefined"!=typeof document&&document.currentScript&&(o=document.currentScript.src),o=0!==o.indexOf("blob:")?o.substr(0,o.lastIndexOf("/")+1):"",n=function(A,e,t){var r=new XMLHttpRequest;r.open("GET",A,!0),r.responseType="arraybuffer",r.onload=function(){if(200==r.status||0==r.status&&r.response)e(r.response);else{var n=O(A);n?e(n.buffer):t()}},r.onerror=t,r.send(null)};var i=t.print||function(){}.bind(),a=t.printErr||function(){}.bind();for(e in r)r.hasOwnProperty(e)&&(t[e]=r[e]);r=null,t.arguments&&t.arguments;var s=0,l=!1;function c(A){var e=t["_"+A];return e||tA("Assertion failed: "+("Cannot call unknown function "+A+", make sure it is exported")),e}var u,f,d,g,h,m,b,p="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function v(A,e){return A?function(A,e,t){for(var r=e+t,n=e;A[n]&&!(n>=r);)++n;if(n-e>16&&A.subarray&&p)return p.decode(A.subarray(e,n));for(var o="";e>10,56320|1023&l)}}else o+=String.fromCharCode((31&i)<<6|a)}else o+=String.fromCharCode(i)}return o}(d,A,e):""}function w(A,e){return A%e>0&&(A+=e-A%e),A}function x(A){u=A,t.HEAP8=f=new Int8Array(A),t.HEAP16=g=new Int16Array(A),t.HEAP32=h=new Int32Array(A),t.HEAPU8=d=new Uint8Array(A),t.HEAPU16=new Uint16Array(A),t.HEAPU32=new Uint32Array(A),t.HEAPF32=m=new Float32Array(A),t.HEAPF64=b=new Float64Array(A)}"undefined"!=typeof TextDecoder&&new TextDecoder("utf-16le");var y=t.TOTAL_MEMORY||33554432;function k(A){for(;A.length>0;){var e=A.shift();if("function"!=typeof e){var r=e.func;"number"==typeof r?void 0===e.arg?t.dynCall_v(r):t.dynCall_vi(r,e.arg):r(void 0===e.arg?null:e.arg)}else e()}}y=(u=t.buffer?t.buffer:new ArrayBuffer(y)).byteLength,x(u),h[7156]=5271536;var C=[],B=[],M=[],D=[];function E(A){C.unshift(A)}function Q(A){D.unshift(A)}var j=Math.abs,N=Math.ceil,S=Math.floor,F=Math.min,P=0,T=null;t.preloadedImages={},t.preloadedAudios={};var L,I,R=null,_="data:application/octet-stream;base64,";function H(A){return String.prototype.startsWith?A.startsWith(_):0===A.indexOf(_)}function z(){return f.length}R="data:application/octet-stream;base64,AAAAAAAAAAAAAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAAAQAAAAQAAAADAAAABgAAAAUAAAACAAAAAAAAAAIAAAADAAAAAQAAAAQAAAAGAAAAAAAAAAUAAAADAAAABgAAAAQAAAAFAAAAAAAAAAEAAAACAAAABAAAAAUAAAAGAAAAAAAAAAIAAAADAAAAAQAAAAUAAAACAAAAAAAAAAEAAAADAAAABgAAAAQAAAAGAAAAAAAAAAUAAAACAAAAAQAAAAQAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAIAAAADAAAAAAAAAAAAAAACAAAAAAAAAAEAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAYAAAAAAAAABQAAAAAAAAAAAAAABAAAAAUAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAYAAAAAAAAABgAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAgAAAAMAAAAEAAAABQAAAAYAAAABAAAAAgAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAgAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAIAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAIAAAADAAAABQAAAAYAAAAAAAAAAQAAAAIAAAADAAAABAAAAAYAAAAAAAAAAQAAAAIAAAADAAAABAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAIAAAAAAAAAAAAAAAYAAAAAAAAAAwAAAAIAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAFAAAABAAAAAAAAAABAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAYAAAAAAAAABAAAAAAAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAgAAAAQAAAADAAAACAAAAAEAAAAHAAAABgAAAAkAAAAAAAAAAwAAAAIAAAACAAAABgAAAAoAAAALAAAAAAAAAAEAAAAFAAAAAwAAAA0AAAABAAAABwAAAAQAAAAMAAAAAAAAAAQAAAB/AAAADwAAAAgAAAADAAAAAAAAAAwAAAAFAAAAAgAAABIAAAAKAAAACAAAAAAAAAAQAAAABgAAAA4AAAALAAAAEQAAAAEAAAAJAAAAAgAAAAcAAAAVAAAACQAAABMAAAADAAAADQAAAAEAAAAIAAAABQAAABYAAAAQAAAABAAAAAAAAAAPAAAACQAAABMAAAAOAAAAFAAAAAEAAAAHAAAABgAAAAoAAAALAAAAGAAAABcAAAAFAAAAAgAAABIAAAALAAAAEQAAABcAAAAZAAAAAgAAAAYAAAAKAAAADAAAABwAAAANAAAAGgAAAAQAAAAPAAAAAwAAAA0AAAAaAAAAFQAAAB0AAAADAAAADAAAAAcAAAAOAAAAfwAAABEAAAAbAAAACQAAABQAAAAGAAAADwAAABYAAAAcAAAAHwAAAAQAAAAIAAAADAAAABAAAAASAAAAIQAAAB4AAAAIAAAABQAAABYAAAARAAAACwAAAA4AAAAGAAAAIwAAABkAAAAbAAAAEgAAABgAAAAeAAAAIAAAAAUAAAAKAAAAEAAAABMAAAAiAAAAFAAAACQAAAAHAAAAFQAAAAkAAAAUAAAADgAAABMAAAAJAAAAKAAAABsAAAAkAAAAFQAAACYAAAATAAAAIgAAAA0AAAAdAAAABwAAABYAAAAQAAAAKQAAACEAAAAPAAAACAAAAB8AAAAXAAAAGAAAAAsAAAAKAAAAJwAAACUAAAAZAAAAGAAAAH8AAAAgAAAAJQAAAAoAAAAXAAAAEgAAABkAAAAXAAAAEQAAAAsAAAAtAAAAJwAAACMAAAAaAAAAKgAAAB0AAAArAAAADAAAABwAAAANAAAAGwAAACgAAAAjAAAALgAAAA4AAAAUAAAAEQAAABwAAAAfAAAAKgAAACwAAAAMAAAADwAAABoAAAAdAAAAKwAAACYAAAAvAAAADQAAABoAAAAVAAAAHgAAACAAAAAwAAAAMgAAABAAAAASAAAAIQAAAB8AAAApAAAALAAAADUAAAAPAAAAFgAAABwAAAAgAAAAHgAAABgAAAASAAAANAAAADIAAAAlAAAAIQAAAB4AAAAxAAAAMAAAABYAAAAQAAAAKQAAACIAAAATAAAAJgAAABUAAAA2AAAAJAAAADMAAAAjAAAALgAAAC0AAAA4AAAAEQAAABsAAAAZAAAAJAAAABQAAAAiAAAAEwAAADcAAAAoAAAANgAAACUAAAAnAAAANAAAADkAAAAYAAAAFwAAACAAAAAmAAAAfwAAACIAAAAzAAAAHQAAAC8AAAAVAAAAJwAAACUAAAAZAAAAFwAAADsAAAA5AAAALQAAACgAAAAbAAAAJAAAABQAAAA8AAAALgAAADcAAAApAAAAMQAAADUAAAA9AAAAFgAAACEAAAAfAAAAKgAAADoAAAArAAAAPgAAABwAAAAsAAAAGgAAACsAAAA+AAAALwAAAEAAAAAaAAAAKgAAAB0AAAAsAAAANQAAADoAAABBAAAAHAAAAB8AAAAqAAAALQAAACcAAAAjAAAAGQAAAD8AAAA7AAAAOAAAAC4AAAA8AAAAOAAAAEQAAAAbAAAAKAAAACMAAAAvAAAAJgAAACsAAAAdAAAARQAAADMAAABAAAAAMAAAADEAAAAeAAAAIQAAAEMAAABCAAAAMgAAADEAAAB/AAAAPQAAAEIAAAAhAAAAMAAAACkAAAAyAAAAMAAAACAAAAAeAAAARgAAAEMAAAA0AAAAMwAAAEUAAAA2AAAARwAAACYAAAAvAAAAIgAAADQAAAA5AAAARgAAAEoAAAAgAAAAJQAAADIAAAA1AAAAPQAAAEEAAABLAAAAHwAAACkAAAAsAAAANgAAAEcAAAA3AAAASQAAACIAAAAzAAAAJAAAADcAAAAoAAAANgAAACQAAABIAAAAPAAAAEkAAAA4AAAARAAAAD8AAABNAAAAIwAAAC4AAAAtAAAAOQAAADsAAABKAAAATgAAACUAAAAnAAAANAAAADoAAAB/AAAAPgAAAEwAAAAsAAAAQQAAACoAAAA7AAAAPwAAAE4AAABPAAAAJwAAAC0AAAA5AAAAPAAAAEgAAABEAAAAUAAAACgAAAA3AAAALgAAAD0AAAA1AAAAMQAAACkAAABRAAAASwAAAEIAAAA+AAAAKwAAADoAAAAqAAAAUgAAAEAAAABMAAAAPwAAAH8AAAA4AAAALQAAAE8AAAA7AAAATQAAAEAAAAAvAAAAPgAAACsAAABUAAAARQAAAFIAAABBAAAAOgAAADUAAAAsAAAAVgAAAEwAAABLAAAAQgAAAEMAAABRAAAAVQAAADEAAAAwAAAAPQAAAEMAAABCAAAAMgAAADAAAABXAAAAVQAAAEYAAABEAAAAOAAAADwAAAAuAAAAWgAAAE0AAABQAAAARQAAADMAAABAAAAALwAAAFkAAABHAAAAVAAAAEYAAABDAAAANAAAADIAAABTAAAAVwAAAEoAAABHAAAAWQAAAEkAAABbAAAAMwAAAEUAAAA2AAAASAAAAH8AAABJAAAANwAAAFAAAAA8AAAAWAAAAEkAAABbAAAASAAAAFgAAAA2AAAARwAAADcAAABKAAAATgAAAFMAAABcAAAANAAAADkAAABGAAAASwAAAEEAAAA9AAAANQAAAF4AAABWAAAAUQAAAEwAAABWAAAAUgAAAGAAAAA6AAAAQQAAAD4AAABNAAAAPwAAAEQAAAA4AAAAXQAAAE8AAABaAAAATgAAAEoAAAA7AAAAOQAAAF8AAABcAAAATwAAAE8AAABOAAAAPwAAADsAAABdAAAAXwAAAE0AAABQAAAARAAAAEgAAAA8AAAAYwAAAFoAAABYAAAAUQAAAFUAAABeAAAAZQAAAD0AAABCAAAASwAAAFIAAABgAAAAVAAAAGIAAAA+AAAATAAAAEAAAABTAAAAfwAAAEoAAABGAAAAZAAAAFcAAABcAAAAVAAAAEUAAABSAAAAQAAAAGEAAABZAAAAYgAAAFUAAABXAAAAZQAAAGYAAABCAAAAQwAAAFEAAABWAAAATAAAAEsAAABBAAAAaAAAAGAAAABeAAAAVwAAAFMAAABmAAAAZAAAAEMAAABGAAAAVQAAAFgAAABIAAAAWwAAAEkAAABjAAAAUAAAAGkAAABZAAAAYQAAAFsAAABnAAAARQAAAFQAAABHAAAAWgAAAE0AAABQAAAARAAAAGoAAABdAAAAYwAAAFsAAABJAAAAWQAAAEcAAABpAAAAWAAAAGcAAABcAAAAUwAAAE4AAABKAAAAbAAAAGQAAABfAAAAXQAAAE8AAABaAAAATQAAAG0AAABfAAAAagAAAF4AAABWAAAAUQAAAEsAAABrAAAAaAAAAGUAAABfAAAAXAAAAE8AAABOAAAAbQAAAGwAAABdAAAAYAAAAGgAAABiAAAAbgAAAEwAAABWAAAAUgAAAGEAAAB/AAAAYgAAAFQAAABnAAAAWQAAAG8AAABiAAAAbgAAAGEAAABvAAAAUgAAAGAAAABUAAAAYwAAAFAAAABpAAAAWAAAAGoAAABaAAAAcQAAAGQAAABmAAAAUwAAAFcAAABsAAAAcgAAAFwAAABlAAAAZgAAAGsAAABwAAAAUQAAAFUAAABeAAAAZgAAAGUAAABXAAAAVQAAAHIAAABwAAAAZAAAAGcAAABbAAAAYQAAAFkAAAB0AAAAaQAAAG8AAABoAAAAawAAAG4AAABzAAAAVgAAAF4AAABgAAAAaQAAAFgAAABnAAAAWwAAAHEAAABjAAAAdAAAAGoAAABdAAAAYwAAAFoAAAB1AAAAbQAAAHEAAABrAAAAfwAAAGUAAABeAAAAcwAAAGgAAABwAAAAbAAAAGQAAABfAAAAXAAAAHYAAAByAAAAbQAAAG0AAABsAAAAXQAAAF8AAAB1AAAAdgAAAGoAAABuAAAAYgAAAGgAAABgAAAAdwAAAG8AAABzAAAAbwAAAGEAAABuAAAAYgAAAHQAAABnAAAAdwAAAHAAAABrAAAAZgAAAGUAAAB4AAAAcwAAAHIAAABxAAAAYwAAAHQAAABpAAAAdQAAAGoAAAB5AAAAcgAAAHAAAABkAAAAZgAAAHYAAAB4AAAAbAAAAHMAAABuAAAAawAAAGgAAAB4AAAAdwAAAHAAAAB0AAAAZwAAAHcAAABvAAAAcQAAAGkAAAB5AAAAdQAAAH8AAABtAAAAdgAAAHEAAAB5AAAAagAAAHYAAAB4AAAAbAAAAHIAAAB1AAAAeQAAAG0AAAB3AAAAbwAAAHMAAABuAAAAeQAAAHQAAAB4AAAAeAAAAHMAAAByAAAAcAAAAHkAAAB3AAAAdgAAAHkAAAB0AAAAeAAAAHcAAAB1AAAAcQAAAHYAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAABAAAABQAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAACAAAABQAAAAEAAAAAAAAA/////wEAAAAAAAAAAwAAAAQAAAACAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAFAAAAAQAAAAAAAAAAAAAAAQAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAADAAAAAAAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAADAAAABQAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAEAAAABQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAABAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAQAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAAAAAABAAAAAwAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAADAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAUAAAABAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAABAAAAAUAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAIAAAAFAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAFAAAAAAAAAAAAAAD/////AQAAAAAAAAADAAAABAAAAAIAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAUAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAUAAAABAAAAAAAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAEAAAD//////////wEAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAADAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAACAAAAAAAAAAAAAAABAAAAAgAAAAYAAAAEAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAcAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAKAAAAAgAAAAAAAAAAAAAAAQAAAAEAAAAFAAAABgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAACAAAAAAAAAAAAAAABAAAAAwAAAAcAAAAGAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAABwAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAADgAAAAIAAAAAAAAAAAAAAAEAAAAAAAAACQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAMAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAIAAAAAAAAAAAAAAAEAAAAEAAAACAAAAAoAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAALAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAACQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAgAAAAAAAAAAAAAAAQAAAAsAAAAPAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAOAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAIAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAABQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAgAAAAAAAAAAAAAAAQAAAAwAAAAQAAAADAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAPAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAADwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAACAAAAAAAAAAAAAAABAAAACgAAABMAAAAIAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAA8AAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAQAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAACQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAIAAAAAAAAAAAAAAAEAAAANAAAAEQAAAA0AAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAARAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAA0AAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAACAAAAAAAAAAAAAAABAAAADgAAABIAAAAPAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAADwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAASAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEgAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAABIAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAATAAAAAgAAAAAAAAAAAAAAAQAAAP//////////EwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAASAAAAAAAAABgAAAAAAAAAIQAAAAAAAAAeAAAAAAAAACAAAAADAAAAMQAAAAEAAAAwAAAAAwAAADIAAAADAAAACAAAAAAAAAAFAAAABQAAAAoAAAAFAAAAFgAAAAAAAAAQAAAAAAAAABIAAAAAAAAAKQAAAAEAAAAhAAAAAAAAAB4AAAAAAAAABAAAAAAAAAAAAAAABQAAAAIAAAAFAAAADwAAAAEAAAAIAAAAAAAAAAUAAAAFAAAAHwAAAAEAAAAWAAAAAAAAABAAAAAAAAAAAgAAAAAAAAAGAAAAAAAAAA4AAAAAAAAACgAAAAAAAAALAAAAAAAAABEAAAADAAAAGAAAAAEAAAAXAAAAAwAAABkAAAADAAAAAAAAAAAAAAABAAAABQAAAAkAAAAFAAAABQAAAAAAAAACAAAAAAAAAAYAAAAAAAAAEgAAAAEAAAAKAAAAAAAAAAsAAAAAAAAABAAAAAEAAAADAAAABQAAAAcAAAAFAAAACAAAAAEAAAAAAAAAAAAAAAEAAAAFAAAAEAAAAAEAAAAFAAAAAAAAAAIAAAAAAAAABwAAAAAAAAAVAAAAAAAAACYAAAAAAAAACQAAAAAAAAATAAAAAAAAACIAAAADAAAADgAAAAEAAAAUAAAAAwAAACQAAAADAAAAAwAAAAAAAAANAAAABQAAAB0AAAAFAAAAAQAAAAAAAAAHAAAAAAAAABUAAAAAAAAABgAAAAEAAAAJAAAAAAAAABMAAAAAAAAABAAAAAIAAAAMAAAABQAAABoAAAAFAAAAAAAAAAEAAAADAAAAAAAAAA0AAAAFAAAAAgAAAAEAAAABAAAAAAAAAAcAAAAAAAAAGgAAAAAAAAAqAAAAAAAAADoAAAAAAAAAHQAAAAAAAAArAAAAAAAAAD4AAAADAAAAJgAAAAEAAAAvAAAAAwAAAEAAAAADAAAADAAAAAAAAAAcAAAABQAAACwAAAAFAAAADQAAAAAAAAAaAAAAAAAAACoAAAAAAAAAFQAAAAEAAAAdAAAAAAAAACsAAAAAAAAABAAAAAMAAAAPAAAABQAAAB8AAAAFAAAAAwAAAAEAAAAMAAAAAAAAABwAAAAFAAAABwAAAAEAAAANAAAAAAAAABoAAAAAAAAAHwAAAAAAAAApAAAAAAAAADEAAAAAAAAALAAAAAAAAAA1AAAAAAAAAD0AAAADAAAAOgAAAAEAAABBAAAAAwAAAEsAAAADAAAADwAAAAAAAAAWAAAABQAAACEAAAAFAAAAHAAAAAAAAAAfAAAAAAAAACkAAAAAAAAAKgAAAAEAAAAsAAAAAAAAADUAAAAAAAAABAAAAAQAAAAIAAAABQAAABAAAAAFAAAADAAAAAEAAAAPAAAAAAAAABYAAAAFAAAAGgAAAAEAAAAcAAAAAAAAAB8AAAAAAAAAMgAAAAAAAAAwAAAAAAAAADEAAAADAAAAIAAAAAAAAAAeAAAAAwAAACEAAAADAAAAGAAAAAMAAAASAAAAAwAAABAAAAADAAAARgAAAAAAAABDAAAAAAAAAEIAAAADAAAANAAAAAMAAAAyAAAAAAAAADAAAAAAAAAAJQAAAAMAAAAgAAAAAAAAAB4AAAADAAAAUwAAAAAAAABXAAAAAwAAAFUAAAADAAAASgAAAAMAAABGAAAAAAAAAEMAAAAAAAAAOQAAAAEAAAA0AAAAAwAAADIAAAAAAAAAGQAAAAAAAAAXAAAAAAAAABgAAAADAAAAEQAAAAAAAAALAAAAAwAAAAoAAAADAAAADgAAAAMAAAAGAAAAAwAAAAIAAAADAAAALQAAAAAAAAAnAAAAAAAAACUAAAADAAAAIwAAAAMAAAAZAAAAAAAAABcAAAAAAAAAGwAAAAMAAAARAAAAAAAAAAsAAAADAAAAPwAAAAAAAAA7AAAAAwAAADkAAAADAAAAOAAAAAMAAAAtAAAAAAAAACcAAAAAAAAALgAAAAMAAAAjAAAAAwAAABkAAAAAAAAAJAAAAAAAAAAUAAAAAAAAAA4AAAADAAAAIgAAAAAAAAATAAAAAwAAAAkAAAADAAAAJgAAAAMAAAAVAAAAAwAAAAcAAAADAAAANwAAAAAAAAAoAAAAAAAAABsAAAADAAAANgAAAAMAAAAkAAAAAAAAABQAAAAAAAAAMwAAAAMAAAAiAAAAAAAAABMAAAADAAAASAAAAAAAAAA8AAAAAwAAAC4AAAADAAAASQAAAAMAAAA3AAAAAAAAACgAAAAAAAAARwAAAAMAAAA2AAAAAwAAACQAAAAAAAAAQAAAAAAAAAAvAAAAAAAAACYAAAADAAAAPgAAAAAAAAArAAAAAwAAAB0AAAADAAAAOgAAAAMAAAAqAAAAAwAAABoAAAADAAAAVAAAAAAAAABFAAAAAAAAADMAAAADAAAAUgAAAAMAAABAAAAAAAAAAC8AAAAAAAAATAAAAAMAAAA+AAAAAAAAACsAAAADAAAAYQAAAAAAAABZAAAAAwAAAEcAAAADAAAAYgAAAAMAAABUAAAAAAAAAEUAAAAAAAAAYAAAAAMAAABSAAAAAwAAAEAAAAAAAAAASwAAAAAAAABBAAAAAAAAADoAAAADAAAAPQAAAAAAAAA1AAAAAwAAACwAAAADAAAAMQAAAAMAAAApAAAAAwAAAB8AAAADAAAAXgAAAAAAAABWAAAAAAAAAEwAAAADAAAAUQAAAAMAAABLAAAAAAAAAEEAAAAAAAAAQgAAAAMAAAA9AAAAAAAAADUAAAADAAAAawAAAAAAAABoAAAAAwAAAGAAAAADAAAAZQAAAAMAAABeAAAAAAAAAFYAAAAAAAAAVQAAAAMAAABRAAAAAwAAAEsAAAAAAAAAOQAAAAAAAAA7AAAAAAAAAD8AAAADAAAASgAAAAAAAABOAAAAAwAAAE8AAAADAAAAUwAAAAMAAABcAAAAAwAAAF8AAAADAAAAJQAAAAAAAAAnAAAAAwAAAC0AAAADAAAANAAAAAAAAAA5AAAAAAAAADsAAAAAAAAARgAAAAMAAABKAAAAAAAAAE4AAAADAAAAGAAAAAAAAAAXAAAAAwAAABkAAAADAAAAIAAAAAMAAAAlAAAAAAAAACcAAAADAAAAMgAAAAMAAAA0AAAAAAAAADkAAAAAAAAALgAAAAAAAAA8AAAAAAAAAEgAAAADAAAAOAAAAAAAAABEAAAAAwAAAFAAAAADAAAAPwAAAAMAAABNAAAAAwAAAFoAAAADAAAAGwAAAAAAAAAoAAAAAwAAADcAAAADAAAAIwAAAAAAAAAuAAAAAAAAADwAAAAAAAAALQAAAAMAAAA4AAAAAAAAAEQAAAADAAAADgAAAAAAAAAUAAAAAwAAACQAAAADAAAAEQAAAAMAAAAbAAAAAAAAACgAAAADAAAAGQAAAAMAAAAjAAAAAAAAAC4AAAAAAAAARwAAAAAAAABZAAAAAAAAAGEAAAADAAAASQAAAAAAAABbAAAAAwAAAGcAAAADAAAASAAAAAMAAABYAAAAAwAAAGkAAAADAAAAMwAAAAAAAABFAAAAAwAAAFQAAAADAAAANgAAAAAAAABHAAAAAAAAAFkAAAAAAAAANwAAAAMAAABJAAAAAAAAAFsAAAADAAAAJgAAAAAAAAAvAAAAAwAAAEAAAAADAAAAIgAAAAMAAAAzAAAAAAAAAEUAAAADAAAAJAAAAAMAAAA2AAAAAAAAAEcAAAAAAAAAYAAAAAAAAABoAAAAAAAAAGsAAAADAAAAYgAAAAAAAABuAAAAAwAAAHMAAAADAAAAYQAAAAMAAABvAAAAAwAAAHcAAAADAAAATAAAAAAAAABWAAAAAwAAAF4AAAADAAAAUgAAAAAAAABgAAAAAAAAAGgAAAAAAAAAVAAAAAMAAABiAAAAAAAAAG4AAAADAAAAOgAAAAAAAABBAAAAAwAAAEsAAAADAAAAPgAAAAMAAABMAAAAAAAAAFYAAAADAAAAQAAAAAMAAABSAAAAAAAAAGAAAAAAAAAAVQAAAAAAAABXAAAAAAAAAFMAAAADAAAAZQAAAAAAAABmAAAAAwAAAGQAAAADAAAAawAAAAMAAABwAAAAAwAAAHIAAAADAAAAQgAAAAAAAABDAAAAAwAAAEYAAAADAAAAUQAAAAAAAABVAAAAAAAAAFcAAAAAAAAAXgAAAAMAAABlAAAAAAAAAGYAAAADAAAAMQAAAAAAAAAwAAAAAwAAADIAAAADAAAAPQAAAAMAAABCAAAAAAAAAEMAAAADAAAASwAAAAMAAABRAAAAAAAAAFUAAAAAAAAAXwAAAAAAAABcAAAAAAAAAFMAAAAAAAAATwAAAAAAAABOAAAAAAAAAEoAAAADAAAAPwAAAAEAAAA7AAAAAwAAADkAAAADAAAAbQAAAAAAAABsAAAAAAAAAGQAAAAFAAAAXQAAAAEAAABfAAAAAAAAAFwAAAAAAAAATQAAAAEAAABPAAAAAAAAAE4AAAAAAAAAdQAAAAQAAAB2AAAABQAAAHIAAAAFAAAAagAAAAEAAABtAAAAAAAAAGwAAAAAAAAAWgAAAAEAAABdAAAAAQAAAF8AAAAAAAAAWgAAAAAAAABNAAAAAAAAAD8AAAAAAAAAUAAAAAAAAABEAAAAAAAAADgAAAADAAAASAAAAAEAAAA8AAAAAwAAAC4AAAADAAAAagAAAAAAAABdAAAAAAAAAE8AAAAFAAAAYwAAAAEAAABaAAAAAAAAAE0AAAAAAAAAWAAAAAEAAABQAAAAAAAAAEQAAAAAAAAAdQAAAAMAAABtAAAABQAAAF8AAAAFAAAAcQAAAAEAAABqAAAAAAAAAF0AAAAAAAAAaQAAAAEAAABjAAAAAQAAAFoAAAAAAAAAaQAAAAAAAABYAAAAAAAAAEgAAAAAAAAAZwAAAAAAAABbAAAAAAAAAEkAAAADAAAAYQAAAAEAAABZAAAAAwAAAEcAAAADAAAAcQAAAAAAAABjAAAAAAAAAFAAAAAFAAAAdAAAAAEAAABpAAAAAAAAAFgAAAAAAAAAbwAAAAEAAABnAAAAAAAAAFsAAAAAAAAAdQAAAAIAAABqAAAABQAAAFoAAAAFAAAAeQAAAAEAAABxAAAAAAAAAGMAAAAAAAAAdwAAAAEAAAB0AAAAAQAAAGkAAAAAAAAAdwAAAAAAAABvAAAAAAAAAGEAAAAAAAAAcwAAAAAAAABuAAAAAAAAAGIAAAADAAAAawAAAAEAAABoAAAAAwAAAGAAAAADAAAAeQAAAAAAAAB0AAAAAAAAAGcAAAAFAAAAeAAAAAEAAAB3AAAAAAAAAG8AAAAAAAAAcAAAAAEAAABzAAAAAAAAAG4AAAAAAAAAdQAAAAEAAABxAAAABQAAAGkAAAAFAAAAdgAAAAEAAAB5AAAAAAAAAHQAAAAAAAAAcgAAAAEAAAB4AAAAAQAAAHcAAAAAAAAAcgAAAAAAAABwAAAAAAAAAGsAAAAAAAAAZAAAAAAAAABmAAAAAAAAAGUAAAADAAAAUwAAAAEAAABXAAAAAwAAAFUAAAADAAAAdgAAAAAAAAB4AAAAAAAAAHMAAAAFAAAAbAAAAAEAAAByAAAAAAAAAHAAAAAAAAAAXAAAAAEAAABkAAAAAAAAAGYAAAAAAAAAdQAAAAAAAAB5AAAABQAAAHcAAAAFAAAAbQAAAAEAAAB2AAAAAAAAAHgAAAAAAAAAXwAAAAEAAABsAAAAAQAAAHIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAABAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAGAAAAAgAAAAUAAAABAAAABAAAAAAAAAAAAAAABQAAAAMAAAABAAAABgAAAAQAAAACAAAAAAAAAH6iBfbytuk/Gq6akm/58z/Xrm0Liez0P5doSdOpSwRAWs602ULg8D/dT7Rcbo/1v1N1RQHFNOM/g9Snx7HW3L8HWsP8Q3jfP6VwOLosutk/9rjk1YQcxj+gnmKMsNn6P/HDeuPFY+M/YHwDjqKhB0Ci19/fCVrbP4UxKkDWOP6/pvljWa09tL9wi7wrQXjnv/Z6yLImkM2/3yTlOzY14D+m+WNZrT20PzwKVQnrQwNA9nrIsiaQzT/g40rFrRQFwPa45NWEHMa/kbslHEZq97/xw3rjxWPjv4cLC2SMBci/otff3wla27+rKF5oIAv0P1N1RQHFNOO/iDJPGyWHBUAHWsP8Q3jfvwQf/by16gXAfqIF9vK26b8XrO0Vh0r+v9eubQuJ7PS/BxLrA0ZZ479azrTZQuDwv1MK1EuItPw/yscgV9Z6FkAwHBR2WjQMQJNRzXsQ5vY/GlUHVJYKF0DONuFv2lMNQNCGZ28QJfk/0WUwoIL36D8ggDOMQuATQNqMOeAy/wZAWFYOYM+M2z/LWC4uH3oSQDE+LyTsMgRAkJzhRGWFGEDd4soovCQQQKqk0DJMEP8/rGmNdwOLBUAW2X/9xCbjP4hu3dcqJhNAzuYItRvdB0CgzW3zJW/sPxotm/Y2TxRAQAk9XmdDDEC1Kx9MKgT3P1M+NctcghZAFVqcLlb0C0Bgzd3sB2b2P77mZDPUWhZAFROHJpUGCEDAfma5CxXtPz1DWq/zYxRAmhYY5824F0DOuQKWSbAOQNCMqrvu3fs/L6DR22K2wT9nAAxPBU8RQGiN6mW43AFAZhu25b633D8c1YgmzowSQNM25BRKWARArGS08/lNxD+LFssHwmMRQLC5aNcxBgJABL9HT0WRF0CjCmJmOGEOQHsuaVzMP/s/TWJCaGGwBUCeu1PAPLzjP9nqN9DZOBNAKE4JcydbCkCGtbd1qjPzP8dgm9U8jhVAtPeKTkVwDkCeCLss5l37P401XMPLmBdAFd29VMVQDUBg0yA55h75Pz6odcYLCRdApBM4rBrkAkDyAVWgQxbRP4XDMnK20hFAymLlF7EmzD8GUgo9XBHlP3lbK7T9COc/k+OhPthhy7+YGEpnrOvCPzBFhLs15u4/epbqB6H4uz9IuuLF5svev6lzLKY31es/CaQ0envF5z8ZY0xlUADXv7zaz7HYEuI/CfbK1sn16T8uAQfWwxLWPzKn/YuFN94/5KdbC1AFu793fyCSnlfvPzK2y4doAMY/NRg5t1/X6b/shq4QJaHDP5yNIAKPOeI/vpn7BSE30r/X4YQrO6nrv78Ziv/Thto/DqJ1Y6+y5z9l51NaxFrlv8QlA65HOLS/86dxiEc96z+Hj0+LFjneP6LzBZ8LTc2/DaJ1Y6+y579l51NaxFrlP8QlA65HOLQ/8qdxiEc967+Jj0+LFjnev6LzBZ8LTc0/1qdbC1AFuz93fyCSnlfvvzK2y4doAMa/NRg5t1/X6T/vhq4QJaHDv5yNIAKPOeK/wJn7BSE30j/W4YQrO6nrP78Ziv/Thtq/CaQ0envF578XY0xlUADXP7zaz7HYEuK/CvbK1sn16b8rAQfWwxLWvzKn/YuFN96/zWLlF7EmzL8GUgo9XBHlv3lbK7T9COe/kOOhPthhyz+cGEpnrOvCvzBFhLs15u6/c5bqB6H4u79IuuLF5sveP6lzLKY31eu/AQAAAP////8HAAAA/////zEAAAD/////VwEAAP////9hCQAA/////6dBAAD/////kcsBAP/////3kAwA/////8H2VwAAAAAAAAAAAAAAAAACAAAA/////w4AAAD/////YgAAAP////+uAgAA/////8ISAAD/////ToMAAP////8ilwMA/////+4hGQD/////gu2vAAAAAAAAAAAAAAAAAAAAAAACAAAA//////////8BAAAAAwAAAP//////////////////////////////////////////////////////////////////////////AQAAAAAAAAACAAAA////////////////AwAAAP//////////////////////////////////////////////////////////////////////////AQAAAAAAAAACAAAA////////////////AwAAAP//////////////////////////////////////////////////////////////////////////AQAAAAAAAAACAAAA////////////////AwAAAP//////////////////////////////////////////////////////////AgAAAP//////////AQAAAAAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAD/////////////////////AQAAAP///////////////wIAAAD///////////////////////////////8DAAAA/////////////////////wAAAAD///////////////8CAAAAAQAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAD///////////////8CAAAAAQAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAD///////////////8CAAAAAQAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAD///////////////8CAAAAAQAAAP////////////////////////////////////////////////////8BAAAAAgAAAP///////////////wAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8BAAAAAgAAAP///////////////wAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8BAAAAAgAAAP///////////////wAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8BAAAAAgAAAP///////////////wAAAAD/////////////////////AwAAAP///////////////////////////////wIAAAD///////////////8BAAAA/////////////////////wAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAABAAAA//////////8CAAAA//////////////////////////////////////////////////////////8DAAAA////////////////AgAAAAAAAAABAAAA//////////////////////////////////////////////////////////////////////////8DAAAA////////////////AgAAAAAAAAABAAAA//////////////////////////////////////////////////////////////////////////8DAAAA////////////////AgAAAAAAAAABAAAA//////////////////////////////////////////////////////////////////////////8DAAAAAQAAAP//////////AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAACAAAAAAAAAAIAAAABAAAAAQAAAAIAAAACAAAAAAAAAAUAAAAFAAAAAAAAAAIAAAACAAAAAwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAgAAAAEAAAACAAAAAgAAAAIAAAAAAAAABQAAAAYAAAAAAAAAAgAAAAIAAAADAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAgAAAAAAAAACAAAAAQAAAAMAAAACAAAAAgAAAAAAAAAFAAAABwAAAAAAAAACAAAAAgAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAACAAAAAAAAAAIAAAABAAAABAAAAAIAAAACAAAAAAAAAAUAAAAIAAAAAAAAAAIAAAACAAAAAwAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAIAAAAAAAAAAgAAAAEAAAAAAAAAAgAAAAIAAAAAAAAABQAAAAkAAAAAAAAAAgAAAAIAAAADAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAKAAAAAgAAAAIAAAAAAAAAAwAAAA4AAAACAAAAAAAAAAIAAAADAAAAAAAAAAAAAAACAAAAAgAAAAMAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAACAAAAAgAAAAAAAAADAAAACgAAAAIAAAAAAAAAAgAAAAMAAAABAAAAAAAAAAIAAAACAAAAAwAAAAcAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAIAAAACAAAAAAAAAAMAAAALAAAAAgAAAAAAAAACAAAAAwAAAAIAAAAAAAAAAgAAAAIAAAADAAAACAAAAAAAAAAAAAAAAAAAAAAAAAANAAAAAgAAAAIAAAAAAAAAAwAAAAwAAAACAAAAAAAAAAIAAAADAAAAAwAAAAAAAAACAAAAAgAAAAMAAAAJAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAACAAAAAgAAAAAAAAADAAAADQAAAAIAAAAAAAAAAgAAAAMAAAAEAAAAAAAAAAIAAAACAAAAAwAAAAoAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAIAAAACAAAAAAAAAAMAAAAGAAAAAgAAAAAAAAACAAAAAwAAAA8AAAAAAAAAAgAAAAIAAAADAAAACwAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAgAAAAIAAAAAAAAAAwAAAAcAAAACAAAAAAAAAAIAAAADAAAAEAAAAAAAAAACAAAAAgAAAAMAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAACAAAAAgAAAAAAAAADAAAACAAAAAIAAAAAAAAAAgAAAAMAAAARAAAAAAAAAAIAAAACAAAAAwAAAA0AAAAAAAAAAAAAAAAAAAAAAAAACAAAAAIAAAACAAAAAAAAAAMAAAAJAAAAAgAAAAAAAAACAAAAAwAAABIAAAAAAAAAAgAAAAIAAAADAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAJAAAAAgAAAAIAAAAAAAAAAwAAAAUAAAACAAAAAAAAAAIAAAADAAAAEwAAAAAAAAACAAAAAgAAAAMAAAAPAAAAAAAAAAAAAAAAAAAAAAAAABAAAAACAAAAAAAAAAIAAAABAAAAEwAAAAIAAAACAAAAAAAAAAUAAAAKAAAAAAAAAAIAAAACAAAAAwAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEQAAAAIAAAAAAAAAAgAAAAEAAAAPAAAAAgAAAAIAAAAAAAAABQAAAAsAAAAAAAAAAgAAAAIAAAADAAAAEQAAAAAAAAAAAAAAAAAAAAAAAAASAAAAAgAAAAAAAAACAAAAAQAAABAAAAACAAAAAgAAAAAAAAAFAAAADAAAAAAAAAACAAAAAgAAAAMAAAASAAAAAAAAAAAAAAAAAAAAAAAAABMAAAACAAAAAAAAAAIAAAABAAAAEQAAAAIAAAACAAAAAAAAAAUAAAANAAAAAAAAAAIAAAACAAAAAwAAABMAAAAAAAAAAAAAAAAAAAAAAAAADwAAAAIAAAAAAAAAAgAAAAEAAAASAAAAAgAAAAIAAAAAAAAABQAAAA4AAAAAAAAAAgAAAAIAAAADAAAAAgAAAAEAAAAAAAAAAQAAAAIAAAAAAAAAAAAAAAIAAAABAAAAAAAAAAEAAAACAAAAAQAAAAAAAAACAAAAAAAAAAUAAAAEAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAFAAAABAAAAAAAAAABAAAABQAAAAQAAAAAAAAABQAAAAAAAAACAAAAAQAAAAAAAAABAAAAAgAAAAAAAAAAAAAAAgAAAAEAAAAAAAAAAQAAAAIAAAABAAAAAAAAAAIAAAACAAAAAAAAAAEAAAAAAAAAAAAAAAUAAAAEAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAFAAAABAAAAAAAAAABAAAABQAAAAQAAAAAAAAABQAAAAUAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAABAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAEAAAAAAAAAAAEAAAAAAQAAAAAAAAAAAQAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAABAAAAAAAAAAAAAQAAAAAAAAAAAAA6B6FaUp9QQTPXMuL4myJBraiDfBwx9UBYJseitzTIQOL5if9jqZtAnXX+Z+ycb0C3pucbhRBCQG8wJBYqpRRAlWbDCzCY5z/eFWBUEve6P/+qo4Q50Y4/D9YM3iCcYT8fcA2QJSA0P4ADxu0qAAc/BNcGolVJ2j5d9FACqwquPh9z7MthtI9CSUSYJke/YUJQ/64OyjU0Qpi0+HCmFQdCm3GfIVdh2kHsJ11kAyauQYC3UDFJOoFBSJsFV1OwU0FK5fcxX4AmQWhy/zZIt/lACqaCPsBjzUDbdUNIScugQMYQlVJ4MXNANiuq8GTvRUDxTXnulxEZQFZ8QX5kpuw/qmG/JwYFlEAluh3Q6DB+QKn4vyNq0GZAKOXekas+UUB8xabXXhI6QG63C2pLtSNAdDBtyNfLDUDyOcu67ID2P0rCMvRXAeE/Ki2TSVyzyT9Dk+8Sz2uzP5J+w5ARWp0/NQAoOiMuhj9YnP+RyMJwPxgW7TvQVFk/KgsLYF0kQz9g5dAC6IwzQcgHPVvDex1B1XjppodHBkHJq3OMM9fwQNvcmJ7wddlAInGPpQs/w0BRobq5EBmtQJZ2ai7n+ZVAtv2G5E+bgECG+gIfKBlpQK5f8jdI91JAL39sL/WpPEB8rGxhDqklQK6yUf43XhBAxL9y/tK8+D86XyZpgrHiPwAAAAD/////AAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////AAAAAP////8AAAAAAAAAAAAAAAABAAAAAAAAAAAAAAD/////AAAAAAAAAAABAAAAAQAAAAAAAAAAAAAA/////wAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAP////8FAAAABQAAAAAAAAAAAAAAAAAAAAAAAAD/////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////////////////////////////wAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////////////////////////////8AAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAFAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////AAAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAEAAAABAAAAAAAAAAEAAAAAAAAABQAAAAEAAAABAAAAAAAAAAAAAAABAAAAAQAAAAAAAAABAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAQAAAAAAAQABAAABAQAAAAAAAQAAAAEAAAABAAEAAAAAAAAAAAAAAAAAAAAAquJYWJZl+D9jaeZNtj/zPwwdI9KqaeO/qGefXwdHdz+q4lhYlmX4P+OrlPMN3PI/DB0j0qpp47+7SQLV4VIEQKriWFiWZfg/r2kma3tz8T82eQmLqNIGwMRIWXMqSvo/fcCszPux9j+jara6ozTwP6hnn18HR3c/MSoKLequ8r+SabgA2nj0P7jBLbDOHO8/1Ym/ICfH4T+6lxjvlFXHv73m373LRPU/0vXyDVxo7T+ToKRHJXMAQF/33578aPE/pAyy64tD9T8+U/hCvyruPwxv8Y7YYwLAuXYr8NAiCEB4+LDK0Sn0P1Qeuy4j+eo/OMx50n7K7L+TrGB/nyf8v5ehC2fbYPM/aXMKexiT6z8mFRIMjg/zP7yUVwGGBNw/E6opHERf8z/z0wR2g9DqPw4pBpcOhvu/NbA29uWAA8DMaTExyXzyP02biiQ+Ruk/S8jz2/FKBEB1pzZnpbb9P7pQU4wLfPI//7ZcQXeG6D9CqEQvAYoIwDB2VB6sSgRAVyv8H5We8T+EHWF8XNPmPzB2wT8Nrrg/SEi+cX+w4L8of+GtdSDxP1sjk5AdouU/6ZjOVru13r8K0obqI6bxvwVbdNXyhfA/w5GG024n5z+rwmtMzP8BwLw9pSX49QXABe/2uQxP8D+b6wCzCvXkP7uGT87fK+Q/pz/JWw4coj+qoBf2J0nwP/yE3PUo0+I/vFJeHcaC+D96luSIqvntP/bf8sHUYu8/gZNN41mL4z9bhOqVOF4FwO6lmAh1hQhAbCVxbdhk7z+1C8NdDcfiPwG36x/0OQBAx0WJ76c2+D9nlSHXANfuP2HlfZ3gqOE/EwnVlVPg9r96+oHzEH//v5bXzdT1Auw/DM3GwLsA4D9p/8uoKcr+v+U9x5DQVAPAehjSdghb7D9sc1IetODgP8MVwwB1pu6/azPk6OGe978W8t/TUc3rP+0QMvYfP+A/RsG/QpSE8D+l3uwScxzgPwQaifgujuw/k1Vti1I43z8MAwLnSh0GQH5nYnwwZgJAiGUzWC5s6j8WyyI/BbLgPw4iUapGeQJAB3W+imnp/j9BLWR4ssrpP2t+gG5Pstk/cpBsfm6DCMCOpU9dOZsFQEv8nFypHeo/ehJ6i+6S2D9jqlGEmarLv7STC5TRiOa/bC+x8WZD6D9H3yUkWpDZP8gZvmCMuQLAreY19/eRBsCoPOc8UzzpP6KI/QV+y9g/t/MoboyWzT+Hv5q3Zu3Mvy2xROCT4uY/9gQitMMg1T9abAqhWMDkv1oLTavoUfG/PMUJP9CD5j+fHRX3t6fSPz7W2gk6bvs/WRnuHwqN9D8YFturGCTmP1EZczv0b9I/5t4exabB5D/1ESLh5fTEP9X2z6SYweQ/6lv3I2zT0D9zkRGNUNMAQKoSvc4EIfs/Xggt8wQI5T+mJHHg/w/SP4lhT/9t8vQ/DrZ/DbwH7D+XlhbYZrjkP34LIpFt6c4/lwfp8fLX9L+j96CTTf76v3WdNhEv9uM/d8c3o4lV0D/vFdCHVcsFwAHeDq0F1QhApbYqcZiN5D9KoilqByXLPwX0/diA0vq/0fo0GxnxAMBbaTkvlCzjP/RrFrWXrMs/UYTrky7jA0DB9f4FiZYAQEGAk/3QzeE/r/TeqE8t0D/OqjlsnPbvvz8RKU8JOfW/smSEbK/O4T8MzuyPm3DDP/rFtctq9gZAfb1EVEaSA0Dts5dVInnhP18SFMc79MM/7y34cw6LAMDFrRJsZO0DwC2KLvLSYuA/hx5wcUHewz+49SnK/4ruPyeS0PX9a+E/ZxaaLvvZ3z8WPu5T2QS8Pygo4RIvMqa/BJ0Kqsd0279cKW4ay8jdP3b05bmZ364/10/qtdxk2r+Bcz6CDMvpv54qOw+Amdw/qLV71pW7sT/YKc80nIPUP8OfIaBJ77G/LyTuD1un2z+diYu8efWzP1wU7ACkfwjAZroyPL1yBkAmv3lKJJbbPysKSE4W+p0/dIgqY79TA8ATLTOQ3tsGwJ2zweD/Xdg/XO/jXeFUaL8VW2qLFKfov1cA9Aa6XfK/tIa7YGgI2T+f3hu/sxqPv2nXdPpf3Pc/jkw8Jbda8j+tT/z8tGPVP1yBHpJd35k/KYvYOy1s8j/yz+kCQjPrP9+agH7x59g/PZfJ9aBhpr/rDKzvYBb+PwtkiaGCt/c/vb1mVr+f1T/JIHwHc8Govw7aeF6+9vG/Xv7kD6fp979isYioQYHVP7AIQZuSFrG/3z1AdUTnAUDN3XY9O7f9P0AdQ9ljYNQ/dJANJPTOrb8kLECUiiPlP4yF7UgmStA/9xGmXxCG1T9qZzix4W2zv2SGJRJVrPe/Fh9a2M/B/b8IexzFCoPSP9y1QFD2bLe/Q86cWLJe/b+mOOfYm78BwOTjkPAGE9E/8aPCUKu/ub9pPZyLCiUGwBA7Mev/BQlALOmrlRi+0j+AMJ/dKULBv7iLtL6a6QRAEMDV/yajAUDa62dE3crJP1P70RgBUbq/38hVnR6esT/s1tG10Z/Ov/zLwalHPss/dTS9NKTXx78nMcRzCIEHQAabxDsAmQRA0tyLK3gSyT+Aui7nOhDGv5Gs58z3WgHATN3forJuBMCAui7nOhDGP9Lciyt4Esm/WAJyHQ4c7z8UP5HFIs3iP3U0vTSk18c//MvBqUc+y7+cvv8HLg/Kvy1I/mHsI+K/U/vRGAFRuj/a62dE3crJv8p+WV8KlQjAuQ/nOP43B0CAMJ/dKULBPyzpq5UYvtK/ZoU+VoLh4L9etLlRUfvtv/GjwlCrv7k/5OOQ8AYT0b9DfT9FhufXPwUX8hJp+4u/3LVAUPZstz8IexzFCoPSv9+L609E5fQ/q9Fz7X2J7T9qZzix4W2zP/cRpl8QhtW/vtNilqGX+j8MOy7QJoL0P3SQDST0zq0/QB1D2WNg1L8IIjSvGNkDwGB8Jou2GAfAsAhBm5IWsT9isYioQYHVvyS9D3zb6uy/gnwRa7uM9L/JIHwHc8GoP729Zla/n9W/CsAHJZwmAEDEW6OYT1r6Pz2XyfWgYaY/35qAfvHn2L83Tdy4lS30vxf2/gZ0jPq/XIEekl3fmb+tT/z8tGPVvybPr2zJ1/+/K7mJ0ypVAsCf3hu/sxqPPwCGu2BoCNm/5oITrpZn+r+UDUyDP+n/v1zv413hVGg/nbPB4P9d2L9MlmkxNvgCQMtZlKE85v8/KwpIThb6nb8mv3lKJJbbv8+SZsTvOOc/pQCIIOYw0j+diYu8efWzvy8k7g9bp9u/kxYDa+pKtD9XlYvA8HnVv6i1e9aVu7G/nio7D4CZ3L/WR6rNh5EGwCkgQweBkghAdvTluZnfrr9cKW4ay8jdvxbjhr1f1QVAR5C0MzivAkAWPu5T2QS8v2cWmi772d+/cKj4lzLJCEBx2QJfYrMFQIcecHFB3sO/LYou8tJi4L+jr7lhO38BwIcI0Nb7xgTAXxIUxzv0w7/ts5dVInnhv0T+l8DZLfE/MP3FoFvS5D8MzuyPm3DDv7JkhGyvzuG/tzhzRIRc0b9Ovv3/0z7mv6/03qhPLdC/m4CT/dDN4b9dwjU5VCQBQBBJX1ntCv0/9GsWtZesy79baTkvlCzjv1mjYgEz++S/oW6KnOQW8b9KoilqByXLv6W2KnGYjeS/SmaKz3Vx9z+BZB5yxGHwP3fHN6OJVdC/dZ02ES/2478PuaBjLrXaP4/JU81pPaO/fgsikW3pzr+XlhbYZrjkv4tSn7YDbP0/f2LnFKlF9z+mJHHg/w/Sv14ILfMECOW/mfg4qYhR/b+OP+RQDCACwOpb9yNs09C/1fbPpJjB5L9pN2WOVZ3wv3hHy9nxIve/URlzO/Rv0r8YFturGCTmv1d1/KKR8QPA8gsy9qzSB8CfHRX3t6fSvzzFCT/Qg+a/EYStnrzV9r/2QJqI7Lb9v/YEIrTDINW/LbFE4JPi5r/7kQEs5fEDQHunnf4GeQBAooj9BX7L2L+oPOc8Uzzpv+ydYY2SSAfAL4HK6CRTB0BH3yUkWpDZv2wvsfFmQ+i/Ik0Yzruh6T8fM3LoGoDUP3oSeovukti/S/ycXKkd6r9rEv+7UWcHQCRIQe/GfwNAa36Abk+y2b9BLWR4ssrpv9KT87qa0bM/FTyktw823L8WyyI/BbLgv4hlM1gubOq/DizMp9Ki6r8b5ckdjVrzv5NVbYtSON+/BBqJ+C6O7L/dUBFqgyXYv00Wh18r7+q/7RAy9h8/4L8W8t/TUc3rv4RM5DKx3wDAfvWIj94aBcBsc1IetODgv3oY0nYIW+y/oGcTFF54AUDkJqS/FKX6PwzNxsC7AOC/ltfN1PUC7L+5Wrz/zHnzP6688w2rNOc/YeV9neCo4b9nlSHXANfuvw9RsxKjY/s/1V8GteXE8j+1C8NdDcfiv2wlcW3YZO+/IOywaA7Q8b9bFP+4Tg36v4GTTeNZi+O/9t/ywdRi77+tRc3yFR7eP2bkcHXJkLO//ITc9SjT4r+qoBf2J0nwv2YHKoswwfm/iQcLspCjAcCb6wCzCvXkvwXv9rkMT/C/YkuwYAMXBMApCNUai9kIwMORhtNuJ+e/BVt01fKF8L+ZqWEfvIjsP6h693QZYNk/WyOTkB2i5b8of+GtdSDxvwpaaulDSwVADMQAX+lOAECEHWF8XNPmv1cr/B+VnvG/XyFG6opcCMD/mtR32/UEQP+2XEF3hui/ulBTjAt88r/imfCfRP+yP9zbvtc8XeO/TZuKJD5G6b/MaTExyXzyvxiTQeElXOO/rbJRQVGN9L/z0wR2g9DqvxOqKRxEX/O/FDGCEei99j9x8zV4VYTmP2lzCnsYk+u/l6ELZ9tg878pRXacaDT/v3k6GZRqoQXAVB67LiP56r94+LDK0Sn0vwO6pZ9b7wFAvK0nKVcc9j8+U/hCvyruv6QMsuuLQ/W/FPhKFYv46j8MyxaDTOW/v9L18g1caO2/vebfvctE9b/7GD8ZrF3xv3gx1AR9bQDAuMEtsM4c77+SabgA2nj0v5xKFIwxsATArKNSBaKsB0Cjara6ozTwv33ArMz7sfa/dF2U0FcWCcDxL357DJX/P69pJmt7c/G/quJYWJZl+L/YntVJlnrSP4sRLzXM+fe/46uU8w3c8r+q4lhYlmX4v85lu5+QRwRAsI0H/WU8479jaeZNtj/zv6riWFiWZfi/sI0H/WU847/OZbufkEcEQHAoPUBrnss/9exKzDtFtT88wM8kax+gP9OqeKeAYog/MW0ItiZvcj+ph+smvt5bP2lCaV5dEUU/StaUmQDaLz+kK9y22BMYP0O3whZuMwI/IIbgZGWE6z7UkjYaEM3UPuezxwa9cr8+LybxRMnFpz6E1N8DbPiRPsYjySMvK3s+//////8fAAj//////zMQCP////9/MiAI/////28yMAj/////YzJACP///z9iMlAI////N2IyYAj///8zYjJwCP//vzNiMoAI//+rM2IykAj/f6szYjKgCP8PqzNiMrAI/wOrM2IywAi/A6szYjLQCJ8DqzNiMuAImQOrM2Iy8Aj//////z8PCP//////Kx8I/////38pLwj/////Pyk/CP////85KU8I////PzgpXwj///8POClvCP///w44KX8I//8fDjgpjwj//w8OOCmfCP9/DQ44Ka8I/w8NDjgpvwj/DQ0OOCnPCP8MDQ44Kd8IxwwNDjgp7wjEDA0OOCn/CAcAAAAHAAAAAQAAAAIAAAAEAAAAAwAAAAAAAAAAAAAABwAAAAMAAAABAAAAAgAAAAUAAAAEAAAAAAAAAAAAAAAEAAAABAAAAAAAAAACAAAAAQAAAAMAAAAOAAAABgAAAAsAAAACAAAABwAAAAEAAAAYAAAABQAAAAoAAAABAAAABgAAAAAAAAAmAAAABwAAAAwAAAADAAAACAAAAAIAAAAxAAAACQAAAA4AAAAAAAAABQAAAAQAAAA6AAAACAAAAA0AAAAEAAAACQAAAAMAAAA/AAAACwAAAAYAAAAPAAAACgAAABAAAABIAAAADAAAAAcAAAAQAAAACwAAABEAAABTAAAACgAAAAUAAAATAAAADgAAAA8AAABhAAAADQAAAAgAAAARAAAADAAAABIAAABrAAAADgAAAAkAAAASAAAADQAAABMAAAB1AAAADwAAABMAAAARAAAAEgAAABAAAAAGAAAAAgAAAAMAAAAFAAAABAAAAAAAAAAAAAAAAAAAAAYAAAACAAAAAwAAAAEAAAAFAAAABAAAAAAAAAAAAAAABwAAAAUAAAADAAAABAAAAAEAAAAAAAAAAgAAAAAAAAACAAAAAwAAAAEAAAAFAAAABAAAAAYAAAAAAAAAAAAAABgtRFT7Ifk/GC1EVPsh+b8YLURU+yEJQBgtRFT7IQnAYWxnb3MuYwBoM05laWdoYm9yUm90YXRpb25zAGNvb3JkaWprLmMAX3VwQXA3Q2hlY2tlZABfdXBBcDdyQ2hlY2tlZABkaXJlY3RlZEVkZ2UuYwBkaXJlY3RlZEVkZ2VUb0JvdW5kYXJ5AGFkamFjZW50RmFjZURpclt0bXBGaWprLmZhY2VdW2ZpamsuZmFjZV0gPT0gS0kAZmFjZWlqay5jAF9mYWNlSWprUGVudFRvQ2VsbEJvdW5kYXJ5AGFkamFjZW50RmFjZURpcltjZW50ZXJJSksuZmFjZV1bZmFjZTJdID09IEtJAF9mYWNlSWprVG9DZWxsQm91bmRhcnkAaDNJbmRleC5jAGNvbXBhY3RDZWxscwBsYXRMbmdUb0NlbGwAY2VsbFRvQ2hpbGRQb3MAdmFsaWRhdGVDaGlsZFBvcwBsYXRMbmcuYwBjZWxsQXJlYVJhZHMyAHBvbHlnb24tPm5leHQgPT0gTlVMTABsaW5rZWRHZW8uYwBhZGROZXdMaW5rZWRQb2x5Z29uAG5leHQgIT0gTlVMTABsb29wICE9IE5VTEwAYWRkTmV3TGlua2VkTG9vcABwb2x5Z29uLT5maXJzdCA9PSBOVUxMAGFkZExpbmtlZExvb3AAY29vcmQgIT0gTlVMTABhZGRMaW5rZWRDb29yZABsb29wLT5maXJzdCA9PSBOVUxMAGlubmVyTG9vcHMgIT0gTlVMTABub3JtYWxpemVNdWx0aVBvbHlnb24AYmJveGVzICE9IE5VTEwAY2FuZGlkYXRlcyAhPSBOVUxMAGZpbmRQb2x5Z29uRm9ySG9sZQBjYW5kaWRhdGVCQm94ZXMgIT0gTlVMTAByZXZEaXIgIT0gSU5WQUxJRF9ESUdJVABsb2NhbGlqLmMAY2VsbFRvTG9jYWxJamsAYmFzZUNlbGwgIT0gb3JpZ2luQmFzZUNlbGwAIShvcmlnaW5PblBlbnQgJiYgaW5kZXhPblBlbnQpAGJhc2VDZWxsID09IG9yaWdpbkJhc2VDZWxsAGJhc2VDZWxsICE9IElOVkFMSURfQkFTRV9DRUxMAGxvY2FsSWprVG9DZWxsACFfaXNCYXNlQ2VsbFBlbnRhZ29uKGJhc2VDZWxsKQBiYXNlQ2VsbFJvdGF0aW9ucyA+PSAwAGdyaWRQYXRoQ2VsbHMAcG9seWZpbGwuYwBpdGVyU3RlcFBvbHlnb25Db21wYWN0ADAAdmVydGV4LmMAdmVydGV4Um90YXRpb25zAGNlbGxUb1ZlcnRleABncmFwaC0+YnVja2V0cyAhPSBOVUxMAHZlcnRleEdyYXBoLmMAaW5pdFZlcnRleEdyYXBoAG5vZGUgIT0gTlVMTABhZGRWZXJ0ZXhOb2Rl";var G="function"==typeof atob?atob:function(A){var e,t,r,n,o,i,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",s="",l=0;A=A.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{e=a.indexOf(A.charAt(l++))<<2|(n=a.indexOf(A.charAt(l++)))>>4,t=(15&n)<<4|(o=a.indexOf(A.charAt(l++)))>>2,r=(3&o)<<6|(i=a.indexOf(A.charAt(l++))),s+=String.fromCharCode(e),64!==o&&(s+=String.fromCharCode(t)),64!==i&&(s+=String.fromCharCode(r))}while(l=0){if((0|t)>13780509){if(0|(a=0|le(15,s)))break;s=0|n[(l=s)>>2],l=0|n[l+4>>2]}else c=0|qe(0|t,0|(a=((0|t)<0)<<31>>31),3,0),l=0|B(),a=0|Ve(0|t,0|a,1,0),a=0|Ve(0|(a=0|qe(0|c,0|l,0|a,0|B())),0|B(),1,0),l=0|B(),n[s>>2]=a,n[s+4>>2]=l,s=a;if(lt(0|r,0,s<<3),0|o){lt(0|o,0,s<<2),a=0|L(A,e,t,r,o,s,l,0);break}(a=0|We(s,4))?(c=0|L(A,e,t,r,a,s,l,0),Ye(a),a=c):a=13}else a=2}while(0);return S=i,0|a}function T(A,e,t,r,o){A|=0,e|=0,t|=0,r|=0,o|=0;var i,a,s=0,l=0,c=0,u=0,f=0,d=0,g=0,h=0,m=0;if(a=S,S=S+16|0,m=a+8|0,n[(h=i=a)>>2]=A,n[h+4>>2]=e,(0|t)<0)return S=a,2;if(n[(s=r)>>2]=A,n[s+4>>2]=e,(s=!!(0|o))&&(n[o>>2]=0),0|HA(A,e))return S=a,9;n[m>>2]=0;A:do{if((0|t)>=1)if(s)for(d=1,f=0,g=0,h=1,s=A;;){if(!(f|g)){if(0|(s=0|I(s,e,4,m,i)))break A;if(0|HA(s=0|n[(e=i)>>2],e=0|n[e+4>>2])){s=9;break A}}if(0|(s=0|I(s,e,0|n[26800+(g<<2)>>2],m,i)))break A;if(s=0|n[(e=i)>>2],e=0|n[e+4>>2],n[(A=r+(d<<3)|0)>>2]=s,n[A+4>>2]=e,n[o+(d<<2)>>2]=h,l=(0|(A=f+1|0))==(0|h),u=6==(0|(c=g+1|0)),0|HA(s,e)){s=9;break A}if((0|(h=h+(u&l&1)|0))>(0|t)){s=0;break}d=d+1|0,f=l?0:A,g=l?u?0:c:g}else for(d=1,f=0,g=0,h=1,s=A;;){if(!(f|g)){if(0|(s=0|I(s,e,4,m,i)))break A;if(0|HA(s=0|n[(e=i)>>2],e=0|n[e+4>>2])){s=9;break A}}if(0|(s=0|I(s,e,0|n[26800+(g<<2)>>2],m,i)))break A;if(s=0|n[(e=i)>>2],e=0|n[e+4>>2],n[(A=r+(d<<3)|0)>>2]=s,n[A+4>>2]=e,l=(0|(A=f+1|0))==(0|h),u=6==(0|(c=g+1|0)),0|HA(s,e)){s=9;break A}if((0|(h=h+(u&l&1)|0))>(0|t)){s=0;break}d=d+1|0,f=l?0:A,g=l?u?0:c:g}else s=0}while(0);return S=a,0|s}function L(A,e,t,r,o,i,a,s){t|=0,r|=0,o|=0,s|=0;var l,c,u,f=0,d=0,g=0,h=0,m=0,b=0,p=0;if(u=S,S=S+16|0,l=u+8|0,c=u,f=0|At(0|(A|=0),0|(e|=0),0|(i|=0),0|(a|=0)),g=0|B(),!(!(0|(p=0|n[(b=h=r+(f<<3)|0)>>2]))&!(0|(b=0|n[b+4>>2]))|(d=(0|p)==(0|A)&(0|b)==(0|e))))do{f=0|$e(0|(f=0|Ve(0|f,0|g,1,0)),0|B(),0|i,0|a),g=0|B(),d=(0|(b=0|n[(p=h=r+(f<<3)|0)>>2]))==(0|A)&(0|(p=0|n[p+4>>2]))==(0|e)}while(!(!(0|b)&!(0|p)|d));if(f=o+(f<<2)|0,d&&(0|n[f>>2])<=(0|s))return S=u,0;if(n[(p=h)>>2]=A,n[p+4>>2]=e,n[f>>2]=s,(0|s)>=(0|t))return S=u,0;switch(d=s+1|0,n[l>>2]=0,0|(f=0|I(A,e,2,l,c))){case 9:m=9;break;case 0:(f=0|L(0|n[(f=c)>>2],0|n[f+4>>2],t,r,o,i,a,d))||(m=9)}A:do{if(9==(0|m)){switch(n[l>>2]=0,0|(f=0|I(A,e,3,l,c))){case 9:break;case 0:if(0|(f=0|L(0|n[(f=c)>>2],0|n[f+4>>2],t,r,o,i,a,d)))break A;break;default:break A}switch(n[l>>2]=0,0|(f=0|I(A,e,1,l,c))){case 9:break;case 0:if(0|(f=0|L(0|n[(f=c)>>2],0|n[f+4>>2],t,r,o,i,a,d)))break A;break;default:break A}switch(n[l>>2]=0,0|(f=0|I(A,e,5,l,c))){case 9:break;case 0:if(0|(f=0|L(0|n[(f=c)>>2],0|n[f+4>>2],t,r,o,i,a,d)))break A;break;default:break A}switch(n[l>>2]=0,0|(f=0|I(A,e,4,l,c))){case 9:break;case 0:if(0|(f=0|L(0|n[(f=c)>>2],0|n[f+4>>2],t,r,o,i,a,d)))break A;break;default:break A}switch(n[l>>2]=0,0|(f=0|I(A,e,6,l,c))){case 9:break;case 0:if(0|(f=0|L(0|n[(f=c)>>2],0|n[f+4>>2],t,r,o,i,a,d)))break A;break;default:break A}return S=u,0}}while(0);return S=u,0|f}function I(A,e,t,r,o){A|=0,e|=0,o|=0;var i,a,s=0,l=0,c=0,u=0,f=0,d=0,g=0;if((t|=0)>>>0>6)return 1;if(f=(0|n[(r|=0)>>2])%6|0,n[r>>2]=f,(0|f)>0){s=0;do{t=0|vA(t),s=s+1|0}while((0|s)<(0|n[r>>2]))}if(f=0|tt(0|A,0|e,45),B(),(a=127&f)>>>0>121)return 5;i=0|OA(A,e),s=0|tt(0|A,0|e,52),B(),s&=15;A:do{if(s){for(;;){if(c=0|tt(0|A,0|e,0|(l=3*(15-s|0)|0)),B(),7==(0|(c&=7))){e=5;break}if(g=!(0|ZA(s)),s=s+-1|0,d=0|rt(7,0,0|l),e&=~B(),A=0|rt(0|n[(g?432:16)+(28*c|0)+(t<<2)>>2],0,0|l)|A&~d,e|=l=0|B(),!(t=0|n[(g?640:224)+(28*c|0)+(t<<2)>>2])){t=0;break A}if(!s){u=8;break A}}return 0|e}u=8}while(0);8==(0|u)&&(A|=0|rt(0|(g=0|n[848+(28*a|0)+(t<<2)>>2]),0,45),e=B()|-1040385&e,t=0|n[4272+(28*a|0)+(t<<2)>>2],127&~g||(g=0|rt(0|n[848+(28*a|0)+20>>2],0,45),e=B()|-1040385&e,t=0|n[4272+(28*a|0)+20>>2],A=0|YA(g|A,e),e=0|B(),n[r>>2]=1+(0|n[r>>2]))),c=0|tt(0|A,0|e,45),B(),c&=127;A:do{if(0|z(c)){e:do{if(1==(0|OA(A,e))){if((0|a)!=(0|c)){if(0|Y(c,0|n[7696+(28*a|0)>>2])){A=0|VA(A,e),l=1,e=0|B();break}M(27795,26864,533,26872)}switch(0|i){case 3:A=0|YA(A,e),e=0|B(),n[r>>2]=1+(0|n[r>>2]),l=0;break e;case 5:A=0|VA(A,e),e=0|B(),n[r>>2]=5+(0|n[r>>2]),l=0;break e;case 0:return 9;default:return 1}}else l=0}while(0);if((0|t)>0){s=0;do{A=0|UA(A,e),e=0|B(),s=s+1|0}while((0|s)!=(0|t))}if((0|a)!=(0|c)){if(!(0|G(c))){if(!!(0|l)|5!=(0|OA(A,e)))break;n[r>>2]=1+(0|n[r>>2]);break}switch(127&f){case 8:case 118:break A}3!=(0|OA(A,e))&&(n[r>>2]=1+(0|n[r>>2]))}}else if((0|t)>0){s=0;do{A=0|YA(A,e),e=0|B(),s=s+1|0}while((0|s)!=(0|t))}}while(0);return n[r>>2]=((0|n[r>>2])+t|0)%6|0,n[(g=o)>>2]=A,n[g+4>>2]=e,0}function R(A,e,t,r){A|=0,e|=0,t|=0,r|=0;var o,i,a=0,s=0,l=0,c=0,u=0,f=0,d=0,g=0,h=0;if(i=S,S=S+16|0,h=i+8|0,n[(g=o=i)>>2]=A,n[g+4>>2]=e,(0|t)<0)return S=i,2;if(!t)return n[(h=r)>>2]=A,n[h+4>>2]=e,S=i,0;n[h>>2]=0;A:do{if(0|HA(A,e))A=9;else{a=0,g=A;do{if(0|(A=0|I(g,e,4,h,o)))break A;if(a=a+1|0,0|HA(g=0|n[(e=o)>>2],e=0|n[e+4>>2])){A=9;break A}}while((0|a)<(0|t));n[(d=r)>>2]=g,n[d+4>>2]=e,d=t+-1|0,f=0,A=1;do{if(a=26800+(f<<2)|0,5==(0|f))for(l=0|n[a>>2],s=0,a=A;;){if(0|(A=0|I(0|n[(A=o)>>2],0|n[A+4>>2],l,h,o)))break A;if((0|s)!=(0|d)){if(c=0|n[(u=o)>>2],u=0|n[u+4>>2],n[(A=r+(a<<3)|0)>>2]=c,n[A+4>>2]=u,0|HA(c,u)){A=9;break A}A=a+1|0}else A=a;if((0|(s=s+1|0))>=(0|t))break;a=A}else for(l=o,u=0|n[a>>2],c=0,a=A,s=0|n[l>>2],l=0|n[l+4>>2];;){if(0|(A=0|I(s,l,u,h,o)))break A;if(s=0|n[(l=o)>>2],l=0|n[l+4>>2],n[(A=r+(a<<3)|0)>>2]=s,n[A+4>>2]=l,A=a+1|0,0|HA(s,l)){A=9;break A}if((0|(c=c+1|0))>=(0|t))break;a=A}f=f+1|0}while(f>>>0<6);A=(0|g)==(0|n[(A=o)>>2])&&(0|e)==(0|n[A+4>>2])?0:9}}while(0);return S=i,0|A}function _(A,e,t,r){t|=0,r|=0;var o,i,a,s=0,l=0;for(a=S,S=S+16|0,o=a,i=a+8|0,s=(s=!(0|HA(A|=0,e|=0)))?1:2;;){if(n[i>>2]=0,!(0|I(A,e,s,i,o))&((0|n[(l=o)>>2])==(0|t)?(0|n[l+4>>2])==(0|r):0)){A=4;break}if((s=s+1|0)>>>0>=7){s=7,A=4;break}}return 4==(0|A)?(S=a,0|s):0}function H(A,e,t,r,i,a,s){e|=0,t|=0,r|=0,i|=0,a|=0,s|=0;var l,c,u,f,d,g,h,m,b,p,v=0,w=0,x=0,y=0,k=0,C=0,M=0,D=0,E=0,Q=0,j=0,N=0,F=0,P=0,T=0,L=0,I=0,R=0,_=0;if(p=S,S=S+64|0,h=p+48|0,m=p+32|0,b=p+24|0,l=p+8|0,c=p,(0|(w=0|n[(A|=0)>>2]))<=0)return S=p,0;for(u=A+4|0,f=h+8|0,d=m+8|0,g=l+8|0,v=0,F=0;;){N=(x=0|n[u>>2])+(F<<4)|0,n[h>>2]=n[N>>2],n[h+4>>2]=n[N+4>>2],n[h+8>>2]=n[N+8>>2],n[h+12>>2]=n[N+12>>2],(0|F)==(w+-1|0)?(n[m>>2]=n[x>>2],n[m+4>>2]=n[x+4>>2],n[m+8>>2]=n[x+8>>2],n[m+12>>2]=n[x+12>>2]):(N=x+(F+1<<4)|0,n[m>>2]=n[N>>2],n[m+4>>2]=n[N+4>>2],n[m+8>>2]=n[N+8>>2],n[m+12>>2]=n[N+12>>2]),w=0|tA(h,m,r,b);A:do{if(w)x=0,v=w;else if(x=0|n[(w=b)>>2],(0|(w=0|n[w+4>>2]))>0|!(0|w)&x>>>0>0){j=0,N=0;e:for(;;){if(I=1/(+(x>>>0)+4294967296*+(0|w)),_=+o[h>>3],R=+((w=0|Ze(0|x,0|w,0|j,0|N))>>>0)+4294967296*+(0|B()),L=+(j>>>0)+4294967296*+(0|N),o[l>>3]=I*(_*R)+I*(+o[m>>3]*L),o[g>>3]=I*(+o[f>>3]*R)+I*(+o[d>>3]*L),0|(w=0|KA(l,r,c))){v=w;break}C=0|At(0|(E=0|n[(Q=c)>>2]),0|(Q=0|n[Q+4>>2]),0|e,0|t),y=0|B(),x=0|n[(k=w=s+(C<<3)|0)>>2],k=0|n[k+4>>2];t:do{if(!(0|x)&!(0|k))P=w,T=16;else for(M=0,D=0;;){if((0|M)>(0|t)|(0|M)==(0|t)&D>>>0>e>>>0){v=1;break e}if((0|x)==(0|E)&(0|k)==(0|Q))break t;if(C=0|$e(0|(w=0|Ve(0|C,0|y,1,0)),0|B(),0|e,0|t),y=0|B(),D=0|Ve(0|D,0|M,1,0),M=0|B(),!(0|(x=0|n[(k=w=s+(C<<3)|0)>>2]))&!(0|(k=0|n[k+4>>2]))){P=w,T=16;break}}}while(0);if(16!=(0|T)||(T=0,!(0|E)&!(0|Q))||(n[(D=P)>>2]=E,n[D+4>>2]=Q,D=a+(n[i>>2]<<3)|0,n[D>>2]=E,n[D+4>>2]=Q,D=0|Ve(0|n[(D=i)>>2],0|n[D+4>>2],1,0),E=0|B(),n[(Q=i)>>2]=D,n[Q+4>>2]=E),j=0|Ve(0|j,0|N,1,0),N=0|B(),x=0|n[(w=b)>>2],!((0|(w=0|n[w+4>>2]))>(0|N)|(0|w)==(0|N)&x>>>0>j>>>0)){x=1;break A}}x=0}else x=1}while(0);if(F=F+1|0,!x){T=21;break}if((0|F)>=(0|(w=0|n[A>>2]))){v=0,T=21;break}}return 21==(0|T)?(S=p,0|v):0}function z(A){return(A|=0)>>>0>121?0|(A=0):0|(A=0|n[7696+(28*A|0)+16>>2])}function G(A){return 4==(0|(A|=0))|117==(0|A)|0}function O(A){return 0|n[11120+(216*(0|n[(A|=0)>>2])|0)+(72*(0|n[A+4>>2])|0)+(24*(0|n[A+8>>2])|0)+(n[A+12>>2]<<3)>>2]}function U(A){return 0|n[11120+(216*(0|n[(A|=0)>>2])|0)+(72*(0|n[A+4>>2])|0)+(24*(0|n[A+8>>2])|0)+(n[A+12>>2]<<3)+4>>2]}function Y(A,e){return e|=0,(0|n[7696+(28*(A|=0)|0)+20>>2])==(0|e)?0|(e=1):0|(e=(0|n[7696+(28*A|0)+24>>2])==(0|e))}function W(A,e){return 0|n[848+(28*(A|=0)|0)+((e|=0)<<2)>>2]}function V(A,e){return e|=0,(0|n[848+(28*(A|=0)|0)>>2])==(0|e)?0|(e=0):(0|n[848+(28*A|0)+4>>2])==(0|e)?0|(e=1):(0|n[848+(28*A|0)+8>>2])==(0|e)?0|(e=2):(0|n[848+(28*A|0)+12>>2])==(0|e)?0|(e=3):(0|n[848+(28*A|0)+16>>2])==(0|e)?0|(e=4):(0|n[848+(28*A|0)+20>>2])==(0|e)?0|(e=5):0|((0|n[848+(28*A|0)+24>>2])==(0|e)?6:7)}function Z(A){var e,t,r;return e=(r=+o[16+(A|=0)>>3])-(t=+o[A+24>>3]),+(r>3]<+o[A+24>>3]|0}function J(A){return+(+o[(A|=0)>>3]-+o[A+8>>3])}function X(A,e){A|=0;var t,r,n=0;return(n=+o[(e|=0)>>3])>=+o[A+8>>3]&&n<=+o[A>>3]?(t=+o[A+16>>3],n=+o[A+24>>3],e=(r=+o[e+8>>3])>=n,A=r<=t&1,t>3]<+o[e+8>>3]||+o[A+8>>3]>+o[e>>3]?0|(s=0):(n=(l=+o[A+16>>3])<(u=+o[(t=A+24|0)>>3]),c=(a=+o[(s=e+16|0)>>3])<(i=+o[(r=e+24|0)>>3]),e=u-a>3],e)||(u=+ie(+o[t>>3],A))>+ie(+o[s>>3],e)?0|(c=0):0|(c=1))}function $(A,e){e|=0;var t,r,n,i,a,s=0,l=0,c=0,u=0;return+o[(A|=0)>>3]<+o[e>>3]||+o[A+8>>3]>+o[e+8>>3]?0|(s=0):(n=(i=+o[(s=A+16|0)>>3])<(l=+o[A+24>>3]),c=(u=+o[(t=e+16|0)>>3])<(a=+o[(r=e+24|0)>>3]),e=l-u>3],e)?0|(c=(u=+ie(+o[s>>3],A))>=+ie(+o[t>>3],e)):0|(c=0))}function AA(A,e){A|=0,e|=0;var t,r,i,a,s,l=0;i=S,S=S+176|0,n[(r=i)>>2]=4,l=+o[e>>3],o[r+8>>3]=l,a=+o[e+16>>3],o[r+16>>3]=a,o[r+24>>3]=l,l=+o[e+24>>3],o[r+32>>3]=l,s=+o[e+8>>3],o[r+40>>3]=s,o[r+48>>3]=l,o[r+56>>3]=s,o[r+64>>3]=a,t=96+(e=r+72|0)|0;do{n[e>>2]=0,e=e+4|0}while((0|e)<(0|t));st(0|A,0|r,168),S=i}function eA(A,e,t){A|=0,e|=0,t|=0;var r,a,c,u,f,d,g,h=0,m=0,b=0,p=0,w=0,y=0,k=0;d=S,S=S+288|0,f=d+264|0,p=d+96|0,m=(h=b=d)+96|0;do{n[h>>2]=0,h=h+4|0}while((0|h)<(0|m));return 0|(e=0|Ae(e,b))?(S=d,0|(y=e)):(qA(b=0|n[(m=b)>>2],m=0|n[m+4>>2],f),$A(b,m,p),u=+ae(f,p+8|0),o[f>>3]=+o[A>>3],o[(m=f+8|0)>>3]=+o[A+16>>3],o[p>>3]=+o[A+8>>3],o[(b=p+8|0)>>3]=+o[A+24>>3],a=+ae(f,p),k=+o[m>>3]-+o[b>>3],c=+l(+k),g=+o[f>>3]-+o[p>>3],r=+l(+g),!(0==k|0==g)&&(k=+ot(+c,+r),k=+v(+a*a/+it(+k/+it(+c,+r),3)/(u*(2.59807621135*u)*.8)),o[i>>3]=k,w=~~k>>>0,y=+l(k)>=1?k>0?~~+x(+s(k/4294967296),4294967295)>>>0:~~+v((k-+(~~k>>>0))/4294967296)>>>0:0,2146435072&~n[i+4>>2])?(p=!(0|w)&!(0|y),n[(e=t)>>2]=p?1:w,n[e+4>>2]=p?0:y,e=0):e=1,S=d,0|(y=e))}function tA(A,e,t,r){A|=0,e|=0,t|=0,r|=0;var a,c,u,f,d=0,g=0,h=0;f=S,S=S+288|0,c=f+264|0,u=f+96|0,a=(d=g=f)+96|0;do{n[d>>2]=0,d=d+4|0}while((0|d)<(0|a));return 0|(t=0|Ae(t,g))?(S=f,0|(r=t)):(qA(d=0|n[(t=g)>>2],t=0|n[t+4>>2],c),$A(d,t,u),h=+ae(c,u+8|0),h=+v(+ +ae(A,e)/(2*h)),o[i>>3]=h,t=~~h>>>0,d=+l(h)>=1?h>0?~~+x(+s(h/4294967296),4294967295)>>>0:~~+v((h-+(~~h>>>0))/4294967296)>>>0:0,2146435072&~n[i+4>>2]?(g=!(0|t)&!(0|d),n[r>>2]=g?1:t,n[r+4>>2]=g?0:d,S=f,0|(r=0)):(S=f,0|(r=1)))}function rA(A,e,t,r){e|=0,t|=0,r|=0,n[(A|=0)>>2]=e,n[A+4>>2]=t,n[A+8>>2]=r}function nA(A){var e,t=0,r=0,o=0,i=0,a=0;t=0|n[(A|=0)>>2],r=0|n[(e=A+4|0)>>2],(0|t)<0&&(r=r-t|0,n[e>>2]=r,n[(a=A+8|0)>>2]=(0|n[a>>2])-t,n[A>>2]=0,t=0),(0|r)<0?(t=t-r|0,n[A>>2]=t,i=(0|n[(a=A+8|0)>>2])-r|0,n[a>>2]=i,n[e>>2]=0,r=0):(a=i=A+8|0,i=0|n[i>>2]),(0|i)<0&&(t=t-i|0,n[A>>2]=t,r=r-i|0,n[e>>2]=r,n[a>>2]=0,i=0),(0|(o=(0|i)<(0|(o=(0|r)<(0|t)?r:t))?i:o))<=0||(n[A>>2]=t-o,n[e>>2]=r-o,n[a>>2]=i-o)}function oA(A,e){var t,r;e|=0,r=0|n[8+(A|=0)>>2],t=+((0|n[A+4>>2])-r|0),o[e>>3]=+((0|n[A>>2])-r|0)-.5*t,o[e+8>>3]=.8660254037844386*t}function iA(A,e,t){A|=0,e|=0,n[(t|=0)>>2]=(0|n[e>>2])+(0|n[A>>2]),n[t+4>>2]=(0|n[e+4>>2])+(0|n[A+4>>2]),n[t+8>>2]=(0|n[e+8>>2])+(0|n[A+8>>2])}function aA(A,e,t){A|=0,e|=0,n[(t|=0)>>2]=(0|n[A>>2])-(0|n[e>>2]),n[t+4>>2]=(0|n[A+4>>2])-(0|n[e+4>>2]),n[t+8>>2]=(0|n[A+8>>2])-(0|n[e+8>>2])}function sA(A,e){e|=0;var t,r=0;r=0|w(0|n[(A|=0)>>2],e),n[A>>2]=r,t=0|w(0|n[(r=A+4|0)>>2],e),n[r>>2]=t,e=0|w(0|n[(A=A+8|0)>>2],e),n[A>>2]=e}function lA(A){var e,t,r=0,o=0,i=0,a=0,s=0;s=(0|(t=0|n[(A|=0)>>2]))<0,A=(A=(o=(0|(a=((e=(0|(i=(0|n[A+4>>2])-(s?t:0)|0))<0)?0-i|0:0)+((0|n[A+8>>2])-(s?t:0))|0))<0)?0:a)-((i=(0|(o=(0|A)<(0|(o=(0|(r=(e?0:i)-(o?a:0)|0))<(0|(a=(s?0:t)-(e?i:0)-(o?a:0)|0))?r:a))?A:o))>0)?o:0)|0,r=r-(i?o:0)|0;A:do{switch(a-(i?o:0)|0){case 0:switch(0|r){case 0:return 0|(0|A?1==(0|A)?1:7:0);case 1:return 0|(0|A?1==(0|A)?3:7:2);default:break A}case 1:switch(0|r){case 0:return 0|(0|A?1==(0|A)?5:7:4);case 1:if(A)break A;return 6;default:break A}}}while(0);return 7}function cA(A){var e,t,r=0,o=0,i=0,a=0,s=0,l=0,c=0;if(l=0|n[(t=8+(A|=0)|0)>>2],(e=(0|n[A>>2])-l|0)>>>0>715827881|(l=(0|n[(c=A+4|0)>>2])-l|0)>>>0>715827881){if(a=2147483647-e|0,s=-2147483648-e|0,(i=(0|e)>0)?(0|a)<(0|e):(0|s)>(0|e))return 1;if(o=e<<1,i?(2147483647-o|0)<(0|e):(-2147483648-o|0)>(0|e))return 1;if((0|l)>0?(2147483647-l|0)<(0|l):(-2147483648-l|0)>(0|l))return 1;if(r=3*e|0,o=l<<1,(i?(0|a)<(0|o):(0|s)>(0|o))||((0|e)>-1?(-2147483648|r)>=(0|l):(-2147483648^r)<(0|l)))return 1}else o=l<<1,r=3*e|0;return i=0|Oe(.14285714285714285*+(r-l|0)),n[A>>2]=i,a=0|Oe(.14285714285714285*+(o+e|0)),n[c>>2]=a,n[t>>2]=0,r=(o=(0|a)<(0|i))?i:a,(0|(o=o?a:i))<0&&((-2147483648==(0|o)||((0|r)>0?(2147483647-r|0)<(0|o):(-2147483648-r|0)>(0|o)))&&M(27795,26892,354,26903),((0|r)>-1?(-2147483648|r)>=(0|o):(-2147483648^r)<(0|o))&&M(27795,26892,354,26903)),r=a-i|0,(0|i)<0?(o=0-i|0,n[c>>2]=r,n[t>>2]=o,n[A>>2]=0,i=0):(r=a,o=0),(0|r)<0&&(i=i-r|0,n[A>>2]=i,o=o-r|0,n[t>>2]=o,n[c>>2]=0,r=0),s=i-o|0,a=r-o|0,(0|o)<0?(n[A>>2]=s,n[c>>2]=a,n[t>>2]=0,r=a,a=s,o=0):a=i,(0|(i=(0|o)<(0|(i=(0|r)<(0|a)?r:a))?o:i))<=0||(n[A>>2]=a-i,n[c>>2]=r-i,n[t>>2]=o-i),0}function uA(A){var e,t=0,r=0,o=0,i=0,a=0,s=0,l=0;if(i=0|n[(e=8+(A|=0)|0)>>2],(a=(0|n[A>>2])-i|0)>>>0>715827881|(i=(0|n[(s=A+4|0)>>2])-i|0)>>>0>715827881){if((r=(0|a)>0)?(2147483647-a|0)<(0|a):(-2147483648-a|0)>(0|a))return 1;if(t=a<<1,(o=(0|i)>0)?(2147483647-i|0)<(0|i):(-2147483648-i|0)>(0|i))return 1;if(l=i<<1,o?(2147483647-l|0)<(0|i):(-2147483648-l|0)>(0|i))return 1;if(r?(2147483647-t|0)<(0|i):(-2147483648-t|0)>(0|i))return 1;if(r=3*i|0,(0|i)>-1?(-2147483648|r)>=(0|a):(-2147483648^r)<(0|a))return 1}else r=3*i|0,t=a<<1;return o=0|Oe(.14285714285714285*+(t+i|0)),n[A>>2]=o,i=0|Oe(.14285714285714285*+(r-a|0)),n[s>>2]=i,n[e>>2]=0,t=(r=(0|i)<(0|o))?o:i,(0|(r=r?i:o))<0&&((-2147483648==(0|r)||((0|t)>0?(2147483647-t|0)<(0|r):(-2147483648-t|0)>(0|r)))&&M(27795,26892,402,26917),((0|t)>-1?(-2147483648|t)>=(0|r):(-2147483648^t)<(0|r))&&M(27795,26892,402,26917)),t=i-o|0,(0|o)<0?(r=0-o|0,n[s>>2]=t,n[e>>2]=r,n[A>>2]=0,o=0):(t=i,r=0),(0|t)<0&&(o=o-t|0,n[A>>2]=o,r=r-t|0,n[e>>2]=r,n[s>>2]=0,t=0),a=o-r|0,i=t-r|0,(0|r)<0?(n[A>>2]=a,n[s>>2]=i,n[e>>2]=0,t=i,i=a,r=0):i=o,(0|(o=(0|r)<(0|(o=(0|t)<(0|i)?t:i))?r:o))<=0||(n[A>>2]=i-o,n[s>>2]=t-o,n[e>>2]=r-o),0}function fA(A){var e,t,r=0,o=0,i=0,a=0,s=0;o=0|n[(e=8+(A|=0)|0)>>2],i=0|Oe(.14285714285714285*+((3*(r=(0|n[A>>2])-o|0)|0)-(o=(0|n[(t=A+4|0)>>2])-o|0)|0)),n[A>>2]=i,r=0|Oe(.14285714285714285*+((o<<1)+r|0)),n[t>>2]=r,n[e>>2]=0,o=r-i|0,(0|i)<0?(s=0-i|0,n[t>>2]=o,n[e>>2]=s,n[A>>2]=0,r=o,i=0,o=s):o=0,(0|r)<0&&(i=i-r|0,n[A>>2]=i,o=o-r|0,n[e>>2]=o,n[t>>2]=0,r=0),s=i-o|0,a=r-o|0,(0|o)<0?(n[A>>2]=s,n[t>>2]=a,n[e>>2]=0,r=a,a=s,o=0):a=i,(0|(i=(0|o)<(0|(i=(0|r)<(0|a)?r:a))?o:i))<=0||(n[A>>2]=a-i,n[t>>2]=r-i,n[e>>2]=o-i)}function dA(A){var e,t,r=0,o=0,i=0,a=0,s=0;o=0|n[(e=8+(A|=0)|0)>>2],i=0|Oe(.14285714285714285*+(((r=(0|n[A>>2])-o|0)<<1)+(o=(0|n[(t=A+4|0)>>2])-o|0)|0)),n[A>>2]=i,r=0|Oe(.14285714285714285*+((3*o|0)-r|0)),n[t>>2]=r,n[e>>2]=0,o=r-i|0,(0|i)<0?(s=0-i|0,n[t>>2]=o,n[e>>2]=s,n[A>>2]=0,r=o,i=0,o=s):o=0,(0|r)<0&&(i=i-r|0,n[A>>2]=i,o=o-r|0,n[e>>2]=o,n[t>>2]=0,r=0),s=i-o|0,a=r-o|0,(0|o)<0?(n[A>>2]=s,n[t>>2]=a,n[e>>2]=0,r=a,a=s,o=0):a=i,(0|(i=(0|o)<(0|(i=(0|r)<(0|a)?r:a))?o:i))<=0||(n[A>>2]=a-i,n[t>>2]=r-i,n[e>>2]=o-i)}function gA(A){var e,t,r,o=0,i=0,a=0,s=0;o=0|n[(A|=0)>>2],i=0|n[(t=A+4|0)>>2],a=0|n[(r=A+8|0)>>2],s=i+(3*o|0)|0,n[A>>2]=s,i=a+(3*i|0)|0,n[t>>2]=i,o=(3*a|0)+o|0,n[r>>2]=o,a=i-s|0,(0|s)<0?(o=o-s|0,n[t>>2]=a,n[r>>2]=o,n[A>>2]=0,i=a,a=0):a=s,(0|i)<0&&(a=a-i|0,n[A>>2]=a,o=o-i|0,n[r>>2]=o,n[t>>2]=0,i=0),e=a-o|0,s=i-o|0,(0|o)<0?(n[A>>2]=e,n[t>>2]=s,n[r>>2]=0,a=e,o=0):s=i,(0|(i=(0|o)<(0|(i=(0|s)<(0|a)?s:a))?o:i))<=0||(n[A>>2]=a-i,n[t>>2]=s-i,n[r>>2]=o-i)}function hA(A){var e,t,r,o=0,i=0,a=0,s=0;s=0|n[(A|=0)>>2],a=(3*(o=0|n[(t=A+4|0)>>2])|0)+s|0,s=(i=0|n[(r=A+8|0)>>2])+(3*s|0)|0,n[A>>2]=s,n[t>>2]=a,o=(3*i|0)+o|0,n[r>>2]=o,i=a-s|0,(0|s)<0?(o=o-s|0,n[t>>2]=i,n[r>>2]=o,n[A>>2]=0,s=0):i=a,(0|i)<0&&(s=s-i|0,n[A>>2]=s,o=o-i|0,n[r>>2]=o,n[t>>2]=0,i=0),e=s-o|0,a=i-o|0,(0|o)<0?(n[A>>2]=e,n[t>>2]=a,n[r>>2]=0,s=e,o=0):a=i,(0|(i=(0|o)<(0|(i=(0|a)<(0|s)?a:s))?o:i))<=0||(n[A>>2]=s-i,n[t>>2]=a-i,n[r>>2]=o-i)}function mA(A,e){A|=0;var t,r,o,i=0,a=0,s=0;((e|=0)-1|0)>>>0>=6||(s=(0|n[15440+(12*e|0)>>2])+(0|n[A>>2])|0,n[A>>2]=s,o=A+4|0,a=(0|n[15440+(12*e|0)+4>>2])+(0|n[o>>2])|0,n[o>>2]=a,r=A+8|0,e=(0|n[15440+(12*e|0)+8>>2])+(0|n[r>>2])|0,n[r>>2]=e,i=a-s|0,(0|s)<0?(e=e-s|0,n[o>>2]=i,n[r>>2]=e,n[A>>2]=0,a=0):(i=a,a=s),(0|i)<0&&(a=a-i|0,n[A>>2]=a,e=e-i|0,n[r>>2]=e,n[o>>2]=0,i=0),t=a-e|0,s=i-e|0,(0|e)<0?(n[A>>2]=t,n[o>>2]=s,n[r>>2]=0,a=t,e=0):s=i,(0|(i=(0|e)<(0|(i=(0|s)<(0|a)?s:a))?e:i))<=0||(n[A>>2]=a-i,n[o>>2]=s-i,n[r>>2]=e-i))}function bA(A){var e,t,r,o=0,i=0,a=0,s=0;s=0|n[(A|=0)>>2],a=(o=0|n[(t=A+4|0)>>2])+s|0,s=(i=0|n[(r=A+8|0)>>2])+s|0,n[A>>2]=s,n[t>>2]=a,o=i+o|0,n[r>>2]=o,i=a-s|0,(0|s)<0?(o=o-s|0,n[t>>2]=i,n[r>>2]=o,n[A>>2]=0,a=0):(i=a,a=s),(0|i)<0&&(a=a-i|0,n[A>>2]=a,o=o-i|0,n[r>>2]=o,n[t>>2]=0,i=0),e=a-o|0,s=i-o|0,(0|o)<0?(n[A>>2]=e,n[t>>2]=s,n[r>>2]=0,a=e,o=0):s=i,(0|(i=(0|o)<(0|(i=(0|s)<(0|a)?s:a))?o:i))<=0||(n[A>>2]=a-i,n[t>>2]=s-i,n[r>>2]=o-i)}function pA(A){var e,t,r,o=0,i=0,a=0,s=0;o=0|n[(A|=0)>>2],a=0|n[(t=A+4|0)>>2],i=0|n[(r=A+8|0)>>2],s=a+o|0,n[A>>2]=s,a=i+a|0,n[t>>2]=a,o=i+o|0,n[r>>2]=o,i=a-s|0,(0|s)<0?(o=o-s|0,n[t>>2]=i,n[r>>2]=o,n[A>>2]=0,a=0):(i=a,a=s),(0|i)<0&&(a=a-i|0,n[A>>2]=a,o=o-i|0,n[r>>2]=o,n[t>>2]=0,i=0),e=a-o|0,s=i-o|0,(0|o)<0?(n[A>>2]=e,n[t>>2]=s,n[r>>2]=0,a=e,o=0):s=i,(0|(i=(0|o)<(0|(i=(0|s)<(0|a)?s:a))?o:i))<=0||(n[A>>2]=a-i,n[t>>2]=s-i,n[r>>2]=o-i)}function vA(A){switch(0|(A|=0)){case 1:A=5;break;case 5:A=4;break;case 4:A=6;break;case 6:A=2;break;case 2:A=3;break;case 3:A=1}return 0|A}function wA(A){switch(0|(A|=0)){case 1:A=3;break;case 3:A=2;break;case 2:A=6;break;case 6:A=4;break;case 4:A=5;break;case 5:A=1}return 0|A}function xA(A){var e,t,r,o=0,i=0,a=0,s=0;o=0|n[(A|=0)>>2],i=0|n[(t=A+4|0)>>2],a=0|n[(r=A+8|0)>>2],s=i+(o<<1)|0,n[A>>2]=s,i=a+(i<<1)|0,n[t>>2]=i,o=(a<<1)+o|0,n[r>>2]=o,a=i-s|0,(0|s)<0?(o=o-s|0,n[t>>2]=a,n[r>>2]=o,n[A>>2]=0,i=a,a=0):a=s,(0|i)<0&&(a=a-i|0,n[A>>2]=a,o=o-i|0,n[r>>2]=o,n[t>>2]=0,i=0),e=a-o|0,s=i-o|0,(0|o)<0?(n[A>>2]=e,n[t>>2]=s,n[r>>2]=0,a=e,o=0):s=i,(0|(i=(0|o)<(0|(i=(0|s)<(0|a)?s:a))?o:i))<=0||(n[A>>2]=a-i,n[t>>2]=s-i,n[r>>2]=o-i)}function yA(A){var e,t,r,o=0,i=0,a=0,s=0;s=0|n[(A|=0)>>2],a=((o=0|n[(t=A+4|0)>>2])<<1)+s|0,s=(i=0|n[(r=A+8|0)>>2])+(s<<1)|0,n[A>>2]=s,n[t>>2]=a,o=(i<<1)+o|0,n[r>>2]=o,i=a-s|0,(0|s)<0?(o=o-s|0,n[t>>2]=i,n[r>>2]=o,n[A>>2]=0,s=0):i=a,(0|i)<0&&(s=s-i|0,n[A>>2]=s,o=o-i|0,n[r>>2]=o,n[t>>2]=0,i=0),e=s-o|0,a=i-o|0,(0|o)<0?(n[A>>2]=e,n[t>>2]=a,n[r>>2]=0,s=e,o=0):a=i,(0|(i=(0|o)<(0|(i=(0|a)<(0|s)?a:s))?o:i))<=0||(n[A>>2]=s-i,n[t>>2]=a-i,n[r>>2]=o-i)}function kA(A,e){e|=0;var t,r,o,i=0,a=0,s=0;return o=(0|(r=(0|n[(A|=0)>>2])-(0|n[e>>2])|0))<0,t=(0|(a=(0|n[A+4>>2])-(0|n[e+4>>2])-(o?r:0)|0))<0,e=(e=(A=(0|(s=(o?0-r|0:0)+(0|n[A+8>>2])-(0|n[e+8>>2])+(t?0-a|0:0)|0))<0)?0:s)-((a=(0|(A=(0|e)<(0|(A=(0|(i=(t?0:a)-(A?s:0)|0))<(0|(s=(o?0:r)-(t?a:0)-(A?s:0)|0))?i:s))?e:A))>0)?A:0)|0,i=i-(a?A:0)|0,0|((0|(A=(0|(A=s-(a?A:0)|0))>-1?A:0-A|0))>(0|(e=(0|(i=(0|i)>-1?i:0-i|0))>(0|(e=(0|e)>-1?e:0-e|0))?i:e))?A:e)}function CA(A){var e,t,r,o;t=(o=0|n[(e=8+(A|=0)|0)>>2])-(0|n[A>>2])|0,n[A>>2]=t,A=(0|n[(r=A+4|0)>>2])-o|0,n[r>>2]=A,n[e>>2]=0-(A+t)}function BA(A){var e,t,r=0,o=0,i=0,a=0,s=0;r=0-(o=0|n[(A|=0)>>2])|0,n[A>>2]=r,n[(e=A+8|0)>>2]=0,a=(i=0|n[(t=A+4|0)>>2])+o|0,(0|o)>0?(n[t>>2]=a,n[e>>2]=o,n[A>>2]=0,r=0,i=a):o=0,(0|i)<0?(s=r-i|0,n[A>>2]=s,o=o-i|0,n[e>>2]=o,n[t>>2]=0,a=s-o|0,r=0-o|0,(0|o)<0?(n[A>>2]=a,n[t>>2]=r,n[e>>2]=0,i=r,o=0):(i=0,a=s)):a=r,(0|(r=(0|o)<(0|(r=(0|i)<(0|a)?i:a))?o:r))<=0||(n[A>>2]=a-r,n[t>>2]=i-r,n[e>>2]=o-r)}function MA(A,e){var t=0;switch(t=0|tt(0|(A|=0),0|(e|=0),56),B(),7&t){case 0:case 7:return 0}return t=-2130706433&e|134217728,!0&268435456==(2013265920&e)?!0&16777216==(117440512&e)&!!(0|HA(A,t))?0|(t=0):0|(t=0|LA(A,t)):0|(t=0)}function DA(A,e,t){t|=0;var r,o,i=0,a=0;return o=S,S=S+16|0,r=o,a=-2130706433&(e|=0)|134217728,!0&268435456==(2013265920&e)?(i=0|tt(0|(A|=0),0|e,56),B(),i=0|function(A,e,t){t|=0;var r,o=0,i=0;if(r=S,S=S+16|0,i=r,o=0|HA(A|=0,e|=0),(t+-1|0)>>>0>5)return S=r,-1;if(1==(0|t)&(o=!!(0|o)))return S=r,-1;do{if(!(0|Fe(A,e,i))){if(o){o=(5+(0|n[26352+(t<<2)>>2])-(0|n[i>>2])|0)%5|0;break}o=(6+(0|n[26384+(t<<2)>>2])-(0|n[i>>2])|0)%6|0;break}o=-1}while(0);return S=r,0|(i=o)}(A,a,7&i),-1==(0|i)?(n[t>>2]=0,S=o,0|(a=6)):(0|XA(A,a,r)&&M(27795,26932,282,26947),e=0|tt(0|A,0|e,52),B(),e&=15,0|HA(A,a)?QA(r,e,i,2,t):FA(r,e,i,2,t),S=o,0|(a=0))):(S=o,0|(a=6))}function EA(A,e,t,r,i){e|=0,t|=0,r|=0,i|=0;var a,s=0,u=0;if(s=+function(A){var e,t;return t=+o[(A|=0)>>3],e=+o[A+8>>3],+ +c(+(t*t+e*e))}(A|=0),s<1e-16)return e=15600+(e<<4)|0,n[i>>2]=n[e>>2],n[i+4>>2]=n[e+4>>2],n[i+8>>2]=n[e+8>>2],void(n[i+12>>2]=n[e+12>>2]);if(u=+p(+ +o[A+8>>3],+ +o[A>>3]),(0|t)>0){A=0;do{s*=.37796447300922725,A=A+1|0}while((0|A)!=(0|t))}a=.3333333333333333*s,r?(t=!(0|ZA(t)),s=+b(.381966011250105*(t?a:.37796447300922725*a))):(s=+b(.381966011250105*s),0|ZA(t)&&(u=+ne(u+.3334731722518321))),function(A,e,t,r){A|=0,e=+e,r|=0;var i=0,a=0,s=0,c=0;if((t=+t)<1e-16)return n[r>>2]=n[A>>2],n[r+4>>2]=n[A+4>>2],n[r+8>>2]=n[A+8>>2],void(n[r+12>>2]=n[A+12>>2]);a=e<0?e+6.283185307179586:e,a=e>=6.283185307179586?a+-6.283185307179586:a;do{if(!(a<1e-16)){if(i=+l(+(a+-3.141592653589793))<1e-16,e=+o[A>>3],i){e-=t,o[r>>3]=e,i=r;break}if(s=+f(+t),t=+d(+t),e=s*+d(+e)+ +f(+a)*(t*+f(+e)),e=+m(+((e=e>1?1:e)<-1?-1:e)),o[r>>3]=e,+l(+(e+-1.5707963267948966))<1e-16)return o[r>>3]=1.5707963267948966,void(o[r+8>>3]=0);if(+l(+(e+1.5707963267948966))<1e-16)return o[r>>3]=-1.5707963267948966,void(o[r+8>>3]=0);if(c=1/+f(+e),a=t*+d(+a)*c,t=+o[A>>3],e=c*((s-+d(+e)*+d(+t))/+f(+t)),s=a>1?1:a,e=e>1?1:e,(e=+o[A+8>>3]+ +p(+(s<-1?-1:s),+(e<-1?-1:e)))>3.141592653589793)do{e+=-6.283185307179586}while(e>3.141592653589793);if(e<-3.141592653589793)do{e+=6.283185307179586}while(e<-3.141592653589793);return void(o[r+8>>3]=e)}e=+o[A>>3]+t,o[r>>3]=e,i=r}while(0);if(+l(+(e+-1.5707963267948966))<1e-16)return o[i>>3]=1.5707963267948966,void(o[r+8>>3]=0);if(+l(+(e+1.5707963267948966))<1e-16)return o[i>>3]=-1.5707963267948966,void(o[r+8>>3]=0);if((e=+o[A+8>>3])>3.141592653589793)do{e+=-6.283185307179586}while(e>3.141592653589793);if(e<-3.141592653589793)do{e+=6.283185307179586}while(e<-3.141592653589793);o[r+8>>3]=e}(15600+(e<<4)|0,+ne(+o[15920+(24*e|0)>>3]-u),s,i)}function QA(A,e,t,r,i){A|=0,e|=0,t|=0,r|=0,i|=0;var a,s,l,c,u,f,d,g,h,m,b,p,v,w,x,y,k,C,B,D,E,Q,j=0,N=0,F=0,P=0,T=0,L=0;if(Q=S,S=S+272|0,P=Q+240|0,B=Q,D=Q+224|0,E=Q+208|0,b=Q+176|0,p=Q+160|0,v=Q+192|0,w=Q+144|0,x=Q+128|0,y=Q+112|0,k=Q+96|0,C=Q+80|0,n[(j=Q+256|0)>>2]=e,n[P>>2]=n[A>>2],n[P+4>>2]=n[A+4>>2],n[P+8>>2]=n[A+8>>2],n[P+12>>2]=n[A+12>>2],jA(P,j,B),n[i>>2]=0,(0|(P=r+t+(5==(0|r)&1)|0))<=(0|t))S=Q;else{s=D+4|0,l=b+4|0,c=t+5|0,u=16880+((a=0|n[j>>2])<<2)|0,f=16960+(a<<2)|0,d=x+8|0,g=y+8|0,h=k+8|0,m=E+4|0,F=t;A:for(;;){N=B+((0|F)%5<<4)|0,n[E>>2]=n[N>>2],n[E+4>>2]=n[N+4>>2],n[E+8>>2]=n[N+8>>2],n[E+12>>2]=n[N+12>>2];do{}while(2==(0|NA(E,a,0,1)));if((0|F)>(0|t)&!!(0|ZA(e))){if(n[b>>2]=n[E>>2],n[b+4>>2]=n[E+4>>2],n[b+8>>2]=n[E+8>>2],n[b+12>>2]=n[E+12>>2],oA(s,p),r=0|n[b>>2],j=0|n[17040+(80*r|0)+(n[D>>2]<<2)>>2],n[b>>2]=n[18640+(80*r|0)+(20*j|0)>>2],(0|(N=0|n[18640+(80*r|0)+(20*j|0)+16>>2]))>0){A=0;do{bA(l),A=A+1|0}while((0|A)<(0|N))}switch(N=18640+(80*r|0)+(20*j|0)+4|0,n[v>>2]=n[N>>2],n[v+4>>2]=n[N+4>>2],n[v+8>>2]=n[N+8>>2],sA(v,3*(0|n[u>>2])|0),iA(l,v,l),nA(l),oA(l,w),T=+(0|n[f>>2]),o[x>>3]=3*T,o[d>>3]=0,L=-1.5*T,o[y>>3]=L,o[g>>3]=2.598076211353316*T,o[k>>3]=L,o[h>>3]=-2.598076211353316*T,0|n[17040+(80*(0|n[b>>2])|0)+(n[E>>2]<<2)>>2]){case 1:A=y,r=x;break;case 3:A=k,r=y;break;case 2:A=x,r=k;break;default:A=12;break A}je(p,w,r,A,C),EA(C,0|n[b>>2],a,1,i+8+(n[i>>2]<<4)|0),n[i>>2]=1+(0|n[i>>2])}if((0|F)<(0|c)&&(oA(m,b),EA(b,0|n[E>>2],a,1,i+8+(n[i>>2]<<4)|0),n[i>>2]=1+(0|n[i>>2])),n[D>>2]=n[E>>2],n[D+4>>2]=n[E+4>>2],n[D+8>>2]=n[E+8>>2],n[D+12>>2]=n[E+12>>2],(0|(F=F+1|0))>=(0|P)){A=3;break}}3!=(0|A)?12==(0|A)&&M(26970,27017,572,27027):S=Q}}function jA(A,e,t){A|=0,e|=0,t|=0;var r,o=0,i=0,a=0,s=0,l=0;r=S,S=S+128|0,i=r,s=20240,l=60+(a=o=r+64|0)|0;do{n[a>>2]=n[s>>2],a=a+4|0,s=s+4|0}while((0|a)<(0|l));s=20304,l=(a=i)+60|0;do{n[a>>2]=n[s>>2],a=a+4|0,s=s+4|0}while((0|a)<(0|l));o=(l=!(0|ZA(0|n[e>>2])))?o:i,xA(i=A+4|0),yA(i),0|ZA(0|n[e>>2])&&(hA(i),n[e>>2]=1+(0|n[e>>2])),n[t>>2]=n[A>>2],iA(i,o,e=t+4|0),nA(e),n[t+16>>2]=n[A>>2],iA(i,o+12|0,e=t+20|0),nA(e),n[t+32>>2]=n[A>>2],iA(i,o+24|0,e=t+36|0),nA(e),n[t+48>>2]=n[A>>2],iA(i,o+36|0,e=t+52|0),nA(e),n[t+64>>2]=n[A>>2],iA(i,o+48|0,t=t+68|0),nA(t),S=r}function NA(A,e,t,r){t|=0,r|=0;var o,i,a,s,l,c,u=0,f=0,d=0,g=0,h=0;if(c=S,S=S+32|0,l=c+12|0,i=c,h=4+(A|=0)|0,g=0|n[16960+((e|=0)<<2)>>2],g=(s=!!(0|r))?3*g|0:g,u=0|n[h>>2],o=0|n[(a=A+8|0)>>2],s){if((0|(u=o+u+(r=0|n[(f=A+12|0)>>2])|0))==(0|g))return S=c,1;d=f}else u=o+u+(r=0|n[(d=A+12|0)>>2])|0;if((0|u)<=(0|g))return S=c,0;do{if((0|r)>0){if(r=0|n[A>>2],(0|o)>0){f=18640+(80*r|0)+60|0,r=A;break}r=18640+(80*r|0)+40|0,t?(rA(l,g,0,0),aA(h,l,i),pA(i),iA(i,l,h),f=r,r=A):(f=r,r=A)}else f=18640+(80*(0|n[A>>2])|0)+20|0,r=A}while(0);if(n[r>>2]=n[f>>2],(0|n[(u=f+16|0)>>2])>0){r=0;do{bA(h),r=r+1|0}while((0|r)<(0|n[u>>2]))}return A=f+4|0,n[l>>2]=n[A>>2],n[l+4>>2]=n[A+4>>2],n[l+8>>2]=n[A+8>>2],e=0|n[16880+(e<<2)>>2],sA(l,s?3*e|0:e),iA(h,l,h),nA(h),r=s&&((0|n[a>>2])+(0|n[h>>2])+(0|n[d>>2])|0)==(0|g)?1:2,S=c,0|r}function SA(A,e){A|=0,e|=0;var t=0;do{t=0|NA(A,e,0,1)}while(2==(0|t));return 0|t}function FA(A,e,t,r,i){A|=0,e|=0,t|=0,r|=0,i|=0;var a,s,l,c,u,f,d,g,h,m,b,p,v,w,x,y,k,C,B=0,D=0,E=0,Q=0,j=0;if(C=S,S=S+240|0,w=C+208|0,x=C,y=C+192|0,k=C+176|0,h=C+160|0,m=C+144|0,b=C+128|0,p=C+112|0,v=C+96|0,n[(B=C+224|0)>>2]=e,n[w>>2]=n[A>>2],n[w+4>>2]=n[A+4>>2],n[w+8>>2]=n[A+8>>2],n[w+12>>2]=n[A+12>>2],PA(w,B,x),n[i>>2]=0,(0|(g=r+t+(6==(0|r)&1)|0))<=(0|t))S=C;else{s=t+6|0,l=16960+((a=0|n[B>>2])<<2)|0,c=m+8|0,u=b+8|0,f=p+8|0,d=y+4|0,D=0,E=t,r=-1;A:for(;;){if(A=x+((B=(0|E)%6|0)<<4)|0,n[y>>2]=n[A>>2],n[y+4>>2]=n[A+4>>2],n[y+8>>2]=n[A+8>>2],n[y+12>>2]=n[A+12>>2],A=D,D=0|NA(y,a,0,1),(0|E)>(0|t)&!!(0|ZA(e))&&1!=(0|A)&&(0|n[y>>2])!=(0|r)){switch(oA(x+((B+5|0)%6<<4)+4|0,k),oA(x+(B<<4)+4|0,h),Q=+(0|n[l>>2]),o[m>>3]=3*Q,o[c>>3]=0,j=-1.5*Q,o[b>>3]=j,o[u>>3]=2.598076211353316*Q,o[p>>3]=j,o[f>>3]=-2.598076211353316*Q,B=0|n[w>>2],0|n[17040+(80*B|0)+(((0|r)==(0|B)?n[y>>2]:r)<<2)>>2]){case 1:A=b,r=m;break;case 3:A=p,r=b;break;case 2:A=m,r=p;break;default:A=8;break A}je(k,h,r,A,v),0|Ne(k,v)||0|Ne(h,v)||(EA(v,0|n[w>>2],a,1,i+8+(n[i>>2]<<4)|0),n[i>>2]=1+(0|n[i>>2]))}if((0|E)<(0|s)&&(oA(d,k),EA(k,0|n[y>>2],a,1,i+8+(n[i>>2]<<4)|0),n[i>>2]=1+(0|n[i>>2])),(0|(E=E+1|0))>=(0|g)){A=3;break}r=0|n[y>>2]}3!=(0|A)?8==(0|A)&&M(27054,27017,737,27099):S=C}}function PA(A,e,t){A|=0,e|=0,t|=0;var r,o=0,i=0,a=0,s=0,l=0;r=S,S=S+160|0,i=r,s=20368,l=72+(a=o=r+80|0)|0;do{n[a>>2]=n[s>>2],a=a+4|0,s=s+4|0}while((0|a)<(0|l));s=20448,l=(a=i)+72|0;do{n[a>>2]=n[s>>2],a=a+4|0,s=s+4|0}while((0|a)<(0|l));o=(l=!(0|ZA(0|n[e>>2])))?o:i,xA(i=A+4|0),yA(i),0|ZA(0|n[e>>2])&&(hA(i),n[e>>2]=1+(0|n[e>>2])),n[t>>2]=n[A>>2],iA(i,o,e=t+4|0),nA(e),n[t+16>>2]=n[A>>2],iA(i,o+12|0,e=t+20|0),nA(e),n[t+32>>2]=n[A>>2],iA(i,o+24|0,e=t+36|0),nA(e),n[t+48>>2]=n[A>>2],iA(i,o+36|0,e=t+52|0),nA(e),n[t+64>>2]=n[A>>2],iA(i,o+48|0,e=t+68|0),nA(e),n[t+80>>2]=n[A>>2],iA(i,o+60|0,t=t+84|0),nA(t),S=r}function TA(A,e){return e=0|tt(0|(A|=0),0|(e|=0),45),B(),127&e}function LA(A,e){A|=0;var t=0,n=0,o=0,i=0;return!0&134217728==(-16777216&(e|=0))?(n=0|tt(0|A,0|e,52),B(),n&=15,t=0|tt(0|A,0|e,45),B(),(t&=127)>>>0>121?0|(A=0):!(613566756&(i=0|rt(0|(o=0|tt(0|A,0|e,0|(i=3*(15^n)|0))),0|B(),0|i))&Ze(-1227133514,-1171,0|i,0|(o=0|B())))&!(4681&o&B())&&15==(0|n)|!(0|(i=0|tt(0|rt(0|~A,0|~e,0|(i=19+(3*n|0)|0)),0|B(),0|i)))&!(0|B())?0|r[20528+t|0]?!(0|A)&!(0|(e&=8191))?0|(i=1):(i=0|nt(0|A,0|e),B(),0|!!((63-i|0)%3|0)):0|(i=1):0|(i=0)):0|(A=0)}function IA(A,e,t,r){A|=0,t|=0,r|=0;var o=0,i=0,a=0,s=0;if(o=0|rt(0|(e|=0),0,52),i=0|B(),t=0|rt(0|t,0,45),t=0|i|B()|134225919,(0|e)<1)return i=-1,r=t,n[(e=A)>>2]=i,void(n[(A=A+4|0)>>2]=r);for(i=1,o=-1;s=0|rt(7,0,0|(a=3*(15-i|0)|0)),t&=~B(),o=o&~s|(a=0|rt(0|r,0,0|a)),t=0|t|B(),(0|i)!=(0|e);)i=i+1|0;n[(a=s=A)>>2]=o,n[(s=s+4|0)>>2]=t}function RA(A,e,t,r){t|=0,r|=0;var o=0,i=0;if(i=0|tt(0|(A|=0),0|(e|=0),52),B(),t>>>0>15)return 4;if((0|(i&=15))<(0|t))return 12;if((0|i)==(0|t))return n[r>>2]=A,n[r+4>>2]=e,0;if(o=0|rt(0|t,0,52),o|=A,A=B()|-15728641&e,(0|i)>(0|t))do{e=0|rt(7,0,3*(14-t|0)|0),t=t+1|0,o|=e,A=0|B()|A}while((0|t)<(0|i));return n[r>>2]=o,n[r+4>>2]=A,0}function _A(A,e,t,r){t|=0,r|=0;var o=0,i=0,a=0;if(i=0|tt(0|(A|=0),0|(e|=0),52),B(),!((0|t)<16&(0|(i&=15))<=(0|t)))return 4;o=t-i|0,t=0|tt(0|A,0|e,45),B();A:do{if(0|z(127&t)){e:do{if(0|i){for(t=1;!((a=0|rt(7,0,3*(15-t|0)|0))&A)&!((0|B())&e);){if(!(t>>>0>>0))break e;t=t+1|0}t=0|pe(7,0,o,((0|o)<0)<<31>>31),o=0|B();break A}}while(0);t=0|Ve(0|(t=0|qe(0|(t=0|pe(7,0,o,((0|o)<0)<<31>>31)),0|B(),5,0)),0|B(),-5,-1),t=0|Ve(0|(t=0|Xe(0|t,0|B(),6,0)),0|B(),1,0),o=0|B()}else t=0|pe(7,0,o,((0|o)<0)<<31>>31),o=0|B()}while(0);return n[(a=r)>>2]=t,n[a+4>>2]=o,0}function HA(A,e){var t=0,r=0,n=0;if(n=0|tt(0|(A|=0),0|(e|=0),45),B(),!(0|z(127&n)))return 0;n=0|tt(0|A,0|e,52),B(),n&=15;A:do{if(n)for(r=1;;){if(t=0|tt(0|A,0|e,3*(15-r|0)|0),B(),0|(t&=7))break A;if(!(r>>>0>>0)){t=0;break}r=r+1|0}else t=0}while(0);return 1&!(0|t)}function zA(A,e,t,r){return A|=0,e|=0,(0|(r|=0))<(0|(t|=0))?(r=A,C(0|(t=e)),0|r):(t=0|rt(-1,-1,3+(3*(r-t|0)|0)|0),r=0|rt(0|~t,0|~B(),3*(15-r|0)|0),t=~B()&e,r=~r&A,C(0|t),0|r)}function GA(A,e,t,r){t|=0,r|=0;var o=0;return o=0|tt(0|(A|=0),0|(e|=0),52),B(),(0|t)<16&(0|(o&=15))<=(0|t)?((0|o)<(0|t)&&(o=0|rt(-1,-1,3+(3*(t+-1-o|0)|0)|0),o=0|rt(0|~o,0|~B(),3*(15-t|0)|0),e=~B()&e,A&=~o),o=0|rt(0|t,0,52),t=-15728641&e|B(),n[r>>2]=A|o,n[r+4>>2]=t,0|(r=0)):0|(r=4)}function OA(A,e){var t=0,r=0,n=0;if(n=0|tt(0|(A|=0),0|(e|=0),52),B(),!(n&=15))return 0;for(r=1;;){if(t=0|tt(0|A,0|e,3*(15-r|0)|0),B(),0|(t&=7)){r=5;break}if(!(r>>>0>>0)){t=0,r=5;break}r=r+1|0}return 5==(0|r)?0|t:0}function UA(A,e){var t=0,r=0,n=0,o=0,i=0,a=0,s=0;if(s=0|tt(0|(A|=0),0|(e|=0),52),B(),!(s&=15))return s=A,C(0|(a=e)),0|s;for(a=1,t=0;;){r=0|rt(7,0,0|(o=3*(15-a|0)|0)),n=0|B(),i=0|tt(0|A,0|e,0|o),B(),A=(o=0|rt(0|vA(7&i),0,0|o))|A&~r,e=(i=0|B())|e&~n;A:do{if(!t)if(!(o&r|0)&!(i&n|0))t=0;else if(r=0|tt(0|A,0|e,52),B(),r&=15){t=1;e:for(;;){switch(i=0|tt(0|A,0|e,3*(15-t|0)|0),B(),7&i){case 1:break e;case 0:break;default:t=1;break A}if(!(t>>>0>>0)){t=1;break A}t=t+1|0}for(t=1;;){if(n=0|tt(0|A,0|e,0|(i=3*(15-t|0)|0)),B(),o=0|rt(7,0,0|i),e&=~B(),A=A&~o|(i=0|rt(0|vA(7&n),0,0|i)),e=0|e|B(),!(t>>>0>>0)){t=1;break}t=t+1|0}}else t=1}while(0);if(!(a>>>0>>0))break;a=a+1|0}return C(0|e),0|A}function YA(A,e){var t=0,r=0,n=0,o=0,i=0;if(r=0|tt(0|(A|=0),0|(e|=0),52),B(),!(r&=15))return r=A,C(0|(t=e)),0|r;for(t=1;i=0|tt(0|A,0|e,0|(o=3*(15-t|0)|0)),B(),n=0|rt(7,0,0|o),e&=~B(),A=(o=0|rt(0|vA(7&i),0,0|o))|A&~n,e=0|B()|e,t>>>0>>0;)t=t+1|0;return C(0|e),0|A}function WA(A,e){var t=0,r=0,n=0,o=0,i=0,a=0,s=0;if(s=0|tt(0|(A|=0),0|(e|=0),52),B(),!(s&=15))return s=A,C(0|(a=e)),0|s;for(a=1,t=0;;){r=0|rt(7,0,0|(o=3*(15-a|0)|0)),n=0|B(),i=0|tt(0|A,0|e,0|o),B(),A=(o=0|rt(0|wA(7&i),0,0|o))|A&~r,e=(i=0|B())|e&~n;A:do{if(!t)if(!(o&r|0)&!(i&n|0))t=0;else if(r=0|tt(0|A,0|e,52),B(),r&=15){t=1;e:for(;;){switch(i=0|tt(0|A,0|e,3*(15-t|0)|0),B(),7&i){case 1:break e;case 0:break;default:t=1;break A}if(!(t>>>0>>0)){t=1;break A}t=t+1|0}for(t=1;;){if(o=0|rt(7,0,0|(n=3*(15-t|0)|0)),i=e&~B(),e=0|tt(0|A,0|e,0|n),B(),A=A&~o|(e=0|rt(0|wA(7&e),0,0|n)),e=0|i|B(),!(t>>>0>>0)){t=1;break}t=t+1|0}}else t=1}while(0);if(!(a>>>0>>0))break;a=a+1|0}return C(0|e),0|A}function VA(A,e){var t=0,r=0,n=0,o=0,i=0;if(r=0|tt(0|(A|=0),0|(e|=0),52),B(),!(r&=15))return r=A,C(0|(t=e)),0|r;for(t=1;o=0|rt(7,0,0|(i=3*(15-t|0)|0)),n=e&~B(),e=0|tt(0|A,0|e,0|i),B(),A=(e=0|rt(0|wA(7&e),0,0|i))|A&~o,e=0|B()|n,t>>>0>>0;)t=t+1|0;return C(0|e),0|A}function ZA(A){return(0|(A|=0))%2|0}function KA(A,e,t){t|=0;var r,i=0;return r=S,S=S+16|0,i=r,(e|=0)>>>0>15?(S=r,0|(i=4)):2146435072&~n[4+(A|=0)>>2]&&2146435072&~n[A+8+4>>2]?(function(A,e,t){var r,i;r=S,S=S+16|0,function(A,e,t,r){e|=0,r|=0;var i,a=0,s=0,l=0,c=0;if(i=S,S=S+16|0,function(A,e,t){e|=0,t|=0;var r,i,a=0;i=S,S=S+32|0,function(A,e){e|=0;var t,r,n=0;n=+o[(A|=0)>>3],t=+f(+n),n=+d(+n),o[e+16>>3]=n,n=+o[A+8>>3],r=t*+f(+n),o[e>>3]=r,n=t*+d(+n),o[e+8>>3]=n}(A|=0,r=i),n[e>>2]=0,o[t>>3]=5,(a=+Se(16400,r))<+o[t>>3]&&(n[e>>2]=0,o[t>>3]=a),(a=+Se(16424,r))<+o[t>>3]&&(n[e>>2]=1,o[t>>3]=a),(a=+Se(16448,r))<+o[t>>3]&&(n[e>>2]=2,o[t>>3]=a),(a=+Se(16472,r))<+o[t>>3]&&(n[e>>2]=3,o[t>>3]=a),(a=+Se(16496,r))<+o[t>>3]&&(n[e>>2]=4,o[t>>3]=a),(a=+Se(16520,r))<+o[t>>3]&&(n[e>>2]=5,o[t>>3]=a),(a=+Se(16544,r))<+o[t>>3]&&(n[e>>2]=6,o[t>>3]=a),(a=+Se(16568,r))<+o[t>>3]&&(n[e>>2]=7,o[t>>3]=a),(a=+Se(16592,r))<+o[t>>3]&&(n[e>>2]=8,o[t>>3]=a),(a=+Se(16616,r))<+o[t>>3]&&(n[e>>2]=9,o[t>>3]=a),(a=+Se(16640,r))<+o[t>>3]&&(n[e>>2]=10,o[t>>3]=a),(a=+Se(16664,r))<+o[t>>3]&&(n[e>>2]=11,o[t>>3]=a),(a=+Se(16688,r))<+o[t>>3]&&(n[e>>2]=12,o[t>>3]=a),(a=+Se(16712,r))<+o[t>>3]&&(n[e>>2]=13,o[t>>3]=a),(a=+Se(16736,r))<+o[t>>3]&&(n[e>>2]=14,o[t>>3]=a),(a=+Se(16760,r))<+o[t>>3]&&(n[e>>2]=15,o[t>>3]=a),(a=+Se(16784,r))<+o[t>>3]&&(n[e>>2]=16,o[t>>3]=a),(a=+Se(16808,r))<+o[t>>3]&&(n[e>>2]=17,o[t>>3]=a),(a=+Se(16832,r))<+o[t>>3]&&(n[e>>2]=18,o[t>>3]=a),(a=+Se(16856,r))<+o[t>>3]?(n[e>>2]=19,o[t>>3]=a,S=i):S=i}(A|=0,t|=0,c=i),(s=+h(+(1-.5*+o[c>>3])))<1e-16)return n[r>>2]=0,n[r+4>>2]=0,n[r+8>>2]=0,n[r+12>>2]=0,void(S=i);if(c=0|n[t>>2],a=+ne((a=+o[15920+(24*c|0)>>3])-+ne(+function(A,e){var t,r,n,i,a;return A|=0,i=+o[(e|=0)>>3],r=+f(+i),n=+o[e+8>>3]-+o[A+8>>3],a=r*+d(+n),t=+o[A>>3],+ +p(+a,+(+d(+i)*+f(+t)-+f(+n)*(r*+d(+t))))}(15600+(c<<4)|0,A))),l=0|ZA(e)?+ne(a+-.3334731722518321):a,a=2.618033988749896*+g(+s),(0|e)>0){A=0;do{a*=2.6457513110645907,A=A+1|0}while((0|A)!=(0|e))}s=+f(+l)*a,o[r>>3]=s,l=+d(+l)*a,o[r+8>>3]=l,S=i}(A|=0,e|=0,t|=0,i=r),function(A,e){A|=0;var t,r,i,a,s=0,c=0,u=0,f=0,d=0,g=0,h=0;n[(a=8+(e|=0)|0)>>2]=0,r=+o[A>>3],f=+l(+r),i=+o[A+8>>3],f+=.5*(d=1.1547005383792515*+l(+i)),f-=+(0|(s=~~f)),d-=+(0|(A=~~d));do{if(f<.5){if(f<.3333333333333333){if(n[e>>2]=s,d<.5*(f+1)){n[e+4>>2]=A;break}A=A+1|0,n[e+4>>2]=A;break}if(A=(1&!(d<(h=1-f)))+A|0,n[e+4>>2]=A,h<=d&d<2*f){s=s+1|0,n[e>>2]=s;break}n[e>>2]=s;break}if(!(f<.6666666666666666)){if(s=s+1|0,n[e>>2]=s,d<.5*f){n[e+4>>2]=A;break}A=A+1|0,n[e+4>>2]=A;break}if(d<1-f){if(n[e+4>>2]=A,2*f-1>2]=s;break}}else A=A+1|0,n[e+4>>2]=A;s=s+1|0,n[e>>2]=s}while(0);do{if(r<0){if(1&A){s=~~(+(0|s)-(2*(+((g=0|Ze(0|s,((0|s)<0)<<31>>31,0|(g=(A+1|0)/2|0),((0|g)<0)<<31>>31))>>>0)+4294967296*+(0|B()))+1)),n[e>>2]=s;break}s=~~(+(0|s)-2*(+((g=0|Ze(0|s,((0|s)<0)<<31>>31,0|(g=(0|A)/2|0),((0|g)<0)<<31>>31))>>>0)+4294967296*+(0|B()))),n[e>>2]=s;break}}while(0);g=e+4|0,i<0&&(s=s-((1|A<<1)/2|0)|0,n[e>>2]=s,A=0-A|0,n[g>>2]=A),c=A-s|0,(0|s)<0?(u=0-s|0,n[g>>2]=c,n[a>>2]=u,n[e>>2]=0,A=c,s=0):u=0,(0|A)<0&&(s=s-A|0,n[e>>2]=s,u=u-A|0,n[a>>2]=u,n[g>>2]=0,A=0),t=s-u|0,c=A-u|0,(0|u)<0&&(n[e>>2]=t,n[g>>2]=c,n[a>>2]=0,A=c,s=t,u=0),(0|(c=(0|u)<(0|(c=(0|A)<(0|s)?A:s))?u:c))<=0||(n[e>>2]=s-c,n[g>>2]=A-c,n[a>>2]=u-c)}(i,t+4|0),S=r}(A,e,i),e=0|function(A,e){A|=0;var t,r=0,o=0,i=0,a=0,s=0,l=0,c=0,u=0;if(t=S,S=S+64|0,l=t+40|0,o=t+24|0,i=t+12|0,a=t,rt(0|(e|=0),0,52),r=134225919|B(),!e)return(0|n[A+4>>2])>2||(0|n[A+8>>2])>2||(0|n[A+12>>2])>2?(l=0,C(0|(s=0)),S=t,0|l):(rt(0|O(A),0,45),s=0|B()|r,l=-1,C(0|s),S=t,0|l);if(n[l>>2]=n[A>>2],n[l+4>>2]=n[A+4>>2],n[l+8>>2]=n[A+8>>2],n[l+12>>2]=n[A+12>>2],s=l+4|0,(0|e)>0)for(A=-1;n[o>>2]=n[s>>2],n[o+4>>2]=n[s+4>>2],n[o+8>>2]=n[s+8>>2],1&e?(fA(s),n[i>>2]=n[s>>2],n[i+4>>2]=n[s+4>>2],n[i+8>>2]=n[s+8>>2],gA(i)):(dA(s),n[i>>2]=n[s>>2],n[i+4>>2]=n[s+4>>2],n[i+8>>2]=n[s+8>>2],hA(i)),aA(o,i,a),nA(a),c=0|rt(7,0,0|(u=3*(15-e|0)|0)),r&=~B(),A=(u=0|rt(0|lA(a),0,0|u))|A&~c,r=0|B()|r,(0|e)>1;)e=e+-1|0;else A=-1;A:do{if((0|n[s>>2])<=2&&(0|n[l+8>>2])<=2&&(0|n[l+12>>2])<=2){if(e=0|rt(0|(o=0|O(l)),0,45),e|=A,A=B()|-1040385&r,a=0|U(l),!(0|z(o))){if((0|a)<=0)break;for(i=0;;){if(o=0|tt(0|e,0|A,52),B(),o&=15)for(r=1;l=0|tt(0|e,0|A,0|(u=3*(15-r|0)|0)),B(),c=0|rt(7,0,0|u),A&=~B(),e=e&~c|(u=0|rt(0|vA(7&l),0,0|u)),A=0|A|B(),r>>>0>>0;)r=r+1|0;if((0|(i=i+1|0))==(0|a))break A}}i=0|tt(0|e,0|A,52),B(),i&=15;e:do{if(i){r=1;t:for(;;){switch(u=0|tt(0|e,0|A,3*(15-r|0)|0),B(),7&u){case 1:break t;case 0:break;default:break e}if(!(r>>>0>>0))break e;r=r+1|0}if(0|Y(o,0|n[l>>2]))for(r=1;c=0|rt(7,0,0|(l=3*(15-r|0)|0)),u=A&~B(),A=0|tt(0|e,0|A,0|l),B(),e=e&~c|(A=0|rt(0|wA(7&A),0,0|l)),A=0|u|B(),r>>>0>>0;)r=r+1|0;else for(r=1;l=0|tt(0|e,0|A,0|(u=3*(15-r|0)|0)),B(),c=0|rt(7,0,0|u),A&=~B(),e=e&~c|(u=0|rt(0|vA(7&l),0,0|u)),A=0|A|B(),r>>>0>>0;)r=r+1|0}}while(0);if((0|a)>0){r=0;do{e=0|UA(e,A),A=0|B(),r=r+1|0}while((0|r)!=(0|a))}}else e=0,A=0}while(0);return u=e,C(0|(c=A)),S=t,0|u}(i,e),i=0|B(),n[t>>2]=e,n[t+4>>2]=i,!(0|e)&!(0|i)&&M(27795,27122,1050,27145),S=r,0|(i=0)):(S=r,0|(i=3))}function JA(A,e,t){var r,o=0,i=0,a=0;if(r=4+(t|=0)|0,i=0|tt(0|(A|=0),0|(e|=0),52),B(),i&=15,a=0|tt(0|A,0|e,45),B(),o=!(0|i),0|z(127&a)){if(o)return 1;o=1}else{if(o)return 0;o=0|n[r>>2]||0|n[t+8>>2]?1:1&!!(0|n[t+12>>2])}for(t=1;1&t?gA(r):hA(r),a=0|tt(0|A,0|e,3*(15-t|0)|0),B(),mA(r,7&a),t>>>0>>0;)t=t+1|0;return 0|o}function XA(A,e,t){t|=0;var r,o,i=0,a=0,s=0,l=0,c=0,u=0;if(o=S,S=S+16|0,r=o,u=0|tt(0|(A|=0),0|(e|=0),45),B(),(u&=127)>>>0>121)return n[t>>2]=0,n[t+4>>2]=0,n[t+8>>2]=0,n[t+12>>2]=0,S=o,5;A:do{if(0|z(u)&&(s=0|tt(0|A,0|e,52),B(),0|(s&=15))){i=1;e:for(;;){switch(c=0|tt(0|A,0|e,3*(15-i|0)|0),B(),7&c){case 5:break e;case 0:break;default:i=e;break A}if(!(i>>>0>>0)){i=e;break A}i=i+1|0}for(a=1,i=e;l=0|rt(7,0,0|(e=3*(15-a|0)|0)),c=i&~B(),i=0|tt(0|A,0|i,0|e),B(),A=A&~l|(i=0|rt(0|wA(7&i),0,0|e)),i=0|c|B(),a>>>0>>0;)a=a+1|0}else i=e}while(0);if(c=7696+(28*u|0)|0,n[t>>2]=n[c>>2],n[t+4>>2]=n[c+4>>2],n[t+8>>2]=n[c+8>>2],n[t+12>>2]=n[c+12>>2],!(0|JA(A,i,t)))return S=o,0;if(l=t+4|0,n[r>>2]=n[l>>2],n[r+4>>2]=n[l+4>>2],n[r+8>>2]=n[l+8>>2],s=0|tt(0|A,0|i,52),B(),c=15&s,1&s?(hA(l),s=c+1|0):s=c,0|z(u)){A:do{if(c)for(e=1;;){if(a=0|tt(0|A,0|i,3*(15-e|0)|0),B(),0|(a&=7)){i=a;break A}if(!(e>>>0>>0)){i=0;break}e=e+1|0}else i=0}while(0);i=4==(0|i)&1}else i=0;if(0|NA(t,s,i,0)){if(0|z(u))do{}while(0|NA(t,s,0,0));(0|s)!=(0|c)&&dA(l)}else(0|s)!=(0|c)&&(n[l>>2]=n[r>>2],n[l+4>>2]=n[r+4>>2],n[l+8>>2]=n[r+8>>2]);return S=o,0}function qA(A,e,t){t|=0;var r,o,i=0;return o=S,S=S+16|0,0|(i=0|XA(A|=0,e|=0,r=o))?(S=o,0|i):(i=0|tt(0|A,0|e,52),B(),function(A,e,t){var r,o;e|=0,t|=0,r=S,S=S+16|0,oA(4+(A|=0)|0,o=r),EA(o,0|n[A>>2],e,0,t),S=r}(r,15&i,t),S=o,0|(i=0))}function $A(A,e,t){t|=0;var r,n=0,o=0,i=0;if(r=S,S=S+16|0,0|(n=0|XA(A|=0,e|=0,i=r)))return S=r,0|n;n=0|tt(0|A,0|e,45),B(),n=!(0|z(127&n)),o=0|tt(0|A,0|e,52),B(),o&=15;A:do{if(!n){if(0|o)for(n=1;;){if(!(!((0|rt(7,0,3*(15-n|0)|0))&A)&!((0|B())&e)))break A;if(!(n>>>0>>0))break;n=n+1|0}return QA(i,o,0,5,t),S=r,0}}while(0);return FA(i,o,0,6,t),S=r,0}function Ae(A,e){e|=0;var t=0,r=0,o=0,i=0,a=0,s=0,l=0;if((A|=0)>>>0>15)return 4;if(rt(0|A,0,52),s=134225919|B(),!A){t=0,r=0;do{0|z(r)&&(rt(0|r,0,45),a=0|s|B(),n[(A=e+(t<<3)|0)>>2]=-1,n[A+4>>2]=a,t=t+1|0),r=r+1|0}while(122!=(0|r));return 0}t=0,a=0;do{if(0|z(a)){for(rt(0|a,0,45),r=1,o=-1,i=0|s|B();o&=~(l=0|rt(7,0,3*(15-r|0)|0)),i&=~B(),(0|r)!=(0|A);)r=r+1|0;n[(l=e+(t<<3)|0)>>2]=o,n[l+4>>2]=i,t=t+1|0}a=a+1|0}while(122!=(0|a));return 0}function ee(A,e,t,r){A|=0,r|=0;var o=0,i=0,a=0;o=0|tt(0|(e|=0),0|(t|=0),52),B(),!(0|e)&!(0|t)|(0|r)>15|(0|(o&=15))>(0|r)?(i=-1,e=-1,t=0,o=0):(e=0|zA(e,t,o+1|0,r),a=-15728641&B(),t=0|rt(0|r,0,52),i=o,e=(e=!(0|HA(t|=e,a=0|a|B())))?-1:r,o=a),n[(a=A)>>2]=t,n[a+4>>2]=o,n[A+8>>2]=i,n[A+12>>2]=e}function te(A,e,t,r){t|=0,r|=0;var o=0,i=0;return o=0|tt(0|(A|=0),0|(e|=0),52),B(),o&=15,n[(i=r+8|0)>>2]=o,!(0|A)&!(0|e)|(0|t)>15|(0|o)>(0|t)?(n[(t=r)>>2]=0,n[t+4>>2]=0,n[i>>2]=-1,void(n[r+12>>2]=-1)):(A=0|zA(A,e,o+1|0,t),i=-15728641&B(),o=0|rt(0|t,0,52),o|=A,i=0|i|B(),n[(A=r)>>2]=o,n[A+4>>2]=i,A=r+12|0,0|HA(o,i)?void(n[A>>2]=t):void(n[A>>2]=-1))}function re(A){var e,t=0,r=0,o=0,i=0,a=0,s=0,l=0,c=0;if(!(!(0|(t=0|n[(r=A|=0)>>2]))&!(0|(r=0|n[r+4>>2]))||(o=0|tt(0|t,0|r,52),B(),t=0|Ve(0|(l=0|rt(1,0,3*(15^(o&=15))|0)),0|B(),0|t,0|r),r=0|B(),n[(l=A)>>2]=t,n[l+4>>2]=r,(0|o)<(0|(s=0|n[(l=A+8|0)>>2]))))){for(e=A+12|0,a=o;;){if((0|a)==(0|s)){o=5;break}if(c=(0|a)==(0|n[e>>2]),o=0|tt(0|t,0|r,0|(i=3*(15-a|0)|0)),B(),c&1==(0|(o&=7))&!0){o=7;break}if(!(7==(0|o)&!0)){o=10;break}if(t=0|Ve(0|t,0|r,0|(c=0|rt(1,0,0|i)),0|B()),r=0|B(),n[(c=A)>>2]=t,n[c+4>>2]=r,!((0|a)>(0|s))){o=10;break}a=a+-1|0}if(5==(0|o))return n[(c=A)>>2]=0,n[c+4>>2]=0,n[l>>2]=-1,void(n[e>>2]=-1);if(7==(0|o))return s=0|Ve(0|t,0|r,0|(s=0|rt(1,0,0|i)),0|B()),l=0|B(),n[(c=A)>>2]=s,n[c+4>>2]=l,void(n[e>>2]=a+-1)}}function ne(A){var e;return e=(A=+A)<0?A+6.283185307179586:A,+(A>=6.283185307179586?e+-6.283185307179586:e)}function oe(A,e){return e|=0,+l(+(+o[(A|=0)>>3]-+o[e>>3]))<17453292519943298e-27?0|(e=+l(+(+o[A+8>>3]-+o[e+8>>3]))<17453292519943298e-27):0|(e=0)}function ie(A,e){switch(A=+A,0|(e|=0)){case 1:A=A<0?A+6.283185307179586:A;break;case 2:A=A>0?A+-6.283185307179586:A}return+A}function ae(A,e){A|=0;var t,r,n,i=0;return r=+o[(e|=0)>>3],t=+o[A>>3],i=(n=+d(.5*(r-t)))*n+(i=+d(.5*(+o[e+8>>3]-+o[A+8>>3])))*(+f(+r)*+f(+t)*i),2*+p(+ +c(+i),+ +c(+(1-i)))*6371.007180918475}function se(A,e){return e|=0,(A|=0)>>>0>15?0|(e=4):(o[e>>3]=+o[20656+(A<<3)>>3],0|(e=0))}function le(A,e){e|=0;var t=0;return(A|=0)>>>0>15?0|(e=4):(t=0|qe(0|(t=0|pe(7,0,A,((0|A)<0)<<31>>31)),0|B(),120,0),A=0|B(),n[e>>2]=2|t,n[e+4>>2]=A,0|(e=0))}function ce(A,e,t){A|=0,t|=0;var r,n,i,a,s=0,l=0,u=0,h=0,m=0,v=0;return v=+o[(e|=0)>>3],i=+o[A>>3],m=+d(.5*(v-i)),u=+o[e+8>>3],n=+o[A+8>>3],h=+d(.5*(u-n)),r=+f(+i),a=+f(+v),h=2*+p(+ +c(+(h=m*m+h*(a*r*h))),+ +c(+(1-h))),m=+o[t>>3],v=+d(.5*(m-v)),s=+o[t+8>>3],u=+d(.5*(s-u)),l=+f(+m),u=2*+p(+ +c(+(u=v*v+u*(a*l*u))),+ +c(+(1-u))),m=+d(.5*(i-m)),s=+d(.5*(n-s)),s=2*+p(+ +c(+(s=m*m+s*(r*l*s))),+ +c(+(1-s))),4*+b(+ +c(+ +g(.5*(l=.5*(h+u+s)))*+g(.5*(l-h))*+g(.5*(l-u))*+g(.5*(l-s))))}function ue(A,e,t){t|=0;var r,i,a,s=0,l=0;if(a=S,S=S+192|0,i=a,0|(l=0|qA(A|=0,e|=0,r=a+168|0)))return S=a,0|l;if(0|$A(A,e,i)&&M(27795,27190,415,27199),(0|(e=0|n[i>>2]))>0){if(s=+ce(i+8|0,i+8+((1!=(0|e)&1)<<4)|0,r)+0,1!=(0|e)){A=1;do{s+=+ce(i+8+((l=A)<<4)|0,i+8+((0|(A=A+1|0))%(0|e)<<4)|0,r)}while((0|A)<(0|e))}}else s=0;return o[t>>3]=s,S=a,0}function fe(A){A|=0;var e,t,r=0;return(e=0|We(1,12))||M(27280,27235,49,27293),0|(r=0|n[(t=A+4|0)>>2])?(n[(r=r+8|0)>>2]=e,n[t>>2]=e,0|e):(0|n[A>>2]&&M(27310,27235,61,27333),n[(r=A)>>2]=e,n[t>>2]=e,0|e)}function de(A,e){var t,r;return A|=0,e|=0,(r=0|Ue(24))||M(27347,27235,78,27361),n[r>>2]=n[e>>2],n[r+4>>2]=n[e+4>>2],n[r+8>>2]=n[e+8>>2],n[r+12>>2]=n[e+12>>2],n[r+16>>2]=0,0|(t=0|n[(e=A+4|0)>>2])?(n[t+16>>2]=r,n[e>>2]=r,0|r):(0|n[A>>2]&&M(27376,27235,82,27361),n[A>>2]=r,n[e>>2]=r,0|r)}function ge(A){var e=0,t=0,r=0,o=0;if(A|=0)for(r=1;;){if(0|(e=0|n[A>>2]))do{if(0|(t=0|n[e>>2]))do{o=t,t=0|n[t+16>>2],Ye(o)}while(0|t);o=e,e=0|n[e+8>>2],Ye(o)}while(0|e);if(e=A,A=0|n[A+8>>2],r||Ye(e),!A)break;r=0}}function he(A,e,t){A|=0;var r=0,i=0,a=0,s=0,l=0,c=0,u=0,f=0;if(!(0|X(e|=0,t|=0)))return 0;if(e=0|K(e),r=+o[t>>3],i=e&(i=+o[t+8>>3])<0?i+6.283185307179586:i,!(A=0|n[A>>2]))return 0;if(e){e=0,u=i,t=A;A:for(;;){for(;s=+o[t>>3],i=+o[t+8>>3],f=0|n[(t=t+16|0)>>2],a=+o[(f=0|f?f:A)>>3],l=+o[f+8>>3],s>a?(c=s,s=l):(c=a,a=s,s=i,i=l),(r=r==a|r==c?r+2220446049250313e-31:r)c;)if(!(t=0|n[t>>2])){t=22;break A}if(((c=(l=s<0?s+6.283185307179586:s)+(r-a)/(c-a)*((s=i<0?i+6.283185307179586:i)-l))<0?c+6.283185307179586:c)>(u=l==u|s==u?u+-2220446049250313e-31:u)&&(e^=1),!(t=0|n[t>>2])){t=22;break}}if(22==(0|t))return 0|e}else{e=0,u=i,t=A;A:for(;;){for(;s=+o[t>>3],i=+o[t+8>>3],f=0|n[(t=t+16|0)>>2],a=+o[(f=0|f?f:A)>>3],l=+o[f+8>>3],s>a?(c=s,s=l):(c=a,a=s,s=i,i=l),(r=r==a|r==c?r+2220446049250313e-31:r)c;)if(!(t=0|n[t>>2])){t=22;break A}if(s+(r-a)/(c-a)*(i-s)>(u=s==u|i==u?u+-2220446049250313e-31:u)&&(e^=1),!(t=0|n[t>>2])){t=22;break}}if(22==(0|t))return 0|e}return 0}function me(A,e,t,o,i){t|=0,o|=0,i|=0;var a,s,l,c,u=0,f=0,d=0,g=0,h=0,m=0,b=0,p=0,v=0,w=0;if(c=S,S=S+32|0,w=c+16|0,l=c,u=0|tt(0|(A|=0),0|(e|=0),52),B(),u&=15,b=0|tt(0|t,0|o,52),B(),(0|u)!=(15&b))return S=c,12;if(h=0|tt(0|A,0|e,45),B(),h&=127,m=0|tt(0|t,0|o,45),B(),h>>>0>121|(m&=127)>>>0>121)return S=c,5;if(b=(0|h)!=(0|m)){if(7==(0|(d=0|V(h,m))))return S=c,1;7==(0|(g=0|V(m,h)))?M(27514,27538,161,27548):(p=d,f=g)}else p=0,f=0;a=0|z(h),s=0|z(m),n[w>>2]=0,n[w+4>>2]=0,n[w+8>>2]=0,n[w+12>>2]=0;do{if(p){if(d=(0|(m=0|n[4272+(28*h|0)+(p<<2)>>2]))>0,s)if(d){h=0,g=t,d=o;do{g=0|WA(g,d),d=0|B(),1==(0|(f=0|wA(f)))&&(f=0|wA(1)),h=h+1|0}while((0|h)!=(0|m));m=f,h=g,g=d}else m=f,h=t,g=o;else if(d){h=0,g=t,d=o;do{g=0|VA(g,d),d=0|B(),f=0|wA(f),h=h+1|0}while((0|h)!=(0|m));m=f,h=g,g=d}else m=f,h=t,g=o;if(JA(h,g,w),b||M(27563,27538,191,27548),(d=!!(0|a))&(f=!!(0|s))&&M(27590,27538,192,27548),d){if(7==(0|(f=0|OA(A,e)))){u=5;break}if(0|r[22e3+(7*f|0)+p|0]){u=1;break}h=g=0|n[21168+(28*f|0)+(p<<2)>>2]}else if(f){if(7==(0|(f=0|OA(h,g)))){u=5;break}if(0|r[22e3+(7*f|0)+m|0]){u=1;break}h=0,g=0|n[21168+(28*m|0)+(f<<2)>>2]}else h=0,g=0;if((h|g|0)<0)u=5;else{if((0|g)>0){d=w+4|0,f=0;do{pA(d),f=f+1|0}while((0|f)!=(0|g))}if(n[l>>2]=0,n[l+4>>2]=0,n[l+8>>2]=0,mA(l,p),0|u)for(;0|ZA(u)?gA(l):hA(l),(0|u)>1;)u=u+-1|0;if((0|h)>0){u=0;do{pA(l),u=u+1|0}while((0|u)!=(0|h))}iA(v=w+4|0,l,v),nA(v),v=51}}else if(JA(t,o,w),!!(0|a)&!!(0|s))if((0|m)!=(0|h)&&M(27621,27538,261,27548),7==(0|(f=0|OA(A,e)))|7==(0|(u=0|OA(t,o))))u=5;else if(0|r[22e3+(7*f|0)+u|0])u=1;else if((0|(f=0|n[21168+(28*f|0)+(u<<2)>>2]))>0){d=w+4|0,u=0;do{pA(d),u=u+1|0}while((0|u)!=(0|f));v=51}else v=51;else v=51}while(0);return 51==(0|v)&&(u=w+4|0,n[i>>2]=n[u>>2],n[i+4>>2]=n[u+4>>2],n[i+8>>2]=n[u+8>>2],u=0),S=c,0|u}function be(A,e,t,r){t|=0,r|=0;var o,i,a,s=0,l=0,c=0,u=0,f=0,d=0,g=0,h=0,m=0,b=0,p=0,v=0,w=0;if(a=S,S=S+48|0,o=a+36|0,c=a+24|0,u=a+12|0,f=a,s=0|tt(0|(A|=0),0|(e|=0),52),B(),s&=15,g=0|tt(0|A,0|e,45),B(),(g&=127)>>>0>121)return S=a,5;if(i=0|z(g),rt(0|s,0,52),b=134225919|B(),n[(l=r)>>2]=-1,n[l+4>>2]=b,!s)return 7==(0|(s=0|lA(t)))||127==(0|(s=0|W(g,s)))?(S=a,0|(b=1)):(h=0|rt(0|s,0,45),m=0|B(),m=-1040385&n[(g=r)+4>>2]|m,n[(b=r)>>2]=n[g>>2]|h,n[b+4>>2]=m,S=a,0|(b=0));for(n[o>>2]=n[t>>2],n[o+4>>2]=n[t+4>>2],n[o+8>>2]=n[t+8>>2],t=s;;){if(l=t,t=t+-1|0,n[c>>2]=n[o>>2],n[c+4>>2]=n[o+4>>2],n[c+8>>2]=n[o+8>>2],0|ZA(l)){if(0|(s=0|cA(o))){t=13;break}n[u>>2]=n[o>>2],n[u+4>>2]=n[o+4>>2],n[u+8>>2]=n[o+8>>2],gA(u)}else{if(0|(s=0|uA(o))){t=13;break}n[u>>2]=n[o>>2],n[u+4>>2]=n[o+4>>2],n[u+8>>2]=n[o+8>>2],hA(u)}if(aA(c,u,f),nA(f),v=0|n[(s=r)>>2],s=0|n[s+4>>2],p=0|rt(7,0,0|(w=3*(15-l|0)|0)),s&=~B(),w=0|rt(0|lA(f),0,0|w),s=0|B()|s,n[(b=r)>>2]=w|v&~p,n[b+4>>2]=s,(0|l)<=1){t=14;break}}A:do{if(13!=(0|t)&&14==(0|t))if((0|n[o>>2])<=1&&(0|n[o+4>>2])<=1&&(0|n[o+8>>2])<=1){f=127==(0|(s=0|W(g,t=0|lA(o))))?0:0|z(s);e:do{if(t){if(i){if(7==(0|(s=0|OA(A,e)))){s=5;break A}if((0|(l=0|n[21376+(28*s|0)+(t<<2)>>2]))>0){s=t,t=0;do{s=0|vA(s),t=t+1|0}while((0|t)!=(0|l))}else s=t;if(1==(0|s)){s=9;break A}127==(0|(t=0|W(g,s)))&&M(27648,27538,411,27678),0|z(t)?M(27693,27538,412,27678):(m=t,h=l,d=s)}else m=s,h=0,d=t;if((0|(u=0|n[4272+(28*g|0)+(d<<2)>>2]))<=-1&&M(27724,27538,419,27678),!f){if((0|h)<0){s=5;break A}if(0|h){s=0,t=0|n[(l=r)>>2],l=0|n[l+4>>2];do{t=0|YA(t,l),l=0|B(),n[(w=r)>>2]=t,n[w+4>>2]=l,s=s+1|0}while((0|s)<(0|h))}if((0|u)<=0){s=m,t=58;break}for(s=0,t=0|n[(l=r)>>2],l=0|n[l+4>>2];;)if(t=0|YA(t,l),l=0|B(),n[(w=r)>>2]=t,n[w+4>>2]=l,(0|(s=s+1|0))==(0|u)){s=m,t=58;break e}}if(7==(0|(c=0|V(m,g)))&&M(27514,27538,428,27678),t=0|n[(s=r)>>2],s=0|n[s+4>>2],(0|u)>0){l=0;do{t=0|YA(t,s),s=0|B(),n[(w=r)>>2]=t,n[w+4>>2]=s,l=l+1|0}while((0|l)!=(0|u))}if(7==(0|(s=0|OA(t,s)))&&M(27795,27538,440,27678),t=0|G(m),(0|(t=0|n[(t?21792:21584)+(28*c|0)+(s<<2)>>2]))<0&&M(27795,27538,454,27678),t){s=0,l=0|n[(c=r)>>2],c=0|n[c+4>>2];do{l=0|UA(l,c),c=0|B(),n[(w=r)>>2]=l,n[w+4>>2]=c,s=s+1|0}while((0|s)<(0|t));s=m,t=58}else s=m,t=58}else if(!!(0|i)&!!(0|f)){if(7==(0|(t=0|OA(A,e)))|7==(0|(l=0|OA(0|n[(l=r)>>2],0|n[l+4>>2])))){s=5;break A}if((0|(l=0|n[21376+(28*t|0)+(l<<2)>>2]))<0){s=5;break A}if(l){t=0,c=0|n[(u=r)>>2],u=0|n[u+4>>2];do{c=0|YA(c,u),u=0|B(),n[(w=r)>>2]=c,n[w+4>>2]=u,t=t+1|0}while((0|t)<(0|l));t=58}else t=59}else t=58}while(0);if(58==(0|t)&&f&&(t=59),59==(0|t)&&1==(0|OA(0|n[(w=r)>>2],0|n[w+4>>2]))){s=9;break}p=0|n[(w=r)>>2],w=-1040385&n[w+4>>2],v=0|rt(0|s,0,45),w=0|w|B(),n[(s=r)>>2]=p|v,n[s+4>>2]=w,s=0}else s=1}while(0);return S=a,0|s}function pe(A,e,t,r){A|=0,e|=0;var n=0,o=0,i=0;if(!(0|(t|=0))&!(0|(r|=0)))return o=1,C(0|(n=0)),0|o;o=A,n=e,A=1,e=0;do{A=0|qe(0|((i=!0&!(1&t))?1:o),0|(i?0:n),0|A,0|e),e=0|B(),t=0|et(0|t,0|r,1),r=0|B(),o=0|qe(0|o,0|n,0|o,0|n),n=0|B()}while(!(!(0|t)&!(0|r)));return C(0|e),0|A}function ve(A,e,t,r){t|=0,r|=0;var i,a=0,s=0,l=0,c=0,u=0,d=0;i=S,S=S+16|0,s=i,l=0|tt(0|(A|=0),0|(e|=0),52),B(),l&=15;do{if(l){if(!(a=0|qA(A,e,s))){u=+o[s>>3],c=1/+f(+u),d=+o[25968+(l<<3)>>3],o[t>>3]=u+d,o[t+8>>3]=u-d,u=+o[s+8>>3],c*=d,o[t+16>>3]=c+u,o[t+24>>3]=u-c;break}return S=i,0|a}if(a=0|tt(0|A,0|e,45),B(),(a&=127)>>>0>121)return S=i,5;s=22064+(a<<5)|0,n[t>>2]=n[s>>2],n[t+4>>2]=n[s+4>>2],n[t+8>>2]=n[s+8>>2],n[t+12>>2]=n[s+12>>2],n[t+16>>2]=n[s+16>>2],n[t+20>>2]=n[s+20>>2],n[t+24>>2]=n[s+24>>2],n[t+28>>2]=n[s+28>>2];break}while(0);return function(A,e){e=+e;var t,r,n,i,a,s,l,c=0,u=0;c=(i=+o[(n=16+(A|=0)|0)>>3])-(r=+o[(t=A+24|0)>>3]),c=i>3],c=.5*(c*e-c),u+=e=.5*((l=u-(s=+o[(a=A+8|0)>>3]))*e-l),o[A>>3]=u>1.5707963267948966?1.5707963267948966:u,e=s-e,o[a>>3]=e<-1.5707963267948966?-1.5707963267948966:e,e=(e=i+c)>3.141592653589793?e+-6.283185307179586:e,o[n>>3]=e<-3.141592653589793?e+6.283185307179586:e,e=(e=r-c)>3.141592653589793?e+-6.283185307179586:e,o[t>>3]=e<-3.141592653589793?e+6.283185307179586:e}(t,r?1.4:1.1),(0|n[(r=26096+(l<<3)|0)>>2])==(0|A)&&(0|n[r+4>>2])==(0|e)&&(o[t>>3]=1.5707963267948966),(0|n[(l=26224+(l<<3)|0)>>2])==(0|A)&&(0|n[l+4>>2])==(0|e)&&(o[t+8>>3]=-1.5707963267948966),1.5707963267948966!=+o[t>>3]&&-1.5707963267948966!=+o[t+8>>3]?(S=i,0|(l=0)):(o[t+16>>3]=3.141592653589793,o[t+24>>3]=-3.141592653589793,S=i,0|(l=0))}function we(A){var e,t,o,i,a=0,s=0,l=0,c=0,u=0,f=0,d=0,g=0,h=0,m=0,b=0,p=0,v=0,w=0,x=0,y=0;if(i=S,S=S+336|0,e=i+168|0,t=i,!(0|(s=0|n[(l=A|=0)>>2]))&!(0|(l=0|n[l+4>>2])))S=i;else{if(0|r[0|(a=A+28|0)]?(s=0|xe(s,l),l=0|B()):r[0|a]=1,!(0|n[n[(o=A+20|0)>>2]>>2]))return 0|(s=0|n[(a=A+24|0)>>2])&&Ye(s),n[(y=A)>>2]=0,n[y+4>>2]=0,n[A+8>>2]=0,n[o>>2]=0,n[A+12>>2]=-1,n[A+16>>2]=0,n[a>>2]=0,void(S=i);c=15&(a=0|n[(y=A+16|0)>>2]);A:do{if(!(0|s)&!(0|l))x=A+24|0;else{v=A+12|0,b=3==(0|c),m=255&a,g=3==(1|c),p=A+24|0,h=(c+-1|0)>>>0<3,f=3==(2|c),d=t+8|0;e:for(;;){if(u=0|tt(0|s,0|l,52),B(),(0|(u&=15))==(0|n[v>>2])){switch(15&m){case 0:case 2:case 3:if(0|(c=0|qA(s,l,e))){w=15;break e}if(0|Me(0|n[o>>2],0|n[p>>2],e)){w=19;break e}}if(g&&(c=0|n[4+(0|n[o>>2])>>2],n[e>>2]=n[c>>2],n[e+4>>2]=n[c+4>>2],n[e+8>>2]=n[c+8>>2],n[e+12>>2]=n[c+12>>2],0|X(26832,e))){if(0|KA(0|n[4+(0|n[o>>2])>>2],u,t)){w=25;break}if((0|n[(c=t)>>2])==(0|s)&&(0|n[c+4>>2])==(0|l)){w=29;break}}if(h){if(0|(c=0|$A(s,l,e))){w=32;break}if(0|ve(s,l,t,0)){w=36;break}if(f&&0|De(0|n[o>>2],0|n[p>>2],e,t)){w=42;break}if(g&&0|Qe(0|n[o>>2],0|n[p>>2],e,t)){w=42;break}}if(b){if(a=0|ve(s,l,e,1),c=0|n[p>>2],0|a){w=45;break}if(0|q(c,e)){if(AA(t,e),0|$(e,0|n[p>>2])){w=53;break}if(0|Me(0|n[o>>2],0|n[p>>2],d)){w=53;break}if(0|Qe(0|n[o>>2],0|n[p>>2],t,e)){w=53;break}}}}do{if((0|u)<(0|n[v>>2])){if(a=0|ve(s,l,e,1),c=0|n[p>>2],0|a){w=58;break e}if(!(0|q(c,e))){w=73;break}if(0|$(0|n[p>>2],e)&&(AA(t,e),0|De(0|n[o>>2],0|n[p>>2],t,e))){w=65;break e}if(0|(s=0|GA(s,l,u+1|0,t))){w=67;break e}s=0|n[(l=t)>>2],l=0|n[l+4>>2]}else w=73}while(0);if(73==(0|w)&&(w=0,s=0|xe(s,l),l=0|B()),!(0|s)&!(0|l)){x=p;break A}}switch(0|w){case 15:0|(a=0|n[p>>2])&&Ye(a),n[(w=A)>>2]=0,n[w+4>>2]=0,n[o>>2]=0,n[v>>2]=-1,n[y>>2]=0,n[p>>2]=0,n[A+8>>2]=c,w=20;break;case 19:n[A>>2]=s,n[A+4>>2]=l,w=20;break;case 25:M(27795,27761,470,27772);break;case 29:case 42:return n[A>>2]=s,n[A+4>>2]=l,void(S=i);case 32:return 0|(a=0|n[p>>2])&&Ye(a),n[(x=A)>>2]=0,n[x+4>>2]=0,n[o>>2]=0,n[v>>2]=-1,n[y>>2]=0,n[p>>2]=0,n[A+8>>2]=c,void(S=i);case 36:M(27795,27761,493,27772);break;case 45:0|c&&Ye(c),n[(w=A)>>2]=0,n[w+4>>2]=0,n[o>>2]=0,n[v>>2]=-1,n[y>>2]=0,n[p>>2]=0,n[A+8>>2]=a,w=55;break;case 53:n[A>>2]=s,n[A+4>>2]=l,w=55;break;case 58:0|c&&Ye(c),n[(w=A)>>2]=0,n[w+4>>2]=0,n[o>>2]=0,n[v>>2]=-1,n[y>>2]=0,n[p>>2]=0,n[A+8>>2]=a,w=71;break;case 65:n[A>>2]=s,n[A+4>>2]=l,w=71;break;case 67:return 0|(a=0|n[p>>2])&&Ye(a),n[(x=A)>>2]=0,n[x+4>>2]=0,n[o>>2]=0,n[v>>2]=-1,n[y>>2]=0,n[p>>2]=0,n[A+8>>2]=s,void(S=i)}if(20==(0|w))return void(S=i);if(55==(0|w))return void(S=i);if(71==(0|w))return void(S=i)}}while(0);0|(a=0|n[x>>2])&&Ye(a),n[(w=A)>>2]=0,n[w+4>>2]=0,n[A+8>>2]=0,n[o>>2]=0,n[A+12>>2]=-1,n[y>>2]=0,n[x>>2]=0,S=i}}function xe(A,e){var t,r=0,o=0,i=0,a=0,s=0,l=0,c=0,u=0,f=0;t=S,S=S+16|0,f=t,o=0|tt(0|(A|=0),0|(e|=0),52),B(),o&=15,r=0|tt(0|A,0|e,45),B();do{if(o){for(;r=0|rt(o+4095|0,0,52),i=B()|-15728641&e,r=r|A|(s=0|rt(7,0,0|(a=3*(15-o|0)|0))),i|=l=0|B(),c=0|tt(0|A,0|e,0|a),B(),o=o+-1|0,!((c&=7)>>>0<6);){if(!o){u=4;break}e=i,A=r}if(4==(0|u)){r=0|tt(0|r,0|i,45),B();break}return f=0|rt(((f=!(0|c)&!!(0|HA(r,i)))?2:1)+c|0,0,0|a),u=0|B()|e&~l,f|=A&~s,C(0|u),S=t,0|f}}while(0);return(r&=127)>>>0>120?(f=0,C(0|(u=0)),S=t,0|f):(IA(f,0,r+1|0,0),u=0|n[f+4>>2],f=0|n[f>>2],C(0|u),S=t,0|f)}function ye(A,e,t){A|=0;var r,i=0,a=0,s=0,l=0,c=0,u=0,f=0,d=0,g=0;if(!(0|X(e|=0,t|=0)))return 0;if(e=0|K(e),i=+o[t>>3],a=e&(a=+o[t+8>>3])<0?a+6.283185307179586:a,(0|(g=0|n[A>>2]))<=0)return 0;if(r=0|n[A+4>>2],e){e=0,d=a,t=-1,A=0;A:for(;;){for(f=A;l=+o[r+(f<<4)>>3],a=+o[r+(f<<4)+8>>3],s=+o[r+((A=(t+2|0)%(0|g)|0)<<4)>>3],c=+o[r+(A<<4)+8>>3],l>s?(u=l,l=c):(u=s,s=l,l=a,a=c),(i=i==s|i==u?i+2220446049250313e-31:i)u;){if((0|(t=f+1|0))>=(0|g)){t=22;break A}A=f,f=t,t=A}if(((u=(c=l<0?l+6.283185307179586:l)+(i-s)/(u-s)*((l=a<0?a+6.283185307179586:a)-c))<0?u+6.283185307179586:u)>(d=c==d|l==d?d+-2220446049250313e-31:d)&&(e^=1),(0|(A=f+1|0))>=(0|g)){t=22;break}t=f}if(22==(0|t))return 0|e}else{e=0,d=a,t=-1,A=0;A:for(;;){for(f=A;l=+o[r+(f<<4)>>3],a=+o[r+(f<<4)+8>>3],s=+o[r+((A=(t+2|0)%(0|g)|0)<<4)>>3],c=+o[r+(A<<4)+8>>3],l>s?(u=l,l=c):(u=s,s=l,l=a,a=c),(i=i==s|i==u?i+2220446049250313e-31:i)u;){if((0|(t=f+1|0))>=(0|g)){t=22;break A}A=f,f=t,t=A}if(l+(i-s)/(u-s)*(a-l)>(d=l==d|a==d?d+-2220446049250313e-31:d)&&(e^=1),(0|(A=f+1|0))>=(0|g)){t=22;break}t=f}if(22==(0|t))return 0|e}return 0}function ke(A,e){e|=0;var t,r,i,a,s,c=0,u=0,f=0,d=0,g=0,h=0,m=0,b=0,p=0,v=0,w=0,x=0;if(!(r=0|n[(A|=0)>>2]))return n[e>>2]=0,n[e+4>>2]=0,n[e+8>>2]=0,n[e+12>>2]=0,n[e+16>>2]=0,n[e+20>>2]=0,n[e+24>>2]=0,void(n[e+28>>2]=0);if(o[(i=e+8|0)>>3]=17976931348623157e292,o[(a=e+24|0)>>3]=17976931348623157e292,o[e>>3]=-17976931348623157e292,o[(s=e+16|0)>>3]=-17976931348623157e292,!((0|r)<=0)){for(t=0|n[A+4>>2],b=17976931348623157e292,p=-17976931348623157e292,v=0,A=-1,d=17976931348623157e292,g=17976931348623157e292,m=-17976931348623157e292,u=-17976931348623157e292,w=0;c=+o[t+(w<<4)>>3],h=+o[t+(w<<4)+8>>3],f=+o[t+(((0|(A=A+2|0))==(0|r)?0:A)<<4)+8>>3],c>3]=c,d=c),h>3]=h,g=h),c>m?o[e>>3]=c:c=m,h>u&&(o[s>>3]=h,u=h),b=h>0&hp?h:p,v|=+l(+(h-f))>3.141592653589793,(0|(A=w+1|0))!=(0|r);)x=w,m=c,w=A,A=x;v&&(o[s>>3]=p,o[a>>3]=b)}}function Ce(A){return 0|((A|=0)>>>0<4?0:15)}function Be(A,e){e|=0;var t,r=0,i=0,a=0,s=0,c=0,u=0,f=0,d=0,g=0,h=0,m=0,b=0,p=0,v=0,w=0,x=0,y=0,k=0,C=0,B=0,M=0;if(p=0|n[(A|=0)>>2]){if(o[(v=e+8|0)>>3]=17976931348623157e292,o[(w=e+24|0)>>3]=17976931348623157e292,o[e>>3]=-17976931348623157e292,o[(x=e+16|0)>>3]=-17976931348623157e292,(0|p)>0){for(a=0|n[A+4>>2],m=17976931348623157e292,b=-17976931348623157e292,i=0,r=-1,f=17976931348623157e292,d=17976931348623157e292,h=-17976931348623157e292,c=-17976931348623157e292,y=0;s=+o[a+(y<<4)>>3],g=+o[a+(y<<4)+8>>3],u=+o[a+(((0|(B=r+2|0))==(0|p)?0:B)<<4)+8>>3],s>3]=s,f=s),g>3]=g,d=g),s>h?o[e>>3]=s:s=h,g>c&&(o[x>>3]=g,c=g),m=g>0&gb?g:b,i|=+l(+(g-u))>3.141592653589793,(0|(r=y+1|0))!=(0|p);)B=y,h=s,y=r,r=B;i&&(o[x>>3]=b,o[w>>3]=m)}}else n[e>>2]=0,n[e+4>>2]=0,n[e+8>>2]=0,n[e+12>>2]=0,n[e+16>>2]=0,n[e+20>>2]=0,n[e+24>>2]=0,n[e+28>>2]=0;if(!((0|(r=0|n[(B=A+8|0)>>2]))<=0)){t=A+12|0,C=0;do{if(a=0|n[t>>2],i=C,w=e+((C=C+1|0)<<5)|0,x=0|n[a+(i<<3)>>2]){if(o[(y=e+(C<<5)+8|0)>>3]=17976931348623157e292,o[(A=e+(C<<5)+24|0)>>3]=17976931348623157e292,o[w>>3]=-17976931348623157e292,o[(k=e+(C<<5)+16|0)>>3]=-17976931348623157e292,(0|x)>0){for(p=0|n[a+(i<<3)+4>>2],m=17976931348623157e292,b=-17976931348623157e292,a=0,i=-1,v=0,f=17976931348623157e292,d=17976931348623157e292,g=-17976931348623157e292,c=-17976931348623157e292;s=+o[p+(v<<4)>>3],h=+o[p+(v<<4)+8>>3],u=+o[p+(((0|(i=i+2|0))==(0|x)?0:i)<<4)+8>>3],s>3]=s,f=s),h>3]=h,d=h),s>g?o[w>>3]=s:s=g,h>c&&(o[k>>3]=h,c=h),m=h>0&hb?h:b,a|=+l(+(h-u))>3.141592653589793,(0|(i=v+1|0))!=(0|x);)M=v,v=i,g=s,i=M;a&&(o[k>>3]=b,o[A>>3]=m)}}else n[w>>2]=0,n[w+4>>2]=0,n[w+8>>2]=0,n[w+12>>2]=0,n[w+16>>2]=0,n[w+20>>2]=0,n[w+24>>2]=0,n[w+28>>2]=0,r=0|n[B>>2]}while((0|C)<(0|r))}}function Me(A,e,t){var r=0,o=0,i=0;if(!(0|ye(A|=0,e|=0,t|=0)))return 0;if((0|n[(o=A+8|0)>>2])<=0)return 1;for(r=A+12|0,A=0;;){if(i=A,A=A+1|0,0|ye((0|n[r>>2])+(i<<3)|0,e+(A<<5)|0,t)){A=0,r=6;break}if((0|A)>=(0|n[o>>2])){A=1,r=6;break}}return 6==(0|r)?0|A:0}function De(A,e,t,r){r|=0;var o,i,a=0,s=0,l=0,c=0,u=0;if(i=S,S=S+16|0,o=i,!(0|ye(A|=0,e|=0,l=8+(t|=0)|0)))return S=i,0;c=A+8|0;A:do{if((0|n[c>>2])>0){for(s=A+12|0,a=0;;){if(u=a,a=a+1|0,0|ye((0|n[s>>2])+(u<<3)|0,e+(a<<5)|0,l)){a=0;break}if((0|a)>=(0|n[c>>2]))break A}return S=i,0|a}}while(0);if(0|Ee(A,e,t,r))return S=i,0;n[o>>2]=n[t>>2],n[o+4>>2]=l,a=0|n[c>>2];A:do{if((0|a)>0)for(A=A+12|0,l=0,s=a;;){if(a=0|n[A>>2],(0|n[a+(l<<3)>>2])>0){if(0|ye(o,r,0|n[a+(l<<3)+4>>2])){a=0;break A}if(a=l+1|0,0|Ee((0|n[A>>2])+(l<<3)|0,e+(a<<5)|0,t,r)){a=0;break A}s=0|n[c>>2]}else a=l+1|0;if(!((0|a)<(0|s))){a=1;break}l=a}else a=1}while(0);return S=i,0|a}function Ee(A,e,t,r){A|=0,t|=0;var i,a,s,l,c,u,f=0,d=0,g=0,h=0,m=0,b=0,p=0,v=0,w=0,x=0,y=0,k=0,C=0,B=0,M=0;if(u=S,S=S+176|0,l=u+172|0,f=u+168|0,c=u,!(0|q(e|=0,r|=0)))return S=u,0;if(function(A,e,t,r){var i,a,s,l,c;e|=0,t|=0,r|=0,A=(a=+o[16+(A|=0)>>3])<(c=+o[A+24>>3]),i=(l=+o[e+16>>3])<(s=+o[e+24>>3]),e=c-l>2]=A?i|e?1:2:0,n[r>>2]=i?A?1:e?2:1:0}(e,r,l,f),st(0|c,0|t,168),(0|n[t>>2])>0){e=0;do{y=+ie(+o[(B=c+8+(e<<4)+8|0)>>3],0|n[f>>2]),o[B>>3]=y,e=e+1|0}while((0|e)<(0|n[t>>2]))}a=+o[r>>3],s=+o[r+8>>3],y=+ie(+o[r+16>>3],0|n[f>>2]),i=+ie(+o[r+24>>3],0|n[f>>2]);A:do{if((0|n[A>>2])>0){if(r=A+4|0,(0|(f=0|n[c>>2]))<=0)for(e=0;;)if((0|(e=e+1|0))>=(0|n[A>>2])){e=0;break A}for(t=0;;){if(e=0|n[r>>2],w=+o[e+(t<<4)>>3],x=+ie(+o[e+(t<<4)+8>>3],0|n[l>>2]),e=0|n[r>>2],B=(0|(t=t+1|0))%(0|n[A>>2])|0,d=+o[e+(B<<4)>>3],g=+ie(+o[e+(B<<4)+8>>3],0|n[l>>2]),!(w>=a)|!(d>=a)&&!(w<=s)|!(d<=s)&&!(x<=i)|!(g<=i)&&!(x>=y)|!(g>=y)){v=d-w,b=g-x,e=0;do{if(M=e,B=(0|(e=e+1|0))==(0|f)?0:e,d=+o[c+8+(M<<4)+8>>3],g=+o[c+8+(B<<4)+8>>3]-d,h=+o[c+8+(M<<4)>>3],!(0==(p=v*g-b*(m=+o[c+8+(B<<4)>>3]-h))||(k=x-d,C=w-h,m=(k*m-g*C)/p,m<0|m>1))&&(p=(v*k-b*C)/p)>=0&p<=1){e=1;break A}}while((0|e)<(0|f))}if((0|t)>=(0|n[A>>2])){e=0;break}}}else e=0}while(0);return S=u,0|e}function Qe(A,e,t,r){var o=0,i=0,a=0;if(0|Ee(A|=0,e|=0,t|=0,r|=0))return 1;if((0|n[(i=A+8|0)>>2])<=0)return 0;for(o=A+12|0,A=0;;){if(a=A,A=A+1|0,0|Ee((0|n[o>>2])+(a<<3)|0,e+(A<<5)|0,t,r)){A=1,o=6;break}if((0|A)>=(0|n[i>>2])){A=0,o=6;break}}return 6==(0|o)?0|A:0}function je(A,e,t,r,n){e|=0,t|=0,r|=0,n|=0;var i,a,s,l,c,u,f,d=0;l=+o[(A|=0)>>3],s=+o[e>>3]-l,a=+o[A+8>>3],i=+o[e+8>>3]-a,u=+o[t>>3],d=((d=+o[r>>3]-u)*(a-(f=+o[t+8>>3]))-(l-u)*(c=+o[r+8>>3]-f))/(s*c-i*d),o[n>>3]=l+s*d,o[n+8>>3]=a+i*d}function Ne(A,e){return e|=0,+l(+(+o[(A|=0)>>3]-+o[e>>3]))<1.1920928955078125e-7?0|(e=+l(+(+o[A+8>>3]-+o[e+8>>3]))<1.1920928955078125e-7):0|(e=0)}function Se(A,e){var t,r,n;return e|=0,+((n=+o[(A|=0)>>3]-+o[e>>3])*n+(r=+o[A+8>>3]-+o[e+8>>3])*r+(t=+o[A+16>>3]-+o[e+16>>3])*t)}function Fe(A,e,t){t|=0;var r,o,i,a,s=0,l=0,c=0,u=0;if(a=S,S=S+32|0,u=a,0|(s=0|XA(A|=0,e|=0,o=a+16|0)))return S=a,0|s;r=0|TA(A,e),i=0|OA(A,e),function(A,e){A=7696+(28*(A|=0)|0)|0,n[(e|=0)>>2]=n[A>>2],n[e+4>>2]=n[A+4>>2],n[e+8>>2]=n[A+8>>2],n[e+12>>2]=n[A+12>>2]}(r,u),s=0|function(A,e){A|=0;var t=0,r=0;if((e|=0)>>>0>20)return-1;do{if((0|n[11120+(216*e|0)>>2])!=(0|A))if((0|n[11120+(216*e|0)+8>>2])!=(0|A))if((0|n[11120+(216*e|0)+16>>2])!=(0|A))if((0|n[11120+(216*e|0)+24>>2])!=(0|A))if((0|n[11120+(216*e|0)+32>>2])!=(0|A))if((0|n[11120+(216*e|0)+40>>2])!=(0|A))if((0|n[11120+(216*e|0)+48>>2])!=(0|A))if((0|n[11120+(216*e|0)+56>>2])!=(0|A))if((0|n[11120+(216*e|0)+64>>2])!=(0|A))if((0|n[11120+(216*e|0)+72>>2])!=(0|A))if((0|n[11120+(216*e|0)+80>>2])!=(0|A))if((0|n[11120+(216*e|0)+88>>2])!=(0|A))if((0|n[11120+(216*e|0)+96>>2])!=(0|A))if((0|n[11120+(216*e|0)+104>>2])!=(0|A))if((0|n[11120+(216*e|0)+112>>2])!=(0|A))if((0|n[11120+(216*e|0)+120>>2])!=(0|A))if((0|n[11120+(216*e|0)+128>>2])!=(0|A)){if((0|n[11120+(216*e|0)+136>>2])!=(0|A)){if((0|n[11120+(216*e|0)+144>>2])==(0|A)){A=0,t=2,r=0;break}if((0|n[11120+(216*e|0)+152>>2])==(0|A)){A=0,t=2,r=1;break}if((0|n[11120+(216*e|0)+160>>2])==(0|A)){A=0,t=2,r=2;break}if((0|n[11120+(216*e|0)+168>>2])==(0|A)){A=1,t=2,r=0;break}if((0|n[11120+(216*e|0)+176>>2])==(0|A)){A=1,t=2,r=1;break}if((0|n[11120+(216*e|0)+184>>2])==(0|A)){A=1,t=2,r=2;break}if((0|n[11120+(216*e|0)+192>>2])==(0|A)){A=2,t=2,r=0;break}if((0|n[11120+(216*e|0)+200>>2])==(0|A)){A=2,t=2,r=1;break}if((0|n[11120+(216*e|0)+208>>2])==(0|A)){A=2,t=2,r=2;break}return-1}A=2,t=1,r=2}else A=2,t=1,r=1;else A=2,t=1,r=0;else A=1,t=1,r=2;else A=1,t=1,r=1;else A=1,t=1,r=0;else A=0,t=1,r=2;else A=0,t=1,r=1;else A=0,t=1,r=0;else A=2,t=0,r=2;else A=2,t=0,r=1;else A=2,t=0,r=0;else A=1,t=0,r=2;else A=1,t=0,r=1;else A=1,t=0,r=0;else A=0,t=0,r=2;else A=0,t=0,r=1;else A=0,t=0,r=0}while(0);return 0|n[11120+(216*e|0)+(72*t|0)+(24*A|0)+(r<<3)+4>>2]}(r,0|n[o>>2]);do{if(0|z(r)){switch(0|r){case 4:l=0;break;case 14:l=1;break;case 24:l=2;break;case 38:l=3;break;case 49:l=4;break;case 58:l=5;break;case 63:l=6;break;case 72:l=7;break;case 83:l=8;break;case 97:l=9;break;case 107:l=10;break;case 117:l=11;break;default:M(27795,27797,75,27806)}if(c=0|n[26416+(24*l|0)+8>>2],e=0|n[26416+(24*l|0)+16>>2],(0|(A=0|n[o>>2]))!=(0|n[u>>2])&&(u=0|G(r))|(0|(A=0|n[o>>2]))==(0|e)&&(s=(s+1|0)%6|0),3==(0|i)&(0|A)==(0|e)){s=(s+5|0)%6|0;break}5==(0|i)&(0|A)==(0|c)&&(s=(s+1|0)%6|0)}}while(0);return n[t>>2]=s,S=a,0}function Pe(A,e,t,r){t|=0,r|=0;var o,i,a,s,l,c=0,u=0,f=0,d=0,g=0,h=0,m=0,b=0,p=0,v=0,w=0;if(l=S,S=S+32|0,w=l+24|0,s=l+20|0,a=l+8|0,i=l+16|0,o=l,g=(g=!(0|HA(A|=0,e|=0)))?6:5,m=0|tt(0|A,0|e,52),B(),g>>>0<=t>>>0)return S=l,2;!(b=!(0|(m&=15)))&&!((p=0|rt(7,0,3*(15^m)|0))&A)&!((0|B())&e)?c=t:u=4;A:do{if(4==(0|u)){if((0|((c=!!(0|HA(A,e)))?4:5))<(0|t))return S=l,1;if(0|Fe(A,e,w))return S=l,1;if(u=(0|n[w>>2])+t|0,7==(0|(p=0|n[(c=c?26704+((0|u)%5<<2)|0:26736+((0|u)%6<<2)|0)>>2])))return S=l,1;n[s>>2]=0,c=0|I(A,e,p,s,a);do{if(!c){if(h=0|n[(d=a)>>2],u=(f=(d=0|n[d+4>>2])>>>0>>0|(0|d)==(0|e)&h>>>0>>0)?h:A,f=f?d:e,!b&&!(h&(b=0|rt(7,0,3*(15^m)|0)))&!(d&(0|B())))c=t;else{if(d=(t+-1+g|0)%(0|g)|0,c=0|HA(A,e),(0|d)<0&&M(27795,27797,248,27822),(0|((g=!!(0|c))?4:5))<(0|d)&&M(27795,27797,248,27822),0|Fe(A,e,w)&&M(27795,27797,248,27822),c=(0|n[w>>2])+d|0,7==(0|(d=0|n[(c=g?26704+((0|c)%5<<2)|0:26736+((0|c)%6<<2)|0)>>2]))&&M(27795,27797,248,27822),n[i>>2]=0,0|(c=0|I(A,e,d,i,o)))break;g=0|n[(h=o)>>2],h=0|n[h+4>>2];do{if(h>>>0>>0|(0|h)==(0|f)&g>>>0>>0){if(u=0|HA(g,h)?0|_(g,h,A,e):0|n[26800+(((0|n[i>>2])+(0|n[26768+(d<<2)>>2])|0)%6<<2)>>2],c=0|HA(g,h),(u+-1|0)>>>0>5){c=-1,u=g,f=h;break}if(1==(0|u)&(c=!!(0|c))){c=-1,u=g,f=h;break}do{if(!(0|Fe(g,h,w))){if(c){c=(5+(0|n[26352+(u<<2)>>2])-(0|n[w>>2])|0)%5|0;break}c=(6+(0|n[26384+(u<<2)>>2])-(0|n[w>>2])|0)%6|0;break}c=-1}while(0);u=g,f=h}else c=t}while(0);h=0|n[(d=a)>>2],d=0|n[d+4>>2]}if((0|u)==(0|h)&(0|f)==(0|d)){if(A=(g=!!(0|HA(h,d)))?0|_(h,d,A,e):0|n[26800+(((0|n[s>>2])+(0|n[26768+(p<<2)>>2])|0)%6<<2)>>2],c=0|HA(h,d),(A+-1|0)>>>0<=5&&!(1==(0|A)&(v=!!(0|c))))do{if(!(0|Fe(h,d,w))){if(v){c=(5+(0|n[26352+(A<<2)>>2])-(0|n[w>>2])|0)%5|0;break}c=(6+(0|n[26384+(A<<2)>>2])-(0|n[w>>2])|0)%6|0;break}c=-1}while(0);else c=-1;c=6==(0|(c=c+1|0))|g&5==(0|c)?0:c}e=f,A=u;break A}}while(0);return S=l,0|c}}while(0);return v=0|rt(0|c,0,56),w=B()|-2130706433&e|536870912,n[r>>2]=v|A,n[r+4>>2]=w,S=l,0}function Te(A,e){A|=0;var t,r,o=0,i=0;return r=S,S=S+16|0,t=r,!0&536870912==(2013265920&(e|=0))&&0|LA(A,o=-2130706433&e|134217728)?(i=0|tt(0|A,0|e,56),B(),o=(i=!(0|Pe(A,o,7&i,t)))&((0|n[(o=t)>>2])==(0|A)?(0|n[o+4>>2])==(0|e):0)&1,S=r,0|o):(S=r,0|(o=0))}function Le(A,e,t){A|=0,t|=0;var r=0;(0|(e|=0))>0?(r=0|We(e,4),n[A>>2]=r,r||M(27835,27858,40,27872)):n[A>>2]=0,n[A+4>>2]=e,n[A+8>>2]=0,n[A+12>>2]=t}function Ie(A){var e,t,r,i=0,a=0,s=0,c=0;e=4+(A|=0)|0,t=A+12|0,r=A+8|0;A:for(;;){for(a=0|n[e>>2],i=0;;){if((0|i)>=(0|a))break A;if(s=0|n[A>>2],c=0|n[s+(i<<2)>>2])break;i=i+1|0}i=s+(~~(+l(+ +u(10,+ +(15-(0|n[t>>2])|0))*(+o[c>>3]+ +o[c+8>>3]))%+(0|a))>>>0<<2)|0,a=0|n[i>>2];e:do{if(0|a){if(s=c+32|0,(0|a)==(0|c))n[i>>2]=n[s>>2];else{if(!(i=0|n[(a=a+32|0)>>2]))break;for(;(0|i)!=(0|c);)if(!(i=0|n[(a=i+32|0)>>2]))break e;n[a>>2]=n[s>>2]}Ye(c),n[r>>2]=(0|n[r>>2])-1}}while(0)}Ye(0|n[A>>2])}function Re(A){var e,t=0,r=0;for(e=0|n[4+(A|=0)>>2],r=0;;){if((0|r)>=(0|e)){t=0,r=4;break}if(t=0|n[(0|n[A>>2])+(r<<2)>>2]){r=4;break}r=r+1|0}return 4==(0|r)?0|t:0}function _e(A,e){e|=0;var t=0,r=0,i=0,a=0;if(t=~~(+l(+ +u(10,+ +(15-(0|n[12+(A|=0)>>2])|0))*(+o[e>>3]+ +o[e+8>>3]))%+(0|n[A+4>>2]))>>>0,t=(0|n[A>>2])+(t<<2)|0,!(r=0|n[t>>2]))return 1;a=e+32|0;do{if((0|r)!=(0|e)){if(!(t=0|n[r+32>>2]))return 1;for(i=t;;){if((0|i)==(0|e)){i=8;break}if(!(t=0|n[i+32>>2])){t=1,i=10;break}r=i,i=t}if(8==(0|i)){n[r+32>>2]=n[a>>2];break}if(10==(0|i))return 0|t}else n[t>>2]=n[a>>2]}while(0);return Ye(e),n[(a=A+8|0)>>2]=(0|n[a>>2])-1,0}function He(A,e,t){A|=0,e|=0,t|=0;var r,i=0,a=0,s=0;(r=0|Ue(40))||M(27888,27858,98,27901),n[r>>2]=n[e>>2],n[r+4>>2]=n[e+4>>2],n[r+8>>2]=n[e+8>>2],n[r+12>>2]=n[e+12>>2],n[(a=r+16|0)>>2]=n[t>>2],n[a+4>>2]=n[t+4>>2],n[a+8>>2]=n[t+8>>2],n[a+12>>2]=n[t+12>>2],n[r+32>>2]=0,a=~~(+l(+ +u(10,+ +(15-(0|n[A+12>>2])|0))*(+o[e>>3]+ +o[e+8>>3]))%+(0|n[A+4>>2]))>>>0,a=(0|n[A>>2])+(a<<2)|0,i=0|n[a>>2];do{if(i){for(;!(0|oe(i,e)&&0|oe(i+16|0,t));)if(a=0|n[i+32>>2],!(0|n[(i=0|a?a:i)+32>>2])){s=10;break}if(10==(0|s)){n[i+32>>2]=r;break}return Ye(r),0|i}n[a>>2]=r}while(0);return n[(s=A+8|0)>>2]=1+(0|n[s>>2]),0|r}function ze(A,e,t){e|=0,t|=0;var r=0,i=0;if(i=~~(+l(+ +u(10,+ +(15-(0|n[12+(A|=0)>>2])|0))*(+o[e>>3]+ +o[e+8>>3]))%+(0|n[A+4>>2]))>>>0,!(i=0|n[(0|n[A>>2])+(i<<2)>>2]))return 0;if(!t){for(A=i;;){if(0|oe(A,e)){r=10;break}if(!(A=0|n[A+32>>2])){A=0,r=10;break}}if(10==(0|r))return 0|A}for(A=i;;){if(0|oe(A,e)&&0|oe(A+16|0,t)){r=10;break}if(!(A=0|n[A+32>>2])){A=0,r=10;break}}return 10==(0|r)?0|A:0}function Ge(A,e){e|=0;var t=0;if(t=~~(+l(+ +u(10,+ +(15-(0|n[12+(A|=0)>>2])|0))*(+o[e>>3]+ +o[e+8>>3]))%+(0|n[A+4>>2]))>>>0,!(A=0|n[(0|n[A>>2])+(t<<2)>>2]))return 0;for(;;){if(0|oe(A,e)){e=5;break}if(!(A=0|n[A+32>>2])){A=0,e=5;break}}return 5==(0|e)?0|A:0}function Oe(A){return 0|+ct(+(A=+A))}function Ue(A){A|=0;var e,t=0,r=0,o=0,i=0,a=0,s=0,l=0,c=0,u=0,f=0,d=0,g=0,h=0,m=0,b=0,p=0,v=0,w=0,x=0,y=0;e=S,S=S+16|0,g=e;do{if(A>>>0<245){if(A=(u=A>>>0<11?16:A+11&-8)>>>3,3&(r=(d=0|n[6981])>>>A))return o=0|n[(r=8+(A=27964+((t=(1&r^1)+A|0)<<1<<2)|0)|0)>>2],(0|(a=0|n[(i=o+8|0)>>2]))==(0|A)?n[6981]=d&~(1<>2]=A,n[r>>2]=a),y=t<<3,n[o+4>>2]=3|y,n[(y=o+y+4|0)>>2]=1|n[y>>2],S=e,0|i;if(u>>>0>(f=0|n[6983])>>>0){if(0|r)return t=((t=r<>>=l=t>>>12&16)>>>5&8)|l|(a=(t>>>=r)>>>2&4)|(A=(t>>>=a)>>>1&2)|(o=(t>>>=A)>>>1&1))+(t>>>o)|0)<<1<<2)|0)|0)>>2],(0|(r=0|n[(l=a+8|0)>>2]))==(0|t)?(A=d&~(1<>2]=t,n[A>>2]=r,A=d),s=(y=o<<3)-u|0,n[a+4>>2]=3|u,n[4+(i=a+u|0)>>2]=1|s,n[a+y>>2]=s,0|f&&(o=0|n[6986],r=27964+((t=f>>>3)<<1<<2)|0,A&(t=1<>2]:(n[6981]=A|t,t=r,A=r+8|0),n[A>>2]=o,n[t+12>>2]=o,n[o+8>>2]=t,n[o+12>>2]=r),n[6983]=s,n[6986]=i,S=e,0|l;if(a=0|n[6982]){for(r=(a&0-a)-1|0,r=c=0|n[28228+(((o=(r>>>=i=r>>>12&16)>>>5&8)|i|(s=(r>>>=o)>>>2&4)|(l=(r>>>=s)>>>1&2)|(c=(r>>>=l)>>>1&1))+(r>>>c)<<2)>>2],l=c,c=(-8&n[c+4>>2])-u|0;(A=0|n[r+16>>2])||(A=0|n[r+20>>2]);)r=A,l=(i=(s=(-8&n[A+4>>2])-u|0)>>>0>>0)?A:l,c=i?s:c;if((s=l+u|0)>>>0>l>>>0){i=0|n[l+24>>2],t=0|n[l+12>>2];do{if((0|t)==(0|l)){if(!(t=0|n[(A=l+20|0)>>2])&&!(t=0|n[(A=l+16|0)>>2])){r=0;break}for(;;)if(r=0|n[(o=t+20|0)>>2])t=r,A=o;else{if(!(r=0|n[(o=t+16|0)>>2]))break;t=r,A=o}n[A>>2]=0,r=t}else r=0|n[l+8>>2],n[r+12>>2]=t,n[t+8>>2]=r,r=t}while(0);do{if(0|i){if(t=0|n[l+28>>2],(0|l)==(0|n[(A=28228+(t<<2)|0)>>2])){if(n[A>>2]=r,!r){n[6982]=a&~(1<>2])==(0|l)?y:i+20)>>2]=r,!r)break;n[r+24>>2]=i,0|(t=0|n[l+16>>2])&&(n[r+16>>2]=t,n[t+24>>2]=r),0|(t=0|n[l+20>>2])&&(n[r+20>>2]=t,n[t+24>>2]=r)}}while(0);return c>>>0<16?(y=c+u|0,n[l+4>>2]=3|y,n[(y=l+y+4|0)>>2]=1|n[y>>2]):(n[l+4>>2]=3|u,n[s+4>>2]=1|c,n[s+c>>2]=c,0|f&&(o=0|n[6986],r=27964+((t=f>>>3)<<1<<2)|0,(t=1<>2]:(n[6981]=t|d,t=r,A=r+8|0),n[A>>2]=o,n[t+12>>2]=o,n[o+8>>2]=t,n[o+12>>2]=r),n[6983]=c,n[6986]=s),S=e,0|l+8}d=u}else d=u}else d=u}else if(A>>>0<=4294967231)if(u=-8&(A=A+11|0),o=0|n[6982]){i=0-u|0,c=(A>>>=8)?u>>>0>16777215?31:u>>>(7+(c=14-((l=(520192+(b=A<<(d=(A+1048320|0)>>>16&8))|0)>>>16&4)|d|(c=(245760+(b<<=l)|0)>>>16&2))+(b<>>15)|0)|0)&1|c<<1:0,r=0|n[28228+(c<<2)>>2];A:do{if(r)for(A=0,l=u<<(31==(0|c)?0:25-(c>>>1)|0),a=0;;){if((s=(-8&n[r+4>>2])-u|0)>>>0>>0){if(!s){A=r,i=0,b=65;break A}A=r,i=s}if(a=!(0|(b=0|n[r+20>>2]))|(0|b)==(0|(r=0|n[r+16+(l>>>31<<2)>>2]))?a:b,!r){r=a,b=61;break}l<<=1}else r=0,A=0,b=61}while(0);if(61==(0|b)){if(!(0|r)&!(0|A)){if(!(A=((A=2<>>=s=d>>>12&16)>>>5&8)|s|(l=(d>>>=a)>>>2&4)|(c=(d>>>=l)>>>1&2)|(r=(d>>>=c)>>>1&1))+(d>>>r)<<2)>>2]}r?b=65:(l=A,s=i)}if(65==(0|b))for(a=r;;){if(i=(r=(d=(-8&n[a+4>>2])-u|0)>>>0>>0)?d:i,A=r?a:A,(r=0|n[a+16>>2])||(r=0|n[a+20>>2]),!r){l=A,s=i;break}a=r}if(0|l&&s>>>0<((0|n[6983])-u|0)>>>0&&(f=l+u|0)>>>0>l>>>0){a=0|n[l+24>>2],t=0|n[l+12>>2];do{if((0|t)==(0|l)){if(!(t=0|n[(A=l+20|0)>>2])&&!(t=0|n[(A=l+16|0)>>2])){t=0;break}for(;;)if(r=0|n[(i=t+20|0)>>2])t=r,A=i;else{if(!(r=0|n[(i=t+16|0)>>2]))break;t=r,A=i}n[A>>2]=0}else y=0|n[l+8>>2],n[y+12>>2]=t,n[t+8>>2]=y}while(0);do{if(a){if(A=0|n[l+28>>2],(0|l)==(0|n[(r=28228+(A<<2)|0)>>2])){if(n[r>>2]=t,!t){o&=~(1<>2])==(0|l)?y:a+20)>>2]=t,!t)break;n[t+24>>2]=a,0|(A=0|n[l+16>>2])&&(n[t+16>>2]=A,n[A+24>>2]=t),(A=0|n[l+20>>2])&&(n[t+20>>2]=A,n[A+24>>2]=t)}}while(0);A:do{if(s>>>0<16)y=s+u|0,n[l+4>>2]=3|y,n[(y=l+y+4|0)>>2]=1|n[y>>2];else{if(n[l+4>>2]=3|u,n[f+4>>2]=1|s,n[f+s>>2]=s,t=s>>>3,s>>>0<256){r=27964+(t<<1<<2)|0,(A=0|n[6981])&(t=1<>2]:(n[6981]=A|t,t=r,A=r+8|0),n[A>>2]=f,n[t+12>>2]=f,n[f+8>>2]=t,n[f+12>>2]=r;break}if(t=28228+((r=(t=s>>>8)?s>>>0>16777215?31:s>>>(7+(r=14-((w=(520192+(y=t<<(x=(t+1048320|0)>>>16&8))|0)>>>16&4)|x|(r=(245760+(y<<=w)|0)>>>16&2))+(y<>>15)|0)|0)&1|r<<1:0)<<2)|0,n[f+28>>2]=r,n[4+(A=f+16|0)>>2]=0,n[A>>2]=0,!(o&(A=1<>2]=f,n[f+24>>2]=t,n[f+12>>2]=f,n[f+8>>2]=f;break}t=0|n[t>>2];e:do{if((-8&n[t+4>>2])!=(0|s)){for(o=s<<(31==(0|r)?0:25-(r>>>1)|0);A=0|n[(r=t+16+(o>>>31<<2)|0)>>2];){if((-8&n[A+4>>2])==(0|s)){t=A;break e}o<<=1,t=A}n[r>>2]=f,n[f+24>>2]=t,n[f+12>>2]=f,n[f+8>>2]=f;break A}}while(0);y=0|n[(x=t+8|0)>>2],n[y+12>>2]=f,n[x>>2]=f,n[f+8>>2]=y,n[f+12>>2]=t,n[f+24>>2]=0}}while(0);return S=e,0|l+8}d=u}else d=u;else d=-1}while(0);if((r=0|n[6983])>>>0>=d>>>0)return t=r-d|0,A=0|n[6986],t>>>0>15?(y=A+d|0,n[6986]=y,n[6983]=t,n[y+4>>2]=1|t,n[A+r>>2]=t,n[A+4>>2]=3|d):(n[6983]=0,n[6986]=0,n[A+4>>2]=3|r,n[(y=A+r+4|0)>>2]=1|n[y>>2]),S=e,0|A+8;if((s=0|n[6984])>>>0>d>>>0)return w=s-d|0,n[6984]=w,x=(y=0|n[6987])+d|0,n[6987]=x,n[x+4>>2]=1|w,n[y+4>>2]=3|d,S=e,0|y+8;if(0|n[7099]?A=0|n[7101]:(n[7101]=4096,n[7100]=4096,n[7102]=-1,n[7103]=-1,n[7104]=0,n[7092]=0,n[7099]=-16&g^1431655768,A=4096),l=d+48|0,(u=(a=A+(c=d+47|0)|0)&(i=0-A|0))>>>0<=d>>>0)return S=e,0;if(0|(A=0|n[7091])&&(g=(f=0|n[7089])+u|0)>>>0<=f>>>0|g>>>0>A>>>0)return S=e,0;A:do{if(4&n[7092])t=0,b=143;else{r=0|n[6987];e:do{if(r){for(o=28372;!((g=0|n[o>>2])>>>0<=r>>>0&&(g+(0|n[o+4>>2])|0)>>>0>r>>>0);){if(!(A=0|n[o+8>>2])){b=128;break e}o=A}if((t=a-s&i)>>>0<2147483647)if((0|(A=0|ut(0|t)))==((0|n[o>>2])+(0|n[o+4>>2])|0)){if(-1!=(0|A)){s=t,a=A,b=145;break A}}else o=A,b=136;else t=0}else b=128}while(0);do{if(128==(0|b))if(-1!=(0|(r=0|ut(0)))&&(t=r,m=(t=((m=(h=0|n[7100])-1|0)&t?(m+t&0-h)-t|0:0)+u|0)+(h=0|n[7089])|0,t>>>0>d>>>0&t>>>0<2147483647)){if(0|(g=0|n[7091])&&m>>>0<=h>>>0|m>>>0>g>>>0){t=0;break}if((0|(A=0|ut(0|t)))==(0|r)){s=t,a=r,b=145;break A}o=A,b=136}else t=0}while(0);do{if(136==(0|b)){if(r=0-t|0,!(l>>>0>t>>>0&t>>>0<2147483647&-1!=(0|o))){if(-1==(0|o)){t=0;break}s=t,a=o,b=145;break A}if((A=c-t+(A=0|n[7101])&0-A)>>>0>=2147483647){s=t,a=o,b=145;break A}if(-1==(0|ut(0|A))){ut(0|r),t=0;break}s=A+t|0,a=o,b=145;break A}}while(0);n[7092]=4|n[7092],b=143}}while(0);if(143==(0|b)&&u>>>0<2147483647&&!(-1==(0|(w=0|ut(0|u)))|1^(v=(p=(m=0|ut(0))-w|0)>>>0>(d+40|0)>>>0)|w>>>0>>0&-1!=(0|w)&-1!=(0|m)^1)&&(s=v?p:t,a=w,b=145),145==(0|b)){t=(0|n[7089])+s|0,n[7089]=t,t>>>0>(0|n[7090])>>>0&&(n[7090]=t),c=0|n[6987];A:do{if(c){for(t=28372;;){if((0|a)==((A=0|n[t>>2])+(r=0|n[t+4>>2])|0)){b=154;break}if(!(o=0|n[t+8>>2]))break;t=o}if(!(154!=(0|b)||(x=t+4|0,8&n[t+12>>2]))&&a>>>0>c>>>0&A>>>0<=c>>>0){n[x>>2]=r+s,x=c+(w=7&(w=c+8|0)?0-w&7:0)|0,w=(y=(0|n[6984])+s|0)-w|0,n[6987]=x,n[6984]=w,n[x+4>>2]=1|w,n[c+y+4>>2]=40,n[6988]=n[7103];break}for(a>>>0<(0|n[6985])>>>0&&(n[6985]=a),r=a+s|0,t=28372;;){if((0|n[t>>2])==(0|r)){b=162;break}if(!(A=0|n[t+8>>2]))break;t=A}if(162==(0|b)&&!(8&n[t+12>>2])){n[t>>2]=a,n[(f=t+4|0)>>2]=(0|n[f>>2])+s,u=(f=a+(7&(f=a+8|0)?0-f&7:0)|0)+d|0,l=(t=r+(7&(t=r+8|0)?0-t&7:0)|0)-f-d|0,n[f+4>>2]=3|d;e:do{if((0|c)==(0|t))y=(0|n[6984])+l|0,n[6984]=y,n[6987]=u,n[u+4>>2]=1|y;else{if((0|n[6986])==(0|t)){y=(0|n[6983])+l|0,n[6983]=y,n[6986]=u,n[u+4>>2]=1|y,n[u+y>>2]=y;break}if(1==(3&(A=0|n[t+4>>2]))){s=-8&A,o=A>>>3;t:do{if(A>>>0<256){if(A=0|n[t+8>>2],(0|(r=0|n[t+12>>2]))==(0|A)){n[6981]=n[6981]&~(1<>2]=r,n[r+8>>2]=A;break}a=0|n[t+24>>2],A=0|n[t+12>>2];do{if((0|A)==(0|t)){if(A=0|n[(o=4+(r=t+16|0)|0)>>2])r=o;else if(!(A=0|n[r>>2])){A=0;break}for(;;)if(o=0|n[(i=A+20|0)>>2])A=o,r=i;else{if(!(o=0|n[(i=A+16|0)>>2]))break;A=o,r=i}n[r>>2]=0}else y=0|n[t+8>>2],n[y+12>>2]=A,n[A+8>>2]=y}while(0);if(!a)break;o=28228+((r=0|n[t+28>>2])<<2)|0;do{if((0|n[o>>2])==(0|t)){if(n[o>>2]=A,0|A)break;n[6982]=n[6982]&~(1<>2])==(0|t)?y:a+20)>>2]=A,!A)break t}while(0);if(n[A+24>>2]=a,0|(o=0|n[(r=t+16|0)>>2])&&(n[A+16>>2]=o,n[o+24>>2]=A),!(r=0|n[r+4>>2]))break;n[A+20>>2]=r,n[r+24>>2]=A}while(0);t=t+s|0,i=s+l|0}else i=l;if(n[(t=t+4|0)>>2]=-2&n[t>>2],n[u+4>>2]=1|i,n[u+i>>2]=i,t=i>>>3,i>>>0<256){r=27964+(t<<1<<2)|0,(A=0|n[6981])&(t=1<>2]:(n[6981]=A|t,t=r,A=r+8|0),n[A>>2]=u,n[t+12>>2]=u,n[u+8>>2]=t,n[u+12>>2]=r;break}t=i>>>8;do{if(t){if(i>>>0>16777215){o=31;break}o=i>>>(7+(o=14-((w=(520192+(y=t<<(x=(t+1048320|0)>>>16&8))|0)>>>16&4)|x|(o=(245760+(y<<=w)|0)>>>16&2))+(y<>>15)|0)|0)&1|o<<1}else o=0}while(0);if(t=28228+(o<<2)|0,n[u+28>>2]=o,n[4+(A=u+16|0)>>2]=0,n[A>>2]=0,!((A=0|n[6982])&(r=1<>2]=u,n[u+24>>2]=t,n[u+12>>2]=u,n[u+8>>2]=u;break}t=0|n[t>>2];t:do{if((-8&n[t+4>>2])!=(0|i)){for(o=i<<(31==(0|o)?0:25-(o>>>1)|0);A=0|n[(r=t+16+(o>>>31<<2)|0)>>2];){if((-8&n[A+4>>2])==(0|i)){t=A;break t}o<<=1,t=A}n[r>>2]=u,n[u+24>>2]=t,n[u+12>>2]=u,n[u+8>>2]=u;break e}}while(0);y=0|n[(x=t+8|0)>>2],n[y+12>>2]=u,n[x>>2]=u,n[u+8>>2]=y,n[u+12>>2]=t,n[u+24>>2]=0}}while(0);return S=e,0|f+8}for(t=28372;!((A=0|n[t>>2])>>>0<=c>>>0&&(y=A+(0|n[t+4>>2])|0)>>>0>c>>>0);)t=0|n[t+8>>2];t=(A=(A=(i=y+-47|0)+(7&(A=i+8|0)?0-A&7:0)|0)>>>0<(i=c+16|0)>>>0?c:A)+8|0,x=a+(w=7&(w=a+8|0)?0-w&7:0)|0,w=(r=s+-40|0)-w|0,n[6987]=x,n[6984]=w,n[x+4>>2]=1|w,n[a+r+4>>2]=40,n[6988]=n[7103],n[(r=A+4|0)>>2]=27,n[t>>2]=n[7093],n[t+4>>2]=n[7094],n[t+8>>2]=n[7095],n[t+12>>2]=n[7096],n[7093]=a,n[7094]=s,n[7096]=0,n[7095]=t,t=A+24|0;do{x=t,n[(t=t+4|0)>>2]=7}while((x+8|0)>>>0>>0);if((0|A)!=(0|c)){if(a=A-c|0,n[r>>2]=-2&n[r>>2],n[c+4>>2]=1|a,n[A>>2]=a,t=a>>>3,a>>>0<256){r=27964+(t<<1<<2)|0,(A=0|n[6981])&(t=1<>2]:(n[6981]=A|t,t=r,A=r+8|0),n[A>>2]=c,n[t+12>>2]=c,n[c+8>>2]=t,n[c+12>>2]=r;break}if(r=28228+((o=(t=a>>>8)?a>>>0>16777215?31:a>>>(7+(o=14-((w=(520192+(y=t<<(x=(t+1048320|0)>>>16&8))|0)>>>16&4)|x|(o=(245760+(y<<=w)|0)>>>16&2))+(y<>>15)|0)|0)&1|o<<1:0)<<2)|0,n[c+28>>2]=o,n[c+20>>2]=0,n[i>>2]=0,!((t=0|n[6982])&(A=1<>2]=c,n[c+24>>2]=r,n[c+12>>2]=c,n[c+8>>2]=c;break}t=0|n[r>>2];e:do{if((-8&n[t+4>>2])!=(0|a)){for(o=a<<(31==(0|o)?0:25-(o>>>1)|0);A=0|n[(r=t+16+(o>>>31<<2)|0)>>2];){if((-8&n[A+4>>2])==(0|a)){t=A;break e}o<<=1,t=A}n[r>>2]=c,n[c+24>>2]=t,n[c+12>>2]=c,n[c+8>>2]=c;break A}}while(0);y=0|n[(x=t+8|0)>>2],n[y+12>>2]=c,n[x>>2]=c,n[c+8>>2]=y,n[c+12>>2]=t,n[c+24>>2]=0}}else!(0|(y=0|n[6985]))|a>>>0>>0&&(n[6985]=a),n[7093]=a,n[7094]=s,n[7096]=0,n[6990]=n[7099],n[6989]=-1,n[6994]=27964,n[6993]=27964,n[6996]=27972,n[6995]=27972,n[6998]=27980,n[6997]=27980,n[7e3]=27988,n[6999]=27988,n[7002]=27996,n[7001]=27996,n[7004]=28004,n[7003]=28004,n[7006]=28012,n[7005]=28012,n[7008]=28020,n[7007]=28020,n[7010]=28028,n[7009]=28028,n[7012]=28036,n[7011]=28036,n[7014]=28044,n[7013]=28044,n[7016]=28052,n[7015]=28052,n[7018]=28060,n[7017]=28060,n[7020]=28068,n[7019]=28068,n[7022]=28076,n[7021]=28076,n[7024]=28084,n[7023]=28084,n[7026]=28092,n[7025]=28092,n[7028]=28100,n[7027]=28100,n[7030]=28108,n[7029]=28108,n[7032]=28116,n[7031]=28116,n[7034]=28124,n[7033]=28124,n[7036]=28132,n[7035]=28132,n[7038]=28140,n[7037]=28140,n[7040]=28148,n[7039]=28148,n[7042]=28156,n[7041]=28156,n[7044]=28164,n[7043]=28164,n[7046]=28172,n[7045]=28172,n[7048]=28180,n[7047]=28180,n[7050]=28188,n[7049]=28188,n[7052]=28196,n[7051]=28196,n[7054]=28204,n[7053]=28204,n[7056]=28212,n[7055]=28212,x=a+(w=7&(w=a+8|0)?0-w&7:0)|0,w=(y=s+-40|0)-w|0,n[6987]=x,n[6984]=w,n[x+4>>2]=1|w,n[a+y+4>>2]=40,n[6988]=n[7103]}while(0);if((t=0|n[6984])>>>0>d>>>0)return w=t-d|0,n[6984]=w,x=(y=0|n[6987])+d|0,n[6987]=x,n[x+4>>2]=1|w,n[y+4>>2]=3|d,S=e,0|y+8}return n[(y=27920)>>2]=12,S=e,0}function Ye(A){var e=0,t=0,r=0,o=0,i=0,a=0,s=0,l=0;if(A|=0){t=A+-8|0,o=0|n[6985],l=t+(e=-8&(A=0|n[A+-4>>2]))|0;do{if(1&A)s=t,a=t;else{if(r=0|n[t>>2],!(3&A))return;if(i=r+e|0,(a=t+(0-r)|0)>>>0>>0)return;if((0|n[6986])==(0|a)){if(3&~(e=0|n[(A=l+4|0)>>2])){s=a,e=i;break}return n[6983]=i,n[A>>2]=-2&e,n[a+4>>2]=1|i,void(n[a+i>>2]=i)}if(t=r>>>3,r>>>0<256){if(A=0|n[a+8>>2],(0|(e=0|n[a+12>>2]))==(0|A)){n[6981]=n[6981]&~(1<>2]=e,n[e+8>>2]=A,s=a,e=i;break}o=0|n[a+24>>2],A=0|n[a+12>>2];do{if((0|A)==(0|a)){if(A=0|n[(t=4+(e=a+16|0)|0)>>2])e=t;else if(!(A=0|n[e>>2])){A=0;break}for(;;)if(t=0|n[(r=A+20|0)>>2])A=t,e=r;else{if(!(t=0|n[(r=A+16|0)>>2]))break;A=t,e=r}n[e>>2]=0}else s=0|n[a+8>>2],n[s+12>>2]=A,n[A+8>>2]=s}while(0);if(o){if(e=0|n[a+28>>2],(0|n[(t=28228+(e<<2)|0)>>2])==(0|a)){if(n[t>>2]=A,!A){n[6982]=n[6982]&~(1<>2])==(0|a)?s:o+20)>>2]=A,!A){s=a,e=i;break}n[A+24>>2]=o,0|(t=0|n[(e=a+16|0)>>2])&&(n[A+16>>2]=t,n[t+24>>2]=A),(e=0|n[e+4>>2])?(n[A+20>>2]=e,n[e+24>>2]=A,s=a,e=i):(s=a,e=i)}else s=a,e=i}}while(0);if(!(a>>>0>=l>>>0)&&1&(r=0|n[(A=l+4|0)>>2])){if(2&r)n[A>>2]=-2&r,n[s+4>>2]=1|e,n[a+e>>2]=e,o=e;else{if((0|n[6987])==(0|l)){if(l=(0|n[6984])+e|0,n[6984]=l,n[6987]=s,n[s+4>>2]=1|l,(0|s)!=(0|n[6986]))return;return n[6986]=0,void(n[6983]=0)}if((0|n[6986])==(0|l))return l=(0|n[6983])+e|0,n[6983]=l,n[6986]=a,n[s+4>>2]=1|l,void(n[a+l>>2]=l);o=(-8&r)+e|0,t=r>>>3;do{if(r>>>0<256){if(e=0|n[l+8>>2],(0|(A=0|n[l+12>>2]))==(0|e)){n[6981]=n[6981]&~(1<>2]=A,n[A+8>>2]=e;break}i=0|n[l+24>>2],A=0|n[l+12>>2];do{if((0|A)==(0|l)){if(A=0|n[(t=4+(e=l+16|0)|0)>>2])e=t;else if(!(A=0|n[e>>2])){t=0;break}for(;;)if(t=0|n[(r=A+20|0)>>2])A=t,e=r;else{if(!(t=0|n[(r=A+16|0)>>2]))break;A=t,e=r}n[e>>2]=0,t=A}else t=0|n[l+8>>2],n[t+12>>2]=A,n[A+8>>2]=t,t=A}while(0);if(0|i){if(A=0|n[l+28>>2],(0|n[(e=28228+(A<<2)|0)>>2])==(0|l)){if(n[e>>2]=t,!t){n[6982]=n[6982]&~(1<>2])==(0|l)?r:i+20)>>2]=t,!t)break;n[t+24>>2]=i,0|(e=0|n[(A=l+16|0)>>2])&&(n[t+16>>2]=e,n[e+24>>2]=t),0|(A=0|n[A+4>>2])&&(n[t+20>>2]=A,n[A+24>>2]=t)}}while(0);if(n[s+4>>2]=1|o,n[a+o>>2]=o,(0|s)==(0|n[6986]))return void(n[6983]=o)}if(A=o>>>3,o>>>0<256)return t=27964+(A<<1<<2)|0,(e=0|n[6981])&(A=1<>2]:(n[6981]=e|A,A=t,e=t+8|0),n[e>>2]=s,n[A+12>>2]=s,n[s+8>>2]=A,void(n[s+12>>2]=t);A=28228+((r=(A=o>>>8)?o>>>0>16777215?31:o>>>(7+(r=14-((i=(520192+(l=A<<(a=(A+1048320|0)>>>16&8))|0)>>>16&4)|a|(r=(245760+(l<<=i)|0)>>>16&2))+(l<>>15)|0)|0)&1|r<<1:0)<<2)|0,n[s+28>>2]=r,n[s+20>>2]=0,n[s+16>>2]=0,e=0|n[6982],t=1<>2];e:do{if((-8&n[A+4>>2])!=(0|o)){for(r=o<<(31==(0|r)?0:25-(r>>>1)|0);e=0|n[(t=A+16+(r>>>31<<2)|0)>>2];){if((-8&n[e+4>>2])==(0|o)){A=e;break e}r<<=1,A=e}n[t>>2]=s,n[s+24>>2]=A,n[s+12>>2]=s,n[s+8>>2]=s;break A}}while(0);l=0|n[(a=A+8|0)>>2],n[l+12>>2]=s,n[a>>2]=s,n[s+8>>2]=l,n[s+12>>2]=A,n[s+24>>2]=0}else n[6982]=e|t,n[A>>2]=s,n[s+24>>2]=A,n[s+12>>2]=s,n[s+8>>2]=s}while(0);if(l=(0|n[6989])-1|0,n[6989]=l,!(0|l)){for(A=28380;A=0|n[A>>2];)A=A+8|0;n[6989]=-1}}}}function We(A,e){e|=0;var t=0;return(A|=0)?(t=0|w(e,A),(e|A)>>>0>65535&&(t=((t>>>0)/(A>>>0)|0)==(0|e)?t:-1)):t=0,(A=0|Ue(t))&&3&n[A+-4>>2]?(lt(0|A,0,0|t),0|A):0|A}function Ve(A,e,t,r){return 0|(C((e|=0)+(r|=0)+((t=(A|=0)+(t|=0)>>>0)>>>0>>0|0)>>>0|0),t)}function Ze(A,e,t,r){return 0|(C(0|(r=(e|=0)-(r|=0)-((t|=0)>>>0>(A|=0)>>>0|0)>>>0)),A-t>>>0)}function Ke(A){return 0|((A|=0)?31-(0|k(A^A-1)):32)}function Je(A,e,t,r,o){o|=0;var i=0,a=0,s=0,l=0,c=0,u=0,f=0,d=0,g=0,h=0;if(u=A|=0,a=t|=0,s=d=r|=0,!(c=l=e|=0))return i=!!(0|o),s?i?(n[o>>2]=0|A,n[o+4>>2]=0&e,o=0,0|(C(0|(d=0)),o)):(o=0,0|(C(0|(d=0)),o)):(i&&(n[o>>2]=(u>>>0)%(a>>>0),n[o+4>>2]=0),o=(u>>>0)/(a>>>0)>>>0,0|(C(0|(d=0)),o));i=!(0|s);do{if(a){if(!i){if((i=(0|k(0|s))-(0|k(0|c))|0)>>>0<=31){a=f=i+1|0,A=u>>>(f>>>0)&(e=i-31>>31)|c<<(s=31-i|0),e&=c>>>(f>>>0),i=0,s=u<>2]=0|A,n[o+4>>2]=l|0&e,o=0,0|(C(0|(d=0)),o)):(o=0,0|(C(0|(d=0)),o))}if((i=a-1|0)&a){a=s=33+(0|k(0|a))-(0|k(0|c))|0,A=(f=32-s|0)-1>>31&c>>>((g=s-32|0)>>>0)|(c<>>(s>>>0))&(e=g>>31),e&=c>>>(s>>>0),i=u<<(h=64-s|0)&(l=f>>31),s=(c<>>(g>>>0))&l|u<>31;break}return 0|o&&(n[o>>2]=i&u,n[o+4>>2]=0),1==(0|a)?(h=0|A,0|(C(0|(g=l|0&e)),h)):(g=c>>>((h=0|Ke(0|a))>>>0)|0,h=c<<32-h|u>>>(h>>>0),0|(C(0|g),h))}if(i)return 0|o&&(n[o>>2]=(c>>>0)%(a>>>0),n[o+4>>2]=0),h=(c>>>0)/(a>>>0)>>>0,0|(C(0|(g=0)),h);if(!u)return 0|o&&(n[o>>2]=0,n[o+4>>2]=(c>>>0)%(s>>>0)),h=(c>>>0)/(s>>>0)>>>0,0|(C(0|(g=0)),h);if(!((i=s-1|0)&s))return 0|o&&(n[o>>2]=0|A,n[o+4>>2]=i&c|0&e),g=0,h=c>>>((0|Ke(0|s))>>>0),0|(C(0|g),h);if((i=(0|k(0|s))-(0|k(0|c))|0)>>>0<=30){a=e=i+1|0,A=c<<(s=31-i|0)|u>>>(e>>>0),e=c>>>(e>>>0),i=0,s=u<>2]=0|A,n[o+4>>2]=l|0&e,h=0,0|(C(0|(g=0)),h)):(h=0,0|(C(0|(g=0)),h))}while(0);if(a){c=0|Ve(0|(f=0|t),0|(u=d|0&r),-1,-1),t=0|B(),l=s,s=0;do{r=l,l=i>>>31|l<<1,i=s|i<<1,Ze(0|c,0|t,0|(r=A<<1|r>>>31),0|(d=A>>>31|e<<1)),s=1&(g=(h=0|B())>>31|((0|h)<0?-1:0)<<1),A=0|Ze(0|r,0|d,g&f|0,(((0|h)<0?-1:0)>>31|((0|h)<0?-1:0)<<1)&u),e=0|B(),a=a-1|0}while(0|a);c=l,l=0}else c=s,l=0,s=0;return a=0,0|o&&(n[o>>2]=A,n[o+4>>2]=e),h=i<<1&-2|s,0|(C(0|(g=(0|i)>>>31|(c|a)<<1|l)),h)}function Xe(A,e,t,r){var n,o,i,a,s;return t|=0,o=(r|=0)>>31|((0|r)<0?-1:0)<<1,n=((0|r)<0?-1:0)>>31|((0|r)<0?-1:0)<<1,i=0|Ze((s=(e|=0)>>31|((0|e)<0?-1:0)<<1)^(A|=0),(a=((0|e)<0?-1:0)>>31|((0|e)<0?-1:0)<<1)^e,0|s,0|a),A=o^s,e=n^a,0|Ze((0|Je(i,0|B(),0|Ze(o^t|0,n^r|0,0|o,0|n),0|B(),0))^A,(0|B())^e,0|A,0|e)}function qe(A,e,t,r){var n,o;return e|=0,r|=0,t=0|function(A,e){var t,r,n,o=0;return A=((t=0|w(o=65535&(e|=0),n=65535&(A|=0)))>>>16)+(0|w(o,r=A>>>16))|0,e=0|w(o=e>>>16,n),0|(C((A>>>16)+(0|w(o,r))+(((65535&A)+e|0)>>>16)|0),A+e<<16|65535&t)}(n=A|=0,o=t|=0),A=0|B(),0|(C((0|w(e,o))+(0|w(r,n))+A|0&A),t)}function $e(A,e,t,r){var o,i,a,s,l,c;return t|=0,o=S,S=S+16|0,s=0|o,c=(r|=0)>>31|((0|r)<0?-1:0)<<1,l=((0|r)<0?-1:0)>>31|((0|r)<0?-1:0)<<1,Je(A=0|Ze((a=(e|=0)>>31|((0|e)<0?-1:0)<<1)^(A|=0),(i=((0|e)<0?-1:0)>>31|((0|e)<0?-1:0)<<1)^e,0|a,0|i),e=0|B(),0|Ze(c^t|0,l^r|0,0|c,0|l),0|B(),s),r=0|Ze(n[s>>2]^a|0,n[s+4>>2]^i|0,0|a,0|i),t=0|B(),S=o,0|(C(0|t),r)}function At(A,e,t,r){var o,i;return i=S,S=S+16|0,Je(A|=0,e|=0,t|=0,r|=0,o=0|i),S=i,0|(C(0|n[o+4>>2]),n[o>>2])}function et(A,e,t){return A|=0,e|=0,(0|(t|=0))<32?(C(e>>t|0),A>>>t|(e&(1<>t-32)}function tt(A,e,t){return A|=0,e|=0,(0|(t|=0))<32?(C(e>>>t|0),A>>>t|(e&(1<>>t-32|0)}function rt(A,e,t){return A|=0,(0|(t|=0))<32?(C((e|=0)<>>32-t),A<=0?+s(A+.5):+v(A-.5)}function st(A,e,t){A|=0,e|=0;var o,i,a=0;if((0|(t|=0))>=8192)return Q(0|A,0|e,0|t),0|A;if(i=0|A,o=A+t|0,(3&A)==(3&e)){for(;3&A;){if(!t)return 0|i;r[0|A]=0|r[0|e],A=A+1|0,e=e+1|0,t=t-1|0}for(a=(t=-4&o)-64|0;(0|A)<=(0|a);)n[A>>2]=n[e>>2],n[A+4>>2]=n[e+4>>2],n[A+8>>2]=n[e+8>>2],n[A+12>>2]=n[e+12>>2],n[A+16>>2]=n[e+16>>2],n[A+20>>2]=n[e+20>>2],n[A+24>>2]=n[e+24>>2],n[A+28>>2]=n[e+28>>2],n[A+32>>2]=n[e+32>>2],n[A+36>>2]=n[e+36>>2],n[A+40>>2]=n[e+40>>2],n[A+44>>2]=n[e+44>>2],n[A+48>>2]=n[e+48>>2],n[A+52>>2]=n[e+52>>2],n[A+56>>2]=n[e+56>>2],n[A+60>>2]=n[e+60>>2],A=A+64|0,e=e+64|0;for(;(0|A)<(0|t);)n[A>>2]=n[e>>2],A=A+4|0,e=e+4|0}else for(t=o-4|0;(0|A)<(0|t);)r[0|A]=0|r[0|e],r[A+1|0]=0|r[e+1|0],r[A+2|0]=0|r[e+2|0],r[A+3|0]=0|r[e+3|0],A=A+4|0,e=e+4|0;for(;(0|A)<(0|o);)r[0|A]=0|r[0|e],A=A+1|0,e=e+1|0;return 0|i}function lt(A,e,t){e|=0;var o,i=0,a=0,s=0;if(o=(A|=0)+(t|=0)|0,e&=255,(0|t)>=67){for(;3&A;)r[0|A]=e,A=A+1|0;for(s=e|e<<8|e<<16|e<<24,a=(i=-4&o)-64|0;(0|A)<=(0|a);)n[A>>2]=s,n[A+4>>2]=s,n[A+8>>2]=s,n[A+12>>2]=s,n[A+16>>2]=s,n[A+20>>2]=s,n[A+24>>2]=s,n[A+28>>2]=s,n[A+32>>2]=s,n[A+36>>2]=s,n[A+40>>2]=s,n[A+44>>2]=s,n[A+48>>2]=s,n[A+52>>2]=s,n[A+56>>2]=s,n[A+60>>2]=s,A=A+64|0;for(;(0|A)<(0|i);)n[A>>2]=s,A=A+4|0}for(;(0|A)<(0|o);)r[0|A]=e,A=A+1|0;return o-t|0}function ct(A){return(A=+A)>=0?+s(A+.5):+v(A-.5)}function ut(A){var e,t,r;return A|=0,r=0|E(),(0|A)>0&(0|(e=(t=0|n[a>>2])+A|0))<(0|t)|(0|e)<0?(N(0|e),D(12),-1):(0|e)>(0|r)&&!(0|j(0|e))?(D(12),-1):(n[a>>2]=e,0|t)}return{___divdi3:Xe,___muldi3:qe,___remdi3:$e,___uremdi3:At,_areNeighborCells:function(A,e,t,r,o){o|=0;var i,a,s,l=0,c=0,u=0,f=0;if(s=S,S=S+64|0,a=s,i=s+56|0,!(!0&134217728==(2013265920&(e|=0))&!0&134217728==(2013265920&(r|=0))))return S=s,5;if((0|(A|=0))==(0|(t|=0))&(0|e)==(0|r))return n[o>>2]=0,S=s,0;if(c=0|tt(0|A,0|e,52),B(),c&=15,f=0|tt(0|t,0|r,52),B(),(0|c)!=(15&f))return S=s,12;if(l=c+-1|0,c>>>0>1){RA(A,e,l,a),RA(t,r,l,i),u=0|n[(f=a)>>2],f=0|n[f+4>>2];A:do{if((0|u)==(0|n[i>>2])&&(0|f)==(0|n[i+4>>2])){l=0|tt(0|A,0|e,0|(c=3*(15^c)|0)),B(),l&=7,c=0|tt(0|t,0|r,0|c),B(),c&=7;do{if(!(0|l)|!(0|c))n[o>>2]=1,l=0;else if(7==(0|l))l=5;else{if(1==(0|l)|1==(0|c)&&0|HA(u,f)){l=5;break}if((0|n[15536+(l<<2)>>2])!=(0|c)&&(0|n[15568+(l<<2)>>2])!=(0|c))break A;n[o>>2]=1,l=0}}while(0);return S=s,0|l}}while(0)}c=(l=a)+56|0;do{n[l>>2]=0,l=l+4|0}while((0|l)<(0|c));return F(A,e,1,a),l=(0|n[(e=a)>>2])==(0|t)&&(0|n[e+4>>2])==(0|r)||(0|n[(e=a+8|0)>>2])==(0|t)&&(0|n[e+4>>2])==(0|r)||(0|n[(e=a+16|0)>>2])==(0|t)&&(0|n[e+4>>2])==(0|r)||(0|n[(e=a+24|0)>>2])==(0|t)&&(0|n[e+4>>2])==(0|r)||(0|n[(e=a+32|0)>>2])==(0|t)&&(0|n[e+4>>2])==(0|r)||(0|n[(e=a+40|0)>>2])==(0|t)&&(0|n[e+4>>2])==(0|r)?1:1&((0|n[(l=a+48|0)>>2])==(0|t)?(0|n[l+4>>2])==(0|r):0),n[o>>2]=l,S=s,0},_bitshift64Ashr:et,_bitshift64Lshr:tt,_bitshift64Shl:rt,_calloc:We,_cellAreaKm2:function(A,e,t){return 0|(A=0|ue(A|=0,e|=0,t|=0))||(o[t>>3]=6371.007180918475*+o[t>>3]*6371.007180918475),0|A},_cellAreaM2:function(A,e,t){return 0|(A=0|ue(A|=0,e|=0,t|=0))||(o[t>>3]=6371.007180918475*+o[t>>3]*6371.007180918475*1e3*1e3),0|A},_cellAreaRads2:ue,_cellToBoundary:$A,_cellToCenterChild:GA,_cellToChildPos:function(A,e,t,r){t|=0,r|=0;var o,i=0,a=0,s=0,l=0,c=0,u=0,f=0,d=0,g=0,h=0,m=0,b=0,p=0,v=0;if(o=S,S=S+16|0,p=o,v=0|tt(0|(A|=0),0|(e|=0),52),B(),t>>>0>15)return S=o,4;if((0|(v&=15))<(0|t))return S=o,12;if((0|v)!=(0|t))if(a=0|rt(0|t,0,52),a|=A,l=B()|-15728641&e,(0|v)>(0|t)){c=t;do{b=0|rt(7,0,3*(14-c|0)|0),c=c+1|0,a|=b,l=0|B()|l}while((0|c)<(0|v));b=a}else b=a;else b=A,l=e;m=0|tt(0|b,0|l,45),B();A:do{if(0|z(127&m)){if(c=0|tt(0|b,0|l,52),B(),0|(c&=15))for(a=1;;){if(!(!((m=0|rt(7,0,3*(15-a|0)|0))&b)&!((0|B())&l))){u=33;break A}if(!(a>>>0>>0))break;a=a+1|0}if(n[(m=r)>>2]=0,n[m+4>>2]=0,(0|v)>(0|t)){for(m=-15728641&e,h=v;;){if(g=h,(h=h+-1|0)>>>0>15|(0|v)<(0|h)){u=19;break}if((0|v)!=(0|h))if(a=0|rt(0|h,0,52),a|=A,c=0|B()|m,(0|v)<(0|g))d=a;else{u=h;do{d=0|rt(7,0,3*(14-u|0)|0),u=u+1|0,a|=d,c=0|B()|c}while((0|u)<(0|v));d=a}else d=A,c=e;if(f=0|tt(0|d,0|c,45),B(),0|z(127&f)){f=0|tt(0|d,0|c,52),B(),f&=15;e:do{if(f)for(u=1;;){if(a=0|tt(0|d,0|c,3*(15-u|0)|0),B(),0|(a&=7))break e;if(!(u>>>0>>0)){a=0;break}u=u+1|0}else a=0}while(0);a=1&!(0|a)}else a=0;if(c=0|tt(0|A,0|e,3*(15-g|0)|0),B(),7==(0|(c&=7))){i=5,u=42;break}if(1==(0|c)&(a=!!(0|a))){i=5,u=42;break}if(0|(d=c+((!!(0|c)&a)<<31>>31)|0)&&(u=0|pe(7,0,u=v-g|0,((0|u)<0)<<31>>31),f=0|B(),a?(a=0|Ve(0|(a=0|qe(0|u,0|f,5,0)),0|B(),-5,-1),a=0|Ve(0|(a=0|Xe(0|a,0|B(),6,0)),0|B(),1,0),c=0|B()):(a=u,c=f),g=0|Ve(0|a,0|c,0|(g=0|qe(0|u,0|f,0|(g=d+-1|0),((0|g)<0)<<31>>31)),0|B()),f=0|Ve(0|g,0|(d=0|B()),0|n[(f=r)>>2],0|n[f+4>>2]),d=0|B(),n[(g=r)>>2]=f,n[g+4>>2]=d),(0|h)<=(0|t)){u=37;break}}if(19==(0|u))M(27795,27122,1367,27158);else{if(37==(0|u)){i=0|n[(s=r)+4>>2],s=0|n[s>>2];break}if(42==(0|u))return S=o,0|i}}else i=0,s=0}else u=33}while(0);A:do{if(33==(0|u)){if(n[(m=r)>>2]=0,n[m+4>>2]=0,(0|v)>(0|t)){for(a=v;;){if(i=0|tt(0|A,0|e,3*(15-a|0)|0),B(),7==(0|(i&=7))){i=5;break}if(i=0|qe(0|(s=0|pe(7,0,s=v-a|0,((0|s)<0)<<31>>31)),0|B(),0|i,0),s=0|B(),s=0|Ve(0|n[(m=r)>>2],0|n[m+4>>2],0|i,0|s),i=0|B(),n[(m=r)>>2]=s,n[m+4>>2]=i,(0|(a=a+-1|0))<=(0|t))break A}return S=o,0|i}i=0,s=0}}while(0);return 0|_A(b,l,v,p)&&M(27795,27122,1327,27173),((0|i)>-1|-1==(0|i)&s>>>0>4294967295)&((0|(p=0|n[(v=p)+4>>2]))>(0|i)|((0|p)==(0|i)?(0|n[v>>2])>>>0>s>>>0:0))?(S=o,0|(v=0)):(M(27795,27122,1407,27158),0)},_cellToChildren:function(A,e,t,r){r|=0;var o,i,a=0,s=0;if(i=S,S=S+16|0,ee(o=i,A|=0,e|=0,t|=0),!(0|(A=0|n[(e=o)>>2]))&!(0|(e=0|n[e+4>>2])))return S=i,0;a=0,t=0;do{n[(s=r+(a<<3)|0)>>2]=A,n[s+4>>2]=e,a=0|Ve(0|a,0|t,1,0),t=0|B(),re(o),A=0|n[(s=o)>>2],e=0|n[s+4>>2]}while(!(!(0|A)&!(0|e)));return S=i,0},_cellToChildrenSize:_A,_cellToLatLng:qA,_cellToLocalIj:function(A,e,t,r,o,i){var a,s;return A|=0,i|=0,s=S,S=S+16|0,a=s,(o|=0)?A=15:(A=0|me(A,e|=0,t|=0,r|=0,a))||(function(A,e){var t;e|=0,t=0|n[8+(A|=0)>>2],n[e>>2]=(0|n[A>>2])-t,n[e+4>>2]=(0|n[A+4>>2])-t}(a,i),A=0),S=s,0|A},_cellToParent:RA,_cellToVertex:Pe,_cellToVertexes:function(A,e,t){t|=0;var r,o=0,i=0;return i=!(0|HA(A|=0,e|=0)),r=!(0|(o=0|Pe(A,e,0,t))),i?r?0|(o=0|Pe(A,e,1,t+8|0))||0|(o=0|Pe(A,e,2,t+16|0))||0|(o=0|Pe(A,e,3,t+24|0))||(o=0|Pe(A,e,4,t+32|0))?0|(i=o):0|Pe(A,e,5,t+40|0):0|(i=o):r?0|(o=0|Pe(A,e,1,t+8|0))||0|(o=0|Pe(A,e,2,t+16|0))||0|(o=0|Pe(A,e,3,t+24|0))||0|(o=0|Pe(A,e,4,t+32|0))?0|(i=o):(n[(i=t+40|0)>>2]=0,n[i+4>>2]=0,0|(i=0)):0|(i=o)},_cellsToDirectedEdge:function(A,e,t,r,o){return o|=0,7==(0|(t=0|_(A|=0,e|=0,t|=0,r|=0)))?0|(o=11):(r=0|rt(0|t,0,56),e=-2130706433&e|B()|268435456,n[o>>2]=A|r,n[o+4>>2]=e,0|(o=0))},_cellsToLinkedMultiPolygon:function(A,e,t){t|=0;var r,i,a,s=0;if(a=S,S=S+32|0,r=a,0|(A=0|function(A,e,t){A|=0,t|=0;var r,o,i=0,a=0,s=0,l=0,c=0,u=0;if(o=S,S=S+176|0,r=o,(0|(e|=0))<1)return Le(t,0,0),S=o,0;for(c=0|tt(0|n[(c=A)>>2],0|n[c+4>>2],52),B(),Le(t,(0|e)>6?e:6,15&c),c=0;!(0|(i=0|$A(0|n[(i=A+(c<<3)|0)>>2],0|n[i+4>>2],r)));){if((0|(i=0|n[r>>2]))>0){l=0;do{s=r+8+(l<<4)|0,(a=0|ze(t,i=r+8+((0|(l=l+1|0))%(0|i)<<4)|0,s))?_e(t,a):He(t,s,i),i=0|n[r>>2]}while((0|l)<(0|i))}if((0|(c=c+1|0))>=(0|e)){i=0,u=13;break}}return 13==(0|u)?(S=o,0|i):(Ie(t),S=o,0|(u=i))}(A|=0,e|=0,i=a+16|0)))return S=a,0|A;if(n[t>>2]=0,n[t+4>>2]=0,n[t+8>>2]=0,0|(A=0|Re(i)))do{e=0|fe(t);do{de(e,A),s=A+16|0,n[r>>2]=n[s>>2],n[r+4>>2]=n[s+4>>2],n[r+8>>2]=n[s+8>>2],n[r+12>>2]=n[s+12>>2],_e(i,A),A=0|Ge(i,r)}while(0|A);A=0|Re(i)}while(0|A);return Ie(i),(A=0|function(A){var e,t,r=0,i=0,a=0,s=0,c=0,u=0,f=0,d=0,g=0,h=0,m=0,b=0,p=0,v=0,w=0,x=0,y=0,k=0,C=0,B=0,D=0,E=0,Q=0,j=0,N=0,S=0,F=0,P=0,T=0,L=0;if(0|n[(s=(A|=0)+8|0)>>2])return 1;if(!(a=0|n[A>>2]))return 0;r=a,i=0;do{i=i+1|0,r=0|n[r+8>>2]}while(0|r);if(i>>>0<2)return 0;(t=0|Ue(i<<2))||M(27396,27235,317,27415),(e=0|Ue(i<<5))||M(27437,27235,321,27415),n[A>>2]=0,n[(E=A+4|0)>>2]=0,n[s>>2]=0,i=0,P=0,D=0,m=0;A:for(;;){if(h=0|n[a>>2]){c=0,u=h;do{if(d=+o[u+8>>3],r=u,u=0|n[u+16>>2],f=+o[(s=(g=!(0|u))?h:u)+8>>3],+l(+(d-f))>3.141592653589793){L=14;break}c+=(f-d)*(+o[r>>3]+ +o[s>>3])}while(!g);if(14==(0|L)){L=0,c=0,r=h;do{B=+o[r+8>>3],S=0|n[(F=r+16|0)>>2],C=+o[(S=0|S?S:h)+8>>3],c+=(+o[r>>3]+ +o[S>>3])*((C<0?C+6.283185307179586:C)-(B<0?B+6.283185307179586:B)),r=0|n[(0|r?F:a)>>2]}while(0|r)}c>0?(n[t+(P<<2)>>2]=a,P=P+1|0,s=D,r=m):L=19}else L=19;if(19==(0|L)){L=0;do{if(!i){if(m){s=E,u=m+8|0,r=a,i=A;break}if(0|n[A>>2]){L=27;break A}s=E,u=A,r=a,i=A;break}if(0|n[(r=i+8|0)>>2]){L=21;break A}if(!(i=0|We(1,12))){L=23;break A}n[r>>2]=i,s=i+4|0,u=i,r=m}while(0);if(n[u>>2]=a,n[s>>2]=a,u=e+(D<<5)|0,g=0|n[a>>2]){for(o[(h=e+(D<<5)+8|0)>>3]=17976931348623157e292,o[(m=e+(D<<5)+24|0)>>3]=17976931348623157e292,o[u>>3]=-17976931348623157e292,o[(b=e+(D<<5)+16|0)>>3]=-17976931348623157e292,y=17976931348623157e292,k=-17976931348623157e292,s=0,p=g,d=17976931348623157e292,w=17976931348623157e292,x=-17976931348623157e292,f=-17976931348623157e292;c=+o[p>>3],B=+o[p+8>>3],p=0|n[p+16>>2],C=+o[((v=!(0|p))?g:p)+8>>3],c>3]=c,d=c),B>3]=B,w=B),c>x?o[u>>3]=c:c=x,B>f&&(o[b>>3]=B,f=B),y=B>0&Bk?B:k,s|=+l(+(B-C))>3.141592653589793,!v;)x=c;s&&(o[b>>3]=k,o[m>>3]=y)}else n[u>>2]=0,n[u+4>>2]=0,n[u+8>>2]=0,n[u+12>>2]=0,n[u+16>>2]=0,n[u+20>>2]=0,n[u+24>>2]=0,n[u+28>>2]=0;s=D+1|0}if(a=0|n[(F=a+8|0)>>2],n[F>>2]=0,!a){L=45;break}D=s,m=r}if(21==(0|L))M(27213,27235,35,27247);else if(23==(0|L))M(27267,27235,37,27247);else if(27==(0|L))M(27310,27235,61,27333);else if(45==(0|L)){A:do{if((0|P)>0){for(F=!(0|s),N=s<<2,S=!(0|A),j=0,r=0;;){if(Q=0|n[t+(j<<2)>>2],F)L=73;else{if(!(D=0|Ue(N))){L=50;break}if(!(E=0|Ue(N))){L=52;break}e:do{if(S)i=0;else{for(s=0,i=0,u=A;a=e+(s<<5)|0,0|he(0|n[u>>2],a,0|n[Q>>2])?(n[D+(i<<2)>>2]=u,n[E+(i<<2)>>2]=a,v=i+1|0):v=i,u=0|n[u+8>>2];)s=s+1|0,i=v;if((0|v)>0)if(a=0|n[D>>2],1==(0|v))i=a;else for(b=0,p=-1,i=a,m=a;;){for(g=0|n[m>>2],a=0,u=0;h=(0|(s=0|n[n[D+(u<<2)>>2]>>2]))==(0|g)?a:a+(1&he(s,0|n[E+(u<<2)>>2],0|n[g>>2]))|0,(0|(u=u+1|0))!=(0|v);)a=h;if(i=(s=(0|h)>(0|p))?m:i,(0|(a=b+1|0))==(0|v))break e;b=a,p=s?h:p,m=0|n[D+(a<<2)>>2]}else i=0}}while(0);if(Ye(D),Ye(E),i){if(a=0|n[(s=i+4|0)>>2])i=a+8|0;else if(0|n[i>>2]){L=70;break}n[i>>2]=Q,n[s>>2]=Q}else L=73}if(73==(0|L)){if(L=0,0|(r=0|n[Q>>2]))do{E=r,r=0|n[r+16>>2],Ye(E)}while(0|r);Ye(Q),r=1}if((0|(j=j+1|0))>=(0|P)){T=r;break A}}50==(0|L)?M(27452,27235,249,27471):52==(0|L)?M(27490,27235,252,27471):70==(0|L)&&M(27310,27235,61,27333)}else T=0}while(0);return Ye(t),Ye(e),0|T}return 0}(t))?(ge(t),S=a,0|(s=A)):(S=a,0|(s=0))},_childPosToCell:function(A,e,t,r,o,i){A|=0,e|=0,i|=0;var a,s=0,l=0,c=0,u=0,f=0,d=0,g=0,h=0,m=0;if(a=S,S=S+16|0,s=a,(o|=0)>>>0>15)return S=a,4;if(l=0|tt(0|(t|=0),0|(r|=0),52),B(),(0|(l&=15))>(0|o))return S=a,12;if(0|_A(t,r,o,s)&&M(27795,27122,1327,27173),!(((0|e)>-1|-1==(0|e)&A>>>0>4294967295)&((0|(u=0|n[(f=s)+4>>2]))>(0|e)|((0|u)==(0|e)?(0|n[f>>2])>>>0>A>>>0:0))))return S=a,2;f=o-l|0,o=0|rt(0|o,0,52),c=B()|-15728641&r,n[(u=i)>>2]=o|t,n[u+4>>2]=c,u=0|tt(0|t,0|r,45),B();A:do{if(0|z(127&u)){if(0|l)for(s=1;;){if(!(!((u=0|rt(7,0,3*(15-s|0)|0))&t)&!((0|B())&r)))break A;if(!(s>>>0>>0))break;s=s+1|0}if((0|f)<1)return S=a,0;for(u=15^l,r=-1,c=1,s=1;;){l=0|pe(7,0,l=f-c|0,((0|l)<0)<<31>>31),t=0|B();do{if(s){if(s=0|Xe(0|(s=0|Ve(0|(s=0|qe(0|l,0|t,5,0)),0|B(),-5,-1)),0|B(),6,0),(0|e)>(0|(o=0|B()))|(0|e)==(0|o)&A>>>0>s>>>0){e=0|Ze(0|(e=0|Ve(0|A,0|e,-1,-1)),0|B(),0|s,0|o),s=0|B(),h=0|n[(d=i)>>2],d=0|n[d+4>>2],g=0|rt(7,0,0|(m=3*(u+r|0)|0)),d&=~B(),m=0|rt(0|(o=0|Ve(0|(r=0|Xe(0|e,0|s,0|l,0|t)),0|(A=0|B()),2,0)),0|B(),0|m),d=0|B()|d,n[(o=i)>>2]=m|h&~g,n[o+4>>2]=d,A=0|Ze(0|e,0|s,0|(A=0|qe(0|r,0|A,0|l,0|t)),0|B()),s=0,e=0|B();break}g=0|n[(m=i)>>2],m=0|n[m+4>>2],h=0|rt(7,0,3*(u+r|0)|0),m&=~B(),n[(s=i)>>2]=g&~h,n[s+4>>2]=m,s=1;break}o=0|n[(g=i)>>2],g=0|n[g+4>>2],d=0|rt(7,0,0|(r=3*(u+r|0)|0)),g&=~B(),r=0|rt(0|(m=0|Xe(0|A,0|e,0|l,0|t)),0|(s=0|B()),0|r),g=0|B()|g,n[(h=i)>>2]=r|o&~d,n[h+4>>2]=g,A=0|Ze(0|A,0|e,0|(s=0|qe(0|m,0|s,0|l,0|t)),0|B()),s=0,e=0|B()}while(0);if(!((0|f)>(0|c))){e=0;break}r=~c,c=c+1|0}return S=a,0|e}}while(0);if((0|f)<1)return S=a,0;for(o=15^l,s=1;;){if(h=0|pe(7,0,h=f-s|0,((0|h)<0)<<31>>31),m=0|B(),t=0|n[(c=i)>>2],c=0|n[c+4>>2],r=0|rt(7,0,0|(l=3*(o-s|0)|0)),c&=~B(),l=0|rt(0|(d=0|Xe(0|A,0|e,0|h,0|m)),0|(g=0|B()),0|l),c=0|B()|c,n[(u=i)>>2]=l|t&~r,n[u+4>>2]=c,A=0|Ze(0|A,0|e,0|(m=0|qe(0|d,0|g,0|h,0|m)),0|B()),e=0|B(),(0|f)<=(0|s)){e=0;break}s=s+1|0}return S=a,0|e},_compactCells:function(A,e,t,r){e|=0;var o,i=0,a=0,s=0,l=0,c=0,u=0,f=0,d=0,g=0,h=0,m=0,b=0,p=0,v=0,w=0,x=0,y=0,k=0,C=0,D=0,E=0,Q=0,j=0,N=0,S=0;if(!(0|(t|=0))&!(0|(r|=0)))return 0;if(a=0|n[(i=A|=0)>>2],!0&!(15728640&(i=0|n[i+4>>2]))){if(!((0|r)>0|!(0|r)&t>>>0>0))return 0;if(n[(S=e)>>2]=a,n[S+4>>2]=i,1==(0|t)&!(0|r))return 0;i=1,a=0;do{N=0|n[4+(j=A+(i<<3)|0)>>2],n[(S=e+(i<<3)|0)>>2]=n[j>>2],n[S+4>>2]=N,i=0|Ve(0|i,0|a,1,0),a=0|B()}while((0|a)<(0|r)|(0|a)==(0|r)&i>>>0>>0);return 0}if(!(N=0|Ue(o=t<<3)))return 13;if(st(0|N,0|A,0|o),!(j=0|We(t,8)))return Ye(N),13;A:for(;;){E=0|tt(0|(u=0|n[(i=N)>>2]),0|(i=0|n[i+4>>2]),52),B(),Q=(E&=15)-1|0,D=!!(0|E),C=(0|r)>0|!(0|r)&t>>>0>0;e:do{if(D&C){if(w=0|rt(0|Q,0,52),x=0|B(),Q>>>0>15){if(!(!(0|u)&!(0|i))){S=16;break A}for(a=0,A=0;;){if(a=0|Ve(0|a,0|A,1,0),!((0|(A=0|B()))<(0|r)|(0|A)==(0|r)&a>>>0>>0))break e;if(!(!(0|(k=0|n[(s=N+(a<<3)|0)>>2]))&!(0|(s=0|n[s+4>>2])))){i=s,S=16;break A}}}for(l=u,A=i,a=0,s=0;;){if(!(!(0|l)&!(0|A))){if(!(!0&!(117440512&A))){S=21;break A}if(f=0|tt(0|l,0|A,52),B(),(0|(f&=15))<(0|Q)){i=12,S=27;break A}if((0|f)!=(0|Q)&&(l|=w,A=-15728641&A|x,f>>>0>=E>>>0)){c=Q;do{k=0|rt(7,0,3*(14-c|0)|0),c=c+1|0,l|=k,A=0|B()|A}while(c>>>0>>0)}if(g=0|At(0|l,0|A,0|t,0|r),h=0|B(),!(!(0|(d=0|n[(f=c=j+(g<<3)|0)>>2]))&!(0|(f=0|n[f+4>>2])))){p=0,v=0;do{if((0|p)>(0|r)|(0|p)==(0|r)&v>>>0>t>>>0){S=31;break A}if((0|d)==(0|l)&(-117440513&f)==(0|A)){m=0|tt(0|d,0|f,56),B(),b=1+(m&=7)|0,k=0|tt(0|d,0|f,45),B();t:do{if(0|z(127&k)){if(d=0|tt(0|d,0|f,52),B(),!(d&=15)){f=6;break}for(f=1;;){if(!(!((k=0|rt(7,0,3*(15-f|0)|0))&l)&!((0|B())&A))){f=7;break t}if(!(f>>>0>>0)){f=6;break}f=f+1|0}}else f=7}while(0);if((m+2|0)>>>0>f>>>0){S=41;break A}k=0|rt(0|b,0,56),A=B()|-117440513&A,n[(y=c)>>2]=0,n[y+4>>2]=0,l|=k}else g=0|$e(0|(g=0|Ve(0|g,0|h,1,0)),0|B(),0|t,0|r),h=0|B();v=0|Ve(0|v,0|p,1,0),p=0|B(),d=0|n[(f=c=j+(g<<3)|0)>>2],f=0|n[f+4>>2]}while(!(!(0|d)&!(0|f)))}n[(k=c)>>2]=l,n[k+4>>2]=A}if(a=0|Ve(0|a,0|s,1,0),!((0|(s=0|B()))<(0|r)|(0|s)==(0|r)&a>>>0>>0))break e;l=0|n[(A=N+(a<<3)|0)>>2],A=0|n[A+4>>2]}}}while(0);if(k=0|Ve(0|t,0|r,5,0),(y=0|B())>>>0<0|!(0|y)&k>>>0<11){S=85;break}if(k=0|Xe(0|t,0|r,6,0),B(),!(k=0|We(k,8))){S=48;break}do{if(C){for(b=0,A=0,m=0,p=0;;){if(!(0|(a=0|n[(s=f=j+(b<<3)|0)>>2]))&!(0|(s=0|n[s+4>>2])))y=m;else{d=0|tt(0|a,0|s,56),B(),l=1+(d&=7)|0,g=-117440513&s,y=0|tt(0|a,0|s,45),B();e:do{if(0|z(127&y)){if(h=0|tt(0|a,0|s,52),B(),0|(h&=15))for(c=1;;){if(!(!(a&(y=0|rt(7,0,3*(15-c|0)|0)))&!(g&(0|B()))))break e;if(!(c>>>0>>0))break;c=c+1|0}a|=s=0|rt(0|l,0,56),s=0|B()|g,n[(l=f)>>2]=a,n[l+4>>2]=s,l=d+2|0}}while(0);7==(0|l)?(n[(y=k+(A<<3)|0)>>2]=a,n[y+4>>2]=-117440513&s,A=0|Ve(0|A,0|m,1,0),y=0|B()):y=m}if(b=0|Ve(0|b,0|p,1,0),!((0|(p=0|B()))<(0|r)|(0|p)==(0|r)&b>>>0>>0))break;m=y}if(C){if(v=Q>>>0>15,w=0|rt(0|Q,0,52),x=0|B(),!D){for(a=0,c=0,l=0,s=0;!(0|u)&!(0|i)||(n[(Q=e+(a<<3)|0)>>2]=u,n[Q+4>>2]=i,a=0|Ve(0|a,0|c,1,0),c=0|B()),l=0|Ve(0|l,0|s,1,0),(0|(s=0|B()))<(0|r)|(0|s)==(0|r)&l>>>0>>0;)u=0|n[(i=N+(l<<3)|0)>>2],i=0|n[i+4>>2];i=y;break}for(a=0,c=0,s=0,l=0;;){do{if(!(!(0|u)&!(0|i))){if(h=0|tt(0|u,0|i,52),B(),v|(0|(h&=15))<(0|Q)){S=80;break A}if((0|h)!=(0|Q)){if(f=u|w,d=-15728641&i|x,h>>>0>=E>>>0){g=Q;do{D=0|rt(7,0,3*(14-g|0)|0),g=g+1|0,f|=D,d=0|B()|d}while(g>>>0>>0)}}else f=u,d=i;m=0|At(0|f,0|d,0|t,0|r),g=0,h=0,p=0|B();do{if((0|g)>(0|r)|(0|g)==(0|r)&h>>>0>t>>>0){S=81;break A}if((-117440513&(b=0|n[4+(D=j+(m<<3)|0)>>2]))==(0|d)&&(0|n[D>>2])==(0|f)){S=65;break}m=0|$e(0|(D=0|Ve(0|m,0|p,1,0)),0|B(),0|t,0|r),p=0|B(),h=0|Ve(0|h,0|g,1,0),g=0|B(),D=j+(m<<3)|0}while((0|n[D>>2])!=(0|f)||(0|n[D+4>>2])!=(0|d));if(65==(0|S)&&(S=0,!0&100663296==(117440512&b)))break;n[(D=e+(a<<3)|0)>>2]=u,n[D+4>>2]=i,a=0|Ve(0|a,0|c,1,0),c=0|B()}}while(0);if(s=0|Ve(0|s,0|l,1,0),!((0|(l=0|B()))<(0|r)|(0|l)==(0|r)&s>>>0>>0))break;u=0|n[(i=N+(s<<3)|0)>>2],i=0|n[i+4>>2]}i=y}else a=0,i=y}else a=0,A=0,i=0}while(0);if(lt(0|j,0,0|o),st(0|N,0|k,A<<3),Ye(k),!(0|A)&!(0|i)){S=89;break}e=e+(a<<3)|0,r=i,t=A}if(16==(0|S))!0&!(117440512&i)?(i=4,S=27):S=21;else if(31==(0|S))M(27795,27122,620,27132);else{if(41==(0|S))return Ye(N),Ye(j),10;if(48==(0|S))return Ye(N),Ye(j),13;80==(0|S)?M(27795,27122,711,27132):81==(0|S)?M(27795,27122,723,27132):85==(0|S)&&(st(0|e,0|N,t<<3),S=89)}return 21==(0|S)?(Ye(N),Ye(j),0|(S=5)):27==(0|S)?(Ye(N),Ye(j),0|(S=i)):89==(0|S)?(Ye(N),Ye(j),0|(S=0)):0},_constructCell:function(A,e,t,o){t|=0,o|=0;var i=0,a=0,s=0,l=0,c=0,u=0;if((A|=0)>>>0>15)return 4;if((e|=0)>>>0>121)return 17;s=0|rt(0|A,0,52),i=0|B(),l=0|rt(0|e,0,45),i=0|i|B()|134225919;A:do{if((0|A)>=1){for(l=1,s=!!(0|r[20528+e|0]),a=-1;;){if((e=0|n[t+(l+-1<<2)>>2])>>>0>6){i=18,e=10;break}if(!(!(0|e)|1^s)){if(1==(0|e)){i=19,e=10;break}s=0}if(c=0|rt(7,0,0|(u=3*(15-l|0)|0)),i&=~B(),a=(e=0|rt(0|e,((0|e)<0)<<31>>31,0|u))|a&~c,i=0|B()|i,!((0|l)<(0|A)))break A;l=l+1|0}if(10==(0|e))return 0|i}else a=-1}while(0);return n[(u=o)>>2]=a,n[u+4>>2]=i,0},_destroyLinkedMultiPolygon:ge,_directedEdgeToBoundary:DA,_directedEdgeToCells:function(A,e,t){A|=0;var r,o,i,a=0;return r=S,S=S+16|0,a=r,!0&268435456==(2013265920&(e|=0))?(o=-2130706433&e|134217728,n[(i=t|=0)>>2]=A,n[i+4>>2]=o,n[a>>2]=0,e=0|tt(0|A,0|e,56),B(),a=0|I(A,o,7&e,a,t+8|0),S=r,0|a):(S=r,0|(a=6))},_edgeLengthKm:function(A,e,t){t|=0;var r,i=0,a=0,s=0,l=0,u=0,g=0,h=0;if(r=S,S=S+176|0,0|(A=0|DA(A|=0,e|=0,l=r)))return l=A,s=+o[t>>3],s*=6371.007180918475,o[t>>3]=s,S=r,0|l;if(o[t>>3]=0,(0|(A=0|n[l>>2]))<=1)return l=0,s=0,s*=6371.007180918475,o[t>>3]=s,S=r,0|l;e=A+-1|0,A=0,i=+o[l+8>>3],a=+o[l+16>>3],s=0;do{g=i,i=+o[l+8+((A=A+1|0)<<4)>>3],h=+d(.5*(i-g)),u=a,a=+o[l+8+(A<<4)+8>>3],u=h*h+(u=+d(.5*(a-u)))*(+f(+g)*+f(+i)*u),s+=2*+p(+ +c(+u),+ +c(+(1-u)))}while((0|A)!=(0|e));return o[t>>3]=s,l=0,h=s,h*=6371.007180918475,o[t>>3]=h,S=r,0|l},_edgeLengthM:function(A,e,t){t|=0;var r,i=0,a=0,s=0,l=0,u=0,g=0,h=0;if(r=S,S=S+176|0,0|(A=0|DA(A|=0,e|=0,l=r)))return l=A,s=+o[t>>3],s*=6371.007180918475,s*=1e3,o[t>>3]=s,S=r,0|l;if(o[t>>3]=0,(0|(A=0|n[l>>2]))<=1)return l=0,s=0,s*=6371.007180918475,s*=1e3,o[t>>3]=s,S=r,0|l;e=A+-1|0,A=0,i=+o[l+8>>3],a=+o[l+16>>3],s=0;do{g=i,i=+o[l+8+((A=A+1|0)<<4)>>3],h=+d(.5*(i-g)),u=a,a=+o[l+8+(A<<4)+8>>3],u=h*h+(u=+d(.5*(a-u)))*(+f(+g)*+f(+i)*u),s+=2*+p(+ +c(+u),+ +c(+(1-u)))}while((0|A)!=(0|e));return o[t>>3]=s,l=0,h=s,h*=6371.007180918475,h*=1e3,o[t>>3]=h,S=r,0|l},_edgeLengthRads:function(A,e,t){t|=0;var r,i=0,a=0,s=0,l=0,u=0,g=0,h=0;if(r=S,S=S+176|0,0|(A=0|DA(A|=0,e|=0,l=r)))return S=r,0|A;if(o[t>>3]=0,(0|(A=0|n[l>>2]))<=1)return S=r,0;e=A+-1|0,A=0,i=+o[l+8>>3],a=+o[l+16>>3],s=0;do{g=i,i=+o[l+8+((A=A+1|0)<<4)>>3],h=+d(.5*(i-g)),u=a,a=+o[l+8+(A<<4)+8>>3],u=h*h+(u=+d(.5*(a-u)))*(+f(+i)*+f(+g)*u),s+=2*+p(+ +c(+u),+ +c(+(1-u)))}while((0|A)<(0|e));return o[t>>3]=s,S=r,0},_emscripten_replace_memory:function(A){return r=new Int8Array(A),n=new Int32Array(A),o=new Float64Array(A),t=A,!0},_free:Ye,_getBaseCellNumber:TA,_getDirectedEdgeDestination:function(A,e,t){A|=0,e|=0,t|=0;var r,o,i=0;return r=S,S=S+16|0,n[(i=r)>>2]=0,!0&268435456==(2013265920&e)?(o=0|tt(0|A,0|e,56),B(),i=0|I(A,-2130706433&e|134217728,7&o,i,t),S=r,0|i):(S=r,0|(i=6))},_getDirectedEdgeOrigin:function(A,e,t){return A|=0,t|=0,!0&268435456==(2013265920&(e|=0))?(n[t>>2]=A,n[t+4>>2]=-2130706433&e|134217728,0|(t=0)):0|(t=6)},_getHexagonAreaAvgKm2:se,_getHexagonAreaAvgM2:function(A,e){return e|=0,(A|=0)>>>0>15?0|(e=4):(o[e>>3]=+o[20784+(A<<3)>>3],0|(e=0))},_getHexagonEdgeLengthAvgKm:function(A,e){return e|=0,(A|=0)>>>0>15?0|(e=4):(o[e>>3]=+o[20912+(A<<3)>>3],0|(e=0))},_getHexagonEdgeLengthAvgM:function(A,e){return e|=0,(A|=0)>>>0>15?0|(e=4):(o[e>>3]=+o[21040+(A<<3)>>3],0|(e=0))},_getIcosahedronFaces:function A(e,t,r){r|=0;var o,i=0,a=0,s=0,l=0,c=0,u=0,f=0,d=0;o=S,S=S+128|0,f=o+112|0,s=o+96|0,d=o,a=0|tt(0|(e|=0),0|(t|=0),52),B(),c=15&a,n[f>>2]=c,l=0|tt(0|e,0|t,45),B(),l&=127;A:do{if(0|z(l)){if(0|c)for(i=1;;){if(!(!((u=0|rt(7,0,3*(15-i|0)|0))&e)&!((0|B())&t))){a=0;break A}if(!(i>>>0>>0))break;i=i+1|0}if(!(1&a))return u=0|rt(c+1|0,0,52),d=B()|-15728641&t,d=0|A((u|e)&~(f=0|rt(7,0,3*(14-c|0)|0)),d&~B(),r),S=o,0|d;a=1}else a=0}while(0);if(!(i=0|XA(e,t,s))){a?(jA(s,f,d),u=5):(PA(s,f,d),u=6);A:do{if(0|z(l))if(c)for(i=1;;){if(!(!((l=0|rt(7,0,3*(15-i|0)|0))&e)&!((0|B())&t))){e=2;break A}if(!(i>>>0>>0)){e=5;break}i=i+1|0}else e=5;else e=2}while(0);lt(0|r,-1,e<<2);A:do{if(a)for(s=0;;){if(SA(l=d+(s<<4)|0,0|n[f>>2]),l=0|n[l>>2],-1==(0|(c=0|n[r>>2]))|(0|c)==(0|l))i=r;else{a=0;do{if((a=a+1|0)>>>0>=e>>>0){i=1;break A}c=0|n[(i=r+(a<<2)|0)>>2]}while(!(-1==(0|c)|(0|c)==(0|l)))}if(n[i>>2]=l,(s=s+1|0)>>>0>=u>>>0){i=0;break}}else for(s=0;;){if(NA(l=d+(s<<4)|0,0|n[f>>2],0,1),l=0|n[l>>2],-1==(0|(c=0|n[r>>2]))|(0|c)==(0|l))i=r;else{a=0;do{if((a=a+1|0)>>>0>=e>>>0){i=1;break A}c=0|n[(i=r+(a<<2)|0)>>2]}while(!(-1==(0|c)|(0|c)==(0|l)))}if(n[i>>2]=l,(s=s+1|0)>>>0>=u>>>0){i=0;break}}}while(0)}return S=o,0|i},_getIndexDigit:function(A,e,t,r){return r|=0,((t|=0)-1|0)>>>0>14?0|(r=4):(t=0|tt(0|(A|=0),0|(e|=0),3*(15-t|0)|0),B(),n[r>>2]=7&t,0|(r=0))},_getNumCells:le,_getPentagons:Ae,_getRes0Cells:function(A){A|=0;var e=0,t=0,r=0;e=0;do{rt(0|e,0,45),r=134225919|B(),n[(t=A+(e<<3)|0)>>2]=-1,n[t+4>>2]=r,e=e+1|0}while(122!=(0|e));return 0},_getResolution:function(A,e){return e=0|tt(0|(A|=0),0|(e|=0),52),B(),15&e},_greatCircleDistanceKm:ae,_greatCircleDistanceM:function(A,e){A|=0;var t,r,n,i=0;return r=+o[(e|=0)>>3],t=+o[A>>3],i=(n=+d(.5*(r-t)))*n+(i=+d(.5*(+o[e+8>>3]-+o[A+8>>3])))*(+f(+r)*+f(+t)*i),2*+p(+ +c(+i),+ +c(+(1-i)))*6371.007180918475*1e3},_greatCircleDistanceRads:function(A,e){A|=0;var t,r,n,i=0;return r=+o[(e|=0)>>3],t=+o[A>>3],i=(n=+d(.5*(r-t)))*n+(i=+d(.5*(+o[e+8>>3]-+o[A+8>>3])))*(+f(+r)*+f(+t)*i),2*+p(+ +c(+i),+ +c(+(1-i)))},_gridDisk:F,_gridDiskDistances:P,_gridDistance:function(A,e,t,r,o){t|=0,r|=0,o|=0;var i,a,s=0,l=0;return a=S,S=S+32|0,l=a,0|(i=0|me(A|=0,e|=0,A,e,s=a+12|0))?(S=a,0|(l=i)):0|(A=0|me(A,e,t,r,l))?(S=a,0|(l=A)):(s=0|kA(s,l),n[(l=o)>>2]=s,n[l+4>>2]=((0|s)<0)<<31>>31,S=a,0|(l=0))},_gridPathCells:function(A,e,t,r,o){t|=0,r|=0,o|=0;var i,a,s=0,c=0,u=0,f=0,d=0,g=0,h=0,m=0,b=0,p=0,v=0,w=0,x=0,y=0,k=0,C=0,D=0,E=0;if(a=S,S=S+48|0,c=a+12|0,D=a,!(s=0|me(A|=0,e|=0,A,e,i=a+24|0))&&!(s=0|me(A,e,t,r,c))){C=((0|(k=0|kA(i,c)))<0)<<31>>31,n[i>>2]=0,n[i+4>>2]=0,n[i+8>>2]=0,n[c>>2]=0,n[c+4>>2]=0,n[c+8>>2]=0,0|me(A,e,A,e,i)&&M(27795,27538,692,27747),0|me(A,e,t,r,c)&&M(27795,27538,697,27747),CA(i),CA(c),g=0|k?1/+(0|k):0,t=0|n[i>>2],v=g*+((0|n[c>>2])-t|0),r=0|n[(w=i+4|0)>>2],x=g*+((0|n[c+4>>2])-r|0),s=0|n[(y=i+8|0)>>2],g*=+((0|n[c+8>>2])-s|0),n[D>>2]=t,n[(h=D+4|0)>>2]=r,n[(m=D+8|0)>>2]=s;A:do{if((0|k)<0)s=0;else for(b=0,p=0;;){E=v*(f=+(p>>>0)+4294967296*+(0|b))+ +(0|t),u=x*f+ +(0|r),f=g*f+ +(0|s),t=~~+at(+E),c=~~+at(+u),s=~~+at(+f),E=+l(+(+(0|t)-E)),u=+l(+(+(0|c)-u)),f=+l(+(+(0|s)-f));do{if(!(E>u&E>f)){if(d=0-t|0,u>f){r=d-s|0;break}r=c,s=d-c|0;break}t=0-(c+s)|0,r=c}while(0);if(n[D>>2]=t,n[h>>2]=r,n[m>>2]=s,BA(D),0|(s=0|be(A,e,D,o+(p<<3)|0)))break A;if(!((0|b)<(0|C)|(0|b)==(0|C)&p>>>0>>0)){s=0;break A}t=0|Ve(0|p,0|b,1,0),b=r=0|B(),p=t,t=0|n[i>>2],r=0|n[w>>2],s=0|n[y>>2]}}while(0);return S=a,0|s}return S=a,0|s},_gridPathCellsSize:function(A,e,t,r,o){t|=0,r|=0,o|=0;var i,a=0,s=0,l=0;return i=S,S=S+32|0,l=i,(a=0|me(A|=0,e|=0,A,e,s=i+12|0))||(a=0|me(A,e,t,r,l))?(S=i,0|(l=a)):(r=0|Ve(0|(r=0|kA(s,l)),((0|r)<0)<<31>>31,1,0),s=0|B(),n[(l=o)>>2]=r,n[l+4>>2]=s,S=i,0|(l=0))},_gridRing:function(A,e,t,r){return 0|R(A|=0,e|=0,t|=0,r|=0)?(lt(0|r,0,48*t|0),0|(r=0|function(A,e,t,r){A|=0,e|=0,r|=0;var o,i=0,a=0,s=0,l=0,c=0,u=0,f=0,d=0;if(o=S,S=S+16|0,s=o,!(t|=0))return n[r>>2]=A,n[r+4>>2]=e,S=o,0;do{if((0|t)>=0){if((0|t)>13780509){if(0|(i=0|le(15,s)))break;i=0|n[(a=s)>>2],a=0|n[a+4>>2]}else f=0|qe(0|t,0|(i=((0|t)<0)<<31>>31),3,0),a=0|B(),i=0|Ve(0|t,0|i,1,0),i=0|Ve(0|(i=0|qe(0|f,0|a,0|i,0|B())),0|B(),1,0),a=0|B(),n[(f=s)>>2]=i,n[f+4>>2]=a;if(u=0|We(i,8)){if(!(f=0|We(i,4))){Ye(u),i=13;break}if(0|(i=0|L(A,e,t,u,f,i,a,0))){Ye(u),Ye(f);break}if(e=0|n[s>>2],(0|(s=0|n[s+4>>2]))>0|!(0|s)&e>>>0>0){i=0,l=0,c=0;do{!(0|(a=0|n[(A=u+(l<<3)|0)>>2]))&!(0|(A=0|n[A+4>>2]))||(0|n[f+(l<<2)>>2])!=(0|t)||(n[(d=r+(i<<3)|0)>>2]=a,n[d+4>>2]=A,i=i+1|0),l=0|Ve(0|l,0|c,1,0),c=0|B()}while((0|c)<(0|s)|(0|c)==(0|s)&l>>>0>>0)}Ye(u),Ye(f),i=0}else i=13}else i=2}while(0);return S=o,0|i}(A,e,t,r))):0|(r=0)},_gridRingUnsafe:R,_i64Add:Ve,_i64Subtract:Ze,_isPentagon:HA,_isResClassIII:function(A,e){return e=0|tt(0|(A|=0),0|(e|=0),52),B(),1&e},_isValidCell:LA,_isValidDirectedEdge:MA,_isValidIndex:function(A,e){A|=0;var t=0,n=0,o=0,i=0;if(!0&134217728==(-16777216&(e|=0))&&(n=0|tt(0|A,0|e,52),B(),n&=15,t=0|tt(0|A,0|e,45),B(),(t&=127)>>>0<=121)&&!(613566756&(i=0|rt(0|(o=0|tt(0|A,0|e,0|(i=3*(15^n)|0))),0|B(),0|i))&Ze(-1227133514,-1171,0|i,0|(o=0|B())))&!(4681&o&B())&&15==(0|n)|!(0|(i=0|tt(0|rt(0|~A,0|~e,0|(i=19+(3*n|0)|0)),0|B(),0|i)))&!(0|B())){if(!(0|r[20528+t|0]))return 1;if(!(0|A)&!(0|(t=8191&e)))return 1;if(i=0|nt(0|A,0|t),B(),(63-i|0)%3|0)return 1}return 0|MA(A,e)?0|(i=1):0|(i=1&!!(0|Te(A,e)))},_isValidVertex:Te,_latLngToCell:KA,_llvm_ctlz_i64:nt,_llvm_maxnum_f64:ot,_llvm_minnum_f64:it,_llvm_round_f64:at,_localIjToCell:function(A,e,t,r,o){var i,a;return A|=0,e|=0,t|=0,o|=0,a=S,S=S+16|0,i=a,(r|=0)?t=15:(t=0|function(A,e){e|=0;var t,r,o,i=0,a=0,s=0;if(a=0|n[(A|=0)>>2],n[e>>2]=a,s=0|n[A+4>>2],n[(r=e+4|0)>>2]=s,n[(o=e+8|0)>>2]=0,A=(i=(0|s)<(0|a))?a:s,(0|(i=i?s:a))<0){if(-2147483648==(0|i)||((0|A)>0?(2147483647-A|0)<(0|i):(-2147483648-A|0)>(0|i)))return 1;if((0|A)>-1?(-2147483648|A)>=(0|i):(-2147483648^A)<(0|i))return 1}return A=s-a|0,(0|a)<0?(i=0-a|0,n[r>>2]=A,n[o>>2]=i,n[e>>2]=0,a=0):(A=s,i=0),(0|A)<0&&(a=a-A|0,n[e>>2]=a,i=i-A|0,n[o>>2]=i,n[r>>2]=0,A=0),t=a-i|0,s=A-i|0,(0|i)<0?(n[e>>2]=t,n[r>>2]=s,n[o>>2]=0,A=s,s=t,i=0):s=a,(0|(a=(0|i)<(0|(a=(0|A)<(0|s)?A:s))?i:a))<=0||(n[e>>2]=s-a,n[r>>2]=A-a,n[o>>2]=i-a),0}(t,i))||(t=0|be(A,e,i,o)),S=a,0|t},_malloc:Ue,_maxFaceCount:function(A,e,t){t|=0;var r=0,o=0;if(o=0|tt(0|(A|=0),0|(e|=0),45),B(),!(0|z(127&o)))return o=2,n[t>>2]=o,0;if(o=0|tt(0|A,0|e,52),B(),!(o&=15))return o=5,n[t>>2]=o,0;for(r=1;;){if(!(!((0|rt(7,0,3*(15-r|0)|0))&A)&!((0|B())&e))){r=2,A=6;break}if(!(r>>>0>>0)){r=5,A=6;break}r=r+1|0}return 6==(0|A)?(n[t>>2]=r,0):0},_maxGridDiskSize:function(A,e){e|=0;var t=0,r=0,o=0;return(0|(A|=0))<0?0|(e=2):(0|A)>13780509?0|(e=0|le(15,e)):(o=0|qe(0|A,0|(t=((0|A)<0)<<31>>31),3,0),r=0|B(),t=0|Ve(0|A,0|t,1,0),t=0|Ve(0|(t=0|qe(0|o,0|r,0|t,0|B())),0|B(),1,0),A=0|B(),n[e>>2]=t,n[e+4>>2]=A,0|(e=0))},_maxPolygonToCellsSize:function(A,e,t,r){A|=0,e|=0,r|=0;var o,i=0,a=0,s=0,l=0,c=0;if(o=S,S=S+48|0,i=o+16|0,a=o+8|0,s=o,0|(t=0|Ce(t|=0)))return S=o,0|t;if(l=0|n[(c=A)+4>>2],n[(t=a)>>2]=n[c>>2],n[t+4>>2]=l,ke(a,i),!(t=0|eA(i,e,s))){if(e=0|n[a>>2],(0|(a=0|n[A+8>>2]))>0){i=0|n[A+12>>2],t=0;do{e=(0|n[i+(t<<3)>>2])+e|0,t=t+1|0}while((0|t)<(0|a))}i=0|n[(t=s)>>2],(0|(t=0|n[t+4>>2]))<(0|(a=((0|e)<0)<<31>>31))|(0|t)==(0|a)&i>>>0>>0?(n[(t=s)>>2]=e,n[t+4>>2]=a,t=a):e=i,l=0|Ve(0|e,0|t,12,0),c=0|B(),n[(t=s)>>2]=l,n[t+4>>2]=c,n[(t=r)>>2]=l,n[t+4>>2]=c,t=0}return S=o,0|t},_maxPolygonToCellsSizeExperimental:function(A,e,t,i){e|=0,t|=0,i|=0;var a,s,c=0,u=0,d=0,g=0,h=0,m=0,b=0,p=0;if(s=S,S=S+48|0,h=s+32|0,g=s+40|0,a=s,!(0|n[(A|=0)>>2]))return n[(m=i)>>2]=0,n[m+4>>2]=0,S=s,0;IA(h,0,0,0),c=0|n[(d=h)>>2],d=0|n[d+4>>2];do{if(e>>>0>15)n[(m=a)>>2]=0,n[m+4>>2]=0,n[a+8>>2]=4,n[a+12>>2]=-1,t=a+29|0,n[(m=a+16|0)>>2]=0,n[m+4>>2]=0,n[m+8>>2]=0,r[m+12|0]=0,r[0|t]=0|r[0|g],r[t+1|0]=0|r[g+1|0],r[t+2|0]=0|r[g+2|0],t=4,m=9;else{if(0|(t=0|Ce(t))){n[(h=a)>>2]=0,n[h+4>>2]=0,n[a+8>>2]=t,n[a+12>>2]=-1,m=a+29|0,n[(h=a+16|0)>>2]=0,n[h+4>>2]=0,n[h+8>>2]=0,r[h+12|0]=0,r[0|m]=0|r[0|g],r[m+1|0]=0|r[g+1|0],r[m+2|0]=0|r[g+2|0],m=9;break}if(!(t=0|We(1+(0|n[A+8>>2])|0,32))){n[(m=a)>>2]=0,n[m+4>>2]=0,n[a+8>>2]=13,n[a+12>>2]=-1,t=a+29|0,n[(m=a+16|0)>>2]=0,n[m+4>>2]=0,n[m+8>>2]=0,r[m+12|0]=0,r[0|t]=0|r[0|g],r[t+1|0]=0|r[g+1|0],r[t+2|0]=0|r[g+2|0],t=13,m=9;break}Be(A,t),n[(p=a)>>2]=c,n[p+4>>2]=d,n[(d=a+8|0)>>2]=0,n[a+12>>2]=e,n[a+20>>2]=A,n[a+24>>2]=t,r[a+28|0]=0,r[0|(c=a+29|0)]=0|r[0|g],r[c+1|0]=0|r[g+1|0],r[c+2|0]=0|r[g+2|0],n[a+16>>2]=3,b=+J(t),b*=+Z(t),u=+l(+ +o[t>>3]),u=b/+f(+ +it(+u,+ +l(+ +o[t+8>>3])))*6371.007180918475*6371.007180918475,t=0|n[(c=a+12|0)>>2];A:do{if((0|t)>0)do{if(se(t+-1|0,h),!(u/+o[h>>3]>10))break A;t=(p=0|n[c>>2])-1|0,n[c>>2]=t}while((0|p)>1)}while(0);if(we(a),n[(c=i)>>2]=0,n[c+4>>2]=0,!(!(0|(t=0|n[(c=a)>>2]))&!(0|(c=0|n[c+4>>2]))))do{_A(t,c,e,h),g=h,g=0|Ve(0|n[(A=i)>>2],0|n[A+4>>2],0|n[g>>2],0|n[g+4>>2]),A=0|B(),n[(p=i)>>2]=g,n[p+4>>2]=A,we(a),t=0|n[(p=a)>>2],c=0|n[p+4>>2]}while(!(!(0|t)&!(0|c)));t=0|n[d>>2]}}while(0);return S=s,0|t},_memcpy:st,_memset:lt,_originToDirectedEdges:function(A,e,t){t|=0;var r,o=0;return r=!(0|HA(A|=0,e|=0)),e&=-2130706433,n[(o=t)>>2]=r?A:0,n[o+4>>2]=r?285212672|e:0,n[(o=t+8|0)>>2]=A,n[o+4>>2]=301989888|e,n[(o=t+16|0)>>2]=A,n[o+4>>2]=318767104|e,n[(o=t+24|0)>>2]=A,n[o+4>>2]=335544320|e,n[(o=t+32|0)>>2]=A,n[o+4>>2]=352321536|e,n[(t=t+40|0)>>2]=A,n[t+4>>2]=369098752|e,0},_pentagonCount:function(){return 12},_polygonToCells:function(A,e,t,r){A|=0,e|=0,r|=0;var o,i,a,s,l=0,c=0,u=0,f=0,d=0,g=0,h=0,m=0,b=0,p=0,v=0,w=0,x=0,y=0,k=0,C=0,M=0,D=0,E=0,Q=0,j=0,N=0,F=0,P=0,I=0,R=0,_=0;if(s=S,S=S+112|0,o=s+80|0,d=s+72|0,i=s,a=s+56|0,0|(l=0|Ce(t|=0)))return S=s,0|l;if(!(_=0|Ue(32+(n[(g=A+8|0)>>2]<<5)|0)))return S=s,13;if(Be(A,_),!(l=0|Ce(t))){if(R=0|n[(I=A)+4>>2],n[(l=d)>>2]=n[I>>2],n[l+4>>2]=R,ke(d,o),l=0|eA(o,e,i))I=0,R=0;else{if(l=0|n[d>>2],(0|(c=0|n[g>>2]))>0){u=0|n[A+12>>2],t=0;do{l=(0|n[u+(t<<3)>>2])+l|0,t=t+1|0}while((0|t)!=(0|c));t=l}else t=l;c=0|n[(l=i)>>2],(0|(l=0|n[l+4>>2]))<(0|(u=((0|t)<0)<<31>>31))|(0|l)==(0|u)&c>>>0>>0?(n[(l=i)>>2]=t,n[l+4>>2]=u,l=u):t=c,I=0|Ve(0|t,0|l,12,0),R=0|B(),n[(l=i)>>2]=I,n[l+4>>2]=R,l=0}if(!l){if(!(t=0|We(I,8)))return Ye(_),S=s,13;if(!(f=0|We(I,8)))return Ye(_),Ye(t),S=s,13;n[(F=o)>>2]=0,n[F+4>>2]=0,P=0|n[(F=A)+4>>2],n[(l=d)>>2]=n[F>>2],n[l+4>>2]=P,l=0|H(d,I,R,e,o,t,f);A:do{if(l)Ye(t),Ye(f),Ye(_);else{e:do{if((0|n[g>>2])>0){for(u=A+12|0,c=0;l=0|H((0|n[u>>2])+(c<<3)|0,I,R,e,o,t,f),c=c+1|0,!(0|l);)if((0|c)>=(0|n[g>>2]))break e;Ye(t),Ye(f),Ye(_);break A}}while(0);(0|R)>0|!(0|R)&I>>>0>0&<(0|f,0,I<<3),F=0|n[(P=o)+4>>2];e:do{if((0|F)>0|!(0|F)&(0|n[P>>2])>>>0>0){Q=t,j=f,N=t,F=f,P=t,l=t,M=t,D=f,E=f,t=f;t:for(;;){for(x=0,y=0,k=0,C=0,c=0,u=0;;){d=(f=i)+56|0;do{n[f>>2]=0,f=f+4|0}while((0|f)<(0|d));if(0|T(g=0|n[(e=Q+(x<<3)|0)>>2],e=0|n[e+4>>2],1,i,0)){d=(f=i)+56|0;do{n[f>>2]=0,f=f+4|0}while((0|f)<(0|d));0|(f=0|We(7,4))&&(L(g,e,1,i,f,7,0,0),Ye(f))}for(w=0;;){p=0|n[(v=i+(w<<3)|0)>>2],v=0|n[v+4>>2];r:do{if(!(0|p)&!(0|v))f=c,d=u;else{if(h=0|At(0|p,0|v,0|I,0|R),g=0|B(),!(!(0|(d=0|n[(e=f=r+(h<<3)|0)>>2]))&!(0|(e=0|n[e+4>>2])))){m=0,b=0;do{if((0|m)>(0|R)|(0|m)==(0|R)&b>>>0>I>>>0)break t;if((0|d)==(0|p)&(0|e)==(0|v)){f=c,d=u;break r}h=0|$e(0|(f=0|Ve(0|h,0|g,1,0)),0|B(),0|I,0|R),g=0|B(),b=0|Ve(0|b,0|m,1,0),m=0|B(),d=0|n[(e=f=r+(h<<3)|0)>>2],e=0|n[e+4>>2]}while(!(!(0|d)&!(0|e)))}if(!(0|p)&!(0|v)){f=c,d=u;break}qA(p,v,a),0|Me(A,_,a)&&(b=0|Ve(0|c,0|u,1,0),u=0|B(),n[(m=f)>>2]=p,n[m+4>>2]=v,n[(c=j+(c<<3)|0)>>2]=p,n[c+4>>2]=v,c=b),f=c,d=u}}while(0);if((w=w+1|0)>>>0>=7)break;c=f,u=d}if(x=0|Ve(0|x,0|y,1,0),y=0|B(),k=0|Ve(0|k,0|C,1,0),C=0|B(),c=0|n[(u=o)>>2],!((0|C)<(0|(u=0|n[u+4>>2]))|(0|C)==(0|u)&k>>>0>>0))break;c=f,u=d}if((0|u)>0|!(0|u)&c>>>0>0){c=0,u=0;do{n[(C=Q+(c<<3)|0)>>2]=0,n[C+4>>2]=0,c=0|Ve(0|c,0|u,1,0),u=0|B(),k=0|n[(C=o)+4>>2]}while((0|u)<(0|k)|((0|u)==(0|k)?c>>>0<(0|n[C>>2])>>>0:0))}if(n[(C=o)>>2]=f,n[C+4>>2]=d,!((0|d)>0|!(0|d)&f>>>0>0))break e;w=t,x=E,y=P,k=D,C=j,t=M,E=l,D=N,M=w,l=x,P=F,F=y,N=k,j=Q,Q=C}Ye(N),Ye(F),Ye(_),l=1;break A}l=f}while(0);Ye(_),Ye(t),Ye(l),l=0}}while(0);return S=s,0|l}}return Ye(_),S=s,0|l},_polygonToCellsExperimental:function(A,e,t,o,i,a){o|=0,i|=0,a|=0;var s,l,c,u=0,f=0,d=0,g=0,h=0,m=0,b=0,p=0;c=S,S=S+160|0,f=c+64|0,h=c+112|0,p=c,function(A,e,t,o){A|=0,e|=0,t|=0,o|=0;var i,a,s,l=0,c=0,u=0,f=0;s=S,S=S+48|0,i=s+40|0,a=s,IA(c=s+32|0,0,0,0),u=0|n[c>>2],c=0|n[c+4>>2];do{if(t>>>0<=15){if(0|(l=0|Ce(o))){n[(o=a)>>2]=0,n[o+4>>2]=0,n[a+8>>2]=l,n[a+12>>2]=-1,u=a+29|0,n[(o=a+16|0)>>2]=0,n[o+4>>2]=0,n[o+8>>2]=0,r[o+12|0]=0,r[0|u]=0|r[0|i],r[u+1|0]=0|r[i+1|0],r[u+2|0]=0|r[i+2|0];break}if(l=0|We(1+(0|n[e+8>>2])|0,32)){Be(e,l),n[(f=a)>>2]=u,n[f+4>>2]=c,n[a+8>>2]=0,n[a+12>>2]=t,n[a+16>>2]=o,n[a+20>>2]=e,n[a+24>>2]=l,r[a+28|0]=0,r[0|(u=a+29|0)]=0|r[0|i],r[u+1|0]=0|r[i+1|0],r[u+2|0]=0|r[i+2|0];break}n[(o=a)>>2]=0,n[o+4>>2]=0,n[a+8>>2]=13,n[a+12>>2]=-1,u=a+29|0,n[(o=a+16|0)>>2]=0,n[o+4>>2]=0,n[o+8>>2]=0,r[o+12|0]=0,r[0|u]=0|r[0|i],r[u+1|0]=0|r[i+1|0],r[u+2|0]=0|r[i+2|0];break}n[(u=a)>>2]=0,n[u+4>>2]=0,n[a+8>>2]=4,n[a+12>>2]=-1,f=a+29|0,n[(u=a+16|0)>>2]=0,n[u+4>>2]=0,n[u+8>>2]=0,r[u+12|0]=0,r[0|f]=0|r[0|i],r[f+1|0]=0|r[i+1|0],r[f+2|0]=0|r[i+2|0]}while(0);we(a),n[A>>2]=n[a>>2],n[A+4>>2]=n[a+4>>2],n[A+8>>2]=n[a+8>>2],n[A+12>>2]=n[a+12>>2],n[A+16>>2]=n[a+16>>2],n[A+20>>2]=n[a+20>>2],n[A+24>>2]=n[a+24>>2],n[A+28>>2]=n[a+28>>2],S=s}(g=c+80|0,A|=0,e|=0,t|=0),ee(f,0|n[(d=g)>>2],0|n[d+4>>2],e),s=0|n[(d=f)>>2],d=0|n[d+4>>2],u=0|n[g+8>>2],n[(m=h+4|0)>>2]=n[g>>2],n[m+4>>2]=n[g+4>>2],n[m+8>>2]=n[g+8>>2],n[m+12>>2]=n[g+12>>2],n[m+16>>2]=n[g+16>>2],n[m+20>>2]=n[g+20>>2],n[m+24>>2]=n[g+24>>2],n[m+28>>2]=n[g+28>>2],n[(m=p)>>2]=s,n[m+4>>2]=d,n[(m=p+8|0)>>2]=u,e=h,t=36+(A=p+12|0)|0;do{n[A>>2]=n[e>>2],A=A+4|0,e=e+4|0}while((0|A)<(0|t));if(n[(h=p+48|0)>>2]=n[f>>2],n[h+4>>2]=n[f+4>>2],n[h+8>>2]=n[f+8>>2],n[h+12>>2]=n[f+12>>2],!(0|s)&!(0|d))return S=c,0|u;t=p+16|0,l=p+24|0,g=p+28|0,u=0,f=0,e=s,A=d;do{if(!((0|u)<(0|i)|(0|u)==(0|i)&f>>>0>>0)){b=4;break}if(d=f,f=0|Ve(0|f,0|u,1,0),u=0|B(),n[(d=a+(d<<3)|0)>>2]=e,n[d+4>>2]=A,re(h),!(0|(e=0|n[(A=h)>>2]))&!(0|(A=0|n[A+4>>2]))){if(we(t),!(0|(A=0|n[(e=t)>>2]))&!(0|(e=0|n[e+4>>2]))){b=10;break}te(A,e,0|n[g>>2],h),e=0|n[(A=h)>>2],A=0|n[A+4>>2]}n[(d=p)>>2]=e,n[d+4>>2]=A}while(!(!(0|e)&!(0|A)));return 4==(0|b)?(0|(e=0|n[(A=p+40|0)>>2])&&Ye(e),n[(b=p+16|0)>>2]=0,n[b+4>>2]=0,n[l>>2]=0,n[p+36>>2]=0,n[g>>2]=-1,n[p+32>>2]=0,n[A>>2]=0,te(0,0,0,h),n[p>>2]=0,n[p+4>>2]=0,n[m>>2]=0,S=c,0|(p=14)):(10==(0|b)&&(n[p>>2]=0,n[p+4>>2]=0,n[m>>2]=n[l>>2]),p=0|n[m>>2],S=c,0|p)},_readInt64AsDoubleFromPointer:function(A){return+(+((0|n[(A|=0)>>2])>>>0)+4294967296*+(0|n[A+4>>2]))},_res0CellCount:function(){return 122},_round:ct,_sbrk:ut,_sizeOfCellBoundary:function(){return 168},_sizeOfCoordIJ:function(){return 8},_sizeOfGeoLoop:function(){return 8},_sizeOfGeoPolygon:function(){return 16},_sizeOfH3Index:function(){return 8},_sizeOfLatLng:function(){return 16},_sizeOfLinkedGeoPolygon:function(){return 12},_uncompactCells:function(A,e,t,r,o,i,a){A|=0,r|=0,o|=0,i|=0;var s,l=0,c=0,u=0,f=0,d=0,g=0,h=0,m=0;if(s=S,S=S+16|0,m=s,!((0|(t|=0))>0|!(0|t)&(e|=0)>>>0>0))return S=s,0;if((0|(a|=0))>=16)return S=s,12;g=0,h=0,d=0,l=0;A:for(;;){if(f=0|tt(0|(c=0|n[(u=A+(g<<3)|0)>>2]),0|(u=0|n[u+4>>2]),52),B(),(15&f)>(0|a)){l=12,c=11;break}if(ee(m,c,u,a),!(0|(u=0|n[(f=m)>>2]))&!(0|(f=0|n[f+4>>2])))c=d;else{c=d;do{if(!((0|l)<(0|i)|(0|l)==(0|i)&c>>>0>>0)){c=10;break A}n[(d=r+(c<<3)|0)>>2]=u,n[d+4>>2]=f,c=0|Ve(0|c,0|l,1,0),l=0|B(),re(m),u=0|n[(d=m)>>2],f=0|n[d+4>>2]}while(!(!(0|u)&!(0|f)))}if(g=0|Ve(0|g,0|h,1,0),!((0|(h=0|B()))<(0|t)|(0|h)==(0|t)&g>>>0>>0)){l=0,c=11;break}d=c}return 10==(0|c)?(S=s,0|(m=14)):11==(0|c)?(S=s,0|l):0},_uncompactCellsSize:function(A,e,t,r,o){A|=0,e|=0,t|=0,r|=0,o|=0;var i,a,s=0,l=0,c=0,u=0,f=0,d=0;a=S,S=S+16|0,i=a;A:do{if((0|t)>0|!(0|t)&e>>>0>0){for(f=0,l=0,s=0,d=0;;){if(!(!(0|(c=0|n[(u=A+(f<<3)|0)>>2]))&!(0|(u=0|n[u+4>>2]))||(u=!(0|_A(c,u,r,i)),l=0|Ve(0|n[(c=i)>>2],0|n[c+4>>2],0|l,0|s),s=0|B(),u))){s=12;break}if(f=0|Ve(0|f,0|d,1,0),!((0|(d=0|B()))<(0|t)|(0|d)==(0|t)&f>>>0>>0))break A}return S=a,0|s}l=0,s=0}while(0);return n[o>>2]=l,n[o+4>>2]=s,S=a,0},_vertexToLatLng:function(A,e,t){t|=0;var r,o,i,a,s=0,l=0;return a=S,S=S+192|0,o=a,i=a+168|0,s=0|tt(0|(A|=0),0|(e|=0),56),B(),s&=7,0|(r=0|XA(A,l=-2130706433&e|134217728,i))?(S=a,0|(l=r)):(e=0|tt(0|A,0|e,52),B(),e&=15,0|HA(A,l)?QA(i,e,s,1,o):FA(i,e,s,1,o),l=o+8|0,n[t>>2]=n[l>>2],n[t+4>>2]=n[l+4>>2],n[t+8>>2]=n[l+8>>2],n[t+12>>2]=n[l+12>>2],S=a,0|(l=0))},establishStackSpace:function(A,e){S=A|=0},stackAlloc:function(A){var e;return e=S,S=15+(S=S+(A|=0)|0)&-16,0|e},stackRestore:function(A){S=A|=0},stackSave:function(){return 0|S}}}({Math:Math,Int8Array:Int8Array,Int32Array:Int32Array,Uint8Array:Uint8Array,Float32Array:Float32Array,Float64Array:Float64Array},{b:function(A){s=A},c:function(){return s},d:function(A,e,t,r){tA("Assertion failed: "+v(A)+", at: "+[e?v(e):"unknown filename",t,r?v(r):"unknown function"])},e:function(A){return t.___errno_location&&(h[t.___errno_location()>>2]=A),A},f:z,g:function(A,e,t){d.set(d.subarray(e,e+t),A)},h:function(A){var e=z(),t=16777216,r=2130706432;if(A>r)return!1;for(var n=Math.max(e,16777216);n0))return 0;for(var n=t+r-1,o=0;o=55296&&i<=57343&&(i=65536+((1023&i)<<10)|1023&A.charCodeAt(++o)),i<=127){if(t>=n)break;e[t++]=i}else if(i<=2047){if(t+1>=n)break;e[t++]=192|i>>6,e[t++]=128|63&i}else if(i<=65535){if(t+2>=n)break;e[t++]=224|i>>12,e[t++]=128|i>>6&63,e[t++]=128|63&i}else{if(t+3>=n)break;e[t++]=240|i>>18,e[t++]=128|i>>12&63,e[t++]=128|i>>6&63,e[t++]=128|63&i}}e[t]=0}(A,d,e,t)}(A,e=Z(t),t)}return e},array:function(A){var e,t,r=Z(A.length);return e=A,t=r,f.set(e,t),r}},o=c(A),i=[],a=0;if(r)for(var s=0;s>1]=e;break;case"i32":h[A>>2]=e;break;case"i64":I=[e>>>0,(L=e,+j(L)>=1?L>0?(0|F(+S(L/4294967296),4294967295))>>>0:~~+N((L-+(~~L>>>0))/4294967296)>>>0:0)],h[A>>2]=I[0],h[A+4>>2]=I[1];break;case"float":m[A>>2]=e;break;case"double":b[A>>3]=e;break;default:tA("invalid type for setValue: "+t)}},t.getValue=function(A,e,t){switch("*"===(e=e||"i8").charAt(e.length-1)&&(e="i32"),e){case"i1":case"i8":return f[0|A];case"i16":return g[A>>1];case"i32":case"i64":return h[A>>2];case"float":return m[A>>2];case"double":return b[A>>3];default:tA("invalid type for getValue: "+e)}return null},R){H(R)||(W=R,R=t.locateFile?t.locateFile(W,o):o+W),P++,t.monitorRunDependencies&&t.monitorRunDependencies(P);var X=function(A){A.byteLength&&(A=new Uint8Array(A)),d.set(A,8),t.memoryInitializerRequest&&delete t.memoryInitializerRequest.response,function(){if(P--,t.monitorRunDependencies&&t.monitorRunDependencies(P),0==P&&T){var A=T;T=null,A()}}()},q=function(){n(R,X,function(){throw"could not load memory initializer "+R})},$=O(R);if($)X($.buffer);else if(t.memoryInitializerRequest){var AA=function(){var A=t.memoryInitializerRequest,e=A.response;if(200!==A.status&&0!==A.status){var r=O(t.memoryInitializerRequestURL);if(!r)return void q();e=r.buffer}X(e)};t.memoryInitializerRequest.response?setTimeout(AA,0):t.memoryInitializerRequest.addEventListener("load",AA)}else q()}function eA(A){function e(){V||(V=!0,l||(k(B),k(M),t.onRuntimeInitialized&&t.onRuntimeInitialized(),function(){if(t.postRun)for("function"==typeof t.postRun&&(t.postRun=[t.postRun]);t.postRun.length;)Q(t.postRun.shift());k(D)}()))}P>0||(function(){if(t.preRun)for("function"==typeof t.preRun&&(t.preRun=[t.preRun]);t.preRun.length;)E(t.preRun.shift());k(C)}(),P>0||(t.setStatus?(t.setStatus("Running..."),setTimeout(function(){setTimeout(function(){t.setStatus("")},1),e()},1)):e()))}function tA(A){throw t.onAbort&&t.onAbort(A),i(A+=""),a(A),l=!0,"abort("+A+"). Build with -s ASSERTIONS=1 for more info."}if(T=function A(){V||eA(),V||(T=A)},t.run=eA,t.abort=tA,t.preInit)for("function"==typeof t.preInit&&(t.preInit=[t.preInit]);t.preInit.length>0;)t.preInit.pop()();return eA(),A}("object"==typeof ke?ke:{}),Ce="number",Be={0:"Success",1:"The operation failed but a more specific error is not available",2:"Argument was outside of acceptable range",3:"Latitude or longitude arguments were outside of acceptable range",4:"Resolution argument was outside of acceptable range",5:"Cell argument was not valid",6:"Directed edge argument was not valid",7:"Undirected edge argument was not valid",8:"Vertex argument was not valid",9:"Pentagon distortion was encountered",10:"Duplicate input",11:"Cell arguments were not neighbors",12:"Cell arguments had incompatible resolutions",13:"Memory allocation failed",14:"Bounds of provided memory were insufficient",15:"Mode or flags argument was not valid",16:"Index argument was not valid",17:"Base cell number was outside of acceptable range",18:"Child indexing digits invalid",19:"Child indexing digits refer to a deleted subsequence"},Me={1e3:"Unknown unit",1001:"Array length out of bounds",1002:"Got unexpected null value for H3 index"};function De(A,e,t){var r=t&&"value"in t,n=new Error((A[e]||"Unknown error")+" (code: "+e+(r?", value: "+t.value:"")+")");return n.code=e,n}function Ee(A){if(0!==A)throw function(A,e){return De(Be,A,2===arguments.length?{value:e}:{})}(A)}var Qe={};[["sizeOfH3Index",Ce],["sizeOfLatLng",Ce],["sizeOfCellBoundary",Ce],["sizeOfGeoLoop",Ce],["sizeOfGeoPolygon",Ce],["sizeOfLinkedGeoPolygon",Ce],["sizeOfCoordIJ",Ce],["readInt64AsDoubleFromPointer",Ce],["isValidCell",Ce,[Ce,Ce]],["isValidIndex",Ce,[Ce,Ce]],["latLngToCell",Ce,[Ce,Ce,Ce,Ce]],["cellToLatLng",Ce,[Ce,Ce,Ce]],["cellToBoundary",Ce,[Ce,Ce,Ce]],["maxGridDiskSize",Ce,[Ce,Ce]],["gridDisk",Ce,[Ce,Ce,Ce,Ce]],["gridDiskDistances",Ce,[Ce,Ce,Ce,Ce,Ce]],["gridRing",Ce,[Ce,Ce,Ce,Ce]],["gridRingUnsafe",Ce,[Ce,Ce,Ce,Ce]],["maxPolygonToCellsSize",Ce,[Ce,Ce,Ce,Ce]],["polygonToCells",Ce,[Ce,Ce,Ce,Ce]],["maxPolygonToCellsSizeExperimental",Ce,[Ce,Ce,Ce,Ce]],["polygonToCellsExperimental",Ce,[Ce,Ce,Ce,Ce,Ce,Ce]],["cellsToLinkedMultiPolygon",Ce,[Ce,Ce,Ce]],["destroyLinkedMultiPolygon",null,[Ce]],["compactCells",Ce,[Ce,Ce,Ce,Ce]],["uncompactCells",Ce,[Ce,Ce,Ce,Ce,Ce,Ce]],["uncompactCellsSize",Ce,[Ce,Ce,Ce,Ce,Ce]],["isPentagon",Ce,[Ce,Ce]],["isResClassIII",Ce,[Ce,Ce]],["getBaseCellNumber",Ce,[Ce,Ce]],["getResolution",Ce,[Ce,Ce]],["getIndexDigit",Ce,[Ce,Ce,Ce]],["constructCell",Ce,[Ce,Ce,Ce,Ce]],["maxFaceCount",Ce,[Ce,Ce,Ce]],["getIcosahedronFaces",Ce,[Ce,Ce,Ce]],["cellToParent",Ce,[Ce,Ce,Ce,Ce]],["cellToChildren",Ce,[Ce,Ce,Ce,Ce]],["cellToCenterChild",Ce,[Ce,Ce,Ce,Ce]],["cellToChildrenSize",Ce,[Ce,Ce,Ce,Ce]],["cellToChildPos",Ce,[Ce,Ce,Ce,Ce]],["childPosToCell",Ce,[Ce,Ce,Ce,Ce,Ce,Ce]],["areNeighborCells",Ce,[Ce,Ce,Ce,Ce,Ce]],["cellsToDirectedEdge",Ce,[Ce,Ce,Ce,Ce,Ce]],["getDirectedEdgeOrigin",Ce,[Ce,Ce,Ce]],["getDirectedEdgeDestination",Ce,[Ce,Ce,Ce]],["isValidDirectedEdge",Ce,[Ce,Ce]],["directedEdgeToCells",Ce,[Ce,Ce,Ce]],["originToDirectedEdges",Ce,[Ce,Ce,Ce]],["directedEdgeToBoundary",Ce,[Ce,Ce,Ce]],["gridDistance",Ce,[Ce,Ce,Ce,Ce,Ce]],["gridPathCells",Ce,[Ce,Ce,Ce,Ce,Ce]],["gridPathCellsSize",Ce,[Ce,Ce,Ce,Ce,Ce]],["cellToLocalIj",Ce,[Ce,Ce,Ce,Ce,Ce,Ce]],["localIjToCell",Ce,[Ce,Ce,Ce,Ce,Ce]],["getHexagonAreaAvgM2",Ce,[Ce,Ce]],["getHexagonAreaAvgKm2",Ce,[Ce,Ce]],["getHexagonEdgeLengthAvgM",Ce,[Ce,Ce]],["getHexagonEdgeLengthAvgKm",Ce,[Ce,Ce]],["greatCircleDistanceM",Ce,[Ce,Ce]],["greatCircleDistanceKm",Ce,[Ce,Ce]],["greatCircleDistanceRads",Ce,[Ce,Ce]],["cellAreaM2",Ce,[Ce,Ce,Ce]],["cellAreaKm2",Ce,[Ce,Ce,Ce]],["cellAreaRads2",Ce,[Ce,Ce,Ce]],["edgeLengthM",Ce,[Ce,Ce,Ce]],["edgeLengthKm",Ce,[Ce,Ce,Ce]],["edgeLengthRads",Ce,[Ce,Ce,Ce]],["getNumCells",Ce,[Ce,Ce]],["getRes0Cells",Ce,[Ce]],["res0CellCount",Ce],["getPentagons",Ce,[Ce,Ce]],["pentagonCount",Ce],["cellToVertex",Ce,[Ce,Ce,Ce,Ce]],["cellToVertexes",Ce,[Ce,Ce,Ce]],["vertexToLatLng",Ce,[Ce,Ce,Ce]],["isValidVertex",Ce,[Ce,Ce]]].forEach(function(A){Qe[A[0]]=ke.cwrap.apply(ke,A)});var je=16,Ne=Qe.sizeOfH3Index(),Se=Qe.sizeOfLatLng(),Fe=Qe.sizeOfCellBoundary();Qe.sizeOfGeoPolygon(),Qe.sizeOfGeoLoop(),Qe.sizeOfLinkedGeoPolygon(),Qe.sizeOfCoordIJ();var Pe=/[^0-9a-fA-F]/;function Te(A){if(A>=0)return A.toString(je);var e=Le(8,(A&=2147483647).toString(je));return(parseInt(e[0],je)+8).toString(je)+e.substring(1)}function Le(A,e){for(var t=A-e.length,r="",n=0;n.85?.9+(i-.85)/.15*.1:.1+(i-.15)/.7*.8;var i;return We(r[Math.min(23,Math.floor(24*o))])}function Ze({coveragePoints:t,visible:r,terrainEnabled:n=!1,brightness:o=.7,basemapMode:i="dark"}){const{current:a}=I(),[s,l]=A.useState(null);A.useEffect(()=>{const A=()=>{var A;const e=null==(A=null==a?void 0:a.getMap)?void 0:A.call(a);e&&!s&&l(e)};A();const e=setInterval(A,50),t=setTimeout(()=>clearInterval(e),5e3);return()=>{clearInterval(e),clearTimeout(t)}},[a,s]);const[c,u]=A.useState(null),[f,d]=A.useState(!1),g=A.useRef({aborted:!1}),h=A.useRef(0),m=A.useRef(i),b=function(e){const[t,r]=A.useState(e);return A.useEffect(()=>{const A=setTimeout(()=>r(e),300);return()=>clearTimeout(A)},[e,300]),t}(t),p=A.useMemo(()=>function(A="dark"){var e;if("light"===A)return Ye;const t=vA();return 24===t.length&&0!==(null==(e=t[0])?void 0:e[0])?t:Ue}(i),[i]);A.useEffect(()=>{if(!b||!Array.isArray(b)||0===b.length)return void queueMicrotask(()=>{u(null),h.current=0});const A=m.current!==i;if(b.length===h.current&&c&&!A)return;h.current=b.length,m.current=i,g.current.aborted=!0,g.current={aborted:!1};const e=g.current;d(!0);const{cells:t,minQuality:r,maxQuality:n}=function(A){const e=new Map;for(const o of A){if("number"!=typeof o.lat||"number"!=typeof o.lon||isNaN(o.lat)||isNaN(o.lon))continue;const A=_e(o.lat,o.lon,8),t=e.get(A),r=o.weight;t?(t.count++,t.qualitySum+=r):e.set(A,{count:1,qualitySum:r})}const t=[];let r=1/0,n=-1/0;for(const[o,i]of e.entries()){const A=i.qualitySum/i.count;t.push({hexId:o,count:i.count,avgQuality:A}),r=Math.min(r,A),n=Math.max(n,A)}return{cells:t,minQuality:t.length>0?r:0,maxQuality:t.length>0?n:0}}(b);if(0===t.length)return u(null),void d(!1);if(t.length<500){const A=function(A,e,t,r){const n=[];for(const o of A){const A=He(o.hexId).map(([A,e])=>[e,A]);A.push(A[0]);const i=Ve(o.avgQuality,e,t,r);n.push({type:"Feature",properties:{color:i,quality:o.avgQuality,count:o.count},geometry:{type:"Polygon",coordinates:[A]}})}return{type:"FeatureCollection",features:n}}(t,r,n,p);return void(e.aborted||(u(A),d(!1)))}return async function(A,e,t,r,n){const o=[];let i=0;for(;i[e,A]);a.push(a[0]);const s=Ve(n.avgQuality,e,t,r);o.push({type:"Feature",properties:{color:s,quality:n.avgQuality,count:n.count},geometry:{type:"Polygon",coordinates:[a]}})}irequestAnimationFrame(A))}return{type:"FeatureCollection",features:o}}(t,r,n,p,e).then(A=>{!e.aborted&&A&&u(A)}).finally(()=>{e.aborted||d(!1)}),()=>{e.aborted=!0}},[b,p]),A.useEffect(()=>{if(!s)return;const A=()=>{var A,e;try{const t=s.getLayer(Oe),n=s.getSource(Ge);if(r&&c&&c.features.length>0){if(n?s.getSource(Ge).setData(c):s.addSource(Ge,{type:"geojson",data:c}),!t){const t=s.getLayer("topology-weak-edges-native"),r=null==(e=null==(A=s.getStyle())?void 0:A.layers)?void 0:e.find(A=>"symbol"===A.type),n=t?"topology-weak-edges-native":null==r?void 0:r.id;s.addLayer({id:Oe,type:"fill",source:Ge,paint:{"fill-color":["get","color"],"fill-opacity":o}},n)}}else t&&s.removeLayer(Oe),n&&s.removeSource(Ge)}catch(t){}};s.isStyleLoaded()?A():s.once("style.load",A)},[s,r,c,n]),A.useEffect(()=>{if(s&&r)try{s.getLayer(Oe)&&s.setPaintProperty(Oe,"fill-opacity",o)}catch{}},[s,o,r]),A.useEffect(()=>()=>{if(s)try{s.getLayer(Oe)&&s.removeLayer(Oe),s.getSource(Ge)&&s.removeSource(Ge)}catch{}},[s]);const v=(null==c?void 0:c.features.length)??0;return v>0&&r?e.jsx("div",{"data-testid":"wardriving-hexlayer-maplibre-active","data-point-count":(null==t?void 0:t.length)||0,"data-cell-count":v,"data-terrain-enabled":n,"data-is-processing":f,style:{display:"none"}}):null}const Ke="https://s3.amazonaws.com/elevation-tiles-prod/terrarium/{z}/{x}/{y}.png",Je="terrarium",Xe="terrain-dem",qe="hillshade-dem",$e="terrain-hillshade";function At({enabled:e,exaggeration:t=4}){const{current:r}=I(),[n,o]=A.useState(null),i=A.useRef(null);return A.useEffect(()=>{const A=()=>{var A;const e=null==(A=null==r?void 0:r.getMap)?void 0:A.call(r);e&&!n&&o(e)};A();const e=setInterval(A,50),t=setTimeout(()=>clearInterval(e),5e3);return()=>{clearInterval(e),clearTimeout(t)}},[r,n]),A.useEffect(()=>{if(!n)return;let A=!0;const e=()=>{var e,t;if(A)try{if(n.getSource(qe)||n.addSource(qe,{type:"raster-dem",tiles:[Ke],encoding:Je,tileSize:256,maxzoom:14}),!n.getLayer($e)){const A=null==(t=null==(e=n.getStyle())?void 0:e.layers)?void 0:t.find(A=>"symbol"===A.type);n.addLayer({id:$e,type:"hillshade",source:qe,paint:{"hillshade-shadow-color":"rgba(10, 10, 10, 0.6)","hillshade-highlight-color":"rgba(245, 240, 230, 0.4)","hillshade-accent-color":"rgba(90, 75, 65, 0.3)","hillshade-illumination-direction":315,"hillshade-exaggeration":.35}},null==A?void 0:A.id)}n.getSource(Xe)||n.addSource(Xe,{type:"raster-dem",tiles:[Ke],encoding:Je,tileSize:256,maxzoom:14})}catch(r){}};return n.isStyleLoaded()?e():(n.once("style.load",e),n.once("load",()=>{A&&!n.getSource(qe)&&e()})),()=>{A=!1}},[n]),A.useEffect(()=>{if(!n)return;let A=!0,r=!1;const o=()=>{if(A&&n.getSource(Xe))try{e?(n.setCenterClampedToGround(!1),n.setTerrain({source:Xe,exaggeration:t}),n.setMaxPitch(70),!r&&n.getPitch()<30&&!n.isMoving()&&(r=!0,null!==i.current&&clearTimeout(i.current),i.current=window.setTimeout(()=>{i.current=null,A&&!n.isMoving()&&n.getPitch()<30&&n.easeTo({pitch:45,duration:1e3})},200))):(n.setTerrain(null),n.setCenterClampedToGround(!0),n.getPitch()>0&&!n.isMoving()&&n.easeTo({pitch:0,duration:800}),n.setMaxPitch(60))}catch(o){}};if(n.isStyleLoaded()&&n.getSource(Xe))o();else{const A=()=>{n.getSource(Xe)&&o()};n.once("idle",A)}return()=>{A=!1,null!==i.current&&(clearTimeout(i.current),i.current=null)}},[n,e,t]),A.useEffect(()=>()=>{var A;try{(null==(A=null==n?void 0:n.getStyle)?void 0:A.call(n))&&n.isStyleLoaded()&&(n.setTerrain(null),n.getLayer($e)&&n.removeLayer($e),n.getSource(qe)&&n.removeSource(qe),n.getSource(Xe)&&n.removeSource(Xe))}catch{}},[n]),null}function et(A,e){let t=0;for(let r=0;r0)for(let t=0;t=A.length)return A;const t=[],r=A.length/e;for(let n=0;no.has(A.fromHash)&&o.has(A.toHash));if(0===i.length)return null;const a=function(A,e,t,r){const n=e.length,o=new Map(e.map((A,e)=>[A,e])),i=Array(n).fill(null).map(()=>Array(n).fill(0));for(const a of A){const A=o.get(a.fromHash),e=o.get(a.toHash);if(void 0!==A&&void 0!==e&&A!==e){const n=a.strength*a.certainCount;let o=1;if(t){const A=t.get(a.fromHash),e=t.get(a.toHash);A&&e&&(o=ot(FA(A[0],A[1],e[0],e[1])/1e3))}let s=1;if(r){const A=[a.fromHash,a.toHash].sort().join("-");s=1-.7*(r.get(A)??0)}const l=.3+.7*(a.symmetryRatio??0),c=Math.pow(n,.7)*Math.pow(o,.3)*s*l;i[A][e]=c,i[e][A]=c}}return i}(i,e,t,r),s=function(A){const e=A.length,t=Array(e).fill(null).map(()=>Array(e).fill(0));for(let r=0;rArray(e).fill(0));for(let a=0;a43758.5453*Math.sin(12.9898*e)%1-.5);rt(o,t),tt(o);let i=0;for(let a=0;a<100;a++){const A=nt(n,o);rt(A,t);const e=et(A,A)/et(o,A);if(tt(A),o=A,Math.abs(e-i)<1e-8)return{vector:o,eigenvalue:r-e};i=e}return{vector:o,eigenvalue:r-i}}(s);if(c<.001)return null;const u=[],f=[];for(let d=0;d0&&A.push([A[0][0],A[0][1]]),t=A}return t}function gt(A,e={}){const t=function(A,e={}){if(A.length<3)return{coordinates:[],valid:!1};const{bandwidth:t=ct,threshold:r=ut,cellSize:n=ft}=e,o=function(A,e){let t=1/0,r=-1/0,n=1/0,o=-1/0;for(const[i,a]of A)ir&&(r=i),ao&&(o=a);return t-=e,r+=e,n-=e,o+=e,{minX:t,minY:n,maxX:r,maxY:o,width:r-t,height:o-n}}(A,.02),i=Math.ceil(o.width/(t/2)),a=Math.ceil(o.height/(t/2)),s=Math.min(1,200/Math.max(i,a)),l=Math.max(10,Math.ceil(i*s)),c=Math.max(10,Math.ceil(a*s)),u=A=>A/l*o.width+o.minX,f=A=>A/c*o.height+o.minY,d=t/o.width*l;try{const e=kA().x(A=>(A[0]-o.minX)/o.width*l).y(A=>(A[1]-o.minY)/o.height*c).size([l,c]).bandwidth(Math.max(5,d)).cellSize(n)(A);if(0===e.length)return{coordinates:[],valid:!1};const t=Math.max(...e.map(A=>A.value))*r;let i=e[0],a=1/0;for(const A of e){const e=Math.abs(A.value-t);e0){const e=A[0],t=A[A.length-1];e[0]===t[0]&&e[1]===t[1]||A.push([e[0],e[1]])}if(A.length>=4){const t=dt(A);e.push(t)}}e.length>0&&s.push(e)}const g=[];for(const A of s)for(const e of A)g.push(e);return{coordinates:s,valid:s.length>0}}catch(g){return{coordinates:[],valid:!1}}}(A,e);return t.valid&&0!==t.coordinates.length?1===t.coordinates.length?{type:"Polygon",coordinates:t.coordinates[0]}:{type:"MultiPolygon",coordinates:t.coordinates}:null}function ht(A,e,t){return(e[0]-A[0])*(t[1]-A[1])-(e[1]-A[1])*(t[0]-A[0])}function mt(A,e,t,r,n){const o=n*n,i=o*n;return[.5*(2*e[0]+(-A[0]+t[0])*n+(2*A[0]-5*e[0]+4*t[0]-r[0])*o+(-A[0]+3*e[0]-3*t[0]+r[0])*i),.5*(2*e[1]+(-A[1]+t[1])*n+(2*A[1]-5*e[1]+4*t[1]-r[1])*o+(-A[1]+3*e[1]-3*t[1]+r[1])*i)]}function bt(A){let e=function(A){if(A.length<3)return A;const e=[...A].sort((A,e)=>A[0]-e[0]||A[1]-e[1]),t=[];for(const n of e){for(;t.length>=2&&ht(t[t.length-2],t[t.length-1],n)<=0;)t.pop();t.push(n)}const r=[];for(let n=e.length-1;n>=0;n--){const A=e[n];for(;r.length>=2&&ht(r[r.length-2],r[r.length-1],A)<=0;)r.pop();r.push(A)}return t.pop(),r.pop(),t.concat(r)}(A);if(e.length<3)return null;e=function(A){if(A.length<3)return A;let e=0,t=0;for(const[r,n]of A)e+=r,t+=n;return e/=A.length,t/=A.length,A.map(([A,r])=>{const n=A-e,o=r-t,i=Math.sqrt(n*n+o*o);if(i<1e-4)return[A,r];const a=(i+.008)/i;return[e+n*a,t+o*a]})}(e);const t=function(A){if(A.length<3)return A;const e=[],t=A.length;for(let r=0;rt?function(A,e,t,r){const n=[];for(const[o,i]of A.communities){const A=[];for(const t of i){const r=e.get(t);r&&A.push([r[1],r[0]])}if(A.length<3)continue;let a=gt(A,{bandwidth:t,threshold:r});a||(a=bt(A)),a&&n.push({type:"Feature",properties:{community:o,color:st(o),borderColor:lt(o),nodeCount:i.length},geometry:a})}return{type:"FeatureCollection",features:n}}(t,r,i,a):{type:"FeatureCollection",features:[]},[t,r,i,a]),c=n?o:0,u={"fill-color":["get","color"],"fill-opacity":c},f={"line-color":["get","borderColor"],"line-width":s,"line-opacity":c};return e.jsxs(R,{id:"mincut-partition",type:"geojson",data:l,children:[e.jsx(_,{id:"mincut-partition-fill",type:"fill",paint:u}),e.jsx(_,{id:"mincut-partition-stroke",type:"line",paint:f})]})}const vt={showTopology:!1,showNeighborLines:!0,show3DTerrain:!1,showMinCut:!1,nodeFilter:"all"},wt=C()(xA(A=>({viewState:null,setViewState:e=>A({viewState:e,lastSavedAt:Date.now()}),toggles:vt,setToggle:(e,t)=>A(A=>({toggles:{...A.toggles,[e]:t},lastSavedAt:Date.now()})),setToggles:e=>A(A=>({toggles:{...A.toggles,...e},lastSavedAt:Date.now()})),hasAnalyzed:!1,setHasAnalyzed:e=>A({hasAnalyzed:e,lastSavedAt:Date.now()}),lastSavedAt:null,reset:()=>A({viewState:null,toggles:vt,hasAnalyzed:!1,lastSavedAt:null})}),{name:"pymc-map-view",partialize:A=>({viewState:A.viewState,toggles:A.toggles,hasAnalyzed:A.hasAnalyzed,lastSavedAt:A.lastSavedAt})}));function xt(A,e=!1,t=!1,r=!1,n=.7,o){const i=bA(o);return r?n>=.75?i.restBright:i.rest:n>=.85?i.rest:i.restDim}function yt(A){return[A[1],A[0]]}function kt(A,e,t,r=12){const[n,o]=A,[i,a]=e,s=[];for(let l=0;l<=r;l++){const A=l/r,e=o+(a-o)*A,c=n+(i-n)*A,u=4*t*A*(1-A);s.push([e,c,u])}return s}function Ct(A){return A<.5?4*A*A*A:1-Math.pow(-2*A+2,3)/2}function Bt(A,e,t,r,n,o,i,a,s,l,c,u="dark"){const f=LA(),d=[];let g=1/0,h=-1/0;const m=[];for(const p of A){const A=.7*(p.edge.avgConfidence??(e?.7:.5))+p.edge.certainCount/Math.max(i,1)*.3+(e?.5:0);m.push({polyline:p,brightnessScore:A}),g=Math.min(g,A),h=Math.max(h,A)}if(0===m.length)return{type:"FeatureCollection",features:[]};const b=h-g||1;m.sort((A,e)=>A.brightnessScore-e.brightnessScore);for(const{polyline:p,brightnessScore:v}of m){const{from:A,to:i,edge:h}=p,m=t.get(h.key)??0;if(m<=0)continue;const w=a.has(h.key),x=s.has(h.key),y=h.avgConfidence??(e?.7:.5),k=l===h.key,C=c[h.fromHash],B=c[h.toHash],M=(null==C?void 0:C.node_name)||(null==C?void 0:C.name)||h.fromHash.slice(0,8),D=(null==B?void 0:B.node_name)||(null==B?void 0:B.name)||h.toHash.slice(0,8),E=[A[0]+(i[0]-A[0])*m,A[1]+(i[1]-A[1])*m];let Q,j,N,S;if(e){const A=o.get(h.key)??PA(h.certainCount),e=n.get(h.key)??A;Q=e+(A-e)*r,k?Q=Math.max(1.6*Q,4.5):x&&(Q*=1.3)}else Q=1.5;if(j=k?f.edges.highlight:xt(0,h.isDirectPathEdge??!1,w,x,y,u),N=k?f.edges.highlight:h.isDirectPathEdge?f.edges.hoverDirect:w?f.edges.hoverLoop:f.edges.hoverStandard,e){const A=Math.min(1.5*m,1)*f.edgeOpacity;S=x?1.15*A:A}else S=(.3+.3*y)*m;k&&(S=.95);const F=(v-g)/b;d.push({type:"Feature",properties:{key:h.key,baseColor:j,hoverColor:N,baseWidth:Q,baseOpacity:S,brightnessScore:F,isLoopEdge:w,isBackbone:x,isDirectPath:h.isDirectPathEdge??!1,isHubConnection:h.isHubConnection??!1,isZeroHop:h.isZeroHop??!1,isValidated:e,certainCount:h.certainCount,confidence:y,symmetryRatio:h.symmetryRatio??1,dominantDirection:h.dominantDirection??"balanced",fromName:M,toName:D,fromHash:h.fromHash,toHash:h.toHash},geometry:{type:"LineString",coordinates:[yt(A),yt(E)]}})}return{type:"FeatureCollection",features:d}}function Mt(A,e){const t=LA(),r=[];let n=0;for(const o of A){const A=e.get(o.hash);A&&A.blendedScore>n&&(n=A.blendedScore)}for(const o of A){const{from:A,to:i,hash:a,neighbor:s,lastHopData:l}=o,c=`neighbor-${a}`,u=(null==l?void 0:l.avgRssi)??s.rssi??null,f=(null==l?void 0:l.avgSnr)??s.snr??null,d=(null==l?void 0:l.count)??0,g=(null==l?void 0:l.confidence)??1,h=e.get(a),m=(null==h?void 0:h.listenerScore)??0,b=(null==h?void 0:h.loudScore)??0,p=(null==h?void 0:h.blendedScore)??0,v=n>0?p/n:0,w=o.rxAdvertCount??0,x=o.txProxyCount??0,y=w+x,k=y>0?(x-w)/y:0,C=kt(A,i,150,8);r.push({type:"Feature",properties:{key:c,hash:a,name:s.node_name||s.name||a.slice(0,8),prefix:a.slice(2,4).toUpperCase(),color:t.neighborColor,width:2.5,opacity:.85,rssi:u,snr:f,packetCount:d,confidence:g,hasAvgRssi:void 0!==(null==l?void 0:l.avgRssi),hasAvgSnr:void 0!==(null==l?void 0:l.avgSnr),isNeighborEdge:!0,listenerScore:m,loudScore:b,blendedScore:p,trafficWeight:v,linkAsymmetry:k,rxAdvertCount:w,txProxyCount:x},geometry:{type:"LineString",coordinates:C}})}return{type:"FeatureCollection",features:r}}function Dt(A){return A<.5?4*A*A*A:1-Math.pow(-2*A+2,3)/2}function Et(A,e){if(A<240)return.5;if(A<480)return 1;const t=(A-480)/(e-480);return Math.max(0,.33*(1-t))}function Qt(A,e,t){const r=t?nA(t):null,n=[];for(const o of A){if(r&&o.toUpperCase()===r){t&&n.push(t);continue}const A=e.get(o.toUpperCase());A&&n.push(A)}return n}const jt="edge-blink-source",Nt="edge-blink-layer",St=1e3,Ft=1e3,Pt="node-markers-layer";function Tt(A){return A<0||A>=St?0:1-A/St}function Lt(A){if(A<0)return 0;if(A>=Ft)return 0;const e=A/Ft;return Math.pow(1-e,3)}function It(A){return[A[1],A[0]]}function Rt(A){const e=new Date(1e3*A);return`${(e.getMonth()+1).toString().padStart(2,"0")}/${e.getDate().toString().padStart(2,"0")}`}function _t({txDelayRec:t,onRemove:r}){const[n,o]=A.useState(!1),i=t.floodFactor??t.txDelayFactor,a=t.directFactor??t.directTxDelayFactor;return e.jsxs("div",{className:"flex items-center gap-2 text-[10px]",children:[e.jsxs("button",{onClick:async()=>{const A=`set txdelay ${i.toFixed(1)}\nset direct.txdelay ${a.toFixed(1)}`;try{await navigator.clipboard.writeText(A),o(!0),setTimeout(()=>o(!1),1500)}catch(e){const t=document.createElement("textarea");t.value=A,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();try{document.execCommand("copy"),o(!0),setTimeout(()=>o(!1),1500)}catch{}document.body.removeChild(t)}},className:"flex items-center gap-2 flex-1 py-1 px-1.5 bg-amber-400/5 hover:bg-amber-400/10 rounded transition-colors group",title:"Click to copy CLI commands",children:[e.jsx(U,{className:"w-3 h-3 text-amber-400 shrink-0"}),e.jsx("span",{className:"text-text-muted",children:"TxDelay"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"text-text-muted",children:"F"}),e.jsxs("span",{className:"data-box data-box-compact text-amber-400",children:["×",i.toFixed(1)]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"text-text-muted",children:"D"}),e.jsxs("span",{className:"data-box data-box-compact text-amber-400",children:["×",a.toFixed(1)]})]})]}),n?e.jsx(E,{className:"w-3 h-3 text-green-400 ml-auto"}):e.jsx(H,{className:"w-3 h-3 text-text-muted opacity-0 group-hover:opacity-100 transition-opacity ml-auto"})]}),r&&e.jsx("button",{onClick:r,className:"p-1 text-text-secondary hover:text-red-400 hover:bg-red-500/10 rounded transition-colors",title:"Remove from contacts",children:e.jsx(N,{className:"w-3.5 h-3.5"})})]})}function Ht({hash:t,hashPrefix:r,name:n,isHub:o,isGateway:i,isBackbone:a,isZeroHop:s,isMobile:l,isRoomServer:c,isStale:u,lastSeenTimestamp:f,centrality:d,affinity:g,meanSnr:h,meanRssi:m,neighbor:b,onRemove:p,txDelayRec:v}){const[w,x]=A.useState(!1),y=s?"Direct":(null==g?void 0:g.typicalHopPosition)?`${g.typicalHopPosition}-hop`:null,k=v&&!v.insufficientData;return e.jsxs("div",{className:"w-[240px] pr-2",children:[e.jsx("div",{className:"text-[14px] font-semibold text-text-primary leading-tight truncate mb-1",children:n}),e.jsxs("div",{className:"flex items-center gap-1 flex-wrap mb-1.5",children:[e.jsx("code",{className:"font-mono text-[10px] text-text-secondary bg-data-box-bg border border-data-box-border px-1 py-0.5 rounded",children:r}),e.jsx("button",{onClick:async()=>{try{await navigator.clipboard.writeText(t),x(!0),setTimeout(()=>x(!1),1500)}catch(A){const e=document.createElement("textarea");e.value=t,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select();try{document.execCommand("copy"),x(!0),setTimeout(()=>x(!1),1500)}catch{}document.body.removeChild(e)}},className:"p-0.5 hover:bg-subtle-fill-hover rounded transition-colors",title:"Copy full hash",children:w?e.jsx(E,{className:"w-3 h-3 text-sys-green"}):e.jsx(H,{className:"w-3 h-3 text-text-secondary"})}),e.jsx(DA,{hash:t,size:"sm"}),y&&e.jsx(iA,{color:s?QA.direct:QA.multihop,compact:!0,children:y}),b.is_repeater&&e.jsx(iA,{color:jA.repeater,compact:!0,children:"Rptr"}),o&&e.jsx(iA,{color:jA.hub,compact:!0,title:"Hub: ≥10% of last-hop traffic",children:"Hub"}),i&&!o&&e.jsx(iA,{color:jA.gateway,compact:!0,title:"Gateway: 7-10% of last-hop traffic",children:"Gate"}),a&&e.jsx(iA,{color:jA.backbone,compact:!0,title:"Backbone",children:"Bone"}),l&&e.jsx(iA,{color:jA.mobile,compact:!0,children:"Mobile"}),c&&e.jsx(iA,{color:jA.room,compact:!0,children:"Room"}),u&&f&&e.jsxs(iA,{compact:!0,title:"Neighbor not heard in 7+ days",children:["Idle ",Rt(f)]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-text-secondary mb-1.5",children:[e.jsxs("span",{className:"flex items-center gap-0.5",children:[e.jsx(z,{className:"w-3 h-3 text-text-muted shrink-0"}),e.jsx("span",{className:"font-mono",children:aA(b.last_seen)})]}),(null==g?void 0:g.distanceMeters)&&e.jsxs("span",{className:"flex items-center gap-0.5",children:[e.jsx(G,{className:"w-3 h-3 text-text-muted shrink-0"}),e.jsx("span",{className:"font-mono font-semibold text-text-primary",children:(C=g.distanceMeters,null===C?"—":C<1e3?`${Math.round(C)}m`:`${(C/1e3).toFixed(1)}km`)})]}),b.latitude&&b.longitude&&0!==b.latitude&&0!==b.longitude&&e.jsxs("span",{className:"flex items-center gap-0.5",children:[e.jsx(O,{className:"w-3 h-3 text-text-muted shrink-0"}),e.jsxs("span",{className:"font-mono text-text-muted",children:[b.latitude.toFixed(2),", ",b.longitude.toFixed(2)]})]})]}),e.jsx("div",{className:"mb-1.5",style:{width:224},children:e.jsx(EA,{nodeHash:t,width:224,height:26,showArea:!0,showTooltip:!0})}),e.jsxs("div",{className:"flex gap-3 text-[10px] mb-1.5",children:[e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsxs("div",{className:"flex justify-between items-center gap-2",children:[e.jsx("span",{className:"text-text-muted",children:"Packets"}),e.jsx("span",{className:"data-box data-box-compact",children:(null==g?void 0:g.frequency)||0})]}),s&&void 0!==h&&e.jsxs("div",{className:"flex justify-between items-center gap-2",children:[e.jsx("span",{className:"text-text-muted",children:"SNR"}),e.jsxs("span",{className:"data-box data-box-compact",children:[h.toFixed(1)," dB"]})]}),k&&v.networkRole&&e.jsxs("div",{className:"flex justify-between items-center gap-2",children:[e.jsx("span",{className:"text-text-muted",children:"Role"}),e.jsx(iA,{color:NA[v.networkRole],compact:!0,title:{hub:"Hub: High-connectivity node that bridges many paths",backbone:"Backbone: Critical relay with high traffic",relay:"Relay: Standard forwarding node",edge:"Edge: Peripheral node"}[v.networkRole],children:v.networkRole})]})]}),e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsxs("div",{className:"flex justify-between items-center gap-2",children:[e.jsx("span",{className:"text-text-muted",children:"Adverts"}),e.jsx("span",{className:"data-box data-box-compact",children:b.advert_count||0})]}),s&&void 0!==m&&e.jsxs("div",{className:"flex justify-between items-center gap-2",children:[e.jsx("span",{className:"text-text-muted",children:"RSSI"}),e.jsxs("span",{className:"data-box data-box-compact",children:[Math.round(m)," dBm"]})]}),k&&v.dataConfidence&&e.jsxs("div",{className:"flex justify-between items-center gap-2",children:[e.jsx("span",{className:"text-text-muted",children:"Data"}),e.jsx(iA,{color:SA[v.dataConfidence],compact:!0,title:{high:"1000+ packets",medium:"500-999 packets",low:"100-499 packets",insufficient:"Insufficient data"}[v.dataConfidence],children:v.dataConfidence})]})]}),!k&&p&&e.jsx("button",{onClick:p,className:"p-1 self-start text-text-secondary hover:text-red-400 hover:bg-red-500/10 rounded transition-colors",title:"Remove from contacts",children:e.jsx(N,{className:"w-3.5 h-3.5"})})]}),k&&e.jsx(_t,{txDelayRec:v,onRemove:p})]});var C}const zt="node-markers-native",Gt="node-markers-layer",Ot="node-markers-layer-local",Ut="marker-standard",Yt="marker-standard-neighbor",Wt="marker-hub",Vt="marker-hub-neighbor",Zt="marker-gateway",Kt="marker-gateway-neighbor",Jt="marker-mobile",Xt="marker-mobile-neighbor",qt="marker-room-server",$t="marker-room-server-neighbor",Ar="marker-local",er="marker-blink-black",tr="marker-blink-black-local",rr="marker-blink",nr="marker-blink-local";function or(A){var e;const t=null==(e=A.contact_type)?void 0:e.toLowerCase();return"room server"===t||"room_server"===t||"room"===t||"server"===t}function ir(A){return A.startsWith("0x")?A.slice(2,4).toUpperCase():A.slice(0,2).toUpperCase()}function ar({neighborsWithLocation:t,localNode:r,localHash:n,zeroHopNeighbors:o,lastHopNeighborMap:i,meshTopology:a,hoveredMarker:s,onMarkerHover:l,getNodeOpacity:c,shouldShowNode:u,onRequestRemove:f,openPopupId:d,onOpenPopup:g,onClosePopup:h,onNodeClick:m,blinkingNodes:b}){const{current:p}=I(),v=A.useRef(!1),[w,x]=A.useState(!1);A.useEffect(()=>{var A;const e=null==(A=null==p?void 0:p.getMap)?void 0:A.call(p);if(!e)return;const t=()=>{try{!function(A){const e=mA(),t=(A,e,t=0,r=!1)=>{const n=document.createElement("canvas");n.width=32,n.height=32;const o=n.getContext("2d",r?{colorSpace:"display-p3"}:void 0),i=14-t/2;return o.beginPath(),o.arc(16,16,i,0,2*Math.PI),o.fillStyle=A,o.fill(),e&&t>0&&(o.strokeStyle=e,o.lineWidth=2*t,o.stroke()),o.shadowColor="rgba(0,0,0,0.3)",o.shadowBlur=4,o.shadowOffsetY=2,{data:o.getImageData(0,0,32,32),pixelRatio:2}},r=(A,e=!1)=>{const t=document.createElement("canvas");t.width=48,t.height=48;const r=t.getContext("2d",e?{colorSpace:"display-p3"}:void 0),n=24*.35*2;return r.strokeStyle=A,r.lineWidth=5,r.lineCap="round",r.lineJoin="round",r.beginPath(),r.moveTo(24-n,24),r.lineTo(24,24-n),r.lineTo(40.8,24),r.stroke(),r.beginPath(),r.moveTo(24-.7*n,24),r.lineTo(24-.7*n,35.76),r.lineTo(35.76,35.76),r.lineTo(35.76,24),r.stroke(),r.beginPath(),r.moveTo(20.64,35.76),r.lineTo(20.64,27.36),r.lineTo(27.36,27.36),r.lineTo(27.36,35.76),r.stroke(),{data:r.getImageData(0,0,48,48),pixelRatio:2}},n=(A,e)=>{const t=document.createElement("canvas");t.width=48,t.height=48;const r=t.getContext("2d"),n=24*.35*2;return r.strokeStyle=A,r.lineWidth=5,r.lineCap="round",r.lineJoin="round",e&&(r.fillStyle=e),r.beginPath(),r.roundRect(24-n,24-.6*n,1.6*n,1.2*n,6),e&&r.fill(),r.stroke(),r.beginPath(),r.moveTo(18.96,34.08),r.lineTo(24-.6*n,40.8),r.lineTo(24,34.08),r.stroke(),{data:r.getImageData(0,0,48,48),pixelRatio:2}},o="#00FF00",i={[Ut]:t(e.nodeFill),[Yt]:t(e.neighborColor),[Wt]:t(e.hubColor),[Vt]:t(e.neighborColor),[Zt]:t(e.gatewayColor),[Kt]:t(e.neighborColor),[Jt]:t("transparent",e.mobileColor,2.5),[Xt]:t(e.neighborColor),[qt]:n(e.roomColor),[$t]:n(e.neighborColor,"#1a1a1c"),[Ar]:r(e.localColor),[er]:t("#000000"),[tr]:r("#000000"),[rr]:t(o,void 0,0,!0),[nr]:r(o,!0)};for(const[a,s]of Object.entries(i))A.hasImage(a)&&A.removeImage(a),A.addImage(a,s.data,{pixelRatio:s.pixelRatio})}(e),v.current=!0,w||x(!0)}catch(A){}};e.isStyleLoaded()?t():e.once("style.load",t);const r=()=>{e.hasImage(Ut)||t()};e.on("styledata",r);const n=()=>{v.current=!1,t()},o=new MutationObserver(A=>{for(const e of A)if("data-theme"===e.attributeName){setTimeout(n,100);break}});o.observe(document.documentElement,{attributes:!0});const i=document.querySelector("[data-basemap]");let a=null;return i&&(a=new MutationObserver(A=>{for(const e of A)if("data-basemap"===e.attributeName){setTimeout(n,100);break}}),a.observe(i,{attributes:!0})),()=>{e.off("styledata",r),o.disconnect(),null==a||a.disconnect()}},[p,w]);const y=A.useMemo(()=>{var A;const e=[],r=[...t].sort(([A,e],[t,r])=>{const n=(A,e)=>{var t;return or(e)?5e3:o.has(A)?3e3:a.hubNodes.includes(A)?2e3:(null==(t=a.gatewayNodes)?void 0:t.includes(A))?1e3:0};return n(A,e)-n(t,r)});for(const[t,s]of r){if(!s.latitude||!s.longitude)continue;if(n&&((n.startsWith("0x")?n.slice(2,4).toLowerCase():n.slice(0,2).toLowerCase())===(t.startsWith("0x")?t.slice(2,4).toLowerCase():t.slice(0,2).toLowerCase())||t===n))continue;const r=u(t),l=c(t,r);if(l<=.01)continue;const f=o.has(t),d=a.hubNodes.includes(t),g=(null==(A=a.gatewayNodes)?void 0:A.includes(t))??!1,h=a.mobileNodes.includes(t),m=or(s),b=a.centrality.get(t)||0,p=i.get(t),v="stale"===(null==p?void 0:p.status),w=v?Math.min(l,.5):l;let x="standard";m?x="roomServer":d?x="hub":g?x="gateway":h&&(x="mobile");const y=a.fullAffinity.get(t),k=a.txDelayRecommendations.get(t);e.push({type:"Feature",geometry:{type:"Point",coordinates:[s.longitude,s.latitude]},properties:{hash:t,name:s.node_name||s.name||"Unknown",hashPrefix:ir(t),iconType:x,isNeighbor:f,isHub:d,isGateway:g,isMobile:h,isRoomServer:m,isStale:v,isZeroHop:f,opacity:w,blinkIntensity:0,lastSeenTimestamp:null==p?void 0:p.lastSeen,centrality:b,neighborJson:JSON.stringify(s),affinityJson:y?JSON.stringify(y):void 0,txDelayRecJson:k?JSON.stringify(k):void 0,meanSnr:(null==p?void 0:p.avgSnr)??void 0,meanRssi:(null==p?void 0:p.avgRssi)??void 0}})}return{type:"FeatureCollection",features:e}},[t,n,o,i,a,c,u]),k=A.useMemo(()=>(null==r?void 0:r.latitude)&&(null==r?void 0:r.longitude)?{type:"FeatureCollection",features:[{type:"Feature",geometry:{type:"Point",coordinates:[r.longitude,r.latitude]},properties:{hash:"local",name:r.name,hashPrefix:n?ir(n):"",iconType:"local",isNeighbor:!1,isHub:!1,isGateway:!1,isMobile:!1,isRoomServer:!1,isStale:!1,isZeroHop:!1,opacity:1,blinkIntensity:0,centrality:0}}]}:{type:"FeatureCollection",features:[]},[r,n]),C=A.useCallback(A=>{var e;if(!A.features||0===A.features.length)return;const t=null==(e=A.features[0].properties)?void 0:e.hash;t&&(g&&g(t),m&&"local"!==t&&m(t))},[g,m]),B=A.useCallback(A=>{var e,t;if(!A.features||0===A.features.length)return;const r=null==(e=null==p?void 0:p.getMap)?void 0:e.call(p);r&&(r.getCanvas().style.cursor="pointer");const n=null==(t=A.features[0].properties)?void 0:t.hash;n&&l(n)},[p,l]),M=A.useCallback(()=>{var A;const e=null==(A=null==p?void 0:p.getMap)?void 0:A.call(p);e&&(e.getCanvas().style.cursor=""),l(null)},[p,l]);A.useEffect(()=>{var A;const e=null==(A=null==p?void 0:p.getMap)?void 0:A.call(p);if(!e||!w)return;const t=[Gt,Ot];for(const r of t)e.on("click",r,C),e.on("mouseenter",r,B),e.on("mouseleave",r,M);return()=>{for(const A of t)e.off("click",A,C),e.off("mouseenter",A,B),e.off("mouseleave",A,M)}},[p,w,C,B,M]);const D=A.useRef(y),E=A.useRef(k);A.useEffect(()=>{D.current=y,E.current=k},[y,k]),A.useEffect(()=>{var A;const e=null==(A=null==p?void 0:p.getMap)?void 0:A.call(p);if(!e||!w||!b||0===b.size)return;const t=e.getSource(zt),r=e.getSource(`${zt}-local`);if(t||r){if(t){const A=D.current;let e=!1;const r=A.features.map(A=>{const t=b.get(A.properties.hash)??0;return t!==A.properties.blinkIntensity?(e=!0,{...A,properties:{...A.properties,blinkIntensity:t}}):A});e&&t.setData({type:"FeatureCollection",features:r})}if(r&&n){const A=b.get(n)??0,e=E.current;e.features.length>0&&e.features[0].properties.blinkIntensity!==A&&r.setData({type:"FeatureCollection",features:[{...e.features[0],properties:{...e.features[0].properties,blinkIntensity:A}}]})}}},[p,w,b,n]);const Q=A.useMemo(()=>{if(!d)return null;if("local"===d&&r)return{longitude:r.longitude,latitude:r.latitude,isLocal:!0,name:r.name,hash:n};const A=y.features.find(A=>A.properties.hash===d);if(!A)return null;const e=A.properties,t=e.txDelayRecJson?JSON.parse(e.txDelayRecJson):void 0;return{longitude:A.geometry.coordinates[0],latitude:A.geometry.coordinates[1],isLocal:!1,hash:e.hash,hashPrefix:e.hashPrefix,name:e.name,isHub:e.isHub,isGateway:e.isGateway,isBackbone:"backbone"===(null==t?void 0:t.networkRole),isZeroHop:e.isZeroHop,isMobile:e.isMobile,isRoomServer:e.isRoomServer,isStale:e.isStale,lastSeenTimestamp:e.lastSeenTimestamp,centrality:e.centrality,neighbor:e.neighborJson?JSON.parse(e.neighborJson):void 0,affinity:e.affinityJson?JSON.parse(e.affinityJson):void 0,txDelayRec:t,meanSnr:e.meanSnr,meanRssi:e.meanRssi}},[d,r,n,y]);if(!w)return null;const j=mA(),N=["case",[">",["get","blinkIntensity"],.66],rr,[">",["get","blinkIntensity"],.33],er,["==",["get","iconType"],"roomServer"],["case",["get","isNeighbor"],$t,qt],["==",["get","iconType"],"hub"],["case",["get","isNeighbor"],Vt,Wt],["==",["get","iconType"],"gateway"],["case",["get","isNeighbor"],Kt,Zt],["==",["get","iconType"],"mobile"],["case",["get","isNeighbor"],Xt,Jt],["case",["get","isNeighbor"],Yt,Ut]],S=["interpolate",["linear"],["zoom"],6,.25,10,1];return e.jsxs(e.Fragment,{children:[e.jsx(R,{id:zt,type:"geojson",data:y,children:e.jsx(_,{id:Gt,type:"symbol",layout:{"icon-image":N,"icon-size":S,"icon-allow-overlap":!0,"icon-ignore-placement":!0,"symbol-sort-key":["get","opacity"]},paint:{"icon-opacity":["get","opacity"]}})}),e.jsx(R,{id:`${zt}-local`,type:"geojson",data:k,children:e.jsx(_,{id:Ot,type:"symbol",layout:{"icon-image":["case",[">",["get","blinkIntensity"],.66],nr,[">",["get","blinkIntensity"],.33],tr,Ar],"icon-size":S,"icon-allow-overlap":!0,"icon-ignore-placement":!0},paint:{"icon-opacity":1}})}),Q&&h&&e.jsx(Y,{longitude:Q.longitude,latitude:Q.latitude,offset:{center:[0,0],top:[0,12],"top-left":[6,12],"top-right":[-6,12],bottom:[0,-12],"bottom-left":[6,-12],"bottom-right":[-6,-12],left:[12,0],right:[-12,0]},maxWidth:"280px",closeOnClick:!0,onClose:h,className:"maplibre-popup",children:Q.isLocal?e.jsxs("div",{className:"text-sm",children:[e.jsx("strong",{className:"text-base",children:Q.name}),Q.hash&&e.jsx("span",{className:"ml-2 font-mono text-xs text-text-muted bg-surface-elevated px-1.5 py-0.5 rounded",children:ir(Q.hash)}),e.jsx("br",{}),e.jsx("span",{style:{color:j.localColor},className:"font-medium",children:"This Node (Local)"}),e.jsx("br",{}),r&&e.jsxs("span",{className:"text-xs text-text-muted",children:[r.latitude.toFixed(5),", ",r.longitude.toFixed(5)]})]}):Q.neighbor&&Q.hash?e.jsx(Ht,{hash:Q.hash,hashPrefix:Q.hashPrefix,name:Q.name,isHub:Q.isHub,isGateway:Q.isGateway,isBackbone:Q.isBackbone,isZeroHop:Q.isZeroHop,isMobile:Q.isMobile,isRoomServer:Q.isRoomServer,isStale:Q.isStale,lastSeenTimestamp:Q.lastSeenTimestamp,centrality:Q.centrality,affinity:Q.affinity,meanSnr:Q.meanSnr,meanRssi:Q.meanRssi,neighbor:Q.neighbor,txDelayRec:Q.txDelayRec,onRemove:f?()=>f(Q.hash,Q.name):void 0}):null})]})}const sr=[Gt,Ot];A.createContext(null);const lr="topology-validated-edges-native",cr="topology-weak-edges-native",ur="neighbor-edges-native",fr="topology-weak-edges-native",dr="topology-validated-edges-native",gr="neighbor-edges-native",hr={type:"FeatureCollection",features:[]},mr={"line-cap":"round","line-join":"round"},br={"line-color":"transparent","line-width":16,"line-opacity":0};function pr({showTopology:t,isExiting:r,hoveredEdgeKey:n,highlightedLoopEdges:o,highlightedFocusEdges:i,onEdgeHover:a,onLoopHover:s,loops:l=[],neighborNames:c={},opacityBias:u=.5,widthMultiplier:f=1,trafficFilter:d=0,showNeighborLines:g=!0,disableHover:h=!1}){const{current:m}=I(),b=t||r,p=!0,v=g?"visible":"none",w=h||r,x=A.useRef(null),y=A.useRef(w),k=A.useRef(new Map),C=A.useRef(c),B=A.useRef(s);A.useLayoutEffect(()=>{y.current=w,C.current=c,B.current=s});const M=A.useMemo(()=>function(A){const e=new Map;for(const t of A)for(const A of t.edgeKeys){const r=e.get(A)??[];r.push(t),e.set(A,r)}return e}(l),[l]);A.useLayoutEffect(()=>{k.current=M},[M]);const D=A.useCallback(A=>{var e,t;if(y.current)return;if(!A.features||0===A.features.length)return;const r=A.features[0].properties;if(!(null==r?void 0:r.key))return;const n=r.key;if(n!==x.current){x.current=n;const o=!0===r.isNeighborEdge||"true"===r.isNeighborEdge,i=!0===r.isLoopEdge||"true"===r.isLoopEdge;if(o){const t={key:n,fromName:"Local",toName:r.name,certainCount:Number(r.packetCount)||0,confidence:1,isBackbone:!1,isLoopEdge:!1,isDirectPath:!0,isZeroHop:!0,symmetryRatio:1,dominantDirection:"balanced",isHubConnection:!1};a(n,[A.lngLat.lng,A.lngLat.lat],t),null==(e=B.current)||e.call(B,null)}else if(i&&B.current){const e=k.current.get(n)??[];if(e.length>0){const t=new Set;for(const A of e)for(const e of A.edgeKeys)t.add(e);const r={loops:e,highlightedEdgeKeys:t,hoveredEdgeKey:n,nodeNames:e[0].nodes.map(A=>C.current[A]||A.substring(0,4))};B.current(r,[A.lngLat.lng,A.lngLat.lat]),a(n)}else{const e={key:n,fromName:r.fromName,toName:r.toName,certainCount:Number(r.certainCount),confidence:Number(r.confidence),isBackbone:!0===r.isBackbone||"true"===r.isBackbone,isLoopEdge:!0,isDirectPath:!0===r.isDirectPath||"true"===r.isDirectPath,isZeroHop:!0===r.isZeroHop||"true"===r.isZeroHop,symmetryRatio:Number(r.symmetryRatio),dominantDirection:r.dominantDirection,isHubConnection:!0===r.isHubConnection||"true"===r.isHubConnection};a(n,[A.lngLat.lng,A.lngLat.lat],e)}}else{const e={key:n,fromName:r.fromName,toName:r.toName,certainCount:Number(r.certainCount),confidence:Number(r.confidence),isBackbone:!0===r.isBackbone||"true"===r.isBackbone,isLoopEdge:i,isDirectPath:!0===r.isDirectPath||"true"===r.isDirectPath,isZeroHop:!0===r.isZeroHop||"true"===r.isZeroHop,symmetryRatio:Number(r.symmetryRatio),dominantDirection:r.dominantDirection,isHubConnection:!0===r.isHubConnection||"true"===r.isHubConnection};a(n,[A.lngLat.lng,A.lngLat.lat],e),null==(t=B.current)||t.call(B,null)}}},[a]),E=A.useCallback(()=>{var A;null!==x.current&&(x.current=null,a(null),null==(A=B.current)||A.call(B,null))},[a]);A.useEffect(()=>{var A;const e=null==(A=null==m?void 0:m.getMap)?void 0:A.call(m);if(!e||!b)return;const t="topology-validated-edges-hitarea-native",r=()=>{try{return e.getStyle()&&e.getLayer(t)}catch{return!1}},n=()=>!!r()&&(e.on("mousemove",t,D),e.on("mouseleave",t,E),!0);if(!n()){const A=()=>{n()&&e.off("styledata",A)};return e.on("styledata",A),()=>{try{e.off("styledata",A),r()&&(e.off("mousemove",t,D),e.off("mouseleave",t,E))}catch{}}}return()=>{try{r()&&(e.off("mousemove",t,D),e.off("mouseleave",t,E))}catch{}}},[m,b,D,E]),A.useEffect(()=>{var A;const e=null==(A=null==m?void 0:m.getMap)?void 0:A.call(m);if(!e||!g)return;const t="neighbor-edges-hitarea-native",r=()=>{try{return e.getStyle()&&e.getLayer(t)}catch{return!1}},n=()=>!!r()&&(e.on("mousemove",t,D),e.on("mouseleave",t,E),!0);if(!n()){const A=()=>{n()&&e.off("styledata",A)};return e.on("styledata",A),()=>{try{e.off("styledata",A),r()&&(e.off("mousemove",t,D),e.off("mouseleave",t,E))}catch{}}}return()=>{try{r()&&(e.off("mousemove",t,D),e.off("mouseleave",t,E))}catch{}}},[m,p,g,D,E]),A.useEffect(()=>{var A;const e=null==(A=null==m?void 0:m.getMap)?void 0:A.call(m);if(!e)return;let t=null;const r=(A,t)=>{try{if(e.getLayer(A)&&e.getLayer(t))return e.moveLayer(A,t),!0}catch{}return!1},n=()=>{try{if(!e.getLayer("node-markers-layer"))return;r(gr,"node-markers-layer"),r("neighbor-edges-hitarea-native",gr),(r(dr,"neighbor-edges-hitarea-native")||r(dr,"node-markers-layer"))&&r("topology-validated-edges-hitarea-native",dr),r(fr,"topology-validated-edges-hitarea-native")}catch{}},o=()=>{t&&clearTimeout(t),t=setTimeout(n,50)},i=setTimeout(n,100);e.on("styledata",o);const a=A=>{(A.sourceId===lr||A.sourceId===cr||A.sourceId===ur)&&o()};return e.on("sourcedata",a),()=>{clearTimeout(i),t&&clearTimeout(t);try{e.off("styledata",o),e.off("sourcedata",a)}catch{}}},[m,b,p,g]);const Q=w?null:n,j=function(A,e,t,r,n,o){const i=LA(),a=null!==A,s=n&&n.size>0,l=o&&o.size>0,c=s?Array.from(n):[],u=l?Array.from(o):[],f=e<=0?["get","baseColor"]:["case",[">=",["get","brightnessScore"],1-.5*e],"#FFFFFF",["get","baseColor"]],d=e<=0?1:["max",.1,["+",1,["*",e,3,["-",["get","brightnessScore"],.5]]]],g=s?["in",["get","key"],["literal",c]]:l?["in",["get","key"],["literal",u]]:!!a&&["==",["get","key"],A],h=a||s||l,m=i.edges.hoverLoop??"#A78BFA";return{"line-color":h?["case",g,s?m:l?"#FFD700":["get","hoverColor"],f]:f,"line-width":h?["case",g,["max",["*",["get","baseWidth"],t,1.3],3.5],["*",["get","baseWidth"],t]]:["*",["get","baseWidth"],t],"line-opacity":["case",["<",["get","brightnessScore"],r],0,h?["case",g,["min",["*",["get","baseOpacity"],1.25],1],["*",["get","baseOpacity"],d,.35]]:["*",["get","baseOpacity"],d]]}}(Q,u,f,d,w?null:o,i??null),N=function(A){const e=null!==A,{YELLOW:t,GREEN:r,RED:n,GRAY:o}=Z,i=["to-number",["get","listenerScore"],0],a=["to-number",["get","loudScore"],0],s=["/",i,["max",["+",i,a],1]],l=["*",["+",.2,["*",["to-number",["get","trafficWeight"],0],.8]],8];return{"line-color":["case",["all",["==",i,0],["==",a,0]],o,[">=",s,.97],r,["<=",s,.03],n,["interpolate",["linear"],s,.03,n,.5,t,.97,r]],"line-width":["interpolate",["linear"],["zoom"],6,e?["case",["==",["get","key"],A],["max",["*",l,.25],1.25],["*",l,.25]]:["*",l,.25],10,e?["case",["==",["get","key"],A],["max",l,5],l]:l],"line-opacity":e?["case",["==",["get","key"],A],1,.35]:.9}}(Q);return e.jsxs(e.Fragment,{children:[b&&e.jsx(R,{id:cr,type:"geojson",data:hr,children:e.jsx(_,{id:fr,type:"line",paint:j,layout:{...mr,visibility:v}})}),b&&e.jsxs(R,{id:lr,type:"geojson",data:hr,children:[e.jsx(_,{id:"topology-validated-edges-hitarea-native",type:"line",paint:br,layout:{...mr,visibility:v}}),e.jsx(_,{id:dr,type:"line",paint:j,layout:{...mr,visibility:v}})]}),e.jsxs(R,{id:ur,type:"geojson",data:hr,children:[e.jsx(_,{id:"neighbor-edges-hitarea-native",type:"line",paint:br,layout:{...mr,visibility:v}}),e.jsx(_,{id:gr,type:"line",paint:N,layout:{...mr,visibility:v}})]})]})}const vr=["topology-validated-edges-hitarea-native","topology-validated-edges-native","topology-weak-edges-native","neighbor-edges-hitarea-native","neighbor-edges-native"];function wr({targetHash:e,nodeCoordinates:t,onComplete:r}){const{current:n}=I(),o=A.useRef(null);return A.useEffect(()=>{if(!n||!e||e===o.current)return;const A=t.get(e);if(!A)return;const i=n.getMap();i.isMoving()&&i.stop(),o.current=e;const[a,s]=A;n.flyTo({center:[s,a],zoom:10,duration:2500,essential:!0}),setTimeout(()=>{null==r||r()},2600)},[e,t,n,r]),null}function xr({highlightedEdgeKey:e,validatedPolylines:t,weakPolylines:r,onEnsureTopology:n}){const{current:o}=I(),i=A.useRef(null);return A.useEffect(()=>{if(!o||!e)return;if(e===i.current)return;i.current=e,n();const A=t.find(A=>A.edge.key===e)||r.find(A=>A.edge.key===e);if(!A)return;if(o.getMap().isMoving())return;const a=(A.from[0]+A.to[0])/2,s=(A.from[1]+A.to[1])/2,l=o.getZoom(),c=Math.max(l,11);o.easeTo({center:[s,a],zoom:c,duration:500})},[e,t,r,o,n]),null}function yr(A,e,t,r=64){const n=[],o=t/6371e3*(180/Math.PI),i=o/Math.cos(e*Math.PI/180);for(let a=0;a<=r;a++){const t=a/r*2*Math.PI,s=A+i*Math.cos(t),l=e+o*Math.sin(t);n.push([s,l])}return{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[n]}}}function kr({ghost:t,neighborCoordinates:r,onHighlightedNeighborsChange:n}){const{current:o}=I(),i=A.useRef(null),a=A.useRef(null),s=A.useMemo(()=>t?new Set(t.commonNeighbors):new Set,[t]);A.useEffect(()=>{null==n||n(s)},[s,n]);const l=A.useMemo(()=>{if(!(null==t?void 0:t.commonNeighbors)||t.commonNeighbors.length<2)return 8e3;let A=0;const e=[];for(const n of t.commonNeighbors){const A=r.get(n);A&&e.push(A)}t.estimatedLocation&&e.push([t.estimatedLocation.lat,t.estimatedLocation.lon]);for(let t=0;tA&&(A=n)}return Math.max(A,2e3)},[t,r]),c=A.useMemo(()=>{if(!(null==t?void 0:t.estimatedLocation))return{type:"FeatureCollection",features:[]};const{lat:A,lon:e,uncertaintyM:r}=t.estimatedLocation,n=.5*l,o=r>0?r:2e3;return{type:"FeatureCollection",features:[yr(e,A,Math.max(500,Math.min(o,n)))]}},[t,l]);if(A.useEffect(()=>{if(!o)return;const A=o.getMap();if(t&&t.prefix!==a.current){if(a.current=t.prefix,!i.current&&A.getZoom()>3){const e=A.getCenter();i.current={center:[e.lng,e.lat],zoom:A.getZoom(),pitch:A.getPitch(),bearing:A.getBearing()}}const e=[];for(const A of t.commonNeighbors){const t=r.get(A);t&&e.push([t[1],t[0]])}if(t.estimatedLocation&&e.push([t.estimatedLocation.lon,t.estimatedLocation.lat]),e.length>0){const r=()=>{var n;if(A.isMoving())setTimeout(r,100);else if(1===e.length)o.flyTo({center:e[0],zoom:13,duration:1500});else{let A=1/0,r=-1/0,i=1/0,a=-1/0;for(const[t,n]of e)A=Math.min(A,t),r=Math.max(r,t),i=Math.min(i,n),a=Math.max(a,n);if(null==(n=t.estimatedLocation)?void 0:n.uncertaintyM){const e=t.estimatedLocation.uncertaintyM/111e3;A-=e,r+=e,i-=e,a+=e}o.fitBounds([[A,i],[r,a]],{padding:{top:60,bottom:60,left:60,right:60},maxZoom:14,duration:1500})}};setTimeout(r,50)}}if(!t&&null!==a.current&&(a.current=null,i.current)){const e=i.current,t=()=>{A.isMoving()?setTimeout(t,100):(o.flyTo({center:e.center,zoom:e.zoom,pitch:e.pitch,bearing:e.bearing,duration:1e3}),i.current=null)};setTimeout(t,50)}},[t,o,r]),!(null==t?void 0:t.estimatedLocation))return null;return e.jsx(R,{id:"ghost-uncertainty-circle",type:"geojson",data:c,children:e.jsx(_,{id:"ghost-uncertainty-fill",type:"fill",paint:{"fill-color":"rgba(167, 139, 250, 0.15)","fill-opacity":.8}})})}!function(A){const e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(A);e&&(parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16))}(TA.edges.neighborHover);const Cr={version:8,sources:{},layers:[],glyphs:"https://demotiles.maplibre.org/font/{fontstack}/{range}.pbf"},Br={longitude:0,latitude:0,zoom:2};function Mr({data:A}){const t=A.subtitle&&"loop"===A.type,r=A.subtitle&&"loop"!==A.type;return e.jsxs("div",{className:"w-[540px]",children:[e.jsxs("div",{className:"flex items-center justify-between h-5",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[A.title.icon&&e.jsx("span",{className:`${A.title.color} text-base leading-none flex-shrink-0`,children:A.title.icon}),e.jsx("span",{className:`${A.title.color} font-semibold text-[13px] truncate`,children:A.title.text}),r&&e.jsx("span",{className:`${A.subtitle.color} text-[11px] flex-shrink-0`,children:A.subtitle.text})]}),A.badges.length>0&&e.jsx("div",{className:"flex items-center gap-2 flex-shrink-0 ml-3",children:A.badges.map((A,t)=>e.jsx("span",{className:`${A.color} text-[11px] font-medium`,children:A.text},t))})]}),t&&e.jsx("div",{className:"h-4 mt-0.5 overflow-hidden",children:e.jsx("span",{className:"font-mono text-[10px] text-text-muted truncate block",children:A.subtitle.text})}),e.jsx("div",{className:`flex items-center gap-4 h-4 ${t?"mt-1":"mt-1.5"} text-[11px]`,children:A.stats.map((A,t)=>e.jsxs("span",{className:"whitespace-nowrap",children:[e.jsx("span",{className:`font-mono tabular-nums font-semibold ${A.color??"text-text-primary"}`,children:A.value}),e.jsx("span",{className:"text-text-muted ml-1",children:A.label}),A.unit&&e.jsx("span",{className:"text-text-muted/50 ml-0.5",children:A.unit})]},t))})]})}function Dr({neighbors:t,localNode:r,localHash:n,onRemoveNode:o,selectedNodeHash:i,onNodeSelected:a,highlightedEdgeKey:s,highlightedGhost:l}){const c=A.useRef(null),u=sA(),f=lA(),d=cA(),g=uA(),h=fA(),[m,b]=A.useState(!1),p=wt(A=>A.viewState),v=wt(A=>A.toggles),w=wt(A=>A.hasAnalyzed),x=wt(A=>A.setViewState),y=wt(A=>A.setToggle),k=wt(A=>A.setHasAnalyzed),C=dA(A=>A.preloadFromNodes),B=dA(A=>A.isLoading),M=dA(A=>A.terrainGrid),D=n??h,E=A.useMemo(()=>{const A=[];for(const[,e]of Object.entries(t))e.latitude&&e.longitude&&A.push([e.latitude,e.longitude]);return A},[t]),Q=A.useMemo(()=>function(A,e){let t=[...A];if((null==e?void 0:e.latitude)&&(null==e?void 0:e.longitude)&&t.push([e.latitude,e.longitude]),0===t.length)return null;if(1===t.length){const[A,e]=t[0];return{longitude:e,latitude:A,zoom:14}}t=function(A,e){if(A.length<=2)return A;let t,r;if((null==e?void 0:e.latitude)&&(null==e?void 0:e.longitude))t=e.latitude,r=e.longitude;else{let e=0,n=0;for(const[t,r]of A)e+=t,n+=r;t=e/A.length,r=n/A.length}const n=A.map(([A,e])=>{return{pos:[A,e],dist:(n=t,o=r,i=A,a=e,FA(n,o,i,a)/1e3)};var n,o,i,a});n.sort((A,e)=>A.dist-e.dist);const o=n[Math.floor(n.length/2)].dist,i=Math.max(3*o,50),a=n.filter(A=>A.dist<=i).map(A=>A.pos);return a.length<.5*A.length?A:a}(t,e);let r=1/0,n=-1/0,o=1/0,i=-1/0;for(const[d,g]of t)r=Math.min(r,g),n=Math.max(n,g),o=Math.min(o,d),i=Math.max(i,d);const a=(r+n)/2,s=(o+i)/2,l=i-o,c=n-r,u=Math.max(l,c);let f=16;return u>0&&(f=Math.floor(Math.log2(360/u*1.2)),f=Math.max(1,Math.min(14,f))),f=Math.min(f+1,12),{longitude:a,latitude:s,zoom:f}}(E,r),[E,r]),[j,N]=A.useState(()=>p??Q??Br),S=A.useCallback(A=>{N(A),x(A)},[x]),F=A.useRef(!!p);A.useEffect(()=>{F.current||!Q||p?p&&setTimeout(()=>b(!0),50):(N(Q),x(Q),F.current=!0,setTimeout(()=>b(!0),50))},[Q,p,x]);const[P,T]=A.useState(!1),[L,I]=A.useState(()=>!(v.showTopology&&!g.topologyLoadComplete)&&v.showTopology),[R,_]=A.useState(v.showNeighborLines),[H,z]=A.useState(!1),[G,O]=A.useState(v.showMinCut),[U,Y]=A.useState(be),[Z,J]=A.useState(v.show3DTerrain),[X,q]=A.useState(v.nodeFilter),$=A.useCallback(A=>{I(e=>{const t="function"==typeof A?A(e):A;return y("showTopology",t),t})},[y]),AA=A.useCallback(A=>{_(e=>{const t="function"==typeof A?A(e):A;return y("showNeighborLines",t),t})},[y]),iA=A.useCallback(A=>{O(e=>{const t="function"==typeof A?A(e):A;return y("showMinCut",t),t})},[y]),aA=A.useCallback(A=>{J(e=>{const t="function"==typeof A?A(e):A;return y("show3DTerrain",t),t})},[y]),mA=A.useCallback(A=>{q(A),y("nodeFilter",A)},[y]),[bA,pA]=A.useState(null),[vA,wA]=A.useState(null),[xA,yA]=A.useState(null),[kA]=A.useState(0),[DA]=A.useState(.5),[EA]=A.useState(0),[QA,jA]=A.useState(null),[NA,SA]=A.useState(""),[TA,LA]=A.useState(!1),[RA,_A]=A.useState("fetching"),[HA,zA]=A.useState(!1),[GA,OA]=A.useState(0),[UA,VA]=A.useState(()=>!(w&&!g.topologyLoadComplete)&&w);A.useEffect(()=>{g.topologyLoadComplete||(w&&!UA&&k(!1),v.showTopology&&!L&&y("showTopology",!1))},[w,v.showTopology,g.topologyLoadComplete,UA,L,k,y]);const ZA=A.useCallback(A=>{VA(A),k(A)},[k]),[KA,XA]=A.useState(null),$A=A.useCallback(A=>XA(A),[]),ee=A.useCallback(()=>XA(null),[]),[,te]=A.useState(new Set),re=ce(A=>A.coveragePoints),ne=ce(A=>A.isVisible),oe=ce(A=>A.brightness),ie=ce(A=>A.openModal),ae=ye(A=>A.isEnabled),se=ye(A=>A.toggle),le=CA(),ue=BA(),fe=A.useRef(!1);A.useEffect(()=>{re.length>0&&ne&&!fe.current&&(AA(!1),fe.current=!0)},[re.length,ne]);const de=A.useRef(null);A.useEffect(()=>{if(i&&i!==de.current){de.current=i;const A=setTimeout(()=>{XA(i)},1250);return()=>clearTimeout(A)}},[i]);const[ge,he]=A.useState(null),[pe,ve]=A.useState(null),xe=A.useCallback((A,e,t)=>{wA(A),A&&e&&t?he({longitude:e[0],latitude:e[1],type:"topology",properties:{key:t.key,fromName:t.fromName,toName:t.toName,certainCount:t.certainCount,confidence:t.confidence,isBackbone:t.isBackbone,isLoopEdge:t.isLoopEdge,isDirectPath:t.isDirectPath,isHubConnection:t.isHubConnection,symmetryRatio:t.symmetryRatio,dominantDirection:t.dominantDirection}}):A||he(null)},[]),ke=A.useCallback((A,e)=>{ve(A),A&&he(null)},[]),Ce=A.useMemo(()=>{var A;if(!L)return null;if(!bA)return null;if(vA)return null;const e=u.loops;if(0===e.length)return null;const r=function(A,e,t){const r=function(A,e){return e.filter(e=>e.nodes.includes(A)).sort((A,e)=>e.avgCertainCount-A.avgCertainCount)}(A,e),n=new Set,o=[];for(const i of r)for(const A of i.edgeKeys)if(!n.has(A)){n.add(A);const e=t.get(A);o.push({key:A,certainCount:(null==e?void 0:e.certainCount)??0})}return o.sort((A,e)=>e.certainCount-A.certainCount),{loops:r,highlightedEdgeKeys:n,sortedEdges:o}}(bA,e,u.edgeMap);if(0===r.loops.length)return null;const n=r.loops[0].nodes.map(A=>{var e,r;return A===D?"You":(null==(e=t[A])?void 0:e.node_name)||(null==(r=t[A])?void 0:r.name)||A.substring(0,4)});return{loops:r.loops,highlightedEdgeKeys:r.highlightedEdgeKeys,hoveredEdgeKey:(null==(A=r.sortedEdges[0])?void 0:A.key)||"",nodeNames:n}},[L,bA,vA,u.loops,u.edgeMap,t,D]);A.useEffect(()=>{vA||ve(Ce)},[Ce,vA]);const Be=A.useMemo(()=>{const A={};for(const[e,r]of Object.entries(t))A[e]=r.node_name||r.name||e.substring(0,4);return D&&(A[D]="You"),A},[t,D]),Me=A.useMemo(()=>Object.entries(t).filter(([,A])=>A.latitude&&A.longitude),[t]),De=A.useMemo(()=>{const A=new Map;D&&(null==r?void 0:r.latitude)&&(null==r?void 0:r.longitude)&&A.set(D,[r.latitude,r.longitude]);for(const[e,t]of Me)t.latitude&&t.longitude&&A.set(e,[t.latitude,t.longitude]);return A},[D,r,Me]),Ee=A.useMemo(()=>{const A=new Map;for(const e of d)"expired"!==e.status&&A.set(e.hash,{hash:e.hash,prefix:e.prefix,count:e.count,avgRssi:e.avgRssi,avgSnr:e.avgSnr,lastSeen:e.lastSeen,confidence:1,status:e.status});return A},[d]),Qe=A.useMemo(()=>{var A,e;const r=new Set;for(const n of Ee.keys())(null==(A=t[n])?void 0:A.latitude)&&(null==(e=t[n])?void 0:e.longitude)&&r.add(n);return r},[Ee,t]),je=A.useMemo(()=>{if(0===Qe.size||!D)return new Map;const A=tA.getPackets();if(0===A.length)return new Map;const e=nA(D);return K(A,Qe,e).scores},[Qe,D,g.packetCount]),Ne=A.useCallback(A=>!!(D&&(A.fromHash===D&&Qe.has(A.toHash)||A.toHash===D&&Qe.has(A.fromHash))),[D,Qe]),Se=A.useMemo(()=>{var A,e;if(0===d.length||!D)return[];if(g.backgroundLoadComplete)return[];const r=[];for(const n of d){if("expired"===n.status)continue;if(!(null==(A=t[n.hash])?void 0:A.latitude)||!(null==(e=t[n.hash])?void 0:e.longitude))continue;const o=[D,n.hash].sort(),i=`${o[0]}~${o[1]}`;r.push({fromHash:D,toHash:n.hash,key:i,packetCount:n.count,avgConfidence:1,strength:.8,avgRecency:1,hopDistanceFromLocal:0,isHubConnection:!1,isCertain:!0,certainCount:n.count,isLoopEdge:!1,forwardCount:n.count,reverseCount:0,symmetryRatio:0,dominantDirection:"forward",floodCount:n.count,directCount:0,isDirectPathEdge:!1,isZeroHop:!0,avgRssi:n.avgRssi,avgSnr:n.avgSnr})}return r},[d,D,g.backgroundLoadComplete,t]),Fe=A.useMemo(()=>{const A=[];if(Se.length>0&&!g.backgroundLoadComplete){for(const e of Se){const t=De.get(e.fromHash),r=De.get(e.toHash);t&&r&&A.push({from:t,to:r,edge:e})}return A}for(const e of u.validatedEdges){if(Ne(e))continue;const t=De.get(e.fromHash),r=De.get(e.toHash);t&&r&&A.push({from:t,to:r,edge:e})}return A},[u.validatedEdges,De,Ne,Se,g.backgroundLoadComplete]),Pe=A.useMemo(()=>{const A=[];for(const e of u.weakEdges){if(Ne(e))continue;const t=De.get(e.fromHash),r=De.get(e.toHash);t&&r&&A.push({from:t,to:r,edge:e})}return A},[u.weakEdges,De,Ne]),Te=A.useMemo(()=>{if(!(null==r?void 0:r.latitude)||!(null==r?void 0:r.longitude))return[];const A=[],e=[r.latitude,r.longitude],n=new Map;for(const t of u.lastHopNeighbors)n.set(t.hash,t.count);const o=new Map;for(const t of d)o.set(t.hash,t.count);for(const r of Qe){const i=t[r];if(!(null==i?void 0:i.latitude)||!(null==i?void 0:i.longitude))continue;const a=o.get(r),s=n.get(r);A.push({from:e,to:[i.latitude,i.longitude],hash:r,neighbor:i,lastHopData:Ee.get(r)??null,rxAdvertCount:a,txProxyCount:s})}return A},[r,Qe,t,Ee,u.lastHopNeighbors,d]),Le=A.useMemo(()=>new Set(u.loopEdgeKeys),[u.loopEdgeKeys]),Ie=A.useMemo(()=>new Set(u.backboneEdges),[u.backboneEdges]),Re=A.useMemo(()=>{if(!xA)return null;const A=u.validatedEdges.filter(A=>A.fromHash===xA||A.toHash===xA);if(0===A.length)return null;const e=[...A].sort((A,e)=>e.certainCount-A.certainCount),t=Math.max(1,Math.ceil(.2*e.length)),r=e.slice(0,t);return new Set(r.map(A=>A.key))},[xA,u.validatedEdges]),_e=A.useMemo(()=>{let A=0;if(Se.length>0&&!g.backgroundLoadComplete){for(const e of Se)e.certainCount>A&&(A=e.certainCount);return A||1}for(const e of u.validatedEdges)e.certainCount>A&&(A=e.certainCount);return A||1},[u.validatedEdges,Se,g.backgroundLoadComplete]),He=A.useMemo(()=>{if(0===u.validatedEdges.length)return null;const A=new Set;for(const r of u.validatedEdges)A.add(r.fromHash),A.add(r.toHash);const e=Array.from(A).filter(A=>De.has(A)).sort();if(e.length<3)return null;const t=new Map;for(const r of e){const A=De.get(r);A&&t.set(r,A)}return function(A,e,t,r){const n=e.length;if(n<3)return{communities:new Map([[0,e]]),nodePartitions:e.map(A=>({hash:A,community:0,fiedlerValue:0})),numCommunities:1,fiedlerValue:0,isConnected:n<=1};const o=[];let i=1/0;const a=[[e,0]];for(;a.length>0;){const[e,n]=a.shift();if((t?it(e,t):0)>20&&n<4&&e.length>=10){const o=at(A,e,t,r);if(o){i=Math.min(i,o.fiedlerValue),a.push([o.group0,n+1]),a.push([o.group1,n+1]);continue}}o.push(e)}const s=new Map,l=[],c=new Map;for(let u=0;u{iA(A=>{const e=!A;if(e&&He&&c.current){const A=c.current.getMap();if(!A)return e;let t=1/0,r=-1/0,n=1/0,o=-1/0,i=!1;for(const[,e]of He.communities)for(const A of e){const e=De.get(A);if(e){const[A,a]=e;n=Math.min(n,A),o=Math.max(o,A),t=Math.min(t,a),r=Math.max(r,a),i=!0}}i&&A.fitBounds([[t,n],[r,o]],{padding:{top:60,bottom:100,left:60,right:320},duration:800,maxZoom:14})}return e})},[He,De]),Ge=A.useRef(null);A.useLayoutEffect(()=>{var A,e;Ge.current=(null==(e=null==(A=c.current)?void 0:A.getMap)?void 0:e.call(A))??null});const Oe=eA(),Ue=A.useMemo(()=>tA.getPackets(),[Oe]);!function({map:e,nodeCoordinates:t,packets:r,localHash:n,neighbors:o,meshTopology:i,enabled:a=!0}){const s=A.useRef(null),l=e&&"current"in e?e.current:e;A.useEffect(()=>{s.current=l},[l]);const c=A.useRef(!1),u=A.useRef(null),f=A.useRef([]),d=A.useRef(0),g=A.useRef(!1),[h,m]=A.useState(!1),b=A.useRef(null),p=A.useRef([]),v=A.useRef(new Map),w=A.useRef(t);A.useEffect(()=>{w.current=t},[t]),A.useEffect(()=>{v.current=function(A,e){const t=new Map;for(const r of Object.keys(A)){const A=nA(r);t.has(A)||t.set(A,r)}if(e){const A=nA(e);t.set(A,e)}return t}(o,n)},[o,n]),A.useEffect(()=>{if(!a){b.current&&(clearTimeout(b.current),b.current=null),p.current=[],null!==u.current&&(cancelAnimationFrame(u.current),u.current=null),f.current=[];const A=s.current;if(A&&c.current){const e=A.getSource(jt);e&&e.setData({type:"FeatureCollection",features:[]})}g.current=!1,d.current=0}},[a]),A.useEffect(()=>{const A=l;if(!A)return;let e=null,t=!1;const r=()=>{if(!t&&!c.current)try{A.getLayer(Nt)&&A.removeLayer(Nt),A.getSource(jt)&&A.removeSource(jt),A.addSource(jt,{type:"geojson",data:{type:"FeatureCollection",features:[]}});const t=A.getLayer(Pt)?Pt:void 0;A.addLayer({id:Nt,type:"line",source:jt,layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["case",["any",["==",["get","isSpeculative"],!0],["==",["get","isSpeculative"],"true"]],"#8B7BAD","#12A594"],"line-width":["case",["any",["==",["get","isSpeculative"],!0],["==",["get","isSpeculative"],"true"]],1.875,2.5],"line-opacity":["*",["get","opacityMult"],["interpolate",["linear"],["get","intensity"],0,0,.1,.8,.5,1,1,1]]}},t),c.current=!0,m(!0),e&&(clearInterval(e),e=null)}catch{}};return A.isStyleLoaded()&&r(),A.once("style.load",()=>{r()}),c.current||(e=setInterval(()=>{c.current?e&&clearInterval(e):r()},100),setTimeout(()=>{e&&(clearInterval(e),e=null)},5e3)),()=>{t=!0,e&&clearInterval(e),null!==u.current&&(cancelAnimationFrame(u.current),u.current=null);const A=s.current;if(A&&c.current){try{A.getLayer(Nt)&&A.removeLayer(Nt),A.getSource(jt)&&A.removeSource(jt)}catch{}c.current=!1,m(!1)}}},[l]);const x=A.useRef(()=>{});A.useEffect(()=>{x.current=()=>{const A=s.current;if(!A)return;const e=A.getSource(jt);if(!e)return;const t=performance.now(),r=f.current,n=[],o=[];for(const i of r){const A=t-i.startTime-i.delay;if(A<(i.isSpeculative?Ft:St)){o.push(i);const e=i.isSpeculative?Lt(A):Tt(A);e>0&&n.push({type:"Feature",properties:{intensity:e,opacityMult:i.isSpeculative?.5:1,isSpeculative:i.isSpeculative??!1},geometry:{type:"LineString",coordinates:[i.fromCoord,i.toCoord]}})}}e.setData({type:"FeatureCollection",features:n}),f.current=o,o.length>0?u.current=requestAnimationFrame(()=>x.current()):u.current=null}},[]);const y=A.useCallback(()=>{const A=s.current;A&&function(A){if(!A.getLayer(Nt))return;const e=A.getLayer(Pt)?Pt:void 0;try{A.moveLayer(Nt,e)}catch{}}(A),null===u.current&&(u.current=requestAnimationFrame(()=>x.current()))},[]),k=A.useCallback(()=>{if(!s.current||!c.current)return;const A=p.current;if(p.current=[],b.current=null,0===A.length)return;const e=v.current,t=w.current;if(0===e.size)return;const r=performance.now();let o=0,a=!1;const l=new Set;for(const s of A){const A=rA(s,n);if(!A||A.original.length<2)continue;const c=A.original;let u=0,d=null;for(let n=0;n0){A.sort((A,e)=>e.confidence-A.confidence);const e=Math.max(1,Math.ceil(.25*A.length)),n=A.slice(0,e),i=o+150*u;for(const{edgeKey:A,otherHash:o}of n){const e=t.get(d),n=t.get(o);f.current.push({edgeKey:A,fromCoord:It(e),toCoord:It(n),startTime:r,delay:i,isSpeculative:!0}),l.add(A),a=!0}}}u>0&&(o+=150*u*.5)}a&&y()},[n,i,y]);A.useEffect(()=>{const A=s.current;if(!a)return;if(!A)return;if(!h)return;if(0===r.length)return;const e=Date.now(),t=d.current;if(!g.current){g.current=!0;const A=(e-3e4)/1e3,t=r.filter(e=>(e.timestamp??0)>=A);let n=0;for(const e of r){const A=e.timestamp??0;A>n&&(n=A)}if(d.current=n,t.length>0){t.sort((A,e)=>(A.timestamp??0)-(e.timestamp??0));const A=t.slice(-20);p.current.push(...A),k()}return}const n=r.filter(A=>(A.timestamp??0)>t);if(0===n.length)return;let o=0;for(const r of n){const A=r.timestamp??0;A>o&&(o=A)}d.current=o,p.current.push(...n),b.current&&clearTimeout(b.current),b.current=setTimeout(k,175)},[a,r,k,h]),A.useEffect(()=>()=>{b.current&&clearTimeout(b.current)},[])}({map:Ge,nodeCoordinates:De,packets:Ue,localHash:D,neighbors:t,meshTopology:u,enabled:ae});const{isExiting:Ye,isAnimating:We,resetAnimationState:Ve}=function({map:e,showTopology:t,validatedPolylines:r,weakPolylines:n,maxCertainCount:o,loopEdgeKeys:i,backboneEdgeKeys:a,highlightedEdgeKey:s,neighbors:l,validatedSourceId:c,weakSourceId:u,neighborPolylines:f=[],showNeighborLines:d=!0,neighborSourceId:g,neighborLinkScores:h=new Map,basemapMode:m}){const b=A.useRef(null);A.useEffect(()=>{const A=e&&"current"in e?e.current:e;b.current=A});const p=A.useRef(new Map),v=A.useRef(1),w=A.useRef(new Map),x=A.useRef(new Map),y=A.useRef(!1),k=A.useRef(null),C=A.useRef(t),B=A.useRef(new Set),M=A.useRef(""),D=A.useRef(new Map),E=A.useRef(""),Q=A.useRef(""),j=A.useRef(""),N=A.useRef(r),S=A.useRef(n),F=A.useRef(o),P=A.useRef(i),T=A.useRef(a),L=A.useRef(s),I=A.useRef(l),R=A.useRef(f),_=A.useRef(d),H=A.useRef(h),z=A.useRef(m);A.useEffect(()=>{N.current=r,S.current=n,F.current=o,P.current=i,T.current=a,L.current=s,I.current=l,R.current=f,_.current=d,H.current=h,z.current=m},[r,n,o,i,a,s,l,f,d,h,m]);const G=A.useCallback((A=!1)=>{var e,t,r,n,o,i,a,s,l,f;const d=b.current;if(!d)return;const h=d.getSource(c),m=d.getSource(u),y=d.getSource(g);if(h){const o=Bt(N.current,!0,p.current,v.current,w.current,x.current,F.current,P.current,T.current,L.current,I.current,z.current),i=`${o.features.length}:${(null==(t=null==(e=o.features[0])?void 0:e.properties)?void 0:t.key)??""}:${(null==(n=null==(r=o.features[o.features.length-1])?void 0:r.properties)?void 0:n.key)??""}:${Array.from(p.current.values()).reduce((A,e)=>A+e,0).toFixed(2)}`;(A||i!==E.current)&&(h.setData(o),E.current=i)}if(m){const e=Bt(S.current,!1,p.current,v.current,w.current,x.current,F.current,P.current,T.current,L.current,I.current,z.current),t=`${e.features.length}:${(null==(i=null==(o=e.features[0])?void 0:o.properties)?void 0:i.key)??""}:${(null==(s=null==(a=e.features[e.features.length-1])?void 0:a.properties)?void 0:s.key)??""}`;(A||t!==Q.current)&&(m.setData(e),Q.current=t)}if(y&&R.current.length>0){const e=Mt(R.current,H.current),t=`${e.features.length}:${(null==(f=null==(l=e.features[0])?void 0:l.properties)?void 0:f.hash)??""}`;(A||t!==j.current)&&(y.setData(e),j.current=t)}},[c,u,g]),O=A.useCallback(()=>{k.current&&(cancelAnimationFrame(k.current),k.current=null),p.current=new Map,v.current=1,w.current=new Map,x.current=new Map,y.current=!1,B.current=new Set,M.current="",D.current=new Map},[]);A.useEffect(()=>{const A=C.current,e=t;if(C.current=t,b.current){if(k.current&&(cancelAnimationFrame(k.current),k.current=null),A&&!e&&!y.current){y.current=!0;const A=new Map(p.current);let e=null;const t=r=>{e||(e=r);const n=r-e,o=Math.min(n/500,1),i=(a=o,1-Math.pow(1-a,3));var a;for(const[e,t]of A)p.current.set(e,t*(1-i));G(!0),o<1?k.current=requestAnimationFrame(t):(y.current=!1,p.current=new Map,B.current=new Set,M.current="",w.current=new Map,x.current=new Map,k.current=null,G(!0))};k.current=requestAnimationFrame(t)}!A&&e&&(p.current=new Map,B.current=new Set,M.current="")}},[t,G]),A.useEffect(()=>{const A=b.current;if(!t||y.current||!A)return;const e=[...r,...n],o=e.map(A=>`${A.edge.key}:${A.edge.certainCount}`).sort().join(","),i=0===B.current.size,a=""!==M.current&&M.current!==o;if(!i&&!a)return void G();const s=[],l=[];for(const{edge:t}of e)B.current.has(t.key)?l.push(t.key):s.push(t.key);a&&l.length>0&&(w.current=new Map(D.current),v.current=0),x.current=new Map;for(const{edge:t}of r){const A=PA(t.certainCount);x.current.set(t.key,A)}for(const t of s)p.current.set(t,0);for(const t of l)p.current.has(t)||p.current.set(t,1);if(s.length>0||a&&l.length>0){k.current&&(cancelAnimationFrame(k.current),k.current=null);let A=null;const e=Math.min(100,IA/Math.max(s.length,1)/2),t=r=>{A||(A=r);const n=r-A;for(let A=0;A0){const A=Math.min(n/IA,1);v.current=Ct(A)}G(!0);const o=IA+(s.length-1)*e;k.current=n{const A=b.current;if(!A||!g)return;const e=()=>{const e=A.getSource(g);if(!e)return!1;if(f.length>0){const A=Mt(f,h);e.setData(A)}else e.setData({type:"FeatureCollection",features:[]});return!0};if(e())return;const t=r=>{r.sourceId===g&&e()&&A.off("sourcedata",t)};A.on("sourcedata",t);const r=()=>{e()&&(A.off("styledata",r),A.off("sourcedata",t))};return A.on("styledata",r),()=>{A.off("sourcedata",t),A.off("styledata",r)}},[g,f,h]);const U=A.useRef(m);return A.useEffect(()=>{m!==U.current&&(U.current=m,E.current="",Q.current="",j.current="",G(!0))},[m,G]),A.useEffect(()=>()=>{k.current&&(cancelAnimationFrame(k.current),k.current=null)},[]),{isExiting:y.current,isAnimating:null!==k.current,resetAnimationState:O,weightAnimProgress:v.current,animStartWeights:w.current,animTargetWeights:x.current}}({map:Ge,showTopology:L,validatedPolylines:Fe,weakPolylines:Pe,maxCertainCount:_e,loopEdgeKeys:Le,backboneEdgeKeys:Ie,highlightedEdgeKey:s,neighbors:t,validatedSourceId:lr,weakSourceId:cr,neighborPolylines:Te,showNeighborLines:R,neighborSourceId:ur,neighborLinkScores:je,basemapMode:le}),Ke=A.useMemo(()=>{const A=new Set;for(const e of u.hubNodes){A.add(e);for(const t of u.validatedEdges)t.fromHash===e&&A.add(t.toHash),t.toHash===e&&A.add(t.fromHash)}return A},[u.hubNodes,u.validatedEdges]),Je=A.useMemo(()=>{const A=new Set;if(!n)return A;for(const e of u.validatedEdges)e.fromHash===n&&A.add(e.toHash),e.toHash===n&&A.add(e.fromHash);return A},[n,u.validatedEdges]),{getNodeOpacity:Xe}=function({soloDirect:e,soloHubs:t,neighborHashes:r,hubConnectedNodes:n,directNodeSet:o,localConnectedNodes:i,showTopology:a}){const[s,l]=A.useState(new Map),c=A.useRef(e),u=A.useRef(t),f=A.useRef(new Map),d=A.useRef(null),g=A.useRef(n),h=A.useRef(o),m=A.useRef(i),b=A.useRef(a);return A.useEffect(()=>{g.current=n,h.current=o,m.current=i,b.current=a},[n,o,i,a]),A.useEffect(()=>{const A=c.current,n=u.current,o=e,i=t;if(c.current=e,u.current=t,A===o&&n===i)return;d.current&&(cancelAnimationFrame(d.current),d.current=null);const a=g.current,s=h.current,p=m.current,v=b.current;for(const e of r)f.current.has(e)||f.current.set(e,Math.random());const w=(A,e,t)=>{const r=a.has(A),n=s.has(A),o=v&&p.has(A);return!e&&!t||(e&&t?r||n||o:t?r:!e||n||o)},x=[];for(const e of r){const t=w(e,A,n),r=w(e,o,i);t!==r&&x.push({hash:e,startOpacity:t?1:0,targetOpacity:r?1:0})}if(0===x.length)return;l(A=>{const e=new Map(A);for(const{hash:t,startOpacity:r}of x)e.set(t,r);return e});const y=x;let k=null;const C=A=>{k||(k=A);const e=A-k;let t=!0;l(()=>{const A=new Map;for(const{hash:r,startOpacity:n,targetOpacity:o}of y){const i=250*(f.current.get(r)??0),a=Math.max(0,e-i),s=Math.min(a/500,1),l=n+(o-n)*Dt(s);A.set(r,l),s<1&&(t=!1)}return A}),e<750&&!t?d.current=requestAnimationFrame(C):(d.current=null,l(new Map))};return d.current=requestAnimationFrame(C),()=>{d.current&&(cancelAnimationFrame(d.current),d.current=null)}},[e,t,r]),{nodeOpacities:s,getNodeOpacity:(A,e)=>s.has(A)?s.get(A):e?1:0}}({soloDirect:"direct"===X,soloHubs:"hubs"===X,neighborHashes:Me.map(([A])=>A),hubConnectedNodes:Ke,directNodeSet:Qe,localConnectedNodes:Je,showTopology:L}),{blinkingNodes:qe,blinkColor:$e}=function({neighbors:e,localHash:t,enabled:r=!0}){const[n,o]=A.useState(new Map),i=eA(),a=A.useRef(tA.getPackets());A.useEffect(()=>{a.current=tA.getPackets()},[i]);const s=A.useRef(0),l=A.useRef(null),c=A.useRef(new Map),u=A.useRef(new Map);A.useEffect(()=>{u.current=function(A){const e=new Map;for(const t of Object.keys(A)){const A=nA(t);e.has(A)||e.set(A,t)}return e}(e)},[e]);const f=A.useRef(null);return A.useEffect(()=>{f.current=()=>{const A=performance.now(),e=c.current;if(0===e.size)return l.current=null,void o(new Map);const t=new Map,r=[];for(const[n,{startTime:o,staggerDelay:i}]of e){const e=A-o-i;if(e<0);else if(e>=750)r.push(n);else{const A=Et(e,750);A>0&&t.set(n,A)}}for(const n of r)e.delete(n);o(t),e.size>0&&f.current?l.current=requestAnimationFrame(f.current):l.current=null}},[]),A.useEffect(()=>{if(!r)return;const A=a.current;if(0===A.length)return;const e=s.current,n=A.filter(A=>(A.timestamp??0)>e);if(0===e){const e=A.reduce((A,e)=>Math.max(A,e.timestamp??0),0);return void(s.current=e)}if(0===n.length)return;const o=n.reduce((A,e)=>Math.max(A,e.timestamp??0),0);s.current=o;const i=performance.now();let d=0;for(const r of n){const A=rA(r,t);if(!A||0===A.original.length)continue;const e=Qt(A.original,u.current,t);if(0===e.length)continue;const n=375;for(let t=0;t()=>{null!==l.current&&(cancelAnimationFrame(l.current),l.current=null)},[]),{blinkingNodes:n,blinkColor:"#00FF00"}}({neighbors:t,localHash:n,enabled:ae}),et=A.useCallback(A=>{if("all"===X)return!0;if("direct"===X)return Qe.has(A);if("hubs"===X){if(u.hubNodes.includes(A))return!0;for(const e of u.validatedEdges){if(e.fromHash===A&&u.hubNodes.includes(e.toHash))return!0;if(e.toHash===A&&u.hubNodes.includes(e.fromHash))return!0}return!1}return!0},[X,Qe,u.hubNodes,u.validatedEdges]);A.useEffect(()=>{"fetching"===RA&&(g.loadProgress?OA(g.loadProgress.loaded):g.packetCount>0&&OA(g.packetCount))},[RA,g.loadProgress,g.packetCount]);const tt=A.useCallback(async()=>{zA(!0),LA(!0),_A("fetching"),OA(0),await f(),_A("analyzing"),await new Promise(A=>setTimeout(A,200)),_A("building");const A=Date.now(),e=Date.now()-A;e<1700&&await new Promise(A=>setTimeout(A,1700-e)),_A("complete"),await new Promise(A=>setTimeout(A,1e3)),LA(!1),zA(!1),Ve(),ZA(!0),setTimeout(()=>{$(!0)},150)},[f,Ve]),rt=A.useCallback(()=>{UA?$(A=>!A):tt()},[UA,tt]),nt=A.useCallback(A=>{S(A.viewState),(A.viewState.pitch??0)>10&&!Z&&aA(!0)},[Z]),ot=A.useCallback(()=>{T(A=>{var e,t,r,n,o,i,a;const s=!A,l=null==(r=null==(t=null==(e=c.current)?void 0:e.getContainer())?void 0:t.closest(".map-container-fullscreen, .map-container-16-9"))?void 0:r.parentElement;return s?l&&document.fullscreenEnabled?null==(n=l.requestFullscreen)||n.call(l).catch(()=>{}):l&&document.webkitFullscreenEnabled&&(null==(o=l.webkitRequestFullscreen)||o.call(l)):document.fullscreenElement?null==(i=document.exitFullscreen)||i.call(document).catch(()=>{}):document.webkitFullscreenElement&&(null==(a=document.webkitExitFullscreen)||a.call(document)),s})},[]),st=A.useCallback(A=>{mA(A)},[]),lt=A.useCallback(()=>{AA(A=>!A)},[]),ct=A.useCallback(()=>{z(A=>!A)},[]),ut=A.useCallback(()=>{aA(A=>{const e=!A;if(c.current){const A=c.current.getMap();A&&A.stop()}if(e&&c.current){const A=c.current.getMap();A&&A.easeTo({pitch:45,duration:1500,easing:A=>1-Math.pow(1-A,3)})}if(!e&&c.current){const A=c.current.getMap();A&&A.easeTo({pitch:0,bearing:0,duration:800,easing:A=>1-Math.pow(1-A,2)})}return e})},[]),ft=A.useCallback(()=>{L||$(!0)},[L]),dt=A.useCallback((A,e)=>{jA(A),SA(e)},[]),gt=A.useCallback(()=>{QA&&o&&o(QA),jA(null),SA("")},[QA,o]),ht=A.useMemo(()=>[...vr,...sr],[]),mt=A.useRef(!1);A.useEffect(()=>{mt.current="ontouchstart"in window||navigator.maxTouchPoints>0},[]);const bt=A.useCallback(A=>{A.features&&0!==A.features.length||(mt.current&&ge&&(he(null),wA(null)),xA&&yA(null))},[ge,xA]),vt=A.useCallback(A=>{yA(e=>e===A?null:A)},[]),xt=A.useCallback(A=>{var e,t;if(!A.features||0===A.features.length)return;if(A.features.some(A=>{var e,t;return null==(t=null==(e=A.layer)?void 0:e.id)?void 0:t.startsWith("node-markers-")}))return void(vA&&(wA(null),he(null)));const r=A.features.find(A=>{var e;const t=null==(e=A.layer)?void 0:e.id;return(null==t?void 0:t.startsWith("topology-"))||(null==t?void 0:t.startsWith("neighbor-"))});if(!r)return;const n=null==(e=r.layer)?void 0:e.id,o=r.properties;if(!(null==o?void 0:o.key))return;const i=null==n?void 0:n.startsWith("topology-"),a=null==n?void 0:n.startsWith("neighbor-");if(i||a){const e=o.key.replace(/-loop[12]$/,"");wA(e),A.lngLat&&he({longitude:A.lngLat.lng,latitude:A.lngLat.lat,type:i?"topology":"neighbor",properties:o})}try{(null==(t=c.current)?void 0:t.getCanvas())&&(c.current.getCanvas().style.cursor="pointer")}catch{}},[vA]),yt=A.useCallback(()=>{var A;wA(null),he(null);try{(null==(A=c.current)?void 0:A.getCanvas())&&(c.current.getCanvas().style.cursor="")}catch{}},[]),kt=P?"map-container-fullscreen":"map-container-16-9",Rt=E.length>0||(null==r?void 0:r.latitude)&&(null==r?void 0:r.longitude),_t=!m||!Rt,Ht=Rt;return e.jsxs("div",{className:`relative ${kt}`,role:"application","aria-label":"Mesh network contacts map","aria-describedby":"map-instructions","data-basemap":le,children:[e.jsx("span",{id:"map-instructions",className:"sr-only",children:"Interactive map showing mesh network contacts. Use mouse or touch to pan and zoom. Press Tab to navigate map controls. Press Escape to exit fullscreen mode."}),_t&&e.jsx("div",{className:"absolute inset-0 z-50 glass-card flex items-center justify-center","aria-hidden":"true",children:e.jsxs("div",{className:"flex flex-col items-center gap-3",children:[e.jsx("div",{className:"w-6 h-6 border-2 border-accent-primary border-t-transparent rounded-full animate-spin"}),e.jsx("span",{className:"text-sm text-text-muted",children:"Loading map..."})]})}),Ht&&e.jsx("div",{className:`relative w-full h-full ${P?"":"rounded-[1.125rem] overflow-hidden"} ${_t?"opacity-0":"opacity-100 transition-opacity duration-300"}`,children:e.jsxs(W,{ref:c,...j,onMove:nt,mapStyle:Cr,style:{width:"100%",height:"100%"},attributionControl:!1,interactiveLayerIds:ht,onMouseMove:xt,onMouseLeave:yt,onClick:bt,onError:A=>{},onIdle:()=>{if(!M&&!B&&c.current){const A=c.current.getMap();if(A){const e=Object.values(t).filter(A=>A.latitude&&A.longitude).map(A=>({latitude:A.latitude,longitude:A.longitude}));(null==r?void 0:r.latitude)&&(null==r?void 0:r.longitude)&&e.push({latitude:r.latitude,longitude:r.longitude}),e.length>0&&C(e,A)}}},children:[e.jsx(V,{position:"bottom-right"}),e.jsx(MA,{mode:le}),e.jsx(At,{enabled:Z,exaggeration:4}),e.jsx(Ze,{coveragePoints:re,visible:re.length>0&&ne,terrainEnabled:Z,brightness:oe,basemapMode:le}),e.jsx(pt,{partition:He,nodeCoordinates:De,visible:G&&UA,opacity:U.opacity,bandwidth:U.bandwidth,threshold:U.threshold,strokeWidth:U.strokeWidth}),e.jsx(pr,{showTopology:L,isExiting:Ye,hoveredEdgeKey:vA,highlightedLoopEdges:null==pe?void 0:pe.highlightedEdgeKeys,highlightedFocusEdges:Re,onEdgeHover:xe,onLoopHover:ke,loops:u.loops,neighborNames:Be,opacityBias:kA,widthMultiplier:DA,trafficFilter:EA,showNeighborLines:R,disableHover:We||HA}),i&&e.jsx(wr,{targetHash:i,nodeCoordinates:De,onComplete:a}),s&&e.jsx(xr,{highlightedEdgeKey:s,validatedPolylines:Fe,weakPolylines:Pe,onEnsureTopology:ft}),e.jsx(kr,{ghost:l??null,neighborCoordinates:De,onHighlightedNeighborsChange:te}),e.jsx(ar,{neighborsWithLocation:Me,localNode:r,localHash:n,zeroHopNeighbors:Qe,lastHopNeighborMap:Ee,meshTopology:u,hoveredMarker:bA,onMarkerHover:pA,getNodeOpacity:Xe,shouldShowNode:et,onRequestRemove:o?dt:void 0,openPopupId:KA,onOpenPopup:$A,onClosePopup:ee,onNodeClick:vt,blinkingNodes:qe,blinkColor:$e})]})}),(()=>{const A=function(A,e,t){if(e){const A=e.loops[0],t=e.loops.length,r=[{label:"hops",value:A.size},{label:"seen",value:A.minCertainCount}],n=[];return A.includesLocal&&n.push({text:"★ Includes your node",color:"text-amber-400"}),t>1&&n.push({text:`+${t-1} overlapping`,color:"text-violet-400/70"}),{type:"loop",title:{icon:"⟳",text:"Redundant Path"+(t>1?"s":""),color:"text-violet-400"},subtitle:{text:`${e.nodeNames.join(" → ")} → ${e.nodeNames[0]}`,color:"text-text-secondary",mono:!0},stats:r,badges:n}}if("neighbor"===(null==A?void 0:A.type)){const e=A.properties,t=[];void 0!==e.rssi&&null!==e.rssi&&t.push({label:"RSSI",value:`${Math.round(e.rssi)} dBm`,unit:e.hasAvgRssi?"avg":void 0}),void 0!==e.snr&&null!==e.snr&&t.push({label:"SNR",value:`${Number(e.snr).toFixed(1)} dB`,unit:e.hasAvgSnr?"avg":void 0});const r=e.listenerScore??0,n=e.loudScore??0,o=r>0||n>0;return o&&(t.push({label:"listener",value:r,color:"text-accent-success"}),t.push({label:"loud",value:n,color:"text-accent-danger"})),void 0===e.packetCount||o||t.push({label:"packets",value:Number(e.packetCount).toLocaleString()}),{type:"neighbor",title:{icon:"●",text:e.prefix?`${e.name} (${e.prefix})`:e.name,color:"text-amber-400"},subtitle:{text:"Direct RF Neighbor",color:"text-amber-400/70"},stats:t,badges:[]}}if("topology"===(null==A?void 0:A.type)){const e=A.properties,r=t>0?Number(e.certainCount)/t:0,n=[{label:"validations",value:e.certainCount},{label:"of max traffic",value:`${Math.round(100*r)}%`},{label:"confidence",value:`${Math.round(100*Number(e.confidence))}%`}];if(void 0!==e.symmetryRatio&&e.symmetryRatio<1){const A="forward"===e.dominantDirection?"→":"reverse"===e.dominantDirection?"←":"↔";n.push({label:"symmetric",value:`${A} ${Math.round(100*e.symmetryRatio)}%`,color:"text-text-muted"})}const o=[];return e.isBackbone&&o.push({text:"Backbone",color:"text-gray-300"}),e.isLoopEdge&&o.push({text:"Redundant",color:"text-violet-400"}),e.isDirectPath&&o.push({text:"Direct Path",color:"text-teal-400"}),{type:"topology",title:{icon:"",text:`${e.fromName} ↔ ${e.toName}`,color:"text-text-primary"},stats:n,badges:o}}return null}(ge?{type:ge.type,properties:ge.properties}:null,pe,_e);return A&&e.jsx("div",{className:"map-edge-tooltip",children:e.jsx("div",{className:"map-control-glass map-edge-tooltip-inner",children:e.jsx(Mr,{data:A})})})})(),e.jsx(WA,{mapRef:c,showNeighborLines:R,onToggleNeighborLines:lt,hasNeighborPolylines:Te.length>0,nodeFilter:X,onNodeFilterChange:st,hasHubNodes:u.hubNodes.length>0,hasZeroHopNeighbors:Qe.size>0,showCoverage:H,onToggleCoverage:ct,showMinCut:G,onToggleMinCut:ze,hasMinCutData:UA&&null!==He&&He.numCommunities>1,show3DTerrain:Z,onToggle3DTerrain:ut,basemapMode:le,onToggleBasemap:ue,isFullscreen:P,onToggleFullscreen:ot}),e.jsxs("div",{className:"map-legend-stack",children:[e.jsx(JA,{isActive:L,hasAnalyzed:UA,isLoading:HA,onClick:rt}),e.jsx(qA,{isActive:ae,onClick:se}),e.jsx(Ae,{isActive:re.length>0&&ne,onClick:ie}),e.jsx(YA,{showTopology:L,validatedPolylineCount:Fe.length,filteredNeighborCount:Me.length,hasLocalNode:!(!(null==r?void 0:r.latitude)||!(null==r?void 0:r.longitude)),meshTopology:u,zeroHopNeighbors:Qe,neighborsWithLocation:Me})]}),!P&&e.jsx("div",{className:"glass-card-frame absolute inset-0 pointer-events-none rounded-[1.125rem]",style:{zIndex:9999},"aria-hidden":"true"}),e.jsx(gA,{isOpen:null!==QA,onCancel:()=>jA(null),onConfirm:gt,title:"Remove Node?",message:`Remove "${NA}" from the contacts list? This will hide the node until it sends a new packet.`,confirmLabel:"Remove",cancelLabel:"Cancel",variant:"danger"}),e.jsx(hA,{isOpen:TA,currentStep:RA,packetCount:GA}),e.jsx(me,{}),e.jsx(we,{visible:G&&UA,onClose:()=>iA(!1),settings:U,onSettingsChange:Y,partition:He,totalNodes:Object.keys(t).length})]})}export{Dr as default}; diff --git a/frontend/dist/assets/ContactsMapMapLibre-CsZGQooS.js b/frontend/dist/assets/ContactsMapMapLibre-CsZGQooS.js new file mode 100644 index 00000000..f9660da5 --- /dev/null +++ b/frontend/dist/assets/ContactsMapMapLibre-CsZGQooS.js @@ -0,0 +1 @@ +import{a as A,j as e}from"./vendor-react-DCIF8YoJ.js";import{b as t,S as r,L as n,P as o,u as i,c as a,M as s,d as l,B as c}from"./BasemapLayer-g9CXC1Ky.js";import"./maplibre-gl-Bk5DsYkB.js";import{L as u,c as f}from"./link-scoring-DTgOSmRe.js";import{c as d,K as g,ap as h,aB as m,aC as p,T as b,m as v,C as w,A as y,G as x,aY as k,as as C,X as B,o as M,bz as D,bA as E,p as Q,bB as j,B as N,al as S,aM as F,b1 as P,b0 as T,h as L,v as I,bC as R,bD as _}from"./index-BGs2yNOg.js";import{P as H,T as z,C as G}from"./ConfirmModal-_bkwu5cd.js";import{M as O,a as U,E as Y,b as V,D as W}from"./DeepAnalysisModal-Dhmx8Gh2.js";import{i as Z,j as K,k as J,l as X}from"./useThemeColors-CGx-Jxyf.js";import{M as q,P as $,R as AA,N as eA}from"./Contacts-Bc9XGkC1.js";import{H as tA}from"./house-CCeK_0TO.js";import{R as rA}from"./refresh-cw-ccP9GKH1.js";import{E as nA}from"./target-De7OqeGi.js";import{M as oA}from"./trending-up-2SYsZdKi.js";import{C as iA}from"./compass-DMvXEtHv.js";import{L as aA}from"./loader-circle-CwUrmZrV.js";import{G as sA}from"./git-branch-Sfdze11O.js";import{Z as lA}from"./zap-CQ3I2hAj.js";import{l as cA}from"./font-loader-jlbdh9Fw.js";import{c as uA,p as fA,d as dA}from"./vendor-core-Dl9MTgSr.js";import{C as gA}from"./car-DXNv2W8D.js";import{C as hA}from"./check-qb29v-su.js";import{U as mA}from"./users-D0iUt2so.js";import{y as pA}from"./recharts-DVj1EL-m.js";import{H as bA,b as vA,N as wA,d as yA}from"./SignalIndicator-DWWkJgSd.js";import{C as xA}from"./DataBox-nCNZLfvU.js";import{M as kA}from"./map-pin-x5eP-WEg.js";import"./deckgl-DTsmDcfs.js";import"./triangle-alert-2-1YN-Am.js";import"./ping-HGVILoRV.js";import"./PageLayout-DIXn4UXM.js";import"./chevron-up-ClXInh9N.js";import"./funnel-DZRnHLZd.js";import"./circle-check-Bd9Kbu6i.js";import"./CollisionExplorerModal-CyK7TMsS.js";import"./network-DpalqfB8.js";const CA=d("boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]),BA=d("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),MA=d("grip-vertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]),DA=d("map",[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]]),EA=d("moon",[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]),QA=d("mountain",[["path",{d:"m8 3 4 8 5-5 5 15H2L8 3z",key:"otkl63"}]]),jA=d("sigma",[["path",{d:"M18 7V5a1 1 0 0 0-1-1H6.5a.5.5 0 0 0-.4.8l4.5 6a2 2 0 0 1 0 2.4l-4.5 6a.5.5 0 0 0 .4.8H17a1 1 0 0 0 1-1v-2",key:"wuwx1p"}]]),NA=d("sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]),SA=d("swords",[["polyline",{points:"14.5 17.5 3 6 3 3 6 3 17.5 14.5",key:"1hfsw2"}],["line",{x1:"13",x2:"19",y1:"19",y2:"13",key:"1vrmhu"}],["line",{x1:"16",x2:"20",y1:"16",y2:"20",key:"1bron3"}],["line",{x1:"19",x2:"21",y1:"21",y2:"19",key:"13pww6"}],["polyline",{points:"14.5 6.5 18 3 21 3 21 6 17.5 9.5",key:"hbey2j"}],["line",{x1:"5",x2:"9",y1:"14",y2:"18",key:"1hf58s"}],["line",{x1:"7",x2:"4",y1:"17",y2:"20",key:"pidxm4"}],["line",{x1:"3",x2:"5",y1:"19",y2:"21",key:"1pehsh"}]]),FA=d("wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]]);class PA{constructor(){this.componentControls=new Set}subscribe(A){return this.componentControls.add(A),()=>this.componentControls.delete(A)}start(A,e){this.componentControls.forEach(t=>{t.start(A.nativeEvent||A,e)})}cancel(){this.componentControls.forEach(A=>{A.cancel()})}stop(){this.componentControls.forEach(A=>{A.stop()})}}const TA=()=>new PA;function LA(A,e,t,r){const n=(t-A)*Math.PI/180,o=(r-e)*Math.PI/180,i=Math.sin(n/2)*Math.sin(n/2)+Math.cos(A*Math.PI/180)*Math.cos(t*Math.PI/180)*Math.sin(o/2)*Math.sin(o/2);return 2*Math.atan2(Math.sqrt(i),Math.sqrt(1-i))*6371e3}function IA(A,e){const t=Math.max(5,Math.min(A,300)),r=Math.log(5),n=Math.log(300);return 1+(Math.log(t)-r)/(n-r)*5}const RA={nodeFill:"#3B82F6",nodeStroke:"rgba(255,255,255,0.9)",nodeColor:"#4338CA",localColor:"#FFB224",hubColor:"#8E4EC6",gatewayColor:"#5B5BD6",mobileColor:"#F76B15",roomServerColor:"#D6409F",neighborColor:"#FFB224",edges:{rest:"#4B4B4B",restBright:"#616161",restDim:"#3F3F3F",hoverDirect:"#6FBCBD",hoverLoop:"#8B7BAD",hoverStandard:"#8A8A8A",hoverNeighbor:"#FBBF24",neighborRest:"#6B7280",neighborHover:"#FBBF24",highlight:"#FFD700"},edgeOpacity:.82};function _A(){if("undefined"==typeof window)return RA;const A=Z(),e=K();return{nodeFill:A.nodeFill,nodeStroke:A.nodeStroke,nodeColor:RA.nodeColor,localColor:A.localColor,hubColor:A.hubColor,gatewayColor:A.gatewayColor,mobileColor:A.mobileColor,roomServerColor:A.roomColor,neighborColor:A.neighborColor,edges:{rest:e.rest,restBright:e.restBright,restDim:e.restDim,hoverDirect:e.hoverDirect,hoverLoop:e.hoverLoop,hoverStandard:e.hoverStandard,hoverNeighbor:e.hoverNeighbor,neighborRest:RA.edges.neighborRest,neighborHover:RA.edges.neighborHover,highlight:e.highlight},edgeOpacity:RA.edgeOpacity}}const HA=2e3,zA={type:"spring",stiffness:500,damping:35};function GA({color:A,ring:t}){return e.jsx("span",{className:"shrink-0 rounded-full",style:{width:14,height:14,backgroundColor:t?"transparent":A,border:t?`4px solid ${A}`:void 0,boxSizing:"border-box"}})}function OA({color:A}){return e.jsx("span",{className:"shrink-0 rounded-sm",style:{width:16,height:3,backgroundColor:A}})}function UA({indicator:A,label:t,tooltip:r}){return e.jsxs("div",{className:"flex items-center gap-1.5",children:[A,e.jsx("span",{className:"text-text-secondary",children:t}),r&&e.jsx(b,{content:r,delay:200,children:e.jsx("span",{className:"text-text-muted cursor-help text-[10px] opacity-60 hover:opacity-100 transition-opacity",children:"ⓘ"})})]})}function YA({title:A,tooltip:t,isOpen:r,onToggle:n,showDivider:o,children:i}){return e.jsxs("div",{className:o?"mt-2 pt-2 border-t border-map-ui-border":"",children:[e.jsxs("button",{type:"button",onClick:n,className:"group w-full flex items-center justify-between py-1 text-text-secondary font-medium hover:text-text-primary transition-colors",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[A,e.jsx(b,{content:t,delay:200,children:e.jsx("span",{className:"text-text-muted cursor-help text-[10px] opacity-60 group-hover:opacity-100 transition-opacity",children:"ⓘ"})})]}),e.jsx(v.span,{animate:{rotate:r?0:-90},transition:{duration:.15},children:e.jsx(w,{className:"w-3 h-3 text-text-muted"})})]}),e.jsx(y,{initial:!1,children:r&&e.jsx(v.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:zA,className:"overflow-hidden",children:e.jsx("div",{className:"flex flex-col gap-1 pt-1.5",children:i})})})]})}function VA({label:A,value:t,color:r}){return e.jsxs("div",{className:"flex justify-between tabular-nums text-text-muted",children:[e.jsx("span",{children:A}),e.jsx("span",{className:"text-text-secondary",style:r?{color:r}:void 0,children:t})]})}function WA({icon:A,color:t,title:r,subtitle:n}){return e.jsx("div",{className:"mt-1.5 pt-1.5 border-t border-map-ui-border",children:e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"shrink-0",style:{color:t},children:A}),e.jsxs("div",{className:"flex flex-col min-w-0",children:[e.jsx("span",{className:"font-medium truncate",style:{color:t},children:r}),e.jsx("span",{className:"text-text-muted text-[10px] leading-tight",children:n})]})]})})}function ZA({showTopology:t,validatedPolylineCount:r,filteredNeighborCount:n,hasLocalNode:o,meshTopology:i,zeroHopNeighbors:a,neighborsWithLocation:s}){const l=J(),c=h(),f=m(),d=c.filter(A=>A.isLikelyReal).length,g=function(A){let e=0;for(const t of A.txDelayRecommendations.values())"backbone"===t.networkRole&&e++;return e}(i),b=a.size>0,[v,w]=A.useState(!0),[y,x]=A.useState(!0),[k,C]=A.useState(!0);return e.jsxs("div",{className:"map-control-glass p-2.5 text-xs",children:[e.jsxs(YA,{title:"Nodes",tooltip:"Node type shown by shape + color. Yellow = direct RF neighbor.",isOpen:v,onToggle:()=>w(A=>!A),children:[e.jsx(UA,{indicator:e.jsx(GA,{color:l.nodeFill}),label:"Node",tooltip:"Standard mesh node. Repeater, client, or companion device."}),e.jsx(UA,{indicator:e.jsx(GA,{color:l.hubColor}),label:"Hub",tooltip:"Network hub (≥10% of last-hop traffic)."}),(B=s,B.some(([,A])=>{var e;const t=null==(e=A.contact_type)?void 0:e.toLowerCase();return"room server"===t||"room_server"===t||"room"===t||"server"===t})&&e.jsx(UA,{indicator:e.jsx(q,{className:"w-3 h-3 shrink-0",style:{color:l.roomColor},strokeWidth:2.5}),label:"Room",tooltip:"Room Server identity for client sync."})),e.jsx(UA,{indicator:e.jsx(tA,{className:"w-3 h-3 shrink-0",style:{color:l.localColor},strokeWidth:2.5}),label:"Local",tooltip:"Your repeater running pyMC_Repeater."}),b&&e.jsx(UA,{indicator:e.jsx(GA,{color:l.neighborColor}),label:"Neighbor",tooltip:"Zero-hop direct RF contact."}),i.gatewayNodes.length>0&&e.jsx(UA,{indicator:e.jsx(GA,{color:l.gatewayColor}),label:"Gateway",tooltip:"Significant forwarder (7-10% traffic)."}),g>0&&e.jsx(UA,{indicator:e.jsx(GA,{color:l.hubColor}),label:"Backbone",tooltip:"Critical relay with high centrality."}),i.mobileNodes.length>0&&e.jsx(UA,{indicator:e.jsx(GA,{color:l.mobileColor,ring:!0}),label:"Mobile",tooltip:"Volatile node that appears/disappears."}),d>0&&e.jsx(UA,{indicator:e.jsx(p,{className:"w-3 h-3 shrink-0",style:{color:l.ghostColor},strokeWidth:2.5}),label:`Ghost (${d})`,tooltip:"Unknown repeater from Viterbi analysis."})]}),b&&e.jsxs(YA,{title:"Link Quality",tooltip:"Neighbor edge colors based on bidirectional balance.",isOpen:y,onToggle:()=>x(A=>!A),showDivider:!0,children:[e.jsx(UA,{indicator:e.jsx(OA,{color:u.YELLOW}),label:"2-Way",tooltip:"33-67% balanced. Ideal bidirectional link."}),e.jsx(UA,{indicator:e.jsx(OA,{color:u.GREEN}),label:"Listener",tooltip:">67% listener. They hear us well."}),e.jsx(UA,{indicator:e.jsx(OA,{color:u.RED}),label:"Loud",tooltip:"<33% listener. They route more to us."})]}),t&&r>0&&e.jsxs(YA,{title:"Topology",tooltip:"Links with 5+ validations. Thickness = strength.",isOpen:k,onToggle:()=>C(A=>!A),showDivider:!0,children:[e.jsx(VA,{label:"Nodes",value:n+(o?1:0)}),i.hubNodes.length>0&&e.jsx(VA,{label:"Hubs",value:i.hubNodes.length,color:RA.hubColor}),i.loops.length>0&&e.jsx(WA,{icon:e.jsx(rA,{className:"w-3 h-3"}),color:RA.edges.hoverLoop,title:`${i.loops.length} ${1===i.loops.length?"Loop":"Loops"}`,subtitle:"Redundant paths"}),f.totalPaths>0&&e.jsx(WA,{icon:e.jsx(nA,{className:"w-3 h-3"}),color:l.ghostColor,title:`${f.totalPaths.toLocaleString()} Viterbi`,subtitle:"HMM decoded paths"})]})]});var B}function KA({mapRef:A,showNeighborLines:t,onToggleNeighborLines:r,hasNeighborPolylines:n,nodeFilter:o,onNodeFilterChange:i,hasHubNodes:a,hasZeroHopNeighbors:s,showCoverage:l,onToggleCoverage:c,showMinCut:u=!1,onToggleMinCut:f,hasMinCutData:d=!1,show3DTerrain:g,onToggle3DTerrain:h,basemapMode:m,onToggleBasemap:p,isFullscreen:b,onToggleFullscreen:v}){const w="w-4 h-4";return e.jsx(e.Fragment,{children:e.jsxs("div",{className:"absolute top-3 right-3 z-[600] flex flex-col gap-2 sm:top-4 sm:right-4",children:[e.jsxs("div",{className:"map-control-glass flex items-center gap-1 p-1",children:[n&&e.jsx(x,{plain:!0,color:t?"warning":"muted",onClick:r,title:t?"Hide edge lines":"Show edge lines","aria-label":t?"Hide edge lines":"Show edge lines","aria-pressed":t,className:"!p-1.5 !rounded-md",children:e.jsx(k,{className:w})}),e.jsxs("div",{className:"flex items-center gap-0.5",children:[e.jsx(C,{color:"all"===o?"green":"zinc",onClick:()=>i("all"),title:"Show all nodes",children:"All"}),a&&e.jsx(C,{color:"hubs"===o?"green":"zinc",onClick:()=>i("hubs"),title:"Show only hub nodes and their connections",children:"Hubs"}),s&&e.jsx(C,{color:"direct"===o?"green":"zinc",onClick:()=>i("direct"),title:"Show only zero-hop (direct RF) neighbors",children:"Direct"})]}),d&&f&&e.jsx(x,{plain:!0,color:u?"primary":"muted",onClick:f,title:u?"Hide community partition":"Show community partition","aria-label":u?"Hide community partition":"Show community partition","aria-pressed":u,className:"!p-1.5 !rounded-md",children:e.jsx(CA,{className:w})}),e.jsx(x,{plain:!0,color:"light"===m?"primary":"muted",onClick:p,title:"light"===m?"Switch to dark map":"Switch to light map","aria-label":"light"===m?"Switch to dark map":"Switch to light map","aria-pressed":"light"===m,className:"!p-1.5 !rounded-md",children:"light"===m?e.jsx(NA,{className:w}):e.jsx(EA,{className:w})}),e.jsx(x,{plain:!0,color:g?"success":"muted",onClick:h,title:g?"Disable 3D terrain":"Enable 3D terrain","aria-label":g?"Disable 3D terrain":"Enable 3D terrain","aria-pressed":g,className:"!p-1.5 !rounded-md",children:e.jsx(QA,{className:w})}),e.jsx(x,{plain:!0,color:"muted",onClick:v,title:b?"Exit fullscreen":"Fullscreen","aria-label":b?"Exit fullscreen":"Enter fullscreen","aria-pressed":b,className:"!p-1.5 !rounded-md",children:b?e.jsx(O,{className:w}):e.jsx(U,{className:w})})]}),e.jsxs("div",{className:"map-control-glass flex flex-col items-stretch !overflow-hidden self-end !p-0",children:[e.jsx(x,{plain:!0,color:"muted",onClick:()=>{var e,t;null==(t=null==(e=A.current)?void 0:e.getMap())||t.zoomIn()},title:"Zoom in","aria-label":"Zoom in",className:"!p-1.5 !rounded-none",children:e.jsx(H,{className:w})}),e.jsx("div",{className:"h-px bg-border-subtle"}),e.jsx(x,{plain:!0,color:"muted",onClick:()=>{var e,t;null==(t=null==(e=A.current)?void 0:e.getMap())||t.zoomOut()},title:"Zoom out","aria-label":"Zoom out",className:"!p-1.5 !rounded-none",children:e.jsx(oA,{className:w})}),e.jsx("div",{className:"h-px bg-border-subtle"}),e.jsx(x,{plain:!0,color:"muted",onClick:()=>{var e;const t=null==(e=A.current)?void 0:e.getMap();t&&t.easeTo({bearing:0,pitch:0,duration:300})},title:"Reset bearing to north","aria-label":"Reset bearing to north",className:"!p-1.5 !rounded-none",children:e.jsx(iA,{className:w})})]})]})})}const JA="#4ADE80",XA="DeepAnalysis";function qA(){return"abcdefghijklmnopqrstuvwxyz0123456789"[Math.floor(36*Math.random())]}function $A({isActive:t,hasAnalyzed:r,isLoading:n,onClick:o}){const[i,a]=A.useState(!1),[s,l]=A.useState(XA),c=A.useRef(!1),u=A.useRef(null),[f]=A.useState(()=>{var A;return"undefined"!=typeof window&&((null==(A=window.matchMedia)?void 0:A.call(window,"(hover: hover)").matches)??!1)}),d=i&&!t&&!n&&f;A.useEffect(()=>{if(i&&!t&&!n&&!c.current){c.current=!0;const A=performance.now(),e=t=>{const r=t-A,n=Math.min(r/700,1),o=Math.floor(12*n);let i="";for(let A=0;A<12;A++)i+=A{u.current&&cancelAnimationFrame(u.current)}},[i,t,n]);const g=n?"Analyzing...":s;return e.jsxs("button",{onClick:o,onMouseEnter:()=>f&&a(!0),onMouseLeave:()=>f&&a(!1),onPointerEnter:()=>f&&a(!0),onPointerLeave:()=>f&&a(!1),disabled:n,className:"flex items-center gap-2 w-full text-left rounded-lg transition-colors "+(n?"cursor-wait":""),style:{padding:"0.5rem 0.625rem",backgroundColor:t?"var(--sidebar-action-active-green)":"var(--map-ui-bg, var(--bg-surface))"},title:n?"Analyzing packet history...":r?t?"Hide topology edges":"Show topology edges":"Load full packet history and build topology",children:[n?e.jsx(aA,{className:"w-3.5 h-3.5 flex-shrink-0 text-green-400 animate-spin"}):e.jsx(sA,{className:"w-3.5 h-3.5 flex-shrink-0 transition-colors "+(t?"text-green-400":"text-text-secondary"),style:d?{color:JA}:void 0}),e.jsx("span",{className:t?"text-green-400":"text-text-secondary",style:{fontFamily:"ui-monospace, SFMono-Regular, monospace",fontSize:"0.6875rem",fontWeight:t||d?700:500,letterSpacing:"-0.01em",lineHeight:1,...d?{color:JA}:{}},children:g})]})}const Ae="#12A594";function ee({isActive:t,onClick:r}){const[n,o]=A.useState(!1),[i,a]=A.useState(0),s=A.useRef(!1),l=A.useRef(null),[c,u]=A.useState(0),f=A.useRef(!1),[d]=A.useState(()=>{var A;return"undefined"!=typeof window&&((null==(A=window.matchMedia)?void 0:A.call(window,"(hover: hover)").matches)??!1)}),g=n&&!t&&d;A.useEffect(()=>{g&&!f.current&&(f.current=!0,u(1),setTimeout(()=>u(2),100),setTimeout(()=>u(3),200)),n||(f.current=!1,u(0))},[g,n]),A.useEffect(()=>{if(n&&!t&&!s.current){s.current=!0;const A=performance.now(),e=t=>{const r=t-A,n=Math.min(r/400,1);a(n),n<1&&(l.current=requestAnimationFrame(e))};l.current=requestAnimationFrame(e)}return n||(l.current&&(cancelAnimationFrame(l.current),l.current=null),s.current=!1,a(0)),()=>{l.current&&cancelAnimationFrame(l.current)}},[n,t]);const h=A=>{if(t)return;if(!g)return;const e=11*i;return A>=e-2&&Ad&&o(!0),onMouseLeave:()=>d&&o(!1),onPointerEnter:()=>d&&o(!0),onPointerLeave:()=>d&&o(!1),className:"flex items-center gap-2 w-full text-left rounded-lg transition-colors",style:{padding:"0.5rem 0.625rem",backgroundColor:t?"var(--sidebar-action-active-teal)":"var(--map-ui-bg, var(--bg-surface))"},title:t?"Disable live packet tracing (reduces CPU usage)":"Enable live packet tracing",children:[e.jsx(lA,{className:"w-3.5 h-3.5 flex-shrink-0 "+(t?"text-sys-teal":"text-text-secondary"),fill:1===c?"#FFFFFF":3===c?Ae:"none",stroke:1===c||2===c?"#FFFFFF":g?Ae:"currentColor",style:{transition:"fill 0.05s, stroke 0.05s"}}),e.jsx("span",{className:t?"text-sys-teal":"text-text-secondary",style:{fontFamily:"ui-monospace, SFMono-Regular, monospace",fontSize:"0.6875rem",fontWeight:t||g?700:500,letterSpacing:"-0.01em",lineHeight:1},children:"LiveTrace".split("").map((A,t)=>e.jsx("span",{style:{color:h(t)||void 0},children:A},t))})]})}const te="#fe8019";function re({isActive:t,onClick:r,brightness:n=.7,onBrightnessChange:o}){const[i,a]=A.useState(!1),[s,l]=A.useState(!1),[c]=A.useState(()=>{var A;return"undefined"!=typeof window&&((null==(A=window.matchMedia)?void 0:A.call(window,"(hover: hover)").matches)??!1)});A.useEffect(()=>{cA()},[]),A.useEffect(()=>{if(!i||t)return;const A=requestAnimationFrame(()=>l(!0)),e=setTimeout(()=>l(!1),80);return()=>{cancelAnimationFrame(A),clearTimeout(e)}},[i,t]);const u=Math.max(.01,Math.min(1,n)),f=u<.999,d=u>.011,g=i&&!t&&c;return e.jsxs("button",{onClick:r,onMouseEnter:()=>c&&a(!0),onMouseLeave:()=>c&&a(!1),onPointerEnter:()=>c&&a(!0),onPointerLeave:()=>c&&a(!1),className:"flex items-center gap-2 w-full text-left rounded-lg transition-colors",style:{padding:"0.5rem 0.625rem",backgroundColor:t?"var(--sidebar-action-active-amber)":"var(--map-ui-bg, var(--bg-surface))"},title:t?"Configure wardriving coverage":"Show wardriving coverage",children:[e.jsx(SA,{className:"w-3.5 h-3.5 flex-shrink-0 transition-colors "+(t?"text-amber-400":"text-text-secondary"),style:g?{color:te}:void 0}),e.jsx("span",{className:t?"text-amber-400":"text-text-secondary",style:{fontFamily:t||g?"'Jacquard 12', serif":"ui-monospace, SFMono-Regular, monospace",fontSize:t||g?"0.75rem":"0.6875rem",fontWeight:500,letterSpacing:"-0.01em",lineHeight:1,transition:"none",transform:t?"scale(1.45)":g?`scale(${s?1.595:1.45})`:void 0,transformOrigin:"left center",...g?{color:te}:{}},children:"Wardrive"}),t&&o&&e.jsxs("div",{className:"ml-auto flex items-center gap-0.5",children:[e.jsx("button",{onClick:A=>{A.stopPropagation();const e=Math.max(.01,u-.2);null==o||o(e)},disabled:!d,className:"p-0.5 rounded transition-colors "+(d?"hover:bg-bg-elevated text-amber-400":"text-amber-400/30 cursor-not-allowed"),title:`Decrease opacity (${Math.round(100*u)}%)`,children:e.jsx(EA,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:A=>{A.stopPropagation();const e=Math.min(1,u+.2);null==o||o(e)},disabled:!f,className:"p-0.5 rounded transition-colors "+(f?"hover:bg-bg-elevated text-amber-400":"text-amber-400/30 cursor-not-allowed"),title:`Increase opacity (${Math.round(100*u)}%)`,children:e.jsx(NA,{className:"w-3.5 h-3.5"})})]})]})}function ne(A){let e=!0,t=-90,r=90,n=-180,o=180;for(const i of A.toLowerCase()){const A="0123456789bcdefghjkmnpqrstuvwxyz".indexOf(i);if(-1!==A)for(let i=4;i>=0;i--){const a=A>>i&1;if(e){const A=(n+o)/2;a?n=A:o=A}else{const A=(t+r)/2;a?t=A:r=A}e=!e}}return{lat:(t+r)/2,lon:(n+o)/2}}function oe(A){return Math.exp(-A*Math.LN2/7)}const ie="pymc-wardriving-url",ae="pymc-wardriving-enabled",se="pymc-wardriving-brightness";function le(A){"undefined"!=typeof localStorage&&(A?localStorage.setItem(ie,A):localStorage.removeItem(ie))}function ce(A){"undefined"!=typeof localStorage&&localStorage.setItem(ae,String(A))}function ue(){if("undefined"==typeof localStorage)return.7;const A=localStorage.getItem(se);if(A){const e=parseFloat(A);if(!isNaN(e)&&e>=.01&&e<=1)return e}return.7}function fe(A,e=null){if(null!==A){const t=(Math.max(-12,Math.min(12,A))+12)/24;return null!==e?.8*t+(Math.max(-120,Math.min(-50,e))+120)/70*.2:t}return null!==e?(Math.max(-120,Math.min(-50,e))+120)/70:.5}const de=uA((A,e)=>({status:"idle",isVisible:"undefined"!=typeof localStorage&&"true"===localStorage.getItem(ae),coveragePoints:[],repeaters:[],error:null,stats:{coverageCount:0,repeaterCount:0,lastUpdated:null},url:"undefined"==typeof localStorage?"":localStorage.getItem(ie)||"",brightness:ue(),isModalOpen:!1,openModal:()=>A({isModalOpen:!0}),closeModal:()=>A({isModalOpen:!1}),setUrl:e=>A({url:e}),setBrightness:e=>{const t=Math.max(.01,Math.min(1,e));!function(A){if("undefined"==typeof localStorage)return;const e=Math.max(.01,Math.min(1,A));localStorage.setItem(se,String(e))}(t),A({brightness:t})},toggleVisibility:()=>{const t=!e().isVisible;ce(t),A({isVisible:t})},setVisible:e=>{ce(e),A({isVisible:e})},loadCoverage:async e=>{if(!e.trim())return A({error:"Please enter a URL",status:"error"}),!1;try{new URL(e.trim())}catch{return A({error:"Invalid URL format",status:"error"}),!1}A({error:null,status:"connecting"});try{A({status:"loading"});const t=await async function(A){const e=`${A.replace(/\/+$/,"").replace(/\/get-nodes$/,"").replace(/\/get-samples$/,"")}/get-samples`,t=await async function(A,e={},t=8e3){const r=new AbortController,n=setTimeout(()=>r.abort(),t);try{return await fetch(A,{...e,signal:r.signal})}catch(o){if(o instanceof Error&&"AbortError"===o.name)throw new Error(`Connection timed out after ${t/1e3}s`);throw o}finally{clearTimeout(n)}}(e,{headers:{Accept:"application/json"}});if(!t.ok)throw new Error(`Failed to fetch precise samples: ${t.status}`);return t.json()}(e.trim());if(!t||"object"!=typeof t)throw new Error("Invalid response from server");if(!Array.isArray(t.keys))throw new Error("No sample data found in response");A({status:"processing"});const r=function(A){var e;const t=[];for(const r of A.keys){if(!r.observed)continue;const{lat:A,lon:n}=ne(r.hash),o=parseInt(r.time,10),i=isNaN(o)?30:(Date.now()-o)/864e5,a=oe(i),s=fe(r.snr,r.rssi)*(.3+.7*a);t.push({lat:A,lon:n,successRate:r.observed?1:0,weight:s,totalSamples:1,ageDays:i,geohash:r.hash,repeaters:(null==(e=r.path)?void 0:e.map(A=>A.toLowerCase()))||[]})}return t}(t);if(0===r.length)throw new Error("No valid coverage points found");return A({coveragePoints:r,repeaters:[],stats:{coverageCount:r.length,repeaterCount:0,lastUpdated:new Date},status:"success",isVisible:!0,url:e.trim()}),le(e.trim()),ce(!0),!0}catch(t){const e=t instanceof Error?t.message:"Failed to load coverage data";let r=e;return e.includes("timed out")?r="Connection timed out. Server may be unreachable or slow.":e.includes("Failed to fetch")||e.includes("NetworkError")?r="Could not connect to server. Check the URL and try again.":e.includes("CORS")?r="Server does not allow cross-origin requests.":e.includes("404")?r="Coverage endpoint not found. Check the URL.":(e.includes("ERR_NAME_NOT_RESOLVED")||e.includes("DNS"))&&(r="Server not found. Check the URL for typos."),A({error:r,status:"error"}),!1}},clearCoverage:()=>{A({coveragePoints:[],repeaters:[],stats:{coverageCount:0,repeaterCount:0,lastUpdated:null},status:"idle",error:null,isVisible:!1,url:""}),le(""),ce(!1)}})),ge={type:"spring",damping:25,stiffness:300},he={type:"spring",damping:20,stiffness:300};function me({status:A}){if("connecting"!==A&&"loading"!==A&&"processing"!==A)return null;const t={idle:"",connecting:"Connecting to server...",loading:"Fetching coverage data...",processing:"Processing coverage points...",success:"",error:""}[A];if(!t)return null;const r="connecting"===A?30:"loading"===A?60:90;return e.jsx(v.div,{initial:{opacity:0,height:0,marginTop:0},animate:{opacity:1,height:"auto",marginTop:16},exit:{opacity:0,height:0,marginTop:0},transition:he,className:"overflow-hidden",children:e.jsxs("div",{className:"flex items-center gap-3 p-4 bg-amber-500/10 border border-amber-500/30 rounded-xl",children:[e.jsx("div",{className:"relative",children:e.jsx(aA,{className:"w-5 h-5 text-amber-400 animate-spin"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm text-amber-400 font-medium",children:t}),e.jsx("div",{className:"mt-2 h-1.5 bg-amber-500/20 rounded-full overflow-hidden",children:e.jsx(v.div,{className:"h-full bg-amber-400 rounded-full",initial:{width:0},animate:{width:`${r}%`},transition:{duration:.4,ease:"easeOut"}})})]})]})})}function pe({icon:A,title:t,description:r,variant:n}){const o={success:"bg-accent-success/10 border-accent-success/30 text-accent-success",error:"bg-accent-danger/10 border-accent-danger/30 text-accent-danger",warning:"bg-accent-secondary/10 border-accent-secondary/30 text-accent-secondary"}[n];return e.jsx(v.div,{initial:{opacity:0,height:0,marginTop:0},animate:{opacity:1,height:"auto",marginTop:16},exit:{opacity:0,height:0,marginTop:0},transition:he,className:"overflow-hidden",children:e.jsxs("div",{className:`flex items-start gap-3 p-4 border rounded-xl ${o}`,children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:A}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium",children:t}),r&&e.jsx("p",{className:"text-xs opacity-80 mt-0.5",children:r})]})]})})}function be({icon:A,label:t,value:r,min:n,max:o,formatValue:i,onChange:a}){const s=i?i(r):`${Math.round(r)}%`;return e.jsx(v.div,{initial:{opacity:0,height:0,marginTop:0},animate:{opacity:1,height:"auto",marginTop:16},exit:{opacity:0,height:0,marginTop:0},transition:he,className:"overflow-hidden",children:e.jsx("div",{className:"p-4 bg-bg-surface border border-border-subtle rounded-xl",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"text-text-muted",children:A}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-xs font-medium text-text-secondary",children:t}),e.jsx("span",{className:"text-xs text-text-muted font-mono tabular-nums",children:s})]}),e.jsx("input",{type:"range",min:n,max:o,value:r,onChange:A=>a(Number(A.target.value)),className:"w-full h-1.5 bg-bg-elevated rounded-full appearance-none cursor-pointer\n [&::-webkit-slider-thumb]:appearance-none\n [&::-webkit-slider-thumb]:w-3.5\n [&::-webkit-slider-thumb]:h-3.5\n [&::-webkit-slider-thumb]:rounded-full\n [&::-webkit-slider-thumb]:bg-accent-secondary\n [&::-webkit-slider-thumb]:cursor-pointer\n [&::-webkit-slider-thumb]:transition-transform\n [&::-webkit-slider-thumb]:hover:scale-110\n [&::-webkit-slider-thumb]:shadow-md"})]})]})})})}function ve(){const{isModalOpen:t,closeModal:r,status:n,isVisible:o,stats:i,error:a,url:s,brightness:l,loadCoverage:c,clearCoverage:u,toggleVisibility:f,setUrl:d,setBrightness:g}=de(),h="connecting"===n||"loading"===n||"processing"===n,[m,p]=A.useState(s),b=A.useCallback(async()=>{await c(m)},[m,c]),w=A.useCallback(()=>{p(""),u()},[u]),k=A.useCallback(A=>{"Enter"!==A.key||A.shiftKey||h||(A.preventDefault(),b())},[b,h]),C=A.useCallback(A=>{const e=A.target.value;p(e),d(e)},[d]),M=i.coverageCount>0,D=m.trim().length>0&&!h;return e.jsx(y,{children:t&&e.jsxs("div",{className:"fixed inset-0 z-[10010] flex items-center justify-center",children:[e.jsx(v.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:h?void 0:r}),e.jsx(v.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:ge,className:"relative w-full max-w-md mx-4",children:e.jsxs("div",{className:"map-control-glass rounded-2xl overflow-hidden shadow-2xl",children:[e.jsxs("div",{className:"flex items-center justify-between p-5 border-b border-border-subtle",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2.5 rounded-xl bg-accent-secondary/20",children:e.jsx(gA,{className:"w-5 h-5 text-accent-secondary"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:"Wardriving Coverage"}),e.jsx("p",{className:"text-xs text-text-muted",children:"Overlay RF coverage heatmap"})]})]}),e.jsx(x,{plain:!0,color:"muted",onClick:r,disabled:h,className:"!p-2 !rounded-lg","aria-label":"Close modal",children:e.jsx(B,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"p-5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-text-secondary mb-2",children:"Coverage Server URL"}),e.jsx("input",{type:"url",value:m,onChange:C,onKeyDown:k,placeholder:"https://coverage.wcmesh.com",className:"w-full px-4 py-3 bg-bg-surface border border-border-subtle rounded-xl \n text-text-primary placeholder:text-text-muted \n focus:outline-none focus:ring-2 focus:ring-accent-secondary/50 focus:border-accent-secondary/50 \n transition-all disabled:opacity-50",disabled:h}),e.jsx("p",{className:"mt-2 text-xs text-text-muted",children:"Enter the base URL of a wardriving coverage server (e.g., coverage.wcmesh.com)"})]}),e.jsxs(y,{mode:"wait",children:[h&&e.jsx(me,{status:n},"loading"),"error"===n&&a&&e.jsx(pe,{icon:e.jsx(BA,{className:"w-5 h-5"}),title:"Connection Failed",description:a,variant:"error"},"error"),"success"===n&&M&&e.jsx(pe,{icon:e.jsx(hA,{className:"w-5 h-5"}),title:"Data Loaded Successfully",description:`${i.coverageCount.toLocaleString()} coverage points • ${i.repeaterCount.toLocaleString()} repeaters`,variant:"success"},"success"),M&&!h&&"success"!==n&&e.jsx(pe,{icon:e.jsx(DA,{className:"w-5 h-5"}),title:"Coverage Data Loaded",description:`${i.coverageCount.toLocaleString()} points${i.lastUpdated?` • Last updated ${i.lastUpdated.toLocaleTimeString()}`:""}`,variant:"warning"},"info")]}),e.jsx(y,{children:M&&!h&&e.jsx(be,{icon:e.jsx(NA,{className:"w-4 h-4 "+(l>.5?"text-accent-secondary":"text-text-muted")}),label:"Brightness",value:100*l,min:1,max:100,formatValue:A=>`${Math.round(A)}%`,onChange:A=>g(A/100)},"brightness")})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3 px-5 py-4 border-t border-border-subtle",children:[e.jsx("div",{className:"flex items-center gap-1",children:e.jsx(y,{children:M&&e.jsxs(v.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},exit:{opacity:0,x:-10},className:"flex items-center gap-1",children:[e.jsx(x,{plain:!0,color:"muted",onClick:f,disabled:h,title:o?"Hide heatmap":"Show heatmap",children:o?e.jsxs(e.Fragment,{children:[e.jsx(Y,{"data-slot":"icon"})," Hide"]}):e.jsxs(e.Fragment,{children:[e.jsx(nA,{"data-slot":"icon"})," Show"]})}),e.jsxs(x,{plain:!0,color:"danger",onClick:w,disabled:h,title:"Clear coverage data",children:[e.jsx(z,{"data-slot":"icon"})," Clear"]})]})})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(x,{plain:!0,color:"muted",onClick:r,disabled:h,children:M?"Done":"Cancel"}),e.jsx(x,{color:"warning",onClick:b,disabled:!D,children:h?e.jsxs(e.Fragment,{children:[e.jsx(aA,{"data-slot":"icon",className:"animate-spin"}),"Loading..."]}):M?e.jsxs(e.Fragment,{children:[e.jsx(V,{"data-slot":"icon"}),"Refresh"]}):e.jsxs(e.Fragment,{children:[e.jsx(V,{"data-slot":"icon"}),"Connect"]})})]})]})]})})]})})}const we={bandwidth:.07,threshold:.1,opacity:1,strokeWidth:4.5};function ye({label:A,value:t,min:r,max:n,step:o,unit:i,formatValue:a,onChange:s}){const l=a?a(t):t.toFixed(2);return e.jsxs("div",{className:"flex items-center gap-2 sm:gap-2",children:[e.jsx("span",{className:"text-[11px] sm:text-[11px] text-text-secondary w-14 sm:w-16 flex-shrink-0",children:A}),e.jsx("input",{type:"range",min:r,max:n,step:o,value:t,onChange:A=>s(parseFloat(A.target.value)),className:"flex-1 h-1.5 sm:h-1 bg-bg-elevated rounded-full appearance-none cursor-pointer\n [&::-webkit-slider-thumb]:appearance-none\n [&::-webkit-slider-thumb]:w-4\n [&::-webkit-slider-thumb]:h-4\n [&::-webkit-slider-thumb]:sm:w-2.5\n [&::-webkit-slider-thumb]:sm:h-2.5\n [&::-webkit-slider-thumb]:rounded-full\n [&::-webkit-slider-thumb]:bg-accent-primary\n [&::-webkit-slider-thumb]:cursor-pointer\n [&::-webkit-slider-thumb]:shadow-md"}),e.jsxs("span",{className:"text-[11px] sm:text-[11px] text-text-primary font-mono tabular-nums w-12 sm:w-14 text-right flex-shrink-0",children:[l,i&&e.jsx("span",{className:"text-text-muted ml-0.5 hidden sm:inline",children:i})]})]})}function xe({icon:A,label:t,value:r,subtext:n}){return e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 py-0.5 sm:py-1",children:[e.jsx("div",{className:"text-text-muted",children:A}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx("div",{className:"text-[10px] sm:text-[11px] text-text-secondary truncate",children:t})}),e.jsxs("div",{className:"text-right",children:[e.jsx("div",{className:"text-[11px] sm:text-xs font-mono text-text-primary",children:r}),n&&e.jsx("div",{className:"text-[8px] sm:text-[9px] text-text-muted leading-tight",children:n})]})]})}function ke({visible:t,onClose:r,settings:n,onSettingsChange:o,partition:i,totalNodes:a}){const s=g(TA),l=A.useRef(null),c=A.useMemo(()=>{if(!i)return{numCommunities:0,avgCommunitySize:0,minCommunitySize:0,maxCommunitySize:0,fiedlerValue:0,modularity:0,coveragePercent:0};const A=Array.from(i.communities.values()).map(A=>A.length),e=A.reduce((A,e)=>A+e,0);return{numCommunities:i.numCommunities,avgCommunitySize:A.length>0?Math.round(e/A.length):0,minCommunitySize:A.length>0?Math.min(...A):0,maxCommunitySize:A.length>0?Math.max(...A):0,fiedlerValue:i.fiedlerValue,modularity:0,coveragePercent:a>0?Math.round(e/a*100):0}},[i,a]),u=(A,e)=>{o({...n,[A]:e})},f=(111*n.bandwidth).toFixed(1);return e.jsx("div",{ref:l,className:"absolute inset-0 z-[600] pointer-events-none",children:e.jsx(y,{children:t&&e.jsx(v.div,{drag:!0,dragControls:s,dragConstraints:l,dragElastic:.1,dragMomentum:!1,initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},transition:{type:"spring",damping:25,stiffness:300},className:"\n absolute pointer-events-auto\n /* Mobile: bottom sheet style, full width with margins */\n bottom-2 left-2 right-2\n /* sm+: floating panel in bottom-right */\n sm:bottom-16 sm:left-auto sm:right-3 sm:w-64\n /* md+: slightly wider */\n md:w-72\n ",style:{touchAction:"none"},children:e.jsxs("div",{className:"\n map-control-glass rounded-lg overflow-hidden shadow-lg\n /* Mobile: limit height, allow scroll */\n max-h-[45vh] sm:max-h-[calc(100vh-180px)] overflow-y-auto\n /* iOS momentum scrolling */\n overscroll-contain\n ",children:[e.jsxs("div",{className:"\n flex items-center justify-between \n px-3 py-2 sm:px-2.5 sm:py-1.5 \n border-b border-border-subtle \n cursor-grab active:cursor-grabbing\n /* Larger touch target on mobile */\n min-h-[44px] sm:min-h-0\n ",onPointerDown:A=>s.start(A),children:[e.jsxs("div",{className:"flex items-center gap-2 sm:gap-1.5",children:[e.jsx(MA,{className:"w-4 h-4 sm:w-3 sm:h-3 text-text-muted"}),e.jsx(CA,{className:"w-4 h-4 sm:w-3.5 sm:h-3.5 text-accent-primary"}),e.jsx("span",{className:"text-sm sm:text-xs font-medium text-text-primary",children:"Partition"})]}),e.jsx(x,{plain:!0,color:"muted",onClick:r,className:"!p-1.5 sm:!p-0.5 !rounded min-w-[44px] min-h-[44px] sm:min-w-0 sm:min-h-0 flex items-center justify-center","aria-label":"Close toolbox",children:e.jsx(B,{className:"w-4 h-4 sm:w-3 sm:h-3"})})]}),e.jsx("div",{className:"px-3 py-2 sm:px-2.5 sm:py-1.5 border-b border-border-subtle",children:e.jsxs("div",{className:"grid grid-cols-2 gap-x-4 sm:gap-x-3 gap-y-1 sm:gap-y-0.5",children:[e.jsx(xe,{icon:e.jsx(CA,{className:"w-3.5 h-3.5 sm:w-3 sm:h-3"}),label:"Communities",value:c.numCommunities}),e.jsx(xe,{icon:e.jsx(mA,{className:"w-3.5 h-3.5 sm:w-3 sm:h-3"}),label:"Avg Size",value:c.avgCommunitySize,subtext:`${c.minCommunitySize}–${c.maxCommunitySize}`}),e.jsx(xe,{icon:e.jsx(jA,{className:"w-3.5 h-3.5 sm:w-3 sm:h-3"}),label:"Fiedler λ₂",value:c.fiedlerValue.toFixed(3)}),e.jsx(xe,{icon:e.jsx(mA,{className:"w-3.5 h-3.5 sm:w-3 sm:h-3"}),label:"Coverage",value:`${c.coveragePercent}%`,subtext:`of ${a}`})]})}),e.jsx("div",{className:"px-3 py-2 sm:px-2.5 sm:py-1.5",children:e.jsxs("div",{className:"space-y-3 sm:space-y-1.5",children:[e.jsx(ye,{label:"Bandwidth",value:n.bandwidth,min:.01,max:.15,step:.005,formatValue:()=>f,unit:"km",onChange:A=>u("bandwidth",A)}),e.jsx(ye,{label:"Threshold",value:n.threshold,min:.05,max:.5,step:.01,formatValue:A=>`${Math.round(100*(1-A))}%`,unit:"cov",onChange:A=>u("threshold",A)}),e.jsx(ye,{label:"Opacity",value:n.opacity,min:.1,max:1,step:.05,formatValue:A=>`${Math.round(100*A)}%`,onChange:A=>u("opacity",A)}),e.jsx(ye,{label:"Stroke",value:n.strokeWidth,min:0,max:5,step:.5,unit:"px",formatValue:A=>A.toFixed(1),onChange:A=>u("strokeWidth",A)})]})})]})})})})}const Ce={getItem:A=>{try{return localStorage.getItem(A)}catch{return null}},setItem:(A,e)=>{try{localStorage.setItem(A,e)}catch{}},removeItem:A=>{try{localStorage.removeItem(A)}catch{}}},Be=uA()(fA(A=>({isEnabled:!1,toggle:()=>A(A=>({isEnabled:!A.isEnabled})),setEnabled:e=>A({isEnabled:e})}),{name:"pymc-live-trace",storage:dA(()=>Ce)}));var Me=function(A){var e,t=void 0!==(A=A||{})?A:{},r={};for(e in t)t.hasOwnProperty(e)&&(r[e]=t[e]);var n,o="";"undefined"!=typeof document&&document.currentScript&&(o=document.currentScript.src),o=0!==o.indexOf("blob:")?o.substr(0,o.lastIndexOf("/")+1):"",n=function(A,e,t){var r=new XMLHttpRequest;r.open("GET",A,!0),r.responseType="arraybuffer",r.onload=function(){if(200==r.status||0==r.status&&r.response)e(r.response);else{var n=O(A);n?e(n.buffer):t()}},r.onerror=t,r.send(null)};var i=t.print||function(){}.bind(),a=t.printErr||function(){}.bind();for(e in r)r.hasOwnProperty(e)&&(t[e]=r[e]);r=null,t.arguments&&t.arguments;var s=0,l=!1;function c(A){var e=t["_"+A];return e||tA("Assertion failed: "+("Cannot call unknown function "+A+", make sure it is exported")),e}var u,f,d,g,h,m,p,b="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function v(A,e){return A?function(A,e,t){for(var r=e+t,n=e;A[n]&&!(n>=r);)++n;if(n-e>16&&A.subarray&&b)return b.decode(A.subarray(e,n));for(var o="";e>10,56320|1023&l)}}else o+=String.fromCharCode((31&i)<<6|a)}else o+=String.fromCharCode(i)}return o}(d,A,e):""}function w(A,e){return A%e>0&&(A+=e-A%e),A}function y(A){u=A,t.HEAP8=f=new Int8Array(A),t.HEAP16=g=new Int16Array(A),t.HEAP32=h=new Int32Array(A),t.HEAPU8=d=new Uint8Array(A),t.HEAPU16=new Uint16Array(A),t.HEAPU32=new Uint32Array(A),t.HEAPF32=m=new Float32Array(A),t.HEAPF64=p=new Float64Array(A)}"undefined"!=typeof TextDecoder&&new TextDecoder("utf-16le");var x=t.TOTAL_MEMORY||33554432;function k(A){for(;A.length>0;){var e=A.shift();if("function"!=typeof e){var r=e.func;"number"==typeof r?void 0===e.arg?t.dynCall_v(r):t.dynCall_vi(r,e.arg):r(void 0===e.arg?null:e.arg)}else e()}}x=(u=t.buffer?t.buffer:new ArrayBuffer(x)).byteLength,y(u),h[7156]=5271536;var C=[],B=[],M=[],D=[];function E(A){C.unshift(A)}function Q(A){D.unshift(A)}var j=Math.abs,N=Math.ceil,S=Math.floor,F=Math.min,P=0,T=null;t.preloadedImages={},t.preloadedAudios={};var L,I,R=null,_="data:application/octet-stream;base64,";function H(A){return String.prototype.startsWith?A.startsWith(_):0===A.indexOf(_)}function z(){return f.length}R="data:application/octet-stream;base64,AAAAAAAAAAAAAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAAAQAAAAQAAAADAAAABgAAAAUAAAACAAAAAAAAAAIAAAADAAAAAQAAAAQAAAAGAAAAAAAAAAUAAAADAAAABgAAAAQAAAAFAAAAAAAAAAEAAAACAAAABAAAAAUAAAAGAAAAAAAAAAIAAAADAAAAAQAAAAUAAAACAAAAAAAAAAEAAAADAAAABgAAAAQAAAAGAAAAAAAAAAUAAAACAAAAAQAAAAQAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAIAAAADAAAAAAAAAAAAAAACAAAAAAAAAAEAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAYAAAAAAAAABQAAAAAAAAAAAAAABAAAAAUAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAYAAAAAAAAABgAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAgAAAAMAAAAEAAAABQAAAAYAAAABAAAAAgAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAgAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAIAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAIAAAADAAAABQAAAAYAAAAAAAAAAQAAAAIAAAADAAAABAAAAAYAAAAAAAAAAQAAAAIAAAADAAAABAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAIAAAAAAAAAAAAAAAYAAAAAAAAAAwAAAAIAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAFAAAABAAAAAAAAAABAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAYAAAAAAAAABAAAAAAAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAgAAAAQAAAADAAAACAAAAAEAAAAHAAAABgAAAAkAAAAAAAAAAwAAAAIAAAACAAAABgAAAAoAAAALAAAAAAAAAAEAAAAFAAAAAwAAAA0AAAABAAAABwAAAAQAAAAMAAAAAAAAAAQAAAB/AAAADwAAAAgAAAADAAAAAAAAAAwAAAAFAAAAAgAAABIAAAAKAAAACAAAAAAAAAAQAAAABgAAAA4AAAALAAAAEQAAAAEAAAAJAAAAAgAAAAcAAAAVAAAACQAAABMAAAADAAAADQAAAAEAAAAIAAAABQAAABYAAAAQAAAABAAAAAAAAAAPAAAACQAAABMAAAAOAAAAFAAAAAEAAAAHAAAABgAAAAoAAAALAAAAGAAAABcAAAAFAAAAAgAAABIAAAALAAAAEQAAABcAAAAZAAAAAgAAAAYAAAAKAAAADAAAABwAAAANAAAAGgAAAAQAAAAPAAAAAwAAAA0AAAAaAAAAFQAAAB0AAAADAAAADAAAAAcAAAAOAAAAfwAAABEAAAAbAAAACQAAABQAAAAGAAAADwAAABYAAAAcAAAAHwAAAAQAAAAIAAAADAAAABAAAAASAAAAIQAAAB4AAAAIAAAABQAAABYAAAARAAAACwAAAA4AAAAGAAAAIwAAABkAAAAbAAAAEgAAABgAAAAeAAAAIAAAAAUAAAAKAAAAEAAAABMAAAAiAAAAFAAAACQAAAAHAAAAFQAAAAkAAAAUAAAADgAAABMAAAAJAAAAKAAAABsAAAAkAAAAFQAAACYAAAATAAAAIgAAAA0AAAAdAAAABwAAABYAAAAQAAAAKQAAACEAAAAPAAAACAAAAB8AAAAXAAAAGAAAAAsAAAAKAAAAJwAAACUAAAAZAAAAGAAAAH8AAAAgAAAAJQAAAAoAAAAXAAAAEgAAABkAAAAXAAAAEQAAAAsAAAAtAAAAJwAAACMAAAAaAAAAKgAAAB0AAAArAAAADAAAABwAAAANAAAAGwAAACgAAAAjAAAALgAAAA4AAAAUAAAAEQAAABwAAAAfAAAAKgAAACwAAAAMAAAADwAAABoAAAAdAAAAKwAAACYAAAAvAAAADQAAABoAAAAVAAAAHgAAACAAAAAwAAAAMgAAABAAAAASAAAAIQAAAB8AAAApAAAALAAAADUAAAAPAAAAFgAAABwAAAAgAAAAHgAAABgAAAASAAAANAAAADIAAAAlAAAAIQAAAB4AAAAxAAAAMAAAABYAAAAQAAAAKQAAACIAAAATAAAAJgAAABUAAAA2AAAAJAAAADMAAAAjAAAALgAAAC0AAAA4AAAAEQAAABsAAAAZAAAAJAAAABQAAAAiAAAAEwAAADcAAAAoAAAANgAAACUAAAAnAAAANAAAADkAAAAYAAAAFwAAACAAAAAmAAAAfwAAACIAAAAzAAAAHQAAAC8AAAAVAAAAJwAAACUAAAAZAAAAFwAAADsAAAA5AAAALQAAACgAAAAbAAAAJAAAABQAAAA8AAAALgAAADcAAAApAAAAMQAAADUAAAA9AAAAFgAAACEAAAAfAAAAKgAAADoAAAArAAAAPgAAABwAAAAsAAAAGgAAACsAAAA+AAAALwAAAEAAAAAaAAAAKgAAAB0AAAAsAAAANQAAADoAAABBAAAAHAAAAB8AAAAqAAAALQAAACcAAAAjAAAAGQAAAD8AAAA7AAAAOAAAAC4AAAA8AAAAOAAAAEQAAAAbAAAAKAAAACMAAAAvAAAAJgAAACsAAAAdAAAARQAAADMAAABAAAAAMAAAADEAAAAeAAAAIQAAAEMAAABCAAAAMgAAADEAAAB/AAAAPQAAAEIAAAAhAAAAMAAAACkAAAAyAAAAMAAAACAAAAAeAAAARgAAAEMAAAA0AAAAMwAAAEUAAAA2AAAARwAAACYAAAAvAAAAIgAAADQAAAA5AAAARgAAAEoAAAAgAAAAJQAAADIAAAA1AAAAPQAAAEEAAABLAAAAHwAAACkAAAAsAAAANgAAAEcAAAA3AAAASQAAACIAAAAzAAAAJAAAADcAAAAoAAAANgAAACQAAABIAAAAPAAAAEkAAAA4AAAARAAAAD8AAABNAAAAIwAAAC4AAAAtAAAAOQAAADsAAABKAAAATgAAACUAAAAnAAAANAAAADoAAAB/AAAAPgAAAEwAAAAsAAAAQQAAACoAAAA7AAAAPwAAAE4AAABPAAAAJwAAAC0AAAA5AAAAPAAAAEgAAABEAAAAUAAAACgAAAA3AAAALgAAAD0AAAA1AAAAMQAAACkAAABRAAAASwAAAEIAAAA+AAAAKwAAADoAAAAqAAAAUgAAAEAAAABMAAAAPwAAAH8AAAA4AAAALQAAAE8AAAA7AAAATQAAAEAAAAAvAAAAPgAAACsAAABUAAAARQAAAFIAAABBAAAAOgAAADUAAAAsAAAAVgAAAEwAAABLAAAAQgAAAEMAAABRAAAAVQAAADEAAAAwAAAAPQAAAEMAAABCAAAAMgAAADAAAABXAAAAVQAAAEYAAABEAAAAOAAAADwAAAAuAAAAWgAAAE0AAABQAAAARQAAADMAAABAAAAALwAAAFkAAABHAAAAVAAAAEYAAABDAAAANAAAADIAAABTAAAAVwAAAEoAAABHAAAAWQAAAEkAAABbAAAAMwAAAEUAAAA2AAAASAAAAH8AAABJAAAANwAAAFAAAAA8AAAAWAAAAEkAAABbAAAASAAAAFgAAAA2AAAARwAAADcAAABKAAAATgAAAFMAAABcAAAANAAAADkAAABGAAAASwAAAEEAAAA9AAAANQAAAF4AAABWAAAAUQAAAEwAAABWAAAAUgAAAGAAAAA6AAAAQQAAAD4AAABNAAAAPwAAAEQAAAA4AAAAXQAAAE8AAABaAAAATgAAAEoAAAA7AAAAOQAAAF8AAABcAAAATwAAAE8AAABOAAAAPwAAADsAAABdAAAAXwAAAE0AAABQAAAARAAAAEgAAAA8AAAAYwAAAFoAAABYAAAAUQAAAFUAAABeAAAAZQAAAD0AAABCAAAASwAAAFIAAABgAAAAVAAAAGIAAAA+AAAATAAAAEAAAABTAAAAfwAAAEoAAABGAAAAZAAAAFcAAABcAAAAVAAAAEUAAABSAAAAQAAAAGEAAABZAAAAYgAAAFUAAABXAAAAZQAAAGYAAABCAAAAQwAAAFEAAABWAAAATAAAAEsAAABBAAAAaAAAAGAAAABeAAAAVwAAAFMAAABmAAAAZAAAAEMAAABGAAAAVQAAAFgAAABIAAAAWwAAAEkAAABjAAAAUAAAAGkAAABZAAAAYQAAAFsAAABnAAAARQAAAFQAAABHAAAAWgAAAE0AAABQAAAARAAAAGoAAABdAAAAYwAAAFsAAABJAAAAWQAAAEcAAABpAAAAWAAAAGcAAABcAAAAUwAAAE4AAABKAAAAbAAAAGQAAABfAAAAXQAAAE8AAABaAAAATQAAAG0AAABfAAAAagAAAF4AAABWAAAAUQAAAEsAAABrAAAAaAAAAGUAAABfAAAAXAAAAE8AAABOAAAAbQAAAGwAAABdAAAAYAAAAGgAAABiAAAAbgAAAEwAAABWAAAAUgAAAGEAAAB/AAAAYgAAAFQAAABnAAAAWQAAAG8AAABiAAAAbgAAAGEAAABvAAAAUgAAAGAAAABUAAAAYwAAAFAAAABpAAAAWAAAAGoAAABaAAAAcQAAAGQAAABmAAAAUwAAAFcAAABsAAAAcgAAAFwAAABlAAAAZgAAAGsAAABwAAAAUQAAAFUAAABeAAAAZgAAAGUAAABXAAAAVQAAAHIAAABwAAAAZAAAAGcAAABbAAAAYQAAAFkAAAB0AAAAaQAAAG8AAABoAAAAawAAAG4AAABzAAAAVgAAAF4AAABgAAAAaQAAAFgAAABnAAAAWwAAAHEAAABjAAAAdAAAAGoAAABdAAAAYwAAAFoAAAB1AAAAbQAAAHEAAABrAAAAfwAAAGUAAABeAAAAcwAAAGgAAABwAAAAbAAAAGQAAABfAAAAXAAAAHYAAAByAAAAbQAAAG0AAABsAAAAXQAAAF8AAAB1AAAAdgAAAGoAAABuAAAAYgAAAGgAAABgAAAAdwAAAG8AAABzAAAAbwAAAGEAAABuAAAAYgAAAHQAAABnAAAAdwAAAHAAAABrAAAAZgAAAGUAAAB4AAAAcwAAAHIAAABxAAAAYwAAAHQAAABpAAAAdQAAAGoAAAB5AAAAcgAAAHAAAABkAAAAZgAAAHYAAAB4AAAAbAAAAHMAAABuAAAAawAAAGgAAAB4AAAAdwAAAHAAAAB0AAAAZwAAAHcAAABvAAAAcQAAAGkAAAB5AAAAdQAAAH8AAABtAAAAdgAAAHEAAAB5AAAAagAAAHYAAAB4AAAAbAAAAHIAAAB1AAAAeQAAAG0AAAB3AAAAbwAAAHMAAABuAAAAeQAAAHQAAAB4AAAAeAAAAHMAAAByAAAAcAAAAHkAAAB3AAAAdgAAAHkAAAB0AAAAeAAAAHcAAAB1AAAAcQAAAHYAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAABAAAABQAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAACAAAABQAAAAEAAAAAAAAA/////wEAAAAAAAAAAwAAAAQAAAACAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAFAAAAAQAAAAAAAAAAAAAAAQAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAADAAAAAAAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAADAAAABQAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAEAAAABQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAABAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAQAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAAAAAABAAAAAwAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAADAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAUAAAABAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAABAAAAAUAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAIAAAAFAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAFAAAAAAAAAAAAAAD/////AQAAAAAAAAADAAAABAAAAAIAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAUAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAUAAAABAAAAAAAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAEAAAD//////////wEAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAADAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAACAAAAAAAAAAAAAAABAAAAAgAAAAYAAAAEAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAcAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAKAAAAAgAAAAAAAAAAAAAAAQAAAAEAAAAFAAAABgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAACAAAAAAAAAAAAAAABAAAAAwAAAAcAAAAGAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAABwAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAADgAAAAIAAAAAAAAAAAAAAAEAAAAAAAAACQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAMAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAIAAAAAAAAAAAAAAAEAAAAEAAAACAAAAAoAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAALAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAACQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAgAAAAAAAAAAAAAAAQAAAAsAAAAPAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAOAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAIAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAABQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAgAAAAAAAAAAAAAAAQAAAAwAAAAQAAAADAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAPAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAADwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAACAAAAAAAAAAAAAAABAAAACgAAABMAAAAIAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAA8AAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAQAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAACQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAIAAAAAAAAAAAAAAAEAAAANAAAAEQAAAA0AAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAARAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAA0AAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAACAAAAAAAAAAAAAAABAAAADgAAABIAAAAPAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAADwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAASAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEgAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAABIAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAATAAAAAgAAAAAAAAAAAAAAAQAAAP//////////EwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAASAAAAAAAAABgAAAAAAAAAIQAAAAAAAAAeAAAAAAAAACAAAAADAAAAMQAAAAEAAAAwAAAAAwAAADIAAAADAAAACAAAAAAAAAAFAAAABQAAAAoAAAAFAAAAFgAAAAAAAAAQAAAAAAAAABIAAAAAAAAAKQAAAAEAAAAhAAAAAAAAAB4AAAAAAAAABAAAAAAAAAAAAAAABQAAAAIAAAAFAAAADwAAAAEAAAAIAAAAAAAAAAUAAAAFAAAAHwAAAAEAAAAWAAAAAAAAABAAAAAAAAAAAgAAAAAAAAAGAAAAAAAAAA4AAAAAAAAACgAAAAAAAAALAAAAAAAAABEAAAADAAAAGAAAAAEAAAAXAAAAAwAAABkAAAADAAAAAAAAAAAAAAABAAAABQAAAAkAAAAFAAAABQAAAAAAAAACAAAAAAAAAAYAAAAAAAAAEgAAAAEAAAAKAAAAAAAAAAsAAAAAAAAABAAAAAEAAAADAAAABQAAAAcAAAAFAAAACAAAAAEAAAAAAAAAAAAAAAEAAAAFAAAAEAAAAAEAAAAFAAAAAAAAAAIAAAAAAAAABwAAAAAAAAAVAAAAAAAAACYAAAAAAAAACQAAAAAAAAATAAAAAAAAACIAAAADAAAADgAAAAEAAAAUAAAAAwAAACQAAAADAAAAAwAAAAAAAAANAAAABQAAAB0AAAAFAAAAAQAAAAAAAAAHAAAAAAAAABUAAAAAAAAABgAAAAEAAAAJAAAAAAAAABMAAAAAAAAABAAAAAIAAAAMAAAABQAAABoAAAAFAAAAAAAAAAEAAAADAAAAAAAAAA0AAAAFAAAAAgAAAAEAAAABAAAAAAAAAAcAAAAAAAAAGgAAAAAAAAAqAAAAAAAAADoAAAAAAAAAHQAAAAAAAAArAAAAAAAAAD4AAAADAAAAJgAAAAEAAAAvAAAAAwAAAEAAAAADAAAADAAAAAAAAAAcAAAABQAAACwAAAAFAAAADQAAAAAAAAAaAAAAAAAAACoAAAAAAAAAFQAAAAEAAAAdAAAAAAAAACsAAAAAAAAABAAAAAMAAAAPAAAABQAAAB8AAAAFAAAAAwAAAAEAAAAMAAAAAAAAABwAAAAFAAAABwAAAAEAAAANAAAAAAAAABoAAAAAAAAAHwAAAAAAAAApAAAAAAAAADEAAAAAAAAALAAAAAAAAAA1AAAAAAAAAD0AAAADAAAAOgAAAAEAAABBAAAAAwAAAEsAAAADAAAADwAAAAAAAAAWAAAABQAAACEAAAAFAAAAHAAAAAAAAAAfAAAAAAAAACkAAAAAAAAAKgAAAAEAAAAsAAAAAAAAADUAAAAAAAAABAAAAAQAAAAIAAAABQAAABAAAAAFAAAADAAAAAEAAAAPAAAAAAAAABYAAAAFAAAAGgAAAAEAAAAcAAAAAAAAAB8AAAAAAAAAMgAAAAAAAAAwAAAAAAAAADEAAAADAAAAIAAAAAAAAAAeAAAAAwAAACEAAAADAAAAGAAAAAMAAAASAAAAAwAAABAAAAADAAAARgAAAAAAAABDAAAAAAAAAEIAAAADAAAANAAAAAMAAAAyAAAAAAAAADAAAAAAAAAAJQAAAAMAAAAgAAAAAAAAAB4AAAADAAAAUwAAAAAAAABXAAAAAwAAAFUAAAADAAAASgAAAAMAAABGAAAAAAAAAEMAAAAAAAAAOQAAAAEAAAA0AAAAAwAAADIAAAAAAAAAGQAAAAAAAAAXAAAAAAAAABgAAAADAAAAEQAAAAAAAAALAAAAAwAAAAoAAAADAAAADgAAAAMAAAAGAAAAAwAAAAIAAAADAAAALQAAAAAAAAAnAAAAAAAAACUAAAADAAAAIwAAAAMAAAAZAAAAAAAAABcAAAAAAAAAGwAAAAMAAAARAAAAAAAAAAsAAAADAAAAPwAAAAAAAAA7AAAAAwAAADkAAAADAAAAOAAAAAMAAAAtAAAAAAAAACcAAAAAAAAALgAAAAMAAAAjAAAAAwAAABkAAAAAAAAAJAAAAAAAAAAUAAAAAAAAAA4AAAADAAAAIgAAAAAAAAATAAAAAwAAAAkAAAADAAAAJgAAAAMAAAAVAAAAAwAAAAcAAAADAAAANwAAAAAAAAAoAAAAAAAAABsAAAADAAAANgAAAAMAAAAkAAAAAAAAABQAAAAAAAAAMwAAAAMAAAAiAAAAAAAAABMAAAADAAAASAAAAAAAAAA8AAAAAwAAAC4AAAADAAAASQAAAAMAAAA3AAAAAAAAACgAAAAAAAAARwAAAAMAAAA2AAAAAwAAACQAAAAAAAAAQAAAAAAAAAAvAAAAAAAAACYAAAADAAAAPgAAAAAAAAArAAAAAwAAAB0AAAADAAAAOgAAAAMAAAAqAAAAAwAAABoAAAADAAAAVAAAAAAAAABFAAAAAAAAADMAAAADAAAAUgAAAAMAAABAAAAAAAAAAC8AAAAAAAAATAAAAAMAAAA+AAAAAAAAACsAAAADAAAAYQAAAAAAAABZAAAAAwAAAEcAAAADAAAAYgAAAAMAAABUAAAAAAAAAEUAAAAAAAAAYAAAAAMAAABSAAAAAwAAAEAAAAAAAAAASwAAAAAAAABBAAAAAAAAADoAAAADAAAAPQAAAAAAAAA1AAAAAwAAACwAAAADAAAAMQAAAAMAAAApAAAAAwAAAB8AAAADAAAAXgAAAAAAAABWAAAAAAAAAEwAAAADAAAAUQAAAAMAAABLAAAAAAAAAEEAAAAAAAAAQgAAAAMAAAA9AAAAAAAAADUAAAADAAAAawAAAAAAAABoAAAAAwAAAGAAAAADAAAAZQAAAAMAAABeAAAAAAAAAFYAAAAAAAAAVQAAAAMAAABRAAAAAwAAAEsAAAAAAAAAOQAAAAAAAAA7AAAAAAAAAD8AAAADAAAASgAAAAAAAABOAAAAAwAAAE8AAAADAAAAUwAAAAMAAABcAAAAAwAAAF8AAAADAAAAJQAAAAAAAAAnAAAAAwAAAC0AAAADAAAANAAAAAAAAAA5AAAAAAAAADsAAAAAAAAARgAAAAMAAABKAAAAAAAAAE4AAAADAAAAGAAAAAAAAAAXAAAAAwAAABkAAAADAAAAIAAAAAMAAAAlAAAAAAAAACcAAAADAAAAMgAAAAMAAAA0AAAAAAAAADkAAAAAAAAALgAAAAAAAAA8AAAAAAAAAEgAAAADAAAAOAAAAAAAAABEAAAAAwAAAFAAAAADAAAAPwAAAAMAAABNAAAAAwAAAFoAAAADAAAAGwAAAAAAAAAoAAAAAwAAADcAAAADAAAAIwAAAAAAAAAuAAAAAAAAADwAAAAAAAAALQAAAAMAAAA4AAAAAAAAAEQAAAADAAAADgAAAAAAAAAUAAAAAwAAACQAAAADAAAAEQAAAAMAAAAbAAAAAAAAACgAAAADAAAAGQAAAAMAAAAjAAAAAAAAAC4AAAAAAAAARwAAAAAAAABZAAAAAAAAAGEAAAADAAAASQAAAAAAAABbAAAAAwAAAGcAAAADAAAASAAAAAMAAABYAAAAAwAAAGkAAAADAAAAMwAAAAAAAABFAAAAAwAAAFQAAAADAAAANgAAAAAAAABHAAAAAAAAAFkAAAAAAAAANwAAAAMAAABJAAAAAAAAAFsAAAADAAAAJgAAAAAAAAAvAAAAAwAAAEAAAAADAAAAIgAAAAMAAAAzAAAAAAAAAEUAAAADAAAAJAAAAAMAAAA2AAAAAAAAAEcAAAAAAAAAYAAAAAAAAABoAAAAAAAAAGsAAAADAAAAYgAAAAAAAABuAAAAAwAAAHMAAAADAAAAYQAAAAMAAABvAAAAAwAAAHcAAAADAAAATAAAAAAAAABWAAAAAwAAAF4AAAADAAAAUgAAAAAAAABgAAAAAAAAAGgAAAAAAAAAVAAAAAMAAABiAAAAAAAAAG4AAAADAAAAOgAAAAAAAABBAAAAAwAAAEsAAAADAAAAPgAAAAMAAABMAAAAAAAAAFYAAAADAAAAQAAAAAMAAABSAAAAAAAAAGAAAAAAAAAAVQAAAAAAAABXAAAAAAAAAFMAAAADAAAAZQAAAAAAAABmAAAAAwAAAGQAAAADAAAAawAAAAMAAABwAAAAAwAAAHIAAAADAAAAQgAAAAAAAABDAAAAAwAAAEYAAAADAAAAUQAAAAAAAABVAAAAAAAAAFcAAAAAAAAAXgAAAAMAAABlAAAAAAAAAGYAAAADAAAAMQAAAAAAAAAwAAAAAwAAADIAAAADAAAAPQAAAAMAAABCAAAAAAAAAEMAAAADAAAASwAAAAMAAABRAAAAAAAAAFUAAAAAAAAAXwAAAAAAAABcAAAAAAAAAFMAAAAAAAAATwAAAAAAAABOAAAAAAAAAEoAAAADAAAAPwAAAAEAAAA7AAAAAwAAADkAAAADAAAAbQAAAAAAAABsAAAAAAAAAGQAAAAFAAAAXQAAAAEAAABfAAAAAAAAAFwAAAAAAAAATQAAAAEAAABPAAAAAAAAAE4AAAAAAAAAdQAAAAQAAAB2AAAABQAAAHIAAAAFAAAAagAAAAEAAABtAAAAAAAAAGwAAAAAAAAAWgAAAAEAAABdAAAAAQAAAF8AAAAAAAAAWgAAAAAAAABNAAAAAAAAAD8AAAAAAAAAUAAAAAAAAABEAAAAAAAAADgAAAADAAAASAAAAAEAAAA8AAAAAwAAAC4AAAADAAAAagAAAAAAAABdAAAAAAAAAE8AAAAFAAAAYwAAAAEAAABaAAAAAAAAAE0AAAAAAAAAWAAAAAEAAABQAAAAAAAAAEQAAAAAAAAAdQAAAAMAAABtAAAABQAAAF8AAAAFAAAAcQAAAAEAAABqAAAAAAAAAF0AAAAAAAAAaQAAAAEAAABjAAAAAQAAAFoAAAAAAAAAaQAAAAAAAABYAAAAAAAAAEgAAAAAAAAAZwAAAAAAAABbAAAAAAAAAEkAAAADAAAAYQAAAAEAAABZAAAAAwAAAEcAAAADAAAAcQAAAAAAAABjAAAAAAAAAFAAAAAFAAAAdAAAAAEAAABpAAAAAAAAAFgAAAAAAAAAbwAAAAEAAABnAAAAAAAAAFsAAAAAAAAAdQAAAAIAAABqAAAABQAAAFoAAAAFAAAAeQAAAAEAAABxAAAAAAAAAGMAAAAAAAAAdwAAAAEAAAB0AAAAAQAAAGkAAAAAAAAAdwAAAAAAAABvAAAAAAAAAGEAAAAAAAAAcwAAAAAAAABuAAAAAAAAAGIAAAADAAAAawAAAAEAAABoAAAAAwAAAGAAAAADAAAAeQAAAAAAAAB0AAAAAAAAAGcAAAAFAAAAeAAAAAEAAAB3AAAAAAAAAG8AAAAAAAAAcAAAAAEAAABzAAAAAAAAAG4AAAAAAAAAdQAAAAEAAABxAAAABQAAAGkAAAAFAAAAdgAAAAEAAAB5AAAAAAAAAHQAAAAAAAAAcgAAAAEAAAB4AAAAAQAAAHcAAAAAAAAAcgAAAAAAAABwAAAAAAAAAGsAAAAAAAAAZAAAAAAAAABmAAAAAAAAAGUAAAADAAAAUwAAAAEAAABXAAAAAwAAAFUAAAADAAAAdgAAAAAAAAB4AAAAAAAAAHMAAAAFAAAAbAAAAAEAAAByAAAAAAAAAHAAAAAAAAAAXAAAAAEAAABkAAAAAAAAAGYAAAAAAAAAdQAAAAAAAAB5AAAABQAAAHcAAAAFAAAAbQAAAAEAAAB2AAAAAAAAAHgAAAAAAAAAXwAAAAEAAABsAAAAAQAAAHIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAABAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAGAAAAAgAAAAUAAAABAAAABAAAAAAAAAAAAAAABQAAAAMAAAABAAAABgAAAAQAAAACAAAAAAAAAH6iBfbytuk/Gq6akm/58z/Xrm0Liez0P5doSdOpSwRAWs602ULg8D/dT7Rcbo/1v1N1RQHFNOM/g9Snx7HW3L8HWsP8Q3jfP6VwOLosutk/9rjk1YQcxj+gnmKMsNn6P/HDeuPFY+M/YHwDjqKhB0Ci19/fCVrbP4UxKkDWOP6/pvljWa09tL9wi7wrQXjnv/Z6yLImkM2/3yTlOzY14D+m+WNZrT20PzwKVQnrQwNA9nrIsiaQzT/g40rFrRQFwPa45NWEHMa/kbslHEZq97/xw3rjxWPjv4cLC2SMBci/otff3wla27+rKF5oIAv0P1N1RQHFNOO/iDJPGyWHBUAHWsP8Q3jfvwQf/by16gXAfqIF9vK26b8XrO0Vh0r+v9eubQuJ7PS/BxLrA0ZZ479azrTZQuDwv1MK1EuItPw/yscgV9Z6FkAwHBR2WjQMQJNRzXsQ5vY/GlUHVJYKF0DONuFv2lMNQNCGZ28QJfk/0WUwoIL36D8ggDOMQuATQNqMOeAy/wZAWFYOYM+M2z/LWC4uH3oSQDE+LyTsMgRAkJzhRGWFGEDd4soovCQQQKqk0DJMEP8/rGmNdwOLBUAW2X/9xCbjP4hu3dcqJhNAzuYItRvdB0CgzW3zJW/sPxotm/Y2TxRAQAk9XmdDDEC1Kx9MKgT3P1M+NctcghZAFVqcLlb0C0Bgzd3sB2b2P77mZDPUWhZAFROHJpUGCEDAfma5CxXtPz1DWq/zYxRAmhYY5824F0DOuQKWSbAOQNCMqrvu3fs/L6DR22K2wT9nAAxPBU8RQGiN6mW43AFAZhu25b633D8c1YgmzowSQNM25BRKWARArGS08/lNxD+LFssHwmMRQLC5aNcxBgJABL9HT0WRF0CjCmJmOGEOQHsuaVzMP/s/TWJCaGGwBUCeu1PAPLzjP9nqN9DZOBNAKE4JcydbCkCGtbd1qjPzP8dgm9U8jhVAtPeKTkVwDkCeCLss5l37P401XMPLmBdAFd29VMVQDUBg0yA55h75Pz6odcYLCRdApBM4rBrkAkDyAVWgQxbRP4XDMnK20hFAymLlF7EmzD8GUgo9XBHlP3lbK7T9COc/k+OhPthhy7+YGEpnrOvCPzBFhLs15u4/epbqB6H4uz9IuuLF5svev6lzLKY31es/CaQ0envF5z8ZY0xlUADXv7zaz7HYEuI/CfbK1sn16T8uAQfWwxLWPzKn/YuFN94/5KdbC1AFu793fyCSnlfvPzK2y4doAMY/NRg5t1/X6b/shq4QJaHDP5yNIAKPOeI/vpn7BSE30r/X4YQrO6nrv78Ziv/Thto/DqJ1Y6+y5z9l51NaxFrlv8QlA65HOLS/86dxiEc96z+Hj0+LFjneP6LzBZ8LTc2/DaJ1Y6+y579l51NaxFrlP8QlA65HOLQ/8qdxiEc967+Jj0+LFjnev6LzBZ8LTc0/1qdbC1AFuz93fyCSnlfvvzK2y4doAMa/NRg5t1/X6T/vhq4QJaHDv5yNIAKPOeK/wJn7BSE30j/W4YQrO6nrP78Ziv/Thtq/CaQ0envF578XY0xlUADXP7zaz7HYEuK/CvbK1sn16b8rAQfWwxLWvzKn/YuFN96/zWLlF7EmzL8GUgo9XBHlv3lbK7T9COe/kOOhPthhyz+cGEpnrOvCvzBFhLs15u6/c5bqB6H4u79IuuLF5sveP6lzLKY31eu/AQAAAP////8HAAAA/////zEAAAD/////VwEAAP////9hCQAA/////6dBAAD/////kcsBAP/////3kAwA/////8H2VwAAAAAAAAAAAAAAAAACAAAA/////w4AAAD/////YgAAAP////+uAgAA/////8ISAAD/////ToMAAP////8ilwMA/////+4hGQD/////gu2vAAAAAAAAAAAAAAAAAAAAAAACAAAA//////////8BAAAAAwAAAP//////////////////////////////////////////////////////////////////////////AQAAAAAAAAACAAAA////////////////AwAAAP//////////////////////////////////////////////////////////////////////////AQAAAAAAAAACAAAA////////////////AwAAAP//////////////////////////////////////////////////////////////////////////AQAAAAAAAAACAAAA////////////////AwAAAP//////////////////////////////////////////////////////////AgAAAP//////////AQAAAAAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAD/////////////////////AQAAAP///////////////wIAAAD///////////////////////////////8DAAAA/////////////////////wAAAAD///////////////8CAAAAAQAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAD///////////////8CAAAAAQAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAD///////////////8CAAAAAQAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAD///////////////8CAAAAAQAAAP////////////////////////////////////////////////////8BAAAAAgAAAP///////////////wAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8BAAAAAgAAAP///////////////wAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8BAAAAAgAAAP///////////////wAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8BAAAAAgAAAP///////////////wAAAAD/////////////////////AwAAAP///////////////////////////////wIAAAD///////////////8BAAAA/////////////////////wAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAABAAAA//////////8CAAAA//////////////////////////////////////////////////////////8DAAAA////////////////AgAAAAAAAAABAAAA//////////////////////////////////////////////////////////////////////////8DAAAA////////////////AgAAAAAAAAABAAAA//////////////////////////////////////////////////////////////////////////8DAAAA////////////////AgAAAAAAAAABAAAA//////////////////////////////////////////////////////////////////////////8DAAAAAQAAAP//////////AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAACAAAAAAAAAAIAAAABAAAAAQAAAAIAAAACAAAAAAAAAAUAAAAFAAAAAAAAAAIAAAACAAAAAwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAgAAAAEAAAACAAAAAgAAAAIAAAAAAAAABQAAAAYAAAAAAAAAAgAAAAIAAAADAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAgAAAAAAAAACAAAAAQAAAAMAAAACAAAAAgAAAAAAAAAFAAAABwAAAAAAAAACAAAAAgAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAACAAAAAAAAAAIAAAABAAAABAAAAAIAAAACAAAAAAAAAAUAAAAIAAAAAAAAAAIAAAACAAAAAwAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAIAAAAAAAAAAgAAAAEAAAAAAAAAAgAAAAIAAAAAAAAABQAAAAkAAAAAAAAAAgAAAAIAAAADAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAKAAAAAgAAAAIAAAAAAAAAAwAAAA4AAAACAAAAAAAAAAIAAAADAAAAAAAAAAAAAAACAAAAAgAAAAMAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAACAAAAAgAAAAAAAAADAAAACgAAAAIAAAAAAAAAAgAAAAMAAAABAAAAAAAAAAIAAAACAAAAAwAAAAcAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAIAAAACAAAAAAAAAAMAAAALAAAAAgAAAAAAAAACAAAAAwAAAAIAAAAAAAAAAgAAAAIAAAADAAAACAAAAAAAAAAAAAAAAAAAAAAAAAANAAAAAgAAAAIAAAAAAAAAAwAAAAwAAAACAAAAAAAAAAIAAAADAAAAAwAAAAAAAAACAAAAAgAAAAMAAAAJAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAACAAAAAgAAAAAAAAADAAAADQAAAAIAAAAAAAAAAgAAAAMAAAAEAAAAAAAAAAIAAAACAAAAAwAAAAoAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAIAAAACAAAAAAAAAAMAAAAGAAAAAgAAAAAAAAACAAAAAwAAAA8AAAAAAAAAAgAAAAIAAAADAAAACwAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAgAAAAIAAAAAAAAAAwAAAAcAAAACAAAAAAAAAAIAAAADAAAAEAAAAAAAAAACAAAAAgAAAAMAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAACAAAAAgAAAAAAAAADAAAACAAAAAIAAAAAAAAAAgAAAAMAAAARAAAAAAAAAAIAAAACAAAAAwAAAA0AAAAAAAAAAAAAAAAAAAAAAAAACAAAAAIAAAACAAAAAAAAAAMAAAAJAAAAAgAAAAAAAAACAAAAAwAAABIAAAAAAAAAAgAAAAIAAAADAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAJAAAAAgAAAAIAAAAAAAAAAwAAAAUAAAACAAAAAAAAAAIAAAADAAAAEwAAAAAAAAACAAAAAgAAAAMAAAAPAAAAAAAAAAAAAAAAAAAAAAAAABAAAAACAAAAAAAAAAIAAAABAAAAEwAAAAIAAAACAAAAAAAAAAUAAAAKAAAAAAAAAAIAAAACAAAAAwAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEQAAAAIAAAAAAAAAAgAAAAEAAAAPAAAAAgAAAAIAAAAAAAAABQAAAAsAAAAAAAAAAgAAAAIAAAADAAAAEQAAAAAAAAAAAAAAAAAAAAAAAAASAAAAAgAAAAAAAAACAAAAAQAAABAAAAACAAAAAgAAAAAAAAAFAAAADAAAAAAAAAACAAAAAgAAAAMAAAASAAAAAAAAAAAAAAAAAAAAAAAAABMAAAACAAAAAAAAAAIAAAABAAAAEQAAAAIAAAACAAAAAAAAAAUAAAANAAAAAAAAAAIAAAACAAAAAwAAABMAAAAAAAAAAAAAAAAAAAAAAAAADwAAAAIAAAAAAAAAAgAAAAEAAAASAAAAAgAAAAIAAAAAAAAABQAAAA4AAAAAAAAAAgAAAAIAAAADAAAAAgAAAAEAAAAAAAAAAQAAAAIAAAAAAAAAAAAAAAIAAAABAAAAAAAAAAEAAAACAAAAAQAAAAAAAAACAAAAAAAAAAUAAAAEAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAFAAAABAAAAAAAAAABAAAABQAAAAQAAAAAAAAABQAAAAAAAAACAAAAAQAAAAAAAAABAAAAAgAAAAAAAAAAAAAAAgAAAAEAAAAAAAAAAQAAAAIAAAABAAAAAAAAAAIAAAACAAAAAAAAAAEAAAAAAAAAAAAAAAUAAAAEAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAFAAAABAAAAAAAAAABAAAABQAAAAQAAAAAAAAABQAAAAUAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAABAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAEAAAAAAAAAAAEAAAAAAQAAAAAAAAAAAQAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAABAAAAAAAAAAAAAQAAAAAAAAAAAAA6B6FaUp9QQTPXMuL4myJBraiDfBwx9UBYJseitzTIQOL5if9jqZtAnXX+Z+ycb0C3pucbhRBCQG8wJBYqpRRAlWbDCzCY5z/eFWBUEve6P/+qo4Q50Y4/D9YM3iCcYT8fcA2QJSA0P4ADxu0qAAc/BNcGolVJ2j5d9FACqwquPh9z7MthtI9CSUSYJke/YUJQ/64OyjU0Qpi0+HCmFQdCm3GfIVdh2kHsJ11kAyauQYC3UDFJOoFBSJsFV1OwU0FK5fcxX4AmQWhy/zZIt/lACqaCPsBjzUDbdUNIScugQMYQlVJ4MXNANiuq8GTvRUDxTXnulxEZQFZ8QX5kpuw/qmG/JwYFlEAluh3Q6DB+QKn4vyNq0GZAKOXekas+UUB8xabXXhI6QG63C2pLtSNAdDBtyNfLDUDyOcu67ID2P0rCMvRXAeE/Ki2TSVyzyT9Dk+8Sz2uzP5J+w5ARWp0/NQAoOiMuhj9YnP+RyMJwPxgW7TvQVFk/KgsLYF0kQz9g5dAC6IwzQcgHPVvDex1B1XjppodHBkHJq3OMM9fwQNvcmJ7wddlAInGPpQs/w0BRobq5EBmtQJZ2ai7n+ZVAtv2G5E+bgECG+gIfKBlpQK5f8jdI91JAL39sL/WpPEB8rGxhDqklQK6yUf43XhBAxL9y/tK8+D86XyZpgrHiPwAAAAD/////AAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////AAAAAP////8AAAAAAAAAAAAAAAABAAAAAAAAAAAAAAD/////AAAAAAAAAAABAAAAAQAAAAAAAAAAAAAA/////wAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAP////8FAAAABQAAAAAAAAAAAAAAAAAAAAAAAAD/////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////////////////////////////wAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////////////////////////////8AAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAFAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////AAAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAEAAAABAAAAAAAAAAEAAAAAAAAABQAAAAEAAAABAAAAAAAAAAAAAAABAAAAAQAAAAAAAAABAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAQAAAAAAAQABAAABAQAAAAAAAQAAAAEAAAABAAEAAAAAAAAAAAAAAAAAAAAAquJYWJZl+D9jaeZNtj/zPwwdI9KqaeO/qGefXwdHdz+q4lhYlmX4P+OrlPMN3PI/DB0j0qpp47+7SQLV4VIEQKriWFiWZfg/r2kma3tz8T82eQmLqNIGwMRIWXMqSvo/fcCszPux9j+jara6ozTwP6hnn18HR3c/MSoKLequ8r+SabgA2nj0P7jBLbDOHO8/1Ym/ICfH4T+6lxjvlFXHv73m373LRPU/0vXyDVxo7T+ToKRHJXMAQF/33578aPE/pAyy64tD9T8+U/hCvyruPwxv8Y7YYwLAuXYr8NAiCEB4+LDK0Sn0P1Qeuy4j+eo/OMx50n7K7L+TrGB/nyf8v5ehC2fbYPM/aXMKexiT6z8mFRIMjg/zP7yUVwGGBNw/E6opHERf8z/z0wR2g9DqPw4pBpcOhvu/NbA29uWAA8DMaTExyXzyP02biiQ+Ruk/S8jz2/FKBEB1pzZnpbb9P7pQU4wLfPI//7ZcQXeG6D9CqEQvAYoIwDB2VB6sSgRAVyv8H5We8T+EHWF8XNPmPzB2wT8Nrrg/SEi+cX+w4L8of+GtdSDxP1sjk5AdouU/6ZjOVru13r8K0obqI6bxvwVbdNXyhfA/w5GG024n5z+rwmtMzP8BwLw9pSX49QXABe/2uQxP8D+b6wCzCvXkP7uGT87fK+Q/pz/JWw4coj+qoBf2J0nwP/yE3PUo0+I/vFJeHcaC+D96luSIqvntP/bf8sHUYu8/gZNN41mL4z9bhOqVOF4FwO6lmAh1hQhAbCVxbdhk7z+1C8NdDcfiPwG36x/0OQBAx0WJ76c2+D9nlSHXANfuP2HlfZ3gqOE/EwnVlVPg9r96+oHzEH//v5bXzdT1Auw/DM3GwLsA4D9p/8uoKcr+v+U9x5DQVAPAehjSdghb7D9sc1IetODgP8MVwwB1pu6/azPk6OGe978W8t/TUc3rP+0QMvYfP+A/RsG/QpSE8D+l3uwScxzgPwQaifgujuw/k1Vti1I43z8MAwLnSh0GQH5nYnwwZgJAiGUzWC5s6j8WyyI/BbLgPw4iUapGeQJAB3W+imnp/j9BLWR4ssrpP2t+gG5Pstk/cpBsfm6DCMCOpU9dOZsFQEv8nFypHeo/ehJ6i+6S2D9jqlGEmarLv7STC5TRiOa/bC+x8WZD6D9H3yUkWpDZP8gZvmCMuQLAreY19/eRBsCoPOc8UzzpP6KI/QV+y9g/t/MoboyWzT+Hv5q3Zu3Mvy2xROCT4uY/9gQitMMg1T9abAqhWMDkv1oLTavoUfG/PMUJP9CD5j+fHRX3t6fSPz7W2gk6bvs/WRnuHwqN9D8YFturGCTmP1EZczv0b9I/5t4exabB5D/1ESLh5fTEP9X2z6SYweQ/6lv3I2zT0D9zkRGNUNMAQKoSvc4EIfs/Xggt8wQI5T+mJHHg/w/SP4lhT/9t8vQ/DrZ/DbwH7D+XlhbYZrjkP34LIpFt6c4/lwfp8fLX9L+j96CTTf76v3WdNhEv9uM/d8c3o4lV0D/vFdCHVcsFwAHeDq0F1QhApbYqcZiN5D9KoilqByXLPwX0/diA0vq/0fo0GxnxAMBbaTkvlCzjP/RrFrWXrMs/UYTrky7jA0DB9f4FiZYAQEGAk/3QzeE/r/TeqE8t0D/OqjlsnPbvvz8RKU8JOfW/smSEbK/O4T8MzuyPm3DDP/rFtctq9gZAfb1EVEaSA0Dts5dVInnhP18SFMc79MM/7y34cw6LAMDFrRJsZO0DwC2KLvLSYuA/hx5wcUHewz+49SnK/4ruPyeS0PX9a+E/ZxaaLvvZ3z8WPu5T2QS8Pygo4RIvMqa/BJ0Kqsd0279cKW4ay8jdP3b05bmZ364/10/qtdxk2r+Bcz6CDMvpv54qOw+Amdw/qLV71pW7sT/YKc80nIPUP8OfIaBJ77G/LyTuD1un2z+diYu8efWzP1wU7ACkfwjAZroyPL1yBkAmv3lKJJbbPysKSE4W+p0/dIgqY79TA8ATLTOQ3tsGwJ2zweD/Xdg/XO/jXeFUaL8VW2qLFKfov1cA9Aa6XfK/tIa7YGgI2T+f3hu/sxqPv2nXdPpf3Pc/jkw8Jbda8j+tT/z8tGPVP1yBHpJd35k/KYvYOy1s8j/yz+kCQjPrP9+agH7x59g/PZfJ9aBhpr/rDKzvYBb+PwtkiaGCt/c/vb1mVr+f1T/JIHwHc8Govw7aeF6+9vG/Xv7kD6fp979isYioQYHVP7AIQZuSFrG/3z1AdUTnAUDN3XY9O7f9P0AdQ9ljYNQ/dJANJPTOrb8kLECUiiPlP4yF7UgmStA/9xGmXxCG1T9qZzix4W2zv2SGJRJVrPe/Fh9a2M/B/b8IexzFCoPSP9y1QFD2bLe/Q86cWLJe/b+mOOfYm78BwOTjkPAGE9E/8aPCUKu/ub9pPZyLCiUGwBA7Mev/BQlALOmrlRi+0j+AMJ/dKULBv7iLtL6a6QRAEMDV/yajAUDa62dE3crJP1P70RgBUbq/38hVnR6esT/s1tG10Z/Ov/zLwalHPss/dTS9NKTXx78nMcRzCIEHQAabxDsAmQRA0tyLK3gSyT+Aui7nOhDGv5Gs58z3WgHATN3forJuBMCAui7nOhDGP9Lciyt4Esm/WAJyHQ4c7z8UP5HFIs3iP3U0vTSk18c//MvBqUc+y7+cvv8HLg/Kvy1I/mHsI+K/U/vRGAFRuj/a62dE3crJv8p+WV8KlQjAuQ/nOP43B0CAMJ/dKULBPyzpq5UYvtK/ZoU+VoLh4L9etLlRUfvtv/GjwlCrv7k/5OOQ8AYT0b9DfT9FhufXPwUX8hJp+4u/3LVAUPZstz8IexzFCoPSv9+L609E5fQ/q9Fz7X2J7T9qZzix4W2zP/cRpl8QhtW/vtNilqGX+j8MOy7QJoL0P3SQDST0zq0/QB1D2WNg1L8IIjSvGNkDwGB8Jou2GAfAsAhBm5IWsT9isYioQYHVvyS9D3zb6uy/gnwRa7uM9L/JIHwHc8GoP729Zla/n9W/CsAHJZwmAEDEW6OYT1r6Pz2XyfWgYaY/35qAfvHn2L83Tdy4lS30vxf2/gZ0jPq/XIEekl3fmb+tT/z8tGPVvybPr2zJ1/+/K7mJ0ypVAsCf3hu/sxqPPwCGu2BoCNm/5oITrpZn+r+UDUyDP+n/v1zv413hVGg/nbPB4P9d2L9MlmkxNvgCQMtZlKE85v8/KwpIThb6nb8mv3lKJJbbv8+SZsTvOOc/pQCIIOYw0j+diYu8efWzvy8k7g9bp9u/kxYDa+pKtD9XlYvA8HnVv6i1e9aVu7G/nio7D4CZ3L/WR6rNh5EGwCkgQweBkghAdvTluZnfrr9cKW4ay8jdvxbjhr1f1QVAR5C0MzivAkAWPu5T2QS8v2cWmi772d+/cKj4lzLJCEBx2QJfYrMFQIcecHFB3sO/LYou8tJi4L+jr7lhO38BwIcI0Nb7xgTAXxIUxzv0w7/ts5dVInnhv0T+l8DZLfE/MP3FoFvS5D8MzuyPm3DDv7JkhGyvzuG/tzhzRIRc0b9Ovv3/0z7mv6/03qhPLdC/m4CT/dDN4b9dwjU5VCQBQBBJX1ntCv0/9GsWtZesy79baTkvlCzjv1mjYgEz++S/oW6KnOQW8b9KoilqByXLv6W2KnGYjeS/SmaKz3Vx9z+BZB5yxGHwP3fHN6OJVdC/dZ02ES/2478PuaBjLrXaP4/JU81pPaO/fgsikW3pzr+XlhbYZrjkv4tSn7YDbP0/f2LnFKlF9z+mJHHg/w/Sv14ILfMECOW/mfg4qYhR/b+OP+RQDCACwOpb9yNs09C/1fbPpJjB5L9pN2WOVZ3wv3hHy9nxIve/URlzO/Rv0r8YFturGCTmv1d1/KKR8QPA8gsy9qzSB8CfHRX3t6fSvzzFCT/Qg+a/EYStnrzV9r/2QJqI7Lb9v/YEIrTDINW/LbFE4JPi5r/7kQEs5fEDQHunnf4GeQBAooj9BX7L2L+oPOc8Uzzpv+ydYY2SSAfAL4HK6CRTB0BH3yUkWpDZv2wvsfFmQ+i/Ik0Yzruh6T8fM3LoGoDUP3oSeovukti/S/ycXKkd6r9rEv+7UWcHQCRIQe/GfwNAa36Abk+y2b9BLWR4ssrpv9KT87qa0bM/FTyktw823L8WyyI/BbLgv4hlM1gubOq/DizMp9Ki6r8b5ckdjVrzv5NVbYtSON+/BBqJ+C6O7L/dUBFqgyXYv00Wh18r7+q/7RAy9h8/4L8W8t/TUc3rv4RM5DKx3wDAfvWIj94aBcBsc1IetODgv3oY0nYIW+y/oGcTFF54AUDkJqS/FKX6PwzNxsC7AOC/ltfN1PUC7L+5Wrz/zHnzP6688w2rNOc/YeV9neCo4b9nlSHXANfuvw9RsxKjY/s/1V8GteXE8j+1C8NdDcfiv2wlcW3YZO+/IOywaA7Q8b9bFP+4Tg36v4GTTeNZi+O/9t/ywdRi77+tRc3yFR7eP2bkcHXJkLO//ITc9SjT4r+qoBf2J0nwv2YHKoswwfm/iQcLspCjAcCb6wCzCvXkvwXv9rkMT/C/YkuwYAMXBMApCNUai9kIwMORhtNuJ+e/BVt01fKF8L+ZqWEfvIjsP6h693QZYNk/WyOTkB2i5b8of+GtdSDxvwpaaulDSwVADMQAX+lOAECEHWF8XNPmv1cr/B+VnvG/XyFG6opcCMD/mtR32/UEQP+2XEF3hui/ulBTjAt88r/imfCfRP+yP9zbvtc8XeO/TZuKJD5G6b/MaTExyXzyvxiTQeElXOO/rbJRQVGN9L/z0wR2g9DqvxOqKRxEX/O/FDGCEei99j9x8zV4VYTmP2lzCnsYk+u/l6ELZ9tg878pRXacaDT/v3k6GZRqoQXAVB67LiP56r94+LDK0Sn0vwO6pZ9b7wFAvK0nKVcc9j8+U/hCvyruv6QMsuuLQ/W/FPhKFYv46j8MyxaDTOW/v9L18g1caO2/vebfvctE9b/7GD8ZrF3xv3gx1AR9bQDAuMEtsM4c77+SabgA2nj0v5xKFIwxsATArKNSBaKsB0Cjara6ozTwv33ArMz7sfa/dF2U0FcWCcDxL357DJX/P69pJmt7c/G/quJYWJZl+L/YntVJlnrSP4sRLzXM+fe/46uU8w3c8r+q4lhYlmX4v85lu5+QRwRAsI0H/WU8479jaeZNtj/zv6riWFiWZfi/sI0H/WU847/OZbufkEcEQHAoPUBrnss/9exKzDtFtT88wM8kax+gP9OqeKeAYog/MW0ItiZvcj+ph+smvt5bP2lCaV5dEUU/StaUmQDaLz+kK9y22BMYP0O3whZuMwI/IIbgZGWE6z7UkjYaEM3UPuezxwa9cr8+LybxRMnFpz6E1N8DbPiRPsYjySMvK3s+//////8fAAj//////zMQCP////9/MiAI/////28yMAj/////YzJACP///z9iMlAI////N2IyYAj///8zYjJwCP//vzNiMoAI//+rM2IykAj/f6szYjKgCP8PqzNiMrAI/wOrM2IywAi/A6szYjLQCJ8DqzNiMuAImQOrM2Iy8Aj//////z8PCP//////Kx8I/////38pLwj/////Pyk/CP////85KU8I////PzgpXwj///8POClvCP///w44KX8I//8fDjgpjwj//w8OOCmfCP9/DQ44Ka8I/w8NDjgpvwj/DQ0OOCnPCP8MDQ44Kd8IxwwNDjgp7wjEDA0OOCn/CAcAAAAHAAAAAQAAAAIAAAAEAAAAAwAAAAAAAAAAAAAABwAAAAMAAAABAAAAAgAAAAUAAAAEAAAAAAAAAAAAAAAEAAAABAAAAAAAAAACAAAAAQAAAAMAAAAOAAAABgAAAAsAAAACAAAABwAAAAEAAAAYAAAABQAAAAoAAAABAAAABgAAAAAAAAAmAAAABwAAAAwAAAADAAAACAAAAAIAAAAxAAAACQAAAA4AAAAAAAAABQAAAAQAAAA6AAAACAAAAA0AAAAEAAAACQAAAAMAAAA/AAAACwAAAAYAAAAPAAAACgAAABAAAABIAAAADAAAAAcAAAAQAAAACwAAABEAAABTAAAACgAAAAUAAAATAAAADgAAAA8AAABhAAAADQAAAAgAAAARAAAADAAAABIAAABrAAAADgAAAAkAAAASAAAADQAAABMAAAB1AAAADwAAABMAAAARAAAAEgAAABAAAAAGAAAAAgAAAAMAAAAFAAAABAAAAAAAAAAAAAAAAAAAAAYAAAACAAAAAwAAAAEAAAAFAAAABAAAAAAAAAAAAAAABwAAAAUAAAADAAAABAAAAAEAAAAAAAAAAgAAAAAAAAACAAAAAwAAAAEAAAAFAAAABAAAAAYAAAAAAAAAAAAAABgtRFT7Ifk/GC1EVPsh+b8YLURU+yEJQBgtRFT7IQnAYWxnb3MuYwBoM05laWdoYm9yUm90YXRpb25zAGNvb3JkaWprLmMAX3VwQXA3Q2hlY2tlZABfdXBBcDdyQ2hlY2tlZABkaXJlY3RlZEVkZ2UuYwBkaXJlY3RlZEVkZ2VUb0JvdW5kYXJ5AGFkamFjZW50RmFjZURpclt0bXBGaWprLmZhY2VdW2ZpamsuZmFjZV0gPT0gS0kAZmFjZWlqay5jAF9mYWNlSWprUGVudFRvQ2VsbEJvdW5kYXJ5AGFkamFjZW50RmFjZURpcltjZW50ZXJJSksuZmFjZV1bZmFjZTJdID09IEtJAF9mYWNlSWprVG9DZWxsQm91bmRhcnkAaDNJbmRleC5jAGNvbXBhY3RDZWxscwBsYXRMbmdUb0NlbGwAY2VsbFRvQ2hpbGRQb3MAdmFsaWRhdGVDaGlsZFBvcwBsYXRMbmcuYwBjZWxsQXJlYVJhZHMyAHBvbHlnb24tPm5leHQgPT0gTlVMTABsaW5rZWRHZW8uYwBhZGROZXdMaW5rZWRQb2x5Z29uAG5leHQgIT0gTlVMTABsb29wICE9IE5VTEwAYWRkTmV3TGlua2VkTG9vcABwb2x5Z29uLT5maXJzdCA9PSBOVUxMAGFkZExpbmtlZExvb3AAY29vcmQgIT0gTlVMTABhZGRMaW5rZWRDb29yZABsb29wLT5maXJzdCA9PSBOVUxMAGlubmVyTG9vcHMgIT0gTlVMTABub3JtYWxpemVNdWx0aVBvbHlnb24AYmJveGVzICE9IE5VTEwAY2FuZGlkYXRlcyAhPSBOVUxMAGZpbmRQb2x5Z29uRm9ySG9sZQBjYW5kaWRhdGVCQm94ZXMgIT0gTlVMTAByZXZEaXIgIT0gSU5WQUxJRF9ESUdJVABsb2NhbGlqLmMAY2VsbFRvTG9jYWxJamsAYmFzZUNlbGwgIT0gb3JpZ2luQmFzZUNlbGwAIShvcmlnaW5PblBlbnQgJiYgaW5kZXhPblBlbnQpAGJhc2VDZWxsID09IG9yaWdpbkJhc2VDZWxsAGJhc2VDZWxsICE9IElOVkFMSURfQkFTRV9DRUxMAGxvY2FsSWprVG9DZWxsACFfaXNCYXNlQ2VsbFBlbnRhZ29uKGJhc2VDZWxsKQBiYXNlQ2VsbFJvdGF0aW9ucyA+PSAwAGdyaWRQYXRoQ2VsbHMAcG9seWZpbGwuYwBpdGVyU3RlcFBvbHlnb25Db21wYWN0ADAAdmVydGV4LmMAdmVydGV4Um90YXRpb25zAGNlbGxUb1ZlcnRleABncmFwaC0+YnVja2V0cyAhPSBOVUxMAHZlcnRleEdyYXBoLmMAaW5pdFZlcnRleEdyYXBoAG5vZGUgIT0gTlVMTABhZGRWZXJ0ZXhOb2Rl";var G="function"==typeof atob?atob:function(A){var e,t,r,n,o,i,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",s="",l=0;A=A.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{e=a.indexOf(A.charAt(l++))<<2|(n=a.indexOf(A.charAt(l++)))>>4,t=(15&n)<<4|(o=a.indexOf(A.charAt(l++)))>>2,r=(3&o)<<6|(i=a.indexOf(A.charAt(l++))),s+=String.fromCharCode(e),64!==o&&(s+=String.fromCharCode(t)),64!==i&&(s+=String.fromCharCode(r))}while(l=0){if((0|t)>13780509){if(0|(a=0|le(15,s)))break;s=0|n[(l=s)>>2],l=0|n[l+4>>2]}else c=0|qe(0|t,0|(a=((0|t)<0)<<31>>31),3,0),l=0|B(),a=0|We(0|t,0|a,1,0),a=0|We(0|(a=0|qe(0|c,0|l,0|a,0|B())),0|B(),1,0),l=0|B(),n[s>>2]=a,n[s+4>>2]=l,s=a;if(lt(0|r,0,s<<3),0|o){lt(0|o,0,s<<2),a=0|L(A,e,t,r,o,s,l,0);break}(a=0|Ve(s,4))?(c=0|L(A,e,t,r,a,s,l,0),Ye(a),a=c):a=13}else a=2}while(0);return S=i,0|a}function T(A,e,t,r,o){A|=0,e|=0,t|=0,r|=0,o|=0;var i,a,s=0,l=0,c=0,u=0,f=0,d=0,g=0,h=0,m=0;if(a=S,S=S+16|0,m=a+8|0,n[(h=i=a)>>2]=A,n[h+4>>2]=e,(0|t)<0)return S=a,2;if(n[(s=r)>>2]=A,n[s+4>>2]=e,(s=!!(0|o))&&(n[o>>2]=0),0|HA(A,e))return S=a,9;n[m>>2]=0;A:do{if((0|t)>=1)if(s)for(d=1,f=0,g=0,h=1,s=A;;){if(!(f|g)){if(0|(s=0|I(s,e,4,m,i)))break A;if(0|HA(s=0|n[(e=i)>>2],e=0|n[e+4>>2])){s=9;break A}}if(0|(s=0|I(s,e,0|n[26800+(g<<2)>>2],m,i)))break A;if(s=0|n[(e=i)>>2],e=0|n[e+4>>2],n[(A=r+(d<<3)|0)>>2]=s,n[A+4>>2]=e,n[o+(d<<2)>>2]=h,l=(0|(A=f+1|0))==(0|h),u=6==(0|(c=g+1|0)),0|HA(s,e)){s=9;break A}if((0|(h=h+(u&l&1)|0))>(0|t)){s=0;break}d=d+1|0,f=l?0:A,g=l?u?0:c:g}else for(d=1,f=0,g=0,h=1,s=A;;){if(!(f|g)){if(0|(s=0|I(s,e,4,m,i)))break A;if(0|HA(s=0|n[(e=i)>>2],e=0|n[e+4>>2])){s=9;break A}}if(0|(s=0|I(s,e,0|n[26800+(g<<2)>>2],m,i)))break A;if(s=0|n[(e=i)>>2],e=0|n[e+4>>2],n[(A=r+(d<<3)|0)>>2]=s,n[A+4>>2]=e,l=(0|(A=f+1|0))==(0|h),u=6==(0|(c=g+1|0)),0|HA(s,e)){s=9;break A}if((0|(h=h+(u&l&1)|0))>(0|t)){s=0;break}d=d+1|0,f=l?0:A,g=l?u?0:c:g}else s=0}while(0);return S=a,0|s}function L(A,e,t,r,o,i,a,s){t|=0,r|=0,o|=0,s|=0;var l,c,u,f=0,d=0,g=0,h=0,m=0,p=0,b=0;if(u=S,S=S+16|0,l=u+8|0,c=u,f=0|At(0|(A|=0),0|(e|=0),0|(i|=0),0|(a|=0)),g=0|B(),!(!(0|(b=0|n[(p=h=r+(f<<3)|0)>>2]))&!(0|(p=0|n[p+4>>2]))|(d=(0|b)==(0|A)&(0|p)==(0|e))))do{f=0|$e(0|(f=0|We(0|f,0|g,1,0)),0|B(),0|i,0|a),g=0|B(),d=(0|(p=0|n[(b=h=r+(f<<3)|0)>>2]))==(0|A)&(0|(b=0|n[b+4>>2]))==(0|e)}while(!(!(0|p)&!(0|b)|d));if(f=o+(f<<2)|0,d&&(0|n[f>>2])<=(0|s))return S=u,0;if(n[(b=h)>>2]=A,n[b+4>>2]=e,n[f>>2]=s,(0|s)>=(0|t))return S=u,0;switch(d=s+1|0,n[l>>2]=0,0|(f=0|I(A,e,2,l,c))){case 9:m=9;break;case 0:(f=0|L(0|n[(f=c)>>2],0|n[f+4>>2],t,r,o,i,a,d))||(m=9)}A:do{if(9==(0|m)){switch(n[l>>2]=0,0|(f=0|I(A,e,3,l,c))){case 9:break;case 0:if(0|(f=0|L(0|n[(f=c)>>2],0|n[f+4>>2],t,r,o,i,a,d)))break A;break;default:break A}switch(n[l>>2]=0,0|(f=0|I(A,e,1,l,c))){case 9:break;case 0:if(0|(f=0|L(0|n[(f=c)>>2],0|n[f+4>>2],t,r,o,i,a,d)))break A;break;default:break A}switch(n[l>>2]=0,0|(f=0|I(A,e,5,l,c))){case 9:break;case 0:if(0|(f=0|L(0|n[(f=c)>>2],0|n[f+4>>2],t,r,o,i,a,d)))break A;break;default:break A}switch(n[l>>2]=0,0|(f=0|I(A,e,4,l,c))){case 9:break;case 0:if(0|(f=0|L(0|n[(f=c)>>2],0|n[f+4>>2],t,r,o,i,a,d)))break A;break;default:break A}switch(n[l>>2]=0,0|(f=0|I(A,e,6,l,c))){case 9:break;case 0:if(0|(f=0|L(0|n[(f=c)>>2],0|n[f+4>>2],t,r,o,i,a,d)))break A;break;default:break A}return S=u,0}}while(0);return S=u,0|f}function I(A,e,t,r,o){A|=0,e|=0,o|=0;var i,a,s=0,l=0,c=0,u=0,f=0,d=0,g=0;if((t|=0)>>>0>6)return 1;if(f=(0|n[(r|=0)>>2])%6|0,n[r>>2]=f,(0|f)>0){s=0;do{t=0|vA(t),s=s+1|0}while((0|s)<(0|n[r>>2]))}if(f=0|tt(0|A,0|e,45),B(),(a=127&f)>>>0>121)return 5;i=0|OA(A,e),s=0|tt(0|A,0|e,52),B(),s&=15;A:do{if(s){for(;;){if(c=0|tt(0|A,0|e,0|(l=3*(15-s|0)|0)),B(),7==(0|(c&=7))){e=5;break}if(g=!(0|ZA(s)),s=s+-1|0,d=0|rt(7,0,0|l),e&=~B(),A=0|rt(0|n[(g?432:16)+(28*c|0)+(t<<2)>>2],0,0|l)|A&~d,e|=l=0|B(),!(t=0|n[(g?640:224)+(28*c|0)+(t<<2)>>2])){t=0;break A}if(!s){u=8;break A}}return 0|e}u=8}while(0);8==(0|u)&&(A|=0|rt(0|(g=0|n[848+(28*a|0)+(t<<2)>>2]),0,45),e=B()|-1040385&e,t=0|n[4272+(28*a|0)+(t<<2)>>2],127&~g||(g=0|rt(0|n[848+(28*a|0)+20>>2],0,45),e=B()|-1040385&e,t=0|n[4272+(28*a|0)+20>>2],A=0|YA(g|A,e),e=0|B(),n[r>>2]=1+(0|n[r>>2]))),c=0|tt(0|A,0|e,45),B(),c&=127;A:do{if(0|z(c)){e:do{if(1==(0|OA(A,e))){if((0|a)!=(0|c)){if(0|Y(c,0|n[7696+(28*a|0)>>2])){A=0|WA(A,e),l=1,e=0|B();break}M(27795,26864,533,26872)}switch(0|i){case 3:A=0|YA(A,e),e=0|B(),n[r>>2]=1+(0|n[r>>2]),l=0;break e;case 5:A=0|WA(A,e),e=0|B(),n[r>>2]=5+(0|n[r>>2]),l=0;break e;case 0:return 9;default:return 1}}else l=0}while(0);if((0|t)>0){s=0;do{A=0|UA(A,e),e=0|B(),s=s+1|0}while((0|s)!=(0|t))}if((0|a)!=(0|c)){if(!(0|G(c))){if(!!(0|l)|5!=(0|OA(A,e)))break;n[r>>2]=1+(0|n[r>>2]);break}switch(127&f){case 8:case 118:break A}3!=(0|OA(A,e))&&(n[r>>2]=1+(0|n[r>>2]))}}else if((0|t)>0){s=0;do{A=0|YA(A,e),e=0|B(),s=s+1|0}while((0|s)!=(0|t))}}while(0);return n[r>>2]=((0|n[r>>2])+t|0)%6|0,n[(g=o)>>2]=A,n[g+4>>2]=e,0}function R(A,e,t,r){A|=0,e|=0,t|=0,r|=0;var o,i,a=0,s=0,l=0,c=0,u=0,f=0,d=0,g=0,h=0;if(i=S,S=S+16|0,h=i+8|0,n[(g=o=i)>>2]=A,n[g+4>>2]=e,(0|t)<0)return S=i,2;if(!t)return n[(h=r)>>2]=A,n[h+4>>2]=e,S=i,0;n[h>>2]=0;A:do{if(0|HA(A,e))A=9;else{a=0,g=A;do{if(0|(A=0|I(g,e,4,h,o)))break A;if(a=a+1|0,0|HA(g=0|n[(e=o)>>2],e=0|n[e+4>>2])){A=9;break A}}while((0|a)<(0|t));n[(d=r)>>2]=g,n[d+4>>2]=e,d=t+-1|0,f=0,A=1;do{if(a=26800+(f<<2)|0,5==(0|f))for(l=0|n[a>>2],s=0,a=A;;){if(0|(A=0|I(0|n[(A=o)>>2],0|n[A+4>>2],l,h,o)))break A;if((0|s)!=(0|d)){if(c=0|n[(u=o)>>2],u=0|n[u+4>>2],n[(A=r+(a<<3)|0)>>2]=c,n[A+4>>2]=u,0|HA(c,u)){A=9;break A}A=a+1|0}else A=a;if((0|(s=s+1|0))>=(0|t))break;a=A}else for(l=o,u=0|n[a>>2],c=0,a=A,s=0|n[l>>2],l=0|n[l+4>>2];;){if(0|(A=0|I(s,l,u,h,o)))break A;if(s=0|n[(l=o)>>2],l=0|n[l+4>>2],n[(A=r+(a<<3)|0)>>2]=s,n[A+4>>2]=l,A=a+1|0,0|HA(s,l)){A=9;break A}if((0|(c=c+1|0))>=(0|t))break;a=A}f=f+1|0}while(f>>>0<6);A=(0|g)==(0|n[(A=o)>>2])&&(0|e)==(0|n[A+4>>2])?0:9}}while(0);return S=i,0|A}function _(A,e,t,r){t|=0,r|=0;var o,i,a,s=0,l=0;for(a=S,S=S+16|0,o=a,i=a+8|0,s=(s=!(0|HA(A|=0,e|=0)))?1:2;;){if(n[i>>2]=0,!(0|I(A,e,s,i,o))&((0|n[(l=o)>>2])==(0|t)?(0|n[l+4>>2])==(0|r):0)){A=4;break}if((s=s+1|0)>>>0>=7){s=7,A=4;break}}return 4==(0|A)?(S=a,0|s):0}function H(A,e,t,r,i,a,s){e|=0,t|=0,r|=0,i|=0,a|=0,s|=0;var l,c,u,f,d,g,h,m,p,b,v=0,w=0,y=0,x=0,k=0,C=0,M=0,D=0,E=0,Q=0,j=0,N=0,F=0,P=0,T=0,L=0,I=0,R=0,_=0;if(b=S,S=S+64|0,h=b+48|0,m=b+32|0,p=b+24|0,l=b+8|0,c=b,(0|(w=0|n[(A|=0)>>2]))<=0)return S=b,0;for(u=A+4|0,f=h+8|0,d=m+8|0,g=l+8|0,v=0,F=0;;){N=(y=0|n[u>>2])+(F<<4)|0,n[h>>2]=n[N>>2],n[h+4>>2]=n[N+4>>2],n[h+8>>2]=n[N+8>>2],n[h+12>>2]=n[N+12>>2],(0|F)==(w+-1|0)?(n[m>>2]=n[y>>2],n[m+4>>2]=n[y+4>>2],n[m+8>>2]=n[y+8>>2],n[m+12>>2]=n[y+12>>2]):(N=y+(F+1<<4)|0,n[m>>2]=n[N>>2],n[m+4>>2]=n[N+4>>2],n[m+8>>2]=n[N+8>>2],n[m+12>>2]=n[N+12>>2]),w=0|tA(h,m,r,p);A:do{if(w)y=0,v=w;else if(y=0|n[(w=p)>>2],(0|(w=0|n[w+4>>2]))>0|!(0|w)&y>>>0>0){j=0,N=0;e:for(;;){if(I=1/(+(y>>>0)+4294967296*+(0|w)),_=+o[h>>3],R=+((w=0|Ze(0|y,0|w,0|j,0|N))>>>0)+4294967296*+(0|B()),L=+(j>>>0)+4294967296*+(0|N),o[l>>3]=I*(_*R)+I*(+o[m>>3]*L),o[g>>3]=I*(+o[f>>3]*R)+I*(+o[d>>3]*L),0|(w=0|KA(l,r,c))){v=w;break}C=0|At(0|(E=0|n[(Q=c)>>2]),0|(Q=0|n[Q+4>>2]),0|e,0|t),x=0|B(),y=0|n[(k=w=s+(C<<3)|0)>>2],k=0|n[k+4>>2];t:do{if(!(0|y)&!(0|k))P=w,T=16;else for(M=0,D=0;;){if((0|M)>(0|t)|(0|M)==(0|t)&D>>>0>e>>>0){v=1;break e}if((0|y)==(0|E)&(0|k)==(0|Q))break t;if(C=0|$e(0|(w=0|We(0|C,0|x,1,0)),0|B(),0|e,0|t),x=0|B(),D=0|We(0|D,0|M,1,0),M=0|B(),!(0|(y=0|n[(k=w=s+(C<<3)|0)>>2]))&!(0|(k=0|n[k+4>>2]))){P=w,T=16;break}}}while(0);if(16!=(0|T)||(T=0,!(0|E)&!(0|Q))||(n[(D=P)>>2]=E,n[D+4>>2]=Q,D=a+(n[i>>2]<<3)|0,n[D>>2]=E,n[D+4>>2]=Q,D=0|We(0|n[(D=i)>>2],0|n[D+4>>2],1,0),E=0|B(),n[(Q=i)>>2]=D,n[Q+4>>2]=E),j=0|We(0|j,0|N,1,0),N=0|B(),y=0|n[(w=p)>>2],!((0|(w=0|n[w+4>>2]))>(0|N)|(0|w)==(0|N)&y>>>0>j>>>0)){y=1;break A}}y=0}else y=1}while(0);if(F=F+1|0,!y){T=21;break}if((0|F)>=(0|(w=0|n[A>>2]))){v=0,T=21;break}}return 21==(0|T)?(S=b,0|v):0}function z(A){return(A|=0)>>>0>121?0|(A=0):0|(A=0|n[7696+(28*A|0)+16>>2])}function G(A){return 4==(0|(A|=0))|117==(0|A)|0}function O(A){return 0|n[11120+(216*(0|n[(A|=0)>>2])|0)+(72*(0|n[A+4>>2])|0)+(24*(0|n[A+8>>2])|0)+(n[A+12>>2]<<3)>>2]}function U(A){return 0|n[11120+(216*(0|n[(A|=0)>>2])|0)+(72*(0|n[A+4>>2])|0)+(24*(0|n[A+8>>2])|0)+(n[A+12>>2]<<3)+4>>2]}function Y(A,e){return e|=0,(0|n[7696+(28*(A|=0)|0)+20>>2])==(0|e)?0|(e=1):0|(e=(0|n[7696+(28*A|0)+24>>2])==(0|e))}function V(A,e){return 0|n[848+(28*(A|=0)|0)+((e|=0)<<2)>>2]}function W(A,e){return e|=0,(0|n[848+(28*(A|=0)|0)>>2])==(0|e)?0|(e=0):(0|n[848+(28*A|0)+4>>2])==(0|e)?0|(e=1):(0|n[848+(28*A|0)+8>>2])==(0|e)?0|(e=2):(0|n[848+(28*A|0)+12>>2])==(0|e)?0|(e=3):(0|n[848+(28*A|0)+16>>2])==(0|e)?0|(e=4):(0|n[848+(28*A|0)+20>>2])==(0|e)?0|(e=5):0|((0|n[848+(28*A|0)+24>>2])==(0|e)?6:7)}function Z(A){var e,t,r;return e=(r=+o[16+(A|=0)>>3])-(t=+o[A+24>>3]),+(r>3]<+o[A+24>>3]|0}function J(A){return+(+o[(A|=0)>>3]-+o[A+8>>3])}function X(A,e){A|=0;var t,r,n=0;return(n=+o[(e|=0)>>3])>=+o[A+8>>3]&&n<=+o[A>>3]?(t=+o[A+16>>3],n=+o[A+24>>3],e=(r=+o[e+8>>3])>=n,A=r<=t&1,t>3]<+o[e+8>>3]||+o[A+8>>3]>+o[e>>3]?0|(s=0):(n=(l=+o[A+16>>3])<(u=+o[(t=A+24|0)>>3]),c=(a=+o[(s=e+16|0)>>3])<(i=+o[(r=e+24|0)>>3]),e=u-a>3],e)||(u=+ie(+o[t>>3],A))>+ie(+o[s>>3],e)?0|(c=0):0|(c=1))}function $(A,e){e|=0;var t,r,n,i,a,s=0,l=0,c=0,u=0;return+o[(A|=0)>>3]<+o[e>>3]||+o[A+8>>3]>+o[e+8>>3]?0|(s=0):(n=(i=+o[(s=A+16|0)>>3])<(l=+o[A+24>>3]),c=(u=+o[(t=e+16|0)>>3])<(a=+o[(r=e+24|0)>>3]),e=l-u>3],e)?0|(c=(u=+ie(+o[s>>3],A))>=+ie(+o[t>>3],e)):0|(c=0))}function AA(A,e){A|=0,e|=0;var t,r,i,a,s,l=0;i=S,S=S+176|0,n[(r=i)>>2]=4,l=+o[e>>3],o[r+8>>3]=l,a=+o[e+16>>3],o[r+16>>3]=a,o[r+24>>3]=l,l=+o[e+24>>3],o[r+32>>3]=l,s=+o[e+8>>3],o[r+40>>3]=s,o[r+48>>3]=l,o[r+56>>3]=s,o[r+64>>3]=a,t=96+(e=r+72|0)|0;do{n[e>>2]=0,e=e+4|0}while((0|e)<(0|t));st(0|A,0|r,168),S=i}function eA(A,e,t){A|=0,e|=0,t|=0;var r,a,c,u,f,d,g,h=0,m=0,p=0,b=0,w=0,x=0,k=0;d=S,S=S+288|0,f=d+264|0,b=d+96|0,m=(h=p=d)+96|0;do{n[h>>2]=0,h=h+4|0}while((0|h)<(0|m));return 0|(e=0|Ae(e,p))?(S=d,0|(x=e)):(qA(p=0|n[(m=p)>>2],m=0|n[m+4>>2],f),$A(p,m,b),u=+ae(f,b+8|0),o[f>>3]=+o[A>>3],o[(m=f+8|0)>>3]=+o[A+16>>3],o[b>>3]=+o[A+8>>3],o[(p=b+8|0)>>3]=+o[A+24>>3],a=+ae(f,b),k=+o[m>>3]-+o[p>>3],c=+l(+k),g=+o[f>>3]-+o[b>>3],r=+l(+g),!(0==k|0==g)&&(k=+ot(+c,+r),k=+v(+a*a/+it(+k/+it(+c,+r),3)/(u*(2.59807621135*u)*.8)),o[i>>3]=k,w=~~k>>>0,x=+l(k)>=1?k>0?~~+y(+s(k/4294967296),4294967295)>>>0:~~+v((k-+(~~k>>>0))/4294967296)>>>0:0,2146435072&~n[i+4>>2])?(b=!(0|w)&!(0|x),n[(e=t)>>2]=b?1:w,n[e+4>>2]=b?0:x,e=0):e=1,S=d,0|(x=e))}function tA(A,e,t,r){A|=0,e|=0,t|=0,r|=0;var a,c,u,f,d=0,g=0,h=0;f=S,S=S+288|0,c=f+264|0,u=f+96|0,a=(d=g=f)+96|0;do{n[d>>2]=0,d=d+4|0}while((0|d)<(0|a));return 0|(t=0|Ae(t,g))?(S=f,0|(r=t)):(qA(d=0|n[(t=g)>>2],t=0|n[t+4>>2],c),$A(d,t,u),h=+ae(c,u+8|0),h=+v(+ +ae(A,e)/(2*h)),o[i>>3]=h,t=~~h>>>0,d=+l(h)>=1?h>0?~~+y(+s(h/4294967296),4294967295)>>>0:~~+v((h-+(~~h>>>0))/4294967296)>>>0:0,2146435072&~n[i+4>>2]?(g=!(0|t)&!(0|d),n[r>>2]=g?1:t,n[r+4>>2]=g?0:d,S=f,0|(r=0)):(S=f,0|(r=1)))}function rA(A,e,t,r){e|=0,t|=0,r|=0,n[(A|=0)>>2]=e,n[A+4>>2]=t,n[A+8>>2]=r}function nA(A){var e,t=0,r=0,o=0,i=0,a=0;t=0|n[(A|=0)>>2],r=0|n[(e=A+4|0)>>2],(0|t)<0&&(r=r-t|0,n[e>>2]=r,n[(a=A+8|0)>>2]=(0|n[a>>2])-t,n[A>>2]=0,t=0),(0|r)<0?(t=t-r|0,n[A>>2]=t,i=(0|n[(a=A+8|0)>>2])-r|0,n[a>>2]=i,n[e>>2]=0,r=0):(a=i=A+8|0,i=0|n[i>>2]),(0|i)<0&&(t=t-i|0,n[A>>2]=t,r=r-i|0,n[e>>2]=r,n[a>>2]=0,i=0),(0|(o=(0|i)<(0|(o=(0|r)<(0|t)?r:t))?i:o))<=0||(n[A>>2]=t-o,n[e>>2]=r-o,n[a>>2]=i-o)}function oA(A,e){var t,r;e|=0,r=0|n[8+(A|=0)>>2],t=+((0|n[A+4>>2])-r|0),o[e>>3]=+((0|n[A>>2])-r|0)-.5*t,o[e+8>>3]=.8660254037844386*t}function iA(A,e,t){A|=0,e|=0,n[(t|=0)>>2]=(0|n[e>>2])+(0|n[A>>2]),n[t+4>>2]=(0|n[e+4>>2])+(0|n[A+4>>2]),n[t+8>>2]=(0|n[e+8>>2])+(0|n[A+8>>2])}function aA(A,e,t){A|=0,e|=0,n[(t|=0)>>2]=(0|n[A>>2])-(0|n[e>>2]),n[t+4>>2]=(0|n[A+4>>2])-(0|n[e+4>>2]),n[t+8>>2]=(0|n[A+8>>2])-(0|n[e+8>>2])}function sA(A,e){e|=0;var t,r=0;r=0|w(0|n[(A|=0)>>2],e),n[A>>2]=r,t=0|w(0|n[(r=A+4|0)>>2],e),n[r>>2]=t,e=0|w(0|n[(A=A+8|0)>>2],e),n[A>>2]=e}function lA(A){var e,t,r=0,o=0,i=0,a=0,s=0;s=(0|(t=0|n[(A|=0)>>2]))<0,A=(A=(o=(0|(a=((e=(0|(i=(0|n[A+4>>2])-(s?t:0)|0))<0)?0-i|0:0)+((0|n[A+8>>2])-(s?t:0))|0))<0)?0:a)-((i=(0|(o=(0|A)<(0|(o=(0|(r=(e?0:i)-(o?a:0)|0))<(0|(a=(s?0:t)-(e?i:0)-(o?a:0)|0))?r:a))?A:o))>0)?o:0)|0,r=r-(i?o:0)|0;A:do{switch(a-(i?o:0)|0){case 0:switch(0|r){case 0:return 0|(0|A?1==(0|A)?1:7:0);case 1:return 0|(0|A?1==(0|A)?3:7:2);default:break A}case 1:switch(0|r){case 0:return 0|(0|A?1==(0|A)?5:7:4);case 1:if(A)break A;return 6;default:break A}}}while(0);return 7}function cA(A){var e,t,r=0,o=0,i=0,a=0,s=0,l=0,c=0;if(l=0|n[(t=8+(A|=0)|0)>>2],(e=(0|n[A>>2])-l|0)>>>0>715827881|(l=(0|n[(c=A+4|0)>>2])-l|0)>>>0>715827881){if(a=2147483647-e|0,s=-2147483648-e|0,(i=(0|e)>0)?(0|a)<(0|e):(0|s)>(0|e))return 1;if(o=e<<1,i?(2147483647-o|0)<(0|e):(-2147483648-o|0)>(0|e))return 1;if((0|l)>0?(2147483647-l|0)<(0|l):(-2147483648-l|0)>(0|l))return 1;if(r=3*e|0,o=l<<1,(i?(0|a)<(0|o):(0|s)>(0|o))||((0|e)>-1?(-2147483648|r)>=(0|l):(-2147483648^r)<(0|l)))return 1}else o=l<<1,r=3*e|0;return i=0|Oe(.14285714285714285*+(r-l|0)),n[A>>2]=i,a=0|Oe(.14285714285714285*+(o+e|0)),n[c>>2]=a,n[t>>2]=0,r=(o=(0|a)<(0|i))?i:a,(0|(o=o?a:i))<0&&((-2147483648==(0|o)||((0|r)>0?(2147483647-r|0)<(0|o):(-2147483648-r|0)>(0|o)))&&M(27795,26892,354,26903),((0|r)>-1?(-2147483648|r)>=(0|o):(-2147483648^r)<(0|o))&&M(27795,26892,354,26903)),r=a-i|0,(0|i)<0?(o=0-i|0,n[c>>2]=r,n[t>>2]=o,n[A>>2]=0,i=0):(r=a,o=0),(0|r)<0&&(i=i-r|0,n[A>>2]=i,o=o-r|0,n[t>>2]=o,n[c>>2]=0,r=0),s=i-o|0,a=r-o|0,(0|o)<0?(n[A>>2]=s,n[c>>2]=a,n[t>>2]=0,r=a,a=s,o=0):a=i,(0|(i=(0|o)<(0|(i=(0|r)<(0|a)?r:a))?o:i))<=0||(n[A>>2]=a-i,n[c>>2]=r-i,n[t>>2]=o-i),0}function uA(A){var e,t=0,r=0,o=0,i=0,a=0,s=0,l=0;if(i=0|n[(e=8+(A|=0)|0)>>2],(a=(0|n[A>>2])-i|0)>>>0>715827881|(i=(0|n[(s=A+4|0)>>2])-i|0)>>>0>715827881){if((r=(0|a)>0)?(2147483647-a|0)<(0|a):(-2147483648-a|0)>(0|a))return 1;if(t=a<<1,(o=(0|i)>0)?(2147483647-i|0)<(0|i):(-2147483648-i|0)>(0|i))return 1;if(l=i<<1,o?(2147483647-l|0)<(0|i):(-2147483648-l|0)>(0|i))return 1;if(r?(2147483647-t|0)<(0|i):(-2147483648-t|0)>(0|i))return 1;if(r=3*i|0,(0|i)>-1?(-2147483648|r)>=(0|a):(-2147483648^r)<(0|a))return 1}else r=3*i|0,t=a<<1;return o=0|Oe(.14285714285714285*+(t+i|0)),n[A>>2]=o,i=0|Oe(.14285714285714285*+(r-a|0)),n[s>>2]=i,n[e>>2]=0,t=(r=(0|i)<(0|o))?o:i,(0|(r=r?i:o))<0&&((-2147483648==(0|r)||((0|t)>0?(2147483647-t|0)<(0|r):(-2147483648-t|0)>(0|r)))&&M(27795,26892,402,26917),((0|t)>-1?(-2147483648|t)>=(0|r):(-2147483648^t)<(0|r))&&M(27795,26892,402,26917)),t=i-o|0,(0|o)<0?(r=0-o|0,n[s>>2]=t,n[e>>2]=r,n[A>>2]=0,o=0):(t=i,r=0),(0|t)<0&&(o=o-t|0,n[A>>2]=o,r=r-t|0,n[e>>2]=r,n[s>>2]=0,t=0),a=o-r|0,i=t-r|0,(0|r)<0?(n[A>>2]=a,n[s>>2]=i,n[e>>2]=0,t=i,i=a,r=0):i=o,(0|(o=(0|r)<(0|(o=(0|t)<(0|i)?t:i))?r:o))<=0||(n[A>>2]=i-o,n[s>>2]=t-o,n[e>>2]=r-o),0}function fA(A){var e,t,r=0,o=0,i=0,a=0,s=0;o=0|n[(e=8+(A|=0)|0)>>2],i=0|Oe(.14285714285714285*+((3*(r=(0|n[A>>2])-o|0)|0)-(o=(0|n[(t=A+4|0)>>2])-o|0)|0)),n[A>>2]=i,r=0|Oe(.14285714285714285*+((o<<1)+r|0)),n[t>>2]=r,n[e>>2]=0,o=r-i|0,(0|i)<0?(s=0-i|0,n[t>>2]=o,n[e>>2]=s,n[A>>2]=0,r=o,i=0,o=s):o=0,(0|r)<0&&(i=i-r|0,n[A>>2]=i,o=o-r|0,n[e>>2]=o,n[t>>2]=0,r=0),s=i-o|0,a=r-o|0,(0|o)<0?(n[A>>2]=s,n[t>>2]=a,n[e>>2]=0,r=a,a=s,o=0):a=i,(0|(i=(0|o)<(0|(i=(0|r)<(0|a)?r:a))?o:i))<=0||(n[A>>2]=a-i,n[t>>2]=r-i,n[e>>2]=o-i)}function dA(A){var e,t,r=0,o=0,i=0,a=0,s=0;o=0|n[(e=8+(A|=0)|0)>>2],i=0|Oe(.14285714285714285*+(((r=(0|n[A>>2])-o|0)<<1)+(o=(0|n[(t=A+4|0)>>2])-o|0)|0)),n[A>>2]=i,r=0|Oe(.14285714285714285*+((3*o|0)-r|0)),n[t>>2]=r,n[e>>2]=0,o=r-i|0,(0|i)<0?(s=0-i|0,n[t>>2]=o,n[e>>2]=s,n[A>>2]=0,r=o,i=0,o=s):o=0,(0|r)<0&&(i=i-r|0,n[A>>2]=i,o=o-r|0,n[e>>2]=o,n[t>>2]=0,r=0),s=i-o|0,a=r-o|0,(0|o)<0?(n[A>>2]=s,n[t>>2]=a,n[e>>2]=0,r=a,a=s,o=0):a=i,(0|(i=(0|o)<(0|(i=(0|r)<(0|a)?r:a))?o:i))<=0||(n[A>>2]=a-i,n[t>>2]=r-i,n[e>>2]=o-i)}function gA(A){var e,t,r,o=0,i=0,a=0,s=0;o=0|n[(A|=0)>>2],i=0|n[(t=A+4|0)>>2],a=0|n[(r=A+8|0)>>2],s=i+(3*o|0)|0,n[A>>2]=s,i=a+(3*i|0)|0,n[t>>2]=i,o=(3*a|0)+o|0,n[r>>2]=o,a=i-s|0,(0|s)<0?(o=o-s|0,n[t>>2]=a,n[r>>2]=o,n[A>>2]=0,i=a,a=0):a=s,(0|i)<0&&(a=a-i|0,n[A>>2]=a,o=o-i|0,n[r>>2]=o,n[t>>2]=0,i=0),e=a-o|0,s=i-o|0,(0|o)<0?(n[A>>2]=e,n[t>>2]=s,n[r>>2]=0,a=e,o=0):s=i,(0|(i=(0|o)<(0|(i=(0|s)<(0|a)?s:a))?o:i))<=0||(n[A>>2]=a-i,n[t>>2]=s-i,n[r>>2]=o-i)}function hA(A){var e,t,r,o=0,i=0,a=0,s=0;s=0|n[(A|=0)>>2],a=(3*(o=0|n[(t=A+4|0)>>2])|0)+s|0,s=(i=0|n[(r=A+8|0)>>2])+(3*s|0)|0,n[A>>2]=s,n[t>>2]=a,o=(3*i|0)+o|0,n[r>>2]=o,i=a-s|0,(0|s)<0?(o=o-s|0,n[t>>2]=i,n[r>>2]=o,n[A>>2]=0,s=0):i=a,(0|i)<0&&(s=s-i|0,n[A>>2]=s,o=o-i|0,n[r>>2]=o,n[t>>2]=0,i=0),e=s-o|0,a=i-o|0,(0|o)<0?(n[A>>2]=e,n[t>>2]=a,n[r>>2]=0,s=e,o=0):a=i,(0|(i=(0|o)<(0|(i=(0|a)<(0|s)?a:s))?o:i))<=0||(n[A>>2]=s-i,n[t>>2]=a-i,n[r>>2]=o-i)}function mA(A,e){A|=0;var t,r,o,i=0,a=0,s=0;((e|=0)-1|0)>>>0>=6||(s=(0|n[15440+(12*e|0)>>2])+(0|n[A>>2])|0,n[A>>2]=s,o=A+4|0,a=(0|n[15440+(12*e|0)+4>>2])+(0|n[o>>2])|0,n[o>>2]=a,r=A+8|0,e=(0|n[15440+(12*e|0)+8>>2])+(0|n[r>>2])|0,n[r>>2]=e,i=a-s|0,(0|s)<0?(e=e-s|0,n[o>>2]=i,n[r>>2]=e,n[A>>2]=0,a=0):(i=a,a=s),(0|i)<0&&(a=a-i|0,n[A>>2]=a,e=e-i|0,n[r>>2]=e,n[o>>2]=0,i=0),t=a-e|0,s=i-e|0,(0|e)<0?(n[A>>2]=t,n[o>>2]=s,n[r>>2]=0,a=t,e=0):s=i,(0|(i=(0|e)<(0|(i=(0|s)<(0|a)?s:a))?e:i))<=0||(n[A>>2]=a-i,n[o>>2]=s-i,n[r>>2]=e-i))}function pA(A){var e,t,r,o=0,i=0,a=0,s=0;s=0|n[(A|=0)>>2],a=(o=0|n[(t=A+4|0)>>2])+s|0,s=(i=0|n[(r=A+8|0)>>2])+s|0,n[A>>2]=s,n[t>>2]=a,o=i+o|0,n[r>>2]=o,i=a-s|0,(0|s)<0?(o=o-s|0,n[t>>2]=i,n[r>>2]=o,n[A>>2]=0,a=0):(i=a,a=s),(0|i)<0&&(a=a-i|0,n[A>>2]=a,o=o-i|0,n[r>>2]=o,n[t>>2]=0,i=0),e=a-o|0,s=i-o|0,(0|o)<0?(n[A>>2]=e,n[t>>2]=s,n[r>>2]=0,a=e,o=0):s=i,(0|(i=(0|o)<(0|(i=(0|s)<(0|a)?s:a))?o:i))<=0||(n[A>>2]=a-i,n[t>>2]=s-i,n[r>>2]=o-i)}function bA(A){var e,t,r,o=0,i=0,a=0,s=0;o=0|n[(A|=0)>>2],a=0|n[(t=A+4|0)>>2],i=0|n[(r=A+8|0)>>2],s=a+o|0,n[A>>2]=s,a=i+a|0,n[t>>2]=a,o=i+o|0,n[r>>2]=o,i=a-s|0,(0|s)<0?(o=o-s|0,n[t>>2]=i,n[r>>2]=o,n[A>>2]=0,a=0):(i=a,a=s),(0|i)<0&&(a=a-i|0,n[A>>2]=a,o=o-i|0,n[r>>2]=o,n[t>>2]=0,i=0),e=a-o|0,s=i-o|0,(0|o)<0?(n[A>>2]=e,n[t>>2]=s,n[r>>2]=0,a=e,o=0):s=i,(0|(i=(0|o)<(0|(i=(0|s)<(0|a)?s:a))?o:i))<=0||(n[A>>2]=a-i,n[t>>2]=s-i,n[r>>2]=o-i)}function vA(A){switch(0|(A|=0)){case 1:A=5;break;case 5:A=4;break;case 4:A=6;break;case 6:A=2;break;case 2:A=3;break;case 3:A=1}return 0|A}function wA(A){switch(0|(A|=0)){case 1:A=3;break;case 3:A=2;break;case 2:A=6;break;case 6:A=4;break;case 4:A=5;break;case 5:A=1}return 0|A}function yA(A){var e,t,r,o=0,i=0,a=0,s=0;o=0|n[(A|=0)>>2],i=0|n[(t=A+4|0)>>2],a=0|n[(r=A+8|0)>>2],s=i+(o<<1)|0,n[A>>2]=s,i=a+(i<<1)|0,n[t>>2]=i,o=(a<<1)+o|0,n[r>>2]=o,a=i-s|0,(0|s)<0?(o=o-s|0,n[t>>2]=a,n[r>>2]=o,n[A>>2]=0,i=a,a=0):a=s,(0|i)<0&&(a=a-i|0,n[A>>2]=a,o=o-i|0,n[r>>2]=o,n[t>>2]=0,i=0),e=a-o|0,s=i-o|0,(0|o)<0?(n[A>>2]=e,n[t>>2]=s,n[r>>2]=0,a=e,o=0):s=i,(0|(i=(0|o)<(0|(i=(0|s)<(0|a)?s:a))?o:i))<=0||(n[A>>2]=a-i,n[t>>2]=s-i,n[r>>2]=o-i)}function xA(A){var e,t,r,o=0,i=0,a=0,s=0;s=0|n[(A|=0)>>2],a=((o=0|n[(t=A+4|0)>>2])<<1)+s|0,s=(i=0|n[(r=A+8|0)>>2])+(s<<1)|0,n[A>>2]=s,n[t>>2]=a,o=(i<<1)+o|0,n[r>>2]=o,i=a-s|0,(0|s)<0?(o=o-s|0,n[t>>2]=i,n[r>>2]=o,n[A>>2]=0,s=0):i=a,(0|i)<0&&(s=s-i|0,n[A>>2]=s,o=o-i|0,n[r>>2]=o,n[t>>2]=0,i=0),e=s-o|0,a=i-o|0,(0|o)<0?(n[A>>2]=e,n[t>>2]=a,n[r>>2]=0,s=e,o=0):a=i,(0|(i=(0|o)<(0|(i=(0|a)<(0|s)?a:s))?o:i))<=0||(n[A>>2]=s-i,n[t>>2]=a-i,n[r>>2]=o-i)}function kA(A,e){e|=0;var t,r,o,i=0,a=0,s=0;return o=(0|(r=(0|n[(A|=0)>>2])-(0|n[e>>2])|0))<0,t=(0|(a=(0|n[A+4>>2])-(0|n[e+4>>2])-(o?r:0)|0))<0,e=(e=(A=(0|(s=(o?0-r|0:0)+(0|n[A+8>>2])-(0|n[e+8>>2])+(t?0-a|0:0)|0))<0)?0:s)-((a=(0|(A=(0|e)<(0|(A=(0|(i=(t?0:a)-(A?s:0)|0))<(0|(s=(o?0:r)-(t?a:0)-(A?s:0)|0))?i:s))?e:A))>0)?A:0)|0,i=i-(a?A:0)|0,0|((0|(A=(0|(A=s-(a?A:0)|0))>-1?A:0-A|0))>(0|(e=(0|(i=(0|i)>-1?i:0-i|0))>(0|(e=(0|e)>-1?e:0-e|0))?i:e))?A:e)}function CA(A){var e,t,r,o;t=(o=0|n[(e=8+(A|=0)|0)>>2])-(0|n[A>>2])|0,n[A>>2]=t,A=(0|n[(r=A+4|0)>>2])-o|0,n[r>>2]=A,n[e>>2]=0-(A+t)}function BA(A){var e,t,r=0,o=0,i=0,a=0,s=0;r=0-(o=0|n[(A|=0)>>2])|0,n[A>>2]=r,n[(e=A+8|0)>>2]=0,a=(i=0|n[(t=A+4|0)>>2])+o|0,(0|o)>0?(n[t>>2]=a,n[e>>2]=o,n[A>>2]=0,r=0,i=a):o=0,(0|i)<0?(s=r-i|0,n[A>>2]=s,o=o-i|0,n[e>>2]=o,n[t>>2]=0,a=s-o|0,r=0-o|0,(0|o)<0?(n[A>>2]=a,n[t>>2]=r,n[e>>2]=0,i=r,o=0):(i=0,a=s)):a=r,(0|(r=(0|o)<(0|(r=(0|i)<(0|a)?i:a))?o:r))<=0||(n[A>>2]=a-r,n[t>>2]=i-r,n[e>>2]=o-r)}function MA(A,e){var t=0;switch(t=0|tt(0|(A|=0),0|(e|=0),56),B(),7&t){case 0:case 7:return 0}return t=-2130706433&e|134217728,!0&268435456==(2013265920&e)?!0&16777216==(117440512&e)&!!(0|HA(A,t))?0|(t=0):0|(t=0|LA(A,t)):0|(t=0)}function DA(A,e,t){t|=0;var r,o,i=0,a=0;return o=S,S=S+16|0,r=o,a=-2130706433&(e|=0)|134217728,!0&268435456==(2013265920&e)?(i=0|tt(0|(A|=0),0|e,56),B(),i=0|function(A,e,t){t|=0;var r,o=0,i=0;if(r=S,S=S+16|0,i=r,o=0|HA(A|=0,e|=0),(t+-1|0)>>>0>5)return S=r,-1;if(1==(0|t)&(o=!!(0|o)))return S=r,-1;do{if(!(0|Fe(A,e,i))){if(o){o=(5+(0|n[26352+(t<<2)>>2])-(0|n[i>>2])|0)%5|0;break}o=(6+(0|n[26384+(t<<2)>>2])-(0|n[i>>2])|0)%6|0;break}o=-1}while(0);return S=r,0|(i=o)}(A,a,7&i),-1==(0|i)?(n[t>>2]=0,S=o,0|(a=6)):(0|XA(A,a,r)&&M(27795,26932,282,26947),e=0|tt(0|A,0|e,52),B(),e&=15,0|HA(A,a)?QA(r,e,i,2,t):FA(r,e,i,2,t),S=o,0|(a=0))):(S=o,0|(a=6))}function EA(A,e,t,r,i){e|=0,t|=0,r|=0,i|=0;var a,s=0,u=0;if(s=+function(A){var e,t;return t=+o[(A|=0)>>3],e=+o[A+8>>3],+ +c(+(t*t+e*e))}(A|=0),s<1e-16)return e=15600+(e<<4)|0,n[i>>2]=n[e>>2],n[i+4>>2]=n[e+4>>2],n[i+8>>2]=n[e+8>>2],void(n[i+12>>2]=n[e+12>>2]);if(u=+b(+ +o[A+8>>3],+ +o[A>>3]),(0|t)>0){A=0;do{s*=.37796447300922725,A=A+1|0}while((0|A)!=(0|t))}a=.3333333333333333*s,r?(t=!(0|ZA(t)),s=+p(.381966011250105*(t?a:.37796447300922725*a))):(s=+p(.381966011250105*s),0|ZA(t)&&(u=+ne(u+.3334731722518321))),function(A,e,t,r){A|=0,e=+e,r|=0;var i=0,a=0,s=0,c=0;if((t=+t)<1e-16)return n[r>>2]=n[A>>2],n[r+4>>2]=n[A+4>>2],n[r+8>>2]=n[A+8>>2],void(n[r+12>>2]=n[A+12>>2]);a=e<0?e+6.283185307179586:e,a=e>=6.283185307179586?a+-6.283185307179586:a;do{if(!(a<1e-16)){if(i=+l(+(a+-3.141592653589793))<1e-16,e=+o[A>>3],i){e-=t,o[r>>3]=e,i=r;break}if(s=+f(+t),t=+d(+t),e=s*+d(+e)+ +f(+a)*(t*+f(+e)),e=+m(+((e=e>1?1:e)<-1?-1:e)),o[r>>3]=e,+l(+(e+-1.5707963267948966))<1e-16)return o[r>>3]=1.5707963267948966,void(o[r+8>>3]=0);if(+l(+(e+1.5707963267948966))<1e-16)return o[r>>3]=-1.5707963267948966,void(o[r+8>>3]=0);if(c=1/+f(+e),a=t*+d(+a)*c,t=+o[A>>3],e=c*((s-+d(+e)*+d(+t))/+f(+t)),s=a>1?1:a,e=e>1?1:e,(e=+o[A+8>>3]+ +b(+(s<-1?-1:s),+(e<-1?-1:e)))>3.141592653589793)do{e+=-6.283185307179586}while(e>3.141592653589793);if(e<-3.141592653589793)do{e+=6.283185307179586}while(e<-3.141592653589793);return void(o[r+8>>3]=e)}e=+o[A>>3]+t,o[r>>3]=e,i=r}while(0);if(+l(+(e+-1.5707963267948966))<1e-16)return o[i>>3]=1.5707963267948966,void(o[r+8>>3]=0);if(+l(+(e+1.5707963267948966))<1e-16)return o[i>>3]=-1.5707963267948966,void(o[r+8>>3]=0);if((e=+o[A+8>>3])>3.141592653589793)do{e+=-6.283185307179586}while(e>3.141592653589793);if(e<-3.141592653589793)do{e+=6.283185307179586}while(e<-3.141592653589793);o[r+8>>3]=e}(15600+(e<<4)|0,+ne(+o[15920+(24*e|0)>>3]-u),s,i)}function QA(A,e,t,r,i){A|=0,e|=0,t|=0,r|=0,i|=0;var a,s,l,c,u,f,d,g,h,m,p,b,v,w,y,x,k,C,B,D,E,Q,j=0,N=0,F=0,P=0,T=0,L=0;if(Q=S,S=S+272|0,P=Q+240|0,B=Q,D=Q+224|0,E=Q+208|0,p=Q+176|0,b=Q+160|0,v=Q+192|0,w=Q+144|0,y=Q+128|0,x=Q+112|0,k=Q+96|0,C=Q+80|0,n[(j=Q+256|0)>>2]=e,n[P>>2]=n[A>>2],n[P+4>>2]=n[A+4>>2],n[P+8>>2]=n[A+8>>2],n[P+12>>2]=n[A+12>>2],jA(P,j,B),n[i>>2]=0,(0|(P=r+t+(5==(0|r)&1)|0))<=(0|t))S=Q;else{s=D+4|0,l=p+4|0,c=t+5|0,u=16880+((a=0|n[j>>2])<<2)|0,f=16960+(a<<2)|0,d=y+8|0,g=x+8|0,h=k+8|0,m=E+4|0,F=t;A:for(;;){N=B+((0|F)%5<<4)|0,n[E>>2]=n[N>>2],n[E+4>>2]=n[N+4>>2],n[E+8>>2]=n[N+8>>2],n[E+12>>2]=n[N+12>>2];do{}while(2==(0|NA(E,a,0,1)));if((0|F)>(0|t)&!!(0|ZA(e))){if(n[p>>2]=n[E>>2],n[p+4>>2]=n[E+4>>2],n[p+8>>2]=n[E+8>>2],n[p+12>>2]=n[E+12>>2],oA(s,b),r=0|n[p>>2],j=0|n[17040+(80*r|0)+(n[D>>2]<<2)>>2],n[p>>2]=n[18640+(80*r|0)+(20*j|0)>>2],(0|(N=0|n[18640+(80*r|0)+(20*j|0)+16>>2]))>0){A=0;do{pA(l),A=A+1|0}while((0|A)<(0|N))}switch(N=18640+(80*r|0)+(20*j|0)+4|0,n[v>>2]=n[N>>2],n[v+4>>2]=n[N+4>>2],n[v+8>>2]=n[N+8>>2],sA(v,3*(0|n[u>>2])|0),iA(l,v,l),nA(l),oA(l,w),T=+(0|n[f>>2]),o[y>>3]=3*T,o[d>>3]=0,L=-1.5*T,o[x>>3]=L,o[g>>3]=2.598076211353316*T,o[k>>3]=L,o[h>>3]=-2.598076211353316*T,0|n[17040+(80*(0|n[p>>2])|0)+(n[E>>2]<<2)>>2]){case 1:A=x,r=y;break;case 3:A=k,r=x;break;case 2:A=y,r=k;break;default:A=12;break A}je(b,w,r,A,C),EA(C,0|n[p>>2],a,1,i+8+(n[i>>2]<<4)|0),n[i>>2]=1+(0|n[i>>2])}if((0|F)<(0|c)&&(oA(m,p),EA(p,0|n[E>>2],a,1,i+8+(n[i>>2]<<4)|0),n[i>>2]=1+(0|n[i>>2])),n[D>>2]=n[E>>2],n[D+4>>2]=n[E+4>>2],n[D+8>>2]=n[E+8>>2],n[D+12>>2]=n[E+12>>2],(0|(F=F+1|0))>=(0|P)){A=3;break}}3!=(0|A)?12==(0|A)&&M(26970,27017,572,27027):S=Q}}function jA(A,e,t){A|=0,e|=0,t|=0;var r,o=0,i=0,a=0,s=0,l=0;r=S,S=S+128|0,i=r,s=20240,l=60+(a=o=r+64|0)|0;do{n[a>>2]=n[s>>2],a=a+4|0,s=s+4|0}while((0|a)<(0|l));s=20304,l=(a=i)+60|0;do{n[a>>2]=n[s>>2],a=a+4|0,s=s+4|0}while((0|a)<(0|l));o=(l=!(0|ZA(0|n[e>>2])))?o:i,yA(i=A+4|0),xA(i),0|ZA(0|n[e>>2])&&(hA(i),n[e>>2]=1+(0|n[e>>2])),n[t>>2]=n[A>>2],iA(i,o,e=t+4|0),nA(e),n[t+16>>2]=n[A>>2],iA(i,o+12|0,e=t+20|0),nA(e),n[t+32>>2]=n[A>>2],iA(i,o+24|0,e=t+36|0),nA(e),n[t+48>>2]=n[A>>2],iA(i,o+36|0,e=t+52|0),nA(e),n[t+64>>2]=n[A>>2],iA(i,o+48|0,t=t+68|0),nA(t),S=r}function NA(A,e,t,r){t|=0,r|=0;var o,i,a,s,l,c,u=0,f=0,d=0,g=0,h=0;if(c=S,S=S+32|0,l=c+12|0,i=c,h=4+(A|=0)|0,g=0|n[16960+((e|=0)<<2)>>2],g=(s=!!(0|r))?3*g|0:g,u=0|n[h>>2],o=0|n[(a=A+8|0)>>2],s){if((0|(u=o+u+(r=0|n[(f=A+12|0)>>2])|0))==(0|g))return S=c,1;d=f}else u=o+u+(r=0|n[(d=A+12|0)>>2])|0;if((0|u)<=(0|g))return S=c,0;do{if((0|r)>0){if(r=0|n[A>>2],(0|o)>0){f=18640+(80*r|0)+60|0,r=A;break}r=18640+(80*r|0)+40|0,t?(rA(l,g,0,0),aA(h,l,i),bA(i),iA(i,l,h),f=r,r=A):(f=r,r=A)}else f=18640+(80*(0|n[A>>2])|0)+20|0,r=A}while(0);if(n[r>>2]=n[f>>2],(0|n[(u=f+16|0)>>2])>0){r=0;do{pA(h),r=r+1|0}while((0|r)<(0|n[u>>2]))}return A=f+4|0,n[l>>2]=n[A>>2],n[l+4>>2]=n[A+4>>2],n[l+8>>2]=n[A+8>>2],e=0|n[16880+(e<<2)>>2],sA(l,s?3*e|0:e),iA(h,l,h),nA(h),r=s&&((0|n[a>>2])+(0|n[h>>2])+(0|n[d>>2])|0)==(0|g)?1:2,S=c,0|r}function SA(A,e){A|=0,e|=0;var t=0;do{t=0|NA(A,e,0,1)}while(2==(0|t));return 0|t}function FA(A,e,t,r,i){A|=0,e|=0,t|=0,r|=0,i|=0;var a,s,l,c,u,f,d,g,h,m,p,b,v,w,y,x,k,C,B=0,D=0,E=0,Q=0,j=0;if(C=S,S=S+240|0,w=C+208|0,y=C,x=C+192|0,k=C+176|0,h=C+160|0,m=C+144|0,p=C+128|0,b=C+112|0,v=C+96|0,n[(B=C+224|0)>>2]=e,n[w>>2]=n[A>>2],n[w+4>>2]=n[A+4>>2],n[w+8>>2]=n[A+8>>2],n[w+12>>2]=n[A+12>>2],PA(w,B,y),n[i>>2]=0,(0|(g=r+t+(6==(0|r)&1)|0))<=(0|t))S=C;else{s=t+6|0,l=16960+((a=0|n[B>>2])<<2)|0,c=m+8|0,u=p+8|0,f=b+8|0,d=x+4|0,D=0,E=t,r=-1;A:for(;;){if(A=y+((B=(0|E)%6|0)<<4)|0,n[x>>2]=n[A>>2],n[x+4>>2]=n[A+4>>2],n[x+8>>2]=n[A+8>>2],n[x+12>>2]=n[A+12>>2],A=D,D=0|NA(x,a,0,1),(0|E)>(0|t)&!!(0|ZA(e))&&1!=(0|A)&&(0|n[x>>2])!=(0|r)){switch(oA(y+((B+5|0)%6<<4)+4|0,k),oA(y+(B<<4)+4|0,h),Q=+(0|n[l>>2]),o[m>>3]=3*Q,o[c>>3]=0,j=-1.5*Q,o[p>>3]=j,o[u>>3]=2.598076211353316*Q,o[b>>3]=j,o[f>>3]=-2.598076211353316*Q,B=0|n[w>>2],0|n[17040+(80*B|0)+(((0|r)==(0|B)?n[x>>2]:r)<<2)>>2]){case 1:A=p,r=m;break;case 3:A=b,r=p;break;case 2:A=m,r=b;break;default:A=8;break A}je(k,h,r,A,v),0|Ne(k,v)||0|Ne(h,v)||(EA(v,0|n[w>>2],a,1,i+8+(n[i>>2]<<4)|0),n[i>>2]=1+(0|n[i>>2]))}if((0|E)<(0|s)&&(oA(d,k),EA(k,0|n[x>>2],a,1,i+8+(n[i>>2]<<4)|0),n[i>>2]=1+(0|n[i>>2])),(0|(E=E+1|0))>=(0|g)){A=3;break}r=0|n[x>>2]}3!=(0|A)?8==(0|A)&&M(27054,27017,737,27099):S=C}}function PA(A,e,t){A|=0,e|=0,t|=0;var r,o=0,i=0,a=0,s=0,l=0;r=S,S=S+160|0,i=r,s=20368,l=72+(a=o=r+80|0)|0;do{n[a>>2]=n[s>>2],a=a+4|0,s=s+4|0}while((0|a)<(0|l));s=20448,l=(a=i)+72|0;do{n[a>>2]=n[s>>2],a=a+4|0,s=s+4|0}while((0|a)<(0|l));o=(l=!(0|ZA(0|n[e>>2])))?o:i,yA(i=A+4|0),xA(i),0|ZA(0|n[e>>2])&&(hA(i),n[e>>2]=1+(0|n[e>>2])),n[t>>2]=n[A>>2],iA(i,o,e=t+4|0),nA(e),n[t+16>>2]=n[A>>2],iA(i,o+12|0,e=t+20|0),nA(e),n[t+32>>2]=n[A>>2],iA(i,o+24|0,e=t+36|0),nA(e),n[t+48>>2]=n[A>>2],iA(i,o+36|0,e=t+52|0),nA(e),n[t+64>>2]=n[A>>2],iA(i,o+48|0,e=t+68|0),nA(e),n[t+80>>2]=n[A>>2],iA(i,o+60|0,t=t+84|0),nA(t),S=r}function TA(A,e){return e=0|tt(0|(A|=0),0|(e|=0),45),B(),127&e}function LA(A,e){A|=0;var t=0,n=0,o=0,i=0;return!0&134217728==(-16777216&(e|=0))?(n=0|tt(0|A,0|e,52),B(),n&=15,t=0|tt(0|A,0|e,45),B(),(t&=127)>>>0>121?0|(A=0):!(613566756&(i=0|rt(0|(o=0|tt(0|A,0|e,0|(i=3*(15^n)|0))),0|B(),0|i))&Ze(-1227133514,-1171,0|i,0|(o=0|B())))&!(4681&o&B())&&15==(0|n)|!(0|(i=0|tt(0|rt(0|~A,0|~e,0|(i=19+(3*n|0)|0)),0|B(),0|i)))&!(0|B())?0|r[20528+t|0]?!(0|A)&!(0|(e&=8191))?0|(i=1):(i=0|nt(0|A,0|e),B(),0|!!((63-i|0)%3|0)):0|(i=1):0|(i=0)):0|(A=0)}function IA(A,e,t,r){A|=0,t|=0,r|=0;var o=0,i=0,a=0,s=0;if(o=0|rt(0|(e|=0),0,52),i=0|B(),t=0|rt(0|t,0,45),t=0|i|B()|134225919,(0|e)<1)return i=-1,r=t,n[(e=A)>>2]=i,void(n[(A=A+4|0)>>2]=r);for(i=1,o=-1;s=0|rt(7,0,0|(a=3*(15-i|0)|0)),t&=~B(),o=o&~s|(a=0|rt(0|r,0,0|a)),t=0|t|B(),(0|i)!=(0|e);)i=i+1|0;n[(a=s=A)>>2]=o,n[(s=s+4|0)>>2]=t}function RA(A,e,t,r){t|=0,r|=0;var o=0,i=0;if(i=0|tt(0|(A|=0),0|(e|=0),52),B(),t>>>0>15)return 4;if((0|(i&=15))<(0|t))return 12;if((0|i)==(0|t))return n[r>>2]=A,n[r+4>>2]=e,0;if(o=0|rt(0|t,0,52),o|=A,A=B()|-15728641&e,(0|i)>(0|t))do{e=0|rt(7,0,3*(14-t|0)|0),t=t+1|0,o|=e,A=0|B()|A}while((0|t)<(0|i));return n[r>>2]=o,n[r+4>>2]=A,0}function _A(A,e,t,r){t|=0,r|=0;var o=0,i=0,a=0;if(i=0|tt(0|(A|=0),0|(e|=0),52),B(),!((0|t)<16&(0|(i&=15))<=(0|t)))return 4;o=t-i|0,t=0|tt(0|A,0|e,45),B();A:do{if(0|z(127&t)){e:do{if(0|i){for(t=1;!((a=0|rt(7,0,3*(15-t|0)|0))&A)&!((0|B())&e);){if(!(t>>>0>>0))break e;t=t+1|0}t=0|be(7,0,o,((0|o)<0)<<31>>31),o=0|B();break A}}while(0);t=0|We(0|(t=0|qe(0|(t=0|be(7,0,o,((0|o)<0)<<31>>31)),0|B(),5,0)),0|B(),-5,-1),t=0|We(0|(t=0|Xe(0|t,0|B(),6,0)),0|B(),1,0),o=0|B()}else t=0|be(7,0,o,((0|o)<0)<<31>>31),o=0|B()}while(0);return n[(a=r)>>2]=t,n[a+4>>2]=o,0}function HA(A,e){var t=0,r=0,n=0;if(n=0|tt(0|(A|=0),0|(e|=0),45),B(),!(0|z(127&n)))return 0;n=0|tt(0|A,0|e,52),B(),n&=15;A:do{if(n)for(r=1;;){if(t=0|tt(0|A,0|e,3*(15-r|0)|0),B(),0|(t&=7))break A;if(!(r>>>0>>0)){t=0;break}r=r+1|0}else t=0}while(0);return 1&!(0|t)}function zA(A,e,t,r){return A|=0,e|=0,(0|(r|=0))<(0|(t|=0))?(r=A,C(0|(t=e)),0|r):(t=0|rt(-1,-1,3+(3*(r-t|0)|0)|0),r=0|rt(0|~t,0|~B(),3*(15-r|0)|0),t=~B()&e,r=~r&A,C(0|t),0|r)}function GA(A,e,t,r){t|=0,r|=0;var o=0;return o=0|tt(0|(A|=0),0|(e|=0),52),B(),(0|t)<16&(0|(o&=15))<=(0|t)?((0|o)<(0|t)&&(o=0|rt(-1,-1,3+(3*(t+-1-o|0)|0)|0),o=0|rt(0|~o,0|~B(),3*(15-t|0)|0),e=~B()&e,A&=~o),o=0|rt(0|t,0,52),t=-15728641&e|B(),n[r>>2]=A|o,n[r+4>>2]=t,0|(r=0)):0|(r=4)}function OA(A,e){var t=0,r=0,n=0;if(n=0|tt(0|(A|=0),0|(e|=0),52),B(),!(n&=15))return 0;for(r=1;;){if(t=0|tt(0|A,0|e,3*(15-r|0)|0),B(),0|(t&=7)){r=5;break}if(!(r>>>0>>0)){t=0,r=5;break}r=r+1|0}return 5==(0|r)?0|t:0}function UA(A,e){var t=0,r=0,n=0,o=0,i=0,a=0,s=0;if(s=0|tt(0|(A|=0),0|(e|=0),52),B(),!(s&=15))return s=A,C(0|(a=e)),0|s;for(a=1,t=0;;){r=0|rt(7,0,0|(o=3*(15-a|0)|0)),n=0|B(),i=0|tt(0|A,0|e,0|o),B(),A=(o=0|rt(0|vA(7&i),0,0|o))|A&~r,e=(i=0|B())|e&~n;A:do{if(!t)if(!(o&r|0)&!(i&n|0))t=0;else if(r=0|tt(0|A,0|e,52),B(),r&=15){t=1;e:for(;;){switch(i=0|tt(0|A,0|e,3*(15-t|0)|0),B(),7&i){case 1:break e;case 0:break;default:t=1;break A}if(!(t>>>0>>0)){t=1;break A}t=t+1|0}for(t=1;;){if(n=0|tt(0|A,0|e,0|(i=3*(15-t|0)|0)),B(),o=0|rt(7,0,0|i),e&=~B(),A=A&~o|(i=0|rt(0|vA(7&n),0,0|i)),e=0|e|B(),!(t>>>0>>0)){t=1;break}t=t+1|0}}else t=1}while(0);if(!(a>>>0>>0))break;a=a+1|0}return C(0|e),0|A}function YA(A,e){var t=0,r=0,n=0,o=0,i=0;if(r=0|tt(0|(A|=0),0|(e|=0),52),B(),!(r&=15))return r=A,C(0|(t=e)),0|r;for(t=1;i=0|tt(0|A,0|e,0|(o=3*(15-t|0)|0)),B(),n=0|rt(7,0,0|o),e&=~B(),A=(o=0|rt(0|vA(7&i),0,0|o))|A&~n,e=0|B()|e,t>>>0>>0;)t=t+1|0;return C(0|e),0|A}function VA(A,e){var t=0,r=0,n=0,o=0,i=0,a=0,s=0;if(s=0|tt(0|(A|=0),0|(e|=0),52),B(),!(s&=15))return s=A,C(0|(a=e)),0|s;for(a=1,t=0;;){r=0|rt(7,0,0|(o=3*(15-a|0)|0)),n=0|B(),i=0|tt(0|A,0|e,0|o),B(),A=(o=0|rt(0|wA(7&i),0,0|o))|A&~r,e=(i=0|B())|e&~n;A:do{if(!t)if(!(o&r|0)&!(i&n|0))t=0;else if(r=0|tt(0|A,0|e,52),B(),r&=15){t=1;e:for(;;){switch(i=0|tt(0|A,0|e,3*(15-t|0)|0),B(),7&i){case 1:break e;case 0:break;default:t=1;break A}if(!(t>>>0>>0)){t=1;break A}t=t+1|0}for(t=1;;){if(o=0|rt(7,0,0|(n=3*(15-t|0)|0)),i=e&~B(),e=0|tt(0|A,0|e,0|n),B(),A=A&~o|(e=0|rt(0|wA(7&e),0,0|n)),e=0|i|B(),!(t>>>0>>0)){t=1;break}t=t+1|0}}else t=1}while(0);if(!(a>>>0>>0))break;a=a+1|0}return C(0|e),0|A}function WA(A,e){var t=0,r=0,n=0,o=0,i=0;if(r=0|tt(0|(A|=0),0|(e|=0),52),B(),!(r&=15))return r=A,C(0|(t=e)),0|r;for(t=1;o=0|rt(7,0,0|(i=3*(15-t|0)|0)),n=e&~B(),e=0|tt(0|A,0|e,0|i),B(),A=(e=0|rt(0|wA(7&e),0,0|i))|A&~o,e=0|B()|n,t>>>0>>0;)t=t+1|0;return C(0|e),0|A}function ZA(A){return(0|(A|=0))%2|0}function KA(A,e,t){t|=0;var r,i=0;return r=S,S=S+16|0,i=r,(e|=0)>>>0>15?(S=r,0|(i=4)):2146435072&~n[4+(A|=0)>>2]&&2146435072&~n[A+8+4>>2]?(function(A,e,t){var r,i;r=S,S=S+16|0,function(A,e,t,r){e|=0,r|=0;var i,a=0,s=0,l=0,c=0;if(i=S,S=S+16|0,function(A,e,t){e|=0,t|=0;var r,i,a=0;i=S,S=S+32|0,function(A,e){e|=0;var t,r,n=0;n=+o[(A|=0)>>3],t=+f(+n),n=+d(+n),o[e+16>>3]=n,n=+o[A+8>>3],r=t*+f(+n),o[e>>3]=r,n=t*+d(+n),o[e+8>>3]=n}(A|=0,r=i),n[e>>2]=0,o[t>>3]=5,(a=+Se(16400,r))<+o[t>>3]&&(n[e>>2]=0,o[t>>3]=a),(a=+Se(16424,r))<+o[t>>3]&&(n[e>>2]=1,o[t>>3]=a),(a=+Se(16448,r))<+o[t>>3]&&(n[e>>2]=2,o[t>>3]=a),(a=+Se(16472,r))<+o[t>>3]&&(n[e>>2]=3,o[t>>3]=a),(a=+Se(16496,r))<+o[t>>3]&&(n[e>>2]=4,o[t>>3]=a),(a=+Se(16520,r))<+o[t>>3]&&(n[e>>2]=5,o[t>>3]=a),(a=+Se(16544,r))<+o[t>>3]&&(n[e>>2]=6,o[t>>3]=a),(a=+Se(16568,r))<+o[t>>3]&&(n[e>>2]=7,o[t>>3]=a),(a=+Se(16592,r))<+o[t>>3]&&(n[e>>2]=8,o[t>>3]=a),(a=+Se(16616,r))<+o[t>>3]&&(n[e>>2]=9,o[t>>3]=a),(a=+Se(16640,r))<+o[t>>3]&&(n[e>>2]=10,o[t>>3]=a),(a=+Se(16664,r))<+o[t>>3]&&(n[e>>2]=11,o[t>>3]=a),(a=+Se(16688,r))<+o[t>>3]&&(n[e>>2]=12,o[t>>3]=a),(a=+Se(16712,r))<+o[t>>3]&&(n[e>>2]=13,o[t>>3]=a),(a=+Se(16736,r))<+o[t>>3]&&(n[e>>2]=14,o[t>>3]=a),(a=+Se(16760,r))<+o[t>>3]&&(n[e>>2]=15,o[t>>3]=a),(a=+Se(16784,r))<+o[t>>3]&&(n[e>>2]=16,o[t>>3]=a),(a=+Se(16808,r))<+o[t>>3]&&(n[e>>2]=17,o[t>>3]=a),(a=+Se(16832,r))<+o[t>>3]&&(n[e>>2]=18,o[t>>3]=a),(a=+Se(16856,r))<+o[t>>3]?(n[e>>2]=19,o[t>>3]=a,S=i):S=i}(A|=0,t|=0,c=i),(s=+h(+(1-.5*+o[c>>3])))<1e-16)return n[r>>2]=0,n[r+4>>2]=0,n[r+8>>2]=0,n[r+12>>2]=0,void(S=i);if(c=0|n[t>>2],a=+ne((a=+o[15920+(24*c|0)>>3])-+ne(+function(A,e){var t,r,n,i,a;return A|=0,i=+o[(e|=0)>>3],r=+f(+i),n=+o[e+8>>3]-+o[A+8>>3],a=r*+d(+n),t=+o[A>>3],+ +b(+a,+(+d(+i)*+f(+t)-+f(+n)*(r*+d(+t))))}(15600+(c<<4)|0,A))),l=0|ZA(e)?+ne(a+-.3334731722518321):a,a=2.618033988749896*+g(+s),(0|e)>0){A=0;do{a*=2.6457513110645907,A=A+1|0}while((0|A)!=(0|e))}s=+f(+l)*a,o[r>>3]=s,l=+d(+l)*a,o[r+8>>3]=l,S=i}(A|=0,e|=0,t|=0,i=r),function(A,e){A|=0;var t,r,i,a,s=0,c=0,u=0,f=0,d=0,g=0,h=0;n[(a=8+(e|=0)|0)>>2]=0,r=+o[A>>3],f=+l(+r),i=+o[A+8>>3],f+=.5*(d=1.1547005383792515*+l(+i)),f-=+(0|(s=~~f)),d-=+(0|(A=~~d));do{if(f<.5){if(f<.3333333333333333){if(n[e>>2]=s,d<.5*(f+1)){n[e+4>>2]=A;break}A=A+1|0,n[e+4>>2]=A;break}if(A=(1&!(d<(h=1-f)))+A|0,n[e+4>>2]=A,h<=d&d<2*f){s=s+1|0,n[e>>2]=s;break}n[e>>2]=s;break}if(!(f<.6666666666666666)){if(s=s+1|0,n[e>>2]=s,d<.5*f){n[e+4>>2]=A;break}A=A+1|0,n[e+4>>2]=A;break}if(d<1-f){if(n[e+4>>2]=A,2*f-1>2]=s;break}}else A=A+1|0,n[e+4>>2]=A;s=s+1|0,n[e>>2]=s}while(0);do{if(r<0){if(1&A){s=~~(+(0|s)-(2*(+((g=0|Ze(0|s,((0|s)<0)<<31>>31,0|(g=(A+1|0)/2|0),((0|g)<0)<<31>>31))>>>0)+4294967296*+(0|B()))+1)),n[e>>2]=s;break}s=~~(+(0|s)-2*(+((g=0|Ze(0|s,((0|s)<0)<<31>>31,0|(g=(0|A)/2|0),((0|g)<0)<<31>>31))>>>0)+4294967296*+(0|B()))),n[e>>2]=s;break}}while(0);g=e+4|0,i<0&&(s=s-((1|A<<1)/2|0)|0,n[e>>2]=s,A=0-A|0,n[g>>2]=A),c=A-s|0,(0|s)<0?(u=0-s|0,n[g>>2]=c,n[a>>2]=u,n[e>>2]=0,A=c,s=0):u=0,(0|A)<0&&(s=s-A|0,n[e>>2]=s,u=u-A|0,n[a>>2]=u,n[g>>2]=0,A=0),t=s-u|0,c=A-u|0,(0|u)<0&&(n[e>>2]=t,n[g>>2]=c,n[a>>2]=0,A=c,s=t,u=0),(0|(c=(0|u)<(0|(c=(0|A)<(0|s)?A:s))?u:c))<=0||(n[e>>2]=s-c,n[g>>2]=A-c,n[a>>2]=u-c)}(i,t+4|0),S=r}(A,e,i),e=0|function(A,e){A|=0;var t,r=0,o=0,i=0,a=0,s=0,l=0,c=0,u=0;if(t=S,S=S+64|0,l=t+40|0,o=t+24|0,i=t+12|0,a=t,rt(0|(e|=0),0,52),r=134225919|B(),!e)return(0|n[A+4>>2])>2||(0|n[A+8>>2])>2||(0|n[A+12>>2])>2?(l=0,C(0|(s=0)),S=t,0|l):(rt(0|O(A),0,45),s=0|B()|r,l=-1,C(0|s),S=t,0|l);if(n[l>>2]=n[A>>2],n[l+4>>2]=n[A+4>>2],n[l+8>>2]=n[A+8>>2],n[l+12>>2]=n[A+12>>2],s=l+4|0,(0|e)>0)for(A=-1;n[o>>2]=n[s>>2],n[o+4>>2]=n[s+4>>2],n[o+8>>2]=n[s+8>>2],1&e?(fA(s),n[i>>2]=n[s>>2],n[i+4>>2]=n[s+4>>2],n[i+8>>2]=n[s+8>>2],gA(i)):(dA(s),n[i>>2]=n[s>>2],n[i+4>>2]=n[s+4>>2],n[i+8>>2]=n[s+8>>2],hA(i)),aA(o,i,a),nA(a),c=0|rt(7,0,0|(u=3*(15-e|0)|0)),r&=~B(),A=(u=0|rt(0|lA(a),0,0|u))|A&~c,r=0|B()|r,(0|e)>1;)e=e+-1|0;else A=-1;A:do{if((0|n[s>>2])<=2&&(0|n[l+8>>2])<=2&&(0|n[l+12>>2])<=2){if(e=0|rt(0|(o=0|O(l)),0,45),e|=A,A=B()|-1040385&r,a=0|U(l),!(0|z(o))){if((0|a)<=0)break;for(i=0;;){if(o=0|tt(0|e,0|A,52),B(),o&=15)for(r=1;l=0|tt(0|e,0|A,0|(u=3*(15-r|0)|0)),B(),c=0|rt(7,0,0|u),A&=~B(),e=e&~c|(u=0|rt(0|vA(7&l),0,0|u)),A=0|A|B(),r>>>0>>0;)r=r+1|0;if((0|(i=i+1|0))==(0|a))break A}}i=0|tt(0|e,0|A,52),B(),i&=15;e:do{if(i){r=1;t:for(;;){switch(u=0|tt(0|e,0|A,3*(15-r|0)|0),B(),7&u){case 1:break t;case 0:break;default:break e}if(!(r>>>0>>0))break e;r=r+1|0}if(0|Y(o,0|n[l>>2]))for(r=1;c=0|rt(7,0,0|(l=3*(15-r|0)|0)),u=A&~B(),A=0|tt(0|e,0|A,0|l),B(),e=e&~c|(A=0|rt(0|wA(7&A),0,0|l)),A=0|u|B(),r>>>0>>0;)r=r+1|0;else for(r=1;l=0|tt(0|e,0|A,0|(u=3*(15-r|0)|0)),B(),c=0|rt(7,0,0|u),A&=~B(),e=e&~c|(u=0|rt(0|vA(7&l),0,0|u)),A=0|A|B(),r>>>0>>0;)r=r+1|0}}while(0);if((0|a)>0){r=0;do{e=0|UA(e,A),A=0|B(),r=r+1|0}while((0|r)!=(0|a))}}else e=0,A=0}while(0);return u=e,C(0|(c=A)),S=t,0|u}(i,e),i=0|B(),n[t>>2]=e,n[t+4>>2]=i,!(0|e)&!(0|i)&&M(27795,27122,1050,27145),S=r,0|(i=0)):(S=r,0|(i=3))}function JA(A,e,t){var r,o=0,i=0,a=0;if(r=4+(t|=0)|0,i=0|tt(0|(A|=0),0|(e|=0),52),B(),i&=15,a=0|tt(0|A,0|e,45),B(),o=!(0|i),0|z(127&a)){if(o)return 1;o=1}else{if(o)return 0;o=0|n[r>>2]||0|n[t+8>>2]?1:1&!!(0|n[t+12>>2])}for(t=1;1&t?gA(r):hA(r),a=0|tt(0|A,0|e,3*(15-t|0)|0),B(),mA(r,7&a),t>>>0>>0;)t=t+1|0;return 0|o}function XA(A,e,t){t|=0;var r,o,i=0,a=0,s=0,l=0,c=0,u=0;if(o=S,S=S+16|0,r=o,u=0|tt(0|(A|=0),0|(e|=0),45),B(),(u&=127)>>>0>121)return n[t>>2]=0,n[t+4>>2]=0,n[t+8>>2]=0,n[t+12>>2]=0,S=o,5;A:do{if(0|z(u)&&(s=0|tt(0|A,0|e,52),B(),0|(s&=15))){i=1;e:for(;;){switch(c=0|tt(0|A,0|e,3*(15-i|0)|0),B(),7&c){case 5:break e;case 0:break;default:i=e;break A}if(!(i>>>0>>0)){i=e;break A}i=i+1|0}for(a=1,i=e;l=0|rt(7,0,0|(e=3*(15-a|0)|0)),c=i&~B(),i=0|tt(0|A,0|i,0|e),B(),A=A&~l|(i=0|rt(0|wA(7&i),0,0|e)),i=0|c|B(),a>>>0>>0;)a=a+1|0}else i=e}while(0);if(c=7696+(28*u|0)|0,n[t>>2]=n[c>>2],n[t+4>>2]=n[c+4>>2],n[t+8>>2]=n[c+8>>2],n[t+12>>2]=n[c+12>>2],!(0|JA(A,i,t)))return S=o,0;if(l=t+4|0,n[r>>2]=n[l>>2],n[r+4>>2]=n[l+4>>2],n[r+8>>2]=n[l+8>>2],s=0|tt(0|A,0|i,52),B(),c=15&s,1&s?(hA(l),s=c+1|0):s=c,0|z(u)){A:do{if(c)for(e=1;;){if(a=0|tt(0|A,0|i,3*(15-e|0)|0),B(),0|(a&=7)){i=a;break A}if(!(e>>>0>>0)){i=0;break}e=e+1|0}else i=0}while(0);i=4==(0|i)&1}else i=0;if(0|NA(t,s,i,0)){if(0|z(u))do{}while(0|NA(t,s,0,0));(0|s)!=(0|c)&&dA(l)}else(0|s)!=(0|c)&&(n[l>>2]=n[r>>2],n[l+4>>2]=n[r+4>>2],n[l+8>>2]=n[r+8>>2]);return S=o,0}function qA(A,e,t){t|=0;var r,o,i=0;return o=S,S=S+16|0,0|(i=0|XA(A|=0,e|=0,r=o))?(S=o,0|i):(i=0|tt(0|A,0|e,52),B(),function(A,e,t){var r,o;e|=0,t|=0,r=S,S=S+16|0,oA(4+(A|=0)|0,o=r),EA(o,0|n[A>>2],e,0,t),S=r}(r,15&i,t),S=o,0|(i=0))}function $A(A,e,t){t|=0;var r,n=0,o=0,i=0;if(r=S,S=S+16|0,0|(n=0|XA(A|=0,e|=0,i=r)))return S=r,0|n;n=0|tt(0|A,0|e,45),B(),n=!(0|z(127&n)),o=0|tt(0|A,0|e,52),B(),o&=15;A:do{if(!n){if(0|o)for(n=1;;){if(!(!((0|rt(7,0,3*(15-n|0)|0))&A)&!((0|B())&e)))break A;if(!(n>>>0>>0))break;n=n+1|0}return QA(i,o,0,5,t),S=r,0}}while(0);return FA(i,o,0,6,t),S=r,0}function Ae(A,e){e|=0;var t=0,r=0,o=0,i=0,a=0,s=0,l=0;if((A|=0)>>>0>15)return 4;if(rt(0|A,0,52),s=134225919|B(),!A){t=0,r=0;do{0|z(r)&&(rt(0|r,0,45),a=0|s|B(),n[(A=e+(t<<3)|0)>>2]=-1,n[A+4>>2]=a,t=t+1|0),r=r+1|0}while(122!=(0|r));return 0}t=0,a=0;do{if(0|z(a)){for(rt(0|a,0,45),r=1,o=-1,i=0|s|B();o&=~(l=0|rt(7,0,3*(15-r|0)|0)),i&=~B(),(0|r)!=(0|A);)r=r+1|0;n[(l=e+(t<<3)|0)>>2]=o,n[l+4>>2]=i,t=t+1|0}a=a+1|0}while(122!=(0|a));return 0}function ee(A,e,t,r){A|=0,r|=0;var o=0,i=0,a=0;o=0|tt(0|(e|=0),0|(t|=0),52),B(),!(0|e)&!(0|t)|(0|r)>15|(0|(o&=15))>(0|r)?(i=-1,e=-1,t=0,o=0):(e=0|zA(e,t,o+1|0,r),a=-15728641&B(),t=0|rt(0|r,0,52),i=o,e=(e=!(0|HA(t|=e,a=0|a|B())))?-1:r,o=a),n[(a=A)>>2]=t,n[a+4>>2]=o,n[A+8>>2]=i,n[A+12>>2]=e}function te(A,e,t,r){t|=0,r|=0;var o=0,i=0;return o=0|tt(0|(A|=0),0|(e|=0),52),B(),o&=15,n[(i=r+8|0)>>2]=o,!(0|A)&!(0|e)|(0|t)>15|(0|o)>(0|t)?(n[(t=r)>>2]=0,n[t+4>>2]=0,n[i>>2]=-1,void(n[r+12>>2]=-1)):(A=0|zA(A,e,o+1|0,t),i=-15728641&B(),o=0|rt(0|t,0,52),o|=A,i=0|i|B(),n[(A=r)>>2]=o,n[A+4>>2]=i,A=r+12|0,0|HA(o,i)?void(n[A>>2]=t):void(n[A>>2]=-1))}function re(A){var e,t=0,r=0,o=0,i=0,a=0,s=0,l=0,c=0;if(!(!(0|(t=0|n[(r=A|=0)>>2]))&!(0|(r=0|n[r+4>>2]))||(o=0|tt(0|t,0|r,52),B(),t=0|We(0|(l=0|rt(1,0,3*(15^(o&=15))|0)),0|B(),0|t,0|r),r=0|B(),n[(l=A)>>2]=t,n[l+4>>2]=r,(0|o)<(0|(s=0|n[(l=A+8|0)>>2]))))){for(e=A+12|0,a=o;;){if((0|a)==(0|s)){o=5;break}if(c=(0|a)==(0|n[e>>2]),o=0|tt(0|t,0|r,0|(i=3*(15-a|0)|0)),B(),c&1==(0|(o&=7))&!0){o=7;break}if(!(7==(0|o)&!0)){o=10;break}if(t=0|We(0|t,0|r,0|(c=0|rt(1,0,0|i)),0|B()),r=0|B(),n[(c=A)>>2]=t,n[c+4>>2]=r,!((0|a)>(0|s))){o=10;break}a=a+-1|0}if(5==(0|o))return n[(c=A)>>2]=0,n[c+4>>2]=0,n[l>>2]=-1,void(n[e>>2]=-1);if(7==(0|o))return s=0|We(0|t,0|r,0|(s=0|rt(1,0,0|i)),0|B()),l=0|B(),n[(c=A)>>2]=s,n[c+4>>2]=l,void(n[e>>2]=a+-1)}}function ne(A){var e;return e=(A=+A)<0?A+6.283185307179586:A,+(A>=6.283185307179586?e+-6.283185307179586:e)}function oe(A,e){return e|=0,+l(+(+o[(A|=0)>>3]-+o[e>>3]))<17453292519943298e-27?0|(e=+l(+(+o[A+8>>3]-+o[e+8>>3]))<17453292519943298e-27):0|(e=0)}function ie(A,e){switch(A=+A,0|(e|=0)){case 1:A=A<0?A+6.283185307179586:A;break;case 2:A=A>0?A+-6.283185307179586:A}return+A}function ae(A,e){A|=0;var t,r,n,i=0;return r=+o[(e|=0)>>3],t=+o[A>>3],i=(n=+d(.5*(r-t)))*n+(i=+d(.5*(+o[e+8>>3]-+o[A+8>>3])))*(+f(+r)*+f(+t)*i),2*+b(+ +c(+i),+ +c(+(1-i)))*6371.007180918475}function se(A,e){return e|=0,(A|=0)>>>0>15?0|(e=4):(o[e>>3]=+o[20656+(A<<3)>>3],0|(e=0))}function le(A,e){e|=0;var t=0;return(A|=0)>>>0>15?0|(e=4):(t=0|qe(0|(t=0|be(7,0,A,((0|A)<0)<<31>>31)),0|B(),120,0),A=0|B(),n[e>>2]=2|t,n[e+4>>2]=A,0|(e=0))}function ce(A,e,t){A|=0,t|=0;var r,n,i,a,s=0,l=0,u=0,h=0,m=0,v=0;return v=+o[(e|=0)>>3],i=+o[A>>3],m=+d(.5*(v-i)),u=+o[e+8>>3],n=+o[A+8>>3],h=+d(.5*(u-n)),r=+f(+i),a=+f(+v),h=2*+b(+ +c(+(h=m*m+h*(a*r*h))),+ +c(+(1-h))),m=+o[t>>3],v=+d(.5*(m-v)),s=+o[t+8>>3],u=+d(.5*(s-u)),l=+f(+m),u=2*+b(+ +c(+(u=v*v+u*(a*l*u))),+ +c(+(1-u))),m=+d(.5*(i-m)),s=+d(.5*(n-s)),s=2*+b(+ +c(+(s=m*m+s*(r*l*s))),+ +c(+(1-s))),4*+p(+ +c(+ +g(.5*(l=.5*(h+u+s)))*+g(.5*(l-h))*+g(.5*(l-u))*+g(.5*(l-s))))}function ue(A,e,t){t|=0;var r,i,a,s=0,l=0;if(a=S,S=S+192|0,i=a,0|(l=0|qA(A|=0,e|=0,r=a+168|0)))return S=a,0|l;if(0|$A(A,e,i)&&M(27795,27190,415,27199),(0|(e=0|n[i>>2]))>0){if(s=+ce(i+8|0,i+8+((1!=(0|e)&1)<<4)|0,r)+0,1!=(0|e)){A=1;do{s+=+ce(i+8+((l=A)<<4)|0,i+8+((0|(A=A+1|0))%(0|e)<<4)|0,r)}while((0|A)<(0|e))}}else s=0;return o[t>>3]=s,S=a,0}function fe(A){A|=0;var e,t,r=0;return(e=0|Ve(1,12))||M(27280,27235,49,27293),0|(r=0|n[(t=A+4|0)>>2])?(n[(r=r+8|0)>>2]=e,n[t>>2]=e,0|e):(0|n[A>>2]&&M(27310,27235,61,27333),n[(r=A)>>2]=e,n[t>>2]=e,0|e)}function de(A,e){var t,r;return A|=0,e|=0,(r=0|Ue(24))||M(27347,27235,78,27361),n[r>>2]=n[e>>2],n[r+4>>2]=n[e+4>>2],n[r+8>>2]=n[e+8>>2],n[r+12>>2]=n[e+12>>2],n[r+16>>2]=0,0|(t=0|n[(e=A+4|0)>>2])?(n[t+16>>2]=r,n[e>>2]=r,0|r):(0|n[A>>2]&&M(27376,27235,82,27361),n[A>>2]=r,n[e>>2]=r,0|r)}function ge(A){var e=0,t=0,r=0,o=0;if(A|=0)for(r=1;;){if(0|(e=0|n[A>>2]))do{if(0|(t=0|n[e>>2]))do{o=t,t=0|n[t+16>>2],Ye(o)}while(0|t);o=e,e=0|n[e+8>>2],Ye(o)}while(0|e);if(e=A,A=0|n[A+8>>2],r||Ye(e),!A)break;r=0}}function he(A,e,t){A|=0;var r=0,i=0,a=0,s=0,l=0,c=0,u=0,f=0;if(!(0|X(e|=0,t|=0)))return 0;if(e=0|K(e),r=+o[t>>3],i=e&(i=+o[t+8>>3])<0?i+6.283185307179586:i,!(A=0|n[A>>2]))return 0;if(e){e=0,u=i,t=A;A:for(;;){for(;s=+o[t>>3],i=+o[t+8>>3],f=0|n[(t=t+16|0)>>2],a=+o[(f=0|f?f:A)>>3],l=+o[f+8>>3],s>a?(c=s,s=l):(c=a,a=s,s=i,i=l),(r=r==a|r==c?r+2220446049250313e-31:r)c;)if(!(t=0|n[t>>2])){t=22;break A}if(((c=(l=s<0?s+6.283185307179586:s)+(r-a)/(c-a)*((s=i<0?i+6.283185307179586:i)-l))<0?c+6.283185307179586:c)>(u=l==u|s==u?u+-2220446049250313e-31:u)&&(e^=1),!(t=0|n[t>>2])){t=22;break}}if(22==(0|t))return 0|e}else{e=0,u=i,t=A;A:for(;;){for(;s=+o[t>>3],i=+o[t+8>>3],f=0|n[(t=t+16|0)>>2],a=+o[(f=0|f?f:A)>>3],l=+o[f+8>>3],s>a?(c=s,s=l):(c=a,a=s,s=i,i=l),(r=r==a|r==c?r+2220446049250313e-31:r)c;)if(!(t=0|n[t>>2])){t=22;break A}if(s+(r-a)/(c-a)*(i-s)>(u=s==u|i==u?u+-2220446049250313e-31:u)&&(e^=1),!(t=0|n[t>>2])){t=22;break}}if(22==(0|t))return 0|e}return 0}function me(A,e,t,o,i){t|=0,o|=0,i|=0;var a,s,l,c,u=0,f=0,d=0,g=0,h=0,m=0,p=0,b=0,v=0,w=0;if(c=S,S=S+32|0,w=c+16|0,l=c,u=0|tt(0|(A|=0),0|(e|=0),52),B(),u&=15,p=0|tt(0|t,0|o,52),B(),(0|u)!=(15&p))return S=c,12;if(h=0|tt(0|A,0|e,45),B(),h&=127,m=0|tt(0|t,0|o,45),B(),h>>>0>121|(m&=127)>>>0>121)return S=c,5;if(p=(0|h)!=(0|m)){if(7==(0|(d=0|W(h,m))))return S=c,1;7==(0|(g=0|W(m,h)))?M(27514,27538,161,27548):(b=d,f=g)}else b=0,f=0;a=0|z(h),s=0|z(m),n[w>>2]=0,n[w+4>>2]=0,n[w+8>>2]=0,n[w+12>>2]=0;do{if(b){if(d=(0|(m=0|n[4272+(28*h|0)+(b<<2)>>2]))>0,s)if(d){h=0,g=t,d=o;do{g=0|VA(g,d),d=0|B(),1==(0|(f=0|wA(f)))&&(f=0|wA(1)),h=h+1|0}while((0|h)!=(0|m));m=f,h=g,g=d}else m=f,h=t,g=o;else if(d){h=0,g=t,d=o;do{g=0|WA(g,d),d=0|B(),f=0|wA(f),h=h+1|0}while((0|h)!=(0|m));m=f,h=g,g=d}else m=f,h=t,g=o;if(JA(h,g,w),p||M(27563,27538,191,27548),(d=!!(0|a))&(f=!!(0|s))&&M(27590,27538,192,27548),d){if(7==(0|(f=0|OA(A,e)))){u=5;break}if(0|r[22e3+(7*f|0)+b|0]){u=1;break}h=g=0|n[21168+(28*f|0)+(b<<2)>>2]}else if(f){if(7==(0|(f=0|OA(h,g)))){u=5;break}if(0|r[22e3+(7*f|0)+m|0]){u=1;break}h=0,g=0|n[21168+(28*m|0)+(f<<2)>>2]}else h=0,g=0;if((h|g|0)<0)u=5;else{if((0|g)>0){d=w+4|0,f=0;do{bA(d),f=f+1|0}while((0|f)!=(0|g))}if(n[l>>2]=0,n[l+4>>2]=0,n[l+8>>2]=0,mA(l,b),0|u)for(;0|ZA(u)?gA(l):hA(l),(0|u)>1;)u=u+-1|0;if((0|h)>0){u=0;do{bA(l),u=u+1|0}while((0|u)!=(0|h))}iA(v=w+4|0,l,v),nA(v),v=51}}else if(JA(t,o,w),!!(0|a)&!!(0|s))if((0|m)!=(0|h)&&M(27621,27538,261,27548),7==(0|(f=0|OA(A,e)))|7==(0|(u=0|OA(t,o))))u=5;else if(0|r[22e3+(7*f|0)+u|0])u=1;else if((0|(f=0|n[21168+(28*f|0)+(u<<2)>>2]))>0){d=w+4|0,u=0;do{bA(d),u=u+1|0}while((0|u)!=(0|f));v=51}else v=51;else v=51}while(0);return 51==(0|v)&&(u=w+4|0,n[i>>2]=n[u>>2],n[i+4>>2]=n[u+4>>2],n[i+8>>2]=n[u+8>>2],u=0),S=c,0|u}function pe(A,e,t,r){t|=0,r|=0;var o,i,a,s=0,l=0,c=0,u=0,f=0,d=0,g=0,h=0,m=0,p=0,b=0,v=0,w=0;if(a=S,S=S+48|0,o=a+36|0,c=a+24|0,u=a+12|0,f=a,s=0|tt(0|(A|=0),0|(e|=0),52),B(),s&=15,g=0|tt(0|A,0|e,45),B(),(g&=127)>>>0>121)return S=a,5;if(i=0|z(g),rt(0|s,0,52),p=134225919|B(),n[(l=r)>>2]=-1,n[l+4>>2]=p,!s)return 7==(0|(s=0|lA(t)))||127==(0|(s=0|V(g,s)))?(S=a,0|(p=1)):(h=0|rt(0|s,0,45),m=0|B(),m=-1040385&n[(g=r)+4>>2]|m,n[(p=r)>>2]=n[g>>2]|h,n[p+4>>2]=m,S=a,0|(p=0));for(n[o>>2]=n[t>>2],n[o+4>>2]=n[t+4>>2],n[o+8>>2]=n[t+8>>2],t=s;;){if(l=t,t=t+-1|0,n[c>>2]=n[o>>2],n[c+4>>2]=n[o+4>>2],n[c+8>>2]=n[o+8>>2],0|ZA(l)){if(0|(s=0|cA(o))){t=13;break}n[u>>2]=n[o>>2],n[u+4>>2]=n[o+4>>2],n[u+8>>2]=n[o+8>>2],gA(u)}else{if(0|(s=0|uA(o))){t=13;break}n[u>>2]=n[o>>2],n[u+4>>2]=n[o+4>>2],n[u+8>>2]=n[o+8>>2],hA(u)}if(aA(c,u,f),nA(f),v=0|n[(s=r)>>2],s=0|n[s+4>>2],b=0|rt(7,0,0|(w=3*(15-l|0)|0)),s&=~B(),w=0|rt(0|lA(f),0,0|w),s=0|B()|s,n[(p=r)>>2]=w|v&~b,n[p+4>>2]=s,(0|l)<=1){t=14;break}}A:do{if(13!=(0|t)&&14==(0|t))if((0|n[o>>2])<=1&&(0|n[o+4>>2])<=1&&(0|n[o+8>>2])<=1){f=127==(0|(s=0|V(g,t=0|lA(o))))?0:0|z(s);e:do{if(t){if(i){if(7==(0|(s=0|OA(A,e)))){s=5;break A}if((0|(l=0|n[21376+(28*s|0)+(t<<2)>>2]))>0){s=t,t=0;do{s=0|vA(s),t=t+1|0}while((0|t)!=(0|l))}else s=t;if(1==(0|s)){s=9;break A}127==(0|(t=0|V(g,s)))&&M(27648,27538,411,27678),0|z(t)?M(27693,27538,412,27678):(m=t,h=l,d=s)}else m=s,h=0,d=t;if((0|(u=0|n[4272+(28*g|0)+(d<<2)>>2]))<=-1&&M(27724,27538,419,27678),!f){if((0|h)<0){s=5;break A}if(0|h){s=0,t=0|n[(l=r)>>2],l=0|n[l+4>>2];do{t=0|YA(t,l),l=0|B(),n[(w=r)>>2]=t,n[w+4>>2]=l,s=s+1|0}while((0|s)<(0|h))}if((0|u)<=0){s=m,t=58;break}for(s=0,t=0|n[(l=r)>>2],l=0|n[l+4>>2];;)if(t=0|YA(t,l),l=0|B(),n[(w=r)>>2]=t,n[w+4>>2]=l,(0|(s=s+1|0))==(0|u)){s=m,t=58;break e}}if(7==(0|(c=0|W(m,g)))&&M(27514,27538,428,27678),t=0|n[(s=r)>>2],s=0|n[s+4>>2],(0|u)>0){l=0;do{t=0|YA(t,s),s=0|B(),n[(w=r)>>2]=t,n[w+4>>2]=s,l=l+1|0}while((0|l)!=(0|u))}if(7==(0|(s=0|OA(t,s)))&&M(27795,27538,440,27678),t=0|G(m),(0|(t=0|n[(t?21792:21584)+(28*c|0)+(s<<2)>>2]))<0&&M(27795,27538,454,27678),t){s=0,l=0|n[(c=r)>>2],c=0|n[c+4>>2];do{l=0|UA(l,c),c=0|B(),n[(w=r)>>2]=l,n[w+4>>2]=c,s=s+1|0}while((0|s)<(0|t));s=m,t=58}else s=m,t=58}else if(!!(0|i)&!!(0|f)){if(7==(0|(t=0|OA(A,e)))|7==(0|(l=0|OA(0|n[(l=r)>>2],0|n[l+4>>2])))){s=5;break A}if((0|(l=0|n[21376+(28*t|0)+(l<<2)>>2]))<0){s=5;break A}if(l){t=0,c=0|n[(u=r)>>2],u=0|n[u+4>>2];do{c=0|YA(c,u),u=0|B(),n[(w=r)>>2]=c,n[w+4>>2]=u,t=t+1|0}while((0|t)<(0|l));t=58}else t=59}else t=58}while(0);if(58==(0|t)&&f&&(t=59),59==(0|t)&&1==(0|OA(0|n[(w=r)>>2],0|n[w+4>>2]))){s=9;break}b=0|n[(w=r)>>2],w=-1040385&n[w+4>>2],v=0|rt(0|s,0,45),w=0|w|B(),n[(s=r)>>2]=b|v,n[s+4>>2]=w,s=0}else s=1}while(0);return S=a,0|s}function be(A,e,t,r){A|=0,e|=0;var n=0,o=0,i=0;if(!(0|(t|=0))&!(0|(r|=0)))return o=1,C(0|(n=0)),0|o;o=A,n=e,A=1,e=0;do{A=0|qe(0|((i=!0&!(1&t))?1:o),0|(i?0:n),0|A,0|e),e=0|B(),t=0|et(0|t,0|r,1),r=0|B(),o=0|qe(0|o,0|n,0|o,0|n),n=0|B()}while(!(!(0|t)&!(0|r)));return C(0|e),0|A}function ve(A,e,t,r){t|=0,r|=0;var i,a=0,s=0,l=0,c=0,u=0,d=0;i=S,S=S+16|0,s=i,l=0|tt(0|(A|=0),0|(e|=0),52),B(),l&=15;do{if(l){if(!(a=0|qA(A,e,s))){u=+o[s>>3],c=1/+f(+u),d=+o[25968+(l<<3)>>3],o[t>>3]=u+d,o[t+8>>3]=u-d,u=+o[s+8>>3],c*=d,o[t+16>>3]=c+u,o[t+24>>3]=u-c;break}return S=i,0|a}if(a=0|tt(0|A,0|e,45),B(),(a&=127)>>>0>121)return S=i,5;s=22064+(a<<5)|0,n[t>>2]=n[s>>2],n[t+4>>2]=n[s+4>>2],n[t+8>>2]=n[s+8>>2],n[t+12>>2]=n[s+12>>2],n[t+16>>2]=n[s+16>>2],n[t+20>>2]=n[s+20>>2],n[t+24>>2]=n[s+24>>2],n[t+28>>2]=n[s+28>>2];break}while(0);return function(A,e){e=+e;var t,r,n,i,a,s,l,c=0,u=0;c=(i=+o[(n=16+(A|=0)|0)>>3])-(r=+o[(t=A+24|0)>>3]),c=i>3],c=.5*(c*e-c),u+=e=.5*((l=u-(s=+o[(a=A+8|0)>>3]))*e-l),o[A>>3]=u>1.5707963267948966?1.5707963267948966:u,e=s-e,o[a>>3]=e<-1.5707963267948966?-1.5707963267948966:e,e=(e=i+c)>3.141592653589793?e+-6.283185307179586:e,o[n>>3]=e<-3.141592653589793?e+6.283185307179586:e,e=(e=r-c)>3.141592653589793?e+-6.283185307179586:e,o[t>>3]=e<-3.141592653589793?e+6.283185307179586:e}(t,r?1.4:1.1),(0|n[(r=26096+(l<<3)|0)>>2])==(0|A)&&(0|n[r+4>>2])==(0|e)&&(o[t>>3]=1.5707963267948966),(0|n[(l=26224+(l<<3)|0)>>2])==(0|A)&&(0|n[l+4>>2])==(0|e)&&(o[t+8>>3]=-1.5707963267948966),1.5707963267948966!=+o[t>>3]&&-1.5707963267948966!=+o[t+8>>3]?(S=i,0|(l=0)):(o[t+16>>3]=3.141592653589793,o[t+24>>3]=-3.141592653589793,S=i,0|(l=0))}function we(A){var e,t,o,i,a=0,s=0,l=0,c=0,u=0,f=0,d=0,g=0,h=0,m=0,p=0,b=0,v=0,w=0,y=0,x=0;if(i=S,S=S+336|0,e=i+168|0,t=i,!(0|(s=0|n[(l=A|=0)>>2]))&!(0|(l=0|n[l+4>>2])))S=i;else{if(0|r[0|(a=A+28|0)]?(s=0|ye(s,l),l=0|B()):r[0|a]=1,!(0|n[n[(o=A+20|0)>>2]>>2]))return 0|(s=0|n[(a=A+24|0)>>2])&&Ye(s),n[(x=A)>>2]=0,n[x+4>>2]=0,n[A+8>>2]=0,n[o>>2]=0,n[A+12>>2]=-1,n[A+16>>2]=0,n[a>>2]=0,void(S=i);c=15&(a=0|n[(x=A+16|0)>>2]);A:do{if(!(0|s)&!(0|l))y=A+24|0;else{v=A+12|0,p=3==(0|c),m=255&a,g=3==(1|c),b=A+24|0,h=(c+-1|0)>>>0<3,f=3==(2|c),d=t+8|0;e:for(;;){if(u=0|tt(0|s,0|l,52),B(),(0|(u&=15))==(0|n[v>>2])){switch(15&m){case 0:case 2:case 3:if(0|(c=0|qA(s,l,e))){w=15;break e}if(0|Me(0|n[o>>2],0|n[b>>2],e)){w=19;break e}}if(g&&(c=0|n[4+(0|n[o>>2])>>2],n[e>>2]=n[c>>2],n[e+4>>2]=n[c+4>>2],n[e+8>>2]=n[c+8>>2],n[e+12>>2]=n[c+12>>2],0|X(26832,e))){if(0|KA(0|n[4+(0|n[o>>2])>>2],u,t)){w=25;break}if((0|n[(c=t)>>2])==(0|s)&&(0|n[c+4>>2])==(0|l)){w=29;break}}if(h){if(0|(c=0|$A(s,l,e))){w=32;break}if(0|ve(s,l,t,0)){w=36;break}if(f&&0|De(0|n[o>>2],0|n[b>>2],e,t)){w=42;break}if(g&&0|Qe(0|n[o>>2],0|n[b>>2],e,t)){w=42;break}}if(p){if(a=0|ve(s,l,e,1),c=0|n[b>>2],0|a){w=45;break}if(0|q(c,e)){if(AA(t,e),0|$(e,0|n[b>>2])){w=53;break}if(0|Me(0|n[o>>2],0|n[b>>2],d)){w=53;break}if(0|Qe(0|n[o>>2],0|n[b>>2],t,e)){w=53;break}}}}do{if((0|u)<(0|n[v>>2])){if(a=0|ve(s,l,e,1),c=0|n[b>>2],0|a){w=58;break e}if(!(0|q(c,e))){w=73;break}if(0|$(0|n[b>>2],e)&&(AA(t,e),0|De(0|n[o>>2],0|n[b>>2],t,e))){w=65;break e}if(0|(s=0|GA(s,l,u+1|0,t))){w=67;break e}s=0|n[(l=t)>>2],l=0|n[l+4>>2]}else w=73}while(0);if(73==(0|w)&&(w=0,s=0|ye(s,l),l=0|B()),!(0|s)&!(0|l)){y=b;break A}}switch(0|w){case 15:0|(a=0|n[b>>2])&&Ye(a),n[(w=A)>>2]=0,n[w+4>>2]=0,n[o>>2]=0,n[v>>2]=-1,n[x>>2]=0,n[b>>2]=0,n[A+8>>2]=c,w=20;break;case 19:n[A>>2]=s,n[A+4>>2]=l,w=20;break;case 25:M(27795,27761,470,27772);break;case 29:case 42:return n[A>>2]=s,n[A+4>>2]=l,void(S=i);case 32:return 0|(a=0|n[b>>2])&&Ye(a),n[(y=A)>>2]=0,n[y+4>>2]=0,n[o>>2]=0,n[v>>2]=-1,n[x>>2]=0,n[b>>2]=0,n[A+8>>2]=c,void(S=i);case 36:M(27795,27761,493,27772);break;case 45:0|c&&Ye(c),n[(w=A)>>2]=0,n[w+4>>2]=0,n[o>>2]=0,n[v>>2]=-1,n[x>>2]=0,n[b>>2]=0,n[A+8>>2]=a,w=55;break;case 53:n[A>>2]=s,n[A+4>>2]=l,w=55;break;case 58:0|c&&Ye(c),n[(w=A)>>2]=0,n[w+4>>2]=0,n[o>>2]=0,n[v>>2]=-1,n[x>>2]=0,n[b>>2]=0,n[A+8>>2]=a,w=71;break;case 65:n[A>>2]=s,n[A+4>>2]=l,w=71;break;case 67:return 0|(a=0|n[b>>2])&&Ye(a),n[(y=A)>>2]=0,n[y+4>>2]=0,n[o>>2]=0,n[v>>2]=-1,n[x>>2]=0,n[b>>2]=0,n[A+8>>2]=s,void(S=i)}if(20==(0|w))return void(S=i);if(55==(0|w))return void(S=i);if(71==(0|w))return void(S=i)}}while(0);0|(a=0|n[y>>2])&&Ye(a),n[(w=A)>>2]=0,n[w+4>>2]=0,n[A+8>>2]=0,n[o>>2]=0,n[A+12>>2]=-1,n[x>>2]=0,n[y>>2]=0,S=i}}function ye(A,e){var t,r=0,o=0,i=0,a=0,s=0,l=0,c=0,u=0,f=0;t=S,S=S+16|0,f=t,o=0|tt(0|(A|=0),0|(e|=0),52),B(),o&=15,r=0|tt(0|A,0|e,45),B();do{if(o){for(;r=0|rt(o+4095|0,0,52),i=B()|-15728641&e,r=r|A|(s=0|rt(7,0,0|(a=3*(15-o|0)|0))),i|=l=0|B(),c=0|tt(0|A,0|e,0|a),B(),o=o+-1|0,!((c&=7)>>>0<6);){if(!o){u=4;break}e=i,A=r}if(4==(0|u)){r=0|tt(0|r,0|i,45),B();break}return f=0|rt(((f=!(0|c)&!!(0|HA(r,i)))?2:1)+c|0,0,0|a),u=0|B()|e&~l,f|=A&~s,C(0|u),S=t,0|f}}while(0);return(r&=127)>>>0>120?(f=0,C(0|(u=0)),S=t,0|f):(IA(f,0,r+1|0,0),u=0|n[f+4>>2],f=0|n[f>>2],C(0|u),S=t,0|f)}function xe(A,e,t){A|=0;var r,i=0,a=0,s=0,l=0,c=0,u=0,f=0,d=0,g=0;if(!(0|X(e|=0,t|=0)))return 0;if(e=0|K(e),i=+o[t>>3],a=e&(a=+o[t+8>>3])<0?a+6.283185307179586:a,(0|(g=0|n[A>>2]))<=0)return 0;if(r=0|n[A+4>>2],e){e=0,d=a,t=-1,A=0;A:for(;;){for(f=A;l=+o[r+(f<<4)>>3],a=+o[r+(f<<4)+8>>3],s=+o[r+((A=(t+2|0)%(0|g)|0)<<4)>>3],c=+o[r+(A<<4)+8>>3],l>s?(u=l,l=c):(u=s,s=l,l=a,a=c),(i=i==s|i==u?i+2220446049250313e-31:i)u;){if((0|(t=f+1|0))>=(0|g)){t=22;break A}A=f,f=t,t=A}if(((u=(c=l<0?l+6.283185307179586:l)+(i-s)/(u-s)*((l=a<0?a+6.283185307179586:a)-c))<0?u+6.283185307179586:u)>(d=c==d|l==d?d+-2220446049250313e-31:d)&&(e^=1),(0|(A=f+1|0))>=(0|g)){t=22;break}t=f}if(22==(0|t))return 0|e}else{e=0,d=a,t=-1,A=0;A:for(;;){for(f=A;l=+o[r+(f<<4)>>3],a=+o[r+(f<<4)+8>>3],s=+o[r+((A=(t+2|0)%(0|g)|0)<<4)>>3],c=+o[r+(A<<4)+8>>3],l>s?(u=l,l=c):(u=s,s=l,l=a,a=c),(i=i==s|i==u?i+2220446049250313e-31:i)u;){if((0|(t=f+1|0))>=(0|g)){t=22;break A}A=f,f=t,t=A}if(l+(i-s)/(u-s)*(a-l)>(d=l==d|a==d?d+-2220446049250313e-31:d)&&(e^=1),(0|(A=f+1|0))>=(0|g)){t=22;break}t=f}if(22==(0|t))return 0|e}return 0}function ke(A,e){e|=0;var t,r,i,a,s,c=0,u=0,f=0,d=0,g=0,h=0,m=0,p=0,b=0,v=0,w=0,y=0;if(!(r=0|n[(A|=0)>>2]))return n[e>>2]=0,n[e+4>>2]=0,n[e+8>>2]=0,n[e+12>>2]=0,n[e+16>>2]=0,n[e+20>>2]=0,n[e+24>>2]=0,void(n[e+28>>2]=0);if(o[(i=e+8|0)>>3]=17976931348623157e292,o[(a=e+24|0)>>3]=17976931348623157e292,o[e>>3]=-17976931348623157e292,o[(s=e+16|0)>>3]=-17976931348623157e292,!((0|r)<=0)){for(t=0|n[A+4>>2],p=17976931348623157e292,b=-17976931348623157e292,v=0,A=-1,d=17976931348623157e292,g=17976931348623157e292,m=-17976931348623157e292,u=-17976931348623157e292,w=0;c=+o[t+(w<<4)>>3],h=+o[t+(w<<4)+8>>3],f=+o[t+(((0|(A=A+2|0))==(0|r)?0:A)<<4)+8>>3],c>3]=c,d=c),h>3]=h,g=h),c>m?o[e>>3]=c:c=m,h>u&&(o[s>>3]=h,u=h),p=h>0&hb?h:b,v|=+l(+(h-f))>3.141592653589793,(0|(A=w+1|0))!=(0|r);)y=w,m=c,w=A,A=y;v&&(o[s>>3]=b,o[a>>3]=p)}}function Ce(A){return 0|((A|=0)>>>0<4?0:15)}function Be(A,e){e|=0;var t,r=0,i=0,a=0,s=0,c=0,u=0,f=0,d=0,g=0,h=0,m=0,p=0,b=0,v=0,w=0,y=0,x=0,k=0,C=0,B=0,M=0;if(b=0|n[(A|=0)>>2]){if(o[(v=e+8|0)>>3]=17976931348623157e292,o[(w=e+24|0)>>3]=17976931348623157e292,o[e>>3]=-17976931348623157e292,o[(y=e+16|0)>>3]=-17976931348623157e292,(0|b)>0){for(a=0|n[A+4>>2],m=17976931348623157e292,p=-17976931348623157e292,i=0,r=-1,f=17976931348623157e292,d=17976931348623157e292,h=-17976931348623157e292,c=-17976931348623157e292,x=0;s=+o[a+(x<<4)>>3],g=+o[a+(x<<4)+8>>3],u=+o[a+(((0|(B=r+2|0))==(0|b)?0:B)<<4)+8>>3],s>3]=s,f=s),g>3]=g,d=g),s>h?o[e>>3]=s:s=h,g>c&&(o[y>>3]=g,c=g),m=g>0&gp?g:p,i|=+l(+(g-u))>3.141592653589793,(0|(r=x+1|0))!=(0|b);)B=x,h=s,x=r,r=B;i&&(o[y>>3]=p,o[w>>3]=m)}}else n[e>>2]=0,n[e+4>>2]=0,n[e+8>>2]=0,n[e+12>>2]=0,n[e+16>>2]=0,n[e+20>>2]=0,n[e+24>>2]=0,n[e+28>>2]=0;if(!((0|(r=0|n[(B=A+8|0)>>2]))<=0)){t=A+12|0,C=0;do{if(a=0|n[t>>2],i=C,w=e+((C=C+1|0)<<5)|0,y=0|n[a+(i<<3)>>2]){if(o[(x=e+(C<<5)+8|0)>>3]=17976931348623157e292,o[(A=e+(C<<5)+24|0)>>3]=17976931348623157e292,o[w>>3]=-17976931348623157e292,o[(k=e+(C<<5)+16|0)>>3]=-17976931348623157e292,(0|y)>0){for(b=0|n[a+(i<<3)+4>>2],m=17976931348623157e292,p=-17976931348623157e292,a=0,i=-1,v=0,f=17976931348623157e292,d=17976931348623157e292,g=-17976931348623157e292,c=-17976931348623157e292;s=+o[b+(v<<4)>>3],h=+o[b+(v<<4)+8>>3],u=+o[b+(((0|(i=i+2|0))==(0|y)?0:i)<<4)+8>>3],s>3]=s,f=s),h>3]=h,d=h),s>g?o[w>>3]=s:s=g,h>c&&(o[k>>3]=h,c=h),m=h>0&hp?h:p,a|=+l(+(h-u))>3.141592653589793,(0|(i=v+1|0))!=(0|y);)M=v,v=i,g=s,i=M;a&&(o[k>>3]=p,o[A>>3]=m)}}else n[w>>2]=0,n[w+4>>2]=0,n[w+8>>2]=0,n[w+12>>2]=0,n[w+16>>2]=0,n[w+20>>2]=0,n[w+24>>2]=0,n[w+28>>2]=0,r=0|n[B>>2]}while((0|C)<(0|r))}}function Me(A,e,t){var r=0,o=0,i=0;if(!(0|xe(A|=0,e|=0,t|=0)))return 0;if((0|n[(o=A+8|0)>>2])<=0)return 1;for(r=A+12|0,A=0;;){if(i=A,A=A+1|0,0|xe((0|n[r>>2])+(i<<3)|0,e+(A<<5)|0,t)){A=0,r=6;break}if((0|A)>=(0|n[o>>2])){A=1,r=6;break}}return 6==(0|r)?0|A:0}function De(A,e,t,r){r|=0;var o,i,a=0,s=0,l=0,c=0,u=0;if(i=S,S=S+16|0,o=i,!(0|xe(A|=0,e|=0,l=8+(t|=0)|0)))return S=i,0;c=A+8|0;A:do{if((0|n[c>>2])>0){for(s=A+12|0,a=0;;){if(u=a,a=a+1|0,0|xe((0|n[s>>2])+(u<<3)|0,e+(a<<5)|0,l)){a=0;break}if((0|a)>=(0|n[c>>2]))break A}return S=i,0|a}}while(0);if(0|Ee(A,e,t,r))return S=i,0;n[o>>2]=n[t>>2],n[o+4>>2]=l,a=0|n[c>>2];A:do{if((0|a)>0)for(A=A+12|0,l=0,s=a;;){if(a=0|n[A>>2],(0|n[a+(l<<3)>>2])>0){if(0|xe(o,r,0|n[a+(l<<3)+4>>2])){a=0;break A}if(a=l+1|0,0|Ee((0|n[A>>2])+(l<<3)|0,e+(a<<5)|0,t,r)){a=0;break A}s=0|n[c>>2]}else a=l+1|0;if(!((0|a)<(0|s))){a=1;break}l=a}else a=1}while(0);return S=i,0|a}function Ee(A,e,t,r){A|=0,t|=0;var i,a,s,l,c,u,f=0,d=0,g=0,h=0,m=0,p=0,b=0,v=0,w=0,y=0,x=0,k=0,C=0,B=0,M=0;if(u=S,S=S+176|0,l=u+172|0,f=u+168|0,c=u,!(0|q(e|=0,r|=0)))return S=u,0;if(function(A,e,t,r){var i,a,s,l,c;e|=0,t|=0,r|=0,A=(a=+o[16+(A|=0)>>3])<(c=+o[A+24>>3]),i=(l=+o[e+16>>3])<(s=+o[e+24>>3]),e=c-l>2]=A?i|e?1:2:0,n[r>>2]=i?A?1:e?2:1:0}(e,r,l,f),st(0|c,0|t,168),(0|n[t>>2])>0){e=0;do{x=+ie(+o[(B=c+8+(e<<4)+8|0)>>3],0|n[f>>2]),o[B>>3]=x,e=e+1|0}while((0|e)<(0|n[t>>2]))}a=+o[r>>3],s=+o[r+8>>3],x=+ie(+o[r+16>>3],0|n[f>>2]),i=+ie(+o[r+24>>3],0|n[f>>2]);A:do{if((0|n[A>>2])>0){if(r=A+4|0,(0|(f=0|n[c>>2]))<=0)for(e=0;;)if((0|(e=e+1|0))>=(0|n[A>>2])){e=0;break A}for(t=0;;){if(e=0|n[r>>2],w=+o[e+(t<<4)>>3],y=+ie(+o[e+(t<<4)+8>>3],0|n[l>>2]),e=0|n[r>>2],B=(0|(t=t+1|0))%(0|n[A>>2])|0,d=+o[e+(B<<4)>>3],g=+ie(+o[e+(B<<4)+8>>3],0|n[l>>2]),!(w>=a)|!(d>=a)&&!(w<=s)|!(d<=s)&&!(y<=i)|!(g<=i)&&!(y>=x)|!(g>=x)){v=d-w,p=g-y,e=0;do{if(M=e,B=(0|(e=e+1|0))==(0|f)?0:e,d=+o[c+8+(M<<4)+8>>3],g=+o[c+8+(B<<4)+8>>3]-d,h=+o[c+8+(M<<4)>>3],!(0==(b=v*g-p*(m=+o[c+8+(B<<4)>>3]-h))||(k=y-d,C=w-h,m=(k*m-g*C)/b,m<0|m>1))&&(b=(v*k-p*C)/b)>=0&b<=1){e=1;break A}}while((0|e)<(0|f))}if((0|t)>=(0|n[A>>2])){e=0;break}}}else e=0}while(0);return S=u,0|e}function Qe(A,e,t,r){var o=0,i=0,a=0;if(0|Ee(A|=0,e|=0,t|=0,r|=0))return 1;if((0|n[(i=A+8|0)>>2])<=0)return 0;for(o=A+12|0,A=0;;){if(a=A,A=A+1|0,0|Ee((0|n[o>>2])+(a<<3)|0,e+(A<<5)|0,t,r)){A=1,o=6;break}if((0|A)>=(0|n[i>>2])){A=0,o=6;break}}return 6==(0|o)?0|A:0}function je(A,e,t,r,n){e|=0,t|=0,r|=0,n|=0;var i,a,s,l,c,u,f,d=0;l=+o[(A|=0)>>3],s=+o[e>>3]-l,a=+o[A+8>>3],i=+o[e+8>>3]-a,u=+o[t>>3],d=((d=+o[r>>3]-u)*(a-(f=+o[t+8>>3]))-(l-u)*(c=+o[r+8>>3]-f))/(s*c-i*d),o[n>>3]=l+s*d,o[n+8>>3]=a+i*d}function Ne(A,e){return e|=0,+l(+(+o[(A|=0)>>3]-+o[e>>3]))<1.1920928955078125e-7?0|(e=+l(+(+o[A+8>>3]-+o[e+8>>3]))<1.1920928955078125e-7):0|(e=0)}function Se(A,e){var t,r,n;return e|=0,+((n=+o[(A|=0)>>3]-+o[e>>3])*n+(r=+o[A+8>>3]-+o[e+8>>3])*r+(t=+o[A+16>>3]-+o[e+16>>3])*t)}function Fe(A,e,t){t|=0;var r,o,i,a,s=0,l=0,c=0,u=0;if(a=S,S=S+32|0,u=a,0|(s=0|XA(A|=0,e|=0,o=a+16|0)))return S=a,0|s;r=0|TA(A,e),i=0|OA(A,e),function(A,e){A=7696+(28*(A|=0)|0)|0,n[(e|=0)>>2]=n[A>>2],n[e+4>>2]=n[A+4>>2],n[e+8>>2]=n[A+8>>2],n[e+12>>2]=n[A+12>>2]}(r,u),s=0|function(A,e){A|=0;var t=0,r=0;if((e|=0)>>>0>20)return-1;do{if((0|n[11120+(216*e|0)>>2])!=(0|A))if((0|n[11120+(216*e|0)+8>>2])!=(0|A))if((0|n[11120+(216*e|0)+16>>2])!=(0|A))if((0|n[11120+(216*e|0)+24>>2])!=(0|A))if((0|n[11120+(216*e|0)+32>>2])!=(0|A))if((0|n[11120+(216*e|0)+40>>2])!=(0|A))if((0|n[11120+(216*e|0)+48>>2])!=(0|A))if((0|n[11120+(216*e|0)+56>>2])!=(0|A))if((0|n[11120+(216*e|0)+64>>2])!=(0|A))if((0|n[11120+(216*e|0)+72>>2])!=(0|A))if((0|n[11120+(216*e|0)+80>>2])!=(0|A))if((0|n[11120+(216*e|0)+88>>2])!=(0|A))if((0|n[11120+(216*e|0)+96>>2])!=(0|A))if((0|n[11120+(216*e|0)+104>>2])!=(0|A))if((0|n[11120+(216*e|0)+112>>2])!=(0|A))if((0|n[11120+(216*e|0)+120>>2])!=(0|A))if((0|n[11120+(216*e|0)+128>>2])!=(0|A)){if((0|n[11120+(216*e|0)+136>>2])!=(0|A)){if((0|n[11120+(216*e|0)+144>>2])==(0|A)){A=0,t=2,r=0;break}if((0|n[11120+(216*e|0)+152>>2])==(0|A)){A=0,t=2,r=1;break}if((0|n[11120+(216*e|0)+160>>2])==(0|A)){A=0,t=2,r=2;break}if((0|n[11120+(216*e|0)+168>>2])==(0|A)){A=1,t=2,r=0;break}if((0|n[11120+(216*e|0)+176>>2])==(0|A)){A=1,t=2,r=1;break}if((0|n[11120+(216*e|0)+184>>2])==(0|A)){A=1,t=2,r=2;break}if((0|n[11120+(216*e|0)+192>>2])==(0|A)){A=2,t=2,r=0;break}if((0|n[11120+(216*e|0)+200>>2])==(0|A)){A=2,t=2,r=1;break}if((0|n[11120+(216*e|0)+208>>2])==(0|A)){A=2,t=2,r=2;break}return-1}A=2,t=1,r=2}else A=2,t=1,r=1;else A=2,t=1,r=0;else A=1,t=1,r=2;else A=1,t=1,r=1;else A=1,t=1,r=0;else A=0,t=1,r=2;else A=0,t=1,r=1;else A=0,t=1,r=0;else A=2,t=0,r=2;else A=2,t=0,r=1;else A=2,t=0,r=0;else A=1,t=0,r=2;else A=1,t=0,r=1;else A=1,t=0,r=0;else A=0,t=0,r=2;else A=0,t=0,r=1;else A=0,t=0,r=0}while(0);return 0|n[11120+(216*e|0)+(72*t|0)+(24*A|0)+(r<<3)+4>>2]}(r,0|n[o>>2]);do{if(0|z(r)){switch(0|r){case 4:l=0;break;case 14:l=1;break;case 24:l=2;break;case 38:l=3;break;case 49:l=4;break;case 58:l=5;break;case 63:l=6;break;case 72:l=7;break;case 83:l=8;break;case 97:l=9;break;case 107:l=10;break;case 117:l=11;break;default:M(27795,27797,75,27806)}if(c=0|n[26416+(24*l|0)+8>>2],e=0|n[26416+(24*l|0)+16>>2],(0|(A=0|n[o>>2]))!=(0|n[u>>2])&&(u=0|G(r))|(0|(A=0|n[o>>2]))==(0|e)&&(s=(s+1|0)%6|0),3==(0|i)&(0|A)==(0|e)){s=(s+5|0)%6|0;break}5==(0|i)&(0|A)==(0|c)&&(s=(s+1|0)%6|0)}}while(0);return n[t>>2]=s,S=a,0}function Pe(A,e,t,r){t|=0,r|=0;var o,i,a,s,l,c=0,u=0,f=0,d=0,g=0,h=0,m=0,p=0,b=0,v=0,w=0;if(l=S,S=S+32|0,w=l+24|0,s=l+20|0,a=l+8|0,i=l+16|0,o=l,g=(g=!(0|HA(A|=0,e|=0)))?6:5,m=0|tt(0|A,0|e,52),B(),g>>>0<=t>>>0)return S=l,2;!(p=!(0|(m&=15)))&&!((b=0|rt(7,0,3*(15^m)|0))&A)&!((0|B())&e)?c=t:u=4;A:do{if(4==(0|u)){if((0|((c=!!(0|HA(A,e)))?4:5))<(0|t))return S=l,1;if(0|Fe(A,e,w))return S=l,1;if(u=(0|n[w>>2])+t|0,7==(0|(b=0|n[(c=c?26704+((0|u)%5<<2)|0:26736+((0|u)%6<<2)|0)>>2])))return S=l,1;n[s>>2]=0,c=0|I(A,e,b,s,a);do{if(!c){if(h=0|n[(d=a)>>2],u=(f=(d=0|n[d+4>>2])>>>0>>0|(0|d)==(0|e)&h>>>0>>0)?h:A,f=f?d:e,!p&&!(h&(p=0|rt(7,0,3*(15^m)|0)))&!(d&(0|B())))c=t;else{if(d=(t+-1+g|0)%(0|g)|0,c=0|HA(A,e),(0|d)<0&&M(27795,27797,248,27822),(0|((g=!!(0|c))?4:5))<(0|d)&&M(27795,27797,248,27822),0|Fe(A,e,w)&&M(27795,27797,248,27822),c=(0|n[w>>2])+d|0,7==(0|(d=0|n[(c=g?26704+((0|c)%5<<2)|0:26736+((0|c)%6<<2)|0)>>2]))&&M(27795,27797,248,27822),n[i>>2]=0,0|(c=0|I(A,e,d,i,o)))break;g=0|n[(h=o)>>2],h=0|n[h+4>>2];do{if(h>>>0>>0|(0|h)==(0|f)&g>>>0>>0){if(u=0|HA(g,h)?0|_(g,h,A,e):0|n[26800+(((0|n[i>>2])+(0|n[26768+(d<<2)>>2])|0)%6<<2)>>2],c=0|HA(g,h),(u+-1|0)>>>0>5){c=-1,u=g,f=h;break}if(1==(0|u)&(c=!!(0|c))){c=-1,u=g,f=h;break}do{if(!(0|Fe(g,h,w))){if(c){c=(5+(0|n[26352+(u<<2)>>2])-(0|n[w>>2])|0)%5|0;break}c=(6+(0|n[26384+(u<<2)>>2])-(0|n[w>>2])|0)%6|0;break}c=-1}while(0);u=g,f=h}else c=t}while(0);h=0|n[(d=a)>>2],d=0|n[d+4>>2]}if((0|u)==(0|h)&(0|f)==(0|d)){if(A=(g=!!(0|HA(h,d)))?0|_(h,d,A,e):0|n[26800+(((0|n[s>>2])+(0|n[26768+(b<<2)>>2])|0)%6<<2)>>2],c=0|HA(h,d),(A+-1|0)>>>0<=5&&!(1==(0|A)&(v=!!(0|c))))do{if(!(0|Fe(h,d,w))){if(v){c=(5+(0|n[26352+(A<<2)>>2])-(0|n[w>>2])|0)%5|0;break}c=(6+(0|n[26384+(A<<2)>>2])-(0|n[w>>2])|0)%6|0;break}c=-1}while(0);else c=-1;c=6==(0|(c=c+1|0))|g&5==(0|c)?0:c}e=f,A=u;break A}}while(0);return S=l,0|c}}while(0);return v=0|rt(0|c,0,56),w=B()|-2130706433&e|536870912,n[r>>2]=v|A,n[r+4>>2]=w,S=l,0}function Te(A,e){A|=0;var t,r,o=0,i=0;return r=S,S=S+16|0,t=r,!0&536870912==(2013265920&(e|=0))&&0|LA(A,o=-2130706433&e|134217728)?(i=0|tt(0|A,0|e,56),B(),o=(i=!(0|Pe(A,o,7&i,t)))&((0|n[(o=t)>>2])==(0|A)?(0|n[o+4>>2])==(0|e):0)&1,S=r,0|o):(S=r,0|(o=0))}function Le(A,e,t){A|=0,t|=0;var r=0;(0|(e|=0))>0?(r=0|Ve(e,4),n[A>>2]=r,r||M(27835,27858,40,27872)):n[A>>2]=0,n[A+4>>2]=e,n[A+8>>2]=0,n[A+12>>2]=t}function Ie(A){var e,t,r,i=0,a=0,s=0,c=0;e=4+(A|=0)|0,t=A+12|0,r=A+8|0;A:for(;;){for(a=0|n[e>>2],i=0;;){if((0|i)>=(0|a))break A;if(s=0|n[A>>2],c=0|n[s+(i<<2)>>2])break;i=i+1|0}i=s+(~~(+l(+ +u(10,+ +(15-(0|n[t>>2])|0))*(+o[c>>3]+ +o[c+8>>3]))%+(0|a))>>>0<<2)|0,a=0|n[i>>2];e:do{if(0|a){if(s=c+32|0,(0|a)==(0|c))n[i>>2]=n[s>>2];else{if(!(i=0|n[(a=a+32|0)>>2]))break;for(;(0|i)!=(0|c);)if(!(i=0|n[(a=i+32|0)>>2]))break e;n[a>>2]=n[s>>2]}Ye(c),n[r>>2]=(0|n[r>>2])-1}}while(0)}Ye(0|n[A>>2])}function Re(A){var e,t=0,r=0;for(e=0|n[4+(A|=0)>>2],r=0;;){if((0|r)>=(0|e)){t=0,r=4;break}if(t=0|n[(0|n[A>>2])+(r<<2)>>2]){r=4;break}r=r+1|0}return 4==(0|r)?0|t:0}function _e(A,e){e|=0;var t=0,r=0,i=0,a=0;if(t=~~(+l(+ +u(10,+ +(15-(0|n[12+(A|=0)>>2])|0))*(+o[e>>3]+ +o[e+8>>3]))%+(0|n[A+4>>2]))>>>0,t=(0|n[A>>2])+(t<<2)|0,!(r=0|n[t>>2]))return 1;a=e+32|0;do{if((0|r)!=(0|e)){if(!(t=0|n[r+32>>2]))return 1;for(i=t;;){if((0|i)==(0|e)){i=8;break}if(!(t=0|n[i+32>>2])){t=1,i=10;break}r=i,i=t}if(8==(0|i)){n[r+32>>2]=n[a>>2];break}if(10==(0|i))return 0|t}else n[t>>2]=n[a>>2]}while(0);return Ye(e),n[(a=A+8|0)>>2]=(0|n[a>>2])-1,0}function He(A,e,t){A|=0,e|=0,t|=0;var r,i=0,a=0,s=0;(r=0|Ue(40))||M(27888,27858,98,27901),n[r>>2]=n[e>>2],n[r+4>>2]=n[e+4>>2],n[r+8>>2]=n[e+8>>2],n[r+12>>2]=n[e+12>>2],n[(a=r+16|0)>>2]=n[t>>2],n[a+4>>2]=n[t+4>>2],n[a+8>>2]=n[t+8>>2],n[a+12>>2]=n[t+12>>2],n[r+32>>2]=0,a=~~(+l(+ +u(10,+ +(15-(0|n[A+12>>2])|0))*(+o[e>>3]+ +o[e+8>>3]))%+(0|n[A+4>>2]))>>>0,a=(0|n[A>>2])+(a<<2)|0,i=0|n[a>>2];do{if(i){for(;!(0|oe(i,e)&&0|oe(i+16|0,t));)if(a=0|n[i+32>>2],!(0|n[(i=0|a?a:i)+32>>2])){s=10;break}if(10==(0|s)){n[i+32>>2]=r;break}return Ye(r),0|i}n[a>>2]=r}while(0);return n[(s=A+8|0)>>2]=1+(0|n[s>>2]),0|r}function ze(A,e,t){e|=0,t|=0;var r=0,i=0;if(i=~~(+l(+ +u(10,+ +(15-(0|n[12+(A|=0)>>2])|0))*(+o[e>>3]+ +o[e+8>>3]))%+(0|n[A+4>>2]))>>>0,!(i=0|n[(0|n[A>>2])+(i<<2)>>2]))return 0;if(!t){for(A=i;;){if(0|oe(A,e)){r=10;break}if(!(A=0|n[A+32>>2])){A=0,r=10;break}}if(10==(0|r))return 0|A}for(A=i;;){if(0|oe(A,e)&&0|oe(A+16|0,t)){r=10;break}if(!(A=0|n[A+32>>2])){A=0,r=10;break}}return 10==(0|r)?0|A:0}function Ge(A,e){e|=0;var t=0;if(t=~~(+l(+ +u(10,+ +(15-(0|n[12+(A|=0)>>2])|0))*(+o[e>>3]+ +o[e+8>>3]))%+(0|n[A+4>>2]))>>>0,!(A=0|n[(0|n[A>>2])+(t<<2)>>2]))return 0;for(;;){if(0|oe(A,e)){e=5;break}if(!(A=0|n[A+32>>2])){A=0,e=5;break}}return 5==(0|e)?0|A:0}function Oe(A){return 0|+ct(+(A=+A))}function Ue(A){A|=0;var e,t=0,r=0,o=0,i=0,a=0,s=0,l=0,c=0,u=0,f=0,d=0,g=0,h=0,m=0,p=0,b=0,v=0,w=0,y=0,x=0;e=S,S=S+16|0,g=e;do{if(A>>>0<245){if(A=(u=A>>>0<11?16:A+11&-8)>>>3,3&(r=(d=0|n[6981])>>>A))return o=0|n[(r=8+(A=27964+((t=(1&r^1)+A|0)<<1<<2)|0)|0)>>2],(0|(a=0|n[(i=o+8|0)>>2]))==(0|A)?n[6981]=d&~(1<>2]=A,n[r>>2]=a),x=t<<3,n[o+4>>2]=3|x,n[(x=o+x+4|0)>>2]=1|n[x>>2],S=e,0|i;if(u>>>0>(f=0|n[6983])>>>0){if(0|r)return t=((t=r<>>=l=t>>>12&16)>>>5&8)|l|(a=(t>>>=r)>>>2&4)|(A=(t>>>=a)>>>1&2)|(o=(t>>>=A)>>>1&1))+(t>>>o)|0)<<1<<2)|0)|0)>>2],(0|(r=0|n[(l=a+8|0)>>2]))==(0|t)?(A=d&~(1<>2]=t,n[A>>2]=r,A=d),s=(x=o<<3)-u|0,n[a+4>>2]=3|u,n[4+(i=a+u|0)>>2]=1|s,n[a+x>>2]=s,0|f&&(o=0|n[6986],r=27964+((t=f>>>3)<<1<<2)|0,A&(t=1<>2]:(n[6981]=A|t,t=r,A=r+8|0),n[A>>2]=o,n[t+12>>2]=o,n[o+8>>2]=t,n[o+12>>2]=r),n[6983]=s,n[6986]=i,S=e,0|l;if(a=0|n[6982]){for(r=(a&0-a)-1|0,r=c=0|n[28228+(((o=(r>>>=i=r>>>12&16)>>>5&8)|i|(s=(r>>>=o)>>>2&4)|(l=(r>>>=s)>>>1&2)|(c=(r>>>=l)>>>1&1))+(r>>>c)<<2)>>2],l=c,c=(-8&n[c+4>>2])-u|0;(A=0|n[r+16>>2])||(A=0|n[r+20>>2]);)r=A,l=(i=(s=(-8&n[A+4>>2])-u|0)>>>0>>0)?A:l,c=i?s:c;if((s=l+u|0)>>>0>l>>>0){i=0|n[l+24>>2],t=0|n[l+12>>2];do{if((0|t)==(0|l)){if(!(t=0|n[(A=l+20|0)>>2])&&!(t=0|n[(A=l+16|0)>>2])){r=0;break}for(;;)if(r=0|n[(o=t+20|0)>>2])t=r,A=o;else{if(!(r=0|n[(o=t+16|0)>>2]))break;t=r,A=o}n[A>>2]=0,r=t}else r=0|n[l+8>>2],n[r+12>>2]=t,n[t+8>>2]=r,r=t}while(0);do{if(0|i){if(t=0|n[l+28>>2],(0|l)==(0|n[(A=28228+(t<<2)|0)>>2])){if(n[A>>2]=r,!r){n[6982]=a&~(1<>2])==(0|l)?x:i+20)>>2]=r,!r)break;n[r+24>>2]=i,0|(t=0|n[l+16>>2])&&(n[r+16>>2]=t,n[t+24>>2]=r),0|(t=0|n[l+20>>2])&&(n[r+20>>2]=t,n[t+24>>2]=r)}}while(0);return c>>>0<16?(x=c+u|0,n[l+4>>2]=3|x,n[(x=l+x+4|0)>>2]=1|n[x>>2]):(n[l+4>>2]=3|u,n[s+4>>2]=1|c,n[s+c>>2]=c,0|f&&(o=0|n[6986],r=27964+((t=f>>>3)<<1<<2)|0,(t=1<>2]:(n[6981]=t|d,t=r,A=r+8|0),n[A>>2]=o,n[t+12>>2]=o,n[o+8>>2]=t,n[o+12>>2]=r),n[6983]=c,n[6986]=s),S=e,0|l+8}d=u}else d=u}else d=u}else if(A>>>0<=4294967231)if(u=-8&(A=A+11|0),o=0|n[6982]){i=0-u|0,c=(A>>>=8)?u>>>0>16777215?31:u>>>(7+(c=14-((l=(520192+(p=A<<(d=(A+1048320|0)>>>16&8))|0)>>>16&4)|d|(c=(245760+(p<<=l)|0)>>>16&2))+(p<>>15)|0)|0)&1|c<<1:0,r=0|n[28228+(c<<2)>>2];A:do{if(r)for(A=0,l=u<<(31==(0|c)?0:25-(c>>>1)|0),a=0;;){if((s=(-8&n[r+4>>2])-u|0)>>>0>>0){if(!s){A=r,i=0,p=65;break A}A=r,i=s}if(a=!(0|(p=0|n[r+20>>2]))|(0|p)==(0|(r=0|n[r+16+(l>>>31<<2)>>2]))?a:p,!r){r=a,p=61;break}l<<=1}else r=0,A=0,p=61}while(0);if(61==(0|p)){if(!(0|r)&!(0|A)){if(!(A=((A=2<>>=s=d>>>12&16)>>>5&8)|s|(l=(d>>>=a)>>>2&4)|(c=(d>>>=l)>>>1&2)|(r=(d>>>=c)>>>1&1))+(d>>>r)<<2)>>2]}r?p=65:(l=A,s=i)}if(65==(0|p))for(a=r;;){if(i=(r=(d=(-8&n[a+4>>2])-u|0)>>>0>>0)?d:i,A=r?a:A,(r=0|n[a+16>>2])||(r=0|n[a+20>>2]),!r){l=A,s=i;break}a=r}if(0|l&&s>>>0<((0|n[6983])-u|0)>>>0&&(f=l+u|0)>>>0>l>>>0){a=0|n[l+24>>2],t=0|n[l+12>>2];do{if((0|t)==(0|l)){if(!(t=0|n[(A=l+20|0)>>2])&&!(t=0|n[(A=l+16|0)>>2])){t=0;break}for(;;)if(r=0|n[(i=t+20|0)>>2])t=r,A=i;else{if(!(r=0|n[(i=t+16|0)>>2]))break;t=r,A=i}n[A>>2]=0}else x=0|n[l+8>>2],n[x+12>>2]=t,n[t+8>>2]=x}while(0);do{if(a){if(A=0|n[l+28>>2],(0|l)==(0|n[(r=28228+(A<<2)|0)>>2])){if(n[r>>2]=t,!t){o&=~(1<>2])==(0|l)?x:a+20)>>2]=t,!t)break;n[t+24>>2]=a,0|(A=0|n[l+16>>2])&&(n[t+16>>2]=A,n[A+24>>2]=t),(A=0|n[l+20>>2])&&(n[t+20>>2]=A,n[A+24>>2]=t)}}while(0);A:do{if(s>>>0<16)x=s+u|0,n[l+4>>2]=3|x,n[(x=l+x+4|0)>>2]=1|n[x>>2];else{if(n[l+4>>2]=3|u,n[f+4>>2]=1|s,n[f+s>>2]=s,t=s>>>3,s>>>0<256){r=27964+(t<<1<<2)|0,(A=0|n[6981])&(t=1<>2]:(n[6981]=A|t,t=r,A=r+8|0),n[A>>2]=f,n[t+12>>2]=f,n[f+8>>2]=t,n[f+12>>2]=r;break}if(t=28228+((r=(t=s>>>8)?s>>>0>16777215?31:s>>>(7+(r=14-((w=(520192+(x=t<<(y=(t+1048320|0)>>>16&8))|0)>>>16&4)|y|(r=(245760+(x<<=w)|0)>>>16&2))+(x<>>15)|0)|0)&1|r<<1:0)<<2)|0,n[f+28>>2]=r,n[4+(A=f+16|0)>>2]=0,n[A>>2]=0,!(o&(A=1<>2]=f,n[f+24>>2]=t,n[f+12>>2]=f,n[f+8>>2]=f;break}t=0|n[t>>2];e:do{if((-8&n[t+4>>2])!=(0|s)){for(o=s<<(31==(0|r)?0:25-(r>>>1)|0);A=0|n[(r=t+16+(o>>>31<<2)|0)>>2];){if((-8&n[A+4>>2])==(0|s)){t=A;break e}o<<=1,t=A}n[r>>2]=f,n[f+24>>2]=t,n[f+12>>2]=f,n[f+8>>2]=f;break A}}while(0);x=0|n[(y=t+8|0)>>2],n[x+12>>2]=f,n[y>>2]=f,n[f+8>>2]=x,n[f+12>>2]=t,n[f+24>>2]=0}}while(0);return S=e,0|l+8}d=u}else d=u;else d=-1}while(0);if((r=0|n[6983])>>>0>=d>>>0)return t=r-d|0,A=0|n[6986],t>>>0>15?(x=A+d|0,n[6986]=x,n[6983]=t,n[x+4>>2]=1|t,n[A+r>>2]=t,n[A+4>>2]=3|d):(n[6983]=0,n[6986]=0,n[A+4>>2]=3|r,n[(x=A+r+4|0)>>2]=1|n[x>>2]),S=e,0|A+8;if((s=0|n[6984])>>>0>d>>>0)return w=s-d|0,n[6984]=w,y=(x=0|n[6987])+d|0,n[6987]=y,n[y+4>>2]=1|w,n[x+4>>2]=3|d,S=e,0|x+8;if(0|n[7099]?A=0|n[7101]:(n[7101]=4096,n[7100]=4096,n[7102]=-1,n[7103]=-1,n[7104]=0,n[7092]=0,n[7099]=-16&g^1431655768,A=4096),l=d+48|0,(u=(a=A+(c=d+47|0)|0)&(i=0-A|0))>>>0<=d>>>0)return S=e,0;if(0|(A=0|n[7091])&&(g=(f=0|n[7089])+u|0)>>>0<=f>>>0|g>>>0>A>>>0)return S=e,0;A:do{if(4&n[7092])t=0,p=143;else{r=0|n[6987];e:do{if(r){for(o=28372;!((g=0|n[o>>2])>>>0<=r>>>0&&(g+(0|n[o+4>>2])|0)>>>0>r>>>0);){if(!(A=0|n[o+8>>2])){p=128;break e}o=A}if((t=a-s&i)>>>0<2147483647)if((0|(A=0|ut(0|t)))==((0|n[o>>2])+(0|n[o+4>>2])|0)){if(-1!=(0|A)){s=t,a=A,p=145;break A}}else o=A,p=136;else t=0}else p=128}while(0);do{if(128==(0|p))if(-1!=(0|(r=0|ut(0)))&&(t=r,m=(t=((m=(h=0|n[7100])-1|0)&t?(m+t&0-h)-t|0:0)+u|0)+(h=0|n[7089])|0,t>>>0>d>>>0&t>>>0<2147483647)){if(0|(g=0|n[7091])&&m>>>0<=h>>>0|m>>>0>g>>>0){t=0;break}if((0|(A=0|ut(0|t)))==(0|r)){s=t,a=r,p=145;break A}o=A,p=136}else t=0}while(0);do{if(136==(0|p)){if(r=0-t|0,!(l>>>0>t>>>0&t>>>0<2147483647&-1!=(0|o))){if(-1==(0|o)){t=0;break}s=t,a=o,p=145;break A}if((A=c-t+(A=0|n[7101])&0-A)>>>0>=2147483647){s=t,a=o,p=145;break A}if(-1==(0|ut(0|A))){ut(0|r),t=0;break}s=A+t|0,a=o,p=145;break A}}while(0);n[7092]=4|n[7092],p=143}}while(0);if(143==(0|p)&&u>>>0<2147483647&&!(-1==(0|(w=0|ut(0|u)))|1^(v=(b=(m=0|ut(0))-w|0)>>>0>(d+40|0)>>>0)|w>>>0>>0&-1!=(0|w)&-1!=(0|m)^1)&&(s=v?b:t,a=w,p=145),145==(0|p)){t=(0|n[7089])+s|0,n[7089]=t,t>>>0>(0|n[7090])>>>0&&(n[7090]=t),c=0|n[6987];A:do{if(c){for(t=28372;;){if((0|a)==((A=0|n[t>>2])+(r=0|n[t+4>>2])|0)){p=154;break}if(!(o=0|n[t+8>>2]))break;t=o}if(!(154!=(0|p)||(y=t+4|0,8&n[t+12>>2]))&&a>>>0>c>>>0&A>>>0<=c>>>0){n[y>>2]=r+s,y=c+(w=7&(w=c+8|0)?0-w&7:0)|0,w=(x=(0|n[6984])+s|0)-w|0,n[6987]=y,n[6984]=w,n[y+4>>2]=1|w,n[c+x+4>>2]=40,n[6988]=n[7103];break}for(a>>>0<(0|n[6985])>>>0&&(n[6985]=a),r=a+s|0,t=28372;;){if((0|n[t>>2])==(0|r)){p=162;break}if(!(A=0|n[t+8>>2]))break;t=A}if(162==(0|p)&&!(8&n[t+12>>2])){n[t>>2]=a,n[(f=t+4|0)>>2]=(0|n[f>>2])+s,u=(f=a+(7&(f=a+8|0)?0-f&7:0)|0)+d|0,l=(t=r+(7&(t=r+8|0)?0-t&7:0)|0)-f-d|0,n[f+4>>2]=3|d;e:do{if((0|c)==(0|t))x=(0|n[6984])+l|0,n[6984]=x,n[6987]=u,n[u+4>>2]=1|x;else{if((0|n[6986])==(0|t)){x=(0|n[6983])+l|0,n[6983]=x,n[6986]=u,n[u+4>>2]=1|x,n[u+x>>2]=x;break}if(1==(3&(A=0|n[t+4>>2]))){s=-8&A,o=A>>>3;t:do{if(A>>>0<256){if(A=0|n[t+8>>2],(0|(r=0|n[t+12>>2]))==(0|A)){n[6981]=n[6981]&~(1<>2]=r,n[r+8>>2]=A;break}a=0|n[t+24>>2],A=0|n[t+12>>2];do{if((0|A)==(0|t)){if(A=0|n[(o=4+(r=t+16|0)|0)>>2])r=o;else if(!(A=0|n[r>>2])){A=0;break}for(;;)if(o=0|n[(i=A+20|0)>>2])A=o,r=i;else{if(!(o=0|n[(i=A+16|0)>>2]))break;A=o,r=i}n[r>>2]=0}else x=0|n[t+8>>2],n[x+12>>2]=A,n[A+8>>2]=x}while(0);if(!a)break;o=28228+((r=0|n[t+28>>2])<<2)|0;do{if((0|n[o>>2])==(0|t)){if(n[o>>2]=A,0|A)break;n[6982]=n[6982]&~(1<>2])==(0|t)?x:a+20)>>2]=A,!A)break t}while(0);if(n[A+24>>2]=a,0|(o=0|n[(r=t+16|0)>>2])&&(n[A+16>>2]=o,n[o+24>>2]=A),!(r=0|n[r+4>>2]))break;n[A+20>>2]=r,n[r+24>>2]=A}while(0);t=t+s|0,i=s+l|0}else i=l;if(n[(t=t+4|0)>>2]=-2&n[t>>2],n[u+4>>2]=1|i,n[u+i>>2]=i,t=i>>>3,i>>>0<256){r=27964+(t<<1<<2)|0,(A=0|n[6981])&(t=1<>2]:(n[6981]=A|t,t=r,A=r+8|0),n[A>>2]=u,n[t+12>>2]=u,n[u+8>>2]=t,n[u+12>>2]=r;break}t=i>>>8;do{if(t){if(i>>>0>16777215){o=31;break}o=i>>>(7+(o=14-((w=(520192+(x=t<<(y=(t+1048320|0)>>>16&8))|0)>>>16&4)|y|(o=(245760+(x<<=w)|0)>>>16&2))+(x<>>15)|0)|0)&1|o<<1}else o=0}while(0);if(t=28228+(o<<2)|0,n[u+28>>2]=o,n[4+(A=u+16|0)>>2]=0,n[A>>2]=0,!((A=0|n[6982])&(r=1<>2]=u,n[u+24>>2]=t,n[u+12>>2]=u,n[u+8>>2]=u;break}t=0|n[t>>2];t:do{if((-8&n[t+4>>2])!=(0|i)){for(o=i<<(31==(0|o)?0:25-(o>>>1)|0);A=0|n[(r=t+16+(o>>>31<<2)|0)>>2];){if((-8&n[A+4>>2])==(0|i)){t=A;break t}o<<=1,t=A}n[r>>2]=u,n[u+24>>2]=t,n[u+12>>2]=u,n[u+8>>2]=u;break e}}while(0);x=0|n[(y=t+8|0)>>2],n[x+12>>2]=u,n[y>>2]=u,n[u+8>>2]=x,n[u+12>>2]=t,n[u+24>>2]=0}}while(0);return S=e,0|f+8}for(t=28372;!((A=0|n[t>>2])>>>0<=c>>>0&&(x=A+(0|n[t+4>>2])|0)>>>0>c>>>0);)t=0|n[t+8>>2];t=(A=(A=(i=x+-47|0)+(7&(A=i+8|0)?0-A&7:0)|0)>>>0<(i=c+16|0)>>>0?c:A)+8|0,y=a+(w=7&(w=a+8|0)?0-w&7:0)|0,w=(r=s+-40|0)-w|0,n[6987]=y,n[6984]=w,n[y+4>>2]=1|w,n[a+r+4>>2]=40,n[6988]=n[7103],n[(r=A+4|0)>>2]=27,n[t>>2]=n[7093],n[t+4>>2]=n[7094],n[t+8>>2]=n[7095],n[t+12>>2]=n[7096],n[7093]=a,n[7094]=s,n[7096]=0,n[7095]=t,t=A+24|0;do{y=t,n[(t=t+4|0)>>2]=7}while((y+8|0)>>>0>>0);if((0|A)!=(0|c)){if(a=A-c|0,n[r>>2]=-2&n[r>>2],n[c+4>>2]=1|a,n[A>>2]=a,t=a>>>3,a>>>0<256){r=27964+(t<<1<<2)|0,(A=0|n[6981])&(t=1<>2]:(n[6981]=A|t,t=r,A=r+8|0),n[A>>2]=c,n[t+12>>2]=c,n[c+8>>2]=t,n[c+12>>2]=r;break}if(r=28228+((o=(t=a>>>8)?a>>>0>16777215?31:a>>>(7+(o=14-((w=(520192+(x=t<<(y=(t+1048320|0)>>>16&8))|0)>>>16&4)|y|(o=(245760+(x<<=w)|0)>>>16&2))+(x<>>15)|0)|0)&1|o<<1:0)<<2)|0,n[c+28>>2]=o,n[c+20>>2]=0,n[i>>2]=0,!((t=0|n[6982])&(A=1<>2]=c,n[c+24>>2]=r,n[c+12>>2]=c,n[c+8>>2]=c;break}t=0|n[r>>2];e:do{if((-8&n[t+4>>2])!=(0|a)){for(o=a<<(31==(0|o)?0:25-(o>>>1)|0);A=0|n[(r=t+16+(o>>>31<<2)|0)>>2];){if((-8&n[A+4>>2])==(0|a)){t=A;break e}o<<=1,t=A}n[r>>2]=c,n[c+24>>2]=t,n[c+12>>2]=c,n[c+8>>2]=c;break A}}while(0);x=0|n[(y=t+8|0)>>2],n[x+12>>2]=c,n[y>>2]=c,n[c+8>>2]=x,n[c+12>>2]=t,n[c+24>>2]=0}}else!(0|(x=0|n[6985]))|a>>>0>>0&&(n[6985]=a),n[7093]=a,n[7094]=s,n[7096]=0,n[6990]=n[7099],n[6989]=-1,n[6994]=27964,n[6993]=27964,n[6996]=27972,n[6995]=27972,n[6998]=27980,n[6997]=27980,n[7e3]=27988,n[6999]=27988,n[7002]=27996,n[7001]=27996,n[7004]=28004,n[7003]=28004,n[7006]=28012,n[7005]=28012,n[7008]=28020,n[7007]=28020,n[7010]=28028,n[7009]=28028,n[7012]=28036,n[7011]=28036,n[7014]=28044,n[7013]=28044,n[7016]=28052,n[7015]=28052,n[7018]=28060,n[7017]=28060,n[7020]=28068,n[7019]=28068,n[7022]=28076,n[7021]=28076,n[7024]=28084,n[7023]=28084,n[7026]=28092,n[7025]=28092,n[7028]=28100,n[7027]=28100,n[7030]=28108,n[7029]=28108,n[7032]=28116,n[7031]=28116,n[7034]=28124,n[7033]=28124,n[7036]=28132,n[7035]=28132,n[7038]=28140,n[7037]=28140,n[7040]=28148,n[7039]=28148,n[7042]=28156,n[7041]=28156,n[7044]=28164,n[7043]=28164,n[7046]=28172,n[7045]=28172,n[7048]=28180,n[7047]=28180,n[7050]=28188,n[7049]=28188,n[7052]=28196,n[7051]=28196,n[7054]=28204,n[7053]=28204,n[7056]=28212,n[7055]=28212,y=a+(w=7&(w=a+8|0)?0-w&7:0)|0,w=(x=s+-40|0)-w|0,n[6987]=y,n[6984]=w,n[y+4>>2]=1|w,n[a+x+4>>2]=40,n[6988]=n[7103]}while(0);if((t=0|n[6984])>>>0>d>>>0)return w=t-d|0,n[6984]=w,y=(x=0|n[6987])+d|0,n[6987]=y,n[y+4>>2]=1|w,n[x+4>>2]=3|d,S=e,0|x+8}return n[(x=27920)>>2]=12,S=e,0}function Ye(A){var e=0,t=0,r=0,o=0,i=0,a=0,s=0,l=0;if(A|=0){t=A+-8|0,o=0|n[6985],l=t+(e=-8&(A=0|n[A+-4>>2]))|0;do{if(1&A)s=t,a=t;else{if(r=0|n[t>>2],!(3&A))return;if(i=r+e|0,(a=t+(0-r)|0)>>>0>>0)return;if((0|n[6986])==(0|a)){if(3&~(e=0|n[(A=l+4|0)>>2])){s=a,e=i;break}return n[6983]=i,n[A>>2]=-2&e,n[a+4>>2]=1|i,void(n[a+i>>2]=i)}if(t=r>>>3,r>>>0<256){if(A=0|n[a+8>>2],(0|(e=0|n[a+12>>2]))==(0|A)){n[6981]=n[6981]&~(1<>2]=e,n[e+8>>2]=A,s=a,e=i;break}o=0|n[a+24>>2],A=0|n[a+12>>2];do{if((0|A)==(0|a)){if(A=0|n[(t=4+(e=a+16|0)|0)>>2])e=t;else if(!(A=0|n[e>>2])){A=0;break}for(;;)if(t=0|n[(r=A+20|0)>>2])A=t,e=r;else{if(!(t=0|n[(r=A+16|0)>>2]))break;A=t,e=r}n[e>>2]=0}else s=0|n[a+8>>2],n[s+12>>2]=A,n[A+8>>2]=s}while(0);if(o){if(e=0|n[a+28>>2],(0|n[(t=28228+(e<<2)|0)>>2])==(0|a)){if(n[t>>2]=A,!A){n[6982]=n[6982]&~(1<>2])==(0|a)?s:o+20)>>2]=A,!A){s=a,e=i;break}n[A+24>>2]=o,0|(t=0|n[(e=a+16|0)>>2])&&(n[A+16>>2]=t,n[t+24>>2]=A),(e=0|n[e+4>>2])?(n[A+20>>2]=e,n[e+24>>2]=A,s=a,e=i):(s=a,e=i)}else s=a,e=i}}while(0);if(!(a>>>0>=l>>>0)&&1&(r=0|n[(A=l+4|0)>>2])){if(2&r)n[A>>2]=-2&r,n[s+4>>2]=1|e,n[a+e>>2]=e,o=e;else{if((0|n[6987])==(0|l)){if(l=(0|n[6984])+e|0,n[6984]=l,n[6987]=s,n[s+4>>2]=1|l,(0|s)!=(0|n[6986]))return;return n[6986]=0,void(n[6983]=0)}if((0|n[6986])==(0|l))return l=(0|n[6983])+e|0,n[6983]=l,n[6986]=a,n[s+4>>2]=1|l,void(n[a+l>>2]=l);o=(-8&r)+e|0,t=r>>>3;do{if(r>>>0<256){if(e=0|n[l+8>>2],(0|(A=0|n[l+12>>2]))==(0|e)){n[6981]=n[6981]&~(1<>2]=A,n[A+8>>2]=e;break}i=0|n[l+24>>2],A=0|n[l+12>>2];do{if((0|A)==(0|l)){if(A=0|n[(t=4+(e=l+16|0)|0)>>2])e=t;else if(!(A=0|n[e>>2])){t=0;break}for(;;)if(t=0|n[(r=A+20|0)>>2])A=t,e=r;else{if(!(t=0|n[(r=A+16|0)>>2]))break;A=t,e=r}n[e>>2]=0,t=A}else t=0|n[l+8>>2],n[t+12>>2]=A,n[A+8>>2]=t,t=A}while(0);if(0|i){if(A=0|n[l+28>>2],(0|n[(e=28228+(A<<2)|0)>>2])==(0|l)){if(n[e>>2]=t,!t){n[6982]=n[6982]&~(1<>2])==(0|l)?r:i+20)>>2]=t,!t)break;n[t+24>>2]=i,0|(e=0|n[(A=l+16|0)>>2])&&(n[t+16>>2]=e,n[e+24>>2]=t),0|(A=0|n[A+4>>2])&&(n[t+20>>2]=A,n[A+24>>2]=t)}}while(0);if(n[s+4>>2]=1|o,n[a+o>>2]=o,(0|s)==(0|n[6986]))return void(n[6983]=o)}if(A=o>>>3,o>>>0<256)return t=27964+(A<<1<<2)|0,(e=0|n[6981])&(A=1<>2]:(n[6981]=e|A,A=t,e=t+8|0),n[e>>2]=s,n[A+12>>2]=s,n[s+8>>2]=A,void(n[s+12>>2]=t);A=28228+((r=(A=o>>>8)?o>>>0>16777215?31:o>>>(7+(r=14-((i=(520192+(l=A<<(a=(A+1048320|0)>>>16&8))|0)>>>16&4)|a|(r=(245760+(l<<=i)|0)>>>16&2))+(l<>>15)|0)|0)&1|r<<1:0)<<2)|0,n[s+28>>2]=r,n[s+20>>2]=0,n[s+16>>2]=0,e=0|n[6982],t=1<>2];e:do{if((-8&n[A+4>>2])!=(0|o)){for(r=o<<(31==(0|r)?0:25-(r>>>1)|0);e=0|n[(t=A+16+(r>>>31<<2)|0)>>2];){if((-8&n[e+4>>2])==(0|o)){A=e;break e}r<<=1,A=e}n[t>>2]=s,n[s+24>>2]=A,n[s+12>>2]=s,n[s+8>>2]=s;break A}}while(0);l=0|n[(a=A+8|0)>>2],n[l+12>>2]=s,n[a>>2]=s,n[s+8>>2]=l,n[s+12>>2]=A,n[s+24>>2]=0}else n[6982]=e|t,n[A>>2]=s,n[s+24>>2]=A,n[s+12>>2]=s,n[s+8>>2]=s}while(0);if(l=(0|n[6989])-1|0,n[6989]=l,!(0|l)){for(A=28380;A=0|n[A>>2];)A=A+8|0;n[6989]=-1}}}}function Ve(A,e){e|=0;var t=0;return(A|=0)?(t=0|w(e,A),(e|A)>>>0>65535&&(t=((t>>>0)/(A>>>0)|0)==(0|e)?t:-1)):t=0,(A=0|Ue(t))&&3&n[A+-4>>2]?(lt(0|A,0,0|t),0|A):0|A}function We(A,e,t,r){return 0|(C((e|=0)+(r|=0)+((t=(A|=0)+(t|=0)>>>0)>>>0>>0|0)>>>0|0),t)}function Ze(A,e,t,r){return 0|(C(0|(r=(e|=0)-(r|=0)-((t|=0)>>>0>(A|=0)>>>0|0)>>>0)),A-t>>>0)}function Ke(A){return 0|((A|=0)?31-(0|k(A^A-1)):32)}function Je(A,e,t,r,o){o|=0;var i=0,a=0,s=0,l=0,c=0,u=0,f=0,d=0,g=0,h=0;if(u=A|=0,a=t|=0,s=d=r|=0,!(c=l=e|=0))return i=!!(0|o),s?i?(n[o>>2]=0|A,n[o+4>>2]=0&e,o=0,0|(C(0|(d=0)),o)):(o=0,0|(C(0|(d=0)),o)):(i&&(n[o>>2]=(u>>>0)%(a>>>0),n[o+4>>2]=0),o=(u>>>0)/(a>>>0)>>>0,0|(C(0|(d=0)),o));i=!(0|s);do{if(a){if(!i){if((i=(0|k(0|s))-(0|k(0|c))|0)>>>0<=31){a=f=i+1|0,A=u>>>(f>>>0)&(e=i-31>>31)|c<<(s=31-i|0),e&=c>>>(f>>>0),i=0,s=u<>2]=0|A,n[o+4>>2]=l|0&e,o=0,0|(C(0|(d=0)),o)):(o=0,0|(C(0|(d=0)),o))}if((i=a-1|0)&a){a=s=33+(0|k(0|a))-(0|k(0|c))|0,A=(f=32-s|0)-1>>31&c>>>((g=s-32|0)>>>0)|(c<>>(s>>>0))&(e=g>>31),e&=c>>>(s>>>0),i=u<<(h=64-s|0)&(l=f>>31),s=(c<>>(g>>>0))&l|u<>31;break}return 0|o&&(n[o>>2]=i&u,n[o+4>>2]=0),1==(0|a)?(h=0|A,0|(C(0|(g=l|0&e)),h)):(g=c>>>((h=0|Ke(0|a))>>>0)|0,h=c<<32-h|u>>>(h>>>0),0|(C(0|g),h))}if(i)return 0|o&&(n[o>>2]=(c>>>0)%(a>>>0),n[o+4>>2]=0),h=(c>>>0)/(a>>>0)>>>0,0|(C(0|(g=0)),h);if(!u)return 0|o&&(n[o>>2]=0,n[o+4>>2]=(c>>>0)%(s>>>0)),h=(c>>>0)/(s>>>0)>>>0,0|(C(0|(g=0)),h);if(!((i=s-1|0)&s))return 0|o&&(n[o>>2]=0|A,n[o+4>>2]=i&c|0&e),g=0,h=c>>>((0|Ke(0|s))>>>0),0|(C(0|g),h);if((i=(0|k(0|s))-(0|k(0|c))|0)>>>0<=30){a=e=i+1|0,A=c<<(s=31-i|0)|u>>>(e>>>0),e=c>>>(e>>>0),i=0,s=u<>2]=0|A,n[o+4>>2]=l|0&e,h=0,0|(C(0|(g=0)),h)):(h=0,0|(C(0|(g=0)),h))}while(0);if(a){c=0|We(0|(f=0|t),0|(u=d|0&r),-1,-1),t=0|B(),l=s,s=0;do{r=l,l=i>>>31|l<<1,i=s|i<<1,Ze(0|c,0|t,0|(r=A<<1|r>>>31),0|(d=A>>>31|e<<1)),s=1&(g=(h=0|B())>>31|((0|h)<0?-1:0)<<1),A=0|Ze(0|r,0|d,g&f|0,(((0|h)<0?-1:0)>>31|((0|h)<0?-1:0)<<1)&u),e=0|B(),a=a-1|0}while(0|a);c=l,l=0}else c=s,l=0,s=0;return a=0,0|o&&(n[o>>2]=A,n[o+4>>2]=e),h=i<<1&-2|s,0|(C(0|(g=(0|i)>>>31|(c|a)<<1|l)),h)}function Xe(A,e,t,r){var n,o,i,a,s;return t|=0,o=(r|=0)>>31|((0|r)<0?-1:0)<<1,n=((0|r)<0?-1:0)>>31|((0|r)<0?-1:0)<<1,i=0|Ze((s=(e|=0)>>31|((0|e)<0?-1:0)<<1)^(A|=0),(a=((0|e)<0?-1:0)>>31|((0|e)<0?-1:0)<<1)^e,0|s,0|a),A=o^s,e=n^a,0|Ze((0|Je(i,0|B(),0|Ze(o^t|0,n^r|0,0|o,0|n),0|B(),0))^A,(0|B())^e,0|A,0|e)}function qe(A,e,t,r){var n,o;return e|=0,r|=0,t=0|function(A,e){var t,r,n,o=0;return A=((t=0|w(o=65535&(e|=0),n=65535&(A|=0)))>>>16)+(0|w(o,r=A>>>16))|0,e=0|w(o=e>>>16,n),0|(C((A>>>16)+(0|w(o,r))+(((65535&A)+e|0)>>>16)|0),A+e<<16|65535&t)}(n=A|=0,o=t|=0),A=0|B(),0|(C((0|w(e,o))+(0|w(r,n))+A|0&A),t)}function $e(A,e,t,r){var o,i,a,s,l,c;return t|=0,o=S,S=S+16|0,s=0|o,c=(r|=0)>>31|((0|r)<0?-1:0)<<1,l=((0|r)<0?-1:0)>>31|((0|r)<0?-1:0)<<1,Je(A=0|Ze((a=(e|=0)>>31|((0|e)<0?-1:0)<<1)^(A|=0),(i=((0|e)<0?-1:0)>>31|((0|e)<0?-1:0)<<1)^e,0|a,0|i),e=0|B(),0|Ze(c^t|0,l^r|0,0|c,0|l),0|B(),s),r=0|Ze(n[s>>2]^a|0,n[s+4>>2]^i|0,0|a,0|i),t=0|B(),S=o,0|(C(0|t),r)}function At(A,e,t,r){var o,i;return i=S,S=S+16|0,Je(A|=0,e|=0,t|=0,r|=0,o=0|i),S=i,0|(C(0|n[o+4>>2]),n[o>>2])}function et(A,e,t){return A|=0,e|=0,(0|(t|=0))<32?(C(e>>t|0),A>>>t|(e&(1<>t-32)}function tt(A,e,t){return A|=0,e|=0,(0|(t|=0))<32?(C(e>>>t|0),A>>>t|(e&(1<>>t-32|0)}function rt(A,e,t){return A|=0,(0|(t|=0))<32?(C((e|=0)<>>32-t),A<=0?+s(A+.5):+v(A-.5)}function st(A,e,t){A|=0,e|=0;var o,i,a=0;if((0|(t|=0))>=8192)return Q(0|A,0|e,0|t),0|A;if(i=0|A,o=A+t|0,(3&A)==(3&e)){for(;3&A;){if(!t)return 0|i;r[0|A]=0|r[0|e],A=A+1|0,e=e+1|0,t=t-1|0}for(a=(t=-4&o)-64|0;(0|A)<=(0|a);)n[A>>2]=n[e>>2],n[A+4>>2]=n[e+4>>2],n[A+8>>2]=n[e+8>>2],n[A+12>>2]=n[e+12>>2],n[A+16>>2]=n[e+16>>2],n[A+20>>2]=n[e+20>>2],n[A+24>>2]=n[e+24>>2],n[A+28>>2]=n[e+28>>2],n[A+32>>2]=n[e+32>>2],n[A+36>>2]=n[e+36>>2],n[A+40>>2]=n[e+40>>2],n[A+44>>2]=n[e+44>>2],n[A+48>>2]=n[e+48>>2],n[A+52>>2]=n[e+52>>2],n[A+56>>2]=n[e+56>>2],n[A+60>>2]=n[e+60>>2],A=A+64|0,e=e+64|0;for(;(0|A)<(0|t);)n[A>>2]=n[e>>2],A=A+4|0,e=e+4|0}else for(t=o-4|0;(0|A)<(0|t);)r[0|A]=0|r[0|e],r[A+1|0]=0|r[e+1|0],r[A+2|0]=0|r[e+2|0],r[A+3|0]=0|r[e+3|0],A=A+4|0,e=e+4|0;for(;(0|A)<(0|o);)r[0|A]=0|r[0|e],A=A+1|0,e=e+1|0;return 0|i}function lt(A,e,t){e|=0;var o,i=0,a=0,s=0;if(o=(A|=0)+(t|=0)|0,e&=255,(0|t)>=67){for(;3&A;)r[0|A]=e,A=A+1|0;for(s=e|e<<8|e<<16|e<<24,a=(i=-4&o)-64|0;(0|A)<=(0|a);)n[A>>2]=s,n[A+4>>2]=s,n[A+8>>2]=s,n[A+12>>2]=s,n[A+16>>2]=s,n[A+20>>2]=s,n[A+24>>2]=s,n[A+28>>2]=s,n[A+32>>2]=s,n[A+36>>2]=s,n[A+40>>2]=s,n[A+44>>2]=s,n[A+48>>2]=s,n[A+52>>2]=s,n[A+56>>2]=s,n[A+60>>2]=s,A=A+64|0;for(;(0|A)<(0|i);)n[A>>2]=s,A=A+4|0}for(;(0|A)<(0|o);)r[0|A]=e,A=A+1|0;return o-t|0}function ct(A){return(A=+A)>=0?+s(A+.5):+v(A-.5)}function ut(A){var e,t,r;return A|=0,r=0|E(),(0|A)>0&(0|(e=(t=0|n[a>>2])+A|0))<(0|t)|(0|e)<0?(N(0|e),D(12),-1):(0|e)>(0|r)&&!(0|j(0|e))?(D(12),-1):(n[a>>2]=e,0|t)}return{___divdi3:Xe,___muldi3:qe,___remdi3:$e,___uremdi3:At,_areNeighborCells:function(A,e,t,r,o){o|=0;var i,a,s,l=0,c=0,u=0,f=0;if(s=S,S=S+64|0,a=s,i=s+56|0,!(!0&134217728==(2013265920&(e|=0))&!0&134217728==(2013265920&(r|=0))))return S=s,5;if((0|(A|=0))==(0|(t|=0))&(0|e)==(0|r))return n[o>>2]=0,S=s,0;if(c=0|tt(0|A,0|e,52),B(),c&=15,f=0|tt(0|t,0|r,52),B(),(0|c)!=(15&f))return S=s,12;if(l=c+-1|0,c>>>0>1){RA(A,e,l,a),RA(t,r,l,i),u=0|n[(f=a)>>2],f=0|n[f+4>>2];A:do{if((0|u)==(0|n[i>>2])&&(0|f)==(0|n[i+4>>2])){l=0|tt(0|A,0|e,0|(c=3*(15^c)|0)),B(),l&=7,c=0|tt(0|t,0|r,0|c),B(),c&=7;do{if(!(0|l)|!(0|c))n[o>>2]=1,l=0;else if(7==(0|l))l=5;else{if(1==(0|l)|1==(0|c)&&0|HA(u,f)){l=5;break}if((0|n[15536+(l<<2)>>2])!=(0|c)&&(0|n[15568+(l<<2)>>2])!=(0|c))break A;n[o>>2]=1,l=0}}while(0);return S=s,0|l}}while(0)}c=(l=a)+56|0;do{n[l>>2]=0,l=l+4|0}while((0|l)<(0|c));return F(A,e,1,a),l=(0|n[(e=a)>>2])==(0|t)&&(0|n[e+4>>2])==(0|r)||(0|n[(e=a+8|0)>>2])==(0|t)&&(0|n[e+4>>2])==(0|r)||(0|n[(e=a+16|0)>>2])==(0|t)&&(0|n[e+4>>2])==(0|r)||(0|n[(e=a+24|0)>>2])==(0|t)&&(0|n[e+4>>2])==(0|r)||(0|n[(e=a+32|0)>>2])==(0|t)&&(0|n[e+4>>2])==(0|r)||(0|n[(e=a+40|0)>>2])==(0|t)&&(0|n[e+4>>2])==(0|r)?1:1&((0|n[(l=a+48|0)>>2])==(0|t)?(0|n[l+4>>2])==(0|r):0),n[o>>2]=l,S=s,0},_bitshift64Ashr:et,_bitshift64Lshr:tt,_bitshift64Shl:rt,_calloc:Ve,_cellAreaKm2:function(A,e,t){return 0|(A=0|ue(A|=0,e|=0,t|=0))||(o[t>>3]=6371.007180918475*+o[t>>3]*6371.007180918475),0|A},_cellAreaM2:function(A,e,t){return 0|(A=0|ue(A|=0,e|=0,t|=0))||(o[t>>3]=6371.007180918475*+o[t>>3]*6371.007180918475*1e3*1e3),0|A},_cellAreaRads2:ue,_cellToBoundary:$A,_cellToCenterChild:GA,_cellToChildPos:function(A,e,t,r){t|=0,r|=0;var o,i=0,a=0,s=0,l=0,c=0,u=0,f=0,d=0,g=0,h=0,m=0,p=0,b=0,v=0;if(o=S,S=S+16|0,b=o,v=0|tt(0|(A|=0),0|(e|=0),52),B(),t>>>0>15)return S=o,4;if((0|(v&=15))<(0|t))return S=o,12;if((0|v)!=(0|t))if(a=0|rt(0|t,0,52),a|=A,l=B()|-15728641&e,(0|v)>(0|t)){c=t;do{p=0|rt(7,0,3*(14-c|0)|0),c=c+1|0,a|=p,l=0|B()|l}while((0|c)<(0|v));p=a}else p=a;else p=A,l=e;m=0|tt(0|p,0|l,45),B();A:do{if(0|z(127&m)){if(c=0|tt(0|p,0|l,52),B(),0|(c&=15))for(a=1;;){if(!(!((m=0|rt(7,0,3*(15-a|0)|0))&p)&!((0|B())&l))){u=33;break A}if(!(a>>>0>>0))break;a=a+1|0}if(n[(m=r)>>2]=0,n[m+4>>2]=0,(0|v)>(0|t)){for(m=-15728641&e,h=v;;){if(g=h,(h=h+-1|0)>>>0>15|(0|v)<(0|h)){u=19;break}if((0|v)!=(0|h))if(a=0|rt(0|h,0,52),a|=A,c=0|B()|m,(0|v)<(0|g))d=a;else{u=h;do{d=0|rt(7,0,3*(14-u|0)|0),u=u+1|0,a|=d,c=0|B()|c}while((0|u)<(0|v));d=a}else d=A,c=e;if(f=0|tt(0|d,0|c,45),B(),0|z(127&f)){f=0|tt(0|d,0|c,52),B(),f&=15;e:do{if(f)for(u=1;;){if(a=0|tt(0|d,0|c,3*(15-u|0)|0),B(),0|(a&=7))break e;if(!(u>>>0>>0)){a=0;break}u=u+1|0}else a=0}while(0);a=1&!(0|a)}else a=0;if(c=0|tt(0|A,0|e,3*(15-g|0)|0),B(),7==(0|(c&=7))){i=5,u=42;break}if(1==(0|c)&(a=!!(0|a))){i=5,u=42;break}if(0|(d=c+((!!(0|c)&a)<<31>>31)|0)&&(u=0|be(7,0,u=v-g|0,((0|u)<0)<<31>>31),f=0|B(),a?(a=0|We(0|(a=0|qe(0|u,0|f,5,0)),0|B(),-5,-1),a=0|We(0|(a=0|Xe(0|a,0|B(),6,0)),0|B(),1,0),c=0|B()):(a=u,c=f),g=0|We(0|a,0|c,0|(g=0|qe(0|u,0|f,0|(g=d+-1|0),((0|g)<0)<<31>>31)),0|B()),f=0|We(0|g,0|(d=0|B()),0|n[(f=r)>>2],0|n[f+4>>2]),d=0|B(),n[(g=r)>>2]=f,n[g+4>>2]=d),(0|h)<=(0|t)){u=37;break}}if(19==(0|u))M(27795,27122,1367,27158);else{if(37==(0|u)){i=0|n[(s=r)+4>>2],s=0|n[s>>2];break}if(42==(0|u))return S=o,0|i}}else i=0,s=0}else u=33}while(0);A:do{if(33==(0|u)){if(n[(m=r)>>2]=0,n[m+4>>2]=0,(0|v)>(0|t)){for(a=v;;){if(i=0|tt(0|A,0|e,3*(15-a|0)|0),B(),7==(0|(i&=7))){i=5;break}if(i=0|qe(0|(s=0|be(7,0,s=v-a|0,((0|s)<0)<<31>>31)),0|B(),0|i,0),s=0|B(),s=0|We(0|n[(m=r)>>2],0|n[m+4>>2],0|i,0|s),i=0|B(),n[(m=r)>>2]=s,n[m+4>>2]=i,(0|(a=a+-1|0))<=(0|t))break A}return S=o,0|i}i=0,s=0}}while(0);return 0|_A(p,l,v,b)&&M(27795,27122,1327,27173),((0|i)>-1|-1==(0|i)&s>>>0>4294967295)&((0|(b=0|n[(v=b)+4>>2]))>(0|i)|((0|b)==(0|i)?(0|n[v>>2])>>>0>s>>>0:0))?(S=o,0|(v=0)):(M(27795,27122,1407,27158),0)},_cellToChildren:function(A,e,t,r){r|=0;var o,i,a=0,s=0;if(i=S,S=S+16|0,ee(o=i,A|=0,e|=0,t|=0),!(0|(A=0|n[(e=o)>>2]))&!(0|(e=0|n[e+4>>2])))return S=i,0;a=0,t=0;do{n[(s=r+(a<<3)|0)>>2]=A,n[s+4>>2]=e,a=0|We(0|a,0|t,1,0),t=0|B(),re(o),A=0|n[(s=o)>>2],e=0|n[s+4>>2]}while(!(!(0|A)&!(0|e)));return S=i,0},_cellToChildrenSize:_A,_cellToLatLng:qA,_cellToLocalIj:function(A,e,t,r,o,i){var a,s;return A|=0,i|=0,s=S,S=S+16|0,a=s,(o|=0)?A=15:(A=0|me(A,e|=0,t|=0,r|=0,a))||(function(A,e){var t;e|=0,t=0|n[8+(A|=0)>>2],n[e>>2]=(0|n[A>>2])-t,n[e+4>>2]=(0|n[A+4>>2])-t}(a,i),A=0),S=s,0|A},_cellToParent:RA,_cellToVertex:Pe,_cellToVertexes:function(A,e,t){t|=0;var r,o=0,i=0;return i=!(0|HA(A|=0,e|=0)),r=!(0|(o=0|Pe(A,e,0,t))),i?r?0|(o=0|Pe(A,e,1,t+8|0))||0|(o=0|Pe(A,e,2,t+16|0))||0|(o=0|Pe(A,e,3,t+24|0))||(o=0|Pe(A,e,4,t+32|0))?0|(i=o):0|Pe(A,e,5,t+40|0):0|(i=o):r?0|(o=0|Pe(A,e,1,t+8|0))||0|(o=0|Pe(A,e,2,t+16|0))||0|(o=0|Pe(A,e,3,t+24|0))||0|(o=0|Pe(A,e,4,t+32|0))?0|(i=o):(n[(i=t+40|0)>>2]=0,n[i+4>>2]=0,0|(i=0)):0|(i=o)},_cellsToDirectedEdge:function(A,e,t,r,o){return o|=0,7==(0|(t=0|_(A|=0,e|=0,t|=0,r|=0)))?0|(o=11):(r=0|rt(0|t,0,56),e=-2130706433&e|B()|268435456,n[o>>2]=A|r,n[o+4>>2]=e,0|(o=0))},_cellsToLinkedMultiPolygon:function(A,e,t){t|=0;var r,i,a,s=0;if(a=S,S=S+32|0,r=a,0|(A=0|function(A,e,t){A|=0,t|=0;var r,o,i=0,a=0,s=0,l=0,c=0,u=0;if(o=S,S=S+176|0,r=o,(0|(e|=0))<1)return Le(t,0,0),S=o,0;for(c=0|tt(0|n[(c=A)>>2],0|n[c+4>>2],52),B(),Le(t,(0|e)>6?e:6,15&c),c=0;!(0|(i=0|$A(0|n[(i=A+(c<<3)|0)>>2],0|n[i+4>>2],r)));){if((0|(i=0|n[r>>2]))>0){l=0;do{s=r+8+(l<<4)|0,(a=0|ze(t,i=r+8+((0|(l=l+1|0))%(0|i)<<4)|0,s))?_e(t,a):He(t,s,i),i=0|n[r>>2]}while((0|l)<(0|i))}if((0|(c=c+1|0))>=(0|e)){i=0,u=13;break}}return 13==(0|u)?(S=o,0|i):(Ie(t),S=o,0|(u=i))}(A|=0,e|=0,i=a+16|0)))return S=a,0|A;if(n[t>>2]=0,n[t+4>>2]=0,n[t+8>>2]=0,0|(A=0|Re(i)))do{e=0|fe(t);do{de(e,A),s=A+16|0,n[r>>2]=n[s>>2],n[r+4>>2]=n[s+4>>2],n[r+8>>2]=n[s+8>>2],n[r+12>>2]=n[s+12>>2],_e(i,A),A=0|Ge(i,r)}while(0|A);A=0|Re(i)}while(0|A);return Ie(i),(A=0|function(A){var e,t,r=0,i=0,a=0,s=0,c=0,u=0,f=0,d=0,g=0,h=0,m=0,p=0,b=0,v=0,w=0,y=0,x=0,k=0,C=0,B=0,D=0,E=0,Q=0,j=0,N=0,S=0,F=0,P=0,T=0,L=0;if(0|n[(s=(A|=0)+8|0)>>2])return 1;if(!(a=0|n[A>>2]))return 0;r=a,i=0;do{i=i+1|0,r=0|n[r+8>>2]}while(0|r);if(i>>>0<2)return 0;(t=0|Ue(i<<2))||M(27396,27235,317,27415),(e=0|Ue(i<<5))||M(27437,27235,321,27415),n[A>>2]=0,n[(E=A+4|0)>>2]=0,n[s>>2]=0,i=0,P=0,D=0,m=0;A:for(;;){if(h=0|n[a>>2]){c=0,u=h;do{if(d=+o[u+8>>3],r=u,u=0|n[u+16>>2],f=+o[(s=(g=!(0|u))?h:u)+8>>3],+l(+(d-f))>3.141592653589793){L=14;break}c+=(f-d)*(+o[r>>3]+ +o[s>>3])}while(!g);if(14==(0|L)){L=0,c=0,r=h;do{B=+o[r+8>>3],S=0|n[(F=r+16|0)>>2],C=+o[(S=0|S?S:h)+8>>3],c+=(+o[r>>3]+ +o[S>>3])*((C<0?C+6.283185307179586:C)-(B<0?B+6.283185307179586:B)),r=0|n[(0|r?F:a)>>2]}while(0|r)}c>0?(n[t+(P<<2)>>2]=a,P=P+1|0,s=D,r=m):L=19}else L=19;if(19==(0|L)){L=0;do{if(!i){if(m){s=E,u=m+8|0,r=a,i=A;break}if(0|n[A>>2]){L=27;break A}s=E,u=A,r=a,i=A;break}if(0|n[(r=i+8|0)>>2]){L=21;break A}if(!(i=0|Ve(1,12))){L=23;break A}n[r>>2]=i,s=i+4|0,u=i,r=m}while(0);if(n[u>>2]=a,n[s>>2]=a,u=e+(D<<5)|0,g=0|n[a>>2]){for(o[(h=e+(D<<5)+8|0)>>3]=17976931348623157e292,o[(m=e+(D<<5)+24|0)>>3]=17976931348623157e292,o[u>>3]=-17976931348623157e292,o[(p=e+(D<<5)+16|0)>>3]=-17976931348623157e292,x=17976931348623157e292,k=-17976931348623157e292,s=0,b=g,d=17976931348623157e292,w=17976931348623157e292,y=-17976931348623157e292,f=-17976931348623157e292;c=+o[b>>3],B=+o[b+8>>3],b=0|n[b+16>>2],C=+o[((v=!(0|b))?g:b)+8>>3],c>3]=c,d=c),B>3]=B,w=B),c>y?o[u>>3]=c:c=y,B>f&&(o[p>>3]=B,f=B),x=B>0&Bk?B:k,s|=+l(+(B-C))>3.141592653589793,!v;)y=c;s&&(o[p>>3]=k,o[m>>3]=x)}else n[u>>2]=0,n[u+4>>2]=0,n[u+8>>2]=0,n[u+12>>2]=0,n[u+16>>2]=0,n[u+20>>2]=0,n[u+24>>2]=0,n[u+28>>2]=0;s=D+1|0}if(a=0|n[(F=a+8|0)>>2],n[F>>2]=0,!a){L=45;break}D=s,m=r}if(21==(0|L))M(27213,27235,35,27247);else if(23==(0|L))M(27267,27235,37,27247);else if(27==(0|L))M(27310,27235,61,27333);else if(45==(0|L)){A:do{if((0|P)>0){for(F=!(0|s),N=s<<2,S=!(0|A),j=0,r=0;;){if(Q=0|n[t+(j<<2)>>2],F)L=73;else{if(!(D=0|Ue(N))){L=50;break}if(!(E=0|Ue(N))){L=52;break}e:do{if(S)i=0;else{for(s=0,i=0,u=A;a=e+(s<<5)|0,0|he(0|n[u>>2],a,0|n[Q>>2])?(n[D+(i<<2)>>2]=u,n[E+(i<<2)>>2]=a,v=i+1|0):v=i,u=0|n[u+8>>2];)s=s+1|0,i=v;if((0|v)>0)if(a=0|n[D>>2],1==(0|v))i=a;else for(p=0,b=-1,i=a,m=a;;){for(g=0|n[m>>2],a=0,u=0;h=(0|(s=0|n[n[D+(u<<2)>>2]>>2]))==(0|g)?a:a+(1&he(s,0|n[E+(u<<2)>>2],0|n[g>>2]))|0,(0|(u=u+1|0))!=(0|v);)a=h;if(i=(s=(0|h)>(0|b))?m:i,(0|(a=p+1|0))==(0|v))break e;p=a,b=s?h:b,m=0|n[D+(a<<2)>>2]}else i=0}}while(0);if(Ye(D),Ye(E),i){if(a=0|n[(s=i+4|0)>>2])i=a+8|0;else if(0|n[i>>2]){L=70;break}n[i>>2]=Q,n[s>>2]=Q}else L=73}if(73==(0|L)){if(L=0,0|(r=0|n[Q>>2]))do{E=r,r=0|n[r+16>>2],Ye(E)}while(0|r);Ye(Q),r=1}if((0|(j=j+1|0))>=(0|P)){T=r;break A}}50==(0|L)?M(27452,27235,249,27471):52==(0|L)?M(27490,27235,252,27471):70==(0|L)&&M(27310,27235,61,27333)}else T=0}while(0);return Ye(t),Ye(e),0|T}return 0}(t))?(ge(t),S=a,0|(s=A)):(S=a,0|(s=0))},_childPosToCell:function(A,e,t,r,o,i){A|=0,e|=0,i|=0;var a,s=0,l=0,c=0,u=0,f=0,d=0,g=0,h=0,m=0;if(a=S,S=S+16|0,s=a,(o|=0)>>>0>15)return S=a,4;if(l=0|tt(0|(t|=0),0|(r|=0),52),B(),(0|(l&=15))>(0|o))return S=a,12;if(0|_A(t,r,o,s)&&M(27795,27122,1327,27173),!(((0|e)>-1|-1==(0|e)&A>>>0>4294967295)&((0|(u=0|n[(f=s)+4>>2]))>(0|e)|((0|u)==(0|e)?(0|n[f>>2])>>>0>A>>>0:0))))return S=a,2;f=o-l|0,o=0|rt(0|o,0,52),c=B()|-15728641&r,n[(u=i)>>2]=o|t,n[u+4>>2]=c,u=0|tt(0|t,0|r,45),B();A:do{if(0|z(127&u)){if(0|l)for(s=1;;){if(!(!((u=0|rt(7,0,3*(15-s|0)|0))&t)&!((0|B())&r)))break A;if(!(s>>>0>>0))break;s=s+1|0}if((0|f)<1)return S=a,0;for(u=15^l,r=-1,c=1,s=1;;){l=0|be(7,0,l=f-c|0,((0|l)<0)<<31>>31),t=0|B();do{if(s){if(s=0|Xe(0|(s=0|We(0|(s=0|qe(0|l,0|t,5,0)),0|B(),-5,-1)),0|B(),6,0),(0|e)>(0|(o=0|B()))|(0|e)==(0|o)&A>>>0>s>>>0){e=0|Ze(0|(e=0|We(0|A,0|e,-1,-1)),0|B(),0|s,0|o),s=0|B(),h=0|n[(d=i)>>2],d=0|n[d+4>>2],g=0|rt(7,0,0|(m=3*(u+r|0)|0)),d&=~B(),m=0|rt(0|(o=0|We(0|(r=0|Xe(0|e,0|s,0|l,0|t)),0|(A=0|B()),2,0)),0|B(),0|m),d=0|B()|d,n[(o=i)>>2]=m|h&~g,n[o+4>>2]=d,A=0|Ze(0|e,0|s,0|(A=0|qe(0|r,0|A,0|l,0|t)),0|B()),s=0,e=0|B();break}g=0|n[(m=i)>>2],m=0|n[m+4>>2],h=0|rt(7,0,3*(u+r|0)|0),m&=~B(),n[(s=i)>>2]=g&~h,n[s+4>>2]=m,s=1;break}o=0|n[(g=i)>>2],g=0|n[g+4>>2],d=0|rt(7,0,0|(r=3*(u+r|0)|0)),g&=~B(),r=0|rt(0|(m=0|Xe(0|A,0|e,0|l,0|t)),0|(s=0|B()),0|r),g=0|B()|g,n[(h=i)>>2]=r|o&~d,n[h+4>>2]=g,A=0|Ze(0|A,0|e,0|(s=0|qe(0|m,0|s,0|l,0|t)),0|B()),s=0,e=0|B()}while(0);if(!((0|f)>(0|c))){e=0;break}r=~c,c=c+1|0}return S=a,0|e}}while(0);if((0|f)<1)return S=a,0;for(o=15^l,s=1;;){if(h=0|be(7,0,h=f-s|0,((0|h)<0)<<31>>31),m=0|B(),t=0|n[(c=i)>>2],c=0|n[c+4>>2],r=0|rt(7,0,0|(l=3*(o-s|0)|0)),c&=~B(),l=0|rt(0|(d=0|Xe(0|A,0|e,0|h,0|m)),0|(g=0|B()),0|l),c=0|B()|c,n[(u=i)>>2]=l|t&~r,n[u+4>>2]=c,A=0|Ze(0|A,0|e,0|(m=0|qe(0|d,0|g,0|h,0|m)),0|B()),e=0|B(),(0|f)<=(0|s)){e=0;break}s=s+1|0}return S=a,0|e},_compactCells:function(A,e,t,r){e|=0;var o,i=0,a=0,s=0,l=0,c=0,u=0,f=0,d=0,g=0,h=0,m=0,p=0,b=0,v=0,w=0,y=0,x=0,k=0,C=0,D=0,E=0,Q=0,j=0,N=0,S=0;if(!(0|(t|=0))&!(0|(r|=0)))return 0;if(a=0|n[(i=A|=0)>>2],!0&!(15728640&(i=0|n[i+4>>2]))){if(!((0|r)>0|!(0|r)&t>>>0>0))return 0;if(n[(S=e)>>2]=a,n[S+4>>2]=i,1==(0|t)&!(0|r))return 0;i=1,a=0;do{N=0|n[4+(j=A+(i<<3)|0)>>2],n[(S=e+(i<<3)|0)>>2]=n[j>>2],n[S+4>>2]=N,i=0|We(0|i,0|a,1,0),a=0|B()}while((0|a)<(0|r)|(0|a)==(0|r)&i>>>0>>0);return 0}if(!(N=0|Ue(o=t<<3)))return 13;if(st(0|N,0|A,0|o),!(j=0|Ve(t,8)))return Ye(N),13;A:for(;;){E=0|tt(0|(u=0|n[(i=N)>>2]),0|(i=0|n[i+4>>2]),52),B(),Q=(E&=15)-1|0,D=!!(0|E),C=(0|r)>0|!(0|r)&t>>>0>0;e:do{if(D&C){if(w=0|rt(0|Q,0,52),y=0|B(),Q>>>0>15){if(!(!(0|u)&!(0|i))){S=16;break A}for(a=0,A=0;;){if(a=0|We(0|a,0|A,1,0),!((0|(A=0|B()))<(0|r)|(0|A)==(0|r)&a>>>0>>0))break e;if(!(!(0|(k=0|n[(s=N+(a<<3)|0)>>2]))&!(0|(s=0|n[s+4>>2])))){i=s,S=16;break A}}}for(l=u,A=i,a=0,s=0;;){if(!(!(0|l)&!(0|A))){if(!(!0&!(117440512&A))){S=21;break A}if(f=0|tt(0|l,0|A,52),B(),(0|(f&=15))<(0|Q)){i=12,S=27;break A}if((0|f)!=(0|Q)&&(l|=w,A=-15728641&A|y,f>>>0>=E>>>0)){c=Q;do{k=0|rt(7,0,3*(14-c|0)|0),c=c+1|0,l|=k,A=0|B()|A}while(c>>>0>>0)}if(g=0|At(0|l,0|A,0|t,0|r),h=0|B(),!(!(0|(d=0|n[(f=c=j+(g<<3)|0)>>2]))&!(0|(f=0|n[f+4>>2])))){b=0,v=0;do{if((0|b)>(0|r)|(0|b)==(0|r)&v>>>0>t>>>0){S=31;break A}if((0|d)==(0|l)&(-117440513&f)==(0|A)){m=0|tt(0|d,0|f,56),B(),p=1+(m&=7)|0,k=0|tt(0|d,0|f,45),B();t:do{if(0|z(127&k)){if(d=0|tt(0|d,0|f,52),B(),!(d&=15)){f=6;break}for(f=1;;){if(!(!((k=0|rt(7,0,3*(15-f|0)|0))&l)&!((0|B())&A))){f=7;break t}if(!(f>>>0>>0)){f=6;break}f=f+1|0}}else f=7}while(0);if((m+2|0)>>>0>f>>>0){S=41;break A}k=0|rt(0|p,0,56),A=B()|-117440513&A,n[(x=c)>>2]=0,n[x+4>>2]=0,l|=k}else g=0|$e(0|(g=0|We(0|g,0|h,1,0)),0|B(),0|t,0|r),h=0|B();v=0|We(0|v,0|b,1,0),b=0|B(),d=0|n[(f=c=j+(g<<3)|0)>>2],f=0|n[f+4>>2]}while(!(!(0|d)&!(0|f)))}n[(k=c)>>2]=l,n[k+4>>2]=A}if(a=0|We(0|a,0|s,1,0),!((0|(s=0|B()))<(0|r)|(0|s)==(0|r)&a>>>0>>0))break e;l=0|n[(A=N+(a<<3)|0)>>2],A=0|n[A+4>>2]}}}while(0);if(k=0|We(0|t,0|r,5,0),(x=0|B())>>>0<0|!(0|x)&k>>>0<11){S=85;break}if(k=0|Xe(0|t,0|r,6,0),B(),!(k=0|Ve(k,8))){S=48;break}do{if(C){for(p=0,A=0,m=0,b=0;;){if(!(0|(a=0|n[(s=f=j+(p<<3)|0)>>2]))&!(0|(s=0|n[s+4>>2])))x=m;else{d=0|tt(0|a,0|s,56),B(),l=1+(d&=7)|0,g=-117440513&s,x=0|tt(0|a,0|s,45),B();e:do{if(0|z(127&x)){if(h=0|tt(0|a,0|s,52),B(),0|(h&=15))for(c=1;;){if(!(!(a&(x=0|rt(7,0,3*(15-c|0)|0)))&!(g&(0|B()))))break e;if(!(c>>>0>>0))break;c=c+1|0}a|=s=0|rt(0|l,0,56),s=0|B()|g,n[(l=f)>>2]=a,n[l+4>>2]=s,l=d+2|0}}while(0);7==(0|l)?(n[(x=k+(A<<3)|0)>>2]=a,n[x+4>>2]=-117440513&s,A=0|We(0|A,0|m,1,0),x=0|B()):x=m}if(p=0|We(0|p,0|b,1,0),!((0|(b=0|B()))<(0|r)|(0|b)==(0|r)&p>>>0>>0))break;m=x}if(C){if(v=Q>>>0>15,w=0|rt(0|Q,0,52),y=0|B(),!D){for(a=0,c=0,l=0,s=0;!(0|u)&!(0|i)||(n[(Q=e+(a<<3)|0)>>2]=u,n[Q+4>>2]=i,a=0|We(0|a,0|c,1,0),c=0|B()),l=0|We(0|l,0|s,1,0),(0|(s=0|B()))<(0|r)|(0|s)==(0|r)&l>>>0>>0;)u=0|n[(i=N+(l<<3)|0)>>2],i=0|n[i+4>>2];i=x;break}for(a=0,c=0,s=0,l=0;;){do{if(!(!(0|u)&!(0|i))){if(h=0|tt(0|u,0|i,52),B(),v|(0|(h&=15))<(0|Q)){S=80;break A}if((0|h)!=(0|Q)){if(f=u|w,d=-15728641&i|y,h>>>0>=E>>>0){g=Q;do{D=0|rt(7,0,3*(14-g|0)|0),g=g+1|0,f|=D,d=0|B()|d}while(g>>>0>>0)}}else f=u,d=i;m=0|At(0|f,0|d,0|t,0|r),g=0,h=0,b=0|B();do{if((0|g)>(0|r)|(0|g)==(0|r)&h>>>0>t>>>0){S=81;break A}if((-117440513&(p=0|n[4+(D=j+(m<<3)|0)>>2]))==(0|d)&&(0|n[D>>2])==(0|f)){S=65;break}m=0|$e(0|(D=0|We(0|m,0|b,1,0)),0|B(),0|t,0|r),b=0|B(),h=0|We(0|h,0|g,1,0),g=0|B(),D=j+(m<<3)|0}while((0|n[D>>2])!=(0|f)||(0|n[D+4>>2])!=(0|d));if(65==(0|S)&&(S=0,!0&100663296==(117440512&p)))break;n[(D=e+(a<<3)|0)>>2]=u,n[D+4>>2]=i,a=0|We(0|a,0|c,1,0),c=0|B()}}while(0);if(s=0|We(0|s,0|l,1,0),!((0|(l=0|B()))<(0|r)|(0|l)==(0|r)&s>>>0>>0))break;u=0|n[(i=N+(s<<3)|0)>>2],i=0|n[i+4>>2]}i=x}else a=0,i=x}else a=0,A=0,i=0}while(0);if(lt(0|j,0,0|o),st(0|N,0|k,A<<3),Ye(k),!(0|A)&!(0|i)){S=89;break}e=e+(a<<3)|0,r=i,t=A}if(16==(0|S))!0&!(117440512&i)?(i=4,S=27):S=21;else if(31==(0|S))M(27795,27122,620,27132);else{if(41==(0|S))return Ye(N),Ye(j),10;if(48==(0|S))return Ye(N),Ye(j),13;80==(0|S)?M(27795,27122,711,27132):81==(0|S)?M(27795,27122,723,27132):85==(0|S)&&(st(0|e,0|N,t<<3),S=89)}return 21==(0|S)?(Ye(N),Ye(j),0|(S=5)):27==(0|S)?(Ye(N),Ye(j),0|(S=i)):89==(0|S)?(Ye(N),Ye(j),0|(S=0)):0},_constructCell:function(A,e,t,o){t|=0,o|=0;var i=0,a=0,s=0,l=0,c=0,u=0;if((A|=0)>>>0>15)return 4;if((e|=0)>>>0>121)return 17;s=0|rt(0|A,0,52),i=0|B(),l=0|rt(0|e,0,45),i=0|i|B()|134225919;A:do{if((0|A)>=1){for(l=1,s=!!(0|r[20528+e|0]),a=-1;;){if((e=0|n[t+(l+-1<<2)>>2])>>>0>6){i=18,e=10;break}if(!(!(0|e)|1^s)){if(1==(0|e)){i=19,e=10;break}s=0}if(c=0|rt(7,0,0|(u=3*(15-l|0)|0)),i&=~B(),a=(e=0|rt(0|e,((0|e)<0)<<31>>31,0|u))|a&~c,i=0|B()|i,!((0|l)<(0|A)))break A;l=l+1|0}if(10==(0|e))return 0|i}else a=-1}while(0);return n[(u=o)>>2]=a,n[u+4>>2]=i,0},_destroyLinkedMultiPolygon:ge,_directedEdgeToBoundary:DA,_directedEdgeToCells:function(A,e,t){A|=0;var r,o,i,a=0;return r=S,S=S+16|0,a=r,!0&268435456==(2013265920&(e|=0))?(o=-2130706433&e|134217728,n[(i=t|=0)>>2]=A,n[i+4>>2]=o,n[a>>2]=0,e=0|tt(0|A,0|e,56),B(),a=0|I(A,o,7&e,a,t+8|0),S=r,0|a):(S=r,0|(a=6))},_edgeLengthKm:function(A,e,t){t|=0;var r,i=0,a=0,s=0,l=0,u=0,g=0,h=0;if(r=S,S=S+176|0,0|(A=0|DA(A|=0,e|=0,l=r)))return l=A,s=+o[t>>3],s*=6371.007180918475,o[t>>3]=s,S=r,0|l;if(o[t>>3]=0,(0|(A=0|n[l>>2]))<=1)return l=0,s=0,s*=6371.007180918475,o[t>>3]=s,S=r,0|l;e=A+-1|0,A=0,i=+o[l+8>>3],a=+o[l+16>>3],s=0;do{g=i,i=+o[l+8+((A=A+1|0)<<4)>>3],h=+d(.5*(i-g)),u=a,a=+o[l+8+(A<<4)+8>>3],u=h*h+(u=+d(.5*(a-u)))*(+f(+g)*+f(+i)*u),s+=2*+b(+ +c(+u),+ +c(+(1-u)))}while((0|A)!=(0|e));return o[t>>3]=s,l=0,h=s,h*=6371.007180918475,o[t>>3]=h,S=r,0|l},_edgeLengthM:function(A,e,t){t|=0;var r,i=0,a=0,s=0,l=0,u=0,g=0,h=0;if(r=S,S=S+176|0,0|(A=0|DA(A|=0,e|=0,l=r)))return l=A,s=+o[t>>3],s*=6371.007180918475,s*=1e3,o[t>>3]=s,S=r,0|l;if(o[t>>3]=0,(0|(A=0|n[l>>2]))<=1)return l=0,s=0,s*=6371.007180918475,s*=1e3,o[t>>3]=s,S=r,0|l;e=A+-1|0,A=0,i=+o[l+8>>3],a=+o[l+16>>3],s=0;do{g=i,i=+o[l+8+((A=A+1|0)<<4)>>3],h=+d(.5*(i-g)),u=a,a=+o[l+8+(A<<4)+8>>3],u=h*h+(u=+d(.5*(a-u)))*(+f(+g)*+f(+i)*u),s+=2*+b(+ +c(+u),+ +c(+(1-u)))}while((0|A)!=(0|e));return o[t>>3]=s,l=0,h=s,h*=6371.007180918475,h*=1e3,o[t>>3]=h,S=r,0|l},_edgeLengthRads:function(A,e,t){t|=0;var r,i=0,a=0,s=0,l=0,u=0,g=0,h=0;if(r=S,S=S+176|0,0|(A=0|DA(A|=0,e|=0,l=r)))return S=r,0|A;if(o[t>>3]=0,(0|(A=0|n[l>>2]))<=1)return S=r,0;e=A+-1|0,A=0,i=+o[l+8>>3],a=+o[l+16>>3],s=0;do{g=i,i=+o[l+8+((A=A+1|0)<<4)>>3],h=+d(.5*(i-g)),u=a,a=+o[l+8+(A<<4)+8>>3],u=h*h+(u=+d(.5*(a-u)))*(+f(+i)*+f(+g)*u),s+=2*+b(+ +c(+u),+ +c(+(1-u)))}while((0|A)<(0|e));return o[t>>3]=s,S=r,0},_emscripten_replace_memory:function(A){return r=new Int8Array(A),n=new Int32Array(A),o=new Float64Array(A),t=A,!0},_free:Ye,_getBaseCellNumber:TA,_getDirectedEdgeDestination:function(A,e,t){A|=0,e|=0,t|=0;var r,o,i=0;return r=S,S=S+16|0,n[(i=r)>>2]=0,!0&268435456==(2013265920&e)?(o=0|tt(0|A,0|e,56),B(),i=0|I(A,-2130706433&e|134217728,7&o,i,t),S=r,0|i):(S=r,0|(i=6))},_getDirectedEdgeOrigin:function(A,e,t){return A|=0,t|=0,!0&268435456==(2013265920&(e|=0))?(n[t>>2]=A,n[t+4>>2]=-2130706433&e|134217728,0|(t=0)):0|(t=6)},_getHexagonAreaAvgKm2:se,_getHexagonAreaAvgM2:function(A,e){return e|=0,(A|=0)>>>0>15?0|(e=4):(o[e>>3]=+o[20784+(A<<3)>>3],0|(e=0))},_getHexagonEdgeLengthAvgKm:function(A,e){return e|=0,(A|=0)>>>0>15?0|(e=4):(o[e>>3]=+o[20912+(A<<3)>>3],0|(e=0))},_getHexagonEdgeLengthAvgM:function(A,e){return e|=0,(A|=0)>>>0>15?0|(e=4):(o[e>>3]=+o[21040+(A<<3)>>3],0|(e=0))},_getIcosahedronFaces:function A(e,t,r){r|=0;var o,i=0,a=0,s=0,l=0,c=0,u=0,f=0,d=0;o=S,S=S+128|0,f=o+112|0,s=o+96|0,d=o,a=0|tt(0|(e|=0),0|(t|=0),52),B(),c=15&a,n[f>>2]=c,l=0|tt(0|e,0|t,45),B(),l&=127;A:do{if(0|z(l)){if(0|c)for(i=1;;){if(!(!((u=0|rt(7,0,3*(15-i|0)|0))&e)&!((0|B())&t))){a=0;break A}if(!(i>>>0>>0))break;i=i+1|0}if(!(1&a))return u=0|rt(c+1|0,0,52),d=B()|-15728641&t,d=0|A((u|e)&~(f=0|rt(7,0,3*(14-c|0)|0)),d&~B(),r),S=o,0|d;a=1}else a=0}while(0);if(!(i=0|XA(e,t,s))){a?(jA(s,f,d),u=5):(PA(s,f,d),u=6);A:do{if(0|z(l))if(c)for(i=1;;){if(!(!((l=0|rt(7,0,3*(15-i|0)|0))&e)&!((0|B())&t))){e=2;break A}if(!(i>>>0>>0)){e=5;break}i=i+1|0}else e=5;else e=2}while(0);lt(0|r,-1,e<<2);A:do{if(a)for(s=0;;){if(SA(l=d+(s<<4)|0,0|n[f>>2]),l=0|n[l>>2],-1==(0|(c=0|n[r>>2]))|(0|c)==(0|l))i=r;else{a=0;do{if((a=a+1|0)>>>0>=e>>>0){i=1;break A}c=0|n[(i=r+(a<<2)|0)>>2]}while(!(-1==(0|c)|(0|c)==(0|l)))}if(n[i>>2]=l,(s=s+1|0)>>>0>=u>>>0){i=0;break}}else for(s=0;;){if(NA(l=d+(s<<4)|0,0|n[f>>2],0,1),l=0|n[l>>2],-1==(0|(c=0|n[r>>2]))|(0|c)==(0|l))i=r;else{a=0;do{if((a=a+1|0)>>>0>=e>>>0){i=1;break A}c=0|n[(i=r+(a<<2)|0)>>2]}while(!(-1==(0|c)|(0|c)==(0|l)))}if(n[i>>2]=l,(s=s+1|0)>>>0>=u>>>0){i=0;break}}}while(0)}return S=o,0|i},_getIndexDigit:function(A,e,t,r){return r|=0,((t|=0)-1|0)>>>0>14?0|(r=4):(t=0|tt(0|(A|=0),0|(e|=0),3*(15-t|0)|0),B(),n[r>>2]=7&t,0|(r=0))},_getNumCells:le,_getPentagons:Ae,_getRes0Cells:function(A){A|=0;var e=0,t=0,r=0;e=0;do{rt(0|e,0,45),r=134225919|B(),n[(t=A+(e<<3)|0)>>2]=-1,n[t+4>>2]=r,e=e+1|0}while(122!=(0|e));return 0},_getResolution:function(A,e){return e=0|tt(0|(A|=0),0|(e|=0),52),B(),15&e},_greatCircleDistanceKm:ae,_greatCircleDistanceM:function(A,e){A|=0;var t,r,n,i=0;return r=+o[(e|=0)>>3],t=+o[A>>3],i=(n=+d(.5*(r-t)))*n+(i=+d(.5*(+o[e+8>>3]-+o[A+8>>3])))*(+f(+r)*+f(+t)*i),2*+b(+ +c(+i),+ +c(+(1-i)))*6371.007180918475*1e3},_greatCircleDistanceRads:function(A,e){A|=0;var t,r,n,i=0;return r=+o[(e|=0)>>3],t=+o[A>>3],i=(n=+d(.5*(r-t)))*n+(i=+d(.5*(+o[e+8>>3]-+o[A+8>>3])))*(+f(+r)*+f(+t)*i),2*+b(+ +c(+i),+ +c(+(1-i)))},_gridDisk:F,_gridDiskDistances:P,_gridDistance:function(A,e,t,r,o){t|=0,r|=0,o|=0;var i,a,s=0,l=0;return a=S,S=S+32|0,l=a,0|(i=0|me(A|=0,e|=0,A,e,s=a+12|0))?(S=a,0|(l=i)):0|(A=0|me(A,e,t,r,l))?(S=a,0|(l=A)):(s=0|kA(s,l),n[(l=o)>>2]=s,n[l+4>>2]=((0|s)<0)<<31>>31,S=a,0|(l=0))},_gridPathCells:function(A,e,t,r,o){t|=0,r|=0,o|=0;var i,a,s=0,c=0,u=0,f=0,d=0,g=0,h=0,m=0,p=0,b=0,v=0,w=0,y=0,x=0,k=0,C=0,D=0,E=0;if(a=S,S=S+48|0,c=a+12|0,D=a,!(s=0|me(A|=0,e|=0,A,e,i=a+24|0))&&!(s=0|me(A,e,t,r,c))){C=((0|(k=0|kA(i,c)))<0)<<31>>31,n[i>>2]=0,n[i+4>>2]=0,n[i+8>>2]=0,n[c>>2]=0,n[c+4>>2]=0,n[c+8>>2]=0,0|me(A,e,A,e,i)&&M(27795,27538,692,27747),0|me(A,e,t,r,c)&&M(27795,27538,697,27747),CA(i),CA(c),g=0|k?1/+(0|k):0,t=0|n[i>>2],v=g*+((0|n[c>>2])-t|0),r=0|n[(w=i+4|0)>>2],y=g*+((0|n[c+4>>2])-r|0),s=0|n[(x=i+8|0)>>2],g*=+((0|n[c+8>>2])-s|0),n[D>>2]=t,n[(h=D+4|0)>>2]=r,n[(m=D+8|0)>>2]=s;A:do{if((0|k)<0)s=0;else for(p=0,b=0;;){E=v*(f=+(b>>>0)+4294967296*+(0|p))+ +(0|t),u=y*f+ +(0|r),f=g*f+ +(0|s),t=~~+at(+E),c=~~+at(+u),s=~~+at(+f),E=+l(+(+(0|t)-E)),u=+l(+(+(0|c)-u)),f=+l(+(+(0|s)-f));do{if(!(E>u&E>f)){if(d=0-t|0,u>f){r=d-s|0;break}r=c,s=d-c|0;break}t=0-(c+s)|0,r=c}while(0);if(n[D>>2]=t,n[h>>2]=r,n[m>>2]=s,BA(D),0|(s=0|pe(A,e,D,o+(b<<3)|0)))break A;if(!((0|p)<(0|C)|(0|p)==(0|C)&b>>>0>>0)){s=0;break A}t=0|We(0|b,0|p,1,0),p=r=0|B(),b=t,t=0|n[i>>2],r=0|n[w>>2],s=0|n[x>>2]}}while(0);return S=a,0|s}return S=a,0|s},_gridPathCellsSize:function(A,e,t,r,o){t|=0,r|=0,o|=0;var i,a=0,s=0,l=0;return i=S,S=S+32|0,l=i,(a=0|me(A|=0,e|=0,A,e,s=i+12|0))||(a=0|me(A,e,t,r,l))?(S=i,0|(l=a)):(r=0|We(0|(r=0|kA(s,l)),((0|r)<0)<<31>>31,1,0),s=0|B(),n[(l=o)>>2]=r,n[l+4>>2]=s,S=i,0|(l=0))},_gridRing:function(A,e,t,r){return 0|R(A|=0,e|=0,t|=0,r|=0)?(lt(0|r,0,48*t|0),0|(r=0|function(A,e,t,r){A|=0,e|=0,r|=0;var o,i=0,a=0,s=0,l=0,c=0,u=0,f=0,d=0;if(o=S,S=S+16|0,s=o,!(t|=0))return n[r>>2]=A,n[r+4>>2]=e,S=o,0;do{if((0|t)>=0){if((0|t)>13780509){if(0|(i=0|le(15,s)))break;i=0|n[(a=s)>>2],a=0|n[a+4>>2]}else f=0|qe(0|t,0|(i=((0|t)<0)<<31>>31),3,0),a=0|B(),i=0|We(0|t,0|i,1,0),i=0|We(0|(i=0|qe(0|f,0|a,0|i,0|B())),0|B(),1,0),a=0|B(),n[(f=s)>>2]=i,n[f+4>>2]=a;if(u=0|Ve(i,8)){if(!(f=0|Ve(i,4))){Ye(u),i=13;break}if(0|(i=0|L(A,e,t,u,f,i,a,0))){Ye(u),Ye(f);break}if(e=0|n[s>>2],(0|(s=0|n[s+4>>2]))>0|!(0|s)&e>>>0>0){i=0,l=0,c=0;do{!(0|(a=0|n[(A=u+(l<<3)|0)>>2]))&!(0|(A=0|n[A+4>>2]))||(0|n[f+(l<<2)>>2])!=(0|t)||(n[(d=r+(i<<3)|0)>>2]=a,n[d+4>>2]=A,i=i+1|0),l=0|We(0|l,0|c,1,0),c=0|B()}while((0|c)<(0|s)|(0|c)==(0|s)&l>>>0>>0)}Ye(u),Ye(f),i=0}else i=13}else i=2}while(0);return S=o,0|i}(A,e,t,r))):0|(r=0)},_gridRingUnsafe:R,_i64Add:We,_i64Subtract:Ze,_isPentagon:HA,_isResClassIII:function(A,e){return e=0|tt(0|(A|=0),0|(e|=0),52),B(),1&e},_isValidCell:LA,_isValidDirectedEdge:MA,_isValidIndex:function(A,e){A|=0;var t=0,n=0,o=0,i=0;if(!0&134217728==(-16777216&(e|=0))&&(n=0|tt(0|A,0|e,52),B(),n&=15,t=0|tt(0|A,0|e,45),B(),(t&=127)>>>0<=121)&&!(613566756&(i=0|rt(0|(o=0|tt(0|A,0|e,0|(i=3*(15^n)|0))),0|B(),0|i))&Ze(-1227133514,-1171,0|i,0|(o=0|B())))&!(4681&o&B())&&15==(0|n)|!(0|(i=0|tt(0|rt(0|~A,0|~e,0|(i=19+(3*n|0)|0)),0|B(),0|i)))&!(0|B())){if(!(0|r[20528+t|0]))return 1;if(!(0|A)&!(0|(t=8191&e)))return 1;if(i=0|nt(0|A,0|t),B(),(63-i|0)%3|0)return 1}return 0|MA(A,e)?0|(i=1):0|(i=1&!!(0|Te(A,e)))},_isValidVertex:Te,_latLngToCell:KA,_llvm_ctlz_i64:nt,_llvm_maxnum_f64:ot,_llvm_minnum_f64:it,_llvm_round_f64:at,_localIjToCell:function(A,e,t,r,o){var i,a;return A|=0,e|=0,t|=0,o|=0,a=S,S=S+16|0,i=a,(r|=0)?t=15:(t=0|function(A,e){e|=0;var t,r,o,i=0,a=0,s=0;if(a=0|n[(A|=0)>>2],n[e>>2]=a,s=0|n[A+4>>2],n[(r=e+4|0)>>2]=s,n[(o=e+8|0)>>2]=0,A=(i=(0|s)<(0|a))?a:s,(0|(i=i?s:a))<0){if(-2147483648==(0|i)||((0|A)>0?(2147483647-A|0)<(0|i):(-2147483648-A|0)>(0|i)))return 1;if((0|A)>-1?(-2147483648|A)>=(0|i):(-2147483648^A)<(0|i))return 1}return A=s-a|0,(0|a)<0?(i=0-a|0,n[r>>2]=A,n[o>>2]=i,n[e>>2]=0,a=0):(A=s,i=0),(0|A)<0&&(a=a-A|0,n[e>>2]=a,i=i-A|0,n[o>>2]=i,n[r>>2]=0,A=0),t=a-i|0,s=A-i|0,(0|i)<0?(n[e>>2]=t,n[r>>2]=s,n[o>>2]=0,A=s,s=t,i=0):s=a,(0|(a=(0|i)<(0|(a=(0|A)<(0|s)?A:s))?i:a))<=0||(n[e>>2]=s-a,n[r>>2]=A-a,n[o>>2]=i-a),0}(t,i))||(t=0|pe(A,e,i,o)),S=a,0|t},_malloc:Ue,_maxFaceCount:function(A,e,t){t|=0;var r=0,o=0;if(o=0|tt(0|(A|=0),0|(e|=0),45),B(),!(0|z(127&o)))return o=2,n[t>>2]=o,0;if(o=0|tt(0|A,0|e,52),B(),!(o&=15))return o=5,n[t>>2]=o,0;for(r=1;;){if(!(!((0|rt(7,0,3*(15-r|0)|0))&A)&!((0|B())&e))){r=2,A=6;break}if(!(r>>>0>>0)){r=5,A=6;break}r=r+1|0}return 6==(0|A)?(n[t>>2]=r,0):0},_maxGridDiskSize:function(A,e){e|=0;var t=0,r=0,o=0;return(0|(A|=0))<0?0|(e=2):(0|A)>13780509?0|(e=0|le(15,e)):(o=0|qe(0|A,0|(t=((0|A)<0)<<31>>31),3,0),r=0|B(),t=0|We(0|A,0|t,1,0),t=0|We(0|(t=0|qe(0|o,0|r,0|t,0|B())),0|B(),1,0),A=0|B(),n[e>>2]=t,n[e+4>>2]=A,0|(e=0))},_maxPolygonToCellsSize:function(A,e,t,r){A|=0,e|=0,r|=0;var o,i=0,a=0,s=0,l=0,c=0;if(o=S,S=S+48|0,i=o+16|0,a=o+8|0,s=o,0|(t=0|Ce(t|=0)))return S=o,0|t;if(l=0|n[(c=A)+4>>2],n[(t=a)>>2]=n[c>>2],n[t+4>>2]=l,ke(a,i),!(t=0|eA(i,e,s))){if(e=0|n[a>>2],(0|(a=0|n[A+8>>2]))>0){i=0|n[A+12>>2],t=0;do{e=(0|n[i+(t<<3)>>2])+e|0,t=t+1|0}while((0|t)<(0|a))}i=0|n[(t=s)>>2],(0|(t=0|n[t+4>>2]))<(0|(a=((0|e)<0)<<31>>31))|(0|t)==(0|a)&i>>>0>>0?(n[(t=s)>>2]=e,n[t+4>>2]=a,t=a):e=i,l=0|We(0|e,0|t,12,0),c=0|B(),n[(t=s)>>2]=l,n[t+4>>2]=c,n[(t=r)>>2]=l,n[t+4>>2]=c,t=0}return S=o,0|t},_maxPolygonToCellsSizeExperimental:function(A,e,t,i){e|=0,t|=0,i|=0;var a,s,c=0,u=0,d=0,g=0,h=0,m=0,p=0,b=0;if(s=S,S=S+48|0,h=s+32|0,g=s+40|0,a=s,!(0|n[(A|=0)>>2]))return n[(m=i)>>2]=0,n[m+4>>2]=0,S=s,0;IA(h,0,0,0),c=0|n[(d=h)>>2],d=0|n[d+4>>2];do{if(e>>>0>15)n[(m=a)>>2]=0,n[m+4>>2]=0,n[a+8>>2]=4,n[a+12>>2]=-1,t=a+29|0,n[(m=a+16|0)>>2]=0,n[m+4>>2]=0,n[m+8>>2]=0,r[m+12|0]=0,r[0|t]=0|r[0|g],r[t+1|0]=0|r[g+1|0],r[t+2|0]=0|r[g+2|0],t=4,m=9;else{if(0|(t=0|Ce(t))){n[(h=a)>>2]=0,n[h+4>>2]=0,n[a+8>>2]=t,n[a+12>>2]=-1,m=a+29|0,n[(h=a+16|0)>>2]=0,n[h+4>>2]=0,n[h+8>>2]=0,r[h+12|0]=0,r[0|m]=0|r[0|g],r[m+1|0]=0|r[g+1|0],r[m+2|0]=0|r[g+2|0],m=9;break}if(!(t=0|Ve(1+(0|n[A+8>>2])|0,32))){n[(m=a)>>2]=0,n[m+4>>2]=0,n[a+8>>2]=13,n[a+12>>2]=-1,t=a+29|0,n[(m=a+16|0)>>2]=0,n[m+4>>2]=0,n[m+8>>2]=0,r[m+12|0]=0,r[0|t]=0|r[0|g],r[t+1|0]=0|r[g+1|0],r[t+2|0]=0|r[g+2|0],t=13,m=9;break}Be(A,t),n[(b=a)>>2]=c,n[b+4>>2]=d,n[(d=a+8|0)>>2]=0,n[a+12>>2]=e,n[a+20>>2]=A,n[a+24>>2]=t,r[a+28|0]=0,r[0|(c=a+29|0)]=0|r[0|g],r[c+1|0]=0|r[g+1|0],r[c+2|0]=0|r[g+2|0],n[a+16>>2]=3,p=+J(t),p*=+Z(t),u=+l(+ +o[t>>3]),u=p/+f(+ +it(+u,+ +l(+ +o[t+8>>3])))*6371.007180918475*6371.007180918475,t=0|n[(c=a+12|0)>>2];A:do{if((0|t)>0)do{if(se(t+-1|0,h),!(u/+o[h>>3]>10))break A;t=(b=0|n[c>>2])-1|0,n[c>>2]=t}while((0|b)>1)}while(0);if(we(a),n[(c=i)>>2]=0,n[c+4>>2]=0,!(!(0|(t=0|n[(c=a)>>2]))&!(0|(c=0|n[c+4>>2]))))do{_A(t,c,e,h),g=h,g=0|We(0|n[(A=i)>>2],0|n[A+4>>2],0|n[g>>2],0|n[g+4>>2]),A=0|B(),n[(b=i)>>2]=g,n[b+4>>2]=A,we(a),t=0|n[(b=a)>>2],c=0|n[b+4>>2]}while(!(!(0|t)&!(0|c)));t=0|n[d>>2]}}while(0);return S=s,0|t},_memcpy:st,_memset:lt,_originToDirectedEdges:function(A,e,t){t|=0;var r,o=0;return r=!(0|HA(A|=0,e|=0)),e&=-2130706433,n[(o=t)>>2]=r?A:0,n[o+4>>2]=r?285212672|e:0,n[(o=t+8|0)>>2]=A,n[o+4>>2]=301989888|e,n[(o=t+16|0)>>2]=A,n[o+4>>2]=318767104|e,n[(o=t+24|0)>>2]=A,n[o+4>>2]=335544320|e,n[(o=t+32|0)>>2]=A,n[o+4>>2]=352321536|e,n[(t=t+40|0)>>2]=A,n[t+4>>2]=369098752|e,0},_pentagonCount:function(){return 12},_polygonToCells:function(A,e,t,r){A|=0,e|=0,r|=0;var o,i,a,s,l=0,c=0,u=0,f=0,d=0,g=0,h=0,m=0,p=0,b=0,v=0,w=0,y=0,x=0,k=0,C=0,M=0,D=0,E=0,Q=0,j=0,N=0,F=0,P=0,I=0,R=0,_=0;if(s=S,S=S+112|0,o=s+80|0,d=s+72|0,i=s,a=s+56|0,0|(l=0|Ce(t|=0)))return S=s,0|l;if(!(_=0|Ue(32+(n[(g=A+8|0)>>2]<<5)|0)))return S=s,13;if(Be(A,_),!(l=0|Ce(t))){if(R=0|n[(I=A)+4>>2],n[(l=d)>>2]=n[I>>2],n[l+4>>2]=R,ke(d,o),l=0|eA(o,e,i))I=0,R=0;else{if(l=0|n[d>>2],(0|(c=0|n[g>>2]))>0){u=0|n[A+12>>2],t=0;do{l=(0|n[u+(t<<3)>>2])+l|0,t=t+1|0}while((0|t)!=(0|c));t=l}else t=l;c=0|n[(l=i)>>2],(0|(l=0|n[l+4>>2]))<(0|(u=((0|t)<0)<<31>>31))|(0|l)==(0|u)&c>>>0>>0?(n[(l=i)>>2]=t,n[l+4>>2]=u,l=u):t=c,I=0|We(0|t,0|l,12,0),R=0|B(),n[(l=i)>>2]=I,n[l+4>>2]=R,l=0}if(!l){if(!(t=0|Ve(I,8)))return Ye(_),S=s,13;if(!(f=0|Ve(I,8)))return Ye(_),Ye(t),S=s,13;n[(F=o)>>2]=0,n[F+4>>2]=0,P=0|n[(F=A)+4>>2],n[(l=d)>>2]=n[F>>2],n[l+4>>2]=P,l=0|H(d,I,R,e,o,t,f);A:do{if(l)Ye(t),Ye(f),Ye(_);else{e:do{if((0|n[g>>2])>0){for(u=A+12|0,c=0;l=0|H((0|n[u>>2])+(c<<3)|0,I,R,e,o,t,f),c=c+1|0,!(0|l);)if((0|c)>=(0|n[g>>2]))break e;Ye(t),Ye(f),Ye(_);break A}}while(0);(0|R)>0|!(0|R)&I>>>0>0&<(0|f,0,I<<3),F=0|n[(P=o)+4>>2];e:do{if((0|F)>0|!(0|F)&(0|n[P>>2])>>>0>0){Q=t,j=f,N=t,F=f,P=t,l=t,M=t,D=f,E=f,t=f;t:for(;;){for(y=0,x=0,k=0,C=0,c=0,u=0;;){d=(f=i)+56|0;do{n[f>>2]=0,f=f+4|0}while((0|f)<(0|d));if(0|T(g=0|n[(e=Q+(y<<3)|0)>>2],e=0|n[e+4>>2],1,i,0)){d=(f=i)+56|0;do{n[f>>2]=0,f=f+4|0}while((0|f)<(0|d));0|(f=0|Ve(7,4))&&(L(g,e,1,i,f,7,0,0),Ye(f))}for(w=0;;){b=0|n[(v=i+(w<<3)|0)>>2],v=0|n[v+4>>2];r:do{if(!(0|b)&!(0|v))f=c,d=u;else{if(h=0|At(0|b,0|v,0|I,0|R),g=0|B(),!(!(0|(d=0|n[(e=f=r+(h<<3)|0)>>2]))&!(0|(e=0|n[e+4>>2])))){m=0,p=0;do{if((0|m)>(0|R)|(0|m)==(0|R)&p>>>0>I>>>0)break t;if((0|d)==(0|b)&(0|e)==(0|v)){f=c,d=u;break r}h=0|$e(0|(f=0|We(0|h,0|g,1,0)),0|B(),0|I,0|R),g=0|B(),p=0|We(0|p,0|m,1,0),m=0|B(),d=0|n[(e=f=r+(h<<3)|0)>>2],e=0|n[e+4>>2]}while(!(!(0|d)&!(0|e)))}if(!(0|b)&!(0|v)){f=c,d=u;break}qA(b,v,a),0|Me(A,_,a)&&(p=0|We(0|c,0|u,1,0),u=0|B(),n[(m=f)>>2]=b,n[m+4>>2]=v,n[(c=j+(c<<3)|0)>>2]=b,n[c+4>>2]=v,c=p),f=c,d=u}}while(0);if((w=w+1|0)>>>0>=7)break;c=f,u=d}if(y=0|We(0|y,0|x,1,0),x=0|B(),k=0|We(0|k,0|C,1,0),C=0|B(),c=0|n[(u=o)>>2],!((0|C)<(0|(u=0|n[u+4>>2]))|(0|C)==(0|u)&k>>>0>>0))break;c=f,u=d}if((0|u)>0|!(0|u)&c>>>0>0){c=0,u=0;do{n[(C=Q+(c<<3)|0)>>2]=0,n[C+4>>2]=0,c=0|We(0|c,0|u,1,0),u=0|B(),k=0|n[(C=o)+4>>2]}while((0|u)<(0|k)|((0|u)==(0|k)?c>>>0<(0|n[C>>2])>>>0:0))}if(n[(C=o)>>2]=f,n[C+4>>2]=d,!((0|d)>0|!(0|d)&f>>>0>0))break e;w=t,y=E,x=P,k=D,C=j,t=M,E=l,D=N,M=w,l=y,P=F,F=x,N=k,j=Q,Q=C}Ye(N),Ye(F),Ye(_),l=1;break A}l=f}while(0);Ye(_),Ye(t),Ye(l),l=0}}while(0);return S=s,0|l}}return Ye(_),S=s,0|l},_polygonToCellsExperimental:function(A,e,t,o,i,a){o|=0,i|=0,a|=0;var s,l,c,u=0,f=0,d=0,g=0,h=0,m=0,p=0,b=0;c=S,S=S+160|0,f=c+64|0,h=c+112|0,b=c,function(A,e,t,o){A|=0,e|=0,t|=0,o|=0;var i,a,s,l=0,c=0,u=0,f=0;s=S,S=S+48|0,i=s+40|0,a=s,IA(c=s+32|0,0,0,0),u=0|n[c>>2],c=0|n[c+4>>2];do{if(t>>>0<=15){if(0|(l=0|Ce(o))){n[(o=a)>>2]=0,n[o+4>>2]=0,n[a+8>>2]=l,n[a+12>>2]=-1,u=a+29|0,n[(o=a+16|0)>>2]=0,n[o+4>>2]=0,n[o+8>>2]=0,r[o+12|0]=0,r[0|u]=0|r[0|i],r[u+1|0]=0|r[i+1|0],r[u+2|0]=0|r[i+2|0];break}if(l=0|Ve(1+(0|n[e+8>>2])|0,32)){Be(e,l),n[(f=a)>>2]=u,n[f+4>>2]=c,n[a+8>>2]=0,n[a+12>>2]=t,n[a+16>>2]=o,n[a+20>>2]=e,n[a+24>>2]=l,r[a+28|0]=0,r[0|(u=a+29|0)]=0|r[0|i],r[u+1|0]=0|r[i+1|0],r[u+2|0]=0|r[i+2|0];break}n[(o=a)>>2]=0,n[o+4>>2]=0,n[a+8>>2]=13,n[a+12>>2]=-1,u=a+29|0,n[(o=a+16|0)>>2]=0,n[o+4>>2]=0,n[o+8>>2]=0,r[o+12|0]=0,r[0|u]=0|r[0|i],r[u+1|0]=0|r[i+1|0],r[u+2|0]=0|r[i+2|0];break}n[(u=a)>>2]=0,n[u+4>>2]=0,n[a+8>>2]=4,n[a+12>>2]=-1,f=a+29|0,n[(u=a+16|0)>>2]=0,n[u+4>>2]=0,n[u+8>>2]=0,r[u+12|0]=0,r[0|f]=0|r[0|i],r[f+1|0]=0|r[i+1|0],r[f+2|0]=0|r[i+2|0]}while(0);we(a),n[A>>2]=n[a>>2],n[A+4>>2]=n[a+4>>2],n[A+8>>2]=n[a+8>>2],n[A+12>>2]=n[a+12>>2],n[A+16>>2]=n[a+16>>2],n[A+20>>2]=n[a+20>>2],n[A+24>>2]=n[a+24>>2],n[A+28>>2]=n[a+28>>2],S=s}(g=c+80|0,A|=0,e|=0,t|=0),ee(f,0|n[(d=g)>>2],0|n[d+4>>2],e),s=0|n[(d=f)>>2],d=0|n[d+4>>2],u=0|n[g+8>>2],n[(m=h+4|0)>>2]=n[g>>2],n[m+4>>2]=n[g+4>>2],n[m+8>>2]=n[g+8>>2],n[m+12>>2]=n[g+12>>2],n[m+16>>2]=n[g+16>>2],n[m+20>>2]=n[g+20>>2],n[m+24>>2]=n[g+24>>2],n[m+28>>2]=n[g+28>>2],n[(m=b)>>2]=s,n[m+4>>2]=d,n[(m=b+8|0)>>2]=u,e=h,t=36+(A=b+12|0)|0;do{n[A>>2]=n[e>>2],A=A+4|0,e=e+4|0}while((0|A)<(0|t));if(n[(h=b+48|0)>>2]=n[f>>2],n[h+4>>2]=n[f+4>>2],n[h+8>>2]=n[f+8>>2],n[h+12>>2]=n[f+12>>2],!(0|s)&!(0|d))return S=c,0|u;t=b+16|0,l=b+24|0,g=b+28|0,u=0,f=0,e=s,A=d;do{if(!((0|u)<(0|i)|(0|u)==(0|i)&f>>>0>>0)){p=4;break}if(d=f,f=0|We(0|f,0|u,1,0),u=0|B(),n[(d=a+(d<<3)|0)>>2]=e,n[d+4>>2]=A,re(h),!(0|(e=0|n[(A=h)>>2]))&!(0|(A=0|n[A+4>>2]))){if(we(t),!(0|(A=0|n[(e=t)>>2]))&!(0|(e=0|n[e+4>>2]))){p=10;break}te(A,e,0|n[g>>2],h),e=0|n[(A=h)>>2],A=0|n[A+4>>2]}n[(d=b)>>2]=e,n[d+4>>2]=A}while(!(!(0|e)&!(0|A)));return 4==(0|p)?(0|(e=0|n[(A=b+40|0)>>2])&&Ye(e),n[(p=b+16|0)>>2]=0,n[p+4>>2]=0,n[l>>2]=0,n[b+36>>2]=0,n[g>>2]=-1,n[b+32>>2]=0,n[A>>2]=0,te(0,0,0,h),n[b>>2]=0,n[b+4>>2]=0,n[m>>2]=0,S=c,0|(b=14)):(10==(0|p)&&(n[b>>2]=0,n[b+4>>2]=0,n[m>>2]=n[l>>2]),b=0|n[m>>2],S=c,0|b)},_readInt64AsDoubleFromPointer:function(A){return+(+((0|n[(A|=0)>>2])>>>0)+4294967296*+(0|n[A+4>>2]))},_res0CellCount:function(){return 122},_round:ct,_sbrk:ut,_sizeOfCellBoundary:function(){return 168},_sizeOfCoordIJ:function(){return 8},_sizeOfGeoLoop:function(){return 8},_sizeOfGeoPolygon:function(){return 16},_sizeOfH3Index:function(){return 8},_sizeOfLatLng:function(){return 16},_sizeOfLinkedGeoPolygon:function(){return 12},_uncompactCells:function(A,e,t,r,o,i,a){A|=0,r|=0,o|=0,i|=0;var s,l=0,c=0,u=0,f=0,d=0,g=0,h=0,m=0;if(s=S,S=S+16|0,m=s,!((0|(t|=0))>0|!(0|t)&(e|=0)>>>0>0))return S=s,0;if((0|(a|=0))>=16)return S=s,12;g=0,h=0,d=0,l=0;A:for(;;){if(f=0|tt(0|(c=0|n[(u=A+(g<<3)|0)>>2]),0|(u=0|n[u+4>>2]),52),B(),(15&f)>(0|a)){l=12,c=11;break}if(ee(m,c,u,a),!(0|(u=0|n[(f=m)>>2]))&!(0|(f=0|n[f+4>>2])))c=d;else{c=d;do{if(!((0|l)<(0|i)|(0|l)==(0|i)&c>>>0>>0)){c=10;break A}n[(d=r+(c<<3)|0)>>2]=u,n[d+4>>2]=f,c=0|We(0|c,0|l,1,0),l=0|B(),re(m),u=0|n[(d=m)>>2],f=0|n[d+4>>2]}while(!(!(0|u)&!(0|f)))}if(g=0|We(0|g,0|h,1,0),!((0|(h=0|B()))<(0|t)|(0|h)==(0|t)&g>>>0>>0)){l=0,c=11;break}d=c}return 10==(0|c)?(S=s,0|(m=14)):11==(0|c)?(S=s,0|l):0},_uncompactCellsSize:function(A,e,t,r,o){A|=0,e|=0,t|=0,r|=0,o|=0;var i,a,s=0,l=0,c=0,u=0,f=0,d=0;a=S,S=S+16|0,i=a;A:do{if((0|t)>0|!(0|t)&e>>>0>0){for(f=0,l=0,s=0,d=0;;){if(!(!(0|(c=0|n[(u=A+(f<<3)|0)>>2]))&!(0|(u=0|n[u+4>>2]))||(u=!(0|_A(c,u,r,i)),l=0|We(0|n[(c=i)>>2],0|n[c+4>>2],0|l,0|s),s=0|B(),u))){s=12;break}if(f=0|We(0|f,0|d,1,0),!((0|(d=0|B()))<(0|t)|(0|d)==(0|t)&f>>>0>>0))break A}return S=a,0|s}l=0,s=0}while(0);return n[o>>2]=l,n[o+4>>2]=s,S=a,0},_vertexToLatLng:function(A,e,t){t|=0;var r,o,i,a,s=0,l=0;return a=S,S=S+192|0,o=a,i=a+168|0,s=0|tt(0|(A|=0),0|(e|=0),56),B(),s&=7,0|(r=0|XA(A,l=-2130706433&e|134217728,i))?(S=a,0|(l=r)):(e=0|tt(0|A,0|e,52),B(),e&=15,0|HA(A,l)?QA(i,e,s,1,o):FA(i,e,s,1,o),l=o+8|0,n[t>>2]=n[l>>2],n[t+4>>2]=n[l+4>>2],n[t+8>>2]=n[l+8>>2],n[t+12>>2]=n[l+12>>2],S=a,0|(l=0))},establishStackSpace:function(A,e){S=A|=0},stackAlloc:function(A){var e;return e=S,S=15+(S=S+(A|=0)|0)&-16,0|e},stackRestore:function(A){S=A|=0},stackSave:function(){return 0|S}}}({Math:Math,Int8Array:Int8Array,Int32Array:Int32Array,Uint8Array:Uint8Array,Float32Array:Float32Array,Float64Array:Float64Array},{b:function(A){s=A},c:function(){return s},d:function(A,e,t,r){tA("Assertion failed: "+v(A)+", at: "+[e?v(e):"unknown filename",t,r?v(r):"unknown function"])},e:function(A){return t.___errno_location&&(h[t.___errno_location()>>2]=A),A},f:z,g:function(A,e,t){d.set(d.subarray(e,e+t),A)},h:function(A){var e=z(),t=16777216,r=2130706432;if(A>r)return!1;for(var n=Math.max(e,16777216);n0))return 0;for(var n=t+r-1,o=0;o=55296&&i<=57343&&(i=65536+((1023&i)<<10)|1023&A.charCodeAt(++o)),i<=127){if(t>=n)break;e[t++]=i}else if(i<=2047){if(t+1>=n)break;e[t++]=192|i>>6,e[t++]=128|63&i}else if(i<=65535){if(t+2>=n)break;e[t++]=224|i>>12,e[t++]=128|i>>6&63,e[t++]=128|63&i}else{if(t+3>=n)break;e[t++]=240|i>>18,e[t++]=128|i>>12&63,e[t++]=128|i>>6&63,e[t++]=128|63&i}}e[t]=0}(A,d,e,t)}(A,e=Z(t),t)}return e},array:function(A){var e,t,r=Z(A.length);return e=A,t=r,f.set(e,t),r}},o=c(A),i=[],a=0;if(r)for(var s=0;s>1]=e;break;case"i32":h[A>>2]=e;break;case"i64":I=[e>>>0,(L=e,+j(L)>=1?L>0?(0|F(+S(L/4294967296),4294967295))>>>0:~~+N((L-+(~~L>>>0))/4294967296)>>>0:0)],h[A>>2]=I[0],h[A+4>>2]=I[1];break;case"float":m[A>>2]=e;break;case"double":p[A>>3]=e;break;default:tA("invalid type for setValue: "+t)}},t.getValue=function(A,e,t){switch("*"===(e=e||"i8").charAt(e.length-1)&&(e="i32"),e){case"i1":case"i8":return f[0|A];case"i16":return g[A>>1];case"i32":case"i64":return h[A>>2];case"float":return m[A>>2];case"double":return p[A>>3];default:tA("invalid type for getValue: "+e)}return null},R){H(R)||(V=R,R=t.locateFile?t.locateFile(V,o):o+V),P++,t.monitorRunDependencies&&t.monitorRunDependencies(P);var X=function(A){A.byteLength&&(A=new Uint8Array(A)),d.set(A,8),t.memoryInitializerRequest&&delete t.memoryInitializerRequest.response,function(){if(P--,t.monitorRunDependencies&&t.monitorRunDependencies(P),0==P&&T){var A=T;T=null,A()}}()},q=function(){n(R,X,function(){throw"could not load memory initializer "+R})},$=O(R);if($)X($.buffer);else if(t.memoryInitializerRequest){var AA=function(){var A=t.memoryInitializerRequest,e=A.response;if(200!==A.status&&0!==A.status){var r=O(t.memoryInitializerRequestURL);if(!r)return void q();e=r.buffer}X(e)};t.memoryInitializerRequest.response?setTimeout(AA,0):t.memoryInitializerRequest.addEventListener("load",AA)}else q()}function eA(A){function e(){W||(W=!0,l||(k(B),k(M),t.onRuntimeInitialized&&t.onRuntimeInitialized(),function(){if(t.postRun)for("function"==typeof t.postRun&&(t.postRun=[t.postRun]);t.postRun.length;)Q(t.postRun.shift());k(D)}()))}P>0||(function(){if(t.preRun)for("function"==typeof t.preRun&&(t.preRun=[t.preRun]);t.preRun.length;)E(t.preRun.shift());k(C)}(),P>0||(t.setStatus?(t.setStatus("Running..."),setTimeout(function(){setTimeout(function(){t.setStatus("")},1),e()},1)):e()))}function tA(A){throw t.onAbort&&t.onAbort(A),i(A+=""),a(A),l=!0,"abort("+A+"). Build with -s ASSERTIONS=1 for more info."}if(T=function A(){W||eA(),W||(T=A)},t.run=eA,t.abort=tA,t.preInit)for("function"==typeof t.preInit&&(t.preInit=[t.preInit]);t.preInit.length>0;)t.preInit.pop()();return eA(),A}("object"==typeof Me?Me:{}),De="number",Ee={0:"Success",1:"The operation failed but a more specific error is not available",2:"Argument was outside of acceptable range",3:"Latitude or longitude arguments were outside of acceptable range",4:"Resolution argument was outside of acceptable range",5:"Cell argument was not valid",6:"Directed edge argument was not valid",7:"Undirected edge argument was not valid",8:"Vertex argument was not valid",9:"Pentagon distortion was encountered",10:"Duplicate input",11:"Cell arguments were not neighbors",12:"Cell arguments had incompatible resolutions",13:"Memory allocation failed",14:"Bounds of provided memory were insufficient",15:"Mode or flags argument was not valid",16:"Index argument was not valid",17:"Base cell number was outside of acceptable range",18:"Child indexing digits invalid",19:"Child indexing digits refer to a deleted subsequence"},Qe={1e3:"Unknown unit",1001:"Array length out of bounds",1002:"Got unexpected null value for H3 index"};function je(A,e,t){var r=t&&"value"in t,n=new Error((A[e]||"Unknown error")+" (code: "+e+(r?", value: "+t.value:"")+")");return n.code=e,n}function Ne(A){if(0!==A)throw function(A,e){return je(Ee,A,2===arguments.length?{value:e}:{})}(A)}var Se={};[["sizeOfH3Index",De],["sizeOfLatLng",De],["sizeOfCellBoundary",De],["sizeOfGeoLoop",De],["sizeOfGeoPolygon",De],["sizeOfLinkedGeoPolygon",De],["sizeOfCoordIJ",De],["readInt64AsDoubleFromPointer",De],["isValidCell",De,[De,De]],["isValidIndex",De,[De,De]],["latLngToCell",De,[De,De,De,De]],["cellToLatLng",De,[De,De,De]],["cellToBoundary",De,[De,De,De]],["maxGridDiskSize",De,[De,De]],["gridDisk",De,[De,De,De,De]],["gridDiskDistances",De,[De,De,De,De,De]],["gridRing",De,[De,De,De,De]],["gridRingUnsafe",De,[De,De,De,De]],["maxPolygonToCellsSize",De,[De,De,De,De]],["polygonToCells",De,[De,De,De,De]],["maxPolygonToCellsSizeExperimental",De,[De,De,De,De]],["polygonToCellsExperimental",De,[De,De,De,De,De,De]],["cellsToLinkedMultiPolygon",De,[De,De,De]],["destroyLinkedMultiPolygon",null,[De]],["compactCells",De,[De,De,De,De]],["uncompactCells",De,[De,De,De,De,De,De]],["uncompactCellsSize",De,[De,De,De,De,De]],["isPentagon",De,[De,De]],["isResClassIII",De,[De,De]],["getBaseCellNumber",De,[De,De]],["getResolution",De,[De,De]],["getIndexDigit",De,[De,De,De]],["constructCell",De,[De,De,De,De]],["maxFaceCount",De,[De,De,De]],["getIcosahedronFaces",De,[De,De,De]],["cellToParent",De,[De,De,De,De]],["cellToChildren",De,[De,De,De,De]],["cellToCenterChild",De,[De,De,De,De]],["cellToChildrenSize",De,[De,De,De,De]],["cellToChildPos",De,[De,De,De,De]],["childPosToCell",De,[De,De,De,De,De,De]],["areNeighborCells",De,[De,De,De,De,De]],["cellsToDirectedEdge",De,[De,De,De,De,De]],["getDirectedEdgeOrigin",De,[De,De,De]],["getDirectedEdgeDestination",De,[De,De,De]],["isValidDirectedEdge",De,[De,De]],["directedEdgeToCells",De,[De,De,De]],["originToDirectedEdges",De,[De,De,De]],["directedEdgeToBoundary",De,[De,De,De]],["gridDistance",De,[De,De,De,De,De]],["gridPathCells",De,[De,De,De,De,De]],["gridPathCellsSize",De,[De,De,De,De,De]],["cellToLocalIj",De,[De,De,De,De,De,De]],["localIjToCell",De,[De,De,De,De,De]],["getHexagonAreaAvgM2",De,[De,De]],["getHexagonAreaAvgKm2",De,[De,De]],["getHexagonEdgeLengthAvgM",De,[De,De]],["getHexagonEdgeLengthAvgKm",De,[De,De]],["greatCircleDistanceM",De,[De,De]],["greatCircleDistanceKm",De,[De,De]],["greatCircleDistanceRads",De,[De,De]],["cellAreaM2",De,[De,De,De]],["cellAreaKm2",De,[De,De,De]],["cellAreaRads2",De,[De,De,De]],["edgeLengthM",De,[De,De,De]],["edgeLengthKm",De,[De,De,De]],["edgeLengthRads",De,[De,De,De]],["getNumCells",De,[De,De]],["getRes0Cells",De,[De]],["res0CellCount",De],["getPentagons",De,[De,De]],["pentagonCount",De],["cellToVertex",De,[De,De,De,De]],["cellToVertexes",De,[De,De,De]],["vertexToLatLng",De,[De,De,De]],["isValidVertex",De,[De,De]]].forEach(function(A){Se[A[0]]=Me.cwrap.apply(Me,A)});var Fe=16,Pe=Se.sizeOfH3Index(),Te=Se.sizeOfLatLng(),Le=Se.sizeOfCellBoundary();Se.sizeOfGeoPolygon(),Se.sizeOfGeoLoop(),Se.sizeOfLinkedGeoPolygon(),Se.sizeOfCoordIJ();var Ie=/[^0-9a-fA-F]/;function Re(A){if(A>=0)return A.toString(Fe);var e=_e(8,(A&=2147483647).toString(Fe));return(parseInt(e[0],Fe)+8).toString(Fe)+e.substring(1)}function _e(A,e){for(var t=A-e.length,r="",n=0;n.85?.9+(i-.85)/.15*.1:.1+(i-.15)/.7*.8;var i;return Ke(r[Math.min(23,Math.floor(24*o))])}function Xe({coveragePoints:r,visible:n,terrainEnabled:o=!1,brightness:i=.7,basemapMode:a="dark"}){const{current:s}=t(),[l,c]=A.useState(null);A.useEffect(()=>{const A=()=>{var A;const e=null==(A=null==s?void 0:s.getMap)?void 0:A.call(s);e&&!l&&c(e)};A();const e=setInterval(A,50),t=setTimeout(()=>clearInterval(e),5e3);return()=>{clearInterval(e),clearTimeout(t)}},[s,l]);const[u,f]=A.useState(null),[d,g]=A.useState(!1),h=A.useRef({aborted:!1}),m=A.useRef(0),p=A.useRef(a),b=function(e){const[t,r]=A.useState(e);return A.useEffect(()=>{const A=setTimeout(()=>r(e),300);return()=>clearTimeout(A)},[e,300]),t}(r),v=A.useMemo(()=>function(A="dark"){var e;if("light"===A)return Ze;const t=X();return 24===t.length&&0!==(null==(e=t[0])?void 0:e[0])?t:We}(a),[a]);A.useEffect(()=>{if(!b||!Array.isArray(b)||0===b.length)return void queueMicrotask(()=>{f(null),m.current=0});const A=p.current!==a;if(b.length===m.current&&u&&!A)return;m.current=b.length,p.current=a,h.current.aborted=!0,h.current={aborted:!1};const e=h.current;g(!0);const{cells:t,minQuality:r,maxQuality:n}=function(A){const e=new Map;for(const o of A){if("number"!=typeof o.lat||"number"!=typeof o.lon||isNaN(o.lat)||isNaN(o.lon))continue;const A=Ge(o.lat,o.lon,8),t=e.get(A),r=o.weight;t?(t.count++,t.qualitySum+=r):e.set(A,{count:1,qualitySum:r})}const t=[];let r=1/0,n=-1/0;for(const[o,i]of e.entries()){const A=i.qualitySum/i.count;t.push({hexId:o,count:i.count,avgQuality:A}),r=Math.min(r,A),n=Math.max(n,A)}return{cells:t,minQuality:t.length>0?r:0,maxQuality:t.length>0?n:0}}(b);if(0===t.length)return f(null),void g(!1);if(t.length<500){const A=function(A,e,t,r){const n=[];for(const o of A){const A=Oe(o.hexId).map(([A,e])=>[e,A]);A.push(A[0]);const i=Je(o.avgQuality,e,t,r);n.push({type:"Feature",properties:{color:i,quality:o.avgQuality,count:o.count},geometry:{type:"Polygon",coordinates:[A]}})}return{type:"FeatureCollection",features:n}}(t,r,n,v);return void(e.aborted||(f(A),g(!1)))}return async function(A,e,t,r,n){const o=[];let i=0;for(;i[e,A]);a.push(a[0]);const s=Je(n.avgQuality,e,t,r);o.push({type:"Feature",properties:{color:s,quality:n.avgQuality,count:n.count},geometry:{type:"Polygon",coordinates:[a]}})}irequestAnimationFrame(A))}return{type:"FeatureCollection",features:o}}(t,r,n,v,e).then(A=>{!e.aborted&&A&&f(A)}).finally(()=>{e.aborted||g(!1)}),()=>{e.aborted=!0}},[b,v]),A.useEffect(()=>{if(!l)return;const A=()=>{var A,e;try{const t=l.getLayer(Ve),r=l.getSource(Ye);if(n&&u&&u.features.length>0){if(r?l.getSource(Ye).setData(u):l.addSource(Ye,{type:"geojson",data:u}),!t){const t=l.getLayer("topology-weak-edges-native"),r=null==(e=null==(A=l.getStyle())?void 0:A.layers)?void 0:e.find(A=>"symbol"===A.type),n=t?"topology-weak-edges-native":null==r?void 0:r.id;l.addLayer({id:Ve,type:"fill",source:Ye,paint:{"fill-color":["get","color"],"fill-opacity":i}},n)}}else t&&l.removeLayer(Ve),r&&l.removeSource(Ye)}catch(t){}};l.isStyleLoaded()?A():l.once("style.load",A)},[l,n,u,o]),A.useEffect(()=>{if(l&&n)try{l.getLayer(Ve)&&l.setPaintProperty(Ve,"fill-opacity",i)}catch{}},[l,i,n]),A.useEffect(()=>()=>{if(l)try{l.getLayer(Ve)&&l.removeLayer(Ve),l.getSource(Ye)&&l.removeSource(Ye)}catch{}},[l]);const w=(null==u?void 0:u.features.length)??0;return w>0&&n?e.jsx("div",{"data-testid":"wardriving-hexlayer-maplibre-active","data-point-count":(null==r?void 0:r.length)||0,"data-cell-count":w,"data-terrain-enabled":o,"data-is-processing":d,style:{display:"none"}}):null}const qe="https://s3.amazonaws.com/elevation-tiles-prod/terrarium/{z}/{x}/{y}.png",$e="terrarium",At="terrain-dem",et="hillshade-dem",tt="terrain-hillshade";function rt({enabled:e,exaggeration:r=4}){const{current:n}=t(),[o,i]=A.useState(null),a=A.useRef(null);return A.useEffect(()=>{const A=()=>{var A;const e=null==(A=null==n?void 0:n.getMap)?void 0:A.call(n);e&&!o&&i(e)};A();const e=setInterval(A,50),t=setTimeout(()=>clearInterval(e),5e3);return()=>{clearInterval(e),clearTimeout(t)}},[n,o]),A.useEffect(()=>{if(!o)return;let A=!0;const e=()=>{var e,t;if(A)try{if(o.getSource(et)||o.addSource(et,{type:"raster-dem",tiles:[qe],encoding:$e,tileSize:256,maxzoom:14}),!o.getLayer(tt)){const A=null==(t=null==(e=o.getStyle())?void 0:e.layers)?void 0:t.find(A=>"symbol"===A.type);o.addLayer({id:tt,type:"hillshade",source:et,paint:{"hillshade-shadow-color":"rgba(10, 10, 10, 0.6)","hillshade-highlight-color":"rgba(245, 240, 230, 0.4)","hillshade-accent-color":"rgba(90, 75, 65, 0.3)","hillshade-illumination-direction":315,"hillshade-exaggeration":.35}},null==A?void 0:A.id)}o.getSource(At)||o.addSource(At,{type:"raster-dem",tiles:[qe],encoding:$e,tileSize:256,maxzoom:14})}catch(r){}};return o.isStyleLoaded()?e():(o.once("style.load",e),o.once("load",()=>{A&&!o.getSource(et)&&e()})),()=>{A=!1}},[o]),A.useEffect(()=>{if(!o)return;let A=!0,t=!1;const n=()=>{if(A&&o.getSource(At))try{e?(o.setCenterClampedToGround(!1),o.setTerrain({source:At,exaggeration:r}),o.setMaxPitch(70),!t&&o.getPitch()<30&&!o.isMoving()&&(t=!0,null!==a.current&&clearTimeout(a.current),a.current=window.setTimeout(()=>{a.current=null,A&&!o.isMoving()&&o.getPitch()<30&&o.easeTo({pitch:45,duration:1e3})},200))):(o.setTerrain(null),o.setCenterClampedToGround(!0),o.getPitch()>0&&!o.isMoving()&&o.easeTo({pitch:0,duration:800}),o.setMaxPitch(60))}catch(n){}};if(o.isStyleLoaded()&&o.getSource(At))n();else{const A=()=>{o.getSource(At)&&n()};o.once("idle",A)}return()=>{A=!1,null!==a.current&&(clearTimeout(a.current),a.current=null)}},[o,e,r]),A.useEffect(()=>()=>{var A;try{(null==(A=null==o?void 0:o.getStyle)?void 0:A.call(o))&&o.isStyleLoaded()&&(o.setTerrain(null),o.getLayer(tt)&&o.removeLayer(tt),o.getSource(et)&&o.removeSource(et),o.getSource(At)&&o.removeSource(At))}catch{}},[o]),null}function nt(A,e){let t=0;for(let r=0;r0)for(let t=0;t=A.length)return A;const t=[],r=A.length/e;for(let n=0;no.has(A.fromHash)&&o.has(A.toHash));if(0===i.length)return null;const a=function(A,e,t,r){const n=e.length,o=new Map(e.map((A,e)=>[A,e])),i=Array(n).fill(null).map(()=>Array(n).fill(0));for(const a of A){const A=o.get(a.fromHash),e=o.get(a.toHash);if(void 0!==A&&void 0!==e&&A!==e){const n=a.strength*a.certainCount;let o=1;if(t){const A=t.get(a.fromHash),e=t.get(a.toHash);A&&e&&(o=st(LA(A[0],A[1],e[0],e[1])/1e3))}let s=1;if(r){const A=[a.fromHash,a.toHash].sort().join("-");s=1-.7*(r.get(A)??0)}const l=.3+.7*(a.symmetryRatio??0),c=Math.pow(n,.7)*Math.pow(o,.3)*s*l;i[A][e]=c,i[e][A]=c}}return i}(i,e,t,r),s=function(A){const e=A.length,t=Array(e).fill(null).map(()=>Array(e).fill(0));for(let r=0;rArray(e).fill(0));for(let a=0;a43758.5453*Math.sin(12.9898*e)%1-.5);it(o,t),ot(o);let i=0;for(let a=0;a<100;a++){const A=at(n,o);it(A,t);const e=nt(A,A)/nt(o,A);if(ot(A),o=A,Math.abs(e-i)<1e-8)return{vector:o,eigenvalue:r-e};i=e}return{vector:o,eigenvalue:r-i}}(s);if(c<.001)return null;const u=[],f=[];for(let d=0;d0&&A.push([A[0][0],A[0][1]]),t=A}return t}function pt(A,e={}){const t=function(A,e={}){if(A.length<3)return{coordinates:[],valid:!1};const{bandwidth:t=dt,threshold:r=gt,cellSize:n=ht}=e,o=function(A,e){let t=1/0,r=-1/0,n=1/0,o=-1/0;for(const[i,a]of A)ir&&(r=i),ao&&(o=a);return t-=e,r+=e,n-=e,o+=e,{minX:t,minY:n,maxX:r,maxY:o,width:r-t,height:o-n}}(A,.02),i=Math.ceil(o.width/(t/2)),a=Math.ceil(o.height/(t/2)),s=Math.min(1,200/Math.max(i,a)),l=Math.max(10,Math.ceil(i*s)),c=Math.max(10,Math.ceil(a*s)),u=A=>A/l*o.width+o.minX,f=A=>A/c*o.height+o.minY,d=t/o.width*l;try{const e=pA().x(A=>(A[0]-o.minX)/o.width*l).y(A=>(A[1]-o.minY)/o.height*c).size([l,c]).bandwidth(Math.max(5,d)).cellSize(n)(A);if(0===e.length)return{coordinates:[],valid:!1};const t=Math.max(...e.map(A=>A.value))*r;let i=e[0],a=1/0;for(const A of e){const e=Math.abs(A.value-t);e0){const e=A[0],t=A[A.length-1];e[0]===t[0]&&e[1]===t[1]||A.push([e[0],e[1]])}if(A.length>=4){const t=mt(A);e.push(t)}}e.length>0&&s.push(e)}const g=[];for(const A of s)for(const e of A)g.push(e);return{coordinates:s,valid:s.length>0}}catch(g){return{coordinates:[],valid:!1}}}(A,e);return t.valid&&0!==t.coordinates.length?1===t.coordinates.length?{type:"Polygon",coordinates:t.coordinates[0]}:{type:"MultiPolygon",coordinates:t.coordinates}:null}function bt(A,e,t){return(e[0]-A[0])*(t[1]-A[1])-(e[1]-A[1])*(t[0]-A[0])}function vt(A,e,t,r,n){const o=n*n,i=o*n;return[.5*(2*e[0]+(-A[0]+t[0])*n+(2*A[0]-5*e[0]+4*t[0]-r[0])*o+(-A[0]+3*e[0]-3*t[0]+r[0])*i),.5*(2*e[1]+(-A[1]+t[1])*n+(2*A[1]-5*e[1]+4*t[1]-r[1])*o+(-A[1]+3*e[1]-3*t[1]+r[1])*i)]}function wt(A){let e=function(A){if(A.length<3)return A;const e=[...A].sort((A,e)=>A[0]-e[0]||A[1]-e[1]),t=[];for(const n of e){for(;t.length>=2&&bt(t[t.length-2],t[t.length-1],n)<=0;)t.pop();t.push(n)}const r=[];for(let n=e.length-1;n>=0;n--){const A=e[n];for(;r.length>=2&&bt(r[r.length-2],r[r.length-1],A)<=0;)r.pop();r.push(A)}return t.pop(),r.pop(),t.concat(r)}(A);if(e.length<3)return null;e=function(A){if(A.length<3)return A;let e=0,t=0;for(const[r,n]of A)e+=r,t+=n;return e/=A.length,t/=A.length,A.map(([A,r])=>{const n=A-e,o=r-t,i=Math.sqrt(n*n+o*o);if(i<1e-4)return[A,r];const a=(i+.008)/i;return[e+n*a,t+o*a]})}(e);const t=function(A){if(A.length<3)return A;const e=[],t=A.length;for(let r=0;rt?function(A,e,t,r){const n=[];for(const[o,i]of A.communities){const A=[];for(const t of i){const r=e.get(t);r&&A.push([r[1],r[0]])}if(A.length<3)continue;let a=pt(A,{bandwidth:t,threshold:r});a||(a=wt(A)),a&&n.push({type:"Feature",properties:{community:o,color:ut(o),borderColor:ft(o),nodeCount:i.length},geometry:a})}return{type:"FeatureCollection",features:n}}(t,o,s,l):{type:"FeatureCollection",features:[]},[t,o,s,l]),f=i?a:0,d={"fill-color":["get","color"],"fill-opacity":f},g={"line-color":["get","borderColor"],"line-width":c,"line-opacity":f};return e.jsxs(r,{id:"mincut-partition",type:"geojson",data:u,children:[e.jsx(n,{id:"mincut-partition-fill",type:"fill",paint:d}),e.jsx(n,{id:"mincut-partition-stroke",type:"line",paint:g})]})}const xt={showTopology:!1,showNeighborLines:!0,show3DTerrain:!1,showMinCut:!1,nodeFilter:"all"},kt=uA()(fA(A=>({viewState:null,setViewState:e=>A({viewState:e,lastSavedAt:Date.now()}),toggles:xt,setToggle:(e,t)=>A(A=>({toggles:{...A.toggles,[e]:t},lastSavedAt:Date.now()})),setToggles:e=>A(A=>({toggles:{...A.toggles,...e},lastSavedAt:Date.now()})),hasAnalyzed:!1,setHasAnalyzed:e=>A({hasAnalyzed:e,lastSavedAt:Date.now()}),lastSavedAt:null,reset:()=>A({viewState:null,toggles:xt,hasAnalyzed:!1,lastSavedAt:null})}),{name:"pymc-map-view",partialize:A=>({viewState:A.viewState,toggles:A.toggles,hasAnalyzed:A.hasAnalyzed,lastSavedAt:A.lastSavedAt})}));function Ct(A,e=!1,t=!1,r=!1,n=.7,o){const i=K(o);return r?n>=.75?i.restBright:i.rest:n>=.85?i.rest:i.restDim}function Bt(A){return[A[1],A[0]]}function Mt(A,e,t,r=12){const[n,o]=A,[i,a]=e,s=[];for(let l=0;l<=r;l++){const A=l/r,e=o+(a-o)*A,c=n+(i-n)*A,u=4*t*A*(1-A);s.push([e,c,u])}return s}function Dt(A){return A<.5?4*A*A*A:1-Math.pow(-2*A+2,3)/2}function Et(A,e,t,r,n,o,i,a,s,l,c,u="dark"){const f=_A(),d=[];let g=1/0,h=-1/0;const m=[];for(const b of A){const A=.7*(b.edge.avgConfidence??(e?.7:.5))+b.edge.certainCount/Math.max(i,1)*.3+(e?.5:0);m.push({polyline:b,brightnessScore:A}),g=Math.min(g,A),h=Math.max(h,A)}if(0===m.length)return{type:"FeatureCollection",features:[]};const p=h-g||1;m.sort((A,e)=>A.brightnessScore-e.brightnessScore);for(const{polyline:b,brightnessScore:v}of m){const{from:A,to:i,edge:h}=b,m=t.get(h.key)??0;if(m<=0)continue;const w=a.has(h.key),y=s.has(h.key),x=h.avgConfidence??(e?.7:.5),k=l===h.key,C=c[h.fromHash],B=c[h.toHash],M=(null==C?void 0:C.node_name)||(null==C?void 0:C.name)||h.fromHash.slice(0,8),D=(null==B?void 0:B.node_name)||(null==B?void 0:B.name)||h.toHash.slice(0,8),E=[A[0]+(i[0]-A[0])*m,A[1]+(i[1]-A[1])*m];let Q,j,N,S;if(e){const A=o.get(h.key)??IA(h.certainCount),e=n.get(h.key)??A;Q=e+(A-e)*r,k?Q=Math.max(1.6*Q,4.5):y&&(Q*=1.3)}else Q=1.5;if(j=k?f.edges.highlight:Ct(0,h.isDirectPathEdge??!1,w,y,x,u),N=k?f.edges.highlight:h.isDirectPathEdge?f.edges.hoverDirect:w?f.edges.hoverLoop:f.edges.hoverStandard,e){const A=Math.min(1.5*m,1)*f.edgeOpacity;S=y?1.15*A:A}else S=(.3+.3*x)*m;k&&(S=.95);const F=(v-g)/p;d.push({type:"Feature",properties:{key:h.key,baseColor:j,hoverColor:N,baseWidth:Q,baseOpacity:S,brightnessScore:F,isLoopEdge:w,isBackbone:y,isDirectPath:h.isDirectPathEdge??!1,isHubConnection:h.isHubConnection??!1,isZeroHop:h.isZeroHop??!1,isValidated:e,certainCount:h.certainCount,confidence:x,symmetryRatio:h.symmetryRatio??1,dominantDirection:h.dominantDirection??"balanced",fromName:M,toName:D,fromHash:h.fromHash,toHash:h.toHash},geometry:{type:"LineString",coordinates:[Bt(A),Bt(E)]}})}return{type:"FeatureCollection",features:d}}function Qt(A,e){const t=_A(),r=[];let n=0;for(const o of A){const A=e.get(o.hash);A&&A.blendedScore>n&&(n=A.blendedScore)}for(const o of A){const{from:A,to:i,hash:a,neighbor:s,lastHopData:l}=o,c=`neighbor-${a}`,u=(null==l?void 0:l.avgRssi)??s.rssi??null,f=(null==l?void 0:l.avgSnr)??s.snr??null,d=(null==l?void 0:l.count)??0,g=(null==l?void 0:l.confidence)??1,h=e.get(a),m=(null==h?void 0:h.listenerScore)??0,p=(null==h?void 0:h.loudScore)??0,b=(null==h?void 0:h.blendedScore)??0,v=n>0?b/n:0,w=o.rxAdvertCount??0,y=o.txProxyCount??0,x=w+y,k=x>0?(y-w)/x:0,C=Mt(A,i,150,8);r.push({type:"Feature",properties:{key:c,hash:a,name:s.node_name||s.name||a.slice(0,8),prefix:a.slice(2,4).toUpperCase(),color:t.neighborColor,width:2.5,opacity:.85,rssi:u,snr:f,packetCount:d,confidence:g,hasAvgRssi:void 0!==(null==l?void 0:l.avgRssi),hasAvgSnr:void 0!==(null==l?void 0:l.avgSnr),isNeighborEdge:!0,listenerScore:m,loudScore:p,blendedScore:b,trafficWeight:v,linkAsymmetry:k,rxAdvertCount:w,txProxyCount:y},geometry:{type:"LineString",coordinates:C}})}return{type:"FeatureCollection",features:r}}function jt(A){return A<.5?4*A*A*A:1-Math.pow(-2*A+2,3)/2}function Nt(A,e){if(A<240)return.5;if(A<480)return 1;const t=(A-480)/(e-480);return Math.max(0,.33*(1-t))}function St(A,e,t){const r=t?Q(t):null,n=[];for(const o of A){if(r&&o.toUpperCase()===r){t&&n.push(t);continue}const A=e.get(o.toUpperCase());A&&n.push(A)}return n}const Ft="edge-blink-source",Pt="edge-blink-layer",Tt=1e3,Lt=1e3,It="node-markers-layer";function Rt(A){return A<0||A>=Tt?0:1-A/Tt}function _t(A){if(A<0)return 0;if(A>=Lt)return 0;const e=A/Lt;return Math.pow(1-e,3)}function Ht(A){return[A[1],A[0]]}function zt(A){const e=new Date(1e3*A);return`${(e.getMonth()+1).toString().padStart(2,"0")}/${e.getDate().toString().padStart(2,"0")}`}function Gt({txDelayRec:t,onRemove:r}){const[n,o]=A.useState(!1),i=t.floodFactor??t.txDelayFactor,a=t.directFactor??t.directTxDelayFactor;return e.jsxs("div",{className:"flex items-center gap-2 text-[10px]",children:[e.jsxs("button",{onClick:async()=>{const A=`set txdelay ${i.toFixed(1)}\nset direct.txdelay ${a.toFixed(1)}`;try{await navigator.clipboard.writeText(A),o(!0),setTimeout(()=>o(!1),1500)}catch(e){const t=document.createElement("textarea");t.value=A,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();try{document.execCommand("copy"),o(!0),setTimeout(()=>o(!1),1500)}catch{}document.body.removeChild(t)}},className:"flex items-center gap-2 flex-1 py-1 px-1.5 bg-amber-400/5 hover:bg-amber-400/10 rounded transition-colors group",title:"Click to copy CLI commands",children:[e.jsx(FA,{className:"w-3 h-3 text-amber-400 shrink-0"}),e.jsx("span",{className:"text-text-muted",children:"TxDelay"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"text-text-muted",children:"F"}),e.jsxs("span",{className:"data-box data-box-compact text-amber-400",children:["×",i.toFixed(1)]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"text-text-muted",children:"D"}),e.jsxs("span",{className:"data-box data-box-compact text-amber-400",children:["×",a.toFixed(1)]})]})]}),n?e.jsx(hA,{className:"w-3 h-3 text-green-400 ml-auto"}):e.jsx(xA,{className:"w-3 h-3 text-text-muted opacity-0 group-hover:opacity-100 transition-opacity ml-auto"})]}),r&&e.jsx("button",{onClick:r,className:"p-1 text-text-secondary hover:text-red-400 hover:bg-red-500/10 rounded transition-colors",title:"Remove from contacts",children:e.jsx(z,{className:"w-3.5 h-3.5"})})]})}function Ot({hash:t,hashPrefix:r,name:n,isHub:o,isGateway:i,isBackbone:a,isZeroHop:s,isMobile:l,isRoomServer:c,isStale:u,lastSeenTimestamp:f,centrality:d,affinity:g,meanSnr:h,meanRssi:m,neighbor:p,onRemove:b,txDelayRec:v}){const[w,y]=A.useState(!1),x=s?"Direct":(null==g?void 0:g.typicalHopPosition)?`${g.typicalHopPosition}-hop`:null,k=v&&!v.insufficientData;return e.jsxs("div",{className:"w-[240px] pr-2",children:[e.jsx("div",{className:"text-[14px] font-semibold text-text-primary leading-tight truncate mb-1",children:n}),e.jsxs("div",{className:"flex items-center gap-1 flex-wrap mb-1.5",children:[e.jsx("code",{className:"font-mono text-[10px] text-text-secondary bg-data-box-bg border border-data-box-border px-1 py-0.5 rounded",children:r}),e.jsx("button",{onClick:async()=>{try{await navigator.clipboard.writeText(t),y(!0),setTimeout(()=>y(!1),1500)}catch(A){const e=document.createElement("textarea");e.value=t,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select();try{document.execCommand("copy"),y(!0),setTimeout(()=>y(!1),1500)}catch{}document.body.removeChild(e)}},className:"p-0.5 hover:bg-subtle-fill-hover rounded transition-colors",title:"Copy full hash",children:w?e.jsx(hA,{className:"w-3 h-3 text-sys-green"}):e.jsx(xA,{className:"w-3 h-3 text-text-secondary"})}),e.jsx($,{hash:t,size:"sm"}),x&&e.jsx(N,{color:s?bA.direct:bA.multihop,compact:!0,children:x}),p.is_repeater&&e.jsx(N,{color:vA.repeater,compact:!0,children:"Rptr"}),o&&e.jsx(N,{color:vA.hub,compact:!0,title:"Hub: ≥10% of last-hop traffic",children:"Hub"}),i&&!o&&e.jsx(N,{color:vA.gateway,compact:!0,title:"Gateway: 7-10% of last-hop traffic",children:"Gate"}),a&&e.jsx(N,{color:vA.backbone,compact:!0,title:"Backbone",children:"Bone"}),l&&e.jsx(N,{color:vA.mobile,compact:!0,children:"Mobile"}),c&&e.jsx(N,{color:vA.room,compact:!0,children:"Room"}),u&&f&&e.jsxs(N,{compact:!0,title:"Neighbor not heard in 7+ days",children:["Idle ",zt(f)]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-text-secondary mb-1.5",children:[e.jsxs("span",{className:"flex items-center gap-0.5",children:[e.jsx(S,{className:"w-3 h-3 text-text-muted shrink-0"}),e.jsx("span",{className:"font-mono",children:F(p.last_seen)})]}),(null==g?void 0:g.distanceMeters)&&e.jsxs("span",{className:"flex items-center gap-0.5",children:[e.jsx(AA,{className:"w-3 h-3 text-text-muted shrink-0"}),e.jsx("span",{className:"font-mono font-semibold text-text-primary",children:(C=g.distanceMeters,null===C?"—":C<1e3?`${Math.round(C)}m`:`${(C/1e3).toFixed(1)}km`)})]}),p.latitude&&p.longitude&&0!==p.latitude&&0!==p.longitude&&e.jsxs("span",{className:"flex items-center gap-0.5",children:[e.jsx(kA,{className:"w-3 h-3 text-text-muted shrink-0"}),e.jsxs("span",{className:"font-mono text-text-muted",children:[p.latitude.toFixed(2),", ",p.longitude.toFixed(2)]})]})]}),e.jsx("div",{className:"mb-1.5",style:{width:224},children:e.jsx(eA,{nodeHash:t,width:224,height:26,showArea:!0,showTooltip:!0})}),e.jsxs("div",{className:"flex gap-3 text-[10px] mb-1.5",children:[e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsxs("div",{className:"flex justify-between items-center gap-2",children:[e.jsx("span",{className:"text-text-muted",children:"Packets"}),e.jsx("span",{className:"data-box data-box-compact",children:(null==g?void 0:g.frequency)||0})]}),s&&void 0!==h&&e.jsxs("div",{className:"flex justify-between items-center gap-2",children:[e.jsx("span",{className:"text-text-muted",children:"SNR"}),e.jsxs("span",{className:"data-box data-box-compact",children:[h.toFixed(1)," dB"]})]}),k&&v.networkRole&&e.jsxs("div",{className:"flex justify-between items-center gap-2",children:[e.jsx("span",{className:"text-text-muted",children:"Role"}),e.jsx(N,{color:wA[v.networkRole],compact:!0,title:{hub:"Hub: High-connectivity node that bridges many paths",backbone:"Backbone: Critical relay with high traffic",relay:"Relay: Standard forwarding node",edge:"Edge: Peripheral node"}[v.networkRole],children:v.networkRole})]})]}),e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsxs("div",{className:"flex justify-between items-center gap-2",children:[e.jsx("span",{className:"text-text-muted",children:"Adverts"}),e.jsx("span",{className:"data-box data-box-compact",children:p.advert_count||0})]}),s&&void 0!==m&&e.jsxs("div",{className:"flex justify-between items-center gap-2",children:[e.jsx("span",{className:"text-text-muted",children:"RSSI"}),e.jsxs("span",{className:"data-box data-box-compact",children:[Math.round(m)," dBm"]})]}),k&&v.dataConfidence&&e.jsxs("div",{className:"flex justify-between items-center gap-2",children:[e.jsx("span",{className:"text-text-muted",children:"Data"}),e.jsx(N,{color:yA[v.dataConfidence],compact:!0,title:{high:"1000+ packets",medium:"500-999 packets",low:"100-499 packets",insufficient:"Insufficient data"}[v.dataConfidence],children:v.dataConfidence})]})]}),!k&&b&&e.jsx("button",{onClick:b,className:"p-1 self-start text-text-secondary hover:text-red-400 hover:bg-red-500/10 rounded transition-colors",title:"Remove from contacts",children:e.jsx(z,{className:"w-3.5 h-3.5"})})]}),k&&e.jsx(Gt,{txDelayRec:v,onRemove:b})]});var C}const Ut="node-markers-native",Yt="node-markers-layer",Vt="node-markers-layer-local",Wt="marker-standard",Zt="marker-standard-neighbor",Kt="marker-hub",Jt="marker-hub-neighbor",Xt="marker-gateway",qt="marker-gateway-neighbor",$t="marker-mobile",Ar="marker-mobile-neighbor",er="marker-room-server",tr="marker-room-server-neighbor",rr="marker-local",nr="marker-blink-black",or="marker-blink-black-local",ir="marker-blink",ar="marker-blink-local";function sr(A){var e;const t=null==(e=A.contact_type)?void 0:e.toLowerCase();return"room server"===t||"room_server"===t||"room"===t||"server"===t}function lr(A){return A.startsWith("0x")?A.slice(2,4).toUpperCase():A.slice(0,2).toUpperCase()}function cr({neighborsWithLocation:i,localNode:a,localHash:s,zeroHopNeighbors:l,lastHopNeighborMap:c,meshTopology:u,hoveredMarker:f,onMarkerHover:d,getNodeOpacity:g,shouldShowNode:h,onRequestRemove:m,openPopupId:p,onOpenPopup:b,onClosePopup:v,onNodeClick:w,blinkingNodes:y}){const{current:x}=t(),k=A.useRef(!1),[C,B]=A.useState(!1);A.useEffect(()=>{var A;const e=null==(A=null==x?void 0:x.getMap)?void 0:A.call(x);if(!e)return;const t=()=>{try{!function(A){const e=Z(),t=(A,e,t=0,r=!1)=>{const n=document.createElement("canvas");n.width=32,n.height=32;const o=n.getContext("2d",r?{colorSpace:"display-p3"}:void 0),i=14-t/2;return o.beginPath(),o.arc(16,16,i,0,2*Math.PI),o.fillStyle=A,o.fill(),e&&t>0&&(o.strokeStyle=e,o.lineWidth=2*t,o.stroke()),o.shadowColor="rgba(0,0,0,0.3)",o.shadowBlur=4,o.shadowOffsetY=2,{data:o.getImageData(0,0,32,32),pixelRatio:2}},r=(A,e=!1)=>{const t=document.createElement("canvas");t.width=48,t.height=48;const r=t.getContext("2d",e?{colorSpace:"display-p3"}:void 0),n=24*.35*2;return r.strokeStyle=A,r.lineWidth=5,r.lineCap="round",r.lineJoin="round",r.beginPath(),r.moveTo(24-n,24),r.lineTo(24,24-n),r.lineTo(40.8,24),r.stroke(),r.beginPath(),r.moveTo(24-.7*n,24),r.lineTo(24-.7*n,35.76),r.lineTo(35.76,35.76),r.lineTo(35.76,24),r.stroke(),r.beginPath(),r.moveTo(20.64,35.76),r.lineTo(20.64,27.36),r.lineTo(27.36,27.36),r.lineTo(27.36,35.76),r.stroke(),{data:r.getImageData(0,0,48,48),pixelRatio:2}},n=(A,e)=>{const t=document.createElement("canvas");t.width=48,t.height=48;const r=t.getContext("2d"),n=24*.35*2;return r.strokeStyle=A,r.lineWidth=5,r.lineCap="round",r.lineJoin="round",e&&(r.fillStyle=e),r.beginPath(),r.roundRect(24-n,24-.6*n,1.6*n,1.2*n,6),e&&r.fill(),r.stroke(),r.beginPath(),r.moveTo(18.96,34.08),r.lineTo(24-.6*n,40.8),r.lineTo(24,34.08),r.stroke(),{data:r.getImageData(0,0,48,48),pixelRatio:2}},o="#00FF00",i={[Wt]:t(e.nodeFill),[Zt]:t(e.neighborColor),[Kt]:t(e.hubColor),[Jt]:t(e.neighborColor),[Xt]:t(e.gatewayColor),[qt]:t(e.neighborColor),[$t]:t("transparent",e.mobileColor,2.5),[Ar]:t(e.neighborColor),[er]:n(e.roomColor),[tr]:n(e.neighborColor,"#1a1a1c"),[rr]:r(e.localColor),[nr]:t("#000000"),[or]:r("#000000"),[ir]:t(o,void 0,0,!0),[ar]:r(o,!0)};for(const[a,s]of Object.entries(i))A.hasImage(a)&&A.removeImage(a),A.addImage(a,s.data,{pixelRatio:s.pixelRatio})}(e),k.current=!0,C||B(!0)}catch(A){}};e.isStyleLoaded()?t():e.once("style.load",t);const r=()=>{e.hasImage(Wt)||t()};e.on("styledata",r);const n=()=>{k.current=!1,t()},o=new MutationObserver(A=>{for(const e of A)if("data-theme"===e.attributeName){setTimeout(n,100);break}});o.observe(document.documentElement,{attributes:!0});const i=document.querySelector("[data-basemap]");let a=null;return i&&(a=new MutationObserver(A=>{for(const e of A)if("data-basemap"===e.attributeName){setTimeout(n,100);break}}),a.observe(i,{attributes:!0})),()=>{e.off("styledata",r),o.disconnect(),null==a||a.disconnect()}},[x,C]);const M=A.useMemo(()=>{var A;const e=[],t=[...i].sort(([A,e],[t,r])=>{const n=(A,e)=>{var t;return sr(e)?5e3:l.has(A)?3e3:u.hubNodes.includes(A)?2e3:(null==(t=u.gatewayNodes)?void 0:t.includes(A))?1e3:0};return n(A,e)-n(t,r)});for(const[r,n]of t){if(!n.latitude||!n.longitude)continue;if(s&&((s.startsWith("0x")?s.slice(2,4).toLowerCase():s.slice(0,2).toLowerCase())===(r.startsWith("0x")?r.slice(2,4).toLowerCase():r.slice(0,2).toLowerCase())||r===s))continue;const t=h(r),o=g(r,t);if(o<=.01)continue;const i=l.has(r),a=u.hubNodes.includes(r),f=(null==(A=u.gatewayNodes)?void 0:A.includes(r))??!1,d=u.mobileNodes.includes(r),m=sr(n),p=u.centrality.get(r)||0,b=c.get(r),v="stale"===(null==b?void 0:b.status),w=v?Math.min(o,.5):o;let y="standard";m?y="roomServer":a?y="hub":f?y="gateway":d&&(y="mobile");const x=u.fullAffinity.get(r),k=u.txDelayRecommendations.get(r);e.push({type:"Feature",geometry:{type:"Point",coordinates:[n.longitude,n.latitude]},properties:{hash:r,name:n.node_name||n.name||"Unknown",hashPrefix:lr(r),iconType:y,isNeighbor:i,isHub:a,isGateway:f,isMobile:d,isRoomServer:m,isStale:v,isZeroHop:i,opacity:w,blinkIntensity:0,lastSeenTimestamp:null==b?void 0:b.lastSeen,centrality:p,neighborJson:JSON.stringify(n),affinityJson:x?JSON.stringify(x):void 0,txDelayRecJson:k?JSON.stringify(k):void 0,meanSnr:(null==b?void 0:b.avgSnr)??void 0,meanRssi:(null==b?void 0:b.avgRssi)??void 0}})}return{type:"FeatureCollection",features:e}},[i,s,l,c,u,g,h]),D=A.useMemo(()=>(null==a?void 0:a.latitude)&&(null==a?void 0:a.longitude)?{type:"FeatureCollection",features:[{type:"Feature",geometry:{type:"Point",coordinates:[a.longitude,a.latitude]},properties:{hash:"local",name:a.name,hashPrefix:s?lr(s):"",iconType:"local",isNeighbor:!1,isHub:!1,isGateway:!1,isMobile:!1,isRoomServer:!1,isStale:!1,isZeroHop:!1,opacity:1,blinkIntensity:0,centrality:0}}]}:{type:"FeatureCollection",features:[]},[a,s]),E=A.useCallback(A=>{var e;if(!A.features||0===A.features.length)return;const t=null==(e=A.features[0].properties)?void 0:e.hash;t&&(b&&b(t),w&&"local"!==t&&w(t))},[b,w]),Q=A.useCallback(A=>{var e,t;if(!A.features||0===A.features.length)return;const r=null==(e=null==x?void 0:x.getMap)?void 0:e.call(x);r&&(r.getCanvas().style.cursor="pointer");const n=null==(t=A.features[0].properties)?void 0:t.hash;n&&d(n)},[x,d]),j=A.useCallback(()=>{var A;const e=null==(A=null==x?void 0:x.getMap)?void 0:A.call(x);e&&(e.getCanvas().style.cursor=""),d(null)},[x,d]);A.useEffect(()=>{var A;const e=null==(A=null==x?void 0:x.getMap)?void 0:A.call(x);if(!e||!C)return;const t=[Yt,Vt];for(const r of t)e.on("click",r,E),e.on("mouseenter",r,Q),e.on("mouseleave",r,j);return()=>{for(const A of t)e.off("click",A,E),e.off("mouseenter",A,Q),e.off("mouseleave",A,j)}},[x,C,E,Q,j]);const N=A.useRef(M),S=A.useRef(D);A.useEffect(()=>{N.current=M,S.current=D},[M,D]),A.useEffect(()=>{var A;const e=null==(A=null==x?void 0:x.getMap)?void 0:A.call(x);if(!e||!C||!y||0===y.size)return;const t=e.getSource(Ut),r=e.getSource(`${Ut}-local`);if(t||r){if(t){const A=N.current;let e=!1;const r=A.features.map(A=>{const t=y.get(A.properties.hash)??0;return t!==A.properties.blinkIntensity?(e=!0,{...A,properties:{...A.properties,blinkIntensity:t}}):A});e&&t.setData({type:"FeatureCollection",features:r})}if(r&&s){const A=y.get(s)??0,e=S.current;e.features.length>0&&e.features[0].properties.blinkIntensity!==A&&r.setData({type:"FeatureCollection",features:[{...e.features[0],properties:{...e.features[0].properties,blinkIntensity:A}}]})}}},[x,C,y,s]);const F=A.useMemo(()=>{if(!p)return null;if("local"===p&&a)return{longitude:a.longitude,latitude:a.latitude,isLocal:!0,name:a.name,hash:s};const A=M.features.find(A=>A.properties.hash===p);if(!A)return null;const e=A.properties,t=e.txDelayRecJson?JSON.parse(e.txDelayRecJson):void 0;return{longitude:A.geometry.coordinates[0],latitude:A.geometry.coordinates[1],isLocal:!1,hash:e.hash,hashPrefix:e.hashPrefix,name:e.name,isHub:e.isHub,isGateway:e.isGateway,isBackbone:"backbone"===(null==t?void 0:t.networkRole),isZeroHop:e.isZeroHop,isMobile:e.isMobile,isRoomServer:e.isRoomServer,isStale:e.isStale,lastSeenTimestamp:e.lastSeenTimestamp,centrality:e.centrality,neighbor:e.neighborJson?JSON.parse(e.neighborJson):void 0,affinity:e.affinityJson?JSON.parse(e.affinityJson):void 0,txDelayRec:t,meanSnr:e.meanSnr,meanRssi:e.meanRssi}},[p,a,s,M]);if(!C)return null;const P=Z(),T=["case",[">",["get","blinkIntensity"],.66],ir,[">",["get","blinkIntensity"],.33],nr,["==",["get","iconType"],"roomServer"],["case",["get","isNeighbor"],tr,er],["==",["get","iconType"],"hub"],["case",["get","isNeighbor"],Jt,Kt],["==",["get","iconType"],"gateway"],["case",["get","isNeighbor"],qt,Xt],["==",["get","iconType"],"mobile"],["case",["get","isNeighbor"],Ar,$t],["case",["get","isNeighbor"],Zt,Wt]],L=["interpolate",["linear"],["zoom"],6,.25,10,1];return e.jsxs(e.Fragment,{children:[e.jsx(r,{id:Ut,type:"geojson",data:M,children:e.jsx(n,{id:Yt,type:"symbol",layout:{"icon-image":T,"icon-size":L,"icon-allow-overlap":!0,"icon-ignore-placement":!0,"symbol-sort-key":["get","opacity"]},paint:{"icon-opacity":["get","opacity"]}})}),e.jsx(r,{id:`${Ut}-local`,type:"geojson",data:D,children:e.jsx(n,{id:Vt,type:"symbol",layout:{"icon-image":["case",[">",["get","blinkIntensity"],.66],ar,[">",["get","blinkIntensity"],.33],or,rr],"icon-size":L,"icon-allow-overlap":!0,"icon-ignore-placement":!0},paint:{"icon-opacity":1}})}),F&&v&&e.jsx(o,{longitude:F.longitude,latitude:F.latitude,offset:{center:[0,0],top:[0,12],"top-left":[6,12],"top-right":[-6,12],bottom:[0,-12],"bottom-left":[6,-12],"bottom-right":[-6,-12],left:[12,0],right:[-12,0]},maxWidth:"280px",closeOnClick:!0,onClose:v,className:"maplibre-popup",children:F.isLocal?e.jsxs("div",{className:"text-sm",children:[e.jsx("strong",{className:"text-base",children:F.name}),F.hash&&e.jsx("span",{className:"ml-2 font-mono text-xs text-text-muted bg-surface-elevated px-1.5 py-0.5 rounded",children:lr(F.hash)}),e.jsx("br",{}),e.jsx("span",{style:{color:P.localColor},className:"font-medium",children:"This Node (Local)"}),e.jsx("br",{}),a&&e.jsxs("span",{className:"text-xs text-text-muted",children:[a.latitude.toFixed(5),", ",a.longitude.toFixed(5)]})]}):F.neighbor&&F.hash?e.jsx(Ot,{hash:F.hash,hashPrefix:F.hashPrefix,name:F.name,isHub:F.isHub,isGateway:F.isGateway,isBackbone:F.isBackbone,isZeroHop:F.isZeroHop,isMobile:F.isMobile,isRoomServer:F.isRoomServer,isStale:F.isStale,lastSeenTimestamp:F.lastSeenTimestamp,centrality:F.centrality,affinity:F.affinity,meanSnr:F.meanSnr,meanRssi:F.meanRssi,neighbor:F.neighbor,txDelayRec:F.txDelayRec,onRemove:m?()=>m(F.hash,F.name):void 0}):null})]})}const ur=[Yt,Vt];A.createContext(null);const fr="topology-validated-edges-native",dr="topology-weak-edges-native",gr="neighbor-edges-native",hr="topology-weak-edges-native",mr="topology-validated-edges-native",pr="neighbor-edges-native",br={type:"FeatureCollection",features:[]},vr={"line-cap":"round","line-join":"round"},wr={"line-color":"transparent","line-width":16,"line-opacity":0};function yr({showTopology:o,isExiting:i,hoveredEdgeKey:a,highlightedLoopEdges:s,highlightedFocusEdges:l,onEdgeHover:c,onLoopHover:f,loops:d=[],neighborNames:g={},opacityBias:h=.5,widthMultiplier:m=1,trafficFilter:p=0,showNeighborLines:b=!0,disableHover:v=!1}){const{current:w}=t(),y=o||i,x=!0,k=b?"visible":"none",C=v||i,B=A.useRef(null),M=A.useRef(C),D=A.useRef(new Map),E=A.useRef(g),Q=A.useRef(f);A.useLayoutEffect(()=>{M.current=C,E.current=g,Q.current=f});const j=A.useMemo(()=>function(A){const e=new Map;for(const t of A)for(const A of t.edgeKeys){const r=e.get(A)??[];r.push(t),e.set(A,r)}return e}(d),[d]);A.useLayoutEffect(()=>{D.current=j},[j]);const N=A.useCallback(A=>{var e,t;if(M.current)return;if(!A.features||0===A.features.length)return;const r=A.features[0].properties;if(!(null==r?void 0:r.key))return;const n=r.key;if(n!==B.current){B.current=n;const o=!0===r.isNeighborEdge||"true"===r.isNeighborEdge,i=!0===r.isLoopEdge||"true"===r.isLoopEdge;if(o){const t={key:n,fromName:"Local",toName:r.name,certainCount:Number(r.packetCount)||0,confidence:1,isBackbone:!1,isLoopEdge:!1,isDirectPath:!0,isZeroHop:!0,symmetryRatio:1,dominantDirection:"balanced",isHubConnection:!1};c(n,[A.lngLat.lng,A.lngLat.lat],t),null==(e=Q.current)||e.call(Q,null)}else if(i&&Q.current){const e=D.current.get(n)??[];if(e.length>0){const t=new Set;for(const A of e)for(const e of A.edgeKeys)t.add(e);const r={loops:e,highlightedEdgeKeys:t,hoveredEdgeKey:n,nodeNames:e[0].nodes.map(A=>E.current[A]||A.substring(0,4))};Q.current(r,[A.lngLat.lng,A.lngLat.lat]),c(n)}else{const e={key:n,fromName:r.fromName,toName:r.toName,certainCount:Number(r.certainCount),confidence:Number(r.confidence),isBackbone:!0===r.isBackbone||"true"===r.isBackbone,isLoopEdge:!0,isDirectPath:!0===r.isDirectPath||"true"===r.isDirectPath,isZeroHop:!0===r.isZeroHop||"true"===r.isZeroHop,symmetryRatio:Number(r.symmetryRatio),dominantDirection:r.dominantDirection,isHubConnection:!0===r.isHubConnection||"true"===r.isHubConnection};c(n,[A.lngLat.lng,A.lngLat.lat],e)}}else{const e={key:n,fromName:r.fromName,toName:r.toName,certainCount:Number(r.certainCount),confidence:Number(r.confidence),isBackbone:!0===r.isBackbone||"true"===r.isBackbone,isLoopEdge:i,isDirectPath:!0===r.isDirectPath||"true"===r.isDirectPath,isZeroHop:!0===r.isZeroHop||"true"===r.isZeroHop,symmetryRatio:Number(r.symmetryRatio),dominantDirection:r.dominantDirection,isHubConnection:!0===r.isHubConnection||"true"===r.isHubConnection};c(n,[A.lngLat.lng,A.lngLat.lat],e),null==(t=Q.current)||t.call(Q,null)}}},[c]),S=A.useCallback(()=>{var A;null!==B.current&&(B.current=null,c(null),null==(A=Q.current)||A.call(Q,null))},[c]);A.useEffect(()=>{var A;const e=null==(A=null==w?void 0:w.getMap)?void 0:A.call(w);if(!e||!y)return;const t="topology-validated-edges-hitarea-native",r=()=>{try{return e.getStyle()&&e.getLayer(t)}catch{return!1}},n=()=>!!r()&&(e.on("mousemove",t,N),e.on("mouseleave",t,S),!0);if(!n()){const A=()=>{n()&&e.off("styledata",A)};return e.on("styledata",A),()=>{try{e.off("styledata",A),r()&&(e.off("mousemove",t,N),e.off("mouseleave",t,S))}catch{}}}return()=>{try{r()&&(e.off("mousemove",t,N),e.off("mouseleave",t,S))}catch{}}},[w,y,N,S]),A.useEffect(()=>{var A;const e=null==(A=null==w?void 0:w.getMap)?void 0:A.call(w);if(!e||!b)return;const t="neighbor-edges-hitarea-native",r=()=>{try{return e.getStyle()&&e.getLayer(t)}catch{return!1}},n=()=>!!r()&&(e.on("mousemove",t,N),e.on("mouseleave",t,S),!0);if(!n()){const A=()=>{n()&&e.off("styledata",A)};return e.on("styledata",A),()=>{try{e.off("styledata",A),r()&&(e.off("mousemove",t,N),e.off("mouseleave",t,S))}catch{}}}return()=>{try{r()&&(e.off("mousemove",t,N),e.off("mouseleave",t,S))}catch{}}},[w,x,b,N,S]),A.useEffect(()=>{var A;const e=null==(A=null==w?void 0:w.getMap)?void 0:A.call(w);if(!e)return;let t=null;const r=(A,t)=>{try{if(e.getLayer(A)&&e.getLayer(t))return e.moveLayer(A,t),!0}catch{}return!1},n=()=>{try{if(!e.getLayer("node-markers-layer"))return;r(pr,"node-markers-layer"),r("neighbor-edges-hitarea-native",pr),(r(mr,"neighbor-edges-hitarea-native")||r(mr,"node-markers-layer"))&&r("topology-validated-edges-hitarea-native",mr),r(hr,"topology-validated-edges-hitarea-native")}catch{}},o=()=>{t&&clearTimeout(t),t=setTimeout(n,50)},i=setTimeout(n,100);e.on("styledata",o);const a=A=>{(A.sourceId===fr||A.sourceId===dr||A.sourceId===gr)&&o()};return e.on("sourcedata",a),()=>{clearTimeout(i),t&&clearTimeout(t);try{e.off("styledata",o),e.off("sourcedata",a)}catch{}}},[w,y,x,b]);const F=C?null:a,P=function(A,e,t,r,n,o){const i=_A(),a=null!==A,s=n&&n.size>0,l=o&&o.size>0,c=s?Array.from(n):[],u=l?Array.from(o):[],f=e<=0?["get","baseColor"]:["case",[">=",["get","brightnessScore"],1-.5*e],"#FFFFFF",["get","baseColor"]],d=e<=0?1:["max",.1,["+",1,["*",e,3,["-",["get","brightnessScore"],.5]]]],g=s?["in",["get","key"],["literal",c]]:l?["in",["get","key"],["literal",u]]:!!a&&["==",["get","key"],A],h=a||s||l,m=i.edges.hoverLoop??"#A78BFA";return{"line-color":h?["case",g,s?m:l?"#FFD700":["get","hoverColor"],f]:f,"line-width":h?["case",g,["max",["*",["get","baseWidth"],t,1.3],3.5],["*",["get","baseWidth"],t]]:["*",["get","baseWidth"],t],"line-opacity":["case",["<",["get","brightnessScore"],r],0,h?["case",g,["min",["*",["get","baseOpacity"],1.25],1],["*",["get","baseOpacity"],d,.35]]:["*",["get","baseOpacity"],d]]}}(F,h,m,p,C?null:s,l??null),T=function(A){const e=null!==A,{YELLOW:t,GREEN:r,RED:n,GRAY:o}=u,i=["to-number",["get","listenerScore"],0],a=["to-number",["get","loudScore"],0],s=["/",i,["max",["+",i,a],1]],l=["*",["+",.2,["*",["to-number",["get","trafficWeight"],0],.8]],8];return{"line-color":["case",["all",["==",i,0],["==",a,0]],o,[">=",s,.97],r,["<=",s,.03],n,["interpolate",["linear"],s,.03,n,.5,t,.97,r]],"line-width":["interpolate",["linear"],["zoom"],6,e?["case",["==",["get","key"],A],["max",["*",l,.25],1.25],["*",l,.25]]:["*",l,.25],10,e?["case",["==",["get","key"],A],["max",l,5],l]:l],"line-opacity":e?["case",["==",["get","key"],A],1,.35]:.9}}(F);return e.jsxs(e.Fragment,{children:[y&&e.jsx(r,{id:dr,type:"geojson",data:br,children:e.jsx(n,{id:hr,type:"line",paint:P,layout:{...vr,visibility:k}})}),y&&e.jsxs(r,{id:fr,type:"geojson",data:br,children:[e.jsx(n,{id:"topology-validated-edges-hitarea-native",type:"line",paint:wr,layout:{...vr,visibility:k}}),e.jsx(n,{id:mr,type:"line",paint:P,layout:{...vr,visibility:k}})]}),e.jsxs(r,{id:gr,type:"geojson",data:br,children:[e.jsx(n,{id:"neighbor-edges-hitarea-native",type:"line",paint:wr,layout:{...vr,visibility:k}}),e.jsx(n,{id:pr,type:"line",paint:T,layout:{...vr,visibility:k}})]})]})}const xr=["topology-validated-edges-hitarea-native","topology-validated-edges-native","topology-weak-edges-native","neighbor-edges-hitarea-native","neighbor-edges-native"];function kr({targetHash:e,nodeCoordinates:r,onComplete:n}){const{current:o}=t(),i=A.useRef(null);return A.useEffect(()=>{if(!o||!e||e===i.current)return;const A=r.get(e);if(!A)return;const t=o.getMap();t.isMoving()&&t.stop(),i.current=e;const[a,s]=A;o.flyTo({center:[s,a],zoom:10,duration:2500,essential:!0}),setTimeout(()=>{null==n||n()},2600)},[e,r,o,n]),null}function Cr({highlightedEdgeKey:e,validatedPolylines:r,weakPolylines:n,onEnsureTopology:o}){const{current:i}=t(),a=A.useRef(null);return A.useEffect(()=>{if(!i||!e)return;if(e===a.current)return;a.current=e,o();const A=r.find(A=>A.edge.key===e)||n.find(A=>A.edge.key===e);if(!A)return;if(i.getMap().isMoving())return;const t=(A.from[0]+A.to[0])/2,s=(A.from[1]+A.to[1])/2,l=i.getZoom(),c=Math.max(l,11);i.easeTo({center:[s,t],zoom:c,duration:500})},[e,r,n,i,o]),null}function Br(A,e,t,r=64){const n=[],o=t/6371e3*(180/Math.PI),i=o/Math.cos(e*Math.PI/180);for(let a=0;a<=r;a++){const t=a/r*2*Math.PI,s=A+i*Math.cos(t),l=e+o*Math.sin(t);n.push([s,l])}return{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[n]}}}function Mr({ghost:o,neighborCoordinates:i,onHighlightedNeighborsChange:a}){const{current:s}=t(),l=A.useRef(null),c=A.useRef(null),u=A.useMemo(()=>o?new Set(o.commonNeighbors):new Set,[o]);A.useEffect(()=>{null==a||a(u)},[u,a]);const f=A.useMemo(()=>{if(!(null==o?void 0:o.commonNeighbors)||o.commonNeighbors.length<2)return 8e3;let A=0;const e=[];for(const t of o.commonNeighbors){const A=i.get(t);A&&e.push(A)}o.estimatedLocation&&e.push([o.estimatedLocation.lat,o.estimatedLocation.lon]);for(let t=0;tA&&(A=n)}return Math.max(A,2e3)},[o,i]),d=A.useMemo(()=>{if(!(null==o?void 0:o.estimatedLocation))return{type:"FeatureCollection",features:[]};const{lat:A,lon:e,uncertaintyM:t}=o.estimatedLocation,r=.5*f,n=t>0?t:2e3;return{type:"FeatureCollection",features:[Br(e,A,Math.max(500,Math.min(n,r)))]}},[o,f]);if(A.useEffect(()=>{if(!s)return;const A=s.getMap();if(o&&o.prefix!==c.current){if(c.current=o.prefix,!l.current&&A.getZoom()>3){const e=A.getCenter();l.current={center:[e.lng,e.lat],zoom:A.getZoom(),pitch:A.getPitch(),bearing:A.getBearing()}}const e=[];for(const A of o.commonNeighbors){const t=i.get(A);t&&e.push([t[1],t[0]])}if(o.estimatedLocation&&e.push([o.estimatedLocation.lon,o.estimatedLocation.lat]),e.length>0){const t=()=>{var r;if(A.isMoving())setTimeout(t,100);else if(1===e.length)s.flyTo({center:e[0],zoom:13,duration:1500});else{let A=1/0,t=-1/0,n=1/0,i=-1/0;for(const[r,o]of e)A=Math.min(A,r),t=Math.max(t,r),n=Math.min(n,o),i=Math.max(i,o);if(null==(r=o.estimatedLocation)?void 0:r.uncertaintyM){const e=o.estimatedLocation.uncertaintyM/111e3;A-=e,t+=e,n-=e,i+=e}s.fitBounds([[A,n],[t,i]],{padding:{top:60,bottom:60,left:60,right:60},maxZoom:14,duration:1500})}};setTimeout(t,50)}}if(!o&&null!==c.current&&(c.current=null,l.current)){const e=l.current,t=()=>{A.isMoving()?setTimeout(t,100):(s.flyTo({center:e.center,zoom:e.zoom,pitch:e.pitch,bearing:e.bearing,duration:1e3}),l.current=null)};setTimeout(t,50)}},[o,s,i]),!(null==o?void 0:o.estimatedLocation))return null;return e.jsx(r,{id:"ghost-uncertainty-circle",type:"geojson",data:d,children:e.jsx(n,{id:"ghost-uncertainty-fill",type:"fill",paint:{"fill-color":"rgba(167, 139, 250, 0.15)","fill-opacity":.8}})})}!function(A){const e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(A);e&&(parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16))}(RA.edges.neighborHover);const Dr={version:8,sources:{},layers:[],glyphs:"https://demotiles.maplibre.org/font/{fontstack}/{range}.pbf"},Er={longitude:0,latitude:0,zoom:2};function Qr({data:A}){const t=A.subtitle&&"loop"===A.type,r=A.subtitle&&"loop"!==A.type;return e.jsxs("div",{className:"w-[540px]",children:[e.jsxs("div",{className:"flex items-center justify-between h-5",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[A.title.icon&&e.jsx("span",{className:`${A.title.color} text-base leading-none flex-shrink-0`,children:A.title.icon}),e.jsx("span",{className:`${A.title.color} font-semibold text-[13px] truncate`,children:A.title.text}),r&&e.jsx("span",{className:`${A.subtitle.color} text-[11px] flex-shrink-0`,children:A.subtitle.text})]}),A.badges.length>0&&e.jsx("div",{className:"flex items-center gap-2 flex-shrink-0 ml-3",children:A.badges.map((A,t)=>e.jsx("span",{className:`${A.color} text-[11px] font-medium`,children:A.text},t))})]}),t&&e.jsx("div",{className:"h-4 mt-0.5 overflow-hidden",children:e.jsx("span",{className:"font-mono text-[10px] text-text-muted truncate block",children:A.subtitle.text})}),e.jsx("div",{className:`flex items-center gap-4 h-4 ${t?"mt-1":"mt-1.5"} text-[11px]`,children:A.stats.map((A,t)=>e.jsxs("span",{className:"whitespace-nowrap",children:[e.jsx("span",{className:`font-mono tabular-nums font-semibold ${A.color??"text-text-primary"}`,children:A.value}),e.jsx("span",{className:"text-text-muted ml-1",children:A.label}),A.unit&&e.jsx("span",{className:"text-text-muted/50 ml-0.5",children:A.unit})]},t))})]})}function jr({neighbors:t,localNode:r,localHash:n,onRemoveNode:o,selectedNodeHash:u,onNodeSelected:d,highlightedEdgeKey:g,highlightedGhost:h}){const m=A.useRef(null),p=P(),b=T(),v=L(),w=I(),y=R(),[x,k]=A.useState(!1),C=kt(A=>A.viewState),B=kt(A=>A.toggles),N=kt(A=>A.hasAnalyzed),S=kt(A=>A.setViewState),F=kt(A=>A.setToggle),H=kt(A=>A.setHasAnalyzed),z=_(A=>A.preloadFromNodes),O=_(A=>A.isLoading),U=_(A=>A.terrainGrid),Y=n??y,V=A.useMemo(()=>{const A=[];for(const[,e]of Object.entries(t))e.latitude&&e.longitude&&A.push([e.latitude,e.longitude]);return A},[t]),Z=A.useMemo(()=>function(A,e){let t=[...A];if((null==e?void 0:e.latitude)&&(null==e?void 0:e.longitude)&&t.push([e.latitude,e.longitude]),0===t.length)return null;if(1===t.length){const[A,e]=t[0];return{longitude:e,latitude:A,zoom:14}}t=function(A,e){if(A.length<=2)return A;let t,r;if((null==e?void 0:e.latitude)&&(null==e?void 0:e.longitude))t=e.latitude,r=e.longitude;else{let e=0,n=0;for(const[t,r]of A)e+=t,n+=r;t=e/A.length,r=n/A.length}const n=A.map(([A,e])=>{return{pos:[A,e],dist:(n=t,o=r,i=A,a=e,LA(n,o,i,a)/1e3)};var n,o,i,a});n.sort((A,e)=>A.dist-e.dist);const o=n[Math.floor(n.length/2)].dist,i=Math.max(3*o,50),a=n.filter(A=>A.dist<=i).map(A=>A.pos);return a.length<.5*A.length?A:a}(t,e);let r=1/0,n=-1/0,o=1/0,i=-1/0;for(const[d,g]of t)r=Math.min(r,g),n=Math.max(n,g),o=Math.min(o,d),i=Math.max(i,d);const a=(r+n)/2,s=(o+i)/2,l=i-o,c=n-r,u=Math.max(l,c);let f=16;return u>0&&(f=Math.floor(Math.log2(360/u*1.2)),f=Math.max(1,Math.min(14,f))),f=Math.min(f+1,12),{longitude:a,latitude:s,zoom:f}}(V,r),[V,r]),[K,J]=A.useState(()=>C??Z??Er),X=A.useCallback(A=>{J(A),S(A)},[S]),q=A.useRef(!!C);A.useEffect(()=>{q.current||!Z||C?C&&setTimeout(()=>k(!0),50):(J(Z),S(Z),q.current=!0,setTimeout(()=>k(!0),50))},[Z,C,S]);const[$,AA]=A.useState(!1),[eA,tA]=A.useState(()=>!(B.showTopology&&!w.topologyLoadComplete)&&B.showTopology),[rA,nA]=A.useState(B.showNeighborLines),[oA,iA]=A.useState(!1),[aA,sA]=A.useState(B.showMinCut),[lA,cA]=A.useState(we),[uA,fA]=A.useState(B.show3DTerrain),[dA,gA]=A.useState(B.nodeFilter),hA=A.useCallback(A=>{tA(e=>{const t="function"==typeof A?A(e):A;return F("showTopology",t),t})},[F]),mA=A.useCallback(A=>{nA(e=>{const t="function"==typeof A?A(e):A;return F("showNeighborLines",t),t})},[F]),pA=A.useCallback(A=>{sA(e=>{const t="function"==typeof A?A(e):A;return F("showMinCut",t),t})},[F]),bA=A.useCallback(A=>{fA(e=>{const t="function"==typeof A?A(e):A;return F("show3DTerrain",t),t})},[F]),vA=A.useCallback(A=>{gA(A),F("nodeFilter",A)},[F]),[wA,yA]=A.useState(null),[xA,kA]=A.useState(null),[CA,BA]=A.useState(null),[MA]=A.useState(0),[DA]=A.useState(.5),[EA]=A.useState(0),[QA,jA]=A.useState(null),[NA,SA]=A.useState(""),[FA,PA]=A.useState(!1),[TA,RA]=A.useState("fetching"),[_A,zA]=A.useState(!1),[GA,OA]=A.useState(0),[UA,YA]=A.useState(()=>!(N&&!w.topologyLoadComplete)&&N);A.useEffect(()=>{w.topologyLoadComplete||(N&&!UA&&H(!1),B.showTopology&&!eA&&F("showTopology",!1))},[N,B.showTopology,w.topologyLoadComplete,UA,eA,H,F]);const VA=A.useCallback(A=>{YA(A),H(A)},[H]),[WA,JA]=A.useState(null),XA=A.useCallback(A=>JA(A),[]),qA=A.useCallback(()=>JA(null),[]),[,Ae]=A.useState(new Set),te=de(A=>A.coveragePoints),ne=de(A=>A.isVisible),oe=de(A=>A.brightness),ie=de(A=>A.openModal),ae=Be(A=>A.isEnabled),se=Be(A=>A.toggle),le=i(),ce=a(),ue=A.useRef(!1);A.useEffect(()=>{te.length>0&&ne&&!ue.current&&(mA(!1),ue.current=!0)},[te.length,ne]);const fe=A.useRef(null);A.useEffect(()=>{if(u&&u!==fe.current){fe.current=u;const A=setTimeout(()=>{JA(u)},1250);return()=>clearTimeout(A)}},[u]);const[ge,he]=A.useState(null),[me,pe]=A.useState(null),be=A.useCallback((A,e,t)=>{kA(A),A&&e&&t?he({longitude:e[0],latitude:e[1],type:"topology",properties:{key:t.key,fromName:t.fromName,toName:t.toName,certainCount:t.certainCount,confidence:t.confidence,isBackbone:t.isBackbone,isLoopEdge:t.isLoopEdge,isDirectPath:t.isDirectPath,isHubConnection:t.isHubConnection,symmetryRatio:t.symmetryRatio,dominantDirection:t.dominantDirection}}):A||he(null)},[]),ye=A.useCallback((A,e)=>{pe(A),A&&he(null)},[]),xe=A.useMemo(()=>{var A;if(!eA)return null;if(!wA)return null;if(xA)return null;const e=p.loops;if(0===e.length)return null;const r=function(A,e,t){const r=function(A,e){return e.filter(e=>e.nodes.includes(A)).sort((A,e)=>e.avgCertainCount-A.avgCertainCount)}(A,e),n=new Set,o=[];for(const i of r)for(const A of i.edgeKeys)if(!n.has(A)){n.add(A);const e=t.get(A);o.push({key:A,certainCount:(null==e?void 0:e.certainCount)??0})}return o.sort((A,e)=>e.certainCount-A.certainCount),{loops:r,highlightedEdgeKeys:n,sortedEdges:o}}(wA,e,p.edgeMap);if(0===r.loops.length)return null;const n=r.loops[0].nodes.map(A=>{var e,r;return A===Y?"You":(null==(e=t[A])?void 0:e.node_name)||(null==(r=t[A])?void 0:r.name)||A.substring(0,4)});return{loops:r.loops,highlightedEdgeKeys:r.highlightedEdgeKeys,hoveredEdgeKey:(null==(A=r.sortedEdges[0])?void 0:A.key)||"",nodeNames:n}},[eA,wA,xA,p.loops,p.edgeMap,t,Y]);A.useEffect(()=>{xA||pe(xe)},[xe,xA]);const Ce=A.useMemo(()=>{const A={};for(const[e,r]of Object.entries(t))A[e]=r.node_name||r.name||e.substring(0,4);return Y&&(A[Y]="You"),A},[t,Y]),Me=A.useMemo(()=>Object.entries(t).filter(([,A])=>A.latitude&&A.longitude),[t]),De=A.useMemo(()=>{const A=new Map;Y&&(null==r?void 0:r.latitude)&&(null==r?void 0:r.longitude)&&A.set(Y,[r.latitude,r.longitude]);for(const[e,t]of Me)t.latitude&&t.longitude&&A.set(e,[t.latitude,t.longitude]);return A},[Y,r,Me]),Ee=A.useMemo(()=>{const A=new Map;for(const e of v)"expired"!==e.status&&A.set(e.hash,{hash:e.hash,prefix:e.prefix,count:e.count,avgRssi:e.avgRssi,avgSnr:e.avgSnr,lastSeen:e.lastSeen,confidence:1,status:e.status});return A},[v]),Qe=A.useMemo(()=>{var A,e;const r=new Set;for(const n of Ee.keys())(null==(A=t[n])?void 0:A.latitude)&&(null==(e=t[n])?void 0:e.longitude)&&r.add(n);return r},[Ee,t]),je=A.useMemo(()=>{if(0===Qe.size||!Y)return new Map;const A=D.getPackets();if(0===A.length)return new Map;const e=Q(Y);return f(A,Qe,e).scores},[Qe,Y,w.packetCount]),Ne=A.useCallback(A=>!!(Y&&(A.fromHash===Y&&Qe.has(A.toHash)||A.toHash===Y&&Qe.has(A.fromHash))),[Y,Qe]),Se=A.useMemo(()=>{var A,e;if(0===v.length||!Y)return[];if(w.backgroundLoadComplete)return[];const r=[];for(const n of v){if("expired"===n.status)continue;if(!(null==(A=t[n.hash])?void 0:A.latitude)||!(null==(e=t[n.hash])?void 0:e.longitude))continue;const o=[Y,n.hash].sort(),i=`${o[0]}~${o[1]}`;r.push({fromHash:Y,toHash:n.hash,key:i,packetCount:n.count,avgConfidence:1,strength:.8,avgRecency:1,hopDistanceFromLocal:0,isHubConnection:!1,isCertain:!0,certainCount:n.count,isLoopEdge:!1,forwardCount:n.count,reverseCount:0,symmetryRatio:0,dominantDirection:"forward",floodCount:n.count,directCount:0,isDirectPathEdge:!1,isZeroHop:!0,avgRssi:n.avgRssi,avgSnr:n.avgSnr})}return r},[v,Y,w.backgroundLoadComplete,t]),Fe=A.useMemo(()=>{const A=[];if(Se.length>0&&!w.backgroundLoadComplete){for(const e of Se){const t=De.get(e.fromHash),r=De.get(e.toHash);t&&r&&A.push({from:t,to:r,edge:e})}return A}for(const e of p.validatedEdges){if(Ne(e))continue;const t=De.get(e.fromHash),r=De.get(e.toHash);t&&r&&A.push({from:t,to:r,edge:e})}return A},[p.validatedEdges,De,Ne,Se,w.backgroundLoadComplete]),Pe=A.useMemo(()=>{const A=[];for(const e of p.weakEdges){if(Ne(e))continue;const t=De.get(e.fromHash),r=De.get(e.toHash);t&&r&&A.push({from:t,to:r,edge:e})}return A},[p.weakEdges,De,Ne]),Te=A.useMemo(()=>{if(!(null==r?void 0:r.latitude)||!(null==r?void 0:r.longitude))return[];const A=[],e=[r.latitude,r.longitude],n=new Map;for(const t of p.lastHopNeighbors)n.set(t.hash,t.count);const o=new Map;for(const t of v)o.set(t.hash,t.count);for(const r of Qe){const i=t[r];if(!(null==i?void 0:i.latitude)||!(null==i?void 0:i.longitude))continue;const a=o.get(r),s=n.get(r);A.push({from:e,to:[i.latitude,i.longitude],hash:r,neighbor:i,lastHopData:Ee.get(r)??null,rxAdvertCount:a,txProxyCount:s})}return A},[r,Qe,t,Ee,p.lastHopNeighbors,v]),Le=A.useMemo(()=>new Set(p.loopEdgeKeys),[p.loopEdgeKeys]),Ie=A.useMemo(()=>new Set(p.backboneEdges),[p.backboneEdges]),Re=A.useMemo(()=>{if(!CA)return null;const A=p.validatedEdges.filter(A=>A.fromHash===CA||A.toHash===CA);if(0===A.length)return null;const e=[...A].sort((A,e)=>e.certainCount-A.certainCount),t=Math.max(1,Math.ceil(.2*e.length)),r=e.slice(0,t);return new Set(r.map(A=>A.key))},[CA,p.validatedEdges]),_e=A.useMemo(()=>{let A=0;if(Se.length>0&&!w.backgroundLoadComplete){for(const e of Se)e.certainCount>A&&(A=e.certainCount);return A||1}for(const e of p.validatedEdges)e.certainCount>A&&(A=e.certainCount);return A||1},[p.validatedEdges,Se,w.backgroundLoadComplete]),He=A.useMemo(()=>{if(0===p.validatedEdges.length)return null;const A=new Set;for(const r of p.validatedEdges)A.add(r.fromHash),A.add(r.toHash);const e=Array.from(A).filter(A=>De.has(A)).sort();if(e.length<3)return null;const t=new Map;for(const r of e){const A=De.get(r);A&&t.set(r,A)}return function(A,e,t,r){const n=e.length;if(n<3)return{communities:new Map([[0,e]]),nodePartitions:e.map(A=>({hash:A,community:0,fiedlerValue:0})),numCommunities:1,fiedlerValue:0,isConnected:n<=1};const o=[];let i=1/0;const a=[[e,0]];for(;a.length>0;){const[e,n]=a.shift();if((t?lt(e,t):0)>20&&n<4&&e.length>=10){const o=ct(A,e,t,r);if(o){i=Math.min(i,o.fiedlerValue),a.push([o.group0,n+1]),a.push([o.group1,n+1]);continue}}o.push(e)}const s=new Map,l=[],c=new Map;for(let u=0;u{pA(A=>{const e=!A;if(e&&He&&m.current){const A=m.current.getMap();if(!A)return e;let t=1/0,r=-1/0,n=1/0,o=-1/0,i=!1;for(const[,e]of He.communities)for(const A of e){const e=De.get(A);if(e){const[A,a]=e;n=Math.min(n,A),o=Math.max(o,A),t=Math.min(t,a),r=Math.max(r,a),i=!0}}i&&A.fitBounds([[t,n],[r,o]],{padding:{top:60,bottom:100,left:60,right:320},duration:800,maxZoom:14})}return e})},[He,De]),Ge=A.useRef(null);A.useLayoutEffect(()=>{var A,e;Ge.current=(null==(e=null==(A=m.current)?void 0:A.getMap)?void 0:e.call(A))??null});const Oe=M(),Ue=A.useMemo(()=>D.getPackets(),[Oe]);!function({map:e,nodeCoordinates:t,packets:r,localHash:n,neighbors:o,meshTopology:i,enabled:a=!0}){const s=A.useRef(null),l=e&&"current"in e?e.current:e;A.useEffect(()=>{s.current=l},[l]);const c=A.useRef(!1),u=A.useRef(null),f=A.useRef([]),d=A.useRef(0),g=A.useRef(!1),[h,m]=A.useState(!1),p=A.useRef(null),b=A.useRef([]),v=A.useRef(new Map),w=A.useRef(t);A.useEffect(()=>{w.current=t},[t]),A.useEffect(()=>{v.current=function(A,e){const t=new Map;for(const r of Object.keys(A)){const A=Q(r);t.has(A)||t.set(A,r)}if(e){const A=Q(e);t.set(A,e)}return t}(o,n)},[o,n]),A.useEffect(()=>{if(!a){p.current&&(clearTimeout(p.current),p.current=null),b.current=[],null!==u.current&&(cancelAnimationFrame(u.current),u.current=null),f.current=[];const A=s.current;if(A&&c.current){const e=A.getSource(Ft);e&&e.setData({type:"FeatureCollection",features:[]})}g.current=!1,d.current=0}},[a]),A.useEffect(()=>{const A=l;if(!A)return;let e=null,t=!1;const r=()=>{if(!t&&!c.current)try{A.getLayer(Pt)&&A.removeLayer(Pt),A.getSource(Ft)&&A.removeSource(Ft),A.addSource(Ft,{type:"geojson",data:{type:"FeatureCollection",features:[]}});const t=A.getLayer(It)?It:void 0;A.addLayer({id:Pt,type:"line",source:Ft,layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["case",["any",["==",["get","isSpeculative"],!0],["==",["get","isSpeculative"],"true"]],"#8B7BAD","#12A594"],"line-width":["case",["any",["==",["get","isSpeculative"],!0],["==",["get","isSpeculative"],"true"]],1.875,2.5],"line-opacity":["*",["get","opacityMult"],["interpolate",["linear"],["get","intensity"],0,0,.1,.8,.5,1,1,1]]}},t),c.current=!0,m(!0),e&&(clearInterval(e),e=null)}catch{}};return A.isStyleLoaded()&&r(),A.once("style.load",()=>{r()}),c.current||(e=setInterval(()=>{c.current?e&&clearInterval(e):r()},100),setTimeout(()=>{e&&(clearInterval(e),e=null)},5e3)),()=>{t=!0,e&&clearInterval(e),null!==u.current&&(cancelAnimationFrame(u.current),u.current=null);const A=s.current;if(A&&c.current){try{A.getLayer(Pt)&&A.removeLayer(Pt),A.getSource(Ft)&&A.removeSource(Ft)}catch{}c.current=!1,m(!1)}}},[l]);const y=A.useRef(()=>{});A.useEffect(()=>{y.current=()=>{const A=s.current;if(!A)return;const e=A.getSource(Ft);if(!e)return;const t=performance.now(),r=f.current,n=[],o=[];for(const i of r){const A=t-i.startTime-i.delay;if(A<(i.isSpeculative?Lt:Tt)){o.push(i);const e=i.isSpeculative?_t(A):Rt(A);e>0&&n.push({type:"Feature",properties:{intensity:e,opacityMult:i.isSpeculative?.5:1,isSpeculative:i.isSpeculative??!1},geometry:{type:"LineString",coordinates:[i.fromCoord,i.toCoord]}})}}e.setData({type:"FeatureCollection",features:n}),f.current=o,o.length>0?u.current=requestAnimationFrame(()=>y.current()):u.current=null}},[]);const x=A.useCallback(()=>{const A=s.current;A&&function(A){if(!A.getLayer(Pt))return;const e=A.getLayer(It)?It:void 0;try{A.moveLayer(Pt,e)}catch{}}(A),null===u.current&&(u.current=requestAnimationFrame(()=>y.current()))},[]),k=A.useCallback(()=>{if(!s.current||!c.current)return;const A=b.current;if(b.current=[],p.current=null,0===A.length)return;const e=v.current,t=w.current;if(0===e.size)return;const r=performance.now();let o=0,a=!1;const l=new Set;for(const s of A){const A=E(s,n);if(!A||A.original.length<2)continue;const c=A.original;let u=0,d=null;for(let n=0;n0){A.sort((A,e)=>e.confidence-A.confidence);const e=Math.max(1,Math.ceil(.25*A.length)),n=A.slice(0,e),i=o+150*u;for(const{edgeKey:A,otherHash:o}of n){const e=t.get(d),n=t.get(o);f.current.push({edgeKey:A,fromCoord:Ht(e),toCoord:Ht(n),startTime:r,delay:i,isSpeculative:!0}),l.add(A),a=!0}}}u>0&&(o+=150*u*.5)}a&&x()},[n,i,x]);A.useEffect(()=>{const A=s.current;if(!a)return;if(!A)return;if(!h)return;if(0===r.length)return;const e=Date.now(),t=d.current;if(!g.current){g.current=!0;const A=(e-3e4)/1e3,t=r.filter(e=>(e.timestamp??0)>=A);let n=0;for(const e of r){const A=e.timestamp??0;A>n&&(n=A)}if(d.current=n,t.length>0){t.sort((A,e)=>(A.timestamp??0)-(e.timestamp??0));const A=t.slice(-20);b.current.push(...A),k()}return}const n=r.filter(A=>(A.timestamp??0)>t);if(0===n.length)return;let o=0;for(const r of n){const A=r.timestamp??0;A>o&&(o=A)}d.current=o,b.current.push(...n),p.current&&clearTimeout(p.current),p.current=setTimeout(k,175)},[a,r,k,h]),A.useEffect(()=>()=>{p.current&&clearTimeout(p.current)},[])}({map:Ge,nodeCoordinates:De,packets:Ue,localHash:Y,neighbors:t,meshTopology:p,enabled:ae});const{isExiting:Ye,isAnimating:Ve,resetAnimationState:We}=function({map:e,showTopology:t,validatedPolylines:r,weakPolylines:n,maxCertainCount:o,loopEdgeKeys:i,backboneEdgeKeys:a,highlightedEdgeKey:s,neighbors:l,validatedSourceId:c,weakSourceId:u,neighborPolylines:f=[],showNeighborLines:d=!0,neighborSourceId:g,neighborLinkScores:h=new Map,basemapMode:m}){const p=A.useRef(null);A.useEffect(()=>{const A=e&&"current"in e?e.current:e;p.current=A});const b=A.useRef(new Map),v=A.useRef(1),w=A.useRef(new Map),y=A.useRef(new Map),x=A.useRef(!1),k=A.useRef(null),C=A.useRef(t),B=A.useRef(new Set),M=A.useRef(""),D=A.useRef(new Map),E=A.useRef(""),Q=A.useRef(""),j=A.useRef(""),N=A.useRef(r),S=A.useRef(n),F=A.useRef(o),P=A.useRef(i),T=A.useRef(a),L=A.useRef(s),I=A.useRef(l),R=A.useRef(f),_=A.useRef(d),H=A.useRef(h),z=A.useRef(m);A.useEffect(()=>{N.current=r,S.current=n,F.current=o,P.current=i,T.current=a,L.current=s,I.current=l,R.current=f,_.current=d,H.current=h,z.current=m},[r,n,o,i,a,s,l,f,d,h,m]);const G=A.useCallback((A=!1)=>{var e,t,r,n,o,i,a,s,l,f;const d=p.current;if(!d)return;const h=d.getSource(c),m=d.getSource(u),x=d.getSource(g);if(h){const o=Et(N.current,!0,b.current,v.current,w.current,y.current,F.current,P.current,T.current,L.current,I.current,z.current),i=`${o.features.length}:${(null==(t=null==(e=o.features[0])?void 0:e.properties)?void 0:t.key)??""}:${(null==(n=null==(r=o.features[o.features.length-1])?void 0:r.properties)?void 0:n.key)??""}:${Array.from(b.current.values()).reduce((A,e)=>A+e,0).toFixed(2)}`;(A||i!==E.current)&&(h.setData(o),E.current=i)}if(m){const e=Et(S.current,!1,b.current,v.current,w.current,y.current,F.current,P.current,T.current,L.current,I.current,z.current),t=`${e.features.length}:${(null==(i=null==(o=e.features[0])?void 0:o.properties)?void 0:i.key)??""}:${(null==(s=null==(a=e.features[e.features.length-1])?void 0:a.properties)?void 0:s.key)??""}`;(A||t!==Q.current)&&(m.setData(e),Q.current=t)}if(x&&R.current.length>0){const e=Qt(R.current,H.current),t=`${e.features.length}:${(null==(f=null==(l=e.features[0])?void 0:l.properties)?void 0:f.hash)??""}`;(A||t!==j.current)&&(x.setData(e),j.current=t)}},[c,u,g]),O=A.useCallback(()=>{k.current&&(cancelAnimationFrame(k.current),k.current=null),b.current=new Map,v.current=1,w.current=new Map,y.current=new Map,x.current=!1,B.current=new Set,M.current="",D.current=new Map},[]);A.useEffect(()=>{const A=C.current,e=t;if(C.current=t,p.current){if(k.current&&(cancelAnimationFrame(k.current),k.current=null),A&&!e&&!x.current){x.current=!0;const A=new Map(b.current);let e=null;const t=r=>{e||(e=r);const n=r-e,o=Math.min(n/500,1),i=(a=o,1-Math.pow(1-a,3));var a;for(const[e,t]of A)b.current.set(e,t*(1-i));G(!0),o<1?k.current=requestAnimationFrame(t):(x.current=!1,b.current=new Map,B.current=new Set,M.current="",w.current=new Map,y.current=new Map,k.current=null,G(!0))};k.current=requestAnimationFrame(t)}!A&&e&&(b.current=new Map,B.current=new Set,M.current="")}},[t,G]),A.useEffect(()=>{const A=p.current;if(!t||x.current||!A)return;const e=[...r,...n],o=e.map(A=>`${A.edge.key}:${A.edge.certainCount}`).sort().join(","),i=0===B.current.size,a=""!==M.current&&M.current!==o;if(!i&&!a)return void G();const s=[],l=[];for(const{edge:t}of e)B.current.has(t.key)?l.push(t.key):s.push(t.key);a&&l.length>0&&(w.current=new Map(D.current),v.current=0),y.current=new Map;for(const{edge:t}of r){const A=IA(t.certainCount);y.current.set(t.key,A)}for(const t of s)b.current.set(t,0);for(const t of l)b.current.has(t)||b.current.set(t,1);if(s.length>0||a&&l.length>0){k.current&&(cancelAnimationFrame(k.current),k.current=null);let A=null;const e=Math.min(100,HA/Math.max(s.length,1)/2),t=r=>{A||(A=r);const n=r-A;for(let A=0;A0){const A=Math.min(n/HA,1);v.current=Dt(A)}G(!0);const o=HA+(s.length-1)*e;k.current=n{const A=p.current;if(!A||!g)return;const e=()=>{const e=A.getSource(g);if(!e)return!1;if(f.length>0){const A=Qt(f,h);e.setData(A)}else e.setData({type:"FeatureCollection",features:[]});return!0};if(e())return;const t=r=>{r.sourceId===g&&e()&&A.off("sourcedata",t)};A.on("sourcedata",t);const r=()=>{e()&&(A.off("styledata",r),A.off("sourcedata",t))};return A.on("styledata",r),()=>{A.off("sourcedata",t),A.off("styledata",r)}},[g,f,h]);const U=A.useRef(m);return A.useEffect(()=>{m!==U.current&&(U.current=m,E.current="",Q.current="",j.current="",G(!0))},[m,G]),A.useEffect(()=>()=>{k.current&&(cancelAnimationFrame(k.current),k.current=null)},[]),{isExiting:x.current,isAnimating:null!==k.current,resetAnimationState:O,weightAnimProgress:v.current,animStartWeights:w.current,animTargetWeights:y.current}}({map:Ge,showTopology:eA,validatedPolylines:Fe,weakPolylines:Pe,maxCertainCount:_e,loopEdgeKeys:Le,backboneEdgeKeys:Ie,highlightedEdgeKey:g,neighbors:t,validatedSourceId:fr,weakSourceId:dr,neighborPolylines:Te,showNeighborLines:rA,neighborSourceId:gr,neighborLinkScores:je,basemapMode:le}),Ze=A.useMemo(()=>{const A=new Set;for(const e of p.hubNodes){A.add(e);for(const t of p.validatedEdges)t.fromHash===e&&A.add(t.toHash),t.toHash===e&&A.add(t.fromHash)}return A},[p.hubNodes,p.validatedEdges]),Ke=A.useMemo(()=>{const A=new Set;if(!n)return A;for(const e of p.validatedEdges)e.fromHash===n&&A.add(e.toHash),e.toHash===n&&A.add(e.fromHash);return A},[n,p.validatedEdges]),{getNodeOpacity:Je}=function({soloDirect:e,soloHubs:t,neighborHashes:r,hubConnectedNodes:n,directNodeSet:o,localConnectedNodes:i,showTopology:a}){const[s,l]=A.useState(new Map),c=A.useRef(e),u=A.useRef(t),f=A.useRef(new Map),d=A.useRef(null),g=A.useRef(n),h=A.useRef(o),m=A.useRef(i),p=A.useRef(a);return A.useEffect(()=>{g.current=n,h.current=o,m.current=i,p.current=a},[n,o,i,a]),A.useEffect(()=>{const A=c.current,n=u.current,o=e,i=t;if(c.current=e,u.current=t,A===o&&n===i)return;d.current&&(cancelAnimationFrame(d.current),d.current=null);const a=g.current,s=h.current,b=m.current,v=p.current;for(const e of r)f.current.has(e)||f.current.set(e,Math.random());const w=(A,e,t)=>{const r=a.has(A),n=s.has(A),o=v&&b.has(A);return!e&&!t||(e&&t?r||n||o:t?r:!e||n||o)},y=[];for(const e of r){const t=w(e,A,n),r=w(e,o,i);t!==r&&y.push({hash:e,startOpacity:t?1:0,targetOpacity:r?1:0})}if(0===y.length)return;l(A=>{const e=new Map(A);for(const{hash:t,startOpacity:r}of y)e.set(t,r);return e});const x=y;let k=null;const C=A=>{k||(k=A);const e=A-k;let t=!0;l(()=>{const A=new Map;for(const{hash:r,startOpacity:n,targetOpacity:o}of x){const i=250*(f.current.get(r)??0),a=Math.max(0,e-i),s=Math.min(a/500,1),l=n+(o-n)*jt(s);A.set(r,l),s<1&&(t=!1)}return A}),e<750&&!t?d.current=requestAnimationFrame(C):(d.current=null,l(new Map))};return d.current=requestAnimationFrame(C),()=>{d.current&&(cancelAnimationFrame(d.current),d.current=null)}},[e,t,r]),{nodeOpacities:s,getNodeOpacity:(A,e)=>s.has(A)?s.get(A):e?1:0}}({soloDirect:"direct"===dA,soloHubs:"hubs"===dA,neighborHashes:Me.map(([A])=>A),hubConnectedNodes:Ze,directNodeSet:Qe,localConnectedNodes:Ke,showTopology:eA}),{blinkingNodes:qe,blinkColor:$e}=function({neighbors:e,localHash:t,enabled:r=!0}){const[n,o]=A.useState(new Map),i=M(),a=A.useRef(D.getPackets());A.useEffect(()=>{a.current=D.getPackets()},[i]);const s=A.useRef(0),l=A.useRef(null),c=A.useRef(new Map),u=A.useRef(new Map);A.useEffect(()=>{u.current=function(A){const e=new Map;for(const t of Object.keys(A)){const A=Q(t);e.has(A)||e.set(A,t)}return e}(e)},[e]);const f=A.useRef(null);return A.useEffect(()=>{f.current=()=>{const A=performance.now(),e=c.current;if(0===e.size)return l.current=null,void o(new Map);const t=new Map,r=[];for(const[n,{startTime:o,staggerDelay:i}]of e){const e=A-o-i;if(e<0);else if(e>=750)r.push(n);else{const A=Nt(e,750);A>0&&t.set(n,A)}}for(const n of r)e.delete(n);o(t),e.size>0&&f.current?l.current=requestAnimationFrame(f.current):l.current=null}},[]),A.useEffect(()=>{if(!r)return;const A=a.current;if(0===A.length)return;const e=s.current,n=A.filter(A=>(A.timestamp??0)>e);if(0===e){const e=A.reduce((A,e)=>Math.max(A,e.timestamp??0),0);return void(s.current=e)}if(0===n.length)return;const o=n.reduce((A,e)=>Math.max(A,e.timestamp??0),0);s.current=o;const i=performance.now();let d=0;for(const r of n){const A=E(r,t);if(!A||0===A.original.length)continue;const e=St(A.original,u.current,t);if(0===e.length)continue;const n=375;for(let t=0;t()=>{null!==l.current&&(cancelAnimationFrame(l.current),l.current=null)},[]),{blinkingNodes:n,blinkColor:"#00FF00"}}({neighbors:t,localHash:n,enabled:ae}),At=A.useCallback(A=>{if("all"===dA)return!0;if("direct"===dA)return Qe.has(A);if("hubs"===dA){if(p.hubNodes.includes(A))return!0;for(const e of p.validatedEdges){if(e.fromHash===A&&p.hubNodes.includes(e.toHash))return!0;if(e.toHash===A&&p.hubNodes.includes(e.fromHash))return!0}return!1}return!0},[dA,Qe,p.hubNodes,p.validatedEdges]);A.useEffect(()=>{"fetching"===TA&&(w.loadProgress?OA(w.loadProgress.loaded):w.packetCount>0&&OA(w.packetCount))},[TA,w.loadProgress,w.packetCount]);const et=A.useCallback(async()=>{zA(!0),PA(!0),RA("fetching"),OA(0),await b(),RA("analyzing"),await new Promise(A=>setTimeout(A,200)),RA("building");const A=Date.now(),e=Date.now()-A;e<1700&&await new Promise(A=>setTimeout(A,1700-e)),RA("complete"),await new Promise(A=>setTimeout(A,1e3)),PA(!1),zA(!1),We(),VA(!0),setTimeout(()=>{hA(!0)},150)},[b,We]),tt=A.useCallback(()=>{UA?hA(A=>!A):et()},[UA,et]),nt=A.useCallback(A=>{X(A.viewState),(A.viewState.pitch??0)>10&&!uA&&bA(!0)},[uA]),ot=A.useCallback(()=>{AA(A=>{var e,t,r,n,o,i,a;const s=!A,l=null==(r=null==(t=null==(e=m.current)?void 0:e.getContainer())?void 0:t.closest(".map-container-fullscreen, .map-container-16-9"))?void 0:r.parentElement;return s?l&&document.fullscreenEnabled?null==(n=l.requestFullscreen)||n.call(l).catch(()=>{}):l&&document.webkitFullscreenEnabled&&(null==(o=l.webkitRequestFullscreen)||o.call(l)):document.fullscreenElement?null==(i=document.exitFullscreen)||i.call(document).catch(()=>{}):document.webkitFullscreenElement&&(null==(a=document.webkitExitFullscreen)||a.call(document)),s})},[]),it=A.useCallback(A=>{vA(A)},[]),at=A.useCallback(()=>{mA(A=>!A)},[]),st=A.useCallback(()=>{iA(A=>!A)},[]),ut=A.useCallback(()=>{bA(A=>{const e=!A;if(m.current){const A=m.current.getMap();A&&A.stop()}if(e&&m.current){const A=m.current.getMap();A&&A.easeTo({pitch:45,duration:1500,easing:A=>1-Math.pow(1-A,3)})}if(!e&&m.current){const A=m.current.getMap();A&&A.easeTo({pitch:0,bearing:0,duration:800,easing:A=>1-Math.pow(1-A,2)})}return e})},[]),ft=A.useCallback(()=>{eA||hA(!0)},[eA]),dt=A.useCallback((A,e)=>{jA(A),SA(e)},[]),gt=A.useCallback(()=>{QA&&o&&o(QA),jA(null),SA("")},[QA,o]),ht=A.useMemo(()=>[...xr,...ur],[]),mt=A.useRef(!1);A.useEffect(()=>{mt.current="ontouchstart"in window||navigator.maxTouchPoints>0},[]);const pt=A.useCallback(A=>{A.features&&0!==A.features.length||(mt.current&&ge&&(he(null),kA(null)),CA&&BA(null))},[ge,CA]),bt=A.useCallback(A=>{BA(e=>e===A?null:A)},[]),vt=A.useCallback(A=>{var e,t;if(!A.features||0===A.features.length)return;if(A.features.some(A=>{var e,t;return null==(t=null==(e=A.layer)?void 0:e.id)?void 0:t.startsWith("node-markers-")}))return void(xA&&(kA(null),he(null)));const r=A.features.find(A=>{var e;const t=null==(e=A.layer)?void 0:e.id;return(null==t?void 0:t.startsWith("topology-"))||(null==t?void 0:t.startsWith("neighbor-"))});if(!r)return;const n=null==(e=r.layer)?void 0:e.id,o=r.properties;if(!(null==o?void 0:o.key))return;const i=null==n?void 0:n.startsWith("topology-"),a=null==n?void 0:n.startsWith("neighbor-");if(i||a){const e=o.key.replace(/-loop[12]$/,"");kA(e),A.lngLat&&he({longitude:A.lngLat.lng,latitude:A.lngLat.lat,type:i?"topology":"neighbor",properties:o})}try{(null==(t=m.current)?void 0:t.getCanvas())&&(m.current.getCanvas().style.cursor="pointer")}catch{}},[xA]),wt=A.useCallback(()=>{var A;kA(null),he(null);try{(null==(A=m.current)?void 0:A.getCanvas())&&(m.current.getCanvas().style.cursor="")}catch{}},[]),xt=$?"map-container-fullscreen":"map-container-16-9",Ct=V.length>0||(null==r?void 0:r.latitude)&&(null==r?void 0:r.longitude),Bt=!x||!Ct,Mt=Ct;return e.jsxs("div",{className:`relative ${xt}`,role:"application","aria-label":"Mesh network contacts map","aria-describedby":"map-instructions","data-basemap":le,children:[e.jsx("span",{id:"map-instructions",className:"sr-only",children:"Interactive map showing mesh network contacts. Use mouse or touch to pan and zoom. Press Tab to navigate map controls. Press Escape to exit fullscreen mode."}),Bt&&e.jsx("div",{className:"absolute inset-0 z-50 glass-card flex items-center justify-center","aria-hidden":"true",children:e.jsxs("div",{className:"flex flex-col items-center gap-3",children:[e.jsx("div",{className:"w-6 h-6 border-2 border-accent-primary border-t-transparent rounded-full animate-spin"}),e.jsx("span",{className:"text-sm text-text-muted",children:"Loading map..."})]})}),Mt&&e.jsx("div",{className:`relative w-full h-full ${$?"":"rounded-[1.125rem] overflow-hidden"} ${Bt?"opacity-0":"opacity-100 transition-opacity duration-300"}`,children:e.jsxs(s,{ref:m,...K,onMove:nt,mapStyle:Dr,style:{width:"100%",height:"100%"},attributionControl:!1,interactiveLayerIds:ht,onMouseMove:vt,onMouseLeave:wt,onClick:pt,onError:A=>{},onIdle:()=>{if(!U&&!O&&m.current){const A=m.current.getMap();if(A){const e=Object.values(t).filter(A=>A.latitude&&A.longitude).map(A=>({latitude:A.latitude,longitude:A.longitude}));(null==r?void 0:r.latitude)&&(null==r?void 0:r.longitude)&&e.push({latitude:r.latitude,longitude:r.longitude}),e.length>0&&z(e,A)}}},children:[e.jsx(l,{position:"bottom-right"}),e.jsx(c,{mode:le}),e.jsx(rt,{enabled:uA,exaggeration:4}),e.jsx(Xe,{coveragePoints:te,visible:te.length>0&&ne,terrainEnabled:uA,brightness:oe,basemapMode:le}),e.jsx(yt,{partition:He,nodeCoordinates:De,visible:aA&&UA,opacity:lA.opacity,bandwidth:lA.bandwidth,threshold:lA.threshold,strokeWidth:lA.strokeWidth}),e.jsx(yr,{showTopology:eA,isExiting:Ye,hoveredEdgeKey:xA,highlightedLoopEdges:null==me?void 0:me.highlightedEdgeKeys,highlightedFocusEdges:Re,onEdgeHover:be,onLoopHover:ye,loops:p.loops,neighborNames:Ce,opacityBias:MA,widthMultiplier:DA,trafficFilter:EA,showNeighborLines:rA,disableHover:Ve||_A}),u&&e.jsx(kr,{targetHash:u,nodeCoordinates:De,onComplete:d}),g&&e.jsx(Cr,{highlightedEdgeKey:g,validatedPolylines:Fe,weakPolylines:Pe,onEnsureTopology:ft}),e.jsx(Mr,{ghost:h??null,neighborCoordinates:De,onHighlightedNeighborsChange:Ae}),e.jsx(cr,{neighborsWithLocation:Me,localNode:r,localHash:n,zeroHopNeighbors:Qe,lastHopNeighborMap:Ee,meshTopology:p,hoveredMarker:wA,onMarkerHover:yA,getNodeOpacity:Je,shouldShowNode:At,onRequestRemove:o?dt:void 0,openPopupId:WA,onOpenPopup:XA,onClosePopup:qA,onNodeClick:bt,blinkingNodes:qe,blinkColor:$e})]})}),(()=>{const A=function(A,e,t){if(e){const A=e.loops[0],t=e.loops.length,r=[{label:"hops",value:A.size},{label:"seen",value:A.minCertainCount}],n=[];return A.includesLocal&&n.push({text:"★ Includes your node",color:"text-amber-400"}),t>1&&n.push({text:`+${t-1} overlapping`,color:"text-violet-400/70"}),{type:"loop",title:{icon:"⟳",text:"Redundant Path"+(t>1?"s":""),color:"text-violet-400"},subtitle:{text:`${e.nodeNames.join(" → ")} → ${e.nodeNames[0]}`,color:"text-text-secondary",mono:!0},stats:r,badges:n}}if("neighbor"===(null==A?void 0:A.type)){const e=A.properties,t=[];void 0!==e.rssi&&null!==e.rssi&&t.push({label:"RSSI",value:`${Math.round(e.rssi)} dBm`,unit:e.hasAvgRssi?"avg":void 0}),void 0!==e.snr&&null!==e.snr&&t.push({label:"SNR",value:`${Number(e.snr).toFixed(1)} dB`,unit:e.hasAvgSnr?"avg":void 0});const r=e.listenerScore??0,n=e.loudScore??0,o=r>0||n>0;return o&&(t.push({label:"listener",value:r,color:"text-accent-success"}),t.push({label:"loud",value:n,color:"text-accent-danger"})),void 0===e.packetCount||o||t.push({label:"packets",value:Number(e.packetCount).toLocaleString()}),{type:"neighbor",title:{icon:"●",text:e.prefix?`${e.name} (${e.prefix})`:e.name,color:"text-amber-400"},subtitle:{text:"Direct RF Neighbor",color:"text-amber-400/70"},stats:t,badges:[]}}if("topology"===(null==A?void 0:A.type)){const e=A.properties,r=t>0?Number(e.certainCount)/t:0,n=[{label:"validations",value:e.certainCount},{label:"of max traffic",value:`${Math.round(100*r)}%`},{label:"confidence",value:`${Math.round(100*Number(e.confidence))}%`}];if(void 0!==e.symmetryRatio&&e.symmetryRatio<1){const A="forward"===e.dominantDirection?"→":"reverse"===e.dominantDirection?"←":"↔";n.push({label:"symmetric",value:`${A} ${Math.round(100*e.symmetryRatio)}%`,color:"text-text-muted"})}const o=[];return e.isBackbone&&o.push({text:"Backbone",color:"text-gray-300"}),e.isLoopEdge&&o.push({text:"Redundant",color:"text-violet-400"}),e.isDirectPath&&o.push({text:"Direct Path",color:"text-teal-400"}),{type:"topology",title:{icon:"",text:`${e.fromName} ↔ ${e.toName}`,color:"text-text-primary"},stats:n,badges:o}}return null}(ge?{type:ge.type,properties:ge.properties}:null,me,_e);return A&&e.jsx("div",{className:"map-edge-tooltip",children:e.jsx("div",{className:"map-control-glass map-edge-tooltip-inner",children:e.jsx(Qr,{data:A})})})})(),e.jsx(KA,{mapRef:m,showNeighborLines:rA,onToggleNeighborLines:at,hasNeighborPolylines:Te.length>0,nodeFilter:dA,onNodeFilterChange:it,hasHubNodes:p.hubNodes.length>0,hasZeroHopNeighbors:Qe.size>0,showCoverage:oA,onToggleCoverage:st,showMinCut:aA,onToggleMinCut:ze,hasMinCutData:UA&&null!==He&&He.numCommunities>1,show3DTerrain:uA,onToggle3DTerrain:ut,basemapMode:le,onToggleBasemap:ce,isFullscreen:$,onToggleFullscreen:ot}),e.jsxs("div",{className:"map-legend-stack",children:[e.jsx($A,{isActive:eA,hasAnalyzed:UA,isLoading:_A,onClick:tt}),e.jsx(ee,{isActive:ae,onClick:se}),e.jsx(re,{isActive:te.length>0&&ne,onClick:ie}),e.jsx(ZA,{showTopology:eA,validatedPolylineCount:Fe.length,filteredNeighborCount:Me.length,hasLocalNode:!(!(null==r?void 0:r.latitude)||!(null==r?void 0:r.longitude)),meshTopology:p,zeroHopNeighbors:Qe,neighborsWithLocation:Me})]}),!$&&e.jsx("div",{className:"glass-card-frame absolute inset-0 pointer-events-none rounded-[1.125rem]",style:{zIndex:9999},"aria-hidden":"true"}),e.jsx(G,{isOpen:null!==QA,onCancel:()=>jA(null),onConfirm:gt,title:"Remove Node?",message:`Remove "${NA}" from the contacts list? This will hide the node until it sends a new packet.`,confirmLabel:"Remove",cancelLabel:"Cancel",variant:"danger"}),e.jsx(W,{isOpen:FA,currentStep:TA,packetCount:GA}),e.jsx(ve,{}),e.jsx(ke,{visible:aA&&UA,onClose:()=>pA(!1),settings:lA,onSettingsChange:cA,partition:He,totalNodes:Object.keys(t).length})]})}export{jr as default}; diff --git a/frontend/dist/assets/Dashboard-DdOKd_Co.js b/frontend/dist/assets/Dashboard-DdOKd_Co.js new file mode 100644 index 00000000..d96bcc2d --- /dev/null +++ b/frontend/dist/assets/Dashboard-DdOKd_Co.js @@ -0,0 +1 @@ +import{a as e,j as t}from"./vendor-react-DCIF8YoJ.js";import{c as s,B as a,S as n,u as l,d as i,e as r,f as o,w as c,R as d,L as u,h as m,j as h,k as x,D as f,n as p,o as v,p as g,T as j,q as b,r as N,t as y,v as k,x as w,F as M}from"./index-BGs2yNOg.js";import{u as L,a as _}from"./useThemeColors-CGx-Jxyf.js";import{C as S,S as C,a as F,P as B,b as R}from"./PageLayout-DIXn4UXM.js";import{S as D,P as T,T as A}from"./PacketList-CFuBvjqk.js";import{T as P,a as $,M as H}from"./trending-up-2SYsZdKi.js";import{C as I}from"./check-qb29v-su.js";import{C as E}from"./DataBox-nCNZLfvU.js";import{A as q}from"./arrow-right-C9AHsGJs.js";import{L as W,b as z}from"./vendor-core-Dl9MTgSr.js";import{E as O,T as K}from"./TimeRangeSelector-DUE1rBOu.js";import{s as V,C as G}from"./SignalIndicator-DWWkJgSd.js";import{R as U,L as J,Y as Q,u as X,A as Y,C as Z,X as ee,T as te,v as se}from"./recharts-DVj1EL-m.js";import{Z as ae}from"./zap-CQ3I2hAj.js";import{c as ne}from"./link-scoring-DTgOSmRe.js";import{N as le}from"./NodeInformationCard-DcRtH0Bq.js";import{H as ie}from"./house-CCeK_0TO.js";import{R as re,C as oe}from"./Grid-DkfcBkoo.js";import{C as ce}from"./Card-CPlTPCY8.js";import"./deckgl-DTsmDcfs.js";import"./channel-keys-DJWRrSwE.js";import"./arrow-up-ce4_7z5E.js";import"./chevron-right-7sotkg9l.js";import"./loader-circle-CwUrmZrV.js";import"./map-pin-x5eP-WEg.js";import"./triangle-alert-2-1YN-Am.js";import"./route-DRIRJjaN.js";import"./chevron-up-ClXInh9N.js";import"./circle-check-Bd9Kbu6i.js";const de=s("arrow-up-right",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]),ue=s("audio-waveform",[["path",{d:"M2 13a2 2 0 0 0 2-2V7a2 2 0 0 1 4 0v13a2 2 0 0 0 4 0V4a2 2 0 0 1 4 0v13a2 2 0 0 0 4 0v-4a2 2 0 0 1 2-2",key:"57tc96"}]]),me=s("ear",[["path",{d:"M6 8.5a6.5 6.5 0 1 1 13 0c0 6-6 6-6 10a3.5 3.5 0 1 1-7 0",key:"1dfaln"}],["path",{d:"M15 8.5a2.5 2.5 0 0 0-5 0v1a2 2 0 1 1 0 4",key:"1qnva7"}]]),he=s("megaphone",[["path",{d:"M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z",key:"q8bfy3"}],["path",{d:"M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14",key:"1853fq"}],["path",{d:"M8 6v8",key:"15ugcq"}]]),xe=s("satellite-dish",[["path",{d:"M4 10a7.31 7.31 0 0 0 10 10Z",key:"1fzpp3"}],["path",{d:"m9 15 3-3",key:"88sc13"}],["path",{d:"M17 13a6 6 0 0 0-6-6",key:"15cc6u"}],["path",{d:"M21 13A10 10 0 0 0 11 3",key:"11nf8s"}]]),fe=s("square-activity",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M17 12h-2l-2 5-2-10-2 5H7",key:"15hlnc"}]]),pe=s("timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]),ve={",":"punc",".":"punc-period",":":"punc-colon","/":"punc-slash"},ge=/([,\.:\/])/g,je=e.memo(function({children:s,className:a="",as:n="span"}){const l=e.useMemo(()=>{let e;return e="number"==typeof s?s.toLocaleString():Array.isArray(s)?s.join(""):String(s??""),ge.test(e)?(ge.lastIndex=0,e.split(ge).map((e,s)=>{const a=ve[e];return a?t.jsx("span",{className:a,children:e},s):e})):e},[s]);return t.jsx(n,{className:`data-tight ${a}`.trim(),children:l})}),be={received:{barBase:"var(--metric-received)"},forwarded:{barBase:"var(--metric-forwarded)"},transmitted:{barBase:"var(--metric-transmitted)"},dropped:{barBase:"var(--metric-dropped)"},neutral:{barBase:"var(--metric-neutral)"}},Ne={sm:"card-sm",md:"card-md",lg:"card-lg",hero:"card-hero",auto:""};function ye({buckets:s,colorType:a}){const l=be[a].barBase,i=e.useMemo(()=>{if(!(null==s?void 0:s.length))return[];const e=n.statsCard,t=s.length/e,a=t<=1?s:Array.from({length:e},(e,a)=>{var n,l;const i=s.slice(Math.floor(a*t),Math.floor((a+1)*t)),r=i.reduce((e,t)=>e+t.count,0),o=i.length?i.reduce((e,t)=>e+t.avg_snr,0)/i.length:0;return{bucket:a,start:(null==(n=i[0])?void 0:n.start)??0,end:(null==(l=i.at(-1))?void 0:l.end)??0,count:r,airtime_ms:i.reduce((e,t)=>e+t.airtime_ms,0),avg_snr:o,avg_rssi:0}}),i=a.map(e=>e.count).filter(e=>e>0);if(0===i.length)return a.map(()=>({height:0,bottom:0,color:"transparent",count:0,snr:0}));const r=Math.max(...i),o=Math.min(...i),c=r-o;return 0===c?a.map(e=>({height:e.count>0?40:0,bottom:e.count>0?30:0,color:e.count>0?l:"transparent",count:e.count,snr:e.avg_snr})):a.map(e=>{if(0===e.count)return{height:0,bottom:0,color:"transparent",count:0,snr:e.avg_snr};const t=(e.count-o)/c,s=15*t;return{height:Math.max(30,30+50*t),bottom:s,color:l,count:e.count,snr:e.avg_snr}})},[s,l]);return(null==s?void 0:s.length)?t.jsx("div",{className:"w-full h-full flex items-end pt-1",children:i.map((e,s)=>{var a;return t.jsx("div",{className:"flex-1 relative min-w-0",style:{height:"100%"},children:t.jsx("div",{className:"absolute inset-x-0",style:{height:`${e.height}%`,bottom:`${e.bottom}%`,backgroundColor:e.color,opacity:e.count>0?.8:.1},title:e.count>0?`${e.count} packets, SNR: ${null==(a=e.snr)?void 0:a.toFixed(1)}dB`:"No packets"})},s)})}):t.jsx("div",{className:"w-full h-full flex items-end justify-center gap-[2px] opacity-20",children:t.jsx("span",{className:"type-data-xs text-text-secondary",children:"No data"})})}function ke({title:s,value:n,color:l="neutral",subtitle:i,buckets:r,receivedCount:o,timeRangeLabel:c,icon:d,size:u="md",isLoaded:m=!0}){const h="string"==typeof n?n:n.toLocaleString(),x=e.useMemo(()=>function(e){if(!(null==e?void 0:e.length))return null;const t=e.reduce((e,t)=>e+t.count,0),s=e[0].start,a=e[e.length-1].end,n=Math.max((a-s)/3600,1),l=Math.round(t/n);let i=0,r=0;for(let d=0;dr&&(r=e[d].count,i=d);const o=new Date(1e3*e[i].start).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}),c=e.filter(e=>e.count>0&&0!==e.avg_snr);return{total:t,ratePerHour:l,peakCount:r,peakHour:o,avgSnr:c.length>0?c.reduce((e,t)=>e+t.avg_snr,0)/c.length:null}}(r),[r]),f="number"==typeof n?n:(null==x?void 0:x.total)??0,p=o&&o>0?(f/o*100).toFixed(1):null;return m?t.jsxs("div",{className:`data-card flex flex-col relative ${Ne[u]}`,children:[t.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 mb-2 sm:mb-3",children:[d&&t.jsx("span",{className:"icon-sm text-icon-card-title",children:d}),t.jsx("span",{className:"type-micro",children:s}),c&&t.jsx(a,{color:"teal",className:"hidden sm:inline-flex",children:c})]}),t.jsx("div",{className:"type-data-hero text-text-primary",children:t.jsx(je,{children:h})}),t.jsx("div",{className:"flex-1 mt-1 overflow-hidden min-h-[40px] sm:min-h-[60px]",children:r?t.jsx(ye,{buckets:r,colorType:l}):t.jsx("div",{className:"w-full h-full flex items-center justify-center",children:t.jsx("div",{className:"w-full h-0.5 rounded-full bg-text-muted/15"})})}),t.jsx("div",{className:"pt-1.5 sm:pt-2 mt-1",children:t.jsxs("div",{className:"flex gap-2 sm:gap-3",children:[t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"data-box-label",children:"Rate"}),t.jsxs("div",{className:"data-box data-box-fill data-box-left",children:[(null==x?void 0:x.ratePerHour)??i??"—","/hr"]})]}),null!==p?t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"data-box-label",children:"dropped"===l?"Drop %":"Ratio"}),t.jsxs("div",{className:"data-box data-box-fill data-box-left",children:[p,"%"]})]}):(null==x?void 0:x.peakHour)?t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"data-box-label",children:"Peak"}),t.jsx("div",{className:"data-box data-box-fill data-box-left",children:x.peakHour})]}):null]})})]}):t.jsx("div",{className:`data-card flex flex-col relative ${Ne[u]}`,children:t.jsx(S,{})})}const we=.2;function Me(e,t=1){return Math.floor(5*t*e)}function Le(e){const t=Math.round(e/we)*we;return Math.max(0,Math.min(5,t))}function _e({stats:s,receivedBuckets:n,droppedBuckets:l,forwardedBuckets:i,bucketDurationSeconds:r,timeRangeLabel:o,isLoaded:c=!0}){var d,u,m,h;const[x,f]=e.useState(!1);if(!c)return t.jsx("div",{className:"data-card flex flex-col relative",children:t.jsx(S,{})});const p=function(e,t,s,a,n){var l,i;const r=e=>(null==e?void 0:e.reduce((e,t)=>e+t.count,0))??0,o=r(t),c=r(s),d=r(a),u=o||(null==e?void 0:e.rx_count)||1,m=c||(null==e?void 0:e.dropped_count)||0,h=u>0?m/(u+m)*100:0;let x=0;if((null==a?void 0:a.length)&&n)x=100*d/(a.length*n*1e3)*100;else if(e){const t=1e3*(e.uptime_seconds||1);x=(e.total_airtime_ms||e.airtime_used_ms||0)/t*100}const f=(null==e?void 0:e.neighbors)??{},p=Object.values(f).filter(e=>e.zero_hop).length;let v=1;h<3?v-=we:h>15?v+=.4:h>10&&(v+=we),x>5&&(v+=we),p>10&&(v+=we);const g=Le(v),j=Le(.28*g),b=Me(g),N=Me(j),y=Me((null==(i=null==(l=null==e?void 0:e.config)?void 0:l.delays)?void 0:i.tx_delay_factor)??1);return{floodFactor:g,directFactor:j,floodSlots:b,directSlots:N,adjustment:b>y?"increase":b{const e=`set txdelay ${p.floodFactor.toFixed(1)}\nset direct.txdelay ${p.directFactor.toFixed(1)}`;try{await navigator.clipboard.writeText(e),f(!0),setTimeout(()=>f(!1),1500)}catch(t){const s=document.createElement("textarea");s.value=e,s.style.position="fixed",s.style.opacity="0",document.body.appendChild(s),s.select();try{document.execCommand("copy"),f(!0),setTimeout(()=>f(!1),1500)}catch{}document.body.removeChild(s)}},className:"flex gap-3 mb-2 sm:mb-3 w-full text-left hover:bg-white/[0.02] rounded-lg transition-colors p-1 -m-1 group",title:"Click to copy CLI commands",children:[t.jsxs("div",{className:"flex-1 flex flex-col",children:[t.jsx("span",{className:"type-data-hero text-text-primary",children:t.jsxs(je,{children:["×",p.floodFactor.toFixed(1)]})}),t.jsx("span",{className:"text-xs font-medium text-text-muted uppercase tracking-wide mt-0.5 sm:mt-1",children:"Flood"})]}),t.jsxs("div",{className:"flex-1 flex flex-col",children:[t.jsx("span",{className:"type-data-hero text-accent-tertiary",children:t.jsxs(je,{children:["×",p.directFactor.toFixed(1)]})}),t.jsx("span",{className:"text-xs font-medium text-text-muted uppercase tracking-wide mt-0.5 sm:mt-1",children:"Direct"})]}),t.jsx("div",{className:"flex items-center self-center opacity-0 group-hover:opacity-100 transition-opacity",children:x?t.jsx(I,{className:"w-4 h-4 text-green-400"}):t.jsx(E,{className:"w-4 h-4 text-text-muted"})})]}),t.jsx("div",{className:"flex-1 py-2",children:t.jsxs("div",{className:"flex gap-3",children:[t.jsxs("div",{className:"flex-1",children:[t.jsx("div",{className:"data-box-label",children:"Dupe"}),t.jsxs("div",{className:"data-box data-box-fill data-box-left "+(p.duplicateRate>10?"text-accent-warning":""),children:[p.duplicateRate.toFixed(1),"%"]})]}),t.jsxs("div",{className:"flex-1",children:[t.jsx("div",{className:"data-box-label",children:"TX Util"}),t.jsxs("div",{className:"data-box data-box-fill data-box-left",children:[p.txUtilization.toFixed(2),"%"]})]})]})}),t.jsxs("div",{className:"pt-2 mt-2",children:[t.jsx("div",{className:"data-box-label",children:"Current"}),t.jsx("div",{className:"flex gap-2",children:null!==v?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"data-box",children:["×",v.toFixed(2)]}),t.jsxs("div",{className:"data-box",style:{color:"var(--accent-tertiary)"},children:["×",(null==g?void 0:g.toFixed(2))??"—"]})]}):t.jsx("span",{className:"text-sm text-text-muted",children:"No config"})})]})]})}function Se(){const s=l(),a=i(),n=r(),m=o(),[h,x]=e.useState([]);e.useEffect(()=>{const e=c.subscribe(e=>{x(e)});return x(c.getPendingPackets()),e},[]);const f=e.useMemo(()=>{const e=s.length<=100?s:s.slice(-100),t=new Set(e.map(e=>e.packet_hash));return[...h.filter(e=>!t.has(e.packet.packet_hash)).map(e=>({...e.packet,isPending:!0})),...e].sort((e,t)=>(t.timestamp??0)-(e.timestamp??0))},[s,h]),p=null==m?void 0:m.local_hash,v=null==m?void 0:m.neighbors;return t.jsxs("div",{className:"chart-container h-full flex flex-col !overflow-visible",children:[t.jsxs("div",{className:"chart-header",children:[t.jsxs("div",{className:"chart-title",children:[t.jsx(d,{className:"chart-title-icon"}),"Recent Packets"]}),t.jsxs("div",{className:"flex items-center gap-3",children:[n&&t.jsx(u,{showLabel:!0}),t.jsxs(W,{to:"/packets",className:"pill-subtle",children:["View all ",t.jsx(q,{className:"w-3 h-3"})]})]})]}),t.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto px-1",children:t.jsx(T,{packets:f,allPackets:s,localHash:p,neighbors:v,loading:a,maxPackets:50,showPagination:!1,flashNewest:!0,emptyMessage:"No packets received",footerAction:t.jsxs(W,{to:"/packets",className:"pill-subtle",children:["View all ",t.jsx(q,{className:"w-3 h-3"})]})})})]})}const Ce=e.memo(function({active:e,payload:s,label:a,formatValue:n,labelKey:l}){var i;if(!e||!(null==s?void 0:s.length))return null;const r=l&&(null==(i=s[0])?void 0:i.payload)?s[0].payload[l]:a;return t.jsxs("div",{className:"bg-tooltip-bg border border-border-subtle rounded-lg px-4 py-3 shadow-xl",children:[r&&t.jsx("p",{className:"type-data-xs text-white/50 mb-2",children:r}),t.jsx("div",{className:"space-y-1.5",children:s.map((e,s)=>t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{backgroundColor:e.color}}),t.jsx("span",{className:"type-body-sm text-white/70 capitalize min-w-[60px]",children:e.name}),t.jsx("span",{className:"type-data-sm text-white tabular-nums",children:n?n(e.value,e.name):e.value.toLocaleString()})]},s))})]})});e.memo(function({active:e,payload:s,color:a,labelKey:n,unit:l=""}){var i,r;if(!e||!(null==s?void 0:s.length))return null;const o=s[0],c=null==(i=null==o?void 0:o.payload)?void 0:i[n];return t.jsxs("div",{className:"bg-tooltip-bg border border-border-subtle rounded-lg px-3 py-2 shadow-xl",children:[t.jsx("p",{className:"type-data-xs text-white/50 mb-1",children:c}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:a}}),t.jsxs("span",{className:"type-data-sm text-white tabular-nums",children:[null==(r=null==o?void 0:o.value)?void 0:r.toLocaleString(),l]})]})]})}),e.memo(function({payload:e}){return(null==e?void 0:e.length)?t.jsx("div",{className:"flex items-center justify-center gap-6 mt-4 pt-4 border-t border-white/5",children:e.map((e,s)=>t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:e.color}}),t.jsx("span",{className:"type-body-sm text-white/60 capitalize",children:e.value})]},s))}):null});const Fe={stable:"M5 12h14",up:"M5 15l7-7 7 7",down:"M19 9l-7 7-7-7"};function Be({trend:e}){return t.jsx("span",{className:`mini-widget-trend ${e}`,children:t.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:Fe[e]})})})}function Re(){return t.jsx("div",{className:"mini-widget-loading",children:t.jsx("div",{className:"mini-widget-loading-spinner"})})}function De({message:e}){return t.jsx("div",{className:"mini-widget-error",children:t.jsx("span",{title:e,children:"No data"})})}function Te({title:e,icon:s,value:a,unit:n,valueSize:l="md",status:i,subtitle:r,trend:o,children:c,isLoading:d=!1,error:u,className:m="",onClick:h}){const x=["mini-widget-value","lg"===l&&"mini-widget-value-lg","sm"===l&&"mini-widget-value-sm"].filter(Boolean).join(" "),f=["mini-widget",h&&"cursor-pointer",m].filter(Boolean).join(" ");return t.jsxs("div",{className:f,onClick:h,role:h?"button":void 0,children:[t.jsxs("div",{className:"mini-widget-header",children:[s,t.jsx("span",{className:"mini-widget-title",children:e}),i&&"unknown"!==i&&t.jsx("div",{className:`mini-widget-status-dot ${i}`}),o&&t.jsx(Be,{trend:o})]}),d?t.jsx(Re,{}):u?t.jsx(De,{message:u}):t.jsxs(t.Fragment,{children:[void 0!==a&&t.jsxs("div",{className:x,children:[t.jsx(je,{children:a}),n&&t.jsx("span",{className:"mini-widget-unit",children:n})]}),r&&t.jsx("div",{className:"mini-widget-subtitle",children:r}),c]})]})}const Ae={DELTA_CRITICAL:10,SLOPE_CRITICAL:4,JITTER_CRITICAL:6,DELTA_WARNING:5,SLOPE_WARNING:2,JITTER_WARNING:4},Pe={baselineMedian:null,baselineP10:null,baselineP90:null,currentMedian:null,currentSampleCount:0,delta:0,slope:0,jitter:0,penalty:0,penaltyReason:null,computedAt:0,isReliable:!1};function $e(e,t){if(0===e.length)return null;const s=[...e].sort((e,t)=>e-t),a=t/100*(s.length-1),n=Math.floor(a),l=Math.ceil(a);return n===l?s[n]:s[n]+(s[l]-s[n])*(a-n)}function He(e){return $e(e,50)}function Ie(e){if(!e)return[];try{const t=JSON.parse(e);if(Array.isArray(t))return t.map(Number).filter(e=>!isNaN(e))}catch{}return[]}function Ee(e){return null!=e&&0!==e&&!Object.is(e,-0)&&!(e>-50||e<-130)}function qe(e,t,s=2,a=!1){if(null===t)return"stable";const n=e-t;return(0!==t?100*Math.abs(n/t):Math.abs(n))0?"up":"down":n>0?"down":"up"}const We={lbtStats:null,noiseFloor:null,sparklineNoiseFloor:[],linkQuality:null,channelHealth:null,nfTrend:Pe,radioConfig:null,trends:null,stats:null,recentPackets:[],quickNeighbors:[],isLoading:!0,error:null,refresh:async()=>{}},ze=e.createContext(We);function Oe({children:s}){var a;const n=o(),i=l(),r=m(),c=h(),d=x(),u=f[d],v=Math.max(1,u.minutes/60),g=null===n,j=e.useMemo(()=>function(e,t){const s=3600*t,a=Math.floor(Date.now()/1e3)-s,n=e.filter(e=>e.timestamp>=a&&void 0!==e.lbt_attempts&&e.lbt_attempts>0),l=n.length,i=n.filter(e=>(e.lbt_attempts??0)>1).length,r=l>0?i/l*100:0,o=n.filter(e=>(e.lbt_attempts??0)>1),c=o.length>0?o.reduce((e,t)=>e+(t.lbt_attempts??0),0)/o.length:0,d=n.filter(e=>(e.lbt_attempts??0)>=5).length,u=l>0?d/l*100:0,m=[];for(const b of n){const e=Ie(b.lbt_backoff_delays_ms);m.push(...e)}const h=m.reduce((e,t)=>e+t,0),x=m.length>0?h/m.length:0,f=m.length>0?Math.min(...m):0,p=m.length>0?Math.max(...m):0,v=s/24,g=[],j=[];for(let b=0;b<24;b++){const e=a+b*v,t=e+v,s=n.filter(s=>s.timestamp>=e&&s.timestamp(e.lbt_attempts??0)>1).length,i=s.length>0?l/s.length*100:0,r=[];for(const a of s){const e=Ie(a.lbt_backoff_delays_ms);r.push(...e)}const o=r.length>0?r.reduce((e,t)=>e+t,0)/r.length:0;if(g.push(o),0===s.length)j.push(0);else{const e=s.filter(e=>(e.lbt_attempts??0)>=5).length,t=r.length>0?Math.max(...r):0,a=Math.min(s.length/5,1),n=.15,l=Math.log(1+i*n)/Math.log(1+100*n)*40,c=e/s.length*100,d=Math.min(.5*c,25);let u=0;o>100&&(u=Math.min(8*Math.log10(o/100),15));let m=0;t>500&&o>0&&t>2*o&&(m=Math.min((t-500)/200,5));const h=l+d+u+m;j.push(Math.min(h*a,85))}}return{totalPacketsWithLBT:l,packetsWithRetries:i,retryRate:r,avgRetries:c,channelBusyCount:d,channelBusyRate:u,avgBackoffMs:x,minBackoffMs:f,maxBackoffMs:p,totalBackoffMs:h,sparklineBackoff:g,sparklineCollisionRisk:j,windowHours:t,packetCount:e.length}}(i,v),[i,v]),b=(null==n?void 0:n.noise_floor_dbm)??null,N=e.useMemo(()=>Ee(b)?b:null,[b]),y=e.useMemo(()=>{var e;const t=null==(e=null==n?void 0:n.config)?void 0:e.radio;return t?{sf:t.spreading_factor??7,bwHz:t.bandwidth??125e3}:null},[null==(a=null==n?void 0:n.config)?void 0:a.radio]),[k,w]=e.useState([]),M=e.useRef({time:0,hours:0});e.useEffect(()=>{const e=async()=>{var e;const t=Date.now(),s=Math.ceil(v);if(0===M.current.time||M.current.hours!==s||t-M.current.time>=6e4){M.current={time:t,hours:s};try{const t=await p(Math.max(s,24));t.success&&(null==(e=t.data)?void 0:e.history)&&w(t.data.history)}catch{}}};e();const t=setInterval(e,6e4);return()=>clearInterval(t)},[v]);const L=e.useMemo(()=>function(e,t){if(0===e.length)return[];const s=e.reduce((e,t)=>Math.max(e,t.timestamp),0);if(0===s)return[];const a=3600*t,n=s-a,l=a/24,i=[];for(let r=0;r<24;r++){const t=n+r*l,s=t+l,a=e.filter(e=>e.timestamp>=t&&e.timestamp0){const e=a.reduce((e,t)=>e+t.noise_floor_dbm,0)/a.length;i.push(e)}else i.push(i.length>0?i[i.length-1]:-100)}return i}(k,v),[k,v]),_=null==n?void 0:n.neighbors,S=e.useMemo(()=>{const e=_??{};return Object.fromEntries(Object.entries(e).filter(([e])=>!c.has(e)))},[_,c]),C=e.useMemo(()=>r.filter(e=>!c.has(e.hash)),[r,c]),F=e.useMemo(()=>function(e){if(0===e.length)return{...Pe,computedAt:Math.floor(Date.now()/1e3)};const t=Math.floor(Date.now()/1e3),s=e.filter(e=>Number.isFinite(e)),a=e.length>0?[e[e.length-1]]:[],n=e.slice(-4).filter(e=>Number.isFinite(e)),l=He(s),i=$e(s,10),r=$e(s,90),o=He(a),c=null!==o&&null!==i?o-i:0,d=function(e){if(e.length<2)return 0;const t=e.length;let s=0,a=0,n=0,l=0;const i=e[0].timestamp;for(const o of e){const e=(o.timestamp-i)/3600,t=o.value;s+=e,a+=t,n+=e*t,l+=e*e}const r=t*l-s*s;return Math.abs(r)<1e-4?0:(t*n-s*a)/r}(n.map((e,s)=>({timestamp:t-3600*(n.length-1-s),value:e}))),u=function(e){if(e.length<2)return 0;const t=e.reduce((e,t)=>e+t,0)/e.length,s=e.map(e=>Math.pow(e-t,2)).reduce((e,t)=>e+t,0)/e.length;return Math.sqrt(s)}(n),m=s.length>=12,[h,x]=m?function(e,t,s){const a=Ae;return e>=a.DELTA_CRITICAL?[2,`Noise floor ${e.toFixed(1)} dB above baseline`]:t>=a.SLOPE_CRITICAL?[2,`Noise floor rising ${t.toFixed(1)} dB/hour`]:s>=a.JITTER_CRITICAL?[2,`Noise floor unstable (±${s.toFixed(1)} dB)`]:e>=a.DELTA_WARNING?[1,`Noise floor ${e.toFixed(1)} dB above baseline`]:t>=a.SLOPE_WARNING?[1,`Noise floor rising ${t.toFixed(1)} dB/hour`]:s>=a.JITTER_WARNING?[1,`Noise floor variable (±${s.toFixed(1)} dB)`]:[0,null]}(c,d,u):[0,null];return{baselineMedian:l,baselineP10:i,baselineP90:r,currentMedian:o,currentSampleCount:a.length,delta:c,slope:d,jitter:u,penalty:h,penaltyReason:x,computedAt:t,isReliable:m}}(L),[L]),B=e.useMemo(()=>function(e,t,s){if(0===e.length)return{neighbors:[],networkScore:0,neighborCount:0,bestLink:null,worstLink:null};const a=e.map(e=>{const a=function(e,t,s){const a=V(e,t,s,0);if(a)switch(a.finalGrade){case"excellent":return 100;case"good":return 80;case"fair":return 60;case"poor":return 40;case"critical":return 20}const n=void 0===e?50:e>=10?100:e>=5?80:e>=0?60:e>=-5?40:20,l=void 0===t?50:t>=-70?100:t>=-80?80:t>=-90?60:t>=-100?40:20;return Math.round(.6*n+.4*l)}(e.avgSnr??void 0,e.avgRssi??void 0,s),n=t[e.hash];return{name:(null==n?void 0:n.name)||(null==n?void 0:n.node_name)||e.prefix,hash:e.hash,rssi:e.avgRssi??-100,snr:e.avgSnr??-10,score:a,advertCount:e.count}});a.sort((e,t)=>t.score-e.score);const n=a.length>0?a.reduce((e,t)=>e+t.score,0)/a.length:0;return{neighbors:a,networkScore:Math.round(n),neighborCount:a.length,bestLink:a.length>0?{name:a[0].name,score:a[0].score}:null,worstLink:a.length>0?{name:a[a.length-1].name,score:a[a.length-1].score}:null}}(C,S,y),[C,S,y]),R=e.useMemo(()=>function(e,t,s){const a=e?Math.max(0,Math.min(100,100-5*e.retryRate)):50;let n=50;null!==t&&(n=Math.max(0,Math.min(100,(t+120)/30*100)));const l=(null==s?void 0:s.networkScore)??50,i=Math.round(.35*a+.25*n+.4*l);let r;return r=i>=85?"excellent":i>=70?"good":i>=50?"fair":i>=30?"congested":"critical",{score:i,status:r,components:{lbtHealth:Math.round(a),noiseHealth:Math.round(n),linkHealth:Math.round(l)}}}(j,N,B),[j,N,B]),[D,T]=e.useState({noiseFloor:null,networkScore:null,channelHealth:null}),A=e.useRef(0);e.useEffect(()=>{const e=()=>{const e=Date.now();e-A.current>3e4&&(A.current=e,T({noiseFloor:N,networkScore:(null==B?void 0:B.networkScore)??null,channelHealth:(null==R?void 0:R.score)??null}))};e();const t=setInterval(e,5e3);return()=>clearInterval(t)},[N,null==B?void 0:B.networkScore,null==R?void 0:R.score]);const P=e.useMemo(()=>({noiseFloor:{current:N,previous:D.noiseFloor,trend:null!==N?qe(N,D.noiseFloor,2,!0):"stable"},networkScore:{current:(null==B?void 0:B.networkScore)??0,previous:D.networkScore,trend:qe((null==B?void 0:B.networkScore)??0,D.networkScore,3,!1)},channelHealth:{current:(null==R?void 0:R.score)??0,previous:D.channelHealth,trend:qe((null==R?void 0:R.score)??0,D.channelHealth,3,!1)}}),[N,null==B?void 0:B.networkScore,null==R?void 0:R.score,D]),$={lbtStats:j,noiseFloor:N,sparklineNoiseFloor:L,linkQuality:B,channelHealth:R,nfTrend:F,radioConfig:y,trends:P,stats:n,recentPackets:i,quickNeighbors:r,isLoading:g,error:null,refresh:async()=>{}};return t.jsx(ze.Provider,{value:$,children:s})}function Ke(){const t=e.useContext(ze);if(void 0===t)throw new Error("useLBTData must be used within an LBTDataProvider");return t}function Ve(e,t){return 0===e?"No backoffs":`${t.toFixed(0)}% retry rate`}function Ge(){const{lbtStats:s,isLoading:a,error:n}=Ke(),l=z(),i=(null==s?void 0:s.avgBackoffMs)??0,r=(null==s?void 0:s.retryRate)??0,o=s?(c=i)<100?"excellent":c<250?"good":c<500?"fair":c<1e3?"congested":"critical":"unknown";var c;const d=null==s?void 0:s.sparklineBackoff,{chartData:u,yDomain:m}=e.useMemo(()=>{if(!d||d.length<2)return{chartData:[],yDomain:[0,100]};const e=d.map(e=>({value:e})),t=d.filter(e=>e>0);if(0===t.length)return{chartData:e,yDomain:[0,100]};const s=Math.min(...t),a=Math.max(...t),n=a-s,l=Math.max(.2*n,.1*a,10);return{chartData:e,yDomain:[Math.max(0,s-l),a+l]}},[d]);return t.jsx(Te,{title:"LBT Backoff",icon:t.jsx(pe,{className:"mini-widget-icon"}),value:Math.round(i),unit:"ms",status:o,subtitle:s?Ve(i,r):void 0,isLoading:a,error:n,onClick:()=>l("/packets"),children:t.jsx("div",{className:"mini-widget-sparkline",children:u.length>0?t.jsx(U,{width:"100%",height:24,children:t.jsxs(J,{data:u,margin:{top:2,right:2,bottom:2,left:2},children:[t.jsx(Q,{domain:m,hide:!0}),t.jsx(X,{type:"monotone",dataKey:"value",stroke:"var(--accent-primary)",strokeWidth:2,dot:!1,isAnimationActive:!1})]})}):t.jsx("div",{className:"h-full"})})})}function Ue(e){return 0===e?"—":e<1?"<1":Math.round(e).toString()}function Je(){const{lbtStats:e,isLoading:s,error:a}=Ke(),n=z(),l=(null==e?void 0:e.channelBusyCount)??0,i=(null==e?void 0:e.totalPacketsWithLBT)??0,r=(null==e?void 0:e.channelBusyRate)??0,o=(null==e?void 0:e.retryRate)??0,c=(null==e?void 0:e.avgBackoffMs)??0,d=(null==e?void 0:e.minBackoffMs)??0,u=(null==e?void 0:e.maxBackoffMs)??0,m=o>0?Math.max(0,(o-r)/o*100):100;return t.jsx(Te,{title:"Ch. Busy",icon:t.jsx(O,{className:"mini-widget-icon"}),isLoading:s,error:a,onClick:()=>n("/packets"),children:t.jsx("div",{className:"flex-1 flex items-end",children:t.jsxs("div",{className:"grid grid-cols-[auto_minmax(0,1fr)_auto_minmax(0,1fr)] gap-x-2 gap-y-2 w-full items-baseline",children:[t.jsx("span",{className:"data-box-label mb-0",title:`${l} packets exceeded max CAD attempts (5) out of ${i} total transmissions.`,children:"Failed:"}),t.jsxs("div",{className:"data-box justify-self-start",title:`${l} packets exceeded max CAD attempts (5) out of ${i} total transmissions.`,children:[t.jsx(je,{children:l}),t.jsx("span",{className:"text-text-muted punc-slash",children:"/"}),t.jsx(je,{children:i})]}),t.jsx("span",{className:"data-box-label mb-0",title:`${m.toFixed(1)}% of packets that needed LBT retries were sent successfully.`,children:"Sent:"}),t.jsx("div",{className:"data-box justify-self-start",title:`${m.toFixed(1)}% of packets that needed LBT retries were sent successfully.`,children:t.jsxs(je,{children:[m.toFixed(0),"%"]})}),t.jsx("span",{className:"data-box-label mb-0",title:`Average LBT backoff delay: ${c.toFixed(0)}ms.`,children:"Mean:"}),t.jsxs("div",{className:"data-box justify-self-start",title:`Average LBT backoff delay: ${c.toFixed(0)}ms.`,children:[t.jsx(je,{children:Ue(c)}),t.jsx("span",{className:"text-text-muted text-xs",children:"ms"})]}),t.jsx("span",{className:"data-box-label mb-0",title:`Backoff range: ${d.toFixed(0)}ms min, ${u.toFixed(0)}ms max.`,children:"Range:"}),t.jsxs("div",{className:"data-box justify-self-start",title:`Backoff range: ${d.toFixed(0)}ms min, ${u.toFixed(0)}ms max.`,children:[t.jsx(je,{children:Ue(d)}),t.jsx("span",{className:"text-text-muted punc-slash",children:"/"}),t.jsx(je,{children:Ue(u)})]})]})})})}function Qe(e){return null===e?"No reading":e<-115?"Very quiet":e<-105?"Quiet":e<-95?"Moderate":e<-85?"Elevated":"High interference"}function Xe(){const{noiseFloor:s,sparklineNoiseFloor:a,trends:n,isLoading:l,error:i}=Ke(),r=null===(o=s)||o<-110?"excellent":o<-100?"good":o<-90?"fair":o<-80?"congested":"critical";var o;const c=null==n?void 0:n.noiseFloor.trend,{chartData:d,yDomain:u}=e.useMemo(()=>{if(!a||a.length<2)return{chartData:[],yDomain:[-120,-90]};const e=a.map(e=>({value:e})),t=a.filter(e=>-100!==e&&e<-50);if(0===t.length)return{chartData:e,yDomain:[-120,-90]};const s=Math.min(...t),n=Math.max(...t),l=n-s,i=Math.max(.2*l,3);return{chartData:e,yDomain:[s-i,n+i]}},[a]);return t.jsx(Te,{title:"Noise Floor",icon:t.jsx(ue,{className:"mini-widget-icon"}),value:null!==s?Math.round(s):"—",unit:null!==s?"dBm":void 0,status:r,trend:c,subtitle:Qe(s),isLoading:l,error:i,children:t.jsx("div",{className:"mini-widget-sparkline",children:d.length>0?t.jsx(U,{width:"100%",height:24,children:t.jsxs(J,{data:d,margin:{top:2,right:2,bottom:2,left:2},children:[t.jsx(Q,{domain:u,hide:!0}),t.jsx(X,{type:"monotone",dataKey:"value",stroke:"var(--accent-primary)",strokeWidth:2,dot:!1,isAnimationActive:!1})]})}):t.jsx("div",{className:"h-full"})})})}function Ye(){const s=z(),a=m(),n=l(),i=o(),r=x(),c=60*f[r].minutes,d=v(),u=e.useMemo(()=>{if(0===d)return n;const e=d-c;return n.filter(t=>t.timestamp>=e)},[n,c,d]),h=null===i,p=(null==i?void 0:i.local_hash)?g(i.local_hash):"",b=(null==i?void 0:i.neighbors)??{},{neighborHashes:N,neighborNames:y}=e.useMemo(()=>{const e=new Set,t=new Map;for(const s of a){e.add(s.hash);const a=b[s.hash],n=(null==a?void 0:a.name)||(null==a?void 0:a.node_name)||s.prefix;t.set(s.hash,n)}return{neighborHashes:e,neighborNames:t}},[a,b]),k=e.useMemo(()=>{if(0===N.size||0===u.length||!p)return{champion:null,listener:null,loudest:null};const{scores:e}=ne(u,N,p),t=[];for(const[l,i]of e)0!==i.blendedScore&&t.push({...i,name:y.get(l)??g(l)});let s=null,a=null,n=null;for(const l of t)(!s||l.blendedScore>s.blendedScore)&&(s=l),(!a||l.listenerScore>a.listenerScore)&&(a=l),(!n||l.loudScore>n.loudScore)&&(n=l);return{champion:s,listener:a,loudest:n}},[u,N,p,y]),{champion:w,listener:M,loudest:L}=k,_=w||M||L?t.jsxs("div",{className:"flex flex-col gap-0.5 mt-auto",children:[w&&t.jsx(j,{content:(S=w,t.jsxs("div",{className:"max-w-[220px]",children:[t.jsxs("div",{className:"font-semibold mb-1",children:["🏆 Champion: ",S.name]}),t.jsxs("div",{className:"text-text-muted mb-1",children:["Blended Score: ",S.blendedScore,t.jsx("span",{className:"text-text-muted/60 ml-1",children:"(Listener + Loud)"})]}),t.jsxs("div",{className:"border-t border-border-subtle pt-1 mt-1 space-y-0.5",children:[t.jsxs("div",{children:["Listener: ",S.listenerScore,"/100 (",S.listenerCount," shared paths)"]}),t.jsxs("div",{children:["Loud: ",S.loudScore,"/100 (",S.loudCount," packets relayed)"]})]})]})),children:t.jsxs("div",{className:"flex items-center gap-1 text-sm rounded px-1 -mx-1 hover:bg-white/5 transition-colors cursor-default",children:[t.jsx(A,{className:"w-3 h-3 text-map-neighbor-color flex-shrink-0"}),t.jsx("span",{className:"font-semibold text-map-neighbor-color font-mono truncate flex-1 min-w-0",children:w.name}),t.jsx("span",{className:"text-map-neighbor-color pl-2 tabular-nums flex-shrink-0 w-9 text-right",children:w.blendedScore})]})}),M&&t.jsx(j,{content:(e=>t.jsxs("div",{className:"max-w-[220px]",children:[t.jsxs("div",{className:"font-semibold mb-1",children:["👂 Best Listener: ",e.name]}),t.jsxs("div",{className:"text-text-muted mb-1",children:["Score: ",e.listenerScore,"/100"]}),t.jsx("div",{className:"border-t border-border-subtle pt-1 mt-1",children:t.jsxs("div",{children:[e.listenerCount," packets where they heard your transmissions"]})})]}))(M),children:t.jsxs("div",{className:"flex items-center gap-1 text-sm rounded px-1 -mx-1 hover:bg-white/5 transition-colors cursor-default",children:[t.jsx(me,{className:"w-3 h-3 text-text-muted flex-shrink-0"}),t.jsx("span",{className:"text-text-muted font-mono truncate flex-1 min-w-0",children:M.name}),t.jsx("span",{className:"text-text-muted pl-2 tabular-nums flex-shrink-0 w-9 text-right",children:M.listenerScore})]})}),L&&t.jsx(j,{content:(e=>t.jsxs("div",{className:"max-w-[220px]",children:[t.jsxs("div",{className:"font-semibold mb-1",children:["📢 Loudest: ",e.name]}),t.jsxs("div",{className:"text-text-muted mb-1",children:["Score: ",e.loudScore,"/100"]}),t.jsx("div",{className:"border-t border-border-subtle pt-1 mt-1",children:t.jsxs("div",{children:[e.loudCount," packets they relayed directly to you"]})})]}))(L),children:t.jsxs("div",{className:"flex items-center gap-1 text-sm rounded px-1 -mx-1 hover:bg-white/5 transition-colors cursor-default",children:[t.jsx(he,{className:"w-3 h-3 text-text-muted flex-shrink-0"}),t.jsx("span",{className:"text-text-muted font-mono truncate flex-1 min-w-0",children:L.name}),t.jsx("span",{className:"text-text-muted pl-2 tabular-nums flex-shrink-0 w-9 text-right",children:L.loudScore})]})})]}):0===a.length?t.jsx("div",{className:"flex items-center justify-center text-sm text-text-muted mt-auto",children:"No direct neighbors"}):t.jsx("div",{className:"flex items-center justify-center text-sm text-text-muted mt-auto",children:"No routing data yet"});var S;return t.jsx(Te,{title:"Link Leaders",icon:t.jsx(xe,{className:"mini-widget-icon"}),isLoading:h,onClick:()=>s("/contacts"),children:_})}function Ze(){const{lbtStats:s,isLoading:a,error:n}=Ke(),l=s?function(e){const{retryRate:t,channelBusyCount:s,totalPacketsWithLBT:a,avgBackoffMs:n,maxBackoffMs:l}=e;if(0===a)return 0;const i=Math.min(a/10,1),r=Math.log(1+.15*t)/Math.log(16)*40,o=s/a*100,c=Math.min(.5*o,25);let d=0;n>100&&(d=Math.min(8*Math.log10(n/100),15));let u=0;l>500&&n>0&&l>2*n&&(u=Math.min((l-500)/200,5));const m=(r+c+d+u)*i;return Math.min(m,85)}(s):0,i=s?(r=l)<15?"excellent":r<30?"good":r<45?"fair":r<60?"congested":"critical":"unknown";var r;const o=(null==s?void 0:s.maxBackoffMs)??0,c=s?o>200?`Max backoff: ${Math.round(o)}ms`:function(e){return e<15?"Clear channel":e<30?"Light traffic":e<45?"Moderate traffic":e<60?"Heavy traffic":e<75?"Congested":"Severe congestion"}(l):void 0,d=null==s?void 0:s.sparklineCollisionRisk,{chartData:u,yDomain:m}=e.useMemo(()=>{if(!d||d.length<2)return{chartData:[],yDomain:[0,85]};const e=d.map(e=>({value:e})),t=d.filter(e=>e>0);if(0===t.length)return{chartData:e,yDomain:[0,85]};const s=Math.min(...t),a=Math.max(...t),n=a-s,l=Math.max(.2*n,5);return{chartData:e,yDomain:[Math.max(0,s-l),Math.min(85,a+l)]}},[d]);return t.jsx(Te,{title:"Collision Risk",icon:t.jsx(ae,{className:"mini-widget-icon"}),value:l.toFixed(1),unit:"%",status:i,subtitle:c,isLoading:a,error:n,children:t.jsx("div",{className:"mini-widget-sparkline",children:u.length>0?t.jsx(U,{width:"100%",height:24,children:t.jsxs(J,{data:u,margin:{top:2,right:2,bottom:2,left:2},children:[t.jsx(Q,{domain:m,hide:!0}),t.jsx(X,{type:"monotone",dataKey:"value",stroke:"var(--accent-primary)",strokeWidth:2,dot:!1,isAnimationActive:!1})]})}):t.jsx("div",{className:"h-full"})})})}function et(){const[s,a]=e.useState(!1),[n]=e.useState(0),{stats:l,lbtStats:i,isLoading:r}=Ke(),o=e.useMemo(()=>{if(!l)return null;const e=l.airtime_used_ms??0,t=l.max_airtime_ms??1;return{usedMs:e,maxMs:t,remainingMs:l.airtime_remaining_ms??0,utilizationPercent:l.utilization_percent??(t>0?e/t*100:0)}},[l]),c=e.useMemo(()=>i&&0!==i.totalPacketsWithLBT?(i.totalPacketsWithLBT-i.packetsWithRetries)/i.totalPacketsWithLBT*100:100,[i]),u=(null==o?void 0:o.utilizationPercent)??0,m=(h=u)<30?"excellent":h<50?"good":h<70?"fair":h<90?"congested":"critical";var h;const x=(null==o?void 0:o.remainingMs)??0,f=c<95?`${c.toFixed(0)}% clean TX`:((p=x)<1e3?`${Math.round(p)}ms`:p<6e4?`${(p/1e3).toFixed(1)}s`:`${(p/6e4).toFixed(1)}m`)+" remaining";var p;const v=o?t.jsx("div",{className:"mini-widget-progress mt-auto",children:t.jsx("div",{className:`mini-widget-progress-bar ${m}`,style:{width:`${Math.min(u,100)}%`}})}):null;return t.jsx(Te,{title:"Duty Cycle",icon:t.jsx(d,{className:"mini-widget-icon"}),value:u.toFixed(1),unit:"%",status:m,subtitle:f,isLoading:r,children:v})}function tt(){return t.jsxs("div",{className:"mini-widget",children:[t.jsxs("div",{className:"mini-widget-header",children:[t.jsx(C,{className:"w-4 h-4"}),t.jsx(C,{className:"h-3 w-16"})]}),t.jsx(C,{className:"h-7 w-12 mt-2"}),t.jsx(C,{className:"h-3 w-20 mt-2"})]})}function st(){return t.jsx("div",{className:"widget-row",children:Array.from({length:6}).map((e,s)=>t.jsx(tt,{},s))})}function at({className:e="",isLoaded:s=!0}){return t.jsxs("div",{className:`mesh-health-container relative ${e}`,children:[t.jsxs("div",{className:"mesh-health-header",children:[t.jsx(fe,{className:"w-4 h-4 text-accent-primary"}),t.jsx("span",{className:"type-label text-text-muted",children:"MESH HEALTH"})]}),s?t.jsx(Oe,{children:t.jsxs("div",{className:"widget-row",children:[t.jsx(Ge,{}),t.jsx(Ze,{}),t.jsx(Xe,{}),t.jsx(et,{}),t.jsx(Je,{}),t.jsx(Ye,{})]})}):t.jsx(st,{})]})}function nt(){var s,n;const i=o(),r=b(),c=l(),d=N(),u=x(),m=y(),h=k(),p=f[u],v=5===u&&!h.threeDayLoadComplete,g=6===u&&!h.sevenDayLoadComplete,j=7===u&&!h.fourteenDayLoadComplete,S=h.isBackgroundLoading&&(v||g||j),C=L(),D=_(),T=null==(s=null==i?void 0:i.config)?void 0:s.radio,A=e.useMemo(()=>T?{sf:T.spreading_factor??10,bw:T.bandwidth??25e4,cr:T.coding_rate??5,preamble:T.preamble_length??8}:null,[T]),$=c.length,H=e.useMemo(()=>$?w(p.minutes,p.buckets,c,i):null,[$,p.minutes,p.buckets,A]),I=e.useMemo(()=>function(e,t,s){if(!(null==e?void 0:e.length))return[];const a=s<=1440?{hour:"2-digit",minute:"2-digit",hour12:!1}:s<=4320?{weekday:"short",hour:"2-digit",minute:"2-digit",hour12:!1}:{weekday:"short",hour:"numeric",hour12:!1};return e.map((e,n)=>{var l;let i=new Date(1e3*e.start).toLocaleString([],a);return s>4320&&(i=i.replace(/(\d+)$/,"$1h")),{time:i,received:e.count,unique:(null==(l=null==t?void 0:t[n])?void 0:l.count)??0}})}(null==H?void 0:H.received,null==H?void 0:H.unique_received,p.minutes),[null==H?void 0:H.received,null==H?void 0:H.unique_received,p.minutes]),E=e.useMemo(()=>function(e){if(!e.length)return[0,"auto"];let t=0;for(const s of e)s.received>t&&(t=s.received),s.unique>t&&(t=s.unique);return[0,t||1]}(I),[I]),q=e.useMemo(()=>{const e=e=>(null==e?void 0:e.reduce((e,t)=>e+t.count,0))??0,t=e(null==H?void 0:H.received),s=e(null==H?void 0:H.unique_received),a=e(null==H?void 0:H.forwarded),n=e(null==H?void 0:H.dropped),l=e(null==H?void 0:H.transmitted),i=((null==H?void 0:H.time_range_minutes)??p.minutes)/60;return{received:t,uniqueReceived:s,forwarded:a,dropped:n,transmitted:l,rxPerHour:i>0?Math.round(t/i):0,fwdPerHour:i>0?Math.round(a/i):0}},[H,p.minutes]),W=(null==i?void 0:i.node_name)??(null==(n=null==i?void 0:i.config)?void 0:n.node_name)??"Unknown Node";return r?t.jsxs(F,{className:"p-8 text-center",children:[t.jsx("p",{className:"type-subheading text-accent-red mb-2",children:"Failed to connect to backend"}),t.jsx("p",{className:"type-body text-white/50",children:r}),t.jsx("p",{className:"type-data-sm text-white/40 mt-4",children:"Make sure the backend is running on port 8000"})]}):t.jsxs(B,{children:[t.jsx(R,{title:W,icon:t.jsx(ie,{}),controls:t.jsx(K,{ranges:f,selectedIndex:u,onSelect:m,isPending:S})}),t.jsx(re,{template:"hero",children:t.jsx(F,{isLoaded:d,skeletonType:"chart",compact:!0,children:d&&t.jsxs(t.Fragment,{children:[t.jsx(ce,{icon:t.jsx(P,{}),title:"RECEIVED",badge:p.label,actions:t.jsxs("div",{className:"data-box",children:[q.rxPerHour,"/hr"]})}),t.jsxs("div",{className:"flex flex-wrap gap-4 sm:gap-8",children:[t.jsxs("div",{className:"flex items-end gap-2",children:[t.jsx("div",{className:"type-data-hero text-text-primary",children:t.jsx(je,{children:q.received})}),t.jsx(a,{color:"green",className:"mb-0.5 sm:mb-1",children:"Total RF"})]}),t.jsxs("div",{className:"flex items-end gap-2",children:[t.jsx("div",{className:"type-data-hero text-text-primary",children:t.jsx(je,{children:q.uniqueReceived})}),t.jsx(a,{color:"blue",className:"mb-0.5 sm:mb-1",children:"Unique"})]})]}),t.jsx("div",{className:"mt-4 sm:mt-6 lg:mt-8 dashboard-chart-height",children:I.length>0?t.jsx(U,{width:"100%",height:"100%",children:t.jsxs(Y,{data:I,margin:{left:0,right:8,top:0,bottom:0},children:[t.jsx(Z,{strokeDasharray:"3 3",stroke:D.grid,vertical:!1}),t.jsx(ee,{dataKey:"time",axisLine:!1,tickLine:!1,tick:{fill:D.axisTick,fontSize:10,fontFamily:M},dy:8,interval:"preserveStartEnd",minTickGap:60}),t.jsx(Q,{domain:E,axisLine:!1,tickLine:!1,tick:{fill:D.axisTick,fontSize:10,fontFamily:M},dx:-4,width:28}),t.jsx(te,{content:t.jsx(Ce,{labelKey:"time"}),cursor:{stroke:D.cursor,strokeWidth:1}}),t.jsx(se,{type:"stepAfter",dataKey:"received",name:"Total RF",stroke:"none",fill:C.received,fillOpacity:1,dot:!1,activeDot:{r:4,strokeWidth:0,fill:C.received},isAnimationActive:!1}),t.jsx(se,{type:"stepAfter",dataKey:"unique",name:"Unique",stroke:"none",fill:C.forwarded,fillOpacity:1,dot:!1,activeDot:{r:4,strokeWidth:0,fill:C.forwarded},isAnimationActive:!1})]})}):t.jsx("div",{className:"h-full flex items-center justify-center text-text-muted",children:"No data available for this time range"})})]})})}),t.jsxs(re,{template:"compact",children:[t.jsx(oe,{span:6,lg:4,children:t.jsx(ke,{title:"FORWARDED",value:q.forwarded,color:"forwarded",buckets:null==H?void 0:H.forwarded,receivedCount:q.received,timeRangeLabel:p.label,icon:t.jsx(de,{className:"w-4 h-4"}),isLoaded:d})}),t.jsx(oe,{span:6,lg:4,children:t.jsx(ke,{title:"DROPPED",value:q.dropped,color:"dropped",buckets:null==H?void 0:H.dropped,receivedCount:q.received,timeRangeLabel:p.label,icon:t.jsx(G,{className:"w-4 h-4"}),isLoaded:d})}),t.jsx(oe,{span:12,lg:4,children:t.jsx(_e,{stats:i,receivedBuckets:null==H?void 0:H.received,droppedBuckets:null==H?void 0:H.dropped,forwardedBuckets:null==H?void 0:H.forwarded,bucketDurationSeconds:null==H?void 0:H.bucket_duration_seconds,timeRangeLabel:p.label,isLoaded:d})})]}),t.jsx(at,{isLoaded:d}),t.jsx(Se,{}),i&&t.jsx(re,{template:"auto",children:t.jsx(le,{nodeName:W,repeaterVersion:i.version,coreVersion:i.core_version,localHash:i.local_hash,publicKey:i.public_key})})]})}export{nt as default}; diff --git a/frontend/dist/assets/Dashboard-DiETwG01.js b/frontend/dist/assets/Dashboard-DiETwG01.js deleted file mode 100644 index c50a92ca..00000000 --- a/frontend/dist/assets/Dashboard-DiETwG01.js +++ /dev/null @@ -1 +0,0 @@ -import{r as e,j as t,V as s,Y as a,Z as n,_ as l,$ as i,a0 as r,E as o,L as c,a1 as d,U as u,a2 as m,a3 as h,a4 as x,a5 as f,a6 as p,a7 as v,a8 as g,a9 as j,aa as b,ab as N,ac as y,ad as k}from"./vendor-react-C341c8YC.js";import{B as w,S as M,u as L,c as _,d as S,e as C,w as F,L as B,f as R,h as D,j as T,D as A,k as $,m as P,n as I,T as H,o as E,p as W,q,r as z,t as O,F as K}from"./index-BJEgt3tp.js";import{u as G,a as V}from"./useThemeColors-AeHMyThq.js";import{C as U,S as J,a as Q,P as X,b as Y}from"./PageLayout-CnF5SScd.js";import{P as Z}from"./PacketList-BPeOqxkB.js";import{T as ee}from"./TimeRangeSelector-DGCfekAv.js";import{s as te}from"./SignalIndicator-BLrEkFNb.js";import{R as se,L as ae,Y as ne,u as le,A as ie,C as re,X as oe,T as ce,v as de}from"./recharts-6XUQYgRA.js";import{c as ue}from"./link-scoring-Cw0dJsWv.js";import{N as me}from"./NodeInformationCard-CEW2bogB.js";import{R as he,C as xe}from"./Grid-BOO-7ObJ.js";import{C as fe}from"./Card-2pQSGkKC.js";import"./vendor-core-WoOfkQwm.js";import"./deckgl-DTsmDcfs.js";import"./channel-keys-DJWRrSwE.js";import"./DataBox-CRX76VsB.js";const pe={",":"punc",".":"punc-period",":":"punc-colon","/":"punc-slash"},ve=/([,\.:\/])/g,ge=e.memo(function({children:s,className:a="",as:n="span"}){const l=e.useMemo(()=>{let e;return e="number"==typeof s?s.toLocaleString():Array.isArray(s)?s.join(""):String(s??""),ve.test(e)?(ve.lastIndex=0,e.split(ve).map((e,s)=>{const a=pe[e];return a?t.jsx("span",{className:a,children:e},s):e})):e},[s]);return t.jsx(n,{className:`data-tight ${a}`.trim(),children:l})}),je={received:{barBase:"var(--metric-received)"},forwarded:{barBase:"var(--metric-forwarded)"},transmitted:{barBase:"var(--metric-transmitted)"},dropped:{barBase:"var(--metric-dropped)"},neutral:{barBase:"var(--metric-neutral)"}},be={sm:"card-sm",md:"card-md",lg:"card-lg",hero:"card-hero",auto:""};function Ne({buckets:s,colorType:a}){const n=je[a].barBase,l=e.useMemo(()=>{if(!(null==s?void 0:s.length))return[];const e=M.statsCard,t=s.length/e,a=t<=1?s:Array.from({length:e},(e,a)=>{var n,l;const i=s.slice(Math.floor(a*t),Math.floor((a+1)*t)),r=i.reduce((e,t)=>e+t.count,0),o=i.length?i.reduce((e,t)=>e+t.avg_snr,0)/i.length:0;return{bucket:a,start:(null==(n=i[0])?void 0:n.start)??0,end:(null==(l=i.at(-1))?void 0:l.end)??0,count:r,airtime_ms:i.reduce((e,t)=>e+t.airtime_ms,0),avg_snr:o,avg_rssi:0}}),l=a.map(e=>e.count).filter(e=>e>0);if(0===l.length)return a.map(()=>({height:0,bottom:0,color:"transparent",count:0,snr:0}));const i=Math.max(...l),r=Math.min(...l),o=i-r;return 0===o?a.map(e=>({height:e.count>0?40:0,bottom:e.count>0?30:0,color:e.count>0?n:"transparent",count:e.count,snr:e.avg_snr})):a.map(e=>{if(0===e.count)return{height:0,bottom:0,color:"transparent",count:0,snr:e.avg_snr};const t=(e.count-r)/o,s=15*t;return{height:Math.max(30,30+50*t),bottom:s,color:n,count:e.count,snr:e.avg_snr}})},[s,n]);return(null==s?void 0:s.length)?t.jsx("div",{className:"w-full h-full flex items-end pt-1",children:l.map((e,s)=>{var a;return t.jsx("div",{className:"flex-1 relative min-w-0",style:{height:"100%"},children:t.jsx("div",{className:"absolute inset-x-0",style:{height:`${e.height}%`,bottom:`${e.bottom}%`,backgroundColor:e.color,opacity:e.count>0?.8:.1},title:e.count>0?`${e.count} packets, SNR: ${null==(a=e.snr)?void 0:a.toFixed(1)}dB`:"No packets"})},s)})}):t.jsx("div",{className:"w-full h-full flex items-end justify-center gap-[2px] opacity-20",children:t.jsx("span",{className:"type-data-xs text-text-secondary",children:"No data"})})}function ye({title:s,value:a,color:n="neutral",subtitle:l,buckets:i,receivedCount:r,timeRangeLabel:o,icon:c,size:d="md",isLoaded:u=!0}){const m="string"==typeof a?a:a.toLocaleString(),h=e.useMemo(()=>function(e){if(!(null==e?void 0:e.length))return null;const t=e.reduce((e,t)=>e+t.count,0),s=e[0].start,a=e[e.length-1].end,n=Math.max((a-s)/3600,1),l=Math.round(t/n);let i=0,r=0;for(let d=0;dr&&(r=e[d].count,i=d);const o=new Date(1e3*e[i].start).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}),c=e.filter(e=>e.count>0&&0!==e.avg_snr);return{total:t,ratePerHour:l,peakCount:r,peakHour:o,avgSnr:c.length>0?c.reduce((e,t)=>e+t.avg_snr,0)/c.length:null}}(i),[i]),x="number"==typeof a?a:(null==h?void 0:h.total)??0,f=r&&r>0?(x/r*100).toFixed(1):null;return u?t.jsxs("div",{className:`data-card flex flex-col relative ${be[d]}`,children:[t.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 mb-2 sm:mb-3",children:[c&&t.jsx("span",{className:"icon-sm text-icon-card-title",children:c}),t.jsx("span",{className:"type-micro",children:s}),o&&t.jsx(w,{color:"teal",className:"hidden sm:inline-flex",children:o})]}),t.jsx("div",{className:"type-data-hero text-text-primary",children:t.jsx(ge,{children:m})}),t.jsx("div",{className:"flex-1 mt-1 overflow-hidden min-h-[40px] sm:min-h-[60px]",children:i?t.jsx(Ne,{buckets:i,colorType:n}):t.jsx("div",{className:"w-full h-full flex items-center justify-center",children:t.jsx("div",{className:"w-full h-0.5 rounded-full bg-text-muted/15"})})}),t.jsx("div",{className:"pt-1.5 sm:pt-2 mt-1",children:t.jsxs("div",{className:"flex gap-2 sm:gap-3",children:[t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"data-box-label",children:"Rate"}),t.jsxs("div",{className:"data-box data-box-fill data-box-left",children:[(null==h?void 0:h.ratePerHour)??l??"—","/hr"]})]}),null!==f?t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"data-box-label",children:"dropped"===n?"Drop %":"Ratio"}),t.jsxs("div",{className:"data-box data-box-fill data-box-left",children:[f,"%"]})]}):(null==h?void 0:h.peakHour)?t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"data-box-label",children:"Peak"}),t.jsx("div",{className:"data-box data-box-fill data-box-left",children:h.peakHour})]}):null]})})]}):t.jsx("div",{className:`data-card flex flex-col relative ${be[d]}`,children:t.jsx(U,{})})}const ke=.2;function we(e,t=1){return Math.floor(5*t*e)}function Me(e){const t=Math.round(e/ke)*ke;return Math.max(0,Math.min(5,t))}function Le({stats:o,receivedBuckets:c,droppedBuckets:d,forwardedBuckets:u,bucketDurationSeconds:m,timeRangeLabel:h,isLoaded:x=!0}){var f,p,v,g;const[j,b]=e.useState(!1);if(!x)return t.jsx("div",{className:"data-card flex flex-col relative",children:t.jsx(U,{})});const N=function(e,t,s,a,n){var l,i;const r=e=>(null==e?void 0:e.reduce((e,t)=>e+t.count,0))??0,o=r(t),c=r(s),d=r(a),u=o||(null==e?void 0:e.rx_count)||1,m=c||(null==e?void 0:e.dropped_count)||0,h=u>0?m/(u+m)*100:0;let x=0;if((null==a?void 0:a.length)&&n)x=100*d/(a.length*n*1e3)*100;else if(e){const t=1e3*(e.uptime_seconds||1);x=(e.total_airtime_ms||e.airtime_used_ms||0)/t*100}const f=(null==e?void 0:e.neighbors)??{},p=Object.values(f).filter(e=>e.zero_hop).length;let v=1;h<3?v-=ke:h>15?v+=.4:h>10&&(v+=ke),x>5&&(v+=ke),p>10&&(v+=ke);const g=Me(v),j=Me(.28*g),b=we(g),N=we(j),y=we((null==(i=null==(l=null==e?void 0:e.config)?void 0:l.delays)?void 0:i.tx_delay_factor)??1);return{floodFactor:g,directFactor:j,floodSlots:b,directSlots:N,adjustment:b>y?"increase":b{const e=`set txdelay ${N.floodFactor.toFixed(1)}\nset direct.txdelay ${N.directFactor.toFixed(1)}`;try{await navigator.clipboard.writeText(e),b(!0),setTimeout(()=>b(!1),1500)}catch(t){const s=document.createElement("textarea");s.value=e,s.style.position="fixed",s.style.opacity="0",document.body.appendChild(s),s.select();try{document.execCommand("copy"),b(!0),setTimeout(()=>b(!1),1500)}catch{}document.body.removeChild(s)}},className:"flex gap-3 mb-2 sm:mb-3 w-full text-left hover:bg-white/[0.02] rounded-lg transition-colors p-1 -m-1 group",title:"Click to copy CLI commands",children:[t.jsxs("div",{className:"flex-1 flex flex-col",children:[t.jsx("span",{className:"type-data-hero text-text-primary",children:t.jsxs(ge,{children:["×",N.floodFactor.toFixed(1)]})}),t.jsx("span",{className:"text-xs font-medium text-text-muted uppercase tracking-wide mt-0.5 sm:mt-1",children:"Flood"})]}),t.jsxs("div",{className:"flex-1 flex flex-col",children:[t.jsx("span",{className:"type-data-hero text-accent-tertiary",children:t.jsxs(ge,{children:["×",N.directFactor.toFixed(1)]})}),t.jsx("span",{className:"text-xs font-medium text-text-muted uppercase tracking-wide mt-0.5 sm:mt-1",children:"Direct"})]}),t.jsx("div",{className:"flex items-center self-center opacity-0 group-hover:opacity-100 transition-opacity",children:j?t.jsx(i,{className:"w-4 h-4 text-green-400"}):t.jsx(r,{className:"w-4 h-4 text-text-muted"})})]}),t.jsx("div",{className:"flex-1 py-2",children:t.jsxs("div",{className:"flex gap-3",children:[t.jsxs("div",{className:"flex-1",children:[t.jsx("div",{className:"data-box-label",children:"Dupe"}),t.jsxs("div",{className:"data-box data-box-fill data-box-left "+(N.duplicateRate>10?"text-accent-warning":""),children:[N.duplicateRate.toFixed(1),"%"]})]}),t.jsxs("div",{className:"flex-1",children:[t.jsx("div",{className:"data-box-label",children:"TX Util"}),t.jsxs("div",{className:"data-box data-box-fill data-box-left",children:[N.txUtilization.toFixed(2),"%"]})]})]})}),t.jsxs("div",{className:"pt-2 mt-2",children:[t.jsx("div",{className:"data-box-label",children:"Current"}),t.jsx("div",{className:"flex gap-2",children:null!==y?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"data-box",children:["×",y.toFixed(2)]}),t.jsxs("div",{className:"data-box",style:{color:"var(--accent-tertiary)"},children:["×",(null==k?void 0:k.toFixed(2))??"—"]})]}):t.jsx("span",{className:"text-sm text-text-muted",children:"No config"})})]})]})}function _e(){const s=L(),a=_(),n=S(),l=C(),[i,r]=e.useState([]);e.useEffect(()=>{const e=F.subscribe(e=>{r(e)});return r(F.getPendingPackets()),e},[]);const u=e.useMemo(()=>{const e=s.length<=100?s:s.slice(-100),t=new Set(e.map(e=>e.packet_hash));return[...i.filter(e=>!t.has(e.packet.packet_hash)).map(e=>({...e.packet,isPending:!0})),...e].sort((e,t)=>(t.timestamp??0)-(e.timestamp??0))},[s,i]),m=null==l?void 0:l.local_hash,h=null==l?void 0:l.neighbors;return t.jsxs("div",{className:"chart-container h-full flex flex-col !overflow-visible",children:[t.jsxs("div",{className:"chart-header",children:[t.jsxs("div",{className:"chart-title",children:[t.jsx(o,{className:"chart-title-icon"}),"Recent Packets"]}),t.jsxs("div",{className:"flex items-center gap-3",children:[n&&t.jsx(B,{showLabel:!0}),t.jsxs(c,{to:"/packets",className:"pill-subtle",children:["View all ",t.jsx(d,{className:"w-3 h-3"})]})]})]}),t.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto px-1",children:t.jsx(Z,{packets:u,allPackets:s,localHash:m,neighbors:h,loading:a,maxPackets:50,showPagination:!1,flashNewest:!0,emptyMessage:"No packets received",footerAction:t.jsxs(c,{to:"/packets",className:"pill-subtle",children:["View all ",t.jsx(d,{className:"w-3 h-3"})]})})})]})}const Se=e.memo(function({active:e,payload:s,label:a,formatValue:n,labelKey:l}){var i;if(!e||!(null==s?void 0:s.length))return null;const r=l&&(null==(i=s[0])?void 0:i.payload)?s[0].payload[l]:a;return t.jsxs("div",{className:"bg-tooltip-bg border border-border-subtle rounded-lg px-4 py-3 shadow-xl",children:[r&&t.jsx("p",{className:"type-data-xs text-white/50 mb-2",children:r}),t.jsx("div",{className:"space-y-1.5",children:s.map((e,s)=>t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{backgroundColor:e.color}}),t.jsx("span",{className:"type-body-sm text-white/70 capitalize min-w-[60px]",children:e.name}),t.jsx("span",{className:"type-data-sm text-white tabular-nums",children:n?n(e.value,e.name):e.value.toLocaleString()})]},s))})]})});e.memo(function({active:e,payload:s,color:a,labelKey:n,unit:l=""}){var i,r;if(!e||!(null==s?void 0:s.length))return null;const o=s[0],c=null==(i=null==o?void 0:o.payload)?void 0:i[n];return t.jsxs("div",{className:"bg-tooltip-bg border border-border-subtle rounded-lg px-3 py-2 shadow-xl",children:[t.jsx("p",{className:"type-data-xs text-white/50 mb-1",children:c}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:a}}),t.jsxs("span",{className:"type-data-sm text-white tabular-nums",children:[null==(r=null==o?void 0:o.value)?void 0:r.toLocaleString(),l]})]})]})}),e.memo(function({payload:e}){return(null==e?void 0:e.length)?t.jsx("div",{className:"flex items-center justify-center gap-6 mt-4 pt-4 border-t border-white/5",children:e.map((e,s)=>t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:e.color}}),t.jsx("span",{className:"type-body-sm text-white/60 capitalize",children:e.value})]},s))}):null});const Ce={stable:"M5 12h14",up:"M5 15l7-7 7 7",down:"M19 9l-7 7-7-7"};function Fe({trend:e}){return t.jsx("span",{className:`mini-widget-trend ${e}`,children:t.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:Ce[e]})})})}function Be(){return t.jsx("div",{className:"mini-widget-loading",children:t.jsx("div",{className:"mini-widget-loading-spinner"})})}function Re({message:e}){return t.jsx("div",{className:"mini-widget-error",children:t.jsx("span",{title:e,children:"No data"})})}function De({title:e,icon:s,value:a,unit:n,valueSize:l="md",status:i,subtitle:r,trend:o,children:c,isLoading:d=!1,error:u,className:m="",onClick:h}){const x=["mini-widget-value","lg"===l&&"mini-widget-value-lg","sm"===l&&"mini-widget-value-sm"].filter(Boolean).join(" "),f=["mini-widget",h&&"cursor-pointer",m].filter(Boolean).join(" ");return t.jsxs("div",{className:f,onClick:h,role:h?"button":void 0,children:[t.jsxs("div",{className:"mini-widget-header",children:[s,t.jsx("span",{className:"mini-widget-title",children:e}),i&&"unknown"!==i&&t.jsx("div",{className:`mini-widget-status-dot ${i}`}),o&&t.jsx(Fe,{trend:o})]}),d?t.jsx(Be,{}):u?t.jsx(Re,{message:u}):t.jsxs(t.Fragment,{children:[void 0!==a&&t.jsxs("div",{className:x,children:[t.jsx(ge,{children:a}),n&&t.jsx("span",{className:"mini-widget-unit",children:n})]}),r&&t.jsx("div",{className:"mini-widget-subtitle",children:r}),c]})]})}const Te={DELTA_CRITICAL:10,SLOPE_CRITICAL:4,JITTER_CRITICAL:6,DELTA_WARNING:5,SLOPE_WARNING:2,JITTER_WARNING:4},Ae={baselineMedian:null,baselineP10:null,baselineP90:null,currentMedian:null,currentSampleCount:0,delta:0,slope:0,jitter:0,penalty:0,penaltyReason:null,computedAt:0,isReliable:!1};function $e(e,t){if(0===e.length)return null;const s=[...e].sort((e,t)=>e-t),a=t/100*(s.length-1),n=Math.floor(a),l=Math.ceil(a);return n===l?s[n]:s[n]+(s[l]-s[n])*(a-n)}function Pe(e){return $e(e,50)}function Ie(e){if(!e)return[];try{const t=JSON.parse(e);if(Array.isArray(t))return t.map(Number).filter(e=>!isNaN(e))}catch{}return[]}function He(e){return null!=e&&0!==e&&!Object.is(e,-0)&&!(e>-50||e<-130)}function Ee(e,t,s=2,a=!1){if(null===t)return"stable";const n=e-t;return(0!==t?100*Math.abs(n/t):Math.abs(n))0?"up":"down":n>0?"down":"up"}const We={lbtStats:null,noiseFloor:null,sparklineNoiseFloor:[],linkQuality:null,channelHealth:null,nfTrend:Ae,radioConfig:null,trends:null,stats:null,recentPackets:[],quickNeighbors:[],isLoading:!0,error:null,refresh:async()=>{}},qe=e.createContext(We);function ze({children:s}){var a;const n=C(),l=L(),i=R(),r=D(),o=T(),c=A[o],d=Math.max(1,c.minutes/60),u=null===n,m=e.useMemo(()=>function(e,t){const s=3600*t,a=Math.floor(Date.now()/1e3)-s,n=e.filter(e=>e.timestamp>=a&&void 0!==e.lbt_attempts&&e.lbt_attempts>0),l=n.length,i=n.filter(e=>(e.lbt_attempts??0)>1).length,r=l>0?i/l*100:0,o=n.filter(e=>(e.lbt_attempts??0)>1),c=o.length>0?o.reduce((e,t)=>e+(t.lbt_attempts??0),0)/o.length:0,d=n.filter(e=>(e.lbt_attempts??0)>=5).length,u=l>0?d/l*100:0,m=[];for(const b of n){const e=Ie(b.lbt_backoff_delays_ms);m.push(...e)}const h=m.reduce((e,t)=>e+t,0),x=m.length>0?h/m.length:0,f=m.length>0?Math.min(...m):0,p=m.length>0?Math.max(...m):0,v=s/24,g=[],j=[];for(let b=0;b<24;b++){const e=a+b*v,t=e+v,s=n.filter(s=>s.timestamp>=e&&s.timestamp(e.lbt_attempts??0)>1).length,i=s.length>0?l/s.length*100:0,r=[];for(const a of s){const e=Ie(a.lbt_backoff_delays_ms);r.push(...e)}const o=r.length>0?r.reduce((e,t)=>e+t,0)/r.length:0;if(g.push(o),0===s.length)j.push(0);else{const e=s.filter(e=>(e.lbt_attempts??0)>=5).length,t=r.length>0?Math.max(...r):0,a=Math.min(s.length/5,1),n=.15,l=Math.log(1+i*n)/Math.log(1+100*n)*40,c=e/s.length*100,d=Math.min(.5*c,25);let u=0;o>100&&(u=Math.min(8*Math.log10(o/100),15));let m=0;t>500&&o>0&&t>2*o&&(m=Math.min((t-500)/200,5));const h=l+d+u+m;j.push(Math.min(h*a,85))}}return{totalPacketsWithLBT:l,packetsWithRetries:i,retryRate:r,avgRetries:c,channelBusyCount:d,channelBusyRate:u,avgBackoffMs:x,minBackoffMs:f,maxBackoffMs:p,totalBackoffMs:h,sparklineBackoff:g,sparklineCollisionRisk:j,windowHours:t,packetCount:e.length}}(l,d),[l,d]),h=(null==n?void 0:n.noise_floor_dbm)??null,x=e.useMemo(()=>He(h)?h:null,[h]),f=e.useMemo(()=>{var e;const t=null==(e=null==n?void 0:n.config)?void 0:e.radio;return t?{sf:t.spreading_factor??7,bwHz:t.bandwidth??125e3}:null},[null==(a=null==n?void 0:n.config)?void 0:a.radio]),[p,v]=e.useState([]),g=e.useRef({time:0,hours:0});e.useEffect(()=>{const e=async()=>{var e;const t=Date.now(),s=Math.ceil(d);if(0===g.current.time||g.current.hours!==s||t-g.current.time>=6e4){g.current={time:t,hours:s};try{const t=await $(Math.max(s,24));t.success&&(null==(e=t.data)?void 0:e.history)&&v(t.data.history)}catch{}}};e();const t=setInterval(e,6e4);return()=>clearInterval(t)},[d]);const j=e.useMemo(()=>function(e,t){if(0===e.length)return[];const s=e.reduce((e,t)=>Math.max(e,t.timestamp),0);if(0===s)return[];const a=3600*t,n=s-a,l=a/24,i=[];for(let r=0;r<24;r++){const t=n+r*l,s=t+l,a=e.filter(e=>e.timestamp>=t&&e.timestamp0){const e=a.reduce((e,t)=>e+t.noise_floor_dbm,0)/a.length;i.push(e)}else i.push(i.length>0?i[i.length-1]:-100)}return i}(p,d),[p,d]),b=null==n?void 0:n.neighbors,N=e.useMemo(()=>{const e=b??{};return Object.fromEntries(Object.entries(e).filter(([e])=>!r.has(e)))},[b,r]),y=e.useMemo(()=>i.filter(e=>!r.has(e.hash)),[i,r]),k=e.useMemo(()=>function(e){if(0===e.length)return{...Ae,computedAt:Math.floor(Date.now()/1e3)};const t=Math.floor(Date.now()/1e3),s=e.filter(e=>Number.isFinite(e)),a=e.length>0?[e[e.length-1]]:[],n=e.slice(-4).filter(e=>Number.isFinite(e)),l=Pe(s),i=$e(s,10),r=$e(s,90),o=Pe(a),c=null!==o&&null!==i?o-i:0,d=function(e){if(e.length<2)return 0;const t=e.length;let s=0,a=0,n=0,l=0;const i=e[0].timestamp;for(const o of e){const e=(o.timestamp-i)/3600,t=o.value;s+=e,a+=t,n+=e*t,l+=e*e}const r=t*l-s*s;return Math.abs(r)<1e-4?0:(t*n-s*a)/r}(n.map((e,s)=>({timestamp:t-3600*(n.length-1-s),value:e}))),u=function(e){if(e.length<2)return 0;const t=e.reduce((e,t)=>e+t,0)/e.length,s=e.map(e=>Math.pow(e-t,2)).reduce((e,t)=>e+t,0)/e.length;return Math.sqrt(s)}(n),m=s.length>=12,[h,x]=m?function(e,t,s){const a=Te;return e>=a.DELTA_CRITICAL?[2,`Noise floor ${e.toFixed(1)} dB above baseline`]:t>=a.SLOPE_CRITICAL?[2,`Noise floor rising ${t.toFixed(1)} dB/hour`]:s>=a.JITTER_CRITICAL?[2,`Noise floor unstable (±${s.toFixed(1)} dB)`]:e>=a.DELTA_WARNING?[1,`Noise floor ${e.toFixed(1)} dB above baseline`]:t>=a.SLOPE_WARNING?[1,`Noise floor rising ${t.toFixed(1)} dB/hour`]:s>=a.JITTER_WARNING?[1,`Noise floor variable (±${s.toFixed(1)} dB)`]:[0,null]}(c,d,u):[0,null];return{baselineMedian:l,baselineP10:i,baselineP90:r,currentMedian:o,currentSampleCount:a.length,delta:c,slope:d,jitter:u,penalty:h,penaltyReason:x,computedAt:t,isReliable:m}}(j),[j]),w=e.useMemo(()=>function(e,t,s){if(0===e.length)return{neighbors:[],networkScore:0,neighborCount:0,bestLink:null,worstLink:null};const a=e.map(e=>{const a=function(e,t,s){const a=te(e,t,s,0);if(a)switch(a.finalGrade){case"excellent":return 100;case"good":return 80;case"fair":return 60;case"poor":return 40;case"critical":return 20}const n=void 0===e?50:e>=10?100:e>=5?80:e>=0?60:e>=-5?40:20,l=void 0===t?50:t>=-70?100:t>=-80?80:t>=-90?60:t>=-100?40:20;return Math.round(.6*n+.4*l)}(e.avgSnr??void 0,e.avgRssi??void 0,s),n=t[e.hash];return{name:(null==n?void 0:n.name)||(null==n?void 0:n.node_name)||e.prefix,hash:e.hash,rssi:e.avgRssi??-100,snr:e.avgSnr??-10,score:a,advertCount:e.count}});a.sort((e,t)=>t.score-e.score);const n=a.length>0?a.reduce((e,t)=>e+t.score,0)/a.length:0;return{neighbors:a,networkScore:Math.round(n),neighborCount:a.length,bestLink:a.length>0?{name:a[0].name,score:a[0].score}:null,worstLink:a.length>0?{name:a[a.length-1].name,score:a[a.length-1].score}:null}}(y,N,f),[y,N,f]),M=e.useMemo(()=>function(e,t,s){const a=e?Math.max(0,Math.min(100,100-5*e.retryRate)):50;let n=50;null!==t&&(n=Math.max(0,Math.min(100,(t+120)/30*100)));const l=(null==s?void 0:s.networkScore)??50,i=Math.round(.35*a+.25*n+.4*l);let r;return r=i>=85?"excellent":i>=70?"good":i>=50?"fair":i>=30?"congested":"critical",{score:i,status:r,components:{lbtHealth:Math.round(a),noiseHealth:Math.round(n),linkHealth:Math.round(l)}}}(m,x,w),[m,x,w]),[_,S]=e.useState({noiseFloor:null,networkScore:null,channelHealth:null}),F=e.useRef(0);e.useEffect(()=>{const e=()=>{const e=Date.now();e-F.current>3e4&&(F.current=e,S({noiseFloor:x,networkScore:(null==w?void 0:w.networkScore)??null,channelHealth:(null==M?void 0:M.score)??null}))};e();const t=setInterval(e,5e3);return()=>clearInterval(t)},[x,null==w?void 0:w.networkScore,null==M?void 0:M.score]);const B=e.useMemo(()=>({noiseFloor:{current:x,previous:_.noiseFloor,trend:null!==x?Ee(x,_.noiseFloor,2,!0):"stable"},networkScore:{current:(null==w?void 0:w.networkScore)??0,previous:_.networkScore,trend:Ee((null==w?void 0:w.networkScore)??0,_.networkScore,3,!1)},channelHealth:{current:(null==M?void 0:M.score)??0,previous:_.channelHealth,trend:Ee((null==M?void 0:M.score)??0,_.channelHealth,3,!1)}}),[x,null==w?void 0:w.networkScore,null==M?void 0:M.score,_]),P={lbtStats:m,noiseFloor:x,sparklineNoiseFloor:j,linkQuality:w,channelHealth:M,nfTrend:k,radioConfig:f,trends:B,stats:n,recentPackets:l,quickNeighbors:i,isLoading:u,error:null,refresh:async()=>{}};return t.jsx(qe.Provider,{value:P,children:s})}function Oe(){const t=e.useContext(qe);if(void 0===t)throw new Error("useLBTData must be used within an LBTDataProvider");return t}function Ke(e,t){return 0===e?"No backoffs":`${t.toFixed(0)}% retry rate`}function Ge(){const{lbtStats:s,isLoading:a,error:n}=Oe(),l=u(),i=(null==s?void 0:s.avgBackoffMs)??0,r=(null==s?void 0:s.retryRate)??0,o=s?(c=i)<100?"excellent":c<250?"good":c<500?"fair":c<1e3?"congested":"critical":"unknown";var c;const d=null==s?void 0:s.sparklineBackoff,{chartData:h,yDomain:x}=e.useMemo(()=>{if(!d||d.length<2)return{chartData:[],yDomain:[0,100]};const e=d.map(e=>({value:e})),t=d.filter(e=>e>0);if(0===t.length)return{chartData:e,yDomain:[0,100]};const s=Math.min(...t),a=Math.max(...t),n=a-s,l=Math.max(.2*n,.1*a,10);return{chartData:e,yDomain:[Math.max(0,s-l),a+l]}},[d]);return t.jsx(De,{title:"LBT Backoff",icon:t.jsx(m,{className:"mini-widget-icon"}),value:Math.round(i),unit:"ms",status:o,subtitle:s?Ke(i,r):void 0,isLoading:a,error:n,onClick:()=>l("/packets"),children:t.jsx("div",{className:"mini-widget-sparkline",children:h.length>0?t.jsx(se,{width:"100%",height:24,children:t.jsxs(ae,{data:h,margin:{top:2,right:2,bottom:2,left:2},children:[t.jsx(ne,{domain:x,hide:!0}),t.jsx(le,{type:"monotone",dataKey:"value",stroke:"var(--accent-primary)",strokeWidth:2,dot:!1,isAnimationActive:!1})]})}):t.jsx("div",{className:"h-full"})})})}function Ve(e){return 0===e?"—":e<1?"<1":Math.round(e).toString()}function Ue(){const{lbtStats:e,isLoading:s,error:a}=Oe(),n=u(),l=(null==e?void 0:e.channelBusyCount)??0,i=(null==e?void 0:e.totalPacketsWithLBT)??0,r=(null==e?void 0:e.channelBusyRate)??0,o=(null==e?void 0:e.retryRate)??0,c=(null==e?void 0:e.avgBackoffMs)??0,d=(null==e?void 0:e.minBackoffMs)??0,m=(null==e?void 0:e.maxBackoffMs)??0,x=o>0?Math.max(0,(o-r)/o*100):100;return t.jsx(De,{title:"Ch. Busy",icon:t.jsx(h,{className:"mini-widget-icon"}),isLoading:s,error:a,onClick:()=>n("/packets"),children:t.jsx("div",{className:"flex-1 flex items-end",children:t.jsxs("div",{className:"grid grid-cols-[auto_minmax(0,1fr)_auto_minmax(0,1fr)] gap-x-2 gap-y-2 w-full items-baseline",children:[t.jsx("span",{className:"data-box-label mb-0",title:`${l} packets exceeded max CAD attempts (5) out of ${i} total transmissions.`,children:"Failed:"}),t.jsxs("div",{className:"data-box justify-self-start",title:`${l} packets exceeded max CAD attempts (5) out of ${i} total transmissions.`,children:[t.jsx(ge,{children:l}),t.jsx("span",{className:"text-text-muted punc-slash",children:"/"}),t.jsx(ge,{children:i})]}),t.jsx("span",{className:"data-box-label mb-0",title:`${x.toFixed(1)}% of packets that needed LBT retries were sent successfully.`,children:"Sent:"}),t.jsx("div",{className:"data-box justify-self-start",title:`${x.toFixed(1)}% of packets that needed LBT retries were sent successfully.`,children:t.jsxs(ge,{children:[x.toFixed(0),"%"]})}),t.jsx("span",{className:"data-box-label mb-0",title:`Average LBT backoff delay: ${c.toFixed(0)}ms.`,children:"Mean:"}),t.jsxs("div",{className:"data-box justify-self-start",title:`Average LBT backoff delay: ${c.toFixed(0)}ms.`,children:[t.jsx(ge,{children:Ve(c)}),t.jsx("span",{className:"text-text-muted text-xs",children:"ms"})]}),t.jsx("span",{className:"data-box-label mb-0",title:`Backoff range: ${d.toFixed(0)}ms min, ${m.toFixed(0)}ms max.`,children:"Range:"}),t.jsxs("div",{className:"data-box justify-self-start",title:`Backoff range: ${d.toFixed(0)}ms min, ${m.toFixed(0)}ms max.`,children:[t.jsx(ge,{children:Ve(d)}),t.jsx("span",{className:"text-text-muted punc-slash",children:"/"}),t.jsx(ge,{children:Ve(m)})]})]})})})}function Je(e){return null===e?"No reading":e<-115?"Very quiet":e<-105?"Quiet":e<-95?"Moderate":e<-85?"Elevated":"High interference"}function Qe(){const{noiseFloor:s,sparklineNoiseFloor:a,trends:n,isLoading:l,error:i}=Oe(),r=null===(o=s)||o<-110?"excellent":o<-100?"good":o<-90?"fair":o<-80?"congested":"critical";var o;const c=null==n?void 0:n.noiseFloor.trend,{chartData:d,yDomain:u}=e.useMemo(()=>{if(!a||a.length<2)return{chartData:[],yDomain:[-120,-90]};const e=a.map(e=>({value:e})),t=a.filter(e=>-100!==e&&e<-50);if(0===t.length)return{chartData:e,yDomain:[-120,-90]};const s=Math.min(...t),n=Math.max(...t),l=n-s,i=Math.max(.2*l,3);return{chartData:e,yDomain:[s-i,n+i]}},[a]);return t.jsx(De,{title:"Noise Floor",icon:t.jsx(x,{className:"mini-widget-icon"}),value:null!==s?Math.round(s):"—",unit:null!==s?"dBm":void 0,status:r,trend:c,subtitle:Je(s),isLoading:l,error:i,children:t.jsx("div",{className:"mini-widget-sparkline",children:d.length>0?t.jsx(se,{width:"100%",height:24,children:t.jsxs(ae,{data:d,margin:{top:2,right:2,bottom:2,left:2},children:[t.jsx(ne,{domain:u,hide:!0}),t.jsx(le,{type:"monotone",dataKey:"value",stroke:"var(--accent-primary)",strokeWidth:2,dot:!1,isAnimationActive:!1})]})}):t.jsx("div",{className:"h-full"})})})}function Xe(){const s=u(),a=R(),n=L(),l=C(),i=T(),r=60*A[i].minutes,o=P(),c=e.useMemo(()=>{if(0===o)return n;const e=o-r;return n.filter(t=>t.timestamp>=e)},[n,r,o]),d=null===l,m=(null==l?void 0:l.local_hash)?I(l.local_hash):"",h=(null==l?void 0:l.neighbors)??{},{neighborHashes:x,neighborNames:j}=e.useMemo(()=>{const e=new Set,t=new Map;for(const s of a){e.add(s.hash);const a=h[s.hash],n=(null==a?void 0:a.name)||(null==a?void 0:a.node_name)||s.prefix;t.set(s.hash,n)}return{neighborHashes:e,neighborNames:t}},[a,h]),b=e.useMemo(()=>{if(0===x.size||0===c.length||!m)return{champion:null,listener:null,loudest:null};const{scores:e}=ue(c,x,m),t=[];for(const[l,i]of e)0!==i.blendedScore&&t.push({...i,name:j.get(l)??I(l)});let s=null,a=null,n=null;for(const l of t)(!s||l.blendedScore>s.blendedScore)&&(s=l),(!a||l.listenerScore>a.listenerScore)&&(a=l),(!n||l.loudScore>n.loudScore)&&(n=l);return{champion:s,listener:a,loudest:n}},[c,x,m,j]),{champion:N,listener:y,loudest:k}=b,w=N||y||k?t.jsxs("div",{className:"flex flex-col gap-0.5 mt-auto",children:[N&&t.jsx(H,{content:(M=N,t.jsxs("div",{className:"max-w-[220px]",children:[t.jsxs("div",{className:"font-semibold mb-1",children:["🏆 Champion: ",M.name]}),t.jsxs("div",{className:"text-text-muted mb-1",children:["Blended Score: ",M.blendedScore,t.jsx("span",{className:"text-text-muted/60 ml-1",children:"(Listener + Loud)"})]}),t.jsxs("div",{className:"border-t border-border-subtle pt-1 mt-1 space-y-0.5",children:[t.jsxs("div",{children:["Listener: ",M.listenerScore,"/100 (",M.listenerCount," shared paths)"]}),t.jsxs("div",{children:["Loud: ",M.loudScore,"/100 (",M.loudCount," packets relayed)"]})]})]})),children:t.jsxs("div",{className:"flex items-center gap-1 text-sm rounded px-1 -mx-1 hover:bg-white/5 transition-colors cursor-default",children:[t.jsx(f,{className:"w-3 h-3 text-map-neighbor-color flex-shrink-0"}),t.jsx("span",{className:"font-semibold text-map-neighbor-color font-mono truncate flex-1 min-w-0",children:N.name}),t.jsx("span",{className:"text-map-neighbor-color pl-2 tabular-nums flex-shrink-0 w-9 text-right",children:N.blendedScore})]})}),y&&t.jsx(H,{content:(e=>t.jsxs("div",{className:"max-w-[220px]",children:[t.jsxs("div",{className:"font-semibold mb-1",children:["👂 Best Listener: ",e.name]}),t.jsxs("div",{className:"text-text-muted mb-1",children:["Score: ",e.listenerScore,"/100"]}),t.jsx("div",{className:"border-t border-border-subtle pt-1 mt-1",children:t.jsxs("div",{children:[e.listenerCount," packets where they heard your transmissions"]})})]}))(y),children:t.jsxs("div",{className:"flex items-center gap-1 text-sm rounded px-1 -mx-1 hover:bg-white/5 transition-colors cursor-default",children:[t.jsx(p,{className:"w-3 h-3 text-text-muted flex-shrink-0"}),t.jsx("span",{className:"text-text-muted font-mono truncate flex-1 min-w-0",children:y.name}),t.jsx("span",{className:"text-text-muted pl-2 tabular-nums flex-shrink-0 w-9 text-right",children:y.listenerScore})]})}),k&&t.jsx(H,{content:(e=>t.jsxs("div",{className:"max-w-[220px]",children:[t.jsxs("div",{className:"font-semibold mb-1",children:["📢 Loudest: ",e.name]}),t.jsxs("div",{className:"text-text-muted mb-1",children:["Score: ",e.loudScore,"/100"]}),t.jsx("div",{className:"border-t border-border-subtle pt-1 mt-1",children:t.jsxs("div",{children:[e.loudCount," packets they relayed directly to you"]})})]}))(k),children:t.jsxs("div",{className:"flex items-center gap-1 text-sm rounded px-1 -mx-1 hover:bg-white/5 transition-colors cursor-default",children:[t.jsx(v,{className:"w-3 h-3 text-text-muted flex-shrink-0"}),t.jsx("span",{className:"text-text-muted font-mono truncate flex-1 min-w-0",children:k.name}),t.jsx("span",{className:"text-text-muted pl-2 tabular-nums flex-shrink-0 w-9 text-right",children:k.loudScore})]})})]}):0===a.length?t.jsx("div",{className:"flex items-center justify-center text-sm text-text-muted mt-auto",children:"No direct neighbors"}):t.jsx("div",{className:"flex items-center justify-center text-sm text-text-muted mt-auto",children:"No routing data yet"});var M;return t.jsx(De,{title:"Link Leaders",icon:t.jsx(g,{className:"mini-widget-icon"}),isLoading:d,onClick:()=>s("/contacts"),children:w})}function Ye(){const{lbtStats:s,isLoading:a,error:n}=Oe(),l=s?function(e){const{retryRate:t,channelBusyCount:s,totalPacketsWithLBT:a,avgBackoffMs:n,maxBackoffMs:l}=e;if(0===a)return 0;const i=Math.min(a/10,1),r=Math.log(1+.15*t)/Math.log(16)*40,o=s/a*100,c=Math.min(.5*o,25);let d=0;n>100&&(d=Math.min(8*Math.log10(n/100),15));let u=0;l>500&&n>0&&l>2*n&&(u=Math.min((l-500)/200,5));const m=(r+c+d+u)*i;return Math.min(m,85)}(s):0,i=s?(r=l)<15?"excellent":r<30?"good":r<45?"fair":r<60?"congested":"critical":"unknown";var r;const o=(null==s?void 0:s.maxBackoffMs)??0,c=s?o>200?`Max backoff: ${Math.round(o)}ms`:function(e){return e<15?"Clear channel":e<30?"Light traffic":e<45?"Moderate traffic":e<60?"Heavy traffic":e<75?"Congested":"Severe congestion"}(l):void 0,d=null==s?void 0:s.sparklineCollisionRisk,{chartData:u,yDomain:m}=e.useMemo(()=>{if(!d||d.length<2)return{chartData:[],yDomain:[0,85]};const e=d.map(e=>({value:e})),t=d.filter(e=>e>0);if(0===t.length)return{chartData:e,yDomain:[0,85]};const s=Math.min(...t),a=Math.max(...t),n=a-s,l=Math.max(.2*n,5);return{chartData:e,yDomain:[Math.max(0,s-l),Math.min(85,a+l)]}},[d]);return t.jsx(De,{title:"Collision Risk",icon:t.jsx(j,{className:"mini-widget-icon"}),value:l.toFixed(1),unit:"%",status:i,subtitle:c,isLoading:a,error:n,children:t.jsx("div",{className:"mini-widget-sparkline",children:u.length>0?t.jsx(se,{width:"100%",height:24,children:t.jsxs(ae,{data:u,margin:{top:2,right:2,bottom:2,left:2},children:[t.jsx(ne,{domain:m,hide:!0}),t.jsx(le,{type:"monotone",dataKey:"value",stroke:"var(--accent-primary)",strokeWidth:2,dot:!1,isAnimationActive:!1})]})}):t.jsx("div",{className:"h-full"})})})}function Ze(){const[s,a]=e.useState(!1),[n]=e.useState(0),{stats:l,lbtStats:i,isLoading:r}=Oe(),c=e.useMemo(()=>{if(!l)return null;const e=l.airtime_used_ms??0,t=l.max_airtime_ms??1;return{usedMs:e,maxMs:t,remainingMs:l.airtime_remaining_ms??0,utilizationPercent:l.utilization_percent??(t>0?e/t*100:0)}},[l]),d=e.useMemo(()=>i&&0!==i.totalPacketsWithLBT?(i.totalPacketsWithLBT-i.packetsWithRetries)/i.totalPacketsWithLBT*100:100,[i]),u=(null==c?void 0:c.utilizationPercent)??0,m=(h=u)<30?"excellent":h<50?"good":h<70?"fair":h<90?"congested":"critical";var h;const x=(null==c?void 0:c.remainingMs)??0,f=d<95?`${d.toFixed(0)}% clean TX`:((p=x)<1e3?`${Math.round(p)}ms`:p<6e4?`${(p/1e3).toFixed(1)}s`:`${(p/6e4).toFixed(1)}m`)+" remaining";var p;const v=c?t.jsx("div",{className:"mini-widget-progress mt-auto",children:t.jsx("div",{className:`mini-widget-progress-bar ${m}`,style:{width:`${Math.min(u,100)}%`}})}):null;return t.jsx(De,{title:"Duty Cycle",icon:t.jsx(o,{className:"mini-widget-icon"}),value:u.toFixed(1),unit:"%",status:m,subtitle:f,isLoading:r,children:v})}function et(){return t.jsxs("div",{className:"mini-widget",children:[t.jsxs("div",{className:"mini-widget-header",children:[t.jsx(J,{className:"w-4 h-4"}),t.jsx(J,{className:"h-3 w-16"})]}),t.jsx(J,{className:"h-7 w-12 mt-2"}),t.jsx(J,{className:"h-3 w-20 mt-2"})]})}function tt(){return t.jsx("div",{className:"widget-row",children:Array.from({length:6}).map((e,s)=>t.jsx(et,{},s))})}function st({className:e="",isLoaded:s=!0}){return t.jsxs("div",{className:`mesh-health-container relative ${e}`,children:[t.jsxs("div",{className:"mesh-health-header",children:[t.jsx(b,{className:"w-4 h-4 text-accent-primary"}),t.jsx("span",{className:"type-label text-text-muted",children:"MESH HEALTH"})]}),s?t.jsx(ze,{children:t.jsxs("div",{className:"widget-row",children:[t.jsx(Ge,{}),t.jsx(Ye,{}),t.jsx(Qe,{}),t.jsx(Ze,{}),t.jsx(Ue,{}),t.jsx(Xe,{})]})}):t.jsx(tt,{})]})}function at(){var s,n;const l=C(),i=E(),r=L(),o=W(),c=T(),d=q(),u=z(),m=A[c],h=5===c&&!u.threeDayLoadComplete,x=6===c&&!u.sevenDayLoadComplete,f=7===c&&!u.fourteenDayLoadComplete,p=u.isBackgroundLoading&&(h||x||f),v=G(),g=V(),j=null==(s=null==l?void 0:l.config)?void 0:s.radio,b=e.useMemo(()=>j?{sf:j.spreading_factor??10,bw:j.bandwidth??25e4,cr:j.coding_rate??5,preamble:j.preamble_length??8}:null,[j]),M=r.length,_=e.useMemo(()=>M?O(m.minutes,m.buckets,r,l):null,[M,m.minutes,m.buckets,b]),S=e.useMemo(()=>function(e,t,s){if(!(null==e?void 0:e.length))return[];const a=s<=1440?{hour:"2-digit",minute:"2-digit",hour12:!1}:s<=4320?{weekday:"short",hour:"2-digit",minute:"2-digit",hour12:!1}:{weekday:"short",hour:"numeric",hour12:!1};return e.map((e,n)=>{var l;let i=new Date(1e3*e.start).toLocaleString([],a);return s>4320&&(i=i.replace(/(\d+)$/,"$1h")),{time:i,received:e.count,unique:(null==(l=null==t?void 0:t[n])?void 0:l.count)??0}})}(null==_?void 0:_.received,null==_?void 0:_.unique_received,m.minutes),[null==_?void 0:_.received,null==_?void 0:_.unique_received,m.minutes]),F=e.useMemo(()=>function(e){if(!e.length)return[0,"auto"];let t=0;for(const s of e)s.received>t&&(t=s.received),s.unique>t&&(t=s.unique);return[0,t||1]}(S),[S]),B=e.useMemo(()=>{const e=e=>(null==e?void 0:e.reduce((e,t)=>e+t.count,0))??0,t=e(null==_?void 0:_.received),s=e(null==_?void 0:_.unique_received),a=e(null==_?void 0:_.forwarded),n=e(null==_?void 0:_.dropped),l=e(null==_?void 0:_.transmitted),i=((null==_?void 0:_.time_range_minutes)??m.minutes)/60;return{received:t,uniqueReceived:s,forwarded:a,dropped:n,transmitted:l,rxPerHour:i>0?Math.round(t/i):0,fwdPerHour:i>0?Math.round(a/i):0}},[_,m.minutes]),R=(null==l?void 0:l.node_name)??(null==(n=null==l?void 0:l.config)?void 0:n.node_name)??"Unknown Node";return i?t.jsxs(Q,{className:"p-8 text-center",children:[t.jsx("p",{className:"type-subheading text-accent-red mb-2",children:"Failed to connect to backend"}),t.jsx("p",{className:"type-body text-white/50",children:i}),t.jsx("p",{className:"type-data-sm text-white/40 mt-4",children:"Make sure the backend is running on port 8000"})]}):t.jsxs(X,{children:[t.jsx(Y,{title:R,icon:t.jsx(N,{}),controls:t.jsx(ee,{ranges:A,selectedIndex:c,onSelect:d,isPending:p})}),t.jsx(he,{template:"hero",children:t.jsx(Q,{isLoaded:o,skeletonType:"chart",compact:!0,children:o&&t.jsxs(t.Fragment,{children:[t.jsx(fe,{icon:t.jsx(a,{}),title:"RECEIVED",badge:m.label,actions:t.jsxs("div",{className:"data-box",children:[B.rxPerHour,"/hr"]})}),t.jsxs("div",{className:"flex flex-wrap gap-4 sm:gap-8",children:[t.jsxs("div",{className:"flex items-end gap-2",children:[t.jsx("div",{className:"type-data-hero text-text-primary",children:t.jsx(ge,{children:B.received})}),t.jsx(w,{color:"green",className:"mb-0.5 sm:mb-1",children:"Total RF"})]}),t.jsxs("div",{className:"flex items-end gap-2",children:[t.jsx("div",{className:"type-data-hero text-text-primary",children:t.jsx(ge,{children:B.uniqueReceived})}),t.jsx(w,{color:"blue",className:"mb-0.5 sm:mb-1",children:"Unique"})]})]}),t.jsx("div",{className:"mt-4 sm:mt-6 lg:mt-8 dashboard-chart-height",children:S.length>0?t.jsx(se,{width:"100%",height:"100%",children:t.jsxs(ie,{data:S,margin:{left:0,right:8,top:0,bottom:0},children:[t.jsx(re,{strokeDasharray:"3 3",stroke:g.grid,vertical:!1}),t.jsx(oe,{dataKey:"time",axisLine:!1,tickLine:!1,tick:{fill:g.axisTick,fontSize:10,fontFamily:K},dy:8,interval:"preserveStartEnd",minTickGap:60}),t.jsx(ne,{domain:F,axisLine:!1,tickLine:!1,tick:{fill:g.axisTick,fontSize:10,fontFamily:K},dx:-4,width:28}),t.jsx(ce,{content:t.jsx(Se,{labelKey:"time"}),cursor:{stroke:g.cursor,strokeWidth:1}}),t.jsx(de,{type:"stepAfter",dataKey:"received",name:"Total RF",stroke:"none",fill:v.received,fillOpacity:1,dot:!1,activeDot:{r:4,strokeWidth:0,fill:v.received},isAnimationActive:!1}),t.jsx(de,{type:"stepAfter",dataKey:"unique",name:"Unique",stroke:"none",fill:v.forwarded,fillOpacity:1,dot:!1,activeDot:{r:4,strokeWidth:0,fill:v.forwarded},isAnimationActive:!1})]})}):t.jsx("div",{className:"h-full flex items-center justify-center text-text-muted",children:"No data available for this time range"})})]})})}),t.jsxs(he,{template:"compact",children:[t.jsx(xe,{span:6,lg:4,children:t.jsx(ye,{title:"FORWARDED",value:B.forwarded,color:"forwarded",buckets:null==_?void 0:_.forwarded,receivedCount:B.received,timeRangeLabel:m.label,icon:t.jsx(y,{className:"w-4 h-4"}),isLoaded:o})}),t.jsx(xe,{span:6,lg:4,children:t.jsx(ye,{title:"DROPPED",value:B.dropped,color:"dropped",buckets:null==_?void 0:_.dropped,receivedCount:B.received,timeRangeLabel:m.label,icon:t.jsx(k,{className:"w-4 h-4"}),isLoaded:o})}),t.jsx(xe,{span:12,lg:4,children:t.jsx(Le,{stats:l,receivedBuckets:null==_?void 0:_.received,droppedBuckets:null==_?void 0:_.dropped,forwardedBuckets:null==_?void 0:_.forwarded,bucketDurationSeconds:null==_?void 0:_.bucket_duration_seconds,timeRangeLabel:m.label,isLoaded:o})})]}),t.jsx(st,{isLoaded:o}),t.jsx(_e,{}),l&&t.jsx(he,{template:"auto",children:t.jsx(me,{nodeName:R,repeaterVersion:l.version,coreVersion:l.core_version,localHash:l.local_hash,publicKey:l.public_key})})]})}export{at as default}; diff --git a/frontend/dist/assets/DataBox-CRX76VsB.js b/frontend/dist/assets/DataBox-CRX76VsB.js deleted file mode 100644 index c5a9bcf3..00000000 --- a/frontend/dist/assets/DataBox-CRX76VsB.js +++ /dev/null @@ -1 +0,0 @@ -import{r as e,j as t,$ as o,a0 as n}from"./vendor-react-C341c8YC.js";import{n as a}from"./recharts-6XUQYgRA.js";const s={standard:"w-3 h-3",compact:"w-2.5 h-2.5",responsive:"w-2.5 h-2.5 sm:w-3 sm:h-3"};function c({children:c,copyValue:r,copy:i=!1,size:l="standard",className:p,title:u,color:d,truncate:m}){const[h,x]=e.useState(!1),[w,y]=e.useState(!1),f=e.useRef(null),v=r??("string"==typeof c?c:""),b=s[l],g=(()=>{if(!m||"string"!=typeof c)return c;const e=c,[t,o]=!0===m?[6,4]:m;return e.length<=t+o+3?e:`${e.slice(0,t)}…${e.slice(-o)}`})(),j=e.useCallback(e=>{i&&(e.preventDefault(),e.stopPropagation(),f.current&&clearTimeout(f.current),function(e){var t;if("undefined"!=typeof window&&(window.isSecureContext||"https:"===window.location.protocol||"localhost"===window.location.hostname)&&(null==(t=navigator.clipboard)?void 0:t.writeText))return navigator.clipboard.writeText(e).catch(()=>{}),!0;try{const{scrollX:t,scrollY:o}=window,n=document.createElement("textarea");n.value=e,n.style.cssText="position:fixed;left:-9999px;top:-9999px;opacity:0;pointer-events:none",n.setAttribute("readonly",""),document.body.appendChild(n),n.focus({preventScroll:!0}),n.select(),n.setSelectionRange(0,e.length);const a=document.execCommand("copy");return document.body.removeChild(n),window.scrollTo(t,o),a}catch(o){return!1}}(v),x(!0),f.current=setTimeout(()=>x(!1),2e3))},[i,v]),C="compact"===l?"data-box-compact":"responsive"===l?"data-box-responsive":"",N=i?u||`Click to copy: ${v}`:u;return i?t.jsxs("button",{type:"button",onClick:j,onMouseEnter:()=>y(!0),onMouseLeave:()=>y(!1),className:a("data-box",C,"cursor-pointer select-none gap-1","hover:bg-white/[0.08] hover:border-white/[0.12]","transition-all duration-200",d,p),title:N,"aria-label":`Copy ${v}`,children:[t.jsx("span",{className:a("transition-colors duration-200",h?"text-accent-success":""),children:g}),t.jsx("span",{className:a("flex items-center justify-center","compact"===l?"w-3 h-3":"w-3.5 h-3.5"),children:h?t.jsx(o,{className:a("text-accent-success",b)}):t.jsx(n,{className:a("transition-opacity duration-200",w?"opacity-70":"opacity-40",b)})})]}):t.jsx("span",{className:a("data-box",C,d,p),title:N,children:g})}export{c as D}; diff --git a/frontend/dist/assets/DataBox-nCNZLfvU.js b/frontend/dist/assets/DataBox-nCNZLfvU.js new file mode 100644 index 00000000..af0d2505 --- /dev/null +++ b/frontend/dist/assets/DataBox-nCNZLfvU.js @@ -0,0 +1 @@ +import{a as e,j as t}from"./vendor-react-DCIF8YoJ.js";import{n as o}from"./recharts-DVj1EL-m.js";import{C as n}from"./check-qb29v-su.js";import{c as a}from"./index-BGs2yNOg.js";const c=a("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]),s={standard:"w-3 h-3",compact:"w-2.5 h-2.5",responsive:"w-2.5 h-2.5 sm:w-3 sm:h-3"};function r({children:a,copyValue:r,copy:i=!1,size:l="standard",className:p,title:d,color:u,truncate:m}){const[h,x]=e.useState(!1),[y,w]=e.useState(!1),f=e.useRef(null),v=r??("string"==typeof a?a:""),b=s[l],j=(()=>{if(!m||"string"!=typeof a)return a;const e=a,[t,o]=!0===m?[6,4]:m;return e.length<=t+o+3?e:`${e.slice(0,t)}…${e.slice(-o)}`})(),g=e.useCallback(e=>{i&&(e.preventDefault(),e.stopPropagation(),f.current&&clearTimeout(f.current),function(e){var t;if("undefined"!=typeof window&&(window.isSecureContext||"https:"===window.location.protocol||"localhost"===window.location.hostname)&&(null==(t=navigator.clipboard)?void 0:t.writeText))return navigator.clipboard.writeText(e).catch(()=>{}),!0;try{const{scrollX:t,scrollY:o}=window,n=document.createElement("textarea");n.value=e,n.style.cssText="position:fixed;left:-9999px;top:-9999px;opacity:0;pointer-events:none",n.setAttribute("readonly",""),document.body.appendChild(n),n.focus({preventScroll:!0}),n.select(),n.setSelectionRange(0,e.length);const a=document.execCommand("copy");return document.body.removeChild(n),window.scrollTo(t,o),a}catch(o){return!1}}(v),x(!0),f.current=setTimeout(()=>x(!1),2e3))},[i,v]),C="compact"===l?"data-box-compact":"responsive"===l?"data-box-responsive":"",N=i?d||`Click to copy: ${v}`:d;return i?t.jsxs("button",{type:"button",onClick:g,onMouseEnter:()=>w(!0),onMouseLeave:()=>w(!1),className:o("data-box",C,"cursor-pointer select-none gap-1","hover:bg-white/[0.08] hover:border-white/[0.12]","transition-all duration-200",u,p),title:N,"aria-label":`Copy ${v}`,children:[t.jsx("span",{className:o("transition-colors duration-200",h?"text-accent-success":""),children:j}),t.jsx("span",{className:o("flex items-center justify-center","compact"===l?"w-3 h-3":"w-3.5 h-3.5"),children:h?t.jsx(n,{className:o("text-accent-success",b)}):t.jsx(c,{className:o("transition-opacity duration-200",y?"opacity-70":"opacity-40",b)})})]}):t.jsx("span",{className:o("data-box",C,u,p),title:N,children:j})}export{c as C,r as D}; diff --git a/frontend/dist/assets/DeepAnalysisModal-D4eqwCNZ.js b/frontend/dist/assets/DeepAnalysisModal-D4eqwCNZ.js deleted file mode 100644 index a8e74c78..00000000 --- a/frontend/dist/assets/DeepAnalysisModal-D4eqwCNZ.js +++ /dev/null @@ -1 +0,0 @@ -import{r as e,j as t,m as s,$ as a,aJ as i,bW as n,aA as c,q as l,aq as r}from"./vendor-react-C341c8YC.js";import{n as m}from"./recharts-6XUQYgRA.js";import{N as d,aS as x,O as o,aT as p}from"./index-BJEgt3tp.js";function h({label:e,icon:s,status:i,detail:n}){return t.jsxs("div",{className:m("flex items-center gap-3 py-3 px-4 rounded-xl transition-all duration-300","active"===i&&"bg-accent-primary/10","complete"===i&&"bg-accent-primary/10 ring-2 ring-inset ring-accent-primary","pending"===i&&"opacity-40"),children:[t.jsx("div",{className:m("w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0 transition-all duration-300","active"===i&&"bg-accent-primary/20","complete"===i&&"bg-accent-primary/20","pending"===i&&"bg-subtle-fill"),children:"complete"===i?t.jsx(a,{className:"w-4 h-4 text-accent-primary"}):"active"===i?t.jsx(r,{className:"w-4 h-4 animate-spin text-accent-primary"}):t.jsx("span",{className:"text-text-muted",children:s})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:m("text-sm font-medium transition-colors","active"===i&&"text-accent-primary","complete"===i&&"text-accent-primary","pending"===i&&"text-text-muted"),children:e}),n&&"pending"!==i&&t.jsx("div",{className:"text-xs text-text-muted mt-0.5 truncate",children:n})]})]})}const g=e.memo(function({isOpen:e,currentStep:r,packetCount:m,onClose:g}){const j="complete"===r,u=e=>{const t=["fetching","analyzing","building","discovering","complete"],s=t.indexOf(r),a=t.indexOf(e);return a{});return t.jsx(d,{open:e,onClose:y,size:"sm",bottomSheet:!1,children:t.jsx(x,{isLoading:!j,borderRadius:16,children:t.jsx(o,{className:"p-6",children:j?t.jsxs("div",{className:"flex flex-col items-center py-6",children:[t.jsx(s.div,{variants:p,initial:"hidden",animate:"visible",className:"w-16 h-16 rounded-full flex items-center justify-center mb-4 bg-accent-primary/20",children:t.jsx(a,{className:"w-8 h-8 text-accent-primary"})}),t.jsx("h3",{className:"text-lg font-semibold text-accent-primary",children:"Ready!"})]}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[t.jsx("div",{className:"w-10 h-10 rounded-xl flex items-center justify-center bg-accent-primary/15",children:t.jsx(i,{className:"w-5 h-5 text-accent-primary"})}),t.jsxs("div",{children:[t.jsx("h3",{className:"text-base font-semibold text-text-primary",children:"Deep Analysis"}),t.jsx("p",{className:"text-xs text-text-muted",children:"Building mesh topology"})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(h,{label:"Fetching Packets",icon:t.jsx(n,{className:"w-4 h-4"}),status:u("fetching"),detail:m>0?`${m.toLocaleString()} packets`:"Loading database..."}),t.jsx(h,{label:"Analyzing Database",icon:t.jsx(c,{className:"w-4 h-4"}),status:u("analyzing"),detail:"Processing packet paths"}),t.jsx(h,{label:"Building Topology",icon:t.jsx(i,{className:"w-4 h-4"}),status:u("building"),detail:"Computing mesh edges"}),t.jsx(h,{label:"Discovering Nodes",icon:t.jsx(l,{className:"w-4 h-4"}),status:u("discovering"),detail:"Viterbi HMM ghost detection"})]}),t.jsx("p",{className:"text-xs text-text-muted text-center mt-5",children:"This may take a few seconds..."})]})})})})});export{g as D}; diff --git a/frontend/dist/assets/DeepAnalysisModal-Dhmx8Gh2.js b/frontend/dist/assets/DeepAnalysisModal-Dhmx8Gh2.js new file mode 100644 index 00000000..8783a207 --- /dev/null +++ b/frontend/dist/assets/DeepAnalysisModal-Dhmx8Gh2.js @@ -0,0 +1 @@ +import{c as e,aq as t,bE as a,ar as s,m as i,bF as n,aC as c}from"./index-BGs2yNOg.js";import{a as r,j as l}from"./vendor-react-DCIF8YoJ.js";import{n as m}from"./recharts-DVj1EL-m.js";import{C as d}from"./check-qb29v-su.js";import{G as o}from"./git-branch-Sfdze11O.js";import{D as x}from"./house-CCeK_0TO.js";import{L as p}from"./loader-circle-CwUrmZrV.js";const h=e("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]),j=e("eye-off",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),y=e("maximize-2",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]),g=e("minimize-2",[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]]);function u({label:e,icon:t,status:a,detail:s}){return l.jsxs("div",{className:m("flex items-center gap-3 py-3 px-4 rounded-xl transition-all duration-300","active"===a&&"bg-accent-primary/10","complete"===a&&"bg-accent-primary/10 ring-2 ring-inset ring-accent-primary","pending"===a&&"opacity-40"),children:[l.jsx("div",{className:m("w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0 transition-all duration-300","active"===a&&"bg-accent-primary/20","complete"===a&&"bg-accent-primary/20","pending"===a&&"bg-subtle-fill"),children:"complete"===a?l.jsx(d,{className:"w-4 h-4 text-accent-primary"}):"active"===a?l.jsx(p,{className:"w-4 h-4 animate-spin text-accent-primary"}):l.jsx("span",{className:"text-text-muted",children:t})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:m("text-sm font-medium transition-colors","active"===a&&"text-accent-primary","complete"===a&&"text-accent-primary","pending"===a&&"text-text-muted"),children:e}),s&&"pending"!==a&&l.jsx("div",{className:"text-xs text-text-muted mt-0.5 truncate",children:s})]})]})}const f=r.memo(function({isOpen:e,currentStep:r,packetCount:m,onClose:p}){const j="complete"===r,y=e=>{const t=["fetching","analyzing","building","discovering","complete"],a=t.indexOf(r),s=t.indexOf(e);return s{});return l.jsx(t,{open:e,onClose:g,size:"sm",bottomSheet:!1,children:l.jsx(a,{isLoading:!j,borderRadius:16,children:l.jsx(s,{className:"p-6",children:j?l.jsxs("div",{className:"flex flex-col items-center py-6",children:[l.jsx(i.div,{variants:n,initial:"hidden",animate:"visible",className:"w-16 h-16 rounded-full flex items-center justify-center mb-4 bg-accent-primary/20",children:l.jsx(d,{className:"w-8 h-8 text-accent-primary"})}),l.jsx("h3",{className:"text-lg font-semibold text-accent-primary",children:"Ready!"})]}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[l.jsx("div",{className:"w-10 h-10 rounded-xl flex items-center justify-center bg-accent-primary/15",children:l.jsx(o,{className:"w-5 h-5 text-accent-primary"})}),l.jsxs("div",{children:[l.jsx("h3",{className:"text-base font-semibold text-text-primary",children:"Deep Analysis"}),l.jsx("p",{className:"text-xs text-text-muted",children:"Building mesh topology"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(u,{label:"Fetching Packets",icon:l.jsx(h,{className:"w-4 h-4"}),status:y("fetching"),detail:m>0?`${m.toLocaleString()} packets`:"Loading database..."}),l.jsx(u,{label:"Analyzing Database",icon:l.jsx(x,{className:"w-4 h-4"}),status:y("analyzing"),detail:"Processing packet paths"}),l.jsx(u,{label:"Building Topology",icon:l.jsx(o,{className:"w-4 h-4"}),status:y("building"),detail:"Computing mesh edges"}),l.jsx(u,{label:"Discovering Nodes",icon:l.jsx(c,{className:"w-4 h-4"}),status:y("discovering"),detail:"Viterbi HMM ghost detection"})]}),l.jsx("p",{className:"text-xs text-text-muted text-center mt-5",children:"This may take a few seconds..."})]})})})})});export{f as D,j as E,g as M,y as a,h as b}; diff --git a/frontend/dist/assets/Grid-BOO-7ObJ.js b/frontend/dist/assets/Grid-DkfcBkoo.js similarity index 90% rename from frontend/dist/assets/Grid-BOO-7ObJ.js rename to frontend/dist/assets/Grid-DkfcBkoo.js index f8911bcc..c8af12c9 100644 --- a/frontend/dist/assets/Grid-BOO-7ObJ.js +++ b/frontend/dist/assets/Grid-DkfcBkoo.js @@ -1 +1 @@ -import{r as o,j as e}from"./vendor-react-C341c8YC.js";import{n as t}from"./recharts-6XUQYgRA.js";const l={hero:{mobile:12},"hero-tall":{mobile:12},"hero-auto":{mobile:12},panel:{mobile:12,md:6},feature:{mobile:12,md:6,lg:4},standard:{mobile:12,sm:6,lg:4,xl:3},compact:{mobile:6,lg:3},widget:{mobile:6,sm:4,md:3,lg:2},auto:{mobile:12}},a={hero:"bento-row-hero","hero-tall":"bento-row-hero-tall","hero-auto":"bento-row-hero-auto",panel:"bento-row-panel",feature:"bento-row-feature",standard:"bento-row-standard",compact:"bento-row-compact",widget:"bento-row-widget",auto:"bento-row-auto"};function n({template:n,children:r,className:s,gap:c}){const i=l[n],b=a[n],d="none"===c?"gap-0":"sm"===c?"bento-gap-sm":"lg"===c?"bento-gap-lg":"bento-gap",p=o.Children.map(r,t=>o.isValidElement(t)?t.type===m?t:e.jsx(m,{span:i.mobile,sm:i.sm,md:i.md,lg:i.lg,xl:i.xl,children:t}):t);return e.jsx("div",{className:t("bento-row",b,d,s),children:p})}function r(o,e=""){const t=e?`${e}:`:"";return"full"===o?`${t}col-span-full`:"auto"===o?`${t}col-auto`:1.5===o?`${t}bento-col-1-5`:`${t}bento-col-${o}`}function m({children:o,span:l,sm:a,md:n,lg:m,xl:s,className:c}){const i=t("bento-cell",r(l),a&&r(a,"sm"),n&&r(n,"md"),m&&r(m,"lg"),s&&r(s,"xl"),c);return e.jsx("div",{className:i,children:o})}export{m as C,n as R}; +import{a as o,j as e}from"./vendor-react-DCIF8YoJ.js";import{n as t}from"./recharts-DVj1EL-m.js";const l={hero:{mobile:12},"hero-tall":{mobile:12},"hero-auto":{mobile:12},panel:{mobile:12,md:6},feature:{mobile:12,md:6,lg:4},standard:{mobile:12,sm:6,lg:4,xl:3},compact:{mobile:6,lg:3},widget:{mobile:6,sm:4,md:3,lg:2},auto:{mobile:12}},a={hero:"bento-row-hero","hero-tall":"bento-row-hero-tall","hero-auto":"bento-row-hero-auto",panel:"bento-row-panel",feature:"bento-row-feature",standard:"bento-row-standard",compact:"bento-row-compact",widget:"bento-row-widget",auto:"bento-row-auto"};function n({template:n,children:r,className:s,gap:c}){const i=l[n],b=a[n],d="none"===c?"gap-0":"sm"===c?"bento-gap-sm":"lg"===c?"bento-gap-lg":"bento-gap",p=o.Children.map(r,t=>o.isValidElement(t)?t.type===m?t:e.jsx(m,{span:i.mobile,sm:i.sm,md:i.md,lg:i.lg,xl:i.xl,children:t}):t);return e.jsx("div",{className:t("bento-row",b,d,s),children:p})}function r(o,e=""){const t=e?`${e}:`:"";return"full"===o?`${t}col-span-full`:"auto"===o?`${t}col-auto`:1.5===o?`${t}bento-col-1-5`:`${t}bento-col-${o}`}function m({children:o,span:l,sm:a,md:n,lg:m,xl:s,className:c}){const i=t("bento-cell",r(l),a&&r(a,"sm"),n&&r(n,"md"),m&&r(m,"lg"),s&&r(s,"xl"),c);return e.jsx("div",{className:i,children:o})}export{m as C,n as R}; diff --git a/frontend/dist/assets/Login-CkRuF4n8.js b/frontend/dist/assets/Login-BM63wUrV.js similarity index 79% rename from frontend/dist/assets/Login-CkRuF4n8.js rename to frontend/dist/assets/Login-BM63wUrV.js index 09b19ebc..90ab0da2 100644 --- a/frontend/dist/assets/Login-CkRuF4n8.js +++ b/frontend/dist/assets/Login-BM63wUrV.js @@ -1 +1 @@ -import{r as e,j as t,U as s,m as a,A as i}from"./vendor-react-C341c8YC.js";import{n as r}from"./recharts-6XUQYgRA.js";import{g as n,i as o,s as l,l as c,a as d,b as m,P as h}from"./index-BJEgt3tp.js";import"./vendor-core-WoOfkQwm.js";import"./deckgl-DTsmDcfs.js";const x=e.memo(function({width:e,height:s,className:a="",fill:i="currentColor"}){return t.jsxs("svg",{viewBox:"0 0 134 15",width:e,height:s,className:a,role:"img","aria-label":"MeshCore",style:{fillRule:"evenodd",clipRule:"evenodd"},children:[t.jsx("path",{fill:i,d:"M3.277,0.053C2.829,0.053 2.401,0.41 2.321,0.851L0.013,13.623C-0.067,14.064 0.232,14.421 0.681,14.421L3.13,14.421C3.578,14.421 4.006,14.064 4.086,13.623L5.004,8.54L6.684,13.957C6.766,14.239 7.02,14.421 7.337,14.421L10.58,14.421C10.897,14.421 11.217,14.239 11.401,13.957L15.043,8.513L14.119,13.623C14.038,14.064 14.338,14.421 14.787,14.421L17.236,14.421C17.684,14.421 18.112,14.064 18.192,13.623L20.5,0.851C20.582,0.41 20.283,0.053 19.834,0.053L16.69,0.053C16.373,0.053 16.053,0.235 15.87,0.517L9.897,9.473C9.803,9.616 9.578,9.578 9.528,9.41L7.074,0.517C6.992,0.235 6.738,0.053 6.421,0.053L3.277,0.053Z"}),t.jsx("path",{fill:i,d:"M21.146,14.421C21.146,14.421 33.257,14.421 33.257,14.421C33.526,14.421 33.784,14.205 33.831,13.942L34.337,11.128C34.385,10.863 34.206,10.649 33.936,10.649L25.519,10.649C25.429,10.649 25.37,10.576 25.385,10.488L25.635,9.105C25.65,9.017 25.736,8.944 25.826,8.944L32.596,8.944C32.865,8.944 33.123,8.728 33.171,8.465L33.621,5.974C33.669,5.709 33.49,5.495 33.221,5.495L26.45,5.495C26.361,5.495 26.301,5.423 26.317,5.335L26.584,3.852C26.599,3.764 26.685,3.691 26.775,3.691L35.192,3.691C35.462,3.691 35.719,3.476 35.767,3.21L36.258,0.498C36.306,0.235 36.126,0.019 35.857,0.019L23.746,0.019C23.297,0.019 22.867,0.378 22.788,0.819L20.474,13.621C20.396,14.062 20.695,14.421 21.146,14.421Z"}),t.jsx("path",{fill:i,d:"M45.926,14.419L45.926,14.421L46.346,14.421C48.453,14.421 50.465,12.742 50.839,10.67L51.081,9.327C51.456,7.256 50.05,5.576 47.943,5.576L41.455,5.576C41.186,5.576 41.007,5.363 41.054,5.097L41.218,4.192C41.266,3.927 41.524,3.713 41.793,3.713L50.569,3.713C51.018,3.713 51.446,3.356 51.526,2.915L51.9,0.85C51.98,0.407 51.68,0.05 51.232,0.05L41.638,0.05C39.531,0.05 37.519,1.73 37.145,3.801L36.88,5.267C36.505,7.339 37.91,9.018 40.018,9.018L46.506,9.018C46.775,9.018 46.954,9.231 46.907,9.497L46.785,10.176C46.737,10.441 46.479,10.655 46.21,10.655L37.189,10.655C36.741,10.655 36.313,11.012 36.233,11.453L35.841,13.621C35.761,14.062 36.061,14.419 36.51,14.419L45.926,14.419Z"}),t.jsx("path",{fill:i,d:"M68.008,0.046C68.008,0.046 65.296,0.046 65.296,0.046C64.847,0.046 64.42,0.403 64.34,0.844L63.532,5.31C63.517,5.398 63.431,5.469 63.341,5.469L58.085,5.469C57.995,5.469 57.936,5.398 57.951,5.31L58.758,0.844C58.837,0.403 58.539,0.046 58.09,0.046L55.378,0.046C54.93,0.046 54.502,0.403 54.422,0.844L52.112,13.623C52.032,14.064 52.331,14.421 52.78,14.421L55.492,14.421C55.941,14.421 56.369,14.064 56.449,13.623L57.272,9.074C57.287,8.986 57.373,8.914 57.462,8.914L62.719,8.914C62.809,8.914 62.868,8.985 62.853,9.074L62.032,13.623C61.952,14.064 62.252,14.421 62.7,14.421L65.413,14.421C65.861,14.421 66.289,14.064 66.369,13.623L68.678,0.844C68.755,0.403 68.457,0.046 68.008,0.046Z"}),t.jsx("path",{fill:i,d:"M72.099,14.421C72.099,14.421 80.066,14.421 80.066,14.421C80.515,14.421 80.943,14.064 81.022,13.623L81.414,11.453C81.494,11.012 81.194,10.655 80.746,10.655L73.828,10.655C73.559,10.655 73.38,10.441 73.427,10.176L74.51,4.215C74.558,3.951 74.815,3.736 75.082,3.736L82,3.736C82.448,3.736 82.876,3.379 82.956,2.938L83.34,0.817C83.42,0.376 83.12,0.019 82.672,0.019L74.724,0.019C72.622,0.019 70.614,1.691 70.236,3.757L68.965,10.665C68.587,12.738 69.99,14.421 72.099,14.421Z"}),t.jsx("path",{fill:i,d:"M97.176,-0C97.176,0 88.882,0 88.882,0C86.775,0 84.763,1.68 84.389,3.751L83.139,10.67C82.765,12.741 84.169,14.421 86.277,14.421L94.571,14.421C96.678,14.421 98.69,12.741 99.064,10.67L100.314,3.751C100.689,1.68 99.284,-0 97.176,-0ZM94.798,10.178C94.75,10.443 94.492,10.657 94.223,10.657L87.978,10.657C87.709,10.657 87.529,10.443 87.577,10.178L88.659,4.192C88.707,3.927 88.964,3.713 89.234,3.713L95.477,3.713C95.747,3.713 95.926,3.927 95.878,4.192L94.798,10.178Z"}),t.jsx("path",{fill:i,d:"M101.284,14.421L103.995,14.421C104.443,14.421 104.871,14.065 104.951,13.624L105.43,10.97C105.446,10.882 105.531,10.81 105.621,10.81L108.902,10.806C109.064,10.806 109.2,10.886 109.267,11.018L110.813,14.035C110.992,14.392 111.319,14.434 112.303,14.419C112.88,14.426 113.756,14.382 115.169,14.382C115.623,14.382 115.902,13.907 115.678,13.51L113.989,10.569C113.945,10.491 113.993,10.386 114.086,10.34C115.39,9.707 116.423,8.477 116.681,7.055L117.27,3.785C117.646,1.713 116.242,0.033 114.134,0.033L103.884,0.033C103.436,0.033 103.008,0.39 102.928,0.831L100.616,13.623C100.536,14.064 100.836,14.421 101.284,14.421L101.284,14.421ZM106.73,3.791C106.745,3.703 106.831,3.631 106.921,3.631L112.225,3.631C112.626,3.631 112.891,3.949 112.821,4.343L112.431,6.494C112.359,6.885 111.979,7.204 111.58,7.204L106.276,7.204C106.186,7.204 106.127,7.133 106.142,7.043L106.73,3.791Z"}),t.jsx("path",{fill:i,d:"M118.277,14.421C118.277,14.421 130.388,14.421 130.388,14.421C130.657,14.421 130.915,14.205 130.963,13.942L131.468,11.128C131.516,10.863 131.337,10.649 131.068,10.649L122.65,10.649C122.56,10.649 122.501,10.576 122.516,10.488L122.766,9.105C122.781,9.017 122.867,8.944 122.957,8.944L129.728,8.944C129.997,8.944 130.254,8.728 130.302,8.465L130.753,5.974C130.801,5.709 130.621,5.495 130.352,5.495L123.581,5.495C123.492,5.495 123.432,5.423 123.448,5.335L123.715,3.852C123.73,3.764 123.816,3.691 123.906,3.691L132.324,3.691C132.593,3.691 132.851,3.476 132.898,3.21L133.389,0.498C133.437,0.235 133.257,0.019 132.988,0.019L120.877,0.019C120.428,0.019 119.999,0.378 119.919,0.819L117.605,13.621C117.527,14.062 117.827,14.421 118.277,14.421Z"})]})}),u="#9cf15b",p={container:{hidden:{opacity:0},visible:{opacity:1,transition:{staggerChildren:d.normal,delayChildren:.1}}},item:{hidden:{opacity:0,y:12},visible:{opacity:1,y:0,transition:m.smooth}},footer:{hidden:{opacity:0,y:20},visible:{opacity:1,y:0,transition:{...m.gentle,delay:.4}}},error:{hidden:{opacity:0,height:0,marginTop:0},visible:{opacity:1,height:"auto",marginTop:24,transition:m.snappy},exit:{opacity:0,height:0,marginTop:0,transition:{duration:.15}}}},C=r("block font-mono text-xs font-medium uppercase tracking-wider text-text-secondary"),L=r("block w-full rounded-md bg-white/5 px-3 py-2","font-mono text-sm font-semibold text-text-primary","border border-transparent","outline-none ring-1 ring-inset ring-white/10","placeholder:text-text-muted/60 placeholder:font-normal","focus:ring-2 focus:ring-inset focus:ring-accent-primary","transition-shadow duration-150"),f=r("flex w-full justify-center rounded-md px-3 py-2","font-mono text-sm font-semibold uppercase tracking-wide text-black shadow-sm","focus-visible:outline-2 focus-visible:outline-offset-2","disabled:opacity-50 disabled:cursor-not-allowed","transition-colors duration-150"),j=e.memo(function({className:e}){return t.jsxs("svg",{className:r("animate-spin",e),viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[t.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),t.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})}),g=e.memo(function({id:s,value:a,onChange:i,autoComplete:n="current-password",required:o=!1}){const[l,c]=e.useState(!1),d="×".repeat(a.length);return t.jsxs("div",{className:"relative",children:[t.jsx("input",{id:s,name:s,type:l?"text":"password",value:a,onChange:i,autoComplete:n,required:o,className:r(L,"pr-10",!l&&"password-mask"),style:l?void 0:{fontFamily:"var(--font-data)",color:"transparent",caretColor:"var(--text-primary)"}}),!l&&a.length>0&&t.jsx("div",{className:r("pointer-events-none absolute inset-0 flex items-center","px-3 font-mono text-sm font-semibold text-text-primary"),"aria-hidden":"true",children:d}),t.jsx("button",{type:"button",onClick:()=>c(e=>!e),className:r("absolute inset-y-0 right-0 flex items-center pr-3","text-text-muted hover:text-text-secondary transition-colors"),"aria-label":l?"Hide password":"Show password",children:l?t.jsx("svg",{className:"size-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,"aria-hidden":"true",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.98 8.223A10.477 10.477 0 001.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0112 4.5c4.756 0 8.773 3.162 10.065 7.498a10.523 10.523 0 01-4.293 5.774M6.228 6.228L3 3m3.228 3.228l3.65 3.65m7.894 7.894L21 21m-3.228-3.228l-3.65-3.65m0 0a3 3 0 10-4.243-4.243m4.242 4.242L9.88 9.88"})}):t.jsxs("svg",{className:"size-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,"aria-hidden":"true",children:[t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.036 12.322a1.012 1.012 0 010-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178z"}),t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})})]})}),v=e.memo(function({id:e,checked:s,onChange:a,label:i}){return t.jsxs("div",{className:"flex gap-3",children:[t.jsx("div",{className:"flex h-6 shrink-0 items-center",children:t.jsxs("div",{className:"group grid size-4 grid-cols-1",children:[t.jsx("input",{id:e,name:e,type:"checkbox",checked:s,onChange:e=>a(e.target.checked),className:r("col-start-1 row-start-1 appearance-none rounded-sm","border border-white/10 bg-white/5","checked:border-accent-primary checked:bg-accent-primary","focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent-primary","forced-colors:appearance-auto")}),t.jsx("svg",{fill:"none",viewBox:"0 0 14 14","aria-hidden":"true",className:r("pointer-events-none col-start-1 row-start-1","size-3.5 self-center justify-self-center stroke-white","group-has-[:disabled]:stroke-gray-950/25"),children:t.jsx("path",{d:"M3 8L6 11L11 3.5",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:r("transition-opacity",s?"opacity-100":"opacity-0")})})]})}),t.jsx("label",{htmlFor:e,className:"block font-mono text-xs uppercase tracking-wider text-text-secondary cursor-pointer select-none",children:i})]})}),b=e.memo(function({href:e,children:s}){return t.jsx(a.a,{href:e,target:"_blank",rel:"noopener noreferrer",whileHover:{scale:1.05},whileTap:{scale:.98},className:"inline-flex items-center gap-1.5 opacity-60 hover:opacity-100 transition-opacity",children:s})}),y=()=>t.jsx("span",{className:"text-white/20 text-xs","aria-hidden":"true",children:"•"}),w=e.memo(function(){return t.jsx("div",{className:"fixed inset-0 -z-10",style:{backgroundColor:"#09090b"},"aria-hidden":"true"})}),k=e.memo(function(){return t.jsxs(a.footer,{variants:p.footer,initial:"hidden",animate:"visible",className:"fixed bottom-0 inset-x-0 px-4 py-6",children:[t.jsx("p",{className:"text-center font-mono text-[10px] uppercase tracking-widest text-white/40 mb-3",children:"Powered By"}),t.jsx("div",{className:"mx-auto max-w-xs",children:t.jsxs("div",{className:"flex items-center justify-center gap-4",children:[t.jsx(b,{href:"https://github.com/rightup/pyMC_Repeater",children:t.jsxs("span",{className:"font-mono text-sm font-semibold tracking-tight",children:[t.jsx("span",{style:{color:u},children:"py"}),t.jsx("span",{className:"text-white",children:"MC"})]})}),t.jsx(y,{}),t.jsx(b,{href:"https://meshcore.co.uk",children:t.jsx(x,{height:12,className:"text-white"})}),t.jsx(y,{}),t.jsxs(b,{href:"https://wcmesh.com",children:[t.jsx("div",{className:"size-6 overflow-hidden rounded border border-white/10",children:t.jsx("img",{src:"/assets/WCM_Waves-RN-_ocPH.gif",alt:"",className:"size-full object-cover"})}),t.jsx("span",{className:"font-mono text-sm font-semibold tracking-tight text-white",children:"WCM"})]})]})})]})});function N(){const r=s(),[d,m]=e.useState("admin"),[x,b]=e.useState(""),[y,N]=e.useState(n),[M,z]=e.useState(!1),[S,Z]=e.useState(null),T=d.length>0&&x.length>0&&!M;e.useEffect(()=>{o()&&r("/",{replace:!0})},[r]);const W=e.useCallback(()=>Z(null),[]),B=e.useCallback(e=>{m(e.target.value),S&&W()},[S,W]),F=e.useCallback(e=>{b(e.target.value),S&&W()},[S,W]),R=e.useCallback(e=>{N(e),l(e)},[]),A=e.useCallback(async e=>{if(e.preventDefault(),!T)return;z(!0),Z(null);const t=await c(d,x,y);z(!1),t.success?window.location.href="/":Z(t.error??"Login failed")},[T,d,x,y]);return t.jsxs(t.Fragment,{children:[t.jsx(w,{}),t.jsx("main",{className:"flex min-h-svh items-center justify-center px-4 py-12 sm:px-6 lg:px-8",children:t.jsxs(a.div,{variants:p.container,initial:"hidden",animate:"visible",className:"w-full max-w-sm space-y-10",children:[t.jsx(a.div,{variants:p.item,className:"flex justify-center",children:t.jsx(h,{height:32})}),t.jsxs(a.form,{variants:p.item,onSubmit:A,className:"space-y-6",children:[t.jsxs("div",{children:[t.jsx("label",{htmlFor:"username",className:C,children:"Username"}),t.jsx("div",{className:"mt-2",children:t.jsx("input",{id:"username",name:"username",type:"text",value:d,onChange:B,required:!0,autoComplete:"username",autoFocus:!0,className:L})})]}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:"password",className:C,children:"Password"}),t.jsx("div",{className:"mt-2",children:t.jsx(g,{id:"password",value:x,onChange:F,required:!0})})]}),t.jsx(v,{id:"remember-me",checked:y,onChange:R,label:"Remember me"}),t.jsx(i,{mode:"wait",children:S&&t.jsx(a.div,{variants:p.error,initial:"hidden",animate:"visible",exit:"exit",role:"alert",className:"rounded-md bg-accent-danger/10 p-3 overflow-hidden",children:t.jsx("p",{className:"text-sm text-accent-danger text-center",children:S})},"error")}),t.jsx(a.div,{whileTap:T?{scale:.98}:void 0,children:t.jsx("button",{type:"submit",disabled:!T,className:f,style:{backgroundColor:u,"--tw-ring-color":u},onMouseEnter:e=>e.currentTarget.style.backgroundColor="#8de04a",onMouseLeave:e=>e.currentTarget.style.backgroundColor=u,children:M?t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(j,{className:"size-4"}),"Signing in…"]}):"Sign in"})})]}),t.jsxs(a.p,{variants:p.item,className:"text-center text-sm/6 text-text-muted",children:["A ",t.jsx("span",{style:{color:u},children:"@RightUp"})," X"," ",t.jsx("span",{style:{color:u},children:"@Treehouse⚡"})," Collab"]})]})}),t.jsx(k,{})]})}export{N as default}; +import{a as e,j as t}from"./vendor-react-DCIF8YoJ.js";import{n as s}from"./recharts-DVj1EL-m.js";import{g as a,i,s as r,l as n,m as o,a as l,b as c,P as d,A as m}from"./index-BGs2yNOg.js";import{b as h}from"./vendor-core-Dl9MTgSr.js";import"./deckgl-DTsmDcfs.js";const x=e.memo(function({width:e,height:s,className:a="",fill:i="currentColor"}){return t.jsxs("svg",{viewBox:"0 0 134 15",width:e,height:s,className:a,role:"img","aria-label":"MeshCore",style:{fillRule:"evenodd",clipRule:"evenodd"},children:[t.jsx("path",{fill:i,d:"M3.277,0.053C2.829,0.053 2.401,0.41 2.321,0.851L0.013,13.623C-0.067,14.064 0.232,14.421 0.681,14.421L3.13,14.421C3.578,14.421 4.006,14.064 4.086,13.623L5.004,8.54L6.684,13.957C6.766,14.239 7.02,14.421 7.337,14.421L10.58,14.421C10.897,14.421 11.217,14.239 11.401,13.957L15.043,8.513L14.119,13.623C14.038,14.064 14.338,14.421 14.787,14.421L17.236,14.421C17.684,14.421 18.112,14.064 18.192,13.623L20.5,0.851C20.582,0.41 20.283,0.053 19.834,0.053L16.69,0.053C16.373,0.053 16.053,0.235 15.87,0.517L9.897,9.473C9.803,9.616 9.578,9.578 9.528,9.41L7.074,0.517C6.992,0.235 6.738,0.053 6.421,0.053L3.277,0.053Z"}),t.jsx("path",{fill:i,d:"M21.146,14.421C21.146,14.421 33.257,14.421 33.257,14.421C33.526,14.421 33.784,14.205 33.831,13.942L34.337,11.128C34.385,10.863 34.206,10.649 33.936,10.649L25.519,10.649C25.429,10.649 25.37,10.576 25.385,10.488L25.635,9.105C25.65,9.017 25.736,8.944 25.826,8.944L32.596,8.944C32.865,8.944 33.123,8.728 33.171,8.465L33.621,5.974C33.669,5.709 33.49,5.495 33.221,5.495L26.45,5.495C26.361,5.495 26.301,5.423 26.317,5.335L26.584,3.852C26.599,3.764 26.685,3.691 26.775,3.691L35.192,3.691C35.462,3.691 35.719,3.476 35.767,3.21L36.258,0.498C36.306,0.235 36.126,0.019 35.857,0.019L23.746,0.019C23.297,0.019 22.867,0.378 22.788,0.819L20.474,13.621C20.396,14.062 20.695,14.421 21.146,14.421Z"}),t.jsx("path",{fill:i,d:"M45.926,14.419L45.926,14.421L46.346,14.421C48.453,14.421 50.465,12.742 50.839,10.67L51.081,9.327C51.456,7.256 50.05,5.576 47.943,5.576L41.455,5.576C41.186,5.576 41.007,5.363 41.054,5.097L41.218,4.192C41.266,3.927 41.524,3.713 41.793,3.713L50.569,3.713C51.018,3.713 51.446,3.356 51.526,2.915L51.9,0.85C51.98,0.407 51.68,0.05 51.232,0.05L41.638,0.05C39.531,0.05 37.519,1.73 37.145,3.801L36.88,5.267C36.505,7.339 37.91,9.018 40.018,9.018L46.506,9.018C46.775,9.018 46.954,9.231 46.907,9.497L46.785,10.176C46.737,10.441 46.479,10.655 46.21,10.655L37.189,10.655C36.741,10.655 36.313,11.012 36.233,11.453L35.841,13.621C35.761,14.062 36.061,14.419 36.51,14.419L45.926,14.419Z"}),t.jsx("path",{fill:i,d:"M68.008,0.046C68.008,0.046 65.296,0.046 65.296,0.046C64.847,0.046 64.42,0.403 64.34,0.844L63.532,5.31C63.517,5.398 63.431,5.469 63.341,5.469L58.085,5.469C57.995,5.469 57.936,5.398 57.951,5.31L58.758,0.844C58.837,0.403 58.539,0.046 58.09,0.046L55.378,0.046C54.93,0.046 54.502,0.403 54.422,0.844L52.112,13.623C52.032,14.064 52.331,14.421 52.78,14.421L55.492,14.421C55.941,14.421 56.369,14.064 56.449,13.623L57.272,9.074C57.287,8.986 57.373,8.914 57.462,8.914L62.719,8.914C62.809,8.914 62.868,8.985 62.853,9.074L62.032,13.623C61.952,14.064 62.252,14.421 62.7,14.421L65.413,14.421C65.861,14.421 66.289,14.064 66.369,13.623L68.678,0.844C68.755,0.403 68.457,0.046 68.008,0.046Z"}),t.jsx("path",{fill:i,d:"M72.099,14.421C72.099,14.421 80.066,14.421 80.066,14.421C80.515,14.421 80.943,14.064 81.022,13.623L81.414,11.453C81.494,11.012 81.194,10.655 80.746,10.655L73.828,10.655C73.559,10.655 73.38,10.441 73.427,10.176L74.51,4.215C74.558,3.951 74.815,3.736 75.082,3.736L82,3.736C82.448,3.736 82.876,3.379 82.956,2.938L83.34,0.817C83.42,0.376 83.12,0.019 82.672,0.019L74.724,0.019C72.622,0.019 70.614,1.691 70.236,3.757L68.965,10.665C68.587,12.738 69.99,14.421 72.099,14.421Z"}),t.jsx("path",{fill:i,d:"M97.176,-0C97.176,0 88.882,0 88.882,0C86.775,0 84.763,1.68 84.389,3.751L83.139,10.67C82.765,12.741 84.169,14.421 86.277,14.421L94.571,14.421C96.678,14.421 98.69,12.741 99.064,10.67L100.314,3.751C100.689,1.68 99.284,-0 97.176,-0ZM94.798,10.178C94.75,10.443 94.492,10.657 94.223,10.657L87.978,10.657C87.709,10.657 87.529,10.443 87.577,10.178L88.659,4.192C88.707,3.927 88.964,3.713 89.234,3.713L95.477,3.713C95.747,3.713 95.926,3.927 95.878,4.192L94.798,10.178Z"}),t.jsx("path",{fill:i,d:"M101.284,14.421L103.995,14.421C104.443,14.421 104.871,14.065 104.951,13.624L105.43,10.97C105.446,10.882 105.531,10.81 105.621,10.81L108.902,10.806C109.064,10.806 109.2,10.886 109.267,11.018L110.813,14.035C110.992,14.392 111.319,14.434 112.303,14.419C112.88,14.426 113.756,14.382 115.169,14.382C115.623,14.382 115.902,13.907 115.678,13.51L113.989,10.569C113.945,10.491 113.993,10.386 114.086,10.34C115.39,9.707 116.423,8.477 116.681,7.055L117.27,3.785C117.646,1.713 116.242,0.033 114.134,0.033L103.884,0.033C103.436,0.033 103.008,0.39 102.928,0.831L100.616,13.623C100.536,14.064 100.836,14.421 101.284,14.421L101.284,14.421ZM106.73,3.791C106.745,3.703 106.831,3.631 106.921,3.631L112.225,3.631C112.626,3.631 112.891,3.949 112.821,4.343L112.431,6.494C112.359,6.885 111.979,7.204 111.58,7.204L106.276,7.204C106.186,7.204 106.127,7.133 106.142,7.043L106.73,3.791Z"}),t.jsx("path",{fill:i,d:"M118.277,14.421C118.277,14.421 130.388,14.421 130.388,14.421C130.657,14.421 130.915,14.205 130.963,13.942L131.468,11.128C131.516,10.863 131.337,10.649 131.068,10.649L122.65,10.649C122.56,10.649 122.501,10.576 122.516,10.488L122.766,9.105C122.781,9.017 122.867,8.944 122.957,8.944L129.728,8.944C129.997,8.944 130.254,8.728 130.302,8.465L130.753,5.974C130.801,5.709 130.621,5.495 130.352,5.495L123.581,5.495C123.492,5.495 123.432,5.423 123.448,5.335L123.715,3.852C123.73,3.764 123.816,3.691 123.906,3.691L132.324,3.691C132.593,3.691 132.851,3.476 132.898,3.21L133.389,0.498C133.437,0.235 133.257,0.019 132.988,0.019L120.877,0.019C120.428,0.019 119.999,0.378 119.919,0.819L117.605,13.621C117.527,14.062 117.827,14.421 118.277,14.421Z"})]})}),u="#9cf15b",p={container:{hidden:{opacity:0},visible:{opacity:1,transition:{staggerChildren:l.normal,delayChildren:.1}}},item:{hidden:{opacity:0,y:12},visible:{opacity:1,y:0,transition:c.smooth}},footer:{hidden:{opacity:0,y:20},visible:{opacity:1,y:0,transition:{...c.gentle,delay:.4}}},error:{hidden:{opacity:0,height:0,marginTop:0},visible:{opacity:1,height:"auto",marginTop:24,transition:c.snappy},exit:{opacity:0,height:0,marginTop:0,transition:{duration:.15}}}},C=s("block font-mono text-xs font-medium uppercase tracking-wider text-text-secondary"),L=s("block w-full rounded-md bg-white/5 px-3 py-2","font-mono text-sm font-semibold text-text-primary","border border-transparent","outline-none ring-1 ring-inset ring-white/10","placeholder:text-text-muted/60 placeholder:font-normal","focus:ring-2 focus:ring-inset focus:ring-accent-primary","transition-shadow duration-150"),f=s("flex w-full justify-center rounded-md px-3 py-2","font-mono text-sm font-semibold uppercase tracking-wide text-black shadow-sm","focus-visible:outline-2 focus-visible:outline-offset-2","disabled:opacity-50 disabled:cursor-not-allowed","transition-colors duration-150"),j=e.memo(function({className:e}){return t.jsxs("svg",{className:s("animate-spin",e),viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[t.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),t.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})}),g=e.memo(function({id:a,value:i,onChange:r,autoComplete:n="current-password",required:o=!1}){const[l,c]=e.useState(!1),d="×".repeat(i.length);return t.jsxs("div",{className:"relative",children:[t.jsx("input",{id:a,name:a,type:l?"text":"password",value:i,onChange:r,autoComplete:n,required:o,className:s(L,"pr-10",!l&&"password-mask"),style:l?void 0:{fontFamily:"var(--font-data)",color:"transparent",caretColor:"var(--text-primary)"}}),!l&&i.length>0&&t.jsx("div",{className:s("pointer-events-none absolute inset-0 flex items-center","px-3 font-mono text-sm font-semibold text-text-primary"),"aria-hidden":"true",children:d}),t.jsx("button",{type:"button",onClick:()=>c(e=>!e),className:s("absolute inset-y-0 right-0 flex items-center pr-3","text-text-muted hover:text-text-secondary transition-colors"),"aria-label":l?"Hide password":"Show password",children:l?t.jsx("svg",{className:"size-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,"aria-hidden":"true",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.98 8.223A10.477 10.477 0 001.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0112 4.5c4.756 0 8.773 3.162 10.065 7.498a10.523 10.523 0 01-4.293 5.774M6.228 6.228L3 3m3.228 3.228l3.65 3.65m7.894 7.894L21 21m-3.228-3.228l-3.65-3.65m0 0a3 3 0 10-4.243-4.243m4.242 4.242L9.88 9.88"})}):t.jsxs("svg",{className:"size-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,"aria-hidden":"true",children:[t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.036 12.322a1.012 1.012 0 010-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178z"}),t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})})]})}),b=e.memo(function({id:e,checked:a,onChange:i,label:r}){return t.jsxs("div",{className:"flex gap-3",children:[t.jsx("div",{className:"flex h-6 shrink-0 items-center",children:t.jsxs("div",{className:"group grid size-4 grid-cols-1",children:[t.jsx("input",{id:e,name:e,type:"checkbox",checked:a,onChange:e=>i(e.target.checked),className:s("col-start-1 row-start-1 appearance-none rounded-sm","border border-white/10 bg-white/5","checked:border-accent-primary checked:bg-accent-primary","focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent-primary","forced-colors:appearance-auto")}),t.jsx("svg",{fill:"none",viewBox:"0 0 14 14","aria-hidden":"true",className:s("pointer-events-none col-start-1 row-start-1","size-3.5 self-center justify-self-center stroke-white","group-has-[:disabled]:stroke-gray-950/25"),children:t.jsx("path",{d:"M3 8L6 11L11 3.5",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:s("transition-opacity",a?"opacity-100":"opacity-0")})})]})}),t.jsx("label",{htmlFor:e,className:"block font-mono text-xs uppercase tracking-wider text-text-secondary cursor-pointer select-none",children:r})]})}),v=e.memo(function({href:e,children:s}){return t.jsx(o.a,{href:e,target:"_blank",rel:"noopener noreferrer",whileHover:{scale:1.05},whileTap:{scale:.98},className:"inline-flex items-center gap-1.5 opacity-60 hover:opacity-100 transition-opacity",children:s})}),y=()=>t.jsx("span",{className:"text-white/20 text-xs","aria-hidden":"true",children:"•"}),w=e.memo(function(){return t.jsx("div",{className:"fixed inset-0 -z-10",style:{backgroundColor:"#09090b"},"aria-hidden":"true"})}),k=e.memo(function(){return t.jsxs(o.footer,{variants:p.footer,initial:"hidden",animate:"visible",className:"fixed bottom-0 inset-x-0 px-4 py-6",children:[t.jsx("p",{className:"text-center font-mono text-[10px] uppercase tracking-widest text-white/40 mb-3",children:"Powered By"}),t.jsx("div",{className:"mx-auto max-w-xs",children:t.jsxs("div",{className:"flex items-center justify-center gap-4",children:[t.jsx(v,{href:"https://github.com/rightup/pyMC_Repeater",children:t.jsxs("span",{className:"font-mono text-sm font-semibold tracking-tight",children:[t.jsx("span",{style:{color:u},children:"py"}),t.jsx("span",{className:"text-white",children:"MC"})]})}),t.jsx(y,{}),t.jsx(v,{href:"https://meshcore.co.uk",children:t.jsx(x,{height:12,className:"text-white"})}),t.jsx(y,{}),t.jsxs(v,{href:"https://wcmesh.com",children:[t.jsx("div",{className:"size-6 overflow-hidden rounded border border-white/10",children:t.jsx("img",{src:"/assets/WCM_Waves-RN-_ocPH.gif",alt:"",className:"size-full object-cover"})}),t.jsx("span",{className:"font-mono text-sm font-semibold tracking-tight text-white",children:"WCM"})]})]})})]})});function N(){const s=h(),[l,c]=e.useState("admin"),[x,v]=e.useState(""),[y,N]=e.useState(a),[M,z]=e.useState(!1),[S,Z]=e.useState(null),T=l.length>0&&x.length>0&&!M;e.useEffect(()=>{i()&&s("/",{replace:!0})},[s]);const W=e.useCallback(()=>Z(null),[]),B=e.useCallback(e=>{c(e.target.value),S&&W()},[S,W]),F=e.useCallback(e=>{v(e.target.value),S&&W()},[S,W]),R=e.useCallback(e=>{N(e),r(e)},[]),A=e.useCallback(async e=>{if(e.preventDefault(),!T)return;z(!0),Z(null);const t=await n(l,x,y);z(!1),t.success?window.location.href="/":Z(t.error??"Login failed")},[T,l,x,y]);return t.jsxs(t.Fragment,{children:[t.jsx(w,{}),t.jsx("main",{className:"flex min-h-svh items-center justify-center px-4 py-12 sm:px-6 lg:px-8",children:t.jsxs(o.div,{variants:p.container,initial:"hidden",animate:"visible",className:"w-full max-w-sm space-y-10",children:[t.jsx(o.div,{variants:p.item,className:"flex justify-center",children:t.jsx(d,{height:32})}),t.jsxs(o.form,{variants:p.item,onSubmit:A,className:"space-y-6",children:[t.jsxs("div",{children:[t.jsx("label",{htmlFor:"username",className:C,children:"Username"}),t.jsx("div",{className:"mt-2",children:t.jsx("input",{id:"username",name:"username",type:"text",value:l,onChange:B,required:!0,autoComplete:"username",autoFocus:!0,className:L})})]}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:"password",className:C,children:"Password"}),t.jsx("div",{className:"mt-2",children:t.jsx(g,{id:"password",value:x,onChange:F,required:!0})})]}),t.jsx(b,{id:"remember-me",checked:y,onChange:R,label:"Remember me"}),t.jsx(m,{mode:"wait",children:S&&t.jsx(o.div,{variants:p.error,initial:"hidden",animate:"visible",exit:"exit",role:"alert",className:"rounded-md bg-accent-danger/10 p-3 overflow-hidden",children:t.jsx("p",{className:"text-sm text-accent-danger text-center",children:S})},"error")}),t.jsx(o.div,{whileTap:T?{scale:.98}:void 0,children:t.jsx("button",{type:"submit",disabled:!T,className:f,style:{backgroundColor:u,"--tw-ring-color":u},onMouseEnter:e=>e.currentTarget.style.backgroundColor="#8de04a",onMouseLeave:e=>e.currentTarget.style.backgroundColor=u,children:M?t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(j,{className:"size-4"}),"Signing in…"]}):"Sign in"})})]}),t.jsxs(o.p,{variants:p.item,className:"text-center text-sm/6 text-text-muted",children:["A ",t.jsx("span",{style:{color:u},children:"@RightUp"})," X"," ",t.jsx("span",{style:{color:u},children:"@Treehouse⚡"})," Collab"]})]})}),t.jsx(k,{})]})}export{N as default}; diff --git a/frontend/dist/assets/Logs-CO8l86BH.js b/frontend/dist/assets/Logs-CO8l86BH.js new file mode 100644 index 00000000..db8cbc60 --- /dev/null +++ b/frontend/dist/assets/Logs-CO8l86BH.js @@ -0,0 +1 @@ +import{a as e,j as s}from"./vendor-react-DCIF8YoJ.js";import{n as a}from"./recharts-DVj1EL-m.js";import{c as t,bc as l,bd as r,e as c,be as i,y as o,bf as n,ba as m,bg as x}from"./index-BGs2yNOg.js";import{u as d}from"./usePolling-DIhP09j-.js";import{P as p,b as h,a as g,L as j}from"./PageLayout-DIXn4UXM.js";import{C as u}from"./Card-CPlTPCY8.js";import"./deckgl-DTsmDcfs.js";import"./vendor-core-Dl9MTgSr.js";const y=t("circle-play",[["path",{d:"M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z",key:"kmsa83"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),b=t("circle-stop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]]),f=e.memo(function({log:e}){return s.jsx("div",{className:"p-3 rounded-2xl bg-subtle-fill hover:bg-subtle-fill-strong transition-colors",children:s.jsxs("div",{className:"flex items-baseline gap-3",children:[s.jsx("span",{className:a("type-data-sm w-14 shrink-0",x(e.level)),children:e.level}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"type-data-sm text-text-primary break-words whitespace-pre-wrap",children:e.message}),s.jsx("p",{className:"type-data-xs text-text-muted mt-1",children:new Date(e.timestamp).toLocaleString()})]})]})})});function v({showDebug:e,onToggle:t}){return s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:a("type-data-sm",e?"text-accent-tertiary":"text-accent-primary"),children:e?"DEBUG":"INFO"}),s.jsx("button",{onClick:t,className:a("relative w-10 h-5 rounded-full transition-colors duration-200",e?"bg-accent-tertiary":"bg-accent-primary"),role:"switch","aria-checked":e,children:s.jsx("span",{className:a("absolute top-[2px] left-[2px] w-4 h-4 bg-white rounded-full shadow-sm transition-transform duration-200",e?"translate-x-5":"translate-x-0")})})]})}function w(){const t=l(),x=r(),w=c(),N=i(),k=o(),[C,D]=e.useState(!1),L=e.useCallback(()=>{D(e=>!e)},[]),P=C?t:t.filter(e=>"DEBUG"!==e.level);return d(N,m.logs,w),s.jsxs(p,{children:[s.jsx(h,{title:"System Logs",icon:s.jsx(n,{}),controls:s.jsx(v,{showDebug:C,onToggle:L})}),s.jsxs(g,{noPadding:!0,children:[s.jsx(u,{listHeader:!0,icon:s.jsx(n,{className:"icon-sm"}),title:"Log Entries",actions:s.jsx("button",{onClick:()=>k(!w),className:a("transition-colors",w?"text-signal-critical hover:text-signal-critical/80":"text-accent-primary hover:text-accent-primary/80 animate-pulse-slow"),title:w?"Pause":"Resume",children:w?s.jsx(b,{className:"w-5 h-5"}):s.jsx(y,{className:"w-5 h-5"})})}),s.jsx("div",{className:"space-y-2 max-h-[calc(100vh-300px)] sm:max-h-[calc(100vh-250px)] overflow-y-auto p-4",children:x&&0===t.length?s.jsx(j,{count:10}):0===P.length?s.jsx("div",{className:"text-center py-12 text-text-muted",children:0===t.length?"No logs available":"No logs match selected filters"}):P.map((e,a)=>s.jsx(f,{log:e},`${e.timestamp}-${a}`))})]})]})}export{w as default}; diff --git a/frontend/dist/assets/Logs-Cb5GXQFD.js b/frontend/dist/assets/Logs-Cb5GXQFD.js deleted file mode 100644 index 962153e6..00000000 --- a/frontend/dist/assets/Logs-Cb5GXQFD.js +++ /dev/null @@ -1 +0,0 @@ -import{r as s,j as e,F as a,bA as t,bB as l}from"./vendor-react-C341c8YC.js";import{n as r}from"./recharts-6XUQYgRA.js";import{au as i,av as n,d as o,aw as c,v as m,as as x,ax as d}from"./index-BJEgt3tp.js";import{u as p}from"./usePolling-CtRLadGa.js";import{P as h,b as j,a as u,L as g}from"./PageLayout-CnF5SScd.js";import{C as f}from"./Card-2pQSGkKC.js";import"./vendor-core-WoOfkQwm.js";import"./deckgl-DTsmDcfs.js";const v=s.memo(function({log:s}){return e.jsx("div",{className:"p-3 rounded-2xl bg-subtle-fill hover:bg-subtle-fill-strong transition-colors",children:e.jsxs("div",{className:"flex items-baseline gap-3",children:[e.jsx("span",{className:r("type-data-sm w-14 shrink-0",d(s.level)),children:s.level}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"type-data-sm text-text-primary break-words whitespace-pre-wrap",children:s.message}),e.jsx("p",{className:"type-data-xs text-text-muted mt-1",children:new Date(s.timestamp).toLocaleString()})]})]})})});function b({showDebug:s,onToggle:a}){return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:r("type-data-sm",s?"text-accent-tertiary":"text-accent-primary"),children:s?"DEBUG":"INFO"}),e.jsx("button",{onClick:a,className:r("relative w-10 h-5 rounded-full transition-colors duration-200",s?"bg-accent-tertiary":"bg-accent-primary"),role:"switch","aria-checked":s,children:e.jsx("span",{className:r("absolute top-[2px] left-[2px] w-4 h-4 bg-white rounded-full shadow-sm transition-transform duration-200",s?"translate-x-5":"translate-x-0")})})]})}function N(){const d=i(),N=n(),w=o(),y=c(),k=m(),[C,D]=s.useState(!1),L=s.useCallback(()=>{D(s=>!s)},[]),P=C?d:d.filter(s=>"DEBUG"!==s.level);return p(y,x.logs,w),e.jsxs(h,{children:[e.jsx(j,{title:"System Logs",icon:e.jsx(a,{}),controls:e.jsx(b,{showDebug:C,onToggle:L})}),e.jsxs(u,{noPadding:!0,children:[e.jsx(f,{listHeader:!0,icon:e.jsx(a,{className:"icon-sm"}),title:"Log Entries",actions:e.jsx("button",{onClick:()=>k(!w),className:r("transition-colors",w?"text-signal-critical hover:text-signal-critical/80":"text-accent-primary hover:text-accent-primary/80 animate-pulse-slow"),title:w?"Pause":"Resume",children:w?e.jsx(t,{className:"w-5 h-5"}):e.jsx(l,{className:"w-5 h-5"})})}),e.jsx("div",{className:"space-y-2 max-h-[calc(100vh-300px)] sm:max-h-[calc(100vh-250px)] overflow-y-auto p-4",children:N&&0===d.length?e.jsx(g,{count:10}):0===P.length?e.jsx("div",{className:"text-center py-12 text-text-muted",children:0===d.length?"No logs available":"No logs match selected filters"}):P.map((s,a)=>e.jsx(v,{log:s},`${s.timestamp}-${a}`))})]})]})}export{N as default}; diff --git a/frontend/dist/assets/MeshGraph-Cn5F4qEM.js b/frontend/dist/assets/MeshGraph-Cn5F4qEM.js new file mode 100644 index 00000000..d6ed3130 --- /dev/null +++ b/frontend/dist/assets/MeshGraph-Cn5F4qEM.js @@ -0,0 +1 @@ +import{a as e,j as t,m as s,i as a}from"./vendor-react-DCIF8YoJ.js";import"./recharts-DVj1EL-m.js";import{c as n,r as l,b0 as i,v as r,b1 as o,b2 as c,f as d,aL as x,b3 as u,aY as m,T as p,b4 as h,b5 as b,A as g,m as f,X as y,R as j,C as v}from"./index-BGs2yNOg.js";import{D as N,E as w,M as k,a as C}from"./DeepAnalysisModal-Dhmx8Gh2.js";import{L}from"./loader-circle-CwUrmZrV.js";import{S,E as M,T as E}from"./target-De7OqeGi.js";import{F as B}from"./funnel-DZRnHLZd.js";import{G as H}from"./git-branch-Sfdze11O.js";import{C as R,Z as P}from"./zap-CQ3I2hAj.js";import{H as D}from"./house-CCeK_0TO.js";import{N as F}from"./network-DpalqfB8.js";import{A as I}from"./arrow-right-C9AHsGJs.js";import"./deckgl-DTsmDcfs.js";import"./vendor-core-Dl9MTgSr.js";import"./check-qb29v-su.js";const G=n("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),T=n("focus",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}]]),z=n("move",[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"m15 19-3 3-3-3",key:"11eu04"}],["path",{d:"m19 9 3 3-3 3",key:"1mg7y2"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"m5 9-3 3 3 3",key:"j64kie"}],["path",{d:"m9 5 3-3 3 3",key:"l8vdw6"}]]),Z=n("repeat",[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]]),$={type:"spring",stiffness:500,damping:35},A=Math.PI/180;function O(e,t){if(e<=0)return 0;const s=t-e;if(s>1209600)return 0;if(s<0)return 1;const a=s/3600;return Math.exp(-a/12)}function W(e,t){const s=Math.max(.2,Math.min(1,t)),a=e.replace("#",""),n=parseInt(a.substring(0,2),16),l=parseInt(a.substring(2,4),16),i=parseInt(a.substring(4,6),16),r=e=>Math.round(e*s+128*(1-s));return`#${r(n).toString(16).padStart(2,"0")}${r(l).toString(16).padStart(2,"0")}${r(i).toString(16).padStart(2,"0")}`}const V={simulationRepulsion:1.5,simulationLinkDistance:100,simulationGravity:.003,simulationCenter:.015,simulationFriction:.85},_={local:"#FBBF24",hub:"#6366F1",gateway:"#8B5CF6",backbone:"#10B981",neighbor:"#F59E0B",mobile:"#F97316",ghost:"#6B7280",standard:"#64748B"},q={local:"Local Node",hub:"Hub (≥10% traffic)",gateway:"Gateway (7-10%)",backbone:"Backbone",neighbor:"Direct RF Neighbor",mobile:"Mobile/Volatile",ghost:"Discovered (unconfirmed)",standard:"Standard Node"},K={local:D,hub:P,gateway:H,backbone:H,neighbor:j,mobile:z,ghost:R,standard:G},Q="#FBBF24",Y="#8B5CF6",X="#10B981",J="#F59E0B",U=["#440154","#482878","#3E4A89","#31688E","#26828E","#1F9E89","#35B779","#6DCD59","#B4DE2C","#FDE725"];function ee(e,t,s,a,n={x:0,y:0}){const l=e*A,i=s*A,r=(t-a)*A,o=(e-s)*A,c=637100;return n.x=r*Math.cos(.5*(l+i))*c,n.y=o*c,n}function te(e,t){if(t<=0||e<=0)return U[0];const s=Math.log10(e+1),a=Math.log10(t+1),n=Math.min(1,s/a),l=Math.min(U.length-1,Math.floor(n*U.length));return U[l]}const se=["local","hub","gateway","backbone","neighbor","mobile","ghost","standard"];function ae({nodeCount:s,edgeCount:a,nodeClassCounts:n,hasZeroHopEdges:l,hasLoopEdges:i,hasDirectPathEdges:r}){const[o,c]=e.useState(!0),[d,x]=e.useState(!0);return t.jsxs("div",{className:"absolute bottom-4 left-4 z-10 bg-bg-elevated/95 backdrop-blur-sm rounded-lg border border-border-subtle shadow-lg min-w-[200px] max-w-[240px] type-data-xs",children:[t.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border-subtle",children:[t.jsx("span",{className:"font-medium text-text-primary",children:"Mesh Topology"}),t.jsxs("span",{className:"text-text-muted tabular-nums",children:[s,"n / ",a,"e"]})]}),t.jsxs("div",{className:"border-b border-border-subtle",children:[t.jsxs("button",{type:"button",onClick:()=>c(!o),className:"w-full flex items-center justify-between px-3 py-1.5 hover:bg-subtle-fill/50 transition-colors",children:[t.jsx("span",{className:"text-text-secondary",children:"Node Types"}),t.jsx(f.span,{animate:{rotate:o?0:-90},transition:{duration:.15},children:t.jsx(v,{className:"w-3 h-3 text-text-muted"})})]}),t.jsx(g,{initial:!1,children:o&&t.jsx(f.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:$,className:"overflow-hidden",children:t.jsx("div",{className:"px-3 pb-2 space-y-1",children:se.map(e=>{const s=n[e];if(0===s)return null;const a=K[e];return t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"shrink-0 rounded-full",style:{width:8,height:8,backgroundColor:_[e]}}),t.jsx(a,{className:"w-3 h-3 text-text-muted shrink-0"}),t.jsx("span",{className:"text-text-secondary flex-1 truncate",children:q[e]}),t.jsx("span",{className:"text-text-muted tabular-nums",children:s})]},e)})})})})]}),t.jsxs("div",{children:[t.jsxs("button",{type:"button",onClick:()=>x(!d),className:"w-full flex items-center justify-between px-3 py-1.5 hover:bg-subtle-fill/50 transition-colors",children:[t.jsx("span",{className:"text-text-secondary",children:"Edge Types"}),t.jsx(f.span,{animate:{rotate:d?0:-90},transition:{duration:.15},children:t.jsx(v,{className:"w-3 h-3 text-text-muted"})})]}),t.jsx(g,{initial:!1,children:d&&t.jsx(f.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:$,className:"overflow-hidden",children:t.jsxs("div",{className:"px-3 pb-2 space-y-1",children:[l&&t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"w-4 h-0.5 rounded-full",style:{backgroundColor:Q}}),t.jsx(j,{className:"w-3 h-3 text-text-muted"}),t.jsx("span",{className:"text-text-secondary",children:"Direct RF (zero-hop)"})]}),i&&t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"w-4 h-0.5 rounded-full",style:{backgroundColor:Y}}),t.jsx(Z,{className:"w-3 h-3 text-text-muted"}),t.jsx("span",{className:"text-text-secondary",children:"Loop (redundant path)"})]}),r&&t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"w-4 h-0.5 rounded-full",style:{backgroundColor:X}}),t.jsx(I,{className:"w-3 h-3 text-text-muted"}),t.jsx("span",{className:"text-text-secondary",children:"Confirmed unicast"})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"w-4 h-0.5 rounded-full",style:{backgroundColor:"#64748B"}}),t.jsx(H,{className:"w-3 h-3 text-text-muted"}),t.jsx("span",{className:"text-text-secondary",children:"Standard edge"})]}),t.jsxs("div",{className:"pt-1 mt-1 border-t border-border-subtle/50",children:[t.jsx("div",{className:"text-text-muted text-[10px] mb-1",children:"Edge thickness = certainty"}),t.jsx("div",{className:"h-2 rounded-sm",style:{background:`linear-gradient(to right, ${U.slice(0,5).join(", ")}, ${J})`}}),t.jsxs("div",{className:"flex justify-between text-[10px] text-text-muted",children:[t.jsx("span",{children:"Low"}),t.jsx("span",{children:"High"})]})]})]})})})]})]})}function ne({node:e,onClose:s,onZoomTo:a}){const n=K[e.nodeClass],l={active:{label:"Active",color:"text-accent-success"},recent:{label:"Recent",color:"text-accent-secondary"},stale:{label:"Stale",color:"text-signal-poor"},inactive:{label:"Inactive",color:"text-text-muted"}}[e.activityLevel]??{label:e.activityLevel,color:"text-text-muted"};return t.jsxs(f.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:20},transition:{duration:.15},className:"absolute top-4 right-4 z-20 bg-bg-elevated/95 backdrop-blur-sm rounded-xl border border-border-subtle shadow-2xl w-72",children:[t.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border-subtle",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"shrink-0 rounded-full ring-2 ring-offset-1 ring-offset-bg-elevated",style:{width:10,height:10,backgroundColor:_[e.nodeClass],boxShadow:`0 0 8px ${_[e.nodeClass]}40`}}),t.jsx(n,{className:"w-3.5 h-3.5 text-text-muted"}),t.jsx("span",{className:"font-medium text-text-primary type-data-sm",children:e.prefix})]}),t.jsxs("div",{className:"flex items-center gap-1",children:[e.isLocal&&t.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-yellow-500/20 text-yellow-300",children:"LOCAL"}),a&&t.jsx(p,{content:"Zoom to node",children:t.jsx("button",{onClick:a,className:"p-1 rounded hover:bg-subtle-fill transition-colors",children:t.jsx(E,{className:"w-3.5 h-3.5 text-text-muted"})})}),t.jsx("button",{onClick:s,className:"p-1 rounded hover:bg-subtle-fill transition-colors",children:t.jsx(y,{className:"w-3.5 h-3.5 text-text-muted"})})]})]}),t.jsxs("div",{className:"px-3 py-2 space-y-1.5 type-data-xs",children:[e.name&&t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-text-muted",children:"Name"}),t.jsx("span",{className:"text-text-primary font-medium truncate ml-2",children:e.name})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-text-muted",children:"Role"}),t.jsx("span",{className:"text-text-secondary capitalize",children:q[e.nodeClass]})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-text-muted",children:"Activity"}),t.jsx("span",{className:l.color,children:l.label})]})]}),t.jsxs("div",{className:"px-3 py-2 space-y-1.5 type-data-xs border-t border-border-subtle",children:[t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-text-muted",children:"Packets"}),t.jsx("span",{className:"text-text-secondary tabular-nums",children:e.packetCount.toLocaleString()})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-text-muted",children:"Connections"}),t.jsx("span",{className:"text-text-secondary tabular-nums",children:e.degree})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-text-muted",children:"Betweenness"}),t.jsxs("span",{className:"text-text-secondary tabular-nums",children:[(100*e.betweenness).toFixed(1),"%"]})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-text-muted",children:"Community"}),t.jsxs("span",{className:"text-text-secondary tabular-nums",children:["#",e.communityId]})]})]}),e.isZeroHop&&(null!==e.avgRssi||null!==e.avgSnr)&&t.jsxs("div",{className:"px-3 py-2 space-y-1.5 type-data-xs border-t border-border-subtle",children:[t.jsx("div",{className:"text-text-muted text-[10px] uppercase tracking-wide",children:"Signal Quality"}),null!==e.avgRssi&&t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-text-muted",children:"RSSI"}),t.jsxs("span",{className:"text-text-secondary tabular-nums",children:[e.avgRssi.toFixed(0)," dBm"]})]}),null!==e.avgSnr&&t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-text-muted",children:"SNR"}),t.jsxs("span",{className:"text-text-secondary tabular-nums",children:[e.avgSnr.toFixed(1)," dB"]})]})]}),(e.isHub||e.isGateway||e.isBackbone||e.isMobile||e.isInLoop)&&t.jsx("div",{className:"px-3 py-2 border-t border-border-subtle",children:t.jsxs("div",{className:"flex flex-wrap gap-1",children:[e.isHub&&t.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-indigo-500/20 text-indigo-300",children:"Hub"}),e.isGateway&&t.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-violet-500/20 text-violet-300",children:"Gateway"}),e.isBackbone&&t.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-emerald-500/20 text-emerald-300",children:"Backbone"}),e.isMobile&&t.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-orange-500/20 text-orange-300",children:"Mobile"}),e.isInLoop&&t.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-purple-500/20 text-purple-300",children:"In Loop"})]})}),e.hasCollision&&t.jsx("div",{className:"px-3 py-2 border-t border-border-subtle",children:t.jsxs("div",{className:"flex justify-between type-data-xs",children:[t.jsx("span",{className:"text-signal-poor",children:"Prefix collision"}),t.jsxs("span",{className:"text-text-muted tabular-nums",children:[(100*e.prefixConfidence).toFixed(0),"% conf"]})]})}),t.jsxs("div",{className:"px-3 py-2 border-t border-border-subtle space-y-1.5",children:[t.jsxs("div",{className:"flex justify-between type-data-xs",children:[t.jsx("span",{className:"text-text-muted",children:"Position"}),t.jsx("span",{className:e.hasGeo?"text-accent-success":"text-text-muted",children:e.hasGeo?"GPS":"Simulated"})]}),t.jsx("div",{children:t.jsx("span",{className:"text-text-muted break-all text-[10px] leading-relaxed font-mono",children:e.hash})})]})]})}function le(){return t.jsxs("div",{className:"flex flex-col items-center justify-center gap-4 text-center px-8",children:[t.jsx("div",{className:"p-4 rounded-full bg-subtle-fill",children:t.jsx(F,{className:"w-8 h-8 text-text-muted"})}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("h2",{className:"text-lg font-medium text-text-primary",children:"No Topology Data"}),t.jsx("p",{className:"text-sm text-text-muted max-w-sm",children:"The mesh topology will appear here once packets are received and processed. This typically takes a few minutes after starting."})]}),t.jsxs("div",{className:"flex items-center gap-2 text-xs text-text-muted mt-2",children:[t.jsx(j,{className:"w-4 h-4 animate-pulse"}),t.jsx("span",{children:"Waiting for mesh traffic..."})]})]})}function ie(){var n;const j=l(),[v,R]=e.useState(!1),P=i(),D=r(),[F,I]=e.useState(!1),[G,z]=e.useState("fetching"),[Z,$]=e.useState(0),A=e.useRef(!1);e.useEffect(()=>{j&&!A.current&&(A.current=!0,(async()=>{I(!0),z("fetching"),$(0),await P(),z("analyzing"),await new Promise(e=>setTimeout(e,200)),z("building");const e=Date.now(),t=Date.now()-e;t<600&&await new Promise(e=>setTimeout(e,600-t)),z("discovering"),await new Promise(e=>setTimeout(e,400)),z("complete"),await new Promise(e=>setTimeout(e,800)),I(!1),R(!0)})())},[j,P]),e.useEffect(()=>{"fetching"===G&&(D.loadProgress?$(D.loadProgress.loaded):D.packetCount>0&&$(D.packetCount))},[G,D.loadProgress,D.packetCount]);const q=o(),U=c(),se=d(),ie=x(),[re,oe]=e.useState(!0),[ce,de]=e.useState(null),[xe,ue]=e.useState("all"),[me,pe]=e.useState(!0),[he,be]=e.useState(!0),[ge,fe]=e.useState(""),[ye,je]=e.useState(!1),ve=e.useRef(null),[Ne,we]=e.useState(null),[ke,Ce]=e.useState({x:0,y:0}),Le=e.useRef(null),[Se,Me]=e.useState(!1),Ee=u();e.useEffect(()=>{const e=e=>{var t;if(!(e.target instanceof HTMLInputElement))switch(e.key.toLowerCase()){case"f":e.metaKey||e.ctrlKey||(e.preventDefault(),null==(t=Ke.current)||t.fitView(300));break;case"escape":ye?(je(!1),fe("")):ce&&de(null);break;case"/":ye||(e.preventDefault(),je(!0),setTimeout(()=>{var e;return null==(e=ve.current)?void 0:e.focus()},50));break;case" ":e.preventDefault();{const e=Ke.current;e&&(re?e.pause():e.start(),oe(e=>!e))}break;case"l":pe(e=>!e);break;case"e":be(e=>!e)}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[ye,ce,re]);const Be=(null==ie?void 0:ie.latitude)??0,He=(null==ie?void 0:ie.longitude)??0,Re=null!==ie,Pe=e.useMemo(()=>Math.floor(Date.now()/1e3),[]),De=e.useMemo(()=>{var e;if(!U||0===U.size||!v)return[];const t=[],s=(null==se?void 0:se.node_name)??(null==(e=null==se?void 0:se.config)?void 0:e.node_name)??null,a={x:0,y:0};for(const n of U.values()){const e=n.isLocal?1:O(n.lastSeen,Pe);if(0===e&&!n.isLocal)continue;const l=_[n.nodeClass],i=n.isLocal?l:W(l,e),r=6+22*n.betweenness,o=n.isLocal?r:r*(.5+.5*e),c=n.isLocal?s??n.name:n.name;let d,x,u=!1;Re&&(n.isLocal?(d=0,x=0,u=!0):n.latitude&&n.longitude&&(ee(n.latitude,n.longitude,Be,He,a),d=a.x,x=a.y,u=!0)),t.push({id:n.hash,label:c?`${n.prefix} ${c}`:n.prefix,color:i,size:o,x:d,y:x,recencyWeight:e,nodeClass:n.nodeClass,name:c,prefix:n.prefix,packetCount:n.packetCount,betweenness:n.betweenness,communityId:n.communityId,isLocal:n.isLocal,isHub:n.isHub,isGateway:n.isGateway,isBackbone:n.isBackbone,isMobile:n.isMobile,isGhost:n.isGhost,isInLoop:n.isInLoop,isZeroHop:n.isZeroHop,hasGeo:u,avgRssi:n.avgRssi,avgSnr:n.avgSnr,degree:n.degree,activityLevel:n.activityLevel,prefixConfidence:n.prefixConfidence,hasCollision:n.hasCollision,lastSeen:n.lastSeen})}return t},[U,v,Re,Be,He,null==se?void 0:se.node_name,null==(n=null==se?void 0:se.config)?void 0:n.node_name,Pe]),Fe=e.useMemo(()=>{const e=new Set;for(const t of De)e.add(t.id);return e},[De]),{rawLinks:Ie,hasZeroHopEdges:Ge,hasLoopEdges:Te,hasDirectPathEdges:ze}=e.useMemo(()=>{const e=null==q?void 0:q.validatedEdges;if(!e||0===e.length||!v)return{rawLinks:[],maxCertainCount:0,hasZeroHopEdges:!1,hasLoopEdges:!1,hasDirectPathEdges:!1};let t=0,s=!1,a=!1,n=!1;for(const o of e)o.avgRecency<.02||Fe.has(o.fromHash)&&Fe.has(o.toHash)&&(o.certainCount>t&&(t=o.certainCount),s=s||!0===o.isZeroHop,a=a||!0===o.isLoopEdge,n=n||!0===o.isDirectPathEdge);const l=t>0?Math.log10(t+1):1,i=.8*t,r=[];for(const o of e){const e=o.avgRecency;if(e<.02)continue;if(!Fe.has(o.fromHash)||!Fe.has(o.toHash))continue;let s=.5;if(t>0&&o.certainCount>0){const e=Math.log10(o.certainCount+1);s=.5+7.5*Math.min(1,e/l)}const a=s*(.3+.7*e);let n;n=o.isZeroHop?Q:o.isLoopEdge?Y:o.isDirectPathEdge?X:o.certainCount>i?J:te(o.certainCount,t);const c=W(n,e);r.push({source:o.fromHash,target:o.toHash,color:c,width:a,strength:.3+.7*o.strength,recencyWeight:e,packetCount:o.packetCount,certainCount:o.certainCount,isZeroHop:o.isZeroHop??!1,isLoopEdge:o.isLoopEdge??!1,isDirectPath:o.isDirectPathEdge,avgConfidence:o.avgConfidence})}return{rawLinks:r,maxCertainCount:t,hasZeroHopEdges:s,hasLoopEdges:a,hasDirectPathEdges:n}},[null==q?void 0:q.validatedEdges,v,Fe]),Ze=e.useMemo(()=>{const e=new Map;for(const t of Ie)e.set(t.source,(e.get(t.source)??0)+1),e.set(t.target,(e.get(t.target)??0)+1);return e},[Ie]),$e=e.useMemo(()=>{const e=new Map;for(const t of De)e.set(t.id,t);return e},[De]),[Ae,Oe]=e.useState(null),[We,Ve]=e.useState(null),[_e,qe]=e.useState({}),Ke=e.useRef(null),Qe=e.useRef(!1),Ye=e.useRef(null);e.useEffect(()=>{var e,t;if(0===De.length||0===Ie.length)return Oe(null),Ve(null),void(Ye.current=null);const s=`${De.length}:${Ie.length}:${null==(e=De[0])?void 0:e.id}:${null==(t=De[De.length-1])?void 0:t.id}`;if(s===Ye.current||Qe.current)return;let n=!1;return Qe.current=!0,(async()=>{try{const e=De.map(e=>({id:e.id,label:e.label,color:e.color})),t=Ie.map(e=>({source:e.source,target:e.target,color:e.color,width:e.width})),l=new Set(t.map(e=>e.width)),i={points:{pointIdBy:"id",pointColorBy:"color",pointLabelBy:"label",pointDefaultColor:"#64748B",pointGreyoutOpacity:.3,pointDefaultSize:12,pointSizeScale:1},links:{linkSourceBy:"source",linkTargetsBy:["target"],linkColorBy:"color",...t.length>=2&&l.size>=2?{linkWidthBy:"width",linkWidthRange:[.5,8]}:{},linkDefaultWidth:1,linkDefaultColor:"#4B5563",linkGreyoutOpacity:.2,linkWidthScale:1}},r=await a(i,e,t);if(n||!r)return;const{points:o,links:c,cosmographConfig:d}=r;Oe(o??null),Ve(c??null),qe({...d,...V}),Ye.current=s}finally{Qe.current=!1}})(),()=>{n=!0}},[De,Ie]);const Xe=e.useCallback(e=>{Ke.current=e},[]),Je=e.useCallback(()=>{var e;null==(e=Ke.current)||e.fitView(300)},[]),Ue=e.useCallback(()=>{const e=Ke.current;e&&(re?e.pause():e.start(),oe(!re))},[re]),et=e.useCallback(async e=>{const t=Ke.current;if(t)try{const s=await t.getPointIndicesByIds([e]);s&&s.length>0&&void 0!==s[0]&&t.zoomToPoint(s[0],400,2.5)}catch{}},[]),tt=e.useMemo(()=>{if(!ge.trim())return[];const e=ge.toLowerCase();return De.filter(t=>{var s;return t.prefix.toLowerCase().includes(e)||(null==(s=t.name)?void 0:s.toLowerCase().includes(e))||t.id.toLowerCase().includes(e)}).slice(0,8)},[De,ge]),st=e.useCallback(e=>{et(e.id),je(!1),fe(""),de({hash:e.id,name:e.name,prefix:e.prefix,nodeClass:e.nodeClass,packetCount:e.packetCount,edgeCount:Ze.get(e.id)??0,betweenness:e.betweenness,communityId:e.communityId,degree:e.degree,hasGeo:e.hasGeo,isLocal:e.isLocal,isHub:e.isHub,isGateway:e.isGateway,isBackbone:e.isBackbone,isMobile:e.isMobile,isInLoop:e.isInLoop,isZeroHop:e.isZeroHop,avgRssi:e.avgRssi,avgSnr:e.avgSnr,activityLevel:e.activityLevel,prefixConfidence:e.prefixConfidence,hasCollision:e.hasCollision})},[et,Ze]),at=e.useRef(void 0),nt=e.useRef(0),lt=e.useCallback(async(e,t,s)=>{const a=Date.now();if(s&&a-nt.current>=16&&(nt.current=a,Ce({x:s.clientX,y:s.clientY})),e===at.current)return;at.current=e,Le.current&&(clearTimeout(Le.current),Le.current=null);const n=Ke.current;if(n)if(void 0!==e)try{const t=await n.getPointIdsByIndices([e]);if(!t||0===t.length)return;const s=t[0],a=$e.get(s);if(!a)return;we(a),n.selectPoint(e,!1,!0)}catch{we(null)}else Le.current=setTimeout(()=>{we(null),ce||n.unselectAllPoints()},100)},[$e,ce]),it=e.useCallback(()=>{Me(e=>!e)},[]),rt=e.useCallback(()=>{ue(e=>{const t=["all","hubs","neighbors","active"],s=t.indexOf(e);return t[(s+1)%t.length]})},[]),ot={all:"All nodes",hubs:"Hubs & gateways only",neighbors:"Direct RF neighbors",active:"Recently active"},ct=e.useCallback(async(e,t,s)=>{var a;if(we(null),at.current=void 0,void 0===e)return de(null),void(null==(a=Ke.current)||a.unselectAllPoints());const n=Ke.current;if(n)try{const t=await n.getPointIdsByIndices([e]);if(!t||0===t.length)return;const s=t[0],a=$e.get(s);if(!a)return;n.selectPoint(e,!1),de({hash:s,name:a.name,prefix:a.prefix,nodeClass:a.nodeClass,packetCount:a.packetCount,edgeCount:Ze.get(s)??0,betweenness:a.betweenness,communityId:a.communityId,degree:a.degree,hasGeo:a.hasGeo,isLocal:a.isLocal,isHub:a.isHub,isGateway:a.isGateway,isBackbone:a.isBackbone,isMobile:a.isMobile,isInLoop:a.isInLoop,isZeroHop:a.isZeroHop,avgRssi:a.avgRssi,avgSnr:a.avgSnr,activityLevel:a.activityLevel,prefixConfidence:a.prefixConfidence,hasCollision:a.hasCollision})}catch{}},[$e,Ze]);if(!v)return t.jsxs("div",{className:"-mx-4 sm:-mx-6 lg:-mx-8 -mt-5 -mb-4 sm:-mb-6 lg:-mb-8 h-[calc(100vh-64px)] flex items-center justify-center bg-black",children:[t.jsx(N,{isOpen:F,currentStep:G,packetCount:Z}),!F&&t.jsx(L,{className:"w-8 h-8 text-accent-primary animate-spin"})]});if(0===De.length)return t.jsxs("div",{className:"-mx-4 sm:-mx-6 lg:-mx-8 -mt-5 -mb-4 sm:-mb-6 lg:-mb-8 h-[calc(100vh-64px)] flex flex-col bg-black overflow-hidden",children:[t.jsx("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border-subtle bg-bg-elevated/50",children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(m,{className:"w-5 h-5 text-accent-primary"}),t.jsxs("h1",{className:"type-data-sm font-semibold text-text-primary flex items-center gap-2",children:["MeshGraph",t.jsx("span",{className:"px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wider bg-accent-primary/20 text-accent-primary rounded",children:"Beta"})]})]})}),t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(le,{})})]});if(!Ae)return t.jsx("div",{className:"-mx-4 sm:-mx-6 lg:-mx-8 -mt-5 -mb-4 sm:-mb-6 lg:-mb-8 h-[calc(100vh-64px)] flex items-center justify-center bg-black",children:t.jsxs("div",{className:"flex flex-col items-center gap-3",children:[t.jsx(L,{className:"w-8 h-8 text-accent-primary animate-spin"}),t.jsx("span",{className:"text-sm text-text-muted",children:"Preparing graph..."})]})});const dt=Se?"fixed inset-0 z-50 bg-black":"-mx-4 sm:-mx-6 lg:-mx-8 -mt-5 -mb-4 sm:-mb-6 lg:-mb-8 h-[calc(100vh-64px)] bg-black";return t.jsxs("div",{className:`${dt} flex flex-col overflow-hidden`,children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border-subtle/50 bg-black/80 backdrop-blur-sm z-10",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(m,{className:"w-5 h-5 text-accent-primary"}),t.jsxs("h1",{className:"type-data-sm font-semibold text-text-primary flex items-center gap-2",children:["MeshGraph",t.jsx("span",{className:"px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wider bg-accent-primary/20 text-accent-primary rounded",children:"Beta"})]}),t.jsxs("span",{className:"type-data-xs text-text-muted tabular-nums",children:[De.length," nodes • ",Ie.length," edges"]}),"all"!==xe&&t.jsx("span",{className:"text-[10px] px-2 py-0.5 rounded-full bg-accent-primary/20 text-accent-primary",children:ot[xe]})]}),t.jsxs("div",{className:"flex items-center gap-0.5",children:[t.jsx(p,{content:"Search nodes (/)",children:t.jsx("button",{onClick:()=>{je(!0),setTimeout(()=>{var e;return null==(e=ve.current)?void 0:e.focus()},50)},className:"p-2 rounded-lg transition-colors "+(ye?"bg-accent-primary/20 text-accent-primary":"hover:bg-subtle-fill text-text-muted"),children:t.jsx(S,{className:"w-4 h-4"})})}),t.jsx(p,{content:`Filter: ${ot[xe]}`,children:t.jsx("button",{onClick:rt,className:"p-2 rounded-lg transition-colors "+("all"!==xe?"bg-accent-primary/20 text-accent-primary":"hover:bg-subtle-fill text-text-muted"),children:t.jsx(B,{className:"w-4 h-4"})})}),t.jsx("div",{className:"w-px h-4 bg-border-subtle mx-1"}),t.jsx(p,{content:(me?"Hide":"Show")+" labels (L)",children:t.jsx("button",{onClick:()=>pe(e=>!e),className:"p-2 rounded-lg transition-colors "+(me?"text-text-muted hover:bg-subtle-fill":"text-text-muted/50 hover:bg-subtle-fill"),children:me?t.jsx(M,{className:"w-4 h-4"}):t.jsx(w,{className:"w-4 h-4"})})}),t.jsx(p,{content:(he?"Hide":"Show")+" edges (E)",children:t.jsx("button",{onClick:()=>be(e=>!e),className:"p-2 rounded-lg transition-colors "+(he?"text-text-muted hover:bg-subtle-fill":"text-text-muted/50 hover:bg-subtle-fill"),children:t.jsx(H,{className:"w-4 h-4"})})}),t.jsx("div",{className:"w-px h-4 bg-border-subtle mx-1"}),t.jsx(p,{content:(re?"Pause":"Resume")+" simulation (Space)",children:t.jsx("button",{onClick:Ue,className:"p-2 rounded-lg hover:bg-subtle-fill transition-colors",children:re?t.jsx(h,{className:"w-4 h-4 text-accent-success"}):t.jsx(b,{className:"w-4 h-4 text-text-muted"})})}),t.jsx(p,{content:"Fit view (F)",children:t.jsx("button",{onClick:Je,className:"p-2 rounded-lg hover:bg-subtle-fill transition-colors",children:t.jsx(T,{className:"w-4 h-4 text-text-muted"})})}),t.jsx(p,{content:Se?"Exit fullscreen":"Fullscreen",children:t.jsx("button",{onClick:it,className:"p-2 rounded-lg hover:bg-subtle-fill transition-colors",children:Se?t.jsx(k,{className:"w-4 h-4 text-text-muted"}):t.jsx(C,{className:"w-4 h-4 text-text-muted"})})})]})]}),t.jsxs("div",{className:"flex-1 relative min-h-0",children:[t.jsx(s,{className:"absolute inset-0",points:Ae,links:he?We:void 0,..._e,backgroundColor:"#000000",fitViewOnInit:!0,showLabels:me,showDynamicLabels:me,showTopLabels:me,showTopLabelsLimit:30,showHoveredPointLabel:!1,pointLabelColor:"#E2E8F0",pointLabelFontSize:11,onClick:ct,onMouseMove:lt,onMount:Xe,renderHoveredPointRing:!0,hoveredPointRingColor:"#FBBF24",hoveredPointCursor:"pointer",pointGreyoutOpacity:.15,linkGreyoutOpacity:.1}),t.jsx(g,{children:Ne&&t.jsx(f.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},transition:{duration:.1},className:"fixed z-50 pointer-events-none",style:{left:ke.x+16,top:ke.y-8},children:t.jsxs("div",{className:"bg-bg-elevated/95 backdrop-blur-md rounded-lg border border-border-subtle shadow-2xl px-3 py-2 max-w-xs",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[t.jsx("span",{className:"w-2.5 h-2.5 rounded-full shrink-0 ring-1 ring-white/20",style:{backgroundColor:_[Ne.nodeClass],boxShadow:`0 0 6px ${_[Ne.nodeClass]}60`}}),t.jsx("span",{className:"font-medium text-text-primary text-sm truncate",children:Ne.name||Ne.prefix}),Ne.isLocal&&t.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded bg-yellow-500/20 text-yellow-300 shrink-0",children:"LOCAL"})]}),t.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-text-muted",children:[t.jsx("span",{className:"capitalize",children:Ne.nodeClass}),t.jsx("span",{children:"•"}),t.jsxs("span",{children:[Ne.packetCount.toLocaleString()," pkts"]}),t.jsx("span",{children:"•"}),t.jsxs("span",{children:[Ne.degree," conn"]})]}),Ne.isZeroHop&&(null!==Ne.avgSnr||null!==Ne.avgRssi)&&t.jsxs("div",{className:"flex items-center gap-2 mt-1 pt-1 border-t border-border-subtle/50 text-[10px]",children:[null!==Ne.avgSnr&&t.jsxs("span",{className:"text-accent-success",children:["SNR: ",Ne.avgSnr.toFixed(1)," dB"]}),null!==Ne.avgRssi&&t.jsxs("span",{className:"text-text-muted",children:["RSSI: ",Ne.avgRssi.toFixed(0)," dBm"]})]}),(Ne.isHub||Ne.isGateway||Ne.isBackbone||Ne.isMobile)&&t.jsxs("div",{className:"flex items-center gap-1 mt-1 pt-1 border-t border-border-subtle/50",children:[Ne.isHub&&t.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded bg-indigo-500/20 text-indigo-300",children:"Hub"}),Ne.isGateway&&t.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded bg-violet-500/20 text-violet-300",children:"Gateway"}),Ne.isBackbone&&t.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded bg-emerald-500/20 text-emerald-300",children:"Backbone"}),Ne.isMobile&&t.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded bg-orange-500/20 text-orange-300",children:"Mobile"})]}),t.jsx("div",{className:"text-[9px] text-text-muted/60 mt-1",children:"Click for details"})]})})}),t.jsx(g,{children:ye&&t.jsx(f.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.15},className:"absolute top-4 left-1/2 -translate-x-1/2 z-30 w-80",children:t.jsxs("div",{className:"bg-bg-elevated/95 backdrop-blur-sm rounded-xl border border-border-subtle shadow-2xl overflow-hidden",children:[t.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-border-subtle",children:[t.jsx(S,{className:"w-4 h-4 text-text-muted shrink-0"}),t.jsx("input",{ref:ve,type:"text",value:ge,onChange:e=>fe(e.target.value),placeholder:"Search by name or prefix...",className:"flex-1 bg-transparent text-sm text-text-primary placeholder:text-text-muted focus:outline-none",onKeyDown:e=>{"Escape"===e.key?(je(!1),fe("")):"Enter"===e.key&&tt.length>0&&st(tt[0])}}),ge&&t.jsx("button",{onClick:()=>fe(""),className:"p-0.5 rounded hover:bg-subtle-fill",children:t.jsx(y,{className:"w-3 h-3 text-text-muted"})})]}),tt.length>0&&t.jsx("div",{className:"max-h-64 overflow-y-auto",children:tt.map((e,s)=>{const a=K[e.nodeClass];return t.jsxs("button",{onClick:()=>st(e),className:"w-full flex items-center gap-3 px-3 py-2 text-left hover:bg-subtle-fill transition-colors "+(0===s?"bg-subtle-fill/50":""),children:[t.jsx("span",{className:"w-2.5 h-2.5 rounded-full shrink-0",style:{backgroundColor:_[e.nodeClass]}}),t.jsx(a,{className:"w-3.5 h-3.5 text-text-muted shrink-0"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"text-sm text-text-primary truncate",children:e.name||e.prefix}),e.name&&t.jsx("div",{className:"text-[10px] text-text-muted",children:e.prefix})]}),t.jsx(E,{className:"w-3 h-3 text-text-muted shrink-0"})]},e.id)})}),ge&&0===tt.length&&t.jsx("div",{className:"px-3 py-4 text-center text-sm text-text-muted",children:"No nodes found"}),!ge&&t.jsx("div",{className:"px-3 py-2 text-[10px] text-text-muted",children:"Type to search • Enter to select • Esc to close"})]})})}),t.jsx(ae,{nodeCount:De.length,edgeCount:Ie.length,nodeClassCounts:Ee,hasZeroHopEdges:Ge,hasLoopEdges:Te,hasDirectPathEdges:ze}),t.jsxs("div",{className:"absolute bottom-4 right-4 z-10 hidden lg:flex items-center gap-3 text-[10px] text-text-muted/60",children:[t.jsxs("span",{children:[t.jsx("kbd",{className:"px-1 py-0.5 rounded bg-subtle-fill/50 font-mono",children:"/"})," Search"]}),t.jsxs("span",{children:[t.jsx("kbd",{className:"px-1 py-0.5 rounded bg-subtle-fill/50 font-mono",children:"F"})," Fit"]}),t.jsxs("span",{children:[t.jsx("kbd",{className:"px-1 py-0.5 rounded bg-subtle-fill/50 font-mono",children:"Space"})," Pause"]}),t.jsxs("span",{children:[t.jsx("kbd",{className:"px-1 py-0.5 rounded bg-subtle-fill/50 font-mono",children:"Esc"})," Clear"]})]}),t.jsx(g,{children:ce&&t.jsx(ne,{node:ce,onClose:()=>de(null),onZoomTo:()=>et(ce.hash)})})]})]})}export{ie as default}; diff --git a/frontend/dist/assets/MeshGraph-DfCwG9Nt.js b/frontend/dist/assets/MeshGraph-DfCwG9Nt.js deleted file mode 100644 index 520a1f1f..00000000 --- a/frontend/dist/assets/MeshGraph-DfCwG9Nt.js +++ /dev/null @@ -1 +0,0 @@ -import{r as e,j as t,aq as s,W as a,aQ as n,al as l,aK as i,bo as r,aJ as o,w as c,v as d,bp as x,bq as u,br as m,bs as p,A as h,m as b,X as g,bt as f,as as j,bu as y,E as v,a9 as N,ab as w,aY as C,bv as k,aX as S,C as L,bw as E,a1 as B}from"./vendor-react-C341c8YC.js";import"./recharts-6XUQYgRA.js";import{p as M,ak as H,r as R,al as P,am as D,e as F,a5 as I,an as G,T}from"./index-BJEgt3tp.js";import{D as Z}from"./DeepAnalysisModal-D4eqwCNZ.js";import"./vendor-core-WoOfkQwm.js";import"./deckgl-DTsmDcfs.js";const z={type:"spring",stiffness:500,damping:35},$=Math.PI/180;function A(e,t){if(e<=0)return 0;const s=t-e;if(s>1209600)return 0;if(s<0)return 1;const a=s/3600;return Math.exp(-a/12)}function O(e,t){const s=Math.max(.2,Math.min(1,t)),a=e.replace("#",""),n=parseInt(a.substring(0,2),16),l=parseInt(a.substring(2,4),16),i=parseInt(a.substring(4,6),16),r=e=>Math.round(e*s+128*(1-s));return`#${r(n).toString(16).padStart(2,"0")}${r(l).toString(16).padStart(2,"0")}${r(i).toString(16).padStart(2,"0")}`}const W={simulationRepulsion:1.5,simulationLinkDistance:100,simulationGravity:.003,simulationCenter:.015,simulationFriction:.85},K={local:"#FBBF24",hub:"#6366F1",gateway:"#8B5CF6",backbone:"#10B981",neighbor:"#F59E0B",mobile:"#F97316",ghost:"#6B7280",standard:"#64748B"},V={local:"Local Node",hub:"Hub (≥10% traffic)",gateway:"Gateway (7-10%)",backbone:"Backbone",neighbor:"Direct RF Neighbor",mobile:"Mobile/Volatile",ghost:"Discovered (unconfirmed)",standard:"Standard Node"},_={local:w,hub:N,gateway:o,backbone:o,neighbor:v,mobile:y,ghost:j,standard:f},q="#FBBF24",Q="#8B5CF6",X="#10B981",Y="#F59E0B",J=["#440154","#482878","#3E4A89","#31688E","#26828E","#1F9E89","#35B779","#6DCD59","#B4DE2C","#FDE725"];function U(e,t,s,a,n={x:0,y:0}){const l=e*$,i=s*$,r=(t-a)*$,o=(e-s)*$,c=637100;return n.x=r*Math.cos(.5*(l+i))*c,n.y=o*c,n}function ee(e,t){if(t<=0||e<=0)return J[0];const s=Math.log10(e+1),a=Math.log10(t+1),n=Math.min(1,s/a),l=Math.min(J.length-1,Math.floor(n*J.length));return J[l]}const te=["local","hub","gateway","backbone","neighbor","mobile","ghost","standard"];function se({nodeCount:s,edgeCount:a,nodeClassCounts:n,hasZeroHopEdges:l,hasLoopEdges:i,hasDirectPathEdges:r}){const[c,d]=e.useState(!0),[x,u]=e.useState(!0);return t.jsxs("div",{className:"absolute bottom-4 left-4 z-10 bg-bg-elevated/95 backdrop-blur-sm rounded-lg border border-border-subtle shadow-lg min-w-[200px] max-w-[240px] type-data-xs",children:[t.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border-subtle",children:[t.jsx("span",{className:"font-medium text-text-primary",children:"Mesh Topology"}),t.jsxs("span",{className:"text-text-muted tabular-nums",children:[s,"n / ",a,"e"]})]}),t.jsxs("div",{className:"border-b border-border-subtle",children:[t.jsxs("button",{type:"button",onClick:()=>d(!c),className:"w-full flex items-center justify-between px-3 py-1.5 hover:bg-subtle-fill/50 transition-colors",children:[t.jsx("span",{className:"text-text-secondary",children:"Node Types"}),t.jsx(b.span,{animate:{rotate:c?0:-90},transition:{duration:.15},children:t.jsx(L,{className:"w-3 h-3 text-text-muted"})})]}),t.jsx(h,{initial:!1,children:c&&t.jsx(b.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:z,className:"overflow-hidden",children:t.jsx("div",{className:"px-3 pb-2 space-y-1",children:te.map(e=>{const s=n[e];if(0===s)return null;const a=_[e];return t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"shrink-0 rounded-full",style:{width:8,height:8,backgroundColor:K[e]}}),t.jsx(a,{className:"w-3 h-3 text-text-muted shrink-0"}),t.jsx("span",{className:"text-text-secondary flex-1 truncate",children:V[e]}),t.jsx("span",{className:"text-text-muted tabular-nums",children:s})]},e)})})})})]}),t.jsxs("div",{children:[t.jsxs("button",{type:"button",onClick:()=>u(!x),className:"w-full flex items-center justify-between px-3 py-1.5 hover:bg-subtle-fill/50 transition-colors",children:[t.jsx("span",{className:"text-text-secondary",children:"Edge Types"}),t.jsx(b.span,{animate:{rotate:x?0:-90},transition:{duration:.15},children:t.jsx(L,{className:"w-3 h-3 text-text-muted"})})]}),t.jsx(h,{initial:!1,children:x&&t.jsx(b.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:z,className:"overflow-hidden",children:t.jsxs("div",{className:"px-3 pb-2 space-y-1",children:[l&&t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"w-4 h-0.5 rounded-full",style:{backgroundColor:q}}),t.jsx(v,{className:"w-3 h-3 text-text-muted"}),t.jsx("span",{className:"text-text-secondary",children:"Direct RF (zero-hop)"})]}),i&&t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"w-4 h-0.5 rounded-full",style:{backgroundColor:Q}}),t.jsx(E,{className:"w-3 h-3 text-text-muted"}),t.jsx("span",{className:"text-text-secondary",children:"Loop (redundant path)"})]}),r&&t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"w-4 h-0.5 rounded-full",style:{backgroundColor:X}}),t.jsx(B,{className:"w-3 h-3 text-text-muted"}),t.jsx("span",{className:"text-text-secondary",children:"Confirmed unicast"})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"w-4 h-0.5 rounded-full",style:{backgroundColor:"#64748B"}}),t.jsx(o,{className:"w-3 h-3 text-text-muted"}),t.jsx("span",{className:"text-text-secondary",children:"Standard edge"})]}),t.jsxs("div",{className:"pt-1 mt-1 border-t border-border-subtle/50",children:[t.jsx("div",{className:"text-text-muted text-[10px] mb-1",children:"Edge thickness = certainty"}),t.jsx("div",{className:"h-2 rounded-sm",style:{background:`linear-gradient(to right, ${J.slice(0,5).join(", ")}, ${Y})`}}),t.jsxs("div",{className:"flex justify-between text-[10px] text-text-muted",children:[t.jsx("span",{children:"Low"}),t.jsx("span",{children:"High"})]})]})]})})})]})]})}function ae({node:e,onClose:s,onZoomTo:a}){const n=_[e.nodeClass],l={active:{label:"Active",color:"text-accent-success"},recent:{label:"Recent",color:"text-accent-secondary"},stale:{label:"Stale",color:"text-signal-poor"},inactive:{label:"Inactive",color:"text-text-muted"}}[e.activityLevel]??{label:e.activityLevel,color:"text-text-muted"};return t.jsxs(b.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:20},transition:{duration:.15},className:"absolute top-4 right-4 z-20 bg-bg-elevated/95 backdrop-blur-sm rounded-xl border border-border-subtle shadow-2xl w-72",children:[t.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border-subtle",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"shrink-0 rounded-full ring-2 ring-offset-1 ring-offset-bg-elevated",style:{width:10,height:10,backgroundColor:K[e.nodeClass],boxShadow:`0 0 8px ${K[e.nodeClass]}40`}}),t.jsx(n,{className:"w-3.5 h-3.5 text-text-muted"}),t.jsx("span",{className:"font-medium text-text-primary type-data-sm",children:e.prefix})]}),t.jsxs("div",{className:"flex items-center gap-1",children:[e.isLocal&&t.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-yellow-500/20 text-yellow-300",children:"LOCAL"}),a&&t.jsx(T,{content:"Zoom to node",children:t.jsx("button",{onClick:a,className:"p-1 rounded hover:bg-subtle-fill transition-colors",children:t.jsx(C,{className:"w-3.5 h-3.5 text-text-muted"})})}),t.jsx("button",{onClick:s,className:"p-1 rounded hover:bg-subtle-fill transition-colors",children:t.jsx(g,{className:"w-3.5 h-3.5 text-text-muted"})})]})]}),t.jsxs("div",{className:"px-3 py-2 space-y-1.5 type-data-xs",children:[e.name&&t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-text-muted",children:"Name"}),t.jsx("span",{className:"text-text-primary font-medium truncate ml-2",children:e.name})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-text-muted",children:"Role"}),t.jsx("span",{className:"text-text-secondary capitalize",children:V[e.nodeClass]})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-text-muted",children:"Activity"}),t.jsx("span",{className:l.color,children:l.label})]})]}),t.jsxs("div",{className:"px-3 py-2 space-y-1.5 type-data-xs border-t border-border-subtle",children:[t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-text-muted",children:"Packets"}),t.jsx("span",{className:"text-text-secondary tabular-nums",children:e.packetCount.toLocaleString()})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-text-muted",children:"Connections"}),t.jsx("span",{className:"text-text-secondary tabular-nums",children:e.degree})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-text-muted",children:"Betweenness"}),t.jsxs("span",{className:"text-text-secondary tabular-nums",children:[(100*e.betweenness).toFixed(1),"%"]})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-text-muted",children:"Community"}),t.jsxs("span",{className:"text-text-secondary tabular-nums",children:["#",e.communityId]})]})]}),e.isZeroHop&&(null!==e.avgRssi||null!==e.avgSnr)&&t.jsxs("div",{className:"px-3 py-2 space-y-1.5 type-data-xs border-t border-border-subtle",children:[t.jsx("div",{className:"text-text-muted text-[10px] uppercase tracking-wide",children:"Signal Quality"}),null!==e.avgRssi&&t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-text-muted",children:"RSSI"}),t.jsxs("span",{className:"text-text-secondary tabular-nums",children:[e.avgRssi.toFixed(0)," dBm"]})]}),null!==e.avgSnr&&t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-text-muted",children:"SNR"}),t.jsxs("span",{className:"text-text-secondary tabular-nums",children:[e.avgSnr.toFixed(1)," dB"]})]})]}),(e.isHub||e.isGateway||e.isBackbone||e.isMobile||e.isInLoop)&&t.jsx("div",{className:"px-3 py-2 border-t border-border-subtle",children:t.jsxs("div",{className:"flex flex-wrap gap-1",children:[e.isHub&&t.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-indigo-500/20 text-indigo-300",children:"Hub"}),e.isGateway&&t.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-violet-500/20 text-violet-300",children:"Gateway"}),e.isBackbone&&t.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-emerald-500/20 text-emerald-300",children:"Backbone"}),e.isMobile&&t.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-orange-500/20 text-orange-300",children:"Mobile"}),e.isInLoop&&t.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-purple-500/20 text-purple-300",children:"In Loop"})]})}),e.hasCollision&&t.jsx("div",{className:"px-3 py-2 border-t border-border-subtle",children:t.jsxs("div",{className:"flex justify-between type-data-xs",children:[t.jsx("span",{className:"text-signal-poor",children:"Prefix collision"}),t.jsxs("span",{className:"text-text-muted tabular-nums",children:[(100*e.prefixConfidence).toFixed(0),"% conf"]})]})}),t.jsxs("div",{className:"px-3 py-2 border-t border-border-subtle space-y-1.5",children:[t.jsxs("div",{className:"flex justify-between type-data-xs",children:[t.jsx("span",{className:"text-text-muted",children:"Position"}),t.jsx("span",{className:e.hasGeo?"text-accent-success":"text-text-muted",children:e.hasGeo?"GPS":"Simulated"})]}),t.jsx("div",{children:t.jsx("span",{className:"text-text-muted break-all text-[10px] leading-relaxed font-mono",children:e.hash})})]})]})}function ne(){return t.jsxs("div",{className:"flex flex-col items-center justify-center gap-4 text-center px-8",children:[t.jsx("div",{className:"p-4 rounded-full bg-subtle-fill",children:t.jsx(S,{className:"w-8 h-8 text-text-muted"})}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("h2",{className:"text-lg font-medium text-text-primary",children:"No Topology Data"}),t.jsx("p",{className:"text-sm text-text-muted max-w-sm",children:"The mesh topology will appear here once packets are received and processed. This typically takes a few minutes after starting."})]}),t.jsxs("div",{className:"flex items-center gap-2 text-xs text-text-muted mt-2",children:[t.jsx(v,{className:"w-4 h-4 animate-pulse"}),t.jsx("span",{children:"Waiting for mesh traffic..."})]})]})}function le(){var f;const j=M(),[y,v]=e.useState(!1),N=H(),w=R(),[S,L]=e.useState(!1),[E,B]=e.useState("fetching"),[z,$]=e.useState(0),V=e.useRef(!1);e.useEffect(()=>{j&&!V.current&&(V.current=!0,(async()=>{L(!0),B("fetching"),$(0),await N(),B("analyzing"),await new Promise(e=>setTimeout(e,200)),B("building");const e=Date.now(),t=Date.now()-e;t<600&&await new Promise(e=>setTimeout(e,600-t)),B("discovering"),await new Promise(e=>setTimeout(e,400)),B("complete"),await new Promise(e=>setTimeout(e,800)),L(!1),v(!0)})())},[j,N]),e.useEffect(()=>{"fetching"===E&&(w.loadProgress?$(w.loadProgress.loaded):w.packetCount>0&&$(w.packetCount))},[E,w.loadProgress,w.packetCount]);const J=P(),te=D(),le=F(),ie=I(),[re,oe]=e.useState(!0),[ce,de]=e.useState(null),[xe,ue]=e.useState("all"),[me,pe]=e.useState(!0),[he,be]=e.useState(!0),[ge,fe]=e.useState(""),[je,ye]=e.useState(!1),ve=e.useRef(null),[Ne,we]=e.useState(null),[Ce,ke]=e.useState({x:0,y:0}),Se=e.useRef(null),[Le,Ee]=e.useState(!1),Be=G();e.useEffect(()=>{const e=e=>{var t;if(!(e.target instanceof HTMLInputElement))switch(e.key.toLowerCase()){case"f":e.metaKey||e.ctrlKey||(e.preventDefault(),null==(t=qe.current)||t.fitView(300));break;case"escape":je?(ye(!1),fe("")):ce&&de(null);break;case"/":je||(e.preventDefault(),ye(!0),setTimeout(()=>{var e;return null==(e=ve.current)?void 0:e.focus()},50));break;case" ":e.preventDefault();{const e=qe.current;e&&(re?e.pause():e.start(),oe(e=>!e))}break;case"l":pe(e=>!e);break;case"e":be(e=>!e)}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[je,ce,re]);const Me=(null==ie?void 0:ie.latitude)??0,He=(null==ie?void 0:ie.longitude)??0,Re=null!==ie,Pe=e.useMemo(()=>Math.floor(Date.now()/1e3),[]),De=e.useMemo(()=>{var e;if(!te||0===te.size||!y)return[];const t=[],s=(null==le?void 0:le.node_name)??(null==(e=null==le?void 0:le.config)?void 0:e.node_name)??null,a={x:0,y:0};for(const n of te.values()){const e=n.isLocal?1:A(n.lastSeen,Pe);if(0===e&&!n.isLocal)continue;const l=K[n.nodeClass],i=n.isLocal?l:O(l,e),r=6+22*n.betweenness,o=n.isLocal?r:r*(.5+.5*e),c=n.isLocal?s??n.name:n.name;let d,x,u=!1;Re&&(n.isLocal?(d=0,x=0,u=!0):n.latitude&&n.longitude&&(U(n.latitude,n.longitude,Me,He,a),d=a.x,x=a.y,u=!0)),t.push({id:n.hash,label:c?`${n.prefix} ${c}`:n.prefix,color:i,size:o,x:d,y:x,recencyWeight:e,nodeClass:n.nodeClass,name:c,prefix:n.prefix,packetCount:n.packetCount,betweenness:n.betweenness,communityId:n.communityId,isLocal:n.isLocal,isHub:n.isHub,isGateway:n.isGateway,isBackbone:n.isBackbone,isMobile:n.isMobile,isGhost:n.isGhost,isInLoop:n.isInLoop,isZeroHop:n.isZeroHop,hasGeo:u,avgRssi:n.avgRssi,avgSnr:n.avgSnr,degree:n.degree,activityLevel:n.activityLevel,prefixConfidence:n.prefixConfidence,hasCollision:n.hasCollision,lastSeen:n.lastSeen})}return t},[te,y,Re,Me,He,null==le?void 0:le.node_name,null==(f=null==le?void 0:le.config)?void 0:f.node_name,Pe]),Fe=e.useMemo(()=>{const e=new Set;for(const t of De)e.add(t.id);return e},[De]),{rawLinks:Ie,hasZeroHopEdges:Ge,hasLoopEdges:Te,hasDirectPathEdges:Ze}=e.useMemo(()=>{const e=null==J?void 0:J.validatedEdges;if(!e||0===e.length||!y)return{rawLinks:[],maxCertainCount:0,hasZeroHopEdges:!1,hasLoopEdges:!1,hasDirectPathEdges:!1};let t=0,s=!1,a=!1,n=!1;for(const o of e)o.avgRecency<.02||Fe.has(o.fromHash)&&Fe.has(o.toHash)&&(o.certainCount>t&&(t=o.certainCount),s=s||!0===o.isZeroHop,a=a||!0===o.isLoopEdge,n=n||!0===o.isDirectPathEdge);const l=t>0?Math.log10(t+1):1,i=.8*t,r=[];for(const o of e){const e=o.avgRecency;if(e<.02)continue;if(!Fe.has(o.fromHash)||!Fe.has(o.toHash))continue;let s=.5;if(t>0&&o.certainCount>0){const e=Math.log10(o.certainCount+1);s=.5+7.5*Math.min(1,e/l)}const a=s*(.3+.7*e);let n;n=o.isZeroHop?q:o.isLoopEdge?Q:o.isDirectPathEdge?X:o.certainCount>i?Y:ee(o.certainCount,t);const c=O(n,e);r.push({source:o.fromHash,target:o.toHash,color:c,width:a,strength:.3+.7*o.strength,recencyWeight:e,packetCount:o.packetCount,certainCount:o.certainCount,isZeroHop:o.isZeroHop??!1,isLoopEdge:o.isLoopEdge??!1,isDirectPath:o.isDirectPathEdge,avgConfidence:o.avgConfidence})}return{rawLinks:r,maxCertainCount:t,hasZeroHopEdges:s,hasLoopEdges:a,hasDirectPathEdges:n}},[null==J?void 0:J.validatedEdges,y,Fe]),ze=e.useMemo(()=>{const e=new Map;for(const t of Ie)e.set(t.source,(e.get(t.source)??0)+1),e.set(t.target,(e.get(t.target)??0)+1);return e},[Ie]),$e=e.useMemo(()=>{const e=new Map;for(const t of De)e.set(t.id,t);return e},[De]),[Ae,Oe]=e.useState(null),[We,Ke]=e.useState(null),[Ve,_e]=e.useState({}),qe=e.useRef(null),Qe=e.useRef(!1),Xe=e.useRef(null);e.useEffect(()=>{var e,t;if(0===De.length||0===Ie.length)return Oe(null),Ke(null),void(Xe.current=null);const s=`${De.length}:${Ie.length}:${null==(e=De[0])?void 0:e.id}:${null==(t=De[De.length-1])?void 0:t.id}`;if(s===Xe.current||Qe.current)return;let a=!1;return Qe.current=!0,(async()=>{try{const e=De.map(e=>({id:e.id,label:e.label,color:e.color})),t=Ie.map(e=>({source:e.source,target:e.target,color:e.color,width:e.width})),n=new Set(t.map(e=>e.width)),l={points:{pointIdBy:"id",pointColorBy:"color",pointLabelBy:"label",pointDefaultColor:"#64748B",pointGreyoutOpacity:.3,pointDefaultSize:12,pointSizeScale:1},links:{linkSourceBy:"source",linkTargetsBy:["target"],linkColorBy:"color",...t.length>=2&&n.size>=2?{linkWidthBy:"width",linkWidthRange:[.5,8]}:{},linkDefaultWidth:1,linkDefaultColor:"#4B5563",linkGreyoutOpacity:.2,linkWidthScale:1}},i=await k(l,e,t);if(a||!i)return;const{points:r,links:o,cosmographConfig:c}=i;Oe(r??null),Ke(o??null),_e({...c,...W}),Xe.current=s}finally{Qe.current=!1}})(),()=>{a=!0}},[De,Ie]);const Ye=e.useCallback(e=>{qe.current=e},[]),Je=e.useCallback(()=>{var e;null==(e=qe.current)||e.fitView(300)},[]),Ue=e.useCallback(()=>{const e=qe.current;e&&(re?e.pause():e.start(),oe(!re))},[re]),et=e.useCallback(async e=>{const t=qe.current;if(t)try{const s=await t.getPointIndicesByIds([e]);s&&s.length>0&&void 0!==s[0]&&t.zoomToPoint(s[0],400,2.5)}catch{}},[]),tt=e.useMemo(()=>{if(!ge.trim())return[];const e=ge.toLowerCase();return De.filter(t=>{var s;return t.prefix.toLowerCase().includes(e)||(null==(s=t.name)?void 0:s.toLowerCase().includes(e))||t.id.toLowerCase().includes(e)}).slice(0,8)},[De,ge]),st=e.useCallback(e=>{et(e.id),ye(!1),fe(""),de({hash:e.id,name:e.name,prefix:e.prefix,nodeClass:e.nodeClass,packetCount:e.packetCount,edgeCount:ze.get(e.id)??0,betweenness:e.betweenness,communityId:e.communityId,degree:e.degree,hasGeo:e.hasGeo,isLocal:e.isLocal,isHub:e.isHub,isGateway:e.isGateway,isBackbone:e.isBackbone,isMobile:e.isMobile,isInLoop:e.isInLoop,isZeroHop:e.isZeroHop,avgRssi:e.avgRssi,avgSnr:e.avgSnr,activityLevel:e.activityLevel,prefixConfidence:e.prefixConfidence,hasCollision:e.hasCollision})},[et,ze]),at=e.useRef(void 0),nt=e.useRef(0),lt=e.useCallback(async(e,t,s)=>{const a=Date.now();if(s&&a-nt.current>=16&&(nt.current=a,ke({x:s.clientX,y:s.clientY})),e===at.current)return;at.current=e,Se.current&&(clearTimeout(Se.current),Se.current=null);const n=qe.current;if(n)if(void 0!==e)try{const t=await n.getPointIdsByIndices([e]);if(!t||0===t.length)return;const s=t[0],a=$e.get(s);if(!a)return;we(a),n.selectPoint(e,!1,!0)}catch{we(null)}else Se.current=setTimeout(()=>{we(null),ce||n.unselectAllPoints()},100)},[$e,ce]),it=e.useCallback(()=>{Ee(e=>!e)},[]),rt=e.useCallback(()=>{ue(e=>{const t=["all","hubs","neighbors","active"],s=t.indexOf(e);return t[(s+1)%t.length]})},[]),ot={all:"All nodes",hubs:"Hubs & gateways only",neighbors:"Direct RF neighbors",active:"Recently active"},ct=e.useCallback(async(e,t,s)=>{var a;if(we(null),at.current=void 0,void 0===e)return de(null),void(null==(a=qe.current)||a.unselectAllPoints());const n=qe.current;if(n)try{const t=await n.getPointIdsByIndices([e]);if(!t||0===t.length)return;const s=t[0],a=$e.get(s);if(!a)return;n.selectPoint(e,!1),de({hash:s,name:a.name,prefix:a.prefix,nodeClass:a.nodeClass,packetCount:a.packetCount,edgeCount:ze.get(s)??0,betweenness:a.betweenness,communityId:a.communityId,degree:a.degree,hasGeo:a.hasGeo,isLocal:a.isLocal,isHub:a.isHub,isGateway:a.isGateway,isBackbone:a.isBackbone,isMobile:a.isMobile,isInLoop:a.isInLoop,isZeroHop:a.isZeroHop,avgRssi:a.avgRssi,avgSnr:a.avgSnr,activityLevel:a.activityLevel,prefixConfidence:a.prefixConfidence,hasCollision:a.hasCollision})}catch{}},[$e,ze]);if(!y)return t.jsxs("div",{className:"-mx-4 sm:-mx-6 lg:-mx-8 -mt-5 -mb-4 sm:-mb-6 lg:-mb-8 h-[calc(100vh-64px)] flex items-center justify-center bg-black",children:[t.jsx(Z,{isOpen:S,currentStep:E,packetCount:z}),!S&&t.jsx(s,{className:"w-8 h-8 text-accent-primary animate-spin"})]});if(0===De.length)return t.jsxs("div",{className:"-mx-4 sm:-mx-6 lg:-mx-8 -mt-5 -mb-4 sm:-mb-6 lg:-mb-8 h-[calc(100vh-64px)] flex flex-col bg-black overflow-hidden",children:[t.jsx("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border-subtle bg-bg-elevated/50",children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(a,{className:"w-5 h-5 text-accent-primary"}),t.jsxs("h1",{className:"type-data-sm font-semibold text-text-primary flex items-center gap-2",children:["MeshGraph",t.jsx("span",{className:"px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wider bg-accent-primary/20 text-accent-primary rounded",children:"Beta"})]})]})}),t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(ne,{})})]});if(!Ae)return t.jsx("div",{className:"-mx-4 sm:-mx-6 lg:-mx-8 -mt-5 -mb-4 sm:-mb-6 lg:-mb-8 h-[calc(100vh-64px)] flex items-center justify-center bg-black",children:t.jsxs("div",{className:"flex flex-col items-center gap-3",children:[t.jsx(s,{className:"w-8 h-8 text-accent-primary animate-spin"}),t.jsx("span",{className:"text-sm text-text-muted",children:"Preparing graph..."})]})});const dt=Le?"fixed inset-0 z-50 bg-black":"-mx-4 sm:-mx-6 lg:-mx-8 -mt-5 -mb-4 sm:-mb-6 lg:-mb-8 h-[calc(100vh-64px)] bg-black";return t.jsxs("div",{className:`${dt} flex flex-col overflow-hidden`,children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border-subtle/50 bg-black/80 backdrop-blur-sm z-10",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(a,{className:"w-5 h-5 text-accent-primary"}),t.jsxs("h1",{className:"type-data-sm font-semibold text-text-primary flex items-center gap-2",children:["MeshGraph",t.jsx("span",{className:"px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wider bg-accent-primary/20 text-accent-primary rounded",children:"Beta"})]}),t.jsxs("span",{className:"type-data-xs text-text-muted tabular-nums",children:[De.length," nodes • ",Ie.length," edges"]}),"all"!==xe&&t.jsx("span",{className:"text-[10px] px-2 py-0.5 rounded-full bg-accent-primary/20 text-accent-primary",children:ot[xe]})]}),t.jsxs("div",{className:"flex items-center gap-0.5",children:[t.jsx(T,{content:"Search nodes (/)",children:t.jsx("button",{onClick:()=>{ye(!0),setTimeout(()=>{var e;return null==(e=ve.current)?void 0:e.focus()},50)},className:"p-2 rounded-lg transition-colors "+(je?"bg-accent-primary/20 text-accent-primary":"hover:bg-subtle-fill text-text-muted"),children:t.jsx(n,{className:"w-4 h-4"})})}),t.jsx(T,{content:`Filter: ${ot[xe]}`,children:t.jsx("button",{onClick:rt,className:"p-2 rounded-lg transition-colors "+("all"!==xe?"bg-accent-primary/20 text-accent-primary":"hover:bg-subtle-fill text-text-muted"),children:t.jsx(l,{className:"w-4 h-4"})})}),t.jsx("div",{className:"w-px h-4 bg-border-subtle mx-1"}),t.jsx(T,{content:(me?"Hide":"Show")+" labels (L)",children:t.jsx("button",{onClick:()=>pe(e=>!e),className:"p-2 rounded-lg transition-colors "+(me?"text-text-muted hover:bg-subtle-fill":"text-text-muted/50 hover:bg-subtle-fill"),children:me?t.jsx(i,{className:"w-4 h-4"}):t.jsx(r,{className:"w-4 h-4"})})}),t.jsx(T,{content:(he?"Hide":"Show")+" edges (E)",children:t.jsx("button",{onClick:()=>be(e=>!e),className:"p-2 rounded-lg transition-colors "+(he?"text-text-muted hover:bg-subtle-fill":"text-text-muted/50 hover:bg-subtle-fill"),children:t.jsx(o,{className:"w-4 h-4"})})}),t.jsx("div",{className:"w-px h-4 bg-border-subtle mx-1"}),t.jsx(T,{content:(re?"Pause":"Resume")+" simulation (Space)",children:t.jsx("button",{onClick:Ue,className:"p-2 rounded-lg hover:bg-subtle-fill transition-colors",children:re?t.jsx(c,{className:"w-4 h-4 text-accent-success"}):t.jsx(d,{className:"w-4 h-4 text-text-muted"})})}),t.jsx(T,{content:"Fit view (F)",children:t.jsx("button",{onClick:Je,className:"p-2 rounded-lg hover:bg-subtle-fill transition-colors",children:t.jsx(x,{className:"w-4 h-4 text-text-muted"})})}),t.jsx(T,{content:Le?"Exit fullscreen":"Fullscreen",children:t.jsx("button",{onClick:it,className:"p-2 rounded-lg hover:bg-subtle-fill transition-colors",children:Le?t.jsx(u,{className:"w-4 h-4 text-text-muted"}):t.jsx(m,{className:"w-4 h-4 text-text-muted"})})})]})]}),t.jsxs("div",{className:"flex-1 relative min-h-0",children:[t.jsx(p,{className:"absolute inset-0",points:Ae,links:he?We:void 0,...Ve,backgroundColor:"#000000",fitViewOnInit:!0,showLabels:me,showDynamicLabels:me,showTopLabels:me,showTopLabelsLimit:30,showHoveredPointLabel:!1,pointLabelColor:"#E2E8F0",pointLabelFontSize:11,onClick:ct,onMouseMove:lt,onMount:Ye,renderHoveredPointRing:!0,hoveredPointRingColor:"#FBBF24",hoveredPointCursor:"pointer",pointGreyoutOpacity:.15,linkGreyoutOpacity:.1}),t.jsx(h,{children:Ne&&t.jsx(b.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},transition:{duration:.1},className:"fixed z-50 pointer-events-none",style:{left:Ce.x+16,top:Ce.y-8},children:t.jsxs("div",{className:"bg-bg-elevated/95 backdrop-blur-md rounded-lg border border-border-subtle shadow-2xl px-3 py-2 max-w-xs",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[t.jsx("span",{className:"w-2.5 h-2.5 rounded-full shrink-0 ring-1 ring-white/20",style:{backgroundColor:K[Ne.nodeClass],boxShadow:`0 0 6px ${K[Ne.nodeClass]}60`}}),t.jsx("span",{className:"font-medium text-text-primary text-sm truncate",children:Ne.name||Ne.prefix}),Ne.isLocal&&t.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded bg-yellow-500/20 text-yellow-300 shrink-0",children:"LOCAL"})]}),t.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-text-muted",children:[t.jsx("span",{className:"capitalize",children:Ne.nodeClass}),t.jsx("span",{children:"•"}),t.jsxs("span",{children:[Ne.packetCount.toLocaleString()," pkts"]}),t.jsx("span",{children:"•"}),t.jsxs("span",{children:[Ne.degree," conn"]})]}),Ne.isZeroHop&&(null!==Ne.avgSnr||null!==Ne.avgRssi)&&t.jsxs("div",{className:"flex items-center gap-2 mt-1 pt-1 border-t border-border-subtle/50 text-[10px]",children:[null!==Ne.avgSnr&&t.jsxs("span",{className:"text-accent-success",children:["SNR: ",Ne.avgSnr.toFixed(1)," dB"]}),null!==Ne.avgRssi&&t.jsxs("span",{className:"text-text-muted",children:["RSSI: ",Ne.avgRssi.toFixed(0)," dBm"]})]}),(Ne.isHub||Ne.isGateway||Ne.isBackbone||Ne.isMobile)&&t.jsxs("div",{className:"flex items-center gap-1 mt-1 pt-1 border-t border-border-subtle/50",children:[Ne.isHub&&t.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded bg-indigo-500/20 text-indigo-300",children:"Hub"}),Ne.isGateway&&t.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded bg-violet-500/20 text-violet-300",children:"Gateway"}),Ne.isBackbone&&t.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded bg-emerald-500/20 text-emerald-300",children:"Backbone"}),Ne.isMobile&&t.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded bg-orange-500/20 text-orange-300",children:"Mobile"})]}),t.jsx("div",{className:"text-[9px] text-text-muted/60 mt-1",children:"Click for details"})]})})}),t.jsx(h,{children:je&&t.jsx(b.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.15},className:"absolute top-4 left-1/2 -translate-x-1/2 z-30 w-80",children:t.jsxs("div",{className:"bg-bg-elevated/95 backdrop-blur-sm rounded-xl border border-border-subtle shadow-2xl overflow-hidden",children:[t.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-border-subtle",children:[t.jsx(n,{className:"w-4 h-4 text-text-muted shrink-0"}),t.jsx("input",{ref:ve,type:"text",value:ge,onChange:e=>fe(e.target.value),placeholder:"Search by name or prefix...",className:"flex-1 bg-transparent text-sm text-text-primary placeholder:text-text-muted focus:outline-none",onKeyDown:e=>{"Escape"===e.key?(ye(!1),fe("")):"Enter"===e.key&&tt.length>0&&st(tt[0])}}),ge&&t.jsx("button",{onClick:()=>fe(""),className:"p-0.5 rounded hover:bg-subtle-fill",children:t.jsx(g,{className:"w-3 h-3 text-text-muted"})})]}),tt.length>0&&t.jsx("div",{className:"max-h-64 overflow-y-auto",children:tt.map((e,s)=>{const a=_[e.nodeClass];return t.jsxs("button",{onClick:()=>st(e),className:"w-full flex items-center gap-3 px-3 py-2 text-left hover:bg-subtle-fill transition-colors "+(0===s?"bg-subtle-fill/50":""),children:[t.jsx("span",{className:"w-2.5 h-2.5 rounded-full shrink-0",style:{backgroundColor:K[e.nodeClass]}}),t.jsx(a,{className:"w-3.5 h-3.5 text-text-muted shrink-0"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"text-sm text-text-primary truncate",children:e.name||e.prefix}),e.name&&t.jsx("div",{className:"text-[10px] text-text-muted",children:e.prefix})]}),t.jsx(C,{className:"w-3 h-3 text-text-muted shrink-0"})]},e.id)})}),ge&&0===tt.length&&t.jsx("div",{className:"px-3 py-4 text-center text-sm text-text-muted",children:"No nodes found"}),!ge&&t.jsx("div",{className:"px-3 py-2 text-[10px] text-text-muted",children:"Type to search • Enter to select • Esc to close"})]})})}),t.jsx(se,{nodeCount:De.length,edgeCount:Ie.length,nodeClassCounts:Be,hasZeroHopEdges:Ge,hasLoopEdges:Te,hasDirectPathEdges:Ze}),t.jsxs("div",{className:"absolute bottom-4 right-4 z-10 hidden lg:flex items-center gap-3 text-[10px] text-text-muted/60",children:[t.jsxs("span",{children:[t.jsx("kbd",{className:"px-1 py-0.5 rounded bg-subtle-fill/50 font-mono",children:"/"})," Search"]}),t.jsxs("span",{children:[t.jsx("kbd",{className:"px-1 py-0.5 rounded bg-subtle-fill/50 font-mono",children:"F"})," Fit"]}),t.jsxs("span",{children:[t.jsx("kbd",{className:"px-1 py-0.5 rounded bg-subtle-fill/50 font-mono",children:"Space"})," Pause"]}),t.jsxs("span",{children:[t.jsx("kbd",{className:"px-1 py-0.5 rounded bg-subtle-fill/50 font-mono",children:"Esc"})," Clear"]})]}),t.jsx(h,{children:ce&&t.jsx(ae,{node:ce,onClose:()=>de(null),onZoomTo:()=>et(ce.hash)})})]})]})}export{le as default}; diff --git a/frontend/dist/assets/NodeInformationCard-CEW2bogB.js b/frontend/dist/assets/NodeInformationCard-DcRtH0Bq.js similarity index 74% rename from frontend/dist/assets/NodeInformationCard-CEW2bogB.js rename to frontend/dist/assets/NodeInformationCard-DcRtH0Bq.js index 1da210ea..e8337aee 100644 --- a/frontend/dist/assets/NodeInformationCard-CEW2bogB.js +++ b/frontend/dist/assets/NodeInformationCard-DcRtH0Bq.js @@ -1 +1 @@ -import{j as e,E as s}from"./vendor-react-C341c8YC.js";import{a as t}from"./PageLayout-CnF5SScd.js";import{D as a}from"./DataBox-CRX76VsB.js";import{ay as r}from"./index-BJEgt3tp.js";import{C as l}from"./Card-2pQSGkKC.js";function c({nodeName:c,repeaterVersion:m,coreVersion:i,localHash:n,publicKey:d}){return e.jsxs(t,{children:[e.jsx(l,{icon:e.jsx(s,{}),title:"Node Information",largeTitle:!0}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-3 sm:gap-4",children:[e.jsxs("div",{className:"min-w-0 col-span-2 sm:col-span-1",children:[e.jsx("span",{className:"type-label text-text-secondary",children:"Node Name"}),e.jsx("p",{className:"type-body text-text-primary mt-0.5 sm:mt-1 truncate",title:c,children:c})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{className:"type-label text-text-secondary",children:"Repeater"}),e.jsxs("p",{className:"type-data text-text-primary mt-0.5 sm:mt-1 truncate",title:`v${m}`,children:["v",m]})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{className:"type-label text-text-secondary",children:"Core"}),e.jsxs("p",{className:"type-data text-text-primary mt-0.5 sm:mt-1 truncate",title:`v${i}`,children:["v",i]})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{className:"type-label text-text-secondary",children:"Console"}),e.jsxs("p",{className:"type-data text-text-primary mt-0.5 sm:mt-1 truncate",title:`v${r}`,children:["v",r]})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{className:"type-label text-text-secondary",children:"Local Hash"}),e.jsx("div",{className:"mt-0.5 sm:mt-1",children:n?e.jsx(a,{copy:!0,size:"compact",children:n}):e.jsx("span",{className:"type-data-sm text-text-secondary",children:"N/A"})})]})]}),d&&e.jsxs("div",{className:"mt-3 sm:mt-4 pt-3 sm:pt-4 border-t border-border-subtle",children:[e.jsx("span",{className:"type-label text-text-secondary",children:"Public Key"}),e.jsx("div",{className:"mt-0.5 sm:mt-1",children:e.jsx(a,{copy:!0,size:"responsive",children:d})})]})]})}export{c as N}; +import{j as e}from"./vendor-react-DCIF8YoJ.js";import{a as s}from"./PageLayout-DIXn4UXM.js";import{D as t}from"./DataBox-nCNZLfvU.js";import{R as a,bh as r}from"./index-BGs2yNOg.js";import{C as l}from"./Card-CPlTPCY8.js";function c({nodeName:c,repeaterVersion:m,coreVersion:i,localHash:n,publicKey:d}){return e.jsxs(s,{children:[e.jsx(l,{icon:e.jsx(a,{}),title:"Node Information",largeTitle:!0}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-3 sm:gap-4",children:[e.jsxs("div",{className:"min-w-0 col-span-2 sm:col-span-1",children:[e.jsx("span",{className:"type-label text-text-secondary",children:"Node Name"}),e.jsx("p",{className:"type-body text-text-primary mt-0.5 sm:mt-1 truncate",title:c,children:c})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{className:"type-label text-text-secondary",children:"Repeater"}),e.jsxs("p",{className:"type-data text-text-primary mt-0.5 sm:mt-1 truncate",title:`v${m}`,children:["v",m]})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{className:"type-label text-text-secondary",children:"Core"}),e.jsxs("p",{className:"type-data text-text-primary mt-0.5 sm:mt-1 truncate",title:`v${i}`,children:["v",i]})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{className:"type-label text-text-secondary",children:"Console"}),e.jsxs("p",{className:"type-data text-text-primary mt-0.5 sm:mt-1 truncate",title:`v${r}`,children:["v",r]})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{className:"type-label text-text-secondary",children:"Local Hash"}),e.jsx("div",{className:"mt-0.5 sm:mt-1",children:n?e.jsx(t,{copy:!0,size:"compact",children:n}):e.jsx("span",{className:"type-data-sm text-text-secondary",children:"N/A"})})]})]}),d&&e.jsxs("div",{className:"mt-3 sm:mt-4 pt-3 sm:pt-4 border-t border-border-subtle",children:[e.jsx("span",{className:"type-label text-text-secondary",children:"Public Key"}),e.jsx("div",{className:"mt-0.5 sm:mt-1",children:e.jsx(t,{copy:!0,size:"responsive",children:d})})]})]})}export{c as N}; diff --git a/frontend/dist/assets/PacketList-BPeOqxkB.js b/frontend/dist/assets/PacketList-BPeOqxkB.js deleted file mode 100644 index 5fe9f766..00000000 --- a/frontend/dist/assets/PacketList-BPeOqxkB.js +++ /dev/null @@ -1,2 +0,0 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PathMapMapLibre-ChIFu4o3.js","assets/vendor-react-C341c8YC.js","assets/vendor-core-WoOfkQwm.js","assets/BasemapLayer-S9Ush6Hh.js","assets/useThemeColors-AeHMyThq.js","assets/index-BJEgt3tp.js","assets/maplibre-gl-B1CfjdFi.css","assets/index-CIefRaAd.css"])))=>i.map(i=>d[i]); -import{j as e,r as t,an as s,ao as a,a0 as n,a1 as r,aj as l,ap as i,aq as c,ar as o,as as d,at as x,e as m,m as p,au as h,av as u,D as g,aw as f,ax as j,ay as y,az as b,aA as N,E as v,aB as w,aC as k,t as C,aD as S,ab as P,A as _,aE as T,aF as H,aG as B,aH as M,C as F,V as L,a9 as D,aI as z,a5 as A}from"./vendor-react-C341c8YC.js";import{n as E}from"./recharts-6XUQYgRA.js";import{y as R,B as U,z as I,A as $,C as V,E as Q,G as O,n as W,H as G,I as q,e as K,J as Y,K as J,M as X,N as Z,O as ee,Q as te,U as se,V as ae,W as ne}from"./index-BJEgt3tp.js";import{P as re,d as le,g as ie,a as ce,h as oe,b as de,c as xe,e as me,f as pe,i as he,j as ue}from"./channel-keys-DJWRrSwE.js";import{D as ge,S as fe,R as je,P as ye,g as be}from"./SignalIndicator-BLrEkFNb.js";import{_ as Ne}from"./deckgl-DTsmDcfs.js";import{D as ve}from"./DataBox-CRX76VsB.js";import{g as we,s as ke}from"./useThemeColors-AeHMyThq.js";function Ce({"aria-label":t="Page navigation",className:s,...a}){return e.jsx("nav",{"aria-label":t,...a,className:E("flex gap-x-2",s)})}function Se({onClick:t,disabled:s=!1,className:a,children:n="Previous"}){return e.jsx("span",{className:E("grow basis-0",a),children:e.jsxs(R,{plain:!0,onClick:t,disabled:s,"aria-label":"Previous page",className:E("gap-1",s&&"invisible"),children:[e.jsx("svg",{className:"size-4 stroke-current",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:e.jsx("path",{d:"M2.75 8H13.25M2.75 8L5.25 5.5M2.75 8L5.25 10.5",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})}),n]})})}function Pe({onClick:t,disabled:s=!1,className:a,children:n="Next"}){return e.jsx("span",{className:E("flex grow basis-0 justify-end",a),children:e.jsxs(R,{plain:!0,onClick:t,disabled:s,"aria-label":"Next page",className:E("gap-1",s&&"invisible"),children:[n,e.jsx("svg",{className:"size-4 stroke-current",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:e.jsx("path",{d:"M13.25 8L2.75 8M13.25 8L10.75 10.5M13.25 8L10.75 5.5",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})})]})})}function _e({className:t,...s}){return e.jsx("span",{...s,className:E("hidden items-baseline gap-x-2 sm:flex",t)})}function Te({page:t,current:s=!1,onClick:a,className:n,children:r}){return e.jsx(R,{plain:!s,outline:s,onClick:()=>null==a?void 0:a(t),"aria-label":`Page ${t}`,"aria-current":s?"page":void 0,className:E("min-w-[2.25rem] before:absolute before:-inset-px before:rounded-lg",s&&"before:bg-white/5",n),children:r??t})}function He({className:t,...s}){return e.jsx("span",{"aria-hidden":"true",...s,className:E("w-[2.25rem] select-none text-center text-sm text-text-muted",t),children:"…"})}function Be(e){if(!e||e.length<8)return null;const t=parseInt(e.slice(0,2),16),s=parseInt(e.slice(2,4),16),a=parseInt(e.slice(4,6),16),n=parseInt(e.slice(6,8),16);return isNaN(t)||isNaN(s)||isNaN(a)||isNaN(n)?null:((t|s<<8|a<<16|n<<24)>>>0).toString(16).toUpperCase().padStart(8,"0")}function Me(e){return e>=10?"excellent":e>=5?"good":e>=0?"fair":e>=-5?"poor":"critical"}function Fe(e){if(!e.payload)return null;try{const t=oe(e.payload),s=function(e){const t=e.original_path||e.forwarded_path||[];if("string"==typeof t)try{const e=JSON.parse(t);if(Array.isArray(e))return e.map(e=>parseInt(e,16))}catch{return[]}else if(Array.isArray(t))return t.map(e=>parseInt(e,16));return[]}(e),a=de(t,s);return a?{packet:e,decoded:a,timestamp:e.timestamp??0,hopCount:a.snrValues.length,rssi:e.rssi,snr:e.snr}:null}catch{return null}}const Le={rx:{icon:l,label:"Rx",badgeColor:ge.rx,avatarBg:"bg-emerald-500/15",avatarText:"text-emerald-400"},forward:{icon:r,label:"Fwd",badgeColor:ge.forward,avatarBg:"bg-sky-500/15",avatarText:"text-sky-400"},duplicate:{icon:n,label:"Dupe",badgeColor:ge.duplicate,avatarBg:"bg-zinc-500/15",avatarText:"text-zinc-400"},tx:{icon:a,label:"Tx",badgeColor:ge.tx,avatarBg:"bg-violet-500/15",avatarText:"text-violet-400"},dropped:{icon:s,label:"Drop",badgeColor:ge.dropped,avatarBg:"bg-amber-500/15",avatarText:"text-amber-400"}},De={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},ze={sm:"w-7 h-7",md:"w-8 h-8",lg:"w-9 h-9"};function Ae(e){return"tx_local"===e.packet_origin?"tx":"tx_forward"===e.packet_origin?"forward":e.is_duplicate?"duplicate":e.transmitted?"forward":e.drop_reason?"dropped":"rx"}const Ee=t.memo(function({packet:t,showLabel:s=!0,variant:a="avatar",size:n="sm"}){const r=Ae(t),l=Le[r],i=l.icon;return"avatar"===a?e.jsx("div",{className:E("flex items-center justify-center rounded-full flex-shrink-0",l.avatarBg,ze[n]),children:e.jsx(i,{className:E(De[n],l.avatarText)})}):e.jsxs(U,{color:l.badgeColor,children:[e.jsx(i,{className:De[n]}),s&&l.label]})}),Re=t.memo(function({path:t,localHash:s,className:a}){if(!t||0===t.length)return e.jsx("span",{className:E("text-white/30 text-[10px]",a),children:"—"});const n=s?(s.startsWith("0x")?s.slice(2,4):s.slice(0,2)).toUpperCase():null;return e.jsx("span",{className:E("flex items-center gap-0.5 font-mono text-[10px] overflow-hidden",a),children:t.map((s,a)=>{const r=a===t.length-1,l=n&&s.toUpperCase()===n;return e.jsxs("span",{className:"flex items-center flex-shrink-0",children:[l?e.jsx("span",{className:"px-1 py-0.5 rounded bg-amber-500/20 text-amber-400 text-[9px] font-medium",children:"You"}):e.jsx("span",{className:"px-1 py-0.5 rounded bg-white/[0.06] text-white/60",children:s.toUpperCase()}),!r&&e.jsx(i,{className:"w-2.5 h-2.5 text-white/20 mx-0.5 flex-shrink-0"})]},`${s}-${a}`)})})}),Ue=t.memo(function({count:t,className:s}){const a=t>=2;return e.jsxs("span",{className:E("font-mono text-xs tabular-nums",a?"text-white/70":"text-white/30",s),children:[t,e.jsx("span",{className:"text-white/20",children:"→"})]})});function Ie(e){const t=e.payload_type_name||V(e.payload_type??e.type),s=e.route_type_name||Q(e.route_type??e.route);return{payloadType:t,routeType:s,payloadColor:ye[t]??"zinc",routeColor:je[s]??"zinc"}}function $e(e){if(!e)return[];if(Array.isArray(e))return e;try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function Ve(e,t){if(!e||!t)return null;const s=e.startsWith("0x")?e.slice(2):e;for(const[a,n]of Object.entries(t))if((a.startsWith("0x")?a.slice(2):a).toLowerCase().startsWith(s.toLowerCase()))return n.name||n.node_name||null;return null}const Qe=t.memo(function({packet:s,onClick:a,localHash:n,neighbors:r,isFlashing:l=!1,isPending:i,isTraceHighlighted:o,onTraceHover:d,traceTag:x,onViewTraceReport:m,dupeGroupPosition:p,isDupeGroupHovered:h=!1,onDupeGroupHover:u}){const g=I(s.is_duplicate),f=void 0!==p,{payloadType:j,routeType:y,payloadColor:b,routeColor:N}=Ie(s),v="tx_local"===s.packet_origin,w=i??s.isPending,k="TRACE"===j,C=$e(s.original_path),S=$e(s.forwarded_path),P=S.length>0?S:C,_=P.length,T=s.src_hash?(s.src_hash.startsWith("0x")?s.src_hash.slice(2,6):s.src_hash.slice(0,4)).toUpperCase():null,H=Ve(s.src_hash,r),B=s.payload_length??s.length??0;s.lbt_attempts;const M=t.useCallback(()=>{k&&x&&m?m(x):a(s)},[k,x,m,a,s]),F=t.useCallback(()=>{k&&x&&d&&d(x),f&&u&&s.packet_hash&&u(s.packet_hash)},[k,x,d,f,u,s.packet_hash]),L=t.useCallback(()=>{d&&d(null),u&&u(null)},[d,u]),D={lime:"rgb(132, 204, 22)",cyan:"rgb(34, 211, 238)",amber:"rgb(251, 191, 36)",violet:"rgb(167, 139, 250)",rose:"rgb(251, 113, 133)",emerald:"rgb(52, 211, 153)",sky:"rgb(56, 189, 248)",orange:"rgb(251, 146, 60)",pink:"rgb(244, 114, 182)",zinc:"rgb(161, 161, 170)",purple:"rgb(168, 85, 247)",indigo:"rgb(129, 140, 248)",teal:"rgb(45, 212, 191)",fuchsia:"rgb(232, 121, 249)",blue:"rgb(59, 130, 246)",green:"rgb(34, 197, 94)",yellow:"rgb(250, 204, 21)",red:"rgb(239, 68, 68)",brown:"rgb(168, 133, 107)"},z=D[b]||D.zinc,A=h;return e.jsxs("div",{onClick:M,onMouseEnter:F,onMouseLeave:L,className:E("group relative cursor-pointer","hover:bg-white/[0.02]",g&&!h&&"opacity-40",l&&"flash-row",w&&"opacity-70",v&&"bg-violet-500/5",o&&"bg-teal-500/10"),children:[e.jsx("div",{className:E("absolute pointer-events-none transition-opacity duration-75",f?A?"opacity-100":"opacity-0":"opacity-0 group-hover:opacity-100"),style:(()=>{const e={pointerEvents:"none"};return"first"===p?{...e,borderTop:`2px solid ${z}`,borderLeft:`2px solid ${z}`,borderRight:`2px solid ${z}`,borderBottom:"none",borderRadius:"8px 8px 0 0",inset:"-2px -2px 0 -2px"}:"middle"===p?{...e,borderTop:"none",borderLeft:`2px solid ${z}`,borderRight:`2px solid ${z}`,borderBottom:"none",borderRadius:0,inset:"0 -2px"}:"last"===p?{...e,borderTop:"none",borderLeft:`2px solid ${z}`,borderRight:`2px solid ${z}`,borderBottom:`2px solid ${z}`,borderRadius:"0 0 8px 8px",inset:"0 -2px -2px -2px"}:{...e,border:`2px solid ${z}`,borderRadius:"8px",inset:"-2px"}})()}),e.jsxs("div",{className:"relative flex items-center gap-2 min-[600px]:gap-3 px-2 py-2 min-[600px]:px-3 min-[600px]:py-2.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[e.jsxs("div",{className:"relative flex-shrink-0",children:[e.jsx(Ee,{packet:s,variant:"avatar",size:"sm"}),w&&e.jsx(c,{className:"absolute -right-1 -bottom-1 w-3 h-3 text-amber-400 animate-spin"})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-bold text-[13px] text-white font-sans truncate",children:T||"—"}),H&&e.jsx("div",{className:"hidden min-[900px]:block text-[9px] text-white/40 truncate max-w-[70px]",children:H})]})]}),e.jsxs("div",{className:"flex-1 flex items-center gap-1 min-[600px]:gap-1.5 min-[900px]:gap-2 min-w-0",children:[e.jsx("span",{className:"text-[10px] min-[600px]:text-[11px] text-white/50 font-mono tabular-nums whitespace-nowrap flex-shrink-0",children:$(s.timestamp)}),e.jsx(U,{color:b,className:"flex-shrink-0",children:j}),e.jsx("span",{className:"min-[600px]:hidden text-[10px] font-mono text-white/40 flex-shrink-0",children:y.charAt(0)}),e.jsx(U,{color:N,className:"flex-shrink-0 hidden min-[600px]:inline-flex",children:y}),e.jsx("div",{className:"flex-shrink-0 flex items-center",children:e.jsx(Ue,{count:_})}),e.jsxs("span",{className:"hidden min-[520px]:inline text-[10px] text-white/40 font-mono flex-shrink-0",children:[B,"B"]}),e.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:e.jsx(Re,{path:P,localHash:n})})]}),e.jsx("div",{className:"flex-shrink-0",children:e.jsx(fe,{rssi:s.rssi,snr:s.snr,compact:!0,showValues:!0})})]})]})}),Oe=t.memo(function({packet:t,onClick:s,localHash:a,neighbors:n,isFlashing:r=!1,isPending:l,isTraceHighlighted:i,traceTag:o,onViewTraceReport:d,dupeGroupPosition:x,isDupeGroupHovered:m=!1,onDupeGroupHover:p}){const{payloadType:h,routeType:u,payloadColor:g,routeColor:f}=Ie(t),j="tx_local"===t.packet_origin,y=l??t.isPending,b="TRACE"===h,N=I(t.is_duplicate),v=$e(t.original_path),w=$e(t.forwarded_path),k=w.length>0?w:v,C=k.length,S=t.src_hash?(t.src_hash.startsWith("0x")?t.src_hash.slice(2,6):t.src_hash.slice(0,4)).toUpperCase():null,P=Ve(t.src_hash,n),_=t.payload_length??t.length??0,T=t.lbt_attempts??0,H={lime:"rgb(132, 204, 22)",cyan:"rgb(34, 211, 238)",amber:"rgb(251, 191, 36)",violet:"rgb(167, 139, 250)",rose:"rgb(251, 113, 133)",emerald:"rgb(52, 211, 153)",sky:"rgb(56, 189, 248)",orange:"rgb(251, 146, 60)",pink:"rgb(244, 114, 182)",zinc:"rgb(161, 161, 170)",purple:"rgb(168, 85, 247)",indigo:"rgb(129, 140, 248)",teal:"rgb(45, 212, 191)",fuchsia:"rgb(232, 121, 249)",blue:"rgb(59, 130, 246)",green:"rgb(34, 197, 94)",yellow:"rgb(250, 204, 21)",red:"rgb(239, 68, 68)"},B=H[g]||H.zinc;return e.jsxs("div",{onClick:()=>{b&&o&&d?d(o):s(t)},className:E("relative pl-3 pr-2.5 py-2 cursor-pointer","active:bg-white/[0.04]",N&&"opacity-40",r&&"flash-row",y&&"opacity-70",j&&"bg-violet-500/5",i&&"bg-teal-500/10"),children:[e.jsx("div",{className:"absolute left-0 transition-all",style:(()=>{if(!x)return{opacity:0};const e=m?1:.4,t=m?"3px":"2px";return"first"===x?{backgroundColor:B,opacity:e,width:t,top:"6px",bottom:0,borderRadius:"0 9999px 0 0"}:"middle"===x?{backgroundColor:B,opacity:e,width:t,top:0,bottom:0,borderRadius:0}:"last"===x?{backgroundColor:B,opacity:e,width:t,top:0,bottom:"6px",borderRadius:"0 0 9999px 0"}:{backgroundColor:B,opacity:e,width:t,top:"6px",bottom:"6px",borderRadius:"9999px"}})()}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsxs("div",{className:"relative flex-shrink-0 mt-0.5",children:[e.jsx(Ee,{packet:t,variant:"avatar",size:"sm"}),y&&e.jsx(c,{className:"absolute -right-1 -bottom-1 w-2.5 h-2.5 text-amber-400 animate-spin"})]}),e.jsxs("div",{className:"flex-1 min-w-0 space-y-0.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"font-semibold text-[14px] text-white tracking-tight",children:S||"—"}),P&&e.jsx("span",{className:"text-[12px] text-white/40 truncate max-w-[80px]",children:P}),e.jsx("div",{className:"flex-1"}),e.jsx(U,{color:g,className:"flex-shrink-0 !text-[9px] !px-1.5 !py-0",children:h}),e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[e.jsx("span",{className:"text-[10px] font-mono text-white/50 tabular-nums w-[28px] text-right",children:t.rssi}),e.jsx(fe,{rssi:t.rssi,compact:!0,showValues:!1})]})]}),e.jsxs("div",{className:"flex items-center gap-1 text-[10px] text-white/40 font-mono",children:[e.jsx("span",{className:"tabular-nums",children:$(t.timestamp)}),e.jsx(U,{color:f,className:"!text-[8px] !px-1 !py-0 !leading-none",children:u.charAt(0)}),C>0&&e.jsxs("span",{className:"text-white/30",children:[C,"h"]}),_>0&&e.jsxs("span",{className:"text-white/30",children:[_,"B"]}),T>0&&e.jsxs("span",{className:T>1?"text-amber-400/60":"text-white/30",children:["LBT:",T]}),null!=t.snr&&e.jsxs("span",{className:"text-white/30",children:[t.snr.toFixed(0),"dB"]})]}),C>0&&e.jsx("div",{className:"pt-0.5",children:e.jsx(Re,{path:k,localHash:a})})]})]})]})});function We(e){if(e.contact_type){const t=e.contact_type.toLowerCase();if("repeater"===t||"rep"===t)return!0;if("companion"===t||"client"===t||"cli"===t)return!1;if("room server"===t||"room_server"===t||"room"===t||"server"===t)return!1}return!0===e.is_repeater||(e.is_repeater,!1)}const Ge=t.lazy(()=>Ne(()=>import("./PathMapMapLibre-ChIFu4o3.js"),__vite__mapDeps([0,1,2,3,4,5,6,7])));function qe(e){return`${(100*e).toFixed(0)}%`}function Ke(e,t){const s=document.documentElement,a=getComputedStyle(s),n={success:a.getPropertyValue("--accent-success").trim()||"#39D98A",secondary:a.getPropertyValue("--accent-secondary").trim()||"#F9D26F",poor:a.getPropertyValue("--signal-poor").trim()||"#FF8A5C",danger:a.getPropertyValue("--accent-danger").trim()||"#FF5C7A",muted:a.getPropertyValue("--text-muted").trim()||"#767688"};let r;return r=0===t?n.muted:e>=1?n.success:e>=.5?n.secondary:e>=.25?n.poor:e>0?n.danger:n.muted,{color:r}}class Ye extends t.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}render(){return this.state.hasError?e.jsxs("div",{className:"h-[200px] flex items-center justify-center text-text-muted",children:[e.jsx(x,{className:"w-4 h-4 mr-2"}),"Map failed to load"]}):this.props.children}}function Je({path:s,neighbors:a,localNode:n,localHash:r,srcHash:l,dstHash:i,neighborAffinity:c,prefixLookup:x,hubNodes:m,traceSnr:p,advertiserSource:h}){const[u,g]=t.useState(null),f=t.useMemo(()=>{if(!h)return null;const e="wardrive"===h.nodeType;return{prefix:h.prefix||"??",candidates:[{hash:h.publicKey||h.prefix||"source",name:h.name,latitude:h.latitude,longitude:h.longitude,probability:1,isLocal:!1,isWardrive:e}],confidence:1,totalMatches:1,isSource:!0}},[h]),j=t.useMemo(()=>{if(h)return null;if(!l)return null;const e=W(l),t=a[l];if((null==t?void 0:t.latitude)&&(null==t?void 0:t.longitude)&&(0!==t.latitude||0!==t.longitude))return{prefix:e,candidates:[{hash:l,name:t.node_name||t.name||"Source",latitude:t.latitude,longitude:t.longitude,probability:1,isLocal:!1,isDirectNeighbor:!0===t.zero_hop}],confidence:1,totalMatches:1,isSource:!0};const s=(null==t?void 0:t.node_name)||(null==t?void 0:t.name)||l.slice(0,8);return{prefix:e,candidates:[{hash:l,name:s,latitude:0,longitude:0,probability:1,isLocal:!1}],confidence:1,totalMatches:1,isSource:!0}},[h,l,a]),y=t.useMemo(()=>{const e=(null==i?void 0:i.startsWith("0x"))?i.slice(2):i;if((!e||"00"===e||"0000000000000000"===e)&&n&&r){const e=W(r),t=0!==n.latitude||0!==n.longitude;return{prefix:e,candidates:[{hash:r,name:n.name||"Local Node",latitude:t?n.latitude:0,longitude:t?n.longitude:0,probability:1,isLocal:!0}],confidence:1,totalMatches:1,isDestination:!0}}if(!i)return null;const t=W(i);if(r&&i===r&&n){const e=0!==n.latitude||0!==n.longitude;return{prefix:t,candidates:[{hash:i,name:n.name||"Local Node",latitude:e?n.latitude:0,longitude:e?n.longitude:0,probability:1,isLocal:!0}],confidence:1,totalMatches:1,isDestination:!0}}const s=a[i];if((null==s?void 0:s.latitude)&&(null==s?void 0:s.longitude)&&(0!==s.latitude||0!==s.longitude))return{prefix:t,candidates:[{hash:i,name:s.node_name||s.name||"Destination",latitude:s.latitude,longitude:s.longitude,probability:1,isLocal:!1,isDirectNeighbor:!0===s.zero_hop}],confidence:1,totalMatches:1,isDestination:!0};const l=(null==s?void 0:s.node_name)||(null==s?void 0:s.name)||i.slice(0,8);return{prefix:t,candidates:[{hash:i,name:l,latitude:0,longitude:0,probability:1,isLocal:!1}],confidence:1,totalMatches:1,isDestination:!0}},[i,a,n,r]),b=t.useMemo(()=>function(e,t,s,a,n,r){if(!e||0===e.length)return{hops:[],overallConfidence:0,hasValidPath:!1};const l=e.length-1,i=e.map((i,c)=>{const o=c===l,d=e.length-c,{candidates:x,totalMatches:m}=function(e,t,s,a,n=!1,r,l,i){const c=function(e){const t={};for(const[s,a]of Object.entries(e))We(a)&&(t[s]=a);return t}(t);let o;if(l){const t=function(e,t,s){const a=t.toUpperCase(),n=e.get(a);if(!n||0===n.candidates.length)return{hash:null,confidence:0};if(null==s?void 0:s.isLastHop)return{hash:n.bestMatch,confidence:n.confidence};if(1===(null==s?void 0:s.position))return{hash:n.bestMatch,confidence:n.confidence};if((null==s?void 0:s.position)&&n.bestMatchForPosition.has(s.position)){const e=n.bestMatchForPosition.get(s.position),t=Math.max(e.confidence,n.confidence);return{hash:e.hash,confidence:t}}if((null==s?void 0:s.adjacentPrefixes)&&s.adjacentPrefixes.length>0){let e=n.bestMatch,t=0;for(const a of n.candidates){let n=0;for(const e of s.adjacentPrefixes)n+=a.adjacentPrefixCounts.get(e.toUpperCase())||0;const r=a.combinedScore+n/Math.max(1,a.totalAdjacentObservations)*.3;r>t&&(t=r,e=a.hash)}return{hash:e,confidence:n.confidence}}return{hash:n.bestMatch,confidence:n.confidence}}(l,e,{position:i,isLastHop:n});o=t.confidence}const{matches:d,probability:x}=function(e,t,s,a,n=!1){const r=e.toUpperCase(),l=[],i=s&&O(r,s);i&&l.push(s);for(const p of Object.keys(t))O(r,p)&&l.push(p);if(n&&i&&s&&1===l.length)return{matches:l,probability:1,bestMatch:s};if(n&&i&&l.length>1){const e=l.filter(e=>e!==s);if(1===e.length)return{matches:l,probability:1,bestMatch:e[0]}}const c=l.length>0?1/l.length:0,o=[...l].sort();let d=null,x=-1;if(1===o.length)d=o[0];else if(o.length>1&&a){for(const e of o){const t=a.get(e),s=t?"number"==typeof t?t:t.combinedScore:0;s>x&&(x=s,d=e)}d||(d=o[0])}else o.length>0&&(d=o[0]);let m=c;if(l.length>1&&a&&x>0){let e=0;for(const t of l){const s=a.get(t);e+=s?"number"==typeof s?s:s.combinedScore:0}e>0&&(m=Math.min(.95,x/e))}return{matches:l,probability:m,bestMatch:d}}(e,c,a,r,n),m=d.length,p=[],h=e.toUpperCase(),u=s&&void 0!==s.latitude&&void 0!==s.longitude&&(0!==s.latitude||0!==s.longitude);for(const f of d){if(a&&O(h,a)&&f===a&&u&&s){p.push({hash:f,name:s.name||"Local Node",latitude:s.latitude,longitude:s.longitude,probability:n?1:x,isLocal:!0});continue}const e=c[f];(null==e?void 0:e.latitude)&&(null==e?void 0:e.longitude)&&(0!==e.latitude||0!==e.longitude)&&p.push({hash:f,name:e.node_name||e.name||"Unknown",latitude:e.latitude,longitude:e.longitude,probability:x,isLocal:!1,isDirectNeighbor:!0===e.zero_hop})}const g=p.length;if(1===g)p[0].probability=o??1;else if(g>1)if(void 0!==o&&o>0){p[0].probability=o;const e=1-o,t=g-1;p.slice(1).forEach(s=>{s.probability=e/t})}else{let e=0;const t=p.map(t=>{if(t.isLocal)return{candidate:t,score:1};const a=null==r?void 0:r.get(t.hash);let n=.5;var l;let i;return u&&s&&(n=(l=function(e,t,s,a){const n=(s-e)*Math.PI/180,r=(a-t)*Math.PI/180,l=Math.sin(n/2)*Math.sin(n/2)+Math.cos(e*Math.PI/180)*Math.cos(s*Math.PI/180)*Math.sin(r/2)*Math.sin(r/2);return 2*Math.atan2(Math.sqrt(l),Math.sqrt(1-l))*6371e3}(s.latitude,s.longitude,t.latitude,t.longitude))<100?1:l<500?.9:l<1e3?.7:l<5e3?.5:l<1e4?.3:.1),a?i=.3*n+.3*a.hopConsistencyScore+.4*a.frequencyScore:(i=n,t.isDirectNeighbor&&(i=Math.max(i,.8))),e+=i,{candidate:t,score:i}});if(e>0)t.forEach(({candidate:t,score:s})=>{t.probability=Math.min(.95,s/e)});else{const e=1/g;p.forEach(t=>t.probability=e)}}return{candidates:p,totalMatches:m}}(i,t,s,a,o,n,r,d),p=x.length>0?Math.max(...x.map(e=>e.probability)):0;return{prefix:i,candidates:x,confidence:p,totalMatches:m}}),c=i.reduce((e,t)=>0===t.confidence?0:e*t.confidence,1),o=i.some(e=>e.candidates.length>0);return{hops:i,overallConfidence:c,hasValidPath:o}}(s,a,n,r,c,x),[s,a,n,r,c,x]),N=t.useMemo(()=>{const e=[];f?e.push(f):j&&e.push(j),e.push(...b.hops),y&&e.push(y);const t=e.reduce((e,t)=>0===t.confidence?0:e*t.confidence,1),s=e.some(e=>e.candidates.some(e=>0!==e.latitude||0!==e.longitude));return{hops:e,overallConfidence:t,hasValidPath:s}},[f,j,b,y]);return N.hasValidPath?e.jsxs("div",{className:"h-full flex flex-col space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-text-muted",children:"Path Confidence:"}),e.jsx("span",{className:(v=N.overallConfidence,v>=1?"text-accent-success":v>=.5?"text-accent-secondary":v>=.25?"text-signal-poor":v>0?"text-accent-danger":"text-text-muted"),children:qe(N.overallConfidence)}),e.jsx("button",{className:"text-text-muted hover:text-text-secondary transition-colors",title:"Confidence is calculated based on how many known nodes match each path prefix. Multiple matches reduce confidence due to collision probability.",children:e.jsx(d,{className:"w-3 h-3"})})]}),e.jsxs("div",{className:"flex items-center gap-2 text-[10px]",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-accent-success"}),e.jsx("span",{className:"text-text-muted",children:"Exact"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-accent-secondary"}),e.jsx("span",{className:"text-text-muted",children:"Multi"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-text-muted"}),e.jsx("span",{className:"text-text-muted",children:"Unknown"})]})]})]}),e.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:e.jsx(Ye,{children:e.jsx(t.Suspense,{fallback:e.jsx("div",{className:"h-full bg-bg-elevated flex items-center justify-center text-text-muted text-sm",children:"Loading map..."}),children:e.jsx(Ge,{resolvedPath:N,localNode:n,hubNodes:m,hoveredHopIndex:u,onHoverHop:g,traceSnr:p})})})}),e.jsx("div",{className:"flex flex-wrap items-center gap-1.5",children:N.hops.map((t,s)=>{var a,n,r;const l=!0===t.isSource,i=!0===t.isDestination,c=u===s;let o;return o=l?`Source: ${(null==(a=t.candidates[0])?void 0:a.name)||"Unknown"}`:i?`Destination: ${(null==(n=t.candidates[0])?void 0:n.name)||"Unknown"}`:0===t.totalMatches?"No matching nodes found":1===t.totalMatches?`Exact match: ${(null==(r=t.candidates[0])?void 0:r.name)||"Unknown"}`:`${t.totalMatches} possible matches (${(100*t.confidence).toFixed(0)}% confidence)`,e.jsxs("div",{className:E("flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-mono cursor-pointer transition-all",c?"bg-accent-primary/20 ring-1 ring-accent-primary/50":"bg-bg-elevated hover:bg-bg-subtle",l&&"border border-accent-success/30",i&&"border border-accent-primary/30"),title:o,onMouseEnter:()=>g(s),onMouseLeave:()=>g(null),children:[l&&e.jsx("span",{className:"text-accent-success text-[8px] mr-0.5",children:"SRC"}),i&&e.jsx("span",{className:"text-accent-primary text-[8px] mr-0.5",children:"DST"}),e.jsx("span",{style:Ke(t.confidence,t.totalMatches),children:t.prefix}),!l&&!i&&t.totalMatches>1&&e.jsxs("span",{className:"text-text-muted",children:["×",t.totalMatches]}),!l&&!i&&0===t.totalMatches&&e.jsx("span",{className:"text-text-muted",children:"?"})]},s)})})]}):e.jsxs("div",{className:"flex items-center justify-center text-text-muted text-xs py-4",children:[e.jsx(o,{className:"w-3.5 h-3.5 mr-1.5 opacity-50"}),"No location data available for path nodes"]});var v}function Xe(e){return e.match(/.{1,2}/g)||[]}function Ze(e){return null!==e&&e.startsWith("payload:")}const et={red:"var(--sys-red)",orange:"var(--sys-orange)",amber:"var(--sys-amber)",yellow:"var(--sys-yellow)",lime:"var(--sys-green)",green:"var(--sys-green)",emerald:"var(--sys-green)",teal:"var(--sys-teal)",cyan:"var(--sys-cyan)",sky:"var(--sys-cyan)",blue:"var(--sys-blue)",indigo:"var(--sys-indigo)",violet:"var(--sys-indigo)",purple:"var(--sys-purple)",fuchsia:"var(--sys-pink)",pink:"var(--sys-pink)",rose:"var(--sys-red)",brown:"var(--sys-brown)",zinc:"var(--text-muted)"},tt=15,st="color-mix(in srgb, var(--bg-elevated) 60%, var(--bg-body))",at="\n inset 0 0 0 1px color-mix(in srgb, var(--text-primary) 6%, transparent),\n inset 0 1px 0 color-mix(in srgb, white 3%, transparent),\n 0 1px 2px color-mix(in srgb, black 5%, transparent)\n ",nt=2,rt={type:"tween",duration:.25,ease:[.25,.1,.25,1]};function lt(e,t){return e?`inset 0 0 0 ${nt}px ${et[t]}`:at}function it(e,t){return e?t:`color-mix(in srgb, ${t} ${tt}%, transparent)`}function ct({segments:s,selectedSegment:a,onSegmentClick:n}){const[r,l]=t.useState(null),[i,c]=t.useState(null),o=s.some(e=>void 0!==e.id)&&n,d=[];for(const e of s){const t=Xe(e.hex);for(const s of t)d.push({byte:s.toUpperCase(),color:e.color,id:e.id})}const x=[];for(let e=0;e{const d=t.length<16;return e.jsx("div",{className:"flex rounded-md overflow-hidden",children:t.map(({byte:s,color:x,id:m},p)=>{const h=p===t.length-1,u=d&&h,g=et[x],f=m?r===m:i===x,j=Boolean(m&&a===m),y=f||j;return e.jsx("span",{className:"w-[1.75rem] text-xs text-center py-0.5 font-mono select-none "+(o?"cursor-pointer":""),style:{backgroundColor:it(y,g),color:y?"rgba(255,255,255,0.95)":g,transition:y?"none":"background-color 0.15s ease-out, color 0.15s ease-out",touchAction:"manipulation",...u?{borderRadius:"0 0.375rem 0.375rem 0"}:{}},onMouseEnter:()=>{m?l(m):c(x)},onMouseLeave:()=>{l(null),c(null)},onClick:()=>m&&(null==n?void 0:n(m)),onTouchStart:()=>{m?l(m):c(x)},onTouchEnd:()=>{l(null),c(null)},children:s},p)})},s)})})}function ot({bits:t,field:s,value:a,binary:n}){return e.jsxs("tr",{children:[e.jsx("td",{className:"py-1.5 text-xs text-text-muted tabular-nums",children:t}),e.jsx("td",{className:"py-1.5 text-sm text-text-secondary",children:s}),e.jsx("td",{className:"py-1.5",children:(()=>{if("Payload Type"===s){const t=ye[a]||"zinc";return e.jsx(U,{color:t,children:a})}if("Route Type"===s){const t=je[a]||"zinc";return e.jsx(U,{color:t,children:a})}return e.jsx("span",{className:"text-sm text-text-primary",children:a})})()}),e.jsx("td",{className:"py-1.5 font-mono text-xs text-sys-cyan",children:n})]})}function dt({id:t,title:s,color:a,hexBytes:n,startByte:r,endByte:l,isSelected:i,children:c}){const o=n?Xe(n):[];return e.jsxs(p.div,{layout:"position",layoutId:t,transition:rt,className:"w-full min-w-0 overflow-hidden rounded-xl p-4 sm:p-5 space-y-4",style:{backgroundColor:st,boxShadow:lt(i,a)},children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-0.5 min-w-0",children:[e.jsx(U,{color:a,children:s}),o.length>0&&o.length<=16&&o.map((t,s)=>e.jsx(U,{color:a,className:"font-mono",children:t.toUpperCase()},s))]}),e.jsxs("span",{className:"text-[10px] text-text-muted font-mono flex-shrink-0",children:["Bytes ",r,"-",l]})]}),e.jsx("div",{className:"min-w-0 overflow-hidden",children:c})]})}function xt({advert:t,timestamp:s}){const a=q(s||t.timestamp);return e.jsx("div",{className:"mb-4",children:e.jsxs("div",{className:"rounded-2xl overflow-hidden bg-purple-500/10 dark:bg-purple-400/10",style:{backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)"},children:[e.jsxs("div",{className:"px-4 pt-4 pb-3 flex items-center gap-3",children:[e.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center shadow-lg",style:{background:"linear-gradient(135deg, var(--sys-purple) 0%, var(--sys-blue) 100%)"},children:e.jsx(v,{className:"w-6 h-6 text-white"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-lg font-semibold text-text-primary font-sans truncate leading-tight",children:t.name||"Unknown Node"}),e.jsx("p",{className:"text-sm text-text-muted font-sans mt-0.5",children:t.nodeType})]})]}),e.jsx("div",{className:"mx-4 border-t border-black/10 dark:border-white/10"}),e.jsxs("div",{className:"px-4 py-3 space-y-2",children:[void 0!==t.latitude&&void 0!==t.longitude&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(o,{className:"w-4 h-4 text-purple-600 dark:text-purple-400 flex-shrink-0"}),e.jsxs("span",{className:"text-sm text-text-secondary font-mono",children:[t.latitude.toFixed(5),"°, ",t.longitude.toFixed(5),"°"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(g,{className:"w-4 h-4 text-purple-600 dark:text-purple-400 flex-shrink-0"}),e.jsx("span",{className:"text-sm text-text-secondary font-sans",children:a})]})]})]})})}function mt({decoded:t,timestamp:s}){const a=s?q(s):"Unknown";return e.jsx("div",{className:"mb-4",children:e.jsxs("div",{className:"rounded-2xl overflow-hidden bg-teal-500/10 dark:bg-teal-400/10",style:{backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)"},children:[e.jsxs("div",{className:"px-4 pt-4 pb-3 flex items-center gap-3",children:[e.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center shadow-lg",style:{background:"linear-gradient(135deg, var(--sys-teal) 0%, var(--sys-cyan) 100%)"},children:e.jsx(N,{className:"w-6 h-6 text-white"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-lg font-semibold text-text-primary font-sans truncate leading-tight",children:t.channelName||"Channel Data"}),e.jsxs("p",{className:"text-sm text-text-muted font-sans mt-0.5",children:[t.dataLength," bytes • ",t.decrypted?"Decrypted":"Encrypted"]})]})]}),e.jsx("div",{className:"mx-4 border-t border-black/10 dark:border-white/10"}),e.jsxs("div",{className:"px-4 py-3 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(u,{className:"w-4 h-4 text-teal-600 dark:text-teal-400 flex-shrink-0"}),e.jsxs("span",{className:"text-sm text-text-secondary font-sans",children:["Channel: ",e.jsxs("span",{className:"font-mono",children:["0x",t.channelHash]})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(g,{className:"w-4 h-4 text-teal-600 dark:text-teal-400 flex-shrink-0"}),e.jsx("span",{className:"text-sm text-text-secondary font-sans",children:a})]}),t.decrypted&&t.decryptedHex&&e.jsxs("div",{className:"mt-2 pt-2 border-t border-black/10 dark:border-white/10",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-text-muted mb-1 font-sans",children:"Decrypted Data"}),e.jsx("div",{className:"max-w-full overflow-x-auto",children:e.jsx(ve,{size:"compact",copy:!0,className:"inline-block",children:e.jsx("span",{className:"break-all text-xs",children:t.decryptedHex.toUpperCase()})})})]})]})]})})}function pt({decoded:t,timestamp:s,isLoading:a=!1}){const n=s?q(s):"Unknown";return a?e.jsx("div",{className:"mb-4",children:e.jsxs("div",{className:"rounded-xl p-4 sm:p-5",style:{backgroundColor:"color-mix(in srgb, var(--bg-elevated) 60%, var(--bg-body))",boxShadow:"\n inset 0 0 0 1px color-mix(in srgb, var(--text-primary) 6%, transparent),\n inset 0 1px 0 color-mix(in srgb, white 3%, transparent),\n 0 1px 2px color-mix(in srgb, black 5%, transparent)\n "},children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3 h-[15px]",children:[e.jsx("div",{className:"h-2.5 w-12 rounded bg-white/[0.08] animate-pulse"}),e.jsx("div",{className:"h-2.5 w-16 rounded bg-white/[0.08] animate-pulse"})]}),e.jsx("div",{className:"inline-block max-w-[85%] px-3.5 py-2 rounded-2xl rounded-tl-md",style:{background:"color-mix(in srgb, var(--sys-blue) 30%, transparent)"},children:e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("div",{className:"h-3.5 w-48 rounded bg-white/[0.15] animate-pulse"}),e.jsx("div",{className:"h-3.5 w-32 rounded bg-white/[0.15] animate-pulse"})]})})]})}):t.decrypted?e.jsx("div",{className:"mb-4",children:e.jsxs("div",{className:"rounded-xl p-4 sm:p-5",style:{backgroundColor:"color-mix(in srgb, var(--bg-elevated) 60%, var(--bg-body))",boxShadow:"\n inset 0 0 0 1px color-mix(in srgb, var(--text-primary) 6%, transparent),\n inset 0 1px 0 color-mix(in srgb, white 3%, transparent),\n 0 1px 2px color-mix(in srgb, black 5%, transparent)\n "},children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[t.senderName&&e.jsxs("span",{className:"text-[11px] text-text-muted font-sans",children:["From ",e.jsx("span",{className:"text-text-secondary font-medium",children:t.senderName})]}),t.channelName&&e.jsxs("span",{className:"text-[11px] text-text-muted font-sans",children:["in ",e.jsx("span",{className:"text-sys-cyan font-medium",children:t.channelName})]})]}),e.jsx("div",{className:"inline-block max-w-[85%] px-3.5 py-2 rounded-2xl rounded-tl-md",style:{background:"linear-gradient(135deg, var(--sys-blue) 0%, color-mix(in srgb, var(--sys-blue) 85%, var(--sys-cyan)) 100%)"},children:e.jsx("p",{className:"text-sm text-white font-sans leading-relaxed whitespace-pre-wrap break-words",children:t.text})})]})}):e.jsx("div",{className:"mb-4",children:e.jsxs("div",{className:"rounded-2xl overflow-hidden bg-zinc-500/10 dark:bg-zinc-400/10",style:{backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)"},children:[e.jsxs("div",{className:"px-4 pt-4 pb-3 flex items-center gap-3",children:[e.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center shadow-lg",style:{background:"linear-gradient(135deg, var(--sys-zinc) 0%, color-mix(in srgb, var(--sys-zinc) 70%, black) 100%)"},children:e.jsx(f,{className:"w-6 h-6 text-white"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-lg font-semibold text-text-primary font-sans truncate leading-tight",children:"Encrypted Message"}),e.jsxs("p",{className:"text-sm text-text-muted font-sans mt-0.5",children:["Channel hash: ",e.jsxs("span",{className:"font-mono",children:["0x",t.channelHash]})]})]})]}),e.jsx("div",{className:"mx-4 border-t border-black/10 dark:border-white/10"}),e.jsxs("div",{className:"px-4 py-3 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(g,{className:"w-4 h-4 text-zinc-500 dark:text-zinc-400 flex-shrink-0"}),e.jsx("span",{className:"text-sm text-text-secondary font-sans",children:n})]}),e.jsx("p",{className:"text-xs text-text-muted",children:"Private channel or unknown hash channel. Channel secret required for decryption."})]})]})})}function ht({decoded:t,timestamp:s}){const a=s?q(s):"Unknown";return e.jsxs("div",{className:"mb-4 flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl flex items-center justify-center shadow-md",style:{background:"linear-gradient(135deg, var(--sys-green) 0%, var(--sys-teal) 100%)"},children:e.jsx(b,{className:"w-5 h-5 text-white"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-semibold text-text-primary font-sans",children:"Acknowledgment"}),e.jsxs("p",{className:"text-xs text-text-muted font-sans mt-0.5",children:["CRC: ",e.jsxs("span",{className:"font-mono text-sys-green",children:["0x",t.crc]})," · ",a]})]})]})}function ut({decoded:t,timestamp:s}){const a=s?q(s):"Unknown",n=t.path.length;return e.jsx("div",{className:"mb-4",children:e.jsxs("div",{className:"rounded-2xl overflow-hidden bg-amber-500/10 dark:bg-amber-400/10",style:{backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)"},children:[e.jsxs("div",{className:"px-4 pt-4 pb-3 flex items-center gap-3",children:[e.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center shadow-lg",style:{background:"linear-gradient(135deg, var(--sys-amber) 0%, var(--sys-orange) 100%)"},children:e.jsx(y,{className:"w-6 h-6 text-white"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-lg font-semibold text-text-primary font-sans truncate leading-tight",children:"Path Response"}),e.jsxs("p",{className:"text-sm text-text-muted font-sans mt-0.5",children:[n," ",1===n?"hop":"hops"]})]})]}),e.jsx("div",{className:"mx-4 border-t border-black/10 dark:border-white/10"}),e.jsxs("div",{className:"px-4 py-3 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(g,{className:"w-4 h-4 text-amber-600 dark:text-amber-400 flex-shrink-0"}),e.jsx("span",{className:"text-sm text-text-secondary font-sans",children:a})]}),t.path.length>0&&e.jsx("div",{className:"mt-2 pt-2 border-t border-black/10 dark:border-white/10",children:e.jsx("div",{className:"flex flex-wrap items-center gap-2",children:t.path.map((t,s)=>e.jsxs("div",{className:"flex items-center gap-2",children:[s>0&&e.jsx(r,{className:"w-4 h-4 text-amber-500 dark:text-amber-400"}),e.jsx(U,{color:"amber",className:"font-mono",children:t})]},s))})})]})]})})}function gt({decoded:t,timestamp:s}){const a=s?q(s):"Unknown",n=t.pathHashes.length,l=t.snrValues.length;return e.jsx("div",{className:"mb-4",children:e.jsxs("div",{className:"rounded-2xl overflow-hidden bg-blue-500/10 dark:bg-blue-400/10",style:{backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)"},children:[e.jsxs("div",{className:"px-4 pt-4 pb-3 flex items-center gap-3",children:[e.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center shadow-lg",style:{background:"linear-gradient(135deg, var(--sys-blue) 0%, var(--sys-indigo) 100%)"},children:e.jsx(j,{className:"w-6 h-6 text-white"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("h3",{className:"text-lg font-medium text-text-primary truncate leading-tight",children:["Trace ",t.isComplete?"Complete":"In Progress"]}),e.jsxs("p",{className:"text-sm text-text-muted mt-0.5",children:["Tag: 0x",t.traceTag.slice(0,8),t.isComplete&&" • ✓"]})]})]}),e.jsx("div",{className:"mx-4 border-t border-black/10 dark:border-white/10"}),e.jsxs("div",{className:"px-4 py-3 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(g,{className:"w-4 h-4 text-blue-600 dark:text-blue-400 flex-shrink-0"}),e.jsx("span",{className:"text-sm text-text-secondary",children:a})]}),e.jsxs("div",{className:"flex items-center gap-4 text-xs text-text-muted",children:[e.jsxs("span",{children:[n," target ",1===n?"hop":"hops"]}),e.jsx("span",{children:"•"}),e.jsxs("span",{children:[l," SNR ",1===l?"sample":"samples"]}),0!==t.authCode&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"•"}),e.jsxs("span",{children:["Auth: ",t.authCode]})]})]}),t.pathHashes.length>0&&e.jsx("div",{className:"flex flex-wrap items-center gap-2 pt-1",children:t.pathHashes.map((s,a)=>{const n=t.snrValues[a],l=void 0!==n?(e=>e>=7?"green":e>=0?"yellow":e>=-5?"orange":"red")(n):"zinc",i=void 0!==n;return e.jsxs("div",{className:"flex items-center gap-2",children:[a>0&&e.jsx(r,{className:"w-4 h-4 text-blue-500 dark:text-blue-400 flex-shrink-0"}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(U,{color:i?"blue":"zinc",className:"font-mono",children:s}),i&&e.jsxs(U,{color:l,className:"font-mono",children:[n>=0?"+":"",Number.isInteger(n)?n:n.toFixed(1),"dB"]})]})]},a)})})]})]})})}function ft({decoded:t,timestamp:s}){const a=s?q(s):"Unknown";return t.encrypted?e.jsxs("div",{className:"mb-4 flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl flex items-center justify-center shadow-md",style:{background:"linear-gradient(135deg, var(--sys-purple) 0%, var(--sys-indigo) 100%)"},children:e.jsx(f,{className:"w-5 h-5 text-white"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-semibold text-text-primary font-sans",children:"Encrypted Message"}),e.jsxs("p",{className:"text-xs text-text-muted font-sans mt-0.5",children:[t.srcHash," → ",t.destHash," · ",a]})]})]}):e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1.5 px-1",children:[e.jsxs("span",{className:"text-[11px] text-text-muted font-sans",children:[e.jsx("span",{className:"font-mono text-text-secondary",children:t.srcHash})," → ",e.jsx("span",{className:"font-mono text-text-secondary",children:t.destHash})]}),e.jsxs("span",{className:"text-[11px] text-text-muted font-sans",children:["· ",a]})]}),e.jsx("div",{className:"inline-block max-w-[85%] px-3.5 py-2 rounded-2xl rounded-tr-md ml-auto",style:{background:"linear-gradient(135deg, var(--sys-green) 0%, var(--sys-teal) 100%)"},children:e.jsx("p",{className:"text-sm text-white font-sans leading-relaxed whitespace-pre-wrap break-words",children:t.text})})]})}function jt({decoded:t,timestamp:s}){const a=s?q(s):"Unknown",n=(t.partNumber+1)/t.totalParts*100;return e.jsx("div",{className:"mb-4",children:e.jsxs("div",{className:"rounded-2xl overflow-hidden bg-yellow-500/10 dark:bg-yellow-400/10",style:{backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)"},children:[e.jsxs("div",{className:"px-4 pt-4 pb-3 flex items-center gap-3",children:[e.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center shadow-lg",style:{background:"linear-gradient(135deg, var(--sys-yellow) 0%, var(--sys-amber) 100%)"},children:e.jsx(h,{className:"w-6 h-6 text-white"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-lg font-semibold text-text-primary font-sans truncate leading-tight",children:"Multipart Segment"}),e.jsxs("p",{className:"text-sm text-text-muted font-sans mt-0.5",children:["Part ",t.partNumber+1," of ",t.totalParts]})]})]}),e.jsx("div",{className:"mx-4 border-t border-black/10 dark:border-white/10"}),e.jsxs("div",{className:"px-4 py-3 space-y-3",children:[e.jsx("div",{children:e.jsx("div",{className:"h-2 bg-black/10 dark:bg-white/10 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${n}%`,background:"linear-gradient(90deg, var(--sys-yellow), var(--sys-amber))"}})})}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(u,{className:"w-4 h-4 text-yellow-600 dark:text-yellow-400 flex-shrink-0"}),e.jsxs("span",{className:"text-sm text-text-secondary font-sans",children:["Message ID: ",e.jsx("span",{className:"font-mono",children:t.messageId})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(g,{className:"w-4 h-4 text-yellow-600 dark:text-yellow-400 flex-shrink-0"}),e.jsx("span",{className:"text-sm text-text-secondary font-sans",children:a})]})]})]})})}function yt({decoded:t,timestamp:s,payloadType:a}){const n=s?q(s):"Unknown",r=(()=>{switch(a){case xe.REQ:return{icon:C,gradient:"var(--sys-orange), var(--sys-red)",bg:"rgba(249, 115, 22, 0.15)",label:"Request"};case xe.RESPONSE:return{icon:k,gradient:"var(--sys-green), var(--sys-teal)",bg:"rgba(34, 197, 94, 0.15)",label:"Response"};case xe.ANON_REQ:return{icon:f,gradient:"var(--sys-purple), var(--sys-pink)",bg:"rgba(168, 85, 247, 0.15)",label:"Anonymous Request"};default:return{icon:w,gradient:"var(--sys-gray), var(--sys-slate)",bg:"rgba(107, 114, 128, 0.15)",label:t.payloadTypeName}}})(),l=r.icon;return e.jsxs("div",{className:"mb-4 flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl flex items-center justify-center shadow-md",style:{background:`linear-gradient(135deg, ${r.gradient})`},children:e.jsx(l,{className:"w-5 h-5 text-white"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-semibold text-text-primary font-sans",children:r.label}),e.jsxs("p",{className:"text-xs text-text-muted font-sans mt-0.5",children:[t.length," bytes · ",n]})]})]})}function bt({pathHex:t}){if(!t)return null;const s=Xe(t);return e.jsx("div",{className:"flex flex-wrap items-center gap-2 py-2",children:s.map((t,s)=>e.jsxs("div",{className:"flex items-center gap-2",children:[s>0&&e.jsx(r,{className:"w-4 h-4 text-sys-amber flex-shrink-0"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(ve,{size:"compact",copy:!0,children:t.toUpperCase()}),e.jsx("span",{className:"text-[10px] text-text-muted font-sans tabular-nums w-4 text-left",children:s+1})]})]},s))})}function Nt({decoded:t,payloadType:s}){const a=he[s]||`TYPE_${s}`;switch(t.type){case"advert":{const s="chat"===t.nodeType?"companion":t.nodeType.replace("_"," "),a=void 0!==t.latitude&&void 0!==t.longitude&&!(0===t.latitude&&0===t.longitude);return e.jsxs("div",{className:"text-xs text-text-primary space-y-0.5",children:[e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Role:"})," ",s]}),t.name&&e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Name:"})," ",t.name]}),a&&e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Location:"})," ",t.latitude.toFixed(4),"°, ",t.longitude.toFixed(4),"°"]}),e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Time:"})," ",q(t.timestamp)]}),e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Flags:"})," ",t.flagsDescription]})]})}case"ack":return e.jsx("div",{className:"text-xs text-text-primary space-y-0.5",children:e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"CRC:"})," 0x",t.crc]})});case"path":return e.jsx("div",{className:"text-xs text-text-primary space-y-1",children:e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Path:"})," ",t.pathString||"(empty)"]})});case"trace":return e.jsxs("div",{className:"text-xs text-text-primary space-y-1",children:[e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Tag:"})," 0x",t.traceTag]}),e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Target Path:"})," ",t.pathString||"(empty)"]}),t.snrValues.length>0&&e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"SNR:"})," ",t.snrValues.map(e=>`${e>=0?"+":""}${Number.isInteger(e)?e:e.toFixed(1)}dB`).join(" → ")]}),e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Status:"})," ",t.isComplete?"✓ Complete":`In progress (${t.snrValues.length}/${t.pathHashes.length})`]})]});case"txt_msg":return e.jsxs("div",{className:"text-xs text-text-primary space-y-0.5",children:[e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Dest:"})," ",t.destHash]}),e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Src:"})," ",t.srcHash]}),t.encrypted?e.jsx("p",{className:"text-text-muted italic",children:"Encrypted content"}):e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Text:"})," ",t.text]})]});case"grp_txt":return e.jsxs("div",{className:"text-xs text-text-primary space-y-0.5",children:[e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Channel:"})," ",t.channelName?e.jsx("span",{className:"text-accent-success",children:t.channelName}):e.jsxs("span",{className:"font-mono",children:["0x",t.channelHash]})]}),t.decrypted?e.jsxs(e.Fragment,{children:[t.senderName&&e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"From:"})," ",t.senderName]}),e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Text:"})," ",t.text]})]}):e.jsx("p",{className:"text-text-muted italic",children:"Encrypted (unknown channel)"})]});case"grp_data":return e.jsxs("div",{className:"text-xs text-text-primary space-y-0.5",children:[e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Channel:"})," ",t.channelName?e.jsx("span",{className:"text-sys-teal",children:t.channelName}):e.jsxs("span",{className:"font-mono",children:["0x",t.channelHash]})]}),e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Data:"})," ",t.dataLength," bytes ",t.decrypted?"(decrypted)":"(encrypted)"]})]});case"multipart":return e.jsxs("div",{className:"text-xs text-text-primary space-y-0.5",children:[e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Part:"})," ",t.partNumber+1,"/",t.totalParts]}),e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Message ID:"})," ",t.messageId]})]});default:return e.jsxs("p",{className:"text-xs text-text-secondary",children:[a," (",t.length," bytes)"]})}}const vt=t.memo(function({packet:s}){var a;const n=s.raw_packet||"",l=n.length/2,i=G(),[c,o]=t.useState(null),[d,x]=t.useState(null),[h,u]=t.useState(!1),[g,f]=t.useState(null),j=t.useCallback(e=>{f(t=>t===e?null:e)},[]),y=t.useMemo(()=>function(e){if(!e||e.length<4)return null;const t=re.fromHex(e);if(!t.success||!t.packet)return null;const s=t.packet,a=function(e){const t=3&e,s=e>>2&15,a=e>>6&3;return[{bits:"0-1",field:"Route Type",value:ie(t),binary:(3&t).toString(2).padStart(2,"0")},{bits:"2-5",field:"Payload Type",value:ce(s),binary:(15&s).toString(2).padStart(4,"0")},{bits:"6-7",field:"Version",value:a.toString(),binary:(3&a).toString(2).padStart(2,"0")}]}(s.header),n=e.slice(0,2);let r=2,l="";s.hasTransportCodes()&&(l=e.slice(2,10),r=10);const i=e.slice(r,r+2),c=r+2,o=c+2*s.pathLen,d=e.slice(c,o),x=e.slice(o),m=le(s);return{packet:s,headerHex:n,headerFields:a,transportCodesHex:l,pathLengthHex:i,pathDataHex:d,payloadHex:x,payloadStartByte:Math.floor(o/2),decoded:m}}(n),[n]),b=(null==(a=null==y?void 0:y.packet)?void 0:a.payloadType)===xe.GRP_TXT&&(!i||h);if(t.useEffect(()=>{if(!(null==y?void 0:y.packet)||y.packet.payloadType!==xe.GRP_TXT)return o(null),void u(!1);if(!i)return void u(!0);u(!0);let e=!1;return me(y.packet.payload).then(t=>{e||(t&&o(t),u(!1))}),()=>{e=!0}},[null==y?void 0:y.packet,i]),t.useEffect(()=>{if(!(null==y?void 0:y.packet)||y.packet.payloadType!==xe.GRP_DATA)return void x(null);if(!i)return;let e=!1;return pe(y.packet.payload).then(t=>{!e&&t&&x(t)}),()=>{e=!0}},[null==y?void 0:y.packet,i]),!y||0===n.length)return e.jsx("div",{className:"p-4 text-center text-text-muted",children:e.jsx("p",{className:"text-sm",children:"No raw packet data available"})});const{packet:N}=y;let v=y.decoded;c&&"grp_txt"===y.decoded.type?v=c:d&&"grp_data"===y.decoded.type&&(v=d);const w=t.useMemo(()=>function(t,s){switch(t.type){case"advert":return function(t,s){const a=[];let n=0;const r=s.slice(0,64);a.push({id:"payload:publicKey",title:"Public Key",color:"pink",hex:r,startByte:n,endByte:n+31,decoded:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-[11px] text-text-secondary break-all p-2 rounded bg-bg-body/50 font-mono",children:t.publicKey.toUpperCase()}),e.jsx("p",{className:"text-xs text-text-muted mt-1",children:"Ed25519 public key (32 bytes)"})]})}),n+=32;const l=s.slice(64,72);a.push({id:"payload:timestamp",title:"Timestamp",color:"orange",hex:l,startByte:n,endByte:n+3,decoded:e.jsxs(e.Fragment,{children:[e.jsx(ve,{size:"standard",copy:!0,children:l.toUpperCase()}),e.jsxs("p",{className:"text-xs text-text-primary mt-1",children:[t.timestamp," (",q(t.timestamp),")"]})]})}),n+=4;const i=s.slice(72,200);a.push({id:"payload:signature",title:"Signature",color:"teal",hex:i,startByte:n,endByte:n+63,decoded:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-[11px] text-text-secondary break-all p-2 rounded bg-bg-body/50 font-mono",children:t.signature.toUpperCase()}),e.jsx("p",{className:"text-xs text-text-muted mt-1",children:"Ed25519 signature (64 bytes)"})]})}),n+=64;const c=s.slice(200,202);if(a.push({id:"payload:flags",title:"Flags",color:"blue",hex:c,startByte:n,endByte:n,decoded:e.jsxs(e.Fragment,{children:[e.jsxs(ve,{size:"standard",copy:!0,children:["0x",t.flags.toString(16).padStart(2,"0").toUpperCase()]}),e.jsx("p",{className:"text-xs text-text-primary mt-1",children:t.flagsDescription}),e.jsxs("p",{className:"text-xs text-text-muted",children:["Node Type: ",t.nodeType]})]})}),n+=1,void 0!==t.latitude){const r=s.slice(2*n,2*n+8);a.push({id:"payload:latitude",title:"Latitude",color:"green",hex:r,startByte:n,endByte:n+3,decoded:e.jsxs(e.Fragment,{children:[e.jsx(ve,{size:"standard",copy:!0,children:r.toUpperCase()}),e.jsxs("p",{className:"text-xs text-text-primary mt-1",children:[t.latitude.toFixed(6),"°"]})]})}),n+=4}if(void 0!==t.longitude){const r=s.slice(2*n,2*n+8);a.push({id:"payload:longitude",title:"Longitude",color:"purple",hex:r,startByte:n,endByte:n+3,decoded:e.jsxs(e.Fragment,{children:[e.jsx(ve,{size:"standard",copy:!0,children:r.toUpperCase()}),e.jsxs("p",{className:"text-xs text-text-primary mt-1",children:[t.longitude.toFixed(6),"°"]})]})}),n+=4}if(t.name){const r=s.slice(2*n),l=r.length/2;a.push({id:"payload:name",title:"Name",color:"amber",hex:r,startByte:n,endByte:n+l-1,decoded:e.jsxs(e.Fragment,{children:[e.jsx(ve,{size:"standard",copy:!0,children:r.toUpperCase()}),e.jsxs("p",{className:"text-xs text-text-primary mt-1",children:['"',t.name,'"']})]})})}return a}(t,s);case"ack":return function(t,s){return[{id:"payload:crc",title:"CRC",color:"green",hex:s.slice(0,8),startByte:0,endByte:3,decoded:e.jsxs(e.Fragment,{children:[e.jsxs(ve,{size:"standard",copy:!0,children:["0x",t.crc]}),e.jsx("p",{className:"text-xs text-text-muted mt-1",children:"CRC32 of acknowledged packet"})]})}]}(t,s);case"grp_txt":return function(t,s){const a=[];a.push({id:"payload:channelHash",title:"Channel Hash",color:"blue",hex:s.slice(0,2),startByte:0,endByte:0,decoded:e.jsxs(e.Fragment,{children:[e.jsxs(ve,{size:"standard",copy:!0,children:["0x",t.channelHash]}),t.channelName&&e.jsxs("p",{className:"text-xs text-text-primary mt-1",children:["Channel: ",t.channelName]})]})}),t.macHex&&a.push({id:"payload:mac",title:"MAC",color:"purple",hex:s.slice(2,6),startByte:1,endByte:2,decoded:e.jsxs(e.Fragment,{children:[e.jsx(ve,{size:"standard",copy:!0,children:t.macHex.toUpperCase()}),e.jsx("p",{className:"text-xs text-text-muted mt-1",children:"Truncated HMAC-SHA256"})]})});const n=s.slice(6);return n&&a.push({id:"payload:ciphertext",title:t.decrypted?"Message":"Ciphertext",color:t.decrypted?"green":"zinc",hex:n,startByte:3,endByte:3+n.length/2-1,decoded:t.decrypted?e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-sm text-text-primary",children:['"',t.text,'"']}),t.senderName&&e.jsxs("p",{className:"text-xs text-text-muted mt-1",children:["From: ",t.senderName]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-[11px] text-text-secondary break-all p-2 rounded bg-bg-body/50 font-mono",children:n.toUpperCase()}),e.jsx("p",{className:"text-xs text-text-muted mt-1",children:"AES-128-ECB encrypted"})]})}),a}(t,s);case"grp_data":return function(t,s){const a=[];a.push({id:"payload:channelHash",title:"Channel Hash",color:"blue",hex:s.slice(0,2),startByte:0,endByte:0,decoded:e.jsxs(e.Fragment,{children:[e.jsxs(ve,{size:"standard",copy:!0,children:["0x",t.channelHash]}),t.channelName&&e.jsxs("p",{className:"text-xs text-text-primary mt-1",children:["Channel: ",t.channelName]})]})}),t.macHex&&a.push({id:"payload:mac",title:"MAC",color:"purple",hex:s.slice(2,6),startByte:1,endByte:2,decoded:e.jsxs(e.Fragment,{children:[e.jsx(ve,{size:"standard",copy:!0,children:t.macHex.toUpperCase()}),e.jsx("p",{className:"text-xs text-text-muted mt-1",children:"Truncated HMAC-SHA256"})]})});const n=s.slice(6);return n&&a.push({id:"payload:ciphertext",title:t.decrypted?"Decrypted Data":"Encrypted Data",color:t.decrypted?"green":"zinc",hex:n,startByte:3,endByte:3+n.length/2-1,decoded:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-[11px] text-text-secondary break-all p-2 rounded bg-bg-body/50 font-mono",children:(t.decryptedHex||n).toUpperCase()}),e.jsxs("p",{className:"text-xs text-text-muted mt-1",children:[t.dataLength," bytes",t.decrypted?"":" (AES-128-ECB encrypted)"]})]})}),a}(t,s);case"path":return function(t,s){return[{id:"payload:path",title:"Path Hops",color:"amber",hex:s,startByte:0,endByte:s.length/2-1,decoded:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-wrap items-center gap-1",children:t.path.map((t,s)=>e.jsxs("span",{className:"flex items-center gap-1",children:[s>0&&e.jsx(r,{className:"w-3 h-3 text-text-muted"}),e.jsx(U,{color:"amber",className:"font-mono",children:t})]},s))}),e.jsxs("p",{className:"text-xs text-text-muted mt-1",children:[t.path.length," hops"]})]})}]}(t,s);case"trace":return function(t,s){const a=[];a.push({id:"payload:crc",title:"Trace Tag",color:"blue",hex:s.slice(0,8),startByte:0,endByte:3,decoded:e.jsxs(e.Fragment,{children:[e.jsxs(ve,{size:"standard",copy:!0,children:["0x",t.traceTag]}),e.jsx("p",{className:"text-xs text-text-muted mt-1",children:"Unique trace request identifier"})]})}),a.push({id:"payload:mac",title:"Auth Code",color:"purple",hex:s.slice(8,16),startByte:4,endByte:7,decoded:e.jsxs(e.Fragment,{children:[e.jsx(ve,{size:"standard",copy:!0,children:t.authCode}),e.jsx("p",{className:"text-xs text-text-muted mt-1",children:"Authentication/verification code"})]})}),a.push({id:"payload:flags",title:"Flags",color:"amber",hex:s.slice(16,18),startByte:8,endByte:8,decoded:e.jsxs(e.Fragment,{children:[e.jsxs(ve,{size:"standard",copy:!0,children:["0x",t.flags.toString(16).toUpperCase().padStart(2,"0")]}),e.jsx("p",{className:"text-xs text-text-muted mt-1",children:0===t.flags?"No flags set":`Flags: ${t.flags.toString(2).padStart(8,"0")}b`})]})});const n=s.slice(18);if(n){const s=e=>e>=7?"green":e>=0?"yellow":e>=-5?"orange":"red";a.push({id:"payload:path",title:"Target Path",color:"indigo",hex:n,startByte:9,endByte:9+n.length/2-1,decoded:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-wrap items-center gap-1",children:t.pathHashes.map((a,n)=>{const l=t.snrValues[n],i=void 0!==l?s(l):"zinc";return e.jsxs("span",{className:"flex items-center gap-1",children:[n>0&&e.jsx(r,{className:"w-3 h-3 text-text-muted"}),e.jsx(U,{color:"indigo",className:"font-mono",children:a}),void 0!==l&&e.jsxs(U,{color:i,className:"font-mono",children:[l>=0?"+":"",Number.isInteger(l)?l:l.toFixed(1),"dB"]})]},n)})}),e.jsxs("p",{className:"text-xs text-text-muted mt-1",children:[t.pathHashes.length," target ",1===t.pathHashes.length?"hop":"hops",t.snrValues.length>0&&` • ${t.snrValues.length} SNR ${1===t.snrValues.length?"value":"values"} collected`,t.isComplete&&" • ✓ Complete"]})]})})}return a}(t,s);case"multipart":return function(t,s){const a=[];a.push({id:"payload:msgId",title:"Message ID",color:"blue",hex:s.slice(0,4),startByte:0,endByte:1,decoded:e.jsxs(e.Fragment,{children:[e.jsx(ve,{size:"standard",copy:!0,children:t.messageId.toUpperCase()}),e.jsx("p",{className:"text-xs text-text-muted mt-1",children:"Unique message identifier"})]})}),a.push({id:"payload:partNum",title:"Part Number",color:"amber",hex:s.slice(4,6),startByte:2,endByte:2,decoded:e.jsxs(e.Fragment,{children:[e.jsx(ve,{size:"standard",copy:!0,children:t.partNumber}),e.jsx("p",{className:"text-xs text-text-muted mt-1",children:"0-indexed part number"})]})}),a.push({id:"payload:totalParts",title:"Total Parts",color:"orange",hex:s.slice(6,8),startByte:3,endByte:3,decoded:e.jsxs(e.Fragment,{children:[e.jsx(ve,{size:"standard",copy:!0,children:t.totalParts}),e.jsxs("p",{className:"text-xs text-text-muted mt-1",children:["Part ",t.partNumber+1," of ",t.totalParts]})]})});const n=s.slice(8);return n&&a.push({id:"payload:partData",title:"Part Data",color:"cyan",hex:n,startByte:4,endByte:4+n.length/2-1,decoded:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-[11px] text-text-secondary break-all p-2 rounded bg-bg-body/50 font-mono",children:n.toUpperCase()}),e.jsxs("p",{className:"text-xs text-text-muted mt-1",children:[n.length/2," bytes"]})]})}),a}(t,s);default:return[{id:"payload:ciphertext",title:"Raw Data",color:"zinc",hex:s,startByte:0,endByte:s.length/2-1,decoded:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-[11px] text-text-secondary break-all p-2 rounded bg-bg-body/50 font-mono",children:s.toUpperCase()}),e.jsxs("p",{className:"text-xs text-text-muted mt-1",children:[s.length/2," bytes"]})]})}]}}(v,y.payloadHex),[v,y.payloadHex]),k="payload"===g||Ze(g),C=t.useMemo(()=>{const e=[{id:"header",hex:y.headerHex,color:"red"},...y.transportCodesHex?[{id:"transportCodes",hex:y.transportCodesHex,color:"purple"}]:[],{id:"pathLength",hex:y.pathLengthHex,color:"green"},...y.pathDataHex?[{id:"pathData",hex:y.pathDataHex,color:"amber"}]:[]];return k?[...e,...(t=w,t.map(e=>({id:e.id,hex:e.hex,color:e.color})))]:[...e,{id:"payload",hex:y.payloadHex,color:"cyan"}];var t},[y,k,w]);return e.jsxs("div",{className:"font-mono space-y-2 min-w-0 overflow-hidden",children:[(()=>{switch(v.type){case"advert":return e.jsx(xt,{advert:v,timestamp:s.timestamp});case"grp_data":return e.jsx(mt,{decoded:v,timestamp:s.timestamp});case"grp_txt":return e.jsx(pt,{decoded:v,timestamp:s.timestamp,isLoading:b});case"ack":return e.jsx(ht,{decoded:v,timestamp:s.timestamp});case"path":return e.jsx(ut,{decoded:v,timestamp:s.timestamp});case"trace":return e.jsx(gt,{decoded:v,timestamp:s.timestamp});case"txt_msg":return e.jsx(ft,{decoded:v,timestamp:s.timestamp});case"multipart":return e.jsx(jt,{decoded:v,timestamp:s.timestamp});case"generic":return N.payloadType===xe.REQ||N.payloadType===xe.RESPONSE||N.payloadType===xe.ANON_REQ?e.jsx(yt,{decoded:v,timestamp:s.timestamp,payloadType:N.payloadType}):null;default:return null}})(),e.jsx("div",{className:"bg-black rounded-2xl p-6",children:e.jsx(ct,{segments:C,selectedSegment:g,onSegmentClick:j})}),e.jsx(m,{children:e.jsx(p.div,{layout:!0,transition:rt,className:"space-y-2 min-w-0",children:(()=>{var t,s,a,n;const r=[{id:"header",title:"Header",color:"red",startByte:0,endByte:0,hexBytes:`0x${y.headerHex.toUpperCase()}`,condition:!0,content:e.jsxs("table",{className:"w-full text-left",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-[10px] uppercase tracking-wide text-text-muted border-b border-border-subtle font-sans",children:[e.jsx("th",{className:"py-1 font-medium",children:"Bits"}),e.jsx("th",{className:"py-1 font-medium",children:"Field"}),e.jsx("th",{className:"py-1 font-medium",children:"Value"}),e.jsx("th",{className:"py-1 font-medium",children:"Binary"})]})}),e.jsx("tbody",{children:y.headerFields.map(t=>e.jsx(ot,{...t},t.bits))})]})},{id:"transportCodes",title:"Transport Codes",color:"purple",startByte:1,endByte:4,hexBytes:(null==(t=y.transportCodesHex)?void 0:t.toUpperCase())||"",condition:!!y.transportCodesHex,content:e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-xs text-text-muted",children:"Two 16-bit transport codes for encrypted routing"}),e.jsxs("div",{className:"mt-1 text-xs text-text-secondary",children:["Code 1: 0x",null==(s=y.transportCodesHex)?void 0:s.slice(0,4).toUpperCase()," | Code 2: 0x",null==(a=y.transportCodesHex)?void 0:a.slice(4,8).toUpperCase()]})]})},{id:"pathLength",title:"Path Length",color:"green",startByte:y.transportCodesHex?5:1,endByte:y.transportCodesHex?5:1,hexBytes:`0x${y.pathLengthHex.toUpperCase()}`,condition:!0,content:e.jsxs("p",{className:"text-xs text-text-muted pt-1",children:[N.pathLen," bytes showing route taken (increases as packet floods)"]})},{id:"pathData",title:"Path Data",color:"amber",startByte:y.transportCodesHex?6:2,endByte:(y.transportCodesHex?5:1)+N.pathLen,hexBytes:(null==(n=y.pathDataHex)?void 0:n.toUpperCase())||"",condition:N.pathLen>0,content:e.jsxs("div",{className:"space-y-3",children:[e.jsx(bt,{pathHex:y.pathDataHex}),e.jsx("p",{className:"text-xs text-text-muted",children:"Historical route taken (bytes are added as packet floods through network)"})]})},{id:"payload",title:"Payload",color:"cyan",startByte:y.payloadStartByte,endByte:l-1,hexBytes:y.payloadHex.toUpperCase(),condition:!0,content:e.jsxs(e.Fragment,{children:[!Ze(g)&&e.jsxs("div",{className:"p-3 rounded-lg bg-black",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-text-muted mb-1.5 font-sans",children:"Decoded"}),e.jsx(Nt,{decoded:v,payloadType:N.payloadType})]}),!Ze(g)&&w.length>0&&e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-text-muted mt-3 font-sans",children:"Click a field below to highlight its bytes"}),Ze(g)&&e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-text-muted font-sans",children:"↑ Selected field above • Other fields below ↓"})]})}].filter(e=>e.condition),i=Ze(g)?w.find(e=>e.id===g):null,c=Ze(g)?[...r].sort((e,t)=>"payload"===e.id?-1:"payload"===t.id?1:0):[...r].sort((e,t)=>e.id===g?-1:t.id===g?1:0),o=Ze(g)?w.filter(e=>e.id!==g):[];return e.jsxs(e.Fragment,{children:[i&&e.jsx(dt,{id:`subfield-${i.id}`,title:i.title,color:i.color,startByte:y.payloadStartByte+i.startByte,endByte:y.payloadStartByte+i.endByte,hexBytes:i.hex.toUpperCase(),isSelected:!0,children:i.decoded},i.id),c.map(t=>e.jsx(dt,{id:`section-${t.id}`,title:t.title,color:t.color,startByte:t.startByte,endByte:t.endByte,hexBytes:t.hexBytes,isSelected:t.id===g,children:t.content},t.id)),o.map(t=>e.jsxs(p.div,{layout:"position",layoutId:`subfield-${t.id}`,transition:rt,className:"w-full min-w-0 overflow-hidden rounded-xl p-4 sm:p-5 space-y-4",style:{backgroundColor:st,boxShadow:at},children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-0.5 min-w-0",children:[e.jsx(U,{color:t.color,children:t.title}),t.hex.length<=32&&Xe(t.hex).map((s,a)=>e.jsx(U,{color:t.color,className:"font-mono",children:s.toUpperCase()},a))]}),e.jsxs("span",{className:"text-[10px] text-text-muted font-mono flex-shrink-0",children:["Bytes ",y.payloadStartByte+t.startByte,"-",y.payloadStartByte+t.endByte]})]}),e.jsx("div",{className:"min-w-0 overflow-hidden p-3 rounded-lg bg-black",children:t.decoded})]},t.id))]})})()})})]})});function wt(e){if(!e)return[];if(Array.isArray(e))return e;try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function kt(e){return e?(e.startsWith("0x")?e.slice(2):e).slice(0,2).toUpperCase():""}function Ct({hop:s,compact:a=!1,index:n=0,highlightIndex:r=-1,isTrace:l=!1}){var i;const c=n===r,o=S();return t.useEffect(()=>{c&&l&&o.start({boxShadow:["0 0 0 0px rgba(113, 156, 223, 0)","0 0 0 2px rgba(113, 156, 223, 0.5)","0 0 0 2px rgba(113, 156, 223, 0.5)","0 0 0 0px rgba(113, 156, 223, 0)"],transition:{duration:.5,times:[0,.2,.7,1],ease:"easeInOut"}})},[c,l,o]),e.jsxs(p.div,{className:E("flex items-center gap-1.5",a?"flex-row":"flex-col"),animate:{scale:c?1.05:1,opacity:c?1:.85},transition:{duration:.3,ease:"easeInOut"},children:[e.jsxs(p.div,{className:E("flex items-center gap-1.5 px-2.5 py-1 rounded-md","font-mono text-xs font-semibold",s.isLocal?"bg-amber-500/20 text-amber-300 ring-1 ring-amber-500/30":"bg-zinc-700/50 text-zinc-200 ring-1 ring-zinc-600/50"),animate:o,initial:{boxShadow:"0 0 0 0px rgba(113, 156, 223, 0)"},children:[s.isLocal&&e.jsx(P,{className:"w-3 h-3"}),e.jsx("span",{children:s.prefix}),void 0!==s.confidence&&s.confidence<.9&&e.jsxs("span",{className:"text-[9px] opacity-70",children:[(100*s.confidence).toFixed(0),"%"]})]}),!a&&(null==(i=s.neighborInfo)?void 0:i.name)&&e.jsx("span",{className:"text-[10px] text-text-muted truncate max-w-[80px]",children:s.neighborInfo.name})]})}function St({snr:t}){const s=ke(t),a=we()[s]||"#6b7280",n=Number.isInteger(t)?t.toString():t.toFixed(1);return e.jsxs(U,{customColor:a,compact:!0,className:"font-mono",children:[t>=0?"+":"",n,"dB"]})}function Pt({hops:s,compact:a,isTrace:n=!1}){const[r,l]=t.useState(-1);return t.useEffect(()=>{if(0===s.length)return;const e=setTimeout(()=>{l(0)},400),t=setInterval(()=>{l(e=>{const a=e+1;return a>=s.length?(clearInterval(t),-1):a})},n?500:600);return()=>{clearTimeout(e),clearInterval(t)}},[s.length,n]),e.jsx("div",{className:"p-6",style:{display:"grid",gridTemplateColumns:"1fr auto 1fr",gap:"4px 8px"},children:s.map((t,l)=>{const i=l%2==0,c=l===s.length-1;return e.jsxs("div",{className:"contents",children:[e.jsx("div",{className:E("flex items-center","justify-end"),children:i&&e.jsx(Ct,{hop:t,compact:a,index:l,highlightIndex:r,isTrace:n})}),e.jsx("div",{className:"flex flex-col items-center justify-center min-h-[28px]",children:!c&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-px flex-1 bg-zinc-600/40 min-h-[8px]"}),void 0!==t.snr&&e.jsx(St,{snr:t.snr}),e.jsx("svg",{className:"w-3 h-3 text-zinc-500 flex-shrink-0",viewBox:"0 0 12 12",fill:"none",children:e.jsx("path",{d:"M6 2v8M3 7l3 3 3-3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]})}),e.jsx("div",{className:E("flex items-center","justify-start"),children:!i&&e.jsx(Ct,{hop:t,compact:a,index:l,highlightIndex:r,isTrace:n})})]},`${t.prefix}-${l}`)})})}const _t=t.memo(function({packet:s,neighbors:a,localHash:n,neighborAffinity:i,ghostPrefixes:c,direction:o="horizontal",compact:d=!1,traceSnr:x,overridePath:m}){const p=void 0!==x&&x.length>0,h=wt(s.original_path),u=wt(s.forwarded_path),g=m??(u.length>0?u:h),f=kt(n),j=t.useMemo(()=>g.map((e,t)=>{const s=e.toUpperCase(),n=s===f,r=(null==c?void 0:c.has(s))??!1,l=function(e,t,s){const a=e.toUpperCase();if(s){let e=null,n=0;if(s.forEach((t,s)=>{if(kt(s)===a){const a=t.combinedScore??0;a>n&&(n=a,e=s)}}),e&&t[e])return{hash:e,info:t[e],confidence:n}}for(const[n,r]of Object.entries(t))if(kt(n)===a)return{hash:n,info:r,confidence:void 0};return null}(s,a,i);return{prefix:s,fullHash:null==l?void 0:l.hash,neighborInfo:null==l?void 0:l.info,isLocal:n,isGhost:r,confidence:null==l?void 0:l.confidence,snr:null==x?void 0:x[t]}}),[g,a,i,f,c,x]);if(0===j.length)return e.jsxs("div",{className:"flex items-center gap-2 text-text-muted text-xs",children:[e.jsx(v,{className:"w-4 h-4 opacity-50"}),e.jsx("span",{children:"Direct / No path data"})]});if("flowchart"===o)return e.jsx(Pt,{hops:j,compact:d,isTrace:p});const y="horizontal"===o?r:l;return e.jsx("div",{className:E("flex gap-1.5","horizontal"===o?"flex-row flex-wrap items-center":"flex-col items-start"),children:j.map((t,s)=>e.jsxs("div",{className:E("flex items-center gap-1.5","vertical"===o&&"flex-col"),children:[e.jsx(Ct,{hop:t,compact:d}),s0,c=sl&&a(s-1),disabled:!l,className:E("p-0.5 rounded transition-colors",l?"text-text-muted hover:text-text-primary hover:bg-white/10":"text-white/20 cursor-not-allowed"),"aria-label":"Previous observation",children:e.jsx(B,{className:r?"size-3":"size-4"})}),e.jsx("div",{className:"flex items-center gap-0.5",children:t.map((t,n)=>{const l=n===s,i=new Date(1e3*t.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"});return e.jsx(te,{color:l?"cyan":"zinc",filled:l,compact:r,onClick:()=>a(n),title:`Observation ${n+1} at ${i}`,className:E("transition-all duration-150",!l&&"opacity-60 hover:opacity-100"),children:r?e.jsx("span",{className:"tabular-nums",children:n+1}):e.jsxs("span",{className:"tabular-nums text-[10px]",children:["#",n+1,null!=t.rssi&&e.jsx("span",{className:"ml-1 opacity-70",children:t.rssi})]})},`${t.timestamp}_${n}`)})}),e.jsx("button",{onClick:()=>c&&a(s+1),disabled:!c,className:E("p-0.5 rounded transition-colors",c?"text-text-muted hover:text-text-primary hover:bg-white/10":"text-white/20 cursor-not-allowed"),"aria-label":"Next observation",children:e.jsx(i,{className:r?"size-3":"size-4"})}),e.jsxs("span",{className:E("text-text-muted ml-1",r?"text-[9px]":"text-[10px]"),children:[e.jsx(n,{className:"inline size-3 mr-0.5 opacity-50"}),t.length]})]})}function Bt({icon:t,label:s,disabled:a=!1}){return e.jsx(p.div,{className:"flex items-center gap-1 text-[10px]",title:s,animate:{opacity:a?.25:.6},transition:{duration:.15,ease:[.4,0,.2,1]},children:e.jsx("span",{className:E("flex items-center justify-center size-5 rounded border transition-colors duration-150",a?"bg-white/[0.02] border-white/5":"bg-white/5 border-white/10"),children:t})})}function Mt({hasDuplicates:t,hasPrev:s,hasNext:a,canPrevDupe:n,canNextDupe:r}){return e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs("div",{className:"flex items-center gap-0.5",children:[e.jsx(Bt,{icon:e.jsx(M,{className:"size-3"}),label:"Previous packet (↑)",disabled:!s}),e.jsx(Bt,{icon:e.jsx(F,{className:"size-3"}),label:"Next packet (↓)",disabled:!a})]}),t&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-px h-3 bg-white/10"}),e.jsxs("div",{className:"flex items-center gap-0.5",children:[e.jsx(Bt,{icon:e.jsx(B,{className:"size-3"}),label:"Previous observation (←)",disabled:!n}),e.jsx(Bt,{icon:e.jsx(i,{className:"size-3"}),label:"Next observation (→)",disabled:!r})]})]})]})}const Ft=t.memo(function({packets:s,initialIndex:a=0,onClose:n,onNavigatePrev:r,onNavigateNext:l,hasPrev:i=!1,hasNext:c=!1}){const[d,x]=t.useState(a),m=s[d]??s[0],h=s.length>1,u=d>0,f=d{x(Math.max(0,Math.min(e,s.length-1)))},[s.length]);t.useEffect(()=>{const e=e=>{if(!(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement))switch(e.key){case"ArrowUp":e.preventDefault(),null==r||r();break;case"ArrowDown":e.preventDefault(),null==l||l();break;case"ArrowLeft":e.preventDefault(),u&&x(e=>e-1);break;case"ArrowRight":e.preventDefault(),f&&x(e=>e+1)}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[r,l,u,f]);const y=K(),b=Y(),N=J(),w=X(),k=t.useMemo(()=>new Set(w.map(e=>e.prefix.toUpperCase())),[w]),C=m.payload_type_name||V(m.payload_type??m.type),S=m.route_type_name||Q(m.route_type??m.route),P=m.payload_length??m.length??0,B=Tt(m.original_path),M=Tt(m.forwarded_path),F=B.length>0||M.length>0,L=M.length>0?M:B,D=t.useMemo(()=>{var e;if(null==(e=null==y?void 0:y.config)?void 0:e.repeater)return{latitude:y.config.repeater.latitude,longitude:y.config.repeater.longitude,name:y.config.node_name||"Local Node"}},[y]),z=(null==y?void 0:y.neighbors)??{},A=N.size>0?N:void 0,E=m.raw_packet&&m.raw_packet.length>0,R=t.useMemo(()=>{if((m.payload_type??m.type)!==xe.TRACE||!m.payload)return null;try{const e=oe(m.payload),t=m.original_path||m.forwarded_path||[];let s=[];if("string"==typeof t)try{const e=JSON.parse(t);Array.isArray(e)&&(s=e.map(e=>parseInt(e,16)))}catch{s=[]}else Array.isArray(t)&&(s=t.map(e=>parseInt(e,16)));return de(e,s)}catch{return null}},[m]),I=null==R?void 0:R.snrValues,$=t.useMemo(()=>{if((m.payload_type??m.type)!==xe.ADVERT||!m.payload)return null;try{const e=oe(m.payload),t=ue(e);if(!t)return null;const s=t.publicKey.slice(0,2).toUpperCase();return{...t,prefix:s}}catch{return null}},[m]),O=t.useMemo(()=>{if((null==$?void 0:$.latitude)&&(null==$?void 0:$.longitude))return{latitude:$.latitude,longitude:$.longitude,name:$.name||`Node ${$.prefix||"??"}`,prefix:$.prefix,publicKey:$.publicKey}},[$]),W=e=>e&&0!==e?new Date(1e3*e).toLocaleString():"Unknown",[G,q]=t.useState(null);t.useEffect(()=>{if((m.payload_type??m.type)!==xe.GRP_TXT||!m.payload)return void q(null);let e=!1;const t=oe(m.payload);return me(t).then(t=>{!e&&t&&q(t)}),()=>{e=!0}},[m]);const te=t.useCallback(e=>{if(!e)return null;const t=e.trim().match(/(-?\d+\.?\d*)\s*[,\s]\s*(-?\d+\.?\d*)/);if(!t)return null;const s=parseFloat(t[1]),a=parseFloat(t[2]);return isNaN(s)||isNaN(a)||s<-90||s>90||a<-180||a>180||0===s&&0===a?null:{lat:s,lon:a}},[]),se=t.useMemo(()=>{var e,t;if(!(null==G?void 0:G.decrypted))return;if(!(null==(e=G.channelName)?void 0:e.toLowerCase().includes("wardrive")))return;const s=te(G.text);return s?{latitude:s.lat,longitude:s.lon,name:G.senderName||"Wardrive Ping",prefix:(null==(t=G.senderName)?void 0:t.slice(0,2).toUpperCase())||"WD",nodeType:"wardrive"}:void 0},[G,te]),ae=(m.payload_type??m.type)===xe.ADVERT&&(void 0!==O||F),ne=void 0!==se,re=O??se;if(0===L.length)return null;const le=(null==y?void 0:y.local_hash)?(y.local_hash.startsWith("0x")?y.local_hash.slice(2,4):y.local_hash.slice(0,2)).toUpperCase():"";for(const e of L){const t=e.toUpperCase();if(t!==le)if(A){let e=0,s=0;if(A.forEach((a,n)=>{(n.startsWith("0x")?n.slice(2,4):n.slice(0,2)).toUpperCase()===t&&(e++,s=Math.max(s,a.combinedScore??0))}),0===e)for(const a of Object.keys(z))if((a.startsWith("0x")?a.slice(2,4):a.slice(0,2)).toUpperCase()===t)break}else for(const e of Object.keys(z))if((e.startsWith("0x")?e.slice(2,4):e.slice(0,2)).toUpperCase()===t)break}const ie={lime:"rgb(132, 204, 22)",cyan:"rgb(34, 211, 238)",amber:"rgb(251, 191, 36)",violet:"rgb(167, 139, 250)",rose:"rgb(251, 113, 133)",emerald:"rgb(52, 211, 153)",sky:"rgb(56, 189, 248)",orange:"rgb(251, 146, 60)",pink:"rgb(244, 114, 182)",zinc:"rgb(161, 161, 170)",purple:"rgb(168, 85, 247)",indigo:"rgb(129, 140, 248)",teal:"rgb(45, 212, 191)",fuchsia:"rgb(232, 121, 249)",blue:"rgb(59, 130, 246)",green:"rgb(34, 197, 94)",yellow:"rgb(250, 204, 21)",red:"rgb(239, 68, 68)"},ce=ie[ye[C]??"zinc"]||ie.zinc;return e.jsxs(Z,{open:!0,onClose:n,size:"5xl",motionPlus:!0,className:"sm:h-[85vh] sm:max-h-[800px] md:h-[80vh] md:max-h-[900px]",children:[e.jsxs("div",{className:"sm:hidden",children:[e.jsx("div",{className:"flex justify-center pt-2 pb-1",children:e.jsx("div",{className:"w-9 h-1 rounded-full bg-white/30","aria-hidden":"true"})}),e.jsxs("div",{className:"flex items-center justify-between px-3 pb-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(U,{color:ye[C]??"zinc",className:"!text-[9px] !px-1.5 !py-0",children:C}),e.jsx(U,{color:"DIRECT"===S||"T_DIRECT"===S?"cyan":"amber",className:"!text-[9px] !px-1.5 !py-0",children:S}),e.jsxs(U,{color:"zinc",className:"!text-[9px] !px-1.5 !py-0",children:[P,"B"]})]}),e.jsx("button",{onClick:n,className:"px-3 py-1.5 text-[15px] font-medium text-blue-400 active:text-blue-300 transition-colors flex-shrink-0 rounded-lg active:bg-white/5",children:"Done"})]}),h&&e.jsx("div",{className:"px-3 pb-2",children:e.jsx(Ht,{packets:s,selectedIndex:d,onSelect:j,compact:!0})})]}),e.jsx("div",{className:"hidden sm:block px-6 pt-5 pb-4",children:e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(U,{color:ye[C]??"zinc",children:C}),e.jsx(U,{color:"DIRECT"===S||"T_DIRECT"===S?"cyan":"amber",children:S}),e.jsxs(U,{color:"zinc",children:[P,"B"]}),h&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-px h-4 bg-white/10"}),e.jsx(Ht,{packets:s,selectedIndex:d,onSelect:j})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Mt,{hasDuplicates:h,hasPrev:i,hasNext:c,canPrevDupe:u,canNextDupe:f}),e.jsx("button",{onClick:n,className:"p-1.5 -m-1.5 text-text-muted hover:text-text-primary transition-colors rounded-lg hover:bg-bg-elevated flex-shrink-0",children:e.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})]})}),e.jsx("div",{className:"sm:hidden h-[2px]",style:{backgroundColor:ce,opacity:.6}}),e.jsxs(ee,{className:"p-0 overflow-hidden flex-1 flex flex-col min-h-0",children:[e.jsx("div",{className:"md:hidden flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxs("div",{className:"p-2 space-y-2",children:[(null!=m.rssi||null!=m.snr)&&e.jsxs("div",{className:"relative flex items-center justify-between px-2 py-1.5 rounded-lg bg-white/[0.03]",children:[e.jsx(_,{mode:"popLayout",initial:!1,children:e.jsxs(p.div,{className:"flex items-center gap-3",initial:{opacity:0,scale:.96},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.96},transition:{duration:.15,ease:[.4,0,.2,1]},children:[e.jsx(fe,{rssi:m.rssi,snr:m.snr,compact:!0,showValues:!0}),e.jsx("span",{className:"text-[11px] text-white/50",children:be(m.rssi)})]},d)}),L.length>0&&e.jsxs("span",{className:"text-[10px] font-mono text-white/40",children:[L.length," hop",1!==L.length?"s":""]})]}),(F&&L.length>0||ae||ne)&&e.jsx("div",{className:"overflow-hidden rounded-xl",children:e.jsx("div",{className:"aspect-[4/3] w-full",children:e.jsx(Je,{path:L,neighbors:z,localNode:D,localHash:null==y?void 0:y.local_hash,srcHash:m.src_hash,dstHash:m.dst_hash,neighborAffinity:A,hubNodes:[...b],traceSnr:I,advertiserSource:re})})}),R&&R.pathHashes.length>0&&e.jsxs("div",{className:"rounded-xl bg-black overflow-hidden",children:[e.jsx("div",{className:"px-3 py-2 space-y-1.5",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-[10px] font-medium text-text-muted uppercase tracking-wide",children:"Trace Route"}),e.jsx("div",{className:"flex items-center gap-1.5",children:e.jsx(U,{color:R.isComplete?"green":"amber",compact:!0,children:R.isComplete?"Complete":"In Progress"})})]})}),e.jsx(_t,{packet:m,neighbors:z,localHash:null==y?void 0:y.local_hash,neighborAffinity:A,ghostPrefixes:k,direction:"flowchart",compact:!0,overridePath:R.pathHashes,traceSnr:R.snrValues})]}),F&&!R&&e.jsxs("div",{className:"rounded-xl bg-black overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-2",children:[e.jsx("span",{className:"text-[10px] font-medium text-text-muted uppercase tracking-wide",children:"Path"}),e.jsxs(U,{color:"zinc",compact:!0,children:[L.length," hop",1!==L.length?"s":""]})]}),e.jsx(_t,{packet:m,neighbors:z,localHash:null==y?void 0:y.local_hash,neighborAffinity:A,ghostPrefixes:k,direction:"flowchart",compact:!0,traceSnr:I})]}),$&&e.jsxs("div",{className:"rounded-xl bg-white/[0.03] overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-white/5",children:[e.jsx("span",{className:"text-[10px] font-medium text-text-muted uppercase tracking-wide",children:"Advertiser Info"}),e.jsx(U,{color:"lime",compact:!0,children:$.nodeType})]}),e.jsxs("div",{className:"p-3 space-y-2",children:[$.name&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(T,{className:"w-3.5 h-3.5 text-text-muted flex-shrink-0"}),e.jsx("span",{className:"text-sm font-medium text-text-primary truncate",children:$.name})]}),$.latitude&&$.longitude&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(o,{className:"w-3.5 h-3.5 text-text-muted flex-shrink-0"}),e.jsxs("span",{className:"text-xs font-mono text-text-secondary",children:[$.latitude.toFixed(5),", ",$.longitude.toFixed(5)]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(H,{className:"w-3.5 h-3.5 text-text-muted flex-shrink-0"}),e.jsxs("span",{className:"text-[10px] font-mono text-text-muted truncate",children:[$.publicKey.slice(0,16),"...",$.publicKey.slice(-8)]})]}),$.timestamp>0&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(g,{className:"w-3.5 h-3.5 text-text-muted flex-shrink-0"}),e.jsx("span",{className:"text-xs text-text-muted",children:W($.timestamp)})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(v,{className:"w-3.5 h-3.5 text-text-muted flex-shrink-0"}),e.jsx("span",{className:"text-[10px] text-text-muted",children:$.flagsDescription||`Flags: 0x${$.flags.toString(16).padStart(2,"0")}`})]})]})]}),E&&e.jsx("div",{className:"pt-1",children:e.jsx(vt,{packet:m})})]})}),e.jsxs("div",{className:"hidden md:grid md:grid-cols-2 flex-1 overflow-hidden",children:[e.jsx("div",{className:"overflow-y-auto overflow-x-hidden scrollbar-none p-4 border-r border-border-subtle",children:E&&e.jsx(vt,{packet:m})}),e.jsxs("div",{className:"grid overflow-hidden",style:{gridTemplateRows:"minmax(280px, 1fr) auto"},children:[e.jsx("div",{className:"overflow-hidden p-2",children:F&&L.length>0||ae||ne?e.jsx("div",{className:"h-full w-full",children:e.jsx(Je,{path:L,neighbors:z,localNode:D,localHash:null==y?void 0:y.local_hash,srcHash:m.src_hash,dstHash:m.dst_hash,neighborAffinity:A,hubNodes:[...b],traceSnr:I,advertiserSource:re})}):e.jsxs("div",{className:"h-full w-full flex flex-col items-center justify-center text-center px-4",children:[e.jsx(v,{className:"w-8 h-8 text-text-muted/50 mb-2"}),e.jsx("span",{className:"text-sm text-text-muted",children:"Direct Reception"}),e.jsx("span",{className:"text-xs text-text-muted/70 mt-1",children:"Zero-hop packet — received directly from sender"})]})}),e.jsxs("div",{className:"overflow-y-auto max-h-[200px] p-2 space-y-2",children:[!R&&L.length<=1&&(null!=m.rssi||null!=m.snr)&&e.jsx("div",{className:"glass-card rounded-xl p-4",children:e.jsxs("dl",{className:"text-xs grid grid-cols-2 gap-2",children:[e.jsxs("div",{children:[e.jsx("dt",{className:"text-text-muted mb-1",children:"Signal"}),e.jsx(_,{mode:"popLayout",initial:!1,children:e.jsxs(p.dd,{className:"flex items-center gap-2",initial:{opacity:0,scale:.96},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.96},transition:{duration:.15,ease:[.4,0,.2,1]},children:[e.jsx(fe,{rssi:m.rssi,snr:m.snr}),e.jsx("span",{className:"font-medium text-text-primary",children:be(m.rssi)})]},d)})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"text-text-muted mb-1",children:"RF"}),e.jsx(_,{mode:"popLayout",initial:!1,children:e.jsxs(p.dd,{className:"font-mono text-text-secondary tabular-nums",initial:{opacity:0,scale:.96},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.96},transition:{duration:.15,ease:[.4,0,.2,1]},children:[null!=m.rssi&&`${m.rssi} dBm`,null!=m.snr&&` · ${m.snr.toFixed(1)} dB`]},d)})]})]})}),$&&e.jsxs("div",{className:"rounded-xl bg-white/[0.03] overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-white/5",children:[e.jsx("span",{className:"text-xs font-medium text-text-muted uppercase tracking-wide",children:"Advertiser"}),e.jsx(U,{color:"lime",compact:!0,children:$.nodeType})]}),e.jsxs("div",{className:"p-4 space-y-2.5",children:[$.name&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(T,{className:"w-4 h-4 text-text-muted flex-shrink-0"}),e.jsx("span",{className:"text-sm font-medium text-text-primary truncate",children:$.name})]}),$.latitude&&$.longitude&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(o,{className:"w-4 h-4 text-text-muted flex-shrink-0"}),e.jsxs("span",{className:"text-xs font-mono text-text-secondary",children:[$.latitude.toFixed(5),", ",$.longitude.toFixed(5)]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(H,{className:"w-4 h-4 text-text-muted flex-shrink-0"}),e.jsxs("span",{className:"text-[11px] font-mono text-text-muted truncate",children:[$.publicKey.slice(0,16),"...",$.publicKey.slice(-8)]})]}),$.timestamp>0&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(g,{className:"w-4 h-4 text-text-muted flex-shrink-0"}),e.jsx("span",{className:"text-xs text-text-muted",children:W($.timestamp)})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(v,{className:"w-4 h-4 text-text-muted flex-shrink-0"}),e.jsx("span",{className:"text-[11px] text-text-muted",children:$.flagsDescription||`Flags: 0x${$.flags.toString(16).padStart(2,"0")}`})]})]})]}),R&&R.pathHashes.length>0&&e.jsxs("div",{className:"rounded-xl bg-black overflow-hidden",children:[e.jsxs("div",{className:"px-4 py-2 flex items-center justify-between",children:[e.jsx("span",{className:"text-xs font-medium text-text-muted uppercase tracking-wide",children:"Trace Route"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(U,{color:R.isComplete?"green":"amber",compact:!0,children:R.isComplete?"Complete":"In Progress"}),e.jsxs(U,{color:"teal",compact:!0,children:[R.pathHashes.length,"h"]})]})]}),e.jsx(_t,{packet:m,neighbors:z,localHash:null==y?void 0:y.local_hash,neighborAffinity:A,ghostPrefixes:k,direction:"flowchart",compact:!0,overridePath:R.pathHashes,traceSnr:R.snrValues})]}),F&&!R&&e.jsxs("div",{className:"rounded-xl bg-black overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2",children:[e.jsx("span",{className:"text-xs font-medium text-text-muted uppercase tracking-wide",children:"Path"}),e.jsxs(U,{color:"zinc",compact:!0,children:[L.length,"h"]})]}),e.jsx(_t,{packet:m,neighbors:z,localHash:null==y?void 0:y.local_hash,neighborAffinity:A,ghostPrefixes:k,direction:"flowchart",compact:!0,traceSnr:I})]})]})]})]})]})]})}),Lt={type:"spring",visualDuration:.6,bounce:.25,opacity:{duration:.2,ease:"linear"}};function Dt({value:s,format:a,prefix:n,className:r}){const[l,i]=t.useState("waiting");if(t.useEffect(()=>{const e=setTimeout(()=>{i("mounted")},400);return()=>clearTimeout(e)},[]),t.useEffect(()=>{if("mounted"===l){const e=requestAnimationFrame(()=>{i("animating")});return()=>cancelAnimationFrame(e)}},[l]),"waiting"===l){const t=(0).toLocaleString(void 0,a);return e.jsxs("span",{className:r,children:[n,t]})}return e.jsx(z,{className:r,format:a,prefix:n,transition:Lt,children:"animating"===l?s:0})}function zt({label:t,numericValue:s,unit:a,icon:n,subtext:r,showSign:l=!1}){return e.jsxs("div",{className:"rounded-lg p-3 sm:rounded-xl sm:p-4 bg-white/[0.03] ring-1 ring-inset ring-white/[0.06]",children:[e.jsx("div",{className:"mb-1.5 sm:mb-2",children:e.jsx("span",{className:"text-[10px] sm:text-[11px] font-medium uppercase tracking-wide text-text-muted",children:t})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Dt,{value:s,format:{minimumFractionDigits:1,maximumFractionDigits:1,signDisplay:l?"always":"auto"},className:"font-mono text-xl sm:text-2xl font-semibold tabular-nums tracking-tight text-white"}),e.jsxs("div",{className:"flex flex-col items-center justify-center",children:[e.jsx(n,{className:"w-[14px] h-[14px] text-text-muted"}),a&&e.jsx("span",{className:"text-[10px] sm:text-xs font-medium leading-tight text-text-muted",children:a})]})]}),r&&e.jsx("p",{className:"mt-1.5 sm:mt-2 font-mono text-[10px] sm:text-[11px] text-text-muted/80 truncate",children:r})]})}function At({snr:t}){const s=t>=5?"bg-sys-teal":t>=0?"bg-sys-green":t>=-5?"bg-sys-amber":t>=-10?"bg-sys-orange":"bg-sys-red";return e.jsx("span",{className:E("w-1.5 h-1.5 rounded-full flex-shrink-0",s),title:`SNR: ${t.toFixed(1)} dB`})}function Et({fromPrefix:t,toPrefix:s,fromName:a,toName:n,snr:l,maxSnr:i,isWeakest:c,isStrongest:o,index:d=0}){const x=Math.max(i+5,15),m=Math.max(0,Math.min(100,(l- -20)/(x- -20)*100)),h="bg-[#0074BE]",u=l>=5?"bg-sys-teal":l>=0?"bg-sys-green":l>=-5?"bg-sys-amber":l>=-10?"bg-sys-orange":"bg-sys-red",g=.3+.15*d;return e.jsxs("div",{className:"relative p-3 pl-5 rounded-lg bg-white/[0.03] ring-1 ring-inset ring-white/[0.06]",children:[e.jsx("span",{className:E("absolute left-0 top-1/2 -translate-y-1/2 h-4 w-0.5 rounded-full",u)}),e.jsx("span",{className:"absolute -top-0.5 -right-0.5",children:e.jsx(At,{snr:l})}),e.jsxs("div",{className:"sm:hidden",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[e.jsx("span",{className:"text-[13px] font-medium text-white/70 truncate",children:a||t}),e.jsx(r,{className:"w-3 h-3 text-white/30 flex-shrink-0"}),e.jsx("span",{className:"text-[13px] font-semibold text-white truncate",children:n||s})]}),e.jsxs("div",{className:"flex items-center gap-1.5 ml-2 flex-shrink-0",children:[c&&e.jsx(U,{color:"red",compact:!0,children:"Low"}),o&&!c&&e.jsxs(U,{color:"amber",compact:!0,children:[e.jsx(A,{className:"w-2.5 h-2.5"}),"Best"]}),e.jsxs("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded text-[12px] font-mono font-bold tabular-nums bg-white/[0.06] text-text-primary ring-1 ring-inset ring-white/[0.1]",children:[l>=0?"+":"−",Math.abs(l).toFixed(1)]})]})]}),e.jsx("div",{className:"h-1.5 bg-white/10 rounded-full overflow-hidden",children:e.jsx(p.div,{className:E("h-full rounded-full",h),initial:{width:0},animate:{width:`${m}%`},transition:{duration:1.5,delay:g,ease:[.25,.1,.25,1]}})})]}),e.jsxs("div",{className:"hidden sm:block",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[e.jsx("code",{className:"font-mono text-xs text-text-muted",children:t}),a&&e.jsx("span",{className:"text-xs text-text-secondary truncate max-w-[100px]",children:a})]}),e.jsx(r,{className:"w-3 h-3 text-text-muted/40 flex-shrink-0"}),e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[e.jsx("code",{className:"font-mono text-xs font-semibold text-text-primary",children:s}),n&&e.jsx("span",{className:"text-xs text-text-secondary truncate max-w-[100px]",children:n})]})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[c&&e.jsx(U,{color:"red",compact:!0,children:"Bottleneck"}),o&&!c&&e.jsxs(U,{color:"amber",compact:!0,children:[e.jsx(A,{className:"w-3 h-3"}),"Strongest"]}),e.jsxs("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-sm font-mono font-semibold tabular-nums bg-white/[0.06] text-text-primary ring-1 ring-inset ring-white/[0.1]",children:[l>=0?"+":"−",Math.abs(l).toFixed(1)]})]})]}),e.jsx("div",{className:"h-1.5 bg-bg-elevated rounded-full overflow-hidden",children:e.jsx(p.div,{className:E("h-full rounded-full",h),initial:{width:0},animate:{width:`${m}%`},transition:{duration:1.5,delay:g,ease:[.25,.1,.25,1]}})})]})]})}function Rt(e,t){if("You"===e)return"You";const s=e.toUpperCase();for(const[a,n]of Object.entries(t))if((a.startsWith("0x")?a.slice(2,4):a.slice(0,2)).toUpperCase()===s)return n.name||n.node_name||void 0}const Ut=t.memo(function({report:t,onClose:s}){var a,n;const r=K(),l=(null==r?void 0:r.neighbors)??{},i=(null==(a=null==r?void 0:r.config)?void 0:a.repeater)?{latitude:r.config.repeater.latitude,longitude:r.config.repeater.longitude,name:r.config.node_name||"Local Node"}:void 0,c=null==(n=t.bestObservation)?void 0:n.decoded.snrValues,o=t.linkQuality?t.linkQuality.avgSnr>=5?"excellent":t.linkQuality.avgSnr>=0?"good":t.linkQuality.avgSnr>=-5?"fair":"poor":"unknown",d={excellent:"var(--signal-excellent)",good:"var(--signal-good)",fair:"var(--signal-fair)",poor:"var(--signal-poor)",unknown:"var(--text-muted)"}[o];return e.jsxs(Z,{open:!0,onClose:s,size:"5xl",motionPlus:!0,children:[e.jsxs("div",{className:"sm:hidden",children:[e.jsx("div",{className:"flex justify-center pt-2 pb-1",children:e.jsx("div",{className:"w-9 h-1 rounded-full bg-white/30","aria-hidden":"true"})}),e.jsxs("div",{className:"flex items-center justify-between px-4 pb-2",children:[e.jsx("h2",{className:"font-semibold text-[17px] text-white",children:"Trace Report"}),e.jsx("button",{onClick:s,className:"text-[17px] font-medium text-blue-400 active:text-blue-300",children:"Done"})]})]}),e.jsx("div",{className:"sm:hidden h-[2px]",style:{backgroundColor:d,opacity:.6}}),e.jsx("div",{className:"hidden sm:block px-6 pt-5 pb-4",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 sm:gap-3",children:[e.jsx("h2",{className:"text-base sm:text-lg font-semibold text-text-primary",children:"Trace Report"}),e.jsxs(U,{color:"excellent"===o||"good"===o?"green":"fair"===o?"amber":"red",children:[e.jsx(L,{className:"w-3 h-3 mr-1"}),"excellent"===o?"Excellent":"good"===o?"Good":"fair"===o?"Fair":"Poor"]})]}),e.jsx("p",{className:"mt-1 text-xs sm:text-sm font-mono text-text-muted tabular-nums",children:t.traceTag})]}),e.jsx("button",{onClick:s,className:"p-1.5 -m-1.5 text-text-muted hover:text-text-primary transition-colors rounded-lg hover:bg-bg-elevated flex-shrink-0",children:e.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})}),e.jsxs("div",{className:"hidden sm:flex flex-wrap items-center gap-1.5 sm:gap-2 px-4 sm:px-6 pb-3 sm:pb-4 border-b border-border-subtle",children:[e.jsxs(U,{color:"teal",children:[e.jsx("span",{className:"font-mono tabular-nums",children:t.targetHopCount}),e.jsxs("span",{className:"ml-1",children:["hop",1!==t.targetHopCount?"s":""]})]}),e.jsxs(U,{color:"zinc",children:[e.jsx("span",{className:"font-mono tabular-nums",children:t.observationCount}),e.jsx("span",{className:"ml-1",children:"obs"})]}),t.linkQuality&&e.jsxs(U,{color:"purple",children:[e.jsx("span",{className:"font-mono tabular-nums",children:t.linkQuality.avgSnr.toFixed(1)}),e.jsx("span",{className:"ml-1",children:"dB avg"})]}),e.jsx("span",{className:"font-mono text-xs text-text-muted tabular-nums",children:se(t.duration)}),t.linkQuality&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-text-muted/40",children:"•"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium bg-sys-red/15 text-sys-red ring-1 ring-inset ring-sys-red/25",children:[e.jsx("span",{className:"opacity-70",children:"Min"}),e.jsx("span",{className:"font-mono tabular-nums",children:t.linkQuality.minSnr.toFixed(1)})]}),e.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium bg-sys-teal/15 text-sys-teal ring-1 ring-inset ring-sys-teal/25",children:[e.jsx("span",{className:"opacity-70",children:"Max"}),e.jsx("span",{className:"font-mono tabular-nums",children:t.linkQuality.maxSnr.toFixed(1)})]})]})]})]}),e.jsxs(ee,{className:"p-0 overflow-hidden",children:[e.jsx("div",{className:"md:hidden h-[75vh] max-h-[calc(100vh-80px)] overflow-y-auto overflow-x-hidden",children:e.jsxs("div",{className:"px-4 py-3 space-y-3",children:[t.linkQuality&&e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{className:"rounded-lg bg-white/[0.03] ring-1 ring-inset ring-white/[0.06] p-2.5 text-center",children:[e.jsx(Dt,{value:Math.abs(t.linkQuality.minSnr),format:{maximumFractionDigits:0,signDisplay:"never"},prefix:t.linkQuality.minSnr<0?"-":"",className:"text-[20px] font-bold font-mono tabular-nums flex items-center justify-center text-white"}),e.jsxs("div",{className:"flex items-center justify-center gap-1 mt-1",children:[e.jsx(x,{className:"w-2.5 h-2.5 text-text-muted"}),e.jsx("span",{className:"text-[10px] text-white/40",children:"Min dB"})]})]}),e.jsxs("div",{className:"rounded-lg bg-white/[0.03] ring-1 ring-inset ring-white/[0.06] p-2.5 text-center",children:[e.jsx(Dt,{value:t.linkQuality.maxSnr,format:{maximumFractionDigits:0,signDisplay:"always"},className:"text-[20px] font-bold font-mono text-white tabular-nums flex items-center justify-center"}),e.jsxs("div",{className:"flex items-center justify-center gap-1 mt-1",children:[e.jsx(D,{className:"w-2.5 h-2.5 text-text-muted"}),e.jsx("span",{className:"text-[10px] text-white/40",children:"Max dB"})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs(U,{color:"excellent"===o||"good"===o?"green":"fair"===o?"amber":"red",compact:!0,children:[e.jsx(L,{className:"w-2.5 h-2.5 mr-0.5"}),"excellent"===o?"Excellent":"good"===o?"Good":"fair"===o?"Fair":"Poor"]}),e.jsxs(U,{color:"teal",compact:!0,children:[t.targetHopCount," hops"]}),e.jsxs(U,{color:"zinc",compact:!0,children:[t.observationCount," obs"]}),e.jsx("span",{className:"text-[10px] font-mono text-white/30 ml-auto",children:t.traceTag.slice(0,8)})]}),t.targetPath.length>0&&e.jsx("div",{className:"overflow-hidden rounded-xl",children:e.jsx("div",{className:"aspect-[4/3] w-full",children:e.jsx(Je,{path:t.targetPath,neighbors:l,localNode:i,localHash:null==r?void 0:r.local_hash,srcHash:t.srcHash,dstHash:t.dstHash,traceSnr:c})})}),e.jsxs("div",{className:"rounded-xl bg-black overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-white/5",children:[e.jsx("span",{className:"text-[11px] font-medium text-white/60",children:"Route Path"}),t.linkQuality&&e.jsxs("span",{className:"text-[10px] font-mono text-white/40",children:["SNR ",t.linkQuality.minSnr.toFixed(1)," → ",t.linkQuality.maxSnr.toFixed(1)," dB"]})]}),t.bestObservation?e.jsx(_t,{packet:t.bestObservation.packet,neighbors:l,localHash:null==r?void 0:r.local_hash,direction:"flowchart",compact:!0,overridePath:t.targetPath,traceSnr:t.bestObservation.decoded.snrValues}):e.jsx("div",{className:"p-6 text-center text-text-muted text-[11px]",children:"No path data available"})]}),e.jsxs("div",{children:[e.jsxs("h3",{className:"text-[11px] font-medium uppercase tracking-wide text-white/40 mb-2",children:["Link Quality · ",t.hopStats.length," hops"]}),e.jsx("div",{className:"space-y-1.5",children:t.hopStats.length>0?t.hopStats.map((s,a)=>{var n,r,i;const c=a{const s=t.targetPath[t.linkQuality.weakestLinkPosition],a=t.targetPath[t.linkQuality.weakestLinkPosition+1]||"You",n=Rt(s,l),r=Rt(a,l),i=t.targetPath[t.linkQuality.strongestLinkPosition],c=t.targetPath[t.linkQuality.strongestLinkPosition+1]||"You",o=Rt(i,l),d=Rt(c,l);return e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx(zt,{label:"Weakest Link",numericValue:t.linkQuality.minSnr,unit:"dB",icon:x,subtext:`${n||s} → ${r||a}`}),e.jsx(zt,{label:"Best Link",numericValue:t.linkQuality.maxSnr,showSign:!0,unit:"dB",icon:D,subtext:`${o||i} → ${d||c}`})]})})(),e.jsxs("div",{children:[e.jsx("h3",{className:"text-[11px] font-medium uppercase tracking-wide text-text-muted mb-3",children:"Link Details"}),e.jsx("div",{className:"space-y-2",children:t.hopStats.length>0?t.hopStats.map((s,a)=>{var n,r,i;const c=a0&&e.jsx("div",{className:"overflow-hidden",children:e.jsx("div",{className:"aspect-square w-full",children:e.jsx(Je,{path:t.targetPath,neighbors:l,localNode:i,localHash:null==r?void 0:r.local_hash,srcHash:t.srcHash,dstHash:t.dstHash,traceSnr:c})})}),e.jsxs("div",{className:"rounded-xl bg-black overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3",children:[e.jsx("span",{className:"text-xs font-medium text-text-muted uppercase tracking-wide",children:"Trace Route"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(U,{color:t.isComplete?"green":"amber",compact:!0,children:t.isComplete?"Complete":`${t.maxHopsObserved}/${t.targetHopCount}`}),e.jsxs(U,{color:"teal",compact:!0,children:[t.targetHopCount," hop",1!==t.targetHopCount?"s":""]})]})]}),t.linkQuality&&t.bestObservation&&e.jsxs("div",{className:"flex items-center gap-4 px-4 pb-2 font-mono text-[10px] text-text-muted",children:[e.jsxs("span",{children:[e.jsx("span",{className:"opacity-60",children:"Tag"})," ",e.jsx("code",{className:"text-teal-400 tabular-nums",children:t.traceTag.slice(0,8)})]}),e.jsxs("span",{children:[e.jsx("span",{className:"opacity-60",children:"SNR"})," ",e.jsxs("code",{className:"text-accent-secondary tabular-nums",children:[t.linkQuality.minSnr.toFixed(1),"–",t.linkQuality.maxSnr.toFixed(1)]}),e.jsx("span",{className:"opacity-60",children:" dB"})]})]}),t.bestObservation?e.jsx(_t,{packet:t.bestObservation.packet,neighbors:l,localHash:null==r?void 0:r.local_hash,direction:"flowchart",compact:!0,overridePath:t.targetPath,traceSnr:t.bestObservation.decoded.snrValues}):e.jsx("div",{className:"p-8 text-center text-text-muted text-xs",children:"No path data available"})]})]})]})]})]})});function It({message:t}){return e.jsxs("div",{className:"flex flex-col items-center justify-center py-14 text-center",children:[e.jsx(v,{className:"size-6 text-text-muted mb-2"}),e.jsx("p",{className:"text-sm text-text-primary",children:t}),e.jsx("p",{className:"text-xs text-text-muted",children:"Packets will appear here"})]})}function $t(){return e.jsx("div",{className:"py-14 text-center text-sm text-text-muted",children:"Loading packets…"})}function Vt({showPagination:t,currentPage:s,perPage:a,displayCount:n,totalCount:r,action:l}){const i=t?(s-1)*a+1:1,c=t?Math.min(s*a,r):n;return e.jsxs("div",{className:"flex items-center justify-between gap-4 border-t border-white/5 px-4 py-3 text-xs text-text-muted sm:px-6",children:[e.jsxs("span",{children:["Showing"," ",e.jsx("span",{className:"font-medium text-text-secondary",children:t?`${i}–${c}`:n})," ","of"," ",e.jsx("span",{className:"font-medium text-text-secondary",children:r})," ","packets"]}),l]})}function Qt({packets:s,allPackets:a,localHash:n,neighbors:r,loading:l=!1,maxPackets:i,perPage:c=50,showPagination:o=!1,onPacketSelect:d,flashNewest:x=!1,emptyMessage:m="No packets found",className:p,footerAction:h}){const[u,g]=t.useState(null),[f,j]=t.useState(null),[y,b]=t.useState({traceTag:null,dupeGroup:null});t.useLayoutEffect(()=>{b({traceTag:null,dupeGroup:null})},[s]);const N=a??s,v=t.useMemo(()=>i&&i>0?s.slice(0,i):s,[s,i]),{currentPage:w,totalPages:k,goToPage:C,pageRange:S}=function(e,s,a){const[n,r]=t.useState(1),l=a?Math.ceil(e/s):1;t.useEffect(()=>{n>l&&l>0&&queueMicrotask(()=>r(1))},[l,n]);const i=t.useCallback(e=>r(Math.max(1,Math.min(e,l))),[l]),c=t.useMemo(()=>function(e,t,s=1){if(t<=7)return Array.from({length:t},(e,t)=>t+1);const a=Math.max(e-s,1),n=Math.min(e+s,t),r=a>2,l=nt+1),"gap",t]}if(r&&!l){const e=3+2*s;return[1,"gap",...Array.from({length:e},(s,a)=>t-e+a+1)]}return[1,"gap",...Array.from({length:n-a+1},(e,t)=>a+t),"gap",t]}(n,l),[n,l]);return{currentPage:n,totalPages:l,goToPage:i,pageRange:c}}(v.length,c,o),P=t.useMemo(()=>{if(!o)return v;const e=(w-1)*c;return v.slice(e,e+c)},[v,o,w,c]),_=t.useMemo(()=>function(e){const t=new Map;for(const s of e)if((s.payload_type??s.type)===ne.TRACE&&s.payload&&s.packet_hash){const e=Be(s.payload);e&&t.set(s.packet_hash,e)}return t}(P),[P]),T=t.useMemo(()=>function(e){const t=new Map;if(0===e.length)return t;for(let s=0;s{var t,a;if(!s||!e.length)return;const l=(null==(t=e[0])?void 0:t.timestamp)??0,i=l>r.current&&r.current>0;if(r.current=l,!i)return;const c=null==(a=e[0])?void 0:a.packet_hash;if(!c)return;const o=requestAnimationFrame(()=>n(c)),d=setTimeout(()=>n(null),600);return()=>{cancelAnimationFrame(o),clearTimeout(d)}},[e,s]),a}(s,x),B=t.useCallback((e,t)=>{var s,a;const n=e.packet_hash;if(!n)return[e];let r=t;for(;r>0&&(null==(s=P[r-1])?void 0:s.packet_hash)===n;)r--;let l=t;for(;l{var t,s;const a=null==(t=P[e])?void 0:t.packet_hash;if(!a)return e;let n=e;for(;n>0&&(null==(s=P[n-1])?void 0:s.packet_hash)===a;)n--;return n},[P]),F=t.useCallback(e=>{var t,s;const a=null==(t=P[e])?void 0:t.packet_hash;if(!a)return e;let n=e;for(;n{if(d)d(e);else if(void 0!==t){const s=B(e,t),a=s.indexOf(e);g({packets:s,initialIndex:a>=0?a:0,rowIndex:t})}else g({packets:[e],initialIndex:0,rowIndex:0})},[d,B]),D=t.useCallback(()=>{if(!u)return;const e=M(u.rowIndex)-1;if(e<0)return;const t=P[e];if(!t)return;const s=B(t,e);g({packets:s,initialIndex:0,rowIndex:e})},[u,P,M,B]),z=t.useCallback(()=>{if(!u)return;const e=F(u.rowIndex)+1;if(e>=P.length)return;const t=P[e];if(!t)return;const s=B(t,e);g({packets:s,initialIndex:0,rowIndex:e})},[u,P,F,B]),A=t.useMemo(()=>!!u&&M(u.rowIndex)>0,[u,M]),R=t.useMemo(()=>!!u&&F(u.rowIndex)b(t=>({...t,traceTag:e})),[]),I=t.useCallback(e=>b(t=>({...t,dupeGroup:e})),[]),$=t.useCallback(()=>{b({traceTag:null,dupeGroup:null})},[]),V=t.useCallback(e=>{const t=N.filter(t=>(t.payload_type??t.type)===ne.TRACE&&t.payload&&Be(t.payload)===e);if(0===t.length)return;const s=function(e){const t=new Map;for(const s of e){const e=Fe(s);if(!e)continue;const a=e.decoded.traceTag,n=t.get(a)||[];n.push(e),t.set(a,n)}for(const[s,a]of t)a.sort((e,t)=>e.timestamp-t.timestamp),t.set(s,a);return t}(t),a=s.get(e);(null==a?void 0:a.length)&&j(function(e,t){if(0===t.length)return{traceTag:e,traceTagValue:0,targetPath:[],targetHopCount:0,observations:[],observationCount:0,firstSeen:0,lastSeen:0,duration:0,isComplete:!1,maxHopsObserved:0,progressPercent:0,bestObservation:null,hopStats:[],linkQuality:null};const s=[...t].sort((e,t)=>e.timestamp-t.timestamp),a=s.reduce((e,t)=>t.hopCount>e.hopCount?t:e,s[0]),n=s[0].timestamp,r=s[s.length-1].timestamp,l=a.decoded.pathHashes,i=l.length,c=a.hopCount,o=a.decoded.isComplete,d=[],x=a.decoded.snrValues;for(let p=0;p0){const e=Math.min(...x),t=Math.max(...x);m={minSnr:e,maxSnr:t,avgSnr:x.reduce((e,t)=>e+t,0)/x.length,weakestLinkPosition:x.indexOf(e),strongestLinkPosition:x.indexOf(t)}}return{traceTag:e,traceTagValue:a.decoded.traceTagValue,targetPath:l,targetHopCount:i,observations:s,observationCount:s.length,firstSeen:n,lastSeen:r,duration:r-n,isComplete:o,maxHopsObserved:c,progressPercent:i>0?Math.round(c/i*100):0,bestObservation:a,hopStats:d,linkQuality:m,srcHash:a.packet.src_hash,dstHash:a.packet.dst_hash}}(e,a))},[N]),Q=t.useCallback(e=>{const t=N.find(t=>t.packet_hash===e);t&&(j(null),L(t))},[N,L]),O=t=>{if(l&&0===s.length)return e.jsx($t,{});if(0===P.length)return e.jsx(It,{message:m});const a=t?Oe:Qe;return P.map((t,s)=>{const l=t.packet_hash?_.get(t.packet_hash):void 0,i=null!==y.traceTag&&l===y.traceTag,c=T.get(s),o=void 0!==c&&null!==y.dupeGroup&&t.packet_hash===y.dupeGroup;return e.jsx(a,{packet:t,onClick:e=>L(e,s),localHash:n,neighbors:r,isFlashing:x&&H===t.packet_hash,traceTag:l,isTraceHighlighted:i,onTraceHover:U,onViewTraceReport:V,dupeGroupPosition:c,isDupeGroupHovered:o,onDupeGroupHover:I},`${t.packet_hash}_${t.timestamp}_${s}`)})};return e.jsxs("div",{className:E("flex flex-col",p),onMouseLeave:$,children:[e.jsx("div",{className:"hidden divide-y divide-white/5 py-1 sm:block",children:O(!1)}),e.jsx("div",{className:"divide-y divide-white/5 sm:hidden",children:O(!0)}),o&&k>1&&e.jsx("nav",{className:"border-t border-white/5 px-4 py-3",children:e.jsxs(Ce,{className:"justify-center",children:[e.jsx(Se,{onClick:()=>C(w-1),disabled:1===w}),e.jsx(_e,{children:S.map((t,s)=>"gap"===t?e.jsx(He,{},`gap-${s}`):e.jsx(Te,{page:t,current:t===w,onClick:C},t))}),e.jsx(Pe,{onClick:()=>C(w+1),disabled:w===k})]})}),e.jsx(Vt,{showPagination:o,currentPage:w,perPage:c,displayCount:P.length,totalCount:o?v.length:s.length,action:h}),!d&&u&&e.jsx(Ft,{packets:u.packets,initialIndex:u.initialIndex,onClose:()=>g(null),onNavigatePrev:D,onNavigateNext:z,hasPrev:A,hasNext:R}),f&&e.jsx(Ut,{report:f,onClose:()=>j(null),onViewPacket:Q})]})}export{Qt as P,Ae as g}; diff --git a/frontend/dist/assets/PacketList-CFuBvjqk.js b/frontend/dist/assets/PacketList-CFuBvjqk.js new file mode 100644 index 00000000..55a726b1 --- /dev/null +++ b/frontend/dist/assets/PacketList-CFuBvjqk.js @@ -0,0 +1,2 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PathMapMapLibre-CHzpOlxn.js","assets/vendor-react-DCIF8YoJ.js","assets/BasemapLayer-g9CXC1Ky.js","assets/vendor-core-Dl9MTgSr.js","assets/useThemeColors-CGx-Jxyf.js","assets/index-BGs2yNOg.js","assets/car-DXNv2W8D.js","assets/house-CCeK_0TO.js","assets/channel-keys-DJWRrSwE.js","assets/SignalIndicator-DWWkJgSd.js","assets/arrow-up-ce4_7z5E.js","assets/DataBox-nCNZLfvU.js","assets/check-qb29v-su.js","assets/arrow-right-C9AHsGJs.js","assets/chevron-right-7sotkg9l.js","assets/loader-circle-CwUrmZrV.js","assets/map-pin-x5eP-WEg.js","assets/zap-CQ3I2hAj.js","assets/triangle-alert-2-1YN-Am.js","assets/route-DRIRJjaN.js","assets/chevron-up-ClXInh9N.js","assets/circle-check-Bd9Kbu6i.js","assets/maplibre-gl-B1CfjdFi.css","assets/index-CIefRaAd.css"])))=>i.map(i=>d[i]); +import{a as e,j as t}from"./vendor-react-DCIF8YoJ.js";import{n as s}from"./recharts-DVj1EL-m.js";import{c as a,H as n,V as r,I as i,J as l,M as c,K as o,N as d,O as x,Q as p,U as m,W as h,Y as u,Z as f,_ as g,$ as y,a0 as j,a1 as b,a2 as v,a3 as N,a4 as w,a5 as k,a6 as C,a7 as S,a8 as M,a9 as P,aa as T,ab as H,ac as _,G as B,B as F,ad as A,ae as D,af as L,ag as $,ah as z,p as R,ai as E,aj as I,m as U,ak as V,al as O,R as W,am as Q,f as G,an as q,ao as K,ap as Y,aq as J,ar as X,A as Z,as as ee,C as te,at as se,au as ae,av as ne,aw as re,ax as ie,ay as le,az as ce}from"./index-BGs2yNOg.js";import{P as oe,d as de,g as xe,a as pe,h as me,b as he,c as ue,e as fe,f as ge,i as ye,j as je}from"./channel-keys-DJWRrSwE.js";import{D as be,S as ve,R as Ne,P as we,a as ke,g as Ce}from"./SignalIndicator-DWWkJgSd.js";import{a as Se,A as Me}from"./arrow-up-ce4_7z5E.js";import{C as Pe,D as Te}from"./DataBox-nCNZLfvU.js";import{A as He}from"./arrow-right-C9AHsGJs.js";import{C as _e}from"./chevron-right-7sotkg9l.js";import{L as Be}from"./loader-circle-CwUrmZrV.js";import{_ as Fe}from"./deckgl-DTsmDcfs.js";import{M as Ae}from"./map-pin-x5eP-WEg.js";import{C as De,Z as Le}from"./zap-CQ3I2hAj.js";import{T as $e}from"./triangle-alert-2-1YN-Am.js";import{L as ze,H as Re,R as Ee}from"./route-DRIRJjaN.js";import{A as Ie,C as Ue}from"./chevron-up-ClXInh9N.js";import{C as Ve}from"./circle-check-Bd9Kbu6i.js";import{D as Oe,H as We}from"./house-CCeK_0TO.js";import{g as Qe,s as Ge}from"./useThemeColors-CGx-Jxyf.js";const qe=a("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),Ke=a("corner-down-right",[["path",{d:"m15 10 5 5-5 5",key:"qqa56n"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]),Ye=a("lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]),Je=a("reply",[["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}],["path",{d:"m9 17-5-5 5-5",key:"nvlc11"}]]),Xe=a("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]),Ze=a("stethoscope",[["path",{d:"M11 2v2",key:"1539x4"}],["path",{d:"M5 2v2",key:"1yf1q8"}],["path",{d:"M5 3H4a2 2 0 0 0-2 2v4a6 6 0 0 0 12 0V5a2 2 0 0 0-2-2h-1",key:"rb5t3r"}],["path",{d:"M8 15a6 6 0 0 0 12 0v-3",key:"x18d4x"}],["circle",{cx:"20",cy:"10",r:"2",key:"ts1r5v"}]]),et=a("trophy",[["path",{d:"M10 14.66v1.626a2 2 0 0 1-.976 1.696A5 5 0 0 0 7 21.978",key:"1n3hpd"}],["path",{d:"M14 14.66v1.626a2 2 0 0 0 .976 1.696A5 5 0 0 1 17 21.978",key:"rfe1zi"}],["path",{d:"M18 9h1.5a1 1 0 0 0 0-5H18",key:"7xy6bh"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M6 9a6 6 0 0 0 12 0V3a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1z",key:"1mhfuq"}],["path",{d:"M6 9H4.5a1 1 0 0 1 0-5H6",key:"tex48p"}]]),tt=a("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);function st(e,t){return n(e)?e[((e,t,s)=>{const a=t-0;return((s-0)%a+a)%a+0})(0,e.length,t)]:e}class at{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}get finished(){return Promise.all(this.animations.map(e=>e.finished))}getAll(e){return this.animations[0][e]}setAll(e,t){for(let s=0;st.attachTimeline(e));return()=>{t.forEach((e,t)=>{e&&e(),this.animations[t].stop()})}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get state(){return this.getAll("state")}get startTime(){return this.getAll("startTime")}get duration(){return nt(this.animations,"duration")}get iterationDuration(){return nt(this.animations,"iterationDuration")}runAll(e){this.animations.forEach(t=>t[e]())}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}function nt(e,t){let s=0;for(let a=0;as&&(s=n)}return s}class rt extends at{then(e,t){return this.finished.finally(e).then(()=>{})}}class it extends r{constructor(){super(...arguments),this.type="object"}readValueFromInstance(e,t){if(function(e,t){return e in t}(t,e)){const s=e[t];if("string"==typeof s||"number"==typeof s)return s}}getBaseTargetFromProps(){}removeValueFromRenderState(e,t){delete t.output[e]}measureInstanceViewportBox(){return i()}build(e,t){Object.assign(e.output,t)}renderInstance(e,{output:t}){Object.assign(e,t)}sortInstanceNodePosition(){return 0}}function lt({children:s,isValidProp:a,...n}){a&&l(a),(n={...e.useContext(c),...n}).isStatic=o(()=>n.isStatic);const r=e.useMemo(()=>n,[JSON.stringify(n.transition),n.transformPagePoint,n.reducedMotion]);return t.jsx(c.Provider,{value:r,children:s})}function ct(e,t){[...t].reverse().forEach(s=>{const a=e.getVariant(s);a&&p(e,a),e.variantChildren&&e.variantChildren.forEach(e=>{ct(e,t)})})}function ot(){const e=new Set,t={subscribe:t=>(e.add(t),()=>{e.delete(t)}),start(t,s){const a=[];return e.forEach(e=>{a.push(x(e,t,{transitionOverride:s}))}),Promise.all(a)},set:t=>e.forEach(e=>{!function(e,t){Array.isArray(t)?ct(e,t):"string"==typeof t?ct(e,[t]):p(e,t)}(e,t)}),stop(){e.forEach(e=>{!function(e){e.values.forEach(e=>e.stop())}(e)})},mount:()=>()=>{t.stop()}};return t}function dt(e){return"object"==typeof e&&!Array.isArray(e)}function xt(e,t,s,a){return null==e?[]:"string"==typeof e&&dt(t)?m(e,s,a):e instanceof NodeList?Array.from(e):Array.isArray(e)?e.filter(e=>null!=e):[e]}function pt(e,t,s){return e*(t+1)}function mt(e,t,s,a){return"number"==typeof t?t:t.startsWith("-")||t.startsWith("+")?Math.max(0,e+parseFloat(t)):"<"===t?s:t.startsWith("<")?Math.max(0,s+parseFloat(t.slice(1))):a.get(t)??e}function ht(e,t,s,a,n,r){!function(e,t,s){for(let a=0;at&&n.at"number"==typeof e,Nt=e=>e.every(vt);function wt(e){const t={presenceContext:null,props:{},visualState:{renderState:{transform:{},transformOrigin:{},style:{},vars:{},attrs:{}},latestValues:{}}},s=w(e)&&!k(e)?new C(t):new S(t);s.mount(e),M.set(e,s)}function kt(e){const t=new it({presenceContext:null,props:{},visualState:{renderState:{output:{}},latestValues:{}}});t.mount(e),M.set(e,t)}function Ct(e,t,s,a){const n=[];if(function(e,t){return f(e)||"number"==typeof e||"string"==typeof e&&!dt(t)}(e,t))n.push(P(e,dt(t)&&t.default||t,s&&s.default||s));else{if(null==e)return n;const r=xt(e,t,a),i=r.length;for(let e=0;e{const c=jt(e),{delay:o=0,times:d=g(c),type:m=t.type||"keyframes",repeat:h,repeatType:u,repeatDelay:f=0,...w}=s;let{ease:k=t.ease||"easeOut",duration:C}=s;const S="function"==typeof o?o(i,l):o,M=c.length,P=b(m)?m:null==n?void 0:n[m||"keyframes"];if(M<=2&&P){let e=100;if(2===M&&Nt(c)){const t=c[1]-c[0];e=Math.abs(t)}const s={...t,...w};void 0!==C&&(s.duration=v(C));const a=y(s,e,P);k=a.ease,C=a.duration}C??(C=r);const T=x+S;1===d.length&&0===d[0]&&(d[1]=1);const H=d.length-c.length;if(H>0&&j(d,H),1===c.length&&c.unshift(null),h){C=pt(C,h);const e=[...c],t=[...d];k=Array.isArray(k)?[...k]:[k];const s=[...k];for(let a=0;a{for(const n in e){const r=e[n];r.sort(ft);const l=[],c=[],o=[];for(let e=0;e{a.push(...Ct(s,e,t))}),a}(e,t,Mt);else{const{onComplete:r,...i}=s||{};"function"==typeof r&&(a=r),n=Ct(e,t,i,Mt)}var r;const i=new rt(n);return a&&i.finished.then(a),i};var Mt;function Pt(){const e=o(ot);return _(e.mount,[]),e}function Tt({"aria-label":e="Page navigation",className:a,...n}){return t.jsx("nav",{"aria-label":e,...n,className:s("flex gap-x-2",a)})}function Ht({onClick:e,disabled:a=!1,className:n,children:r="Previous"}){return t.jsx("span",{className:s("grow basis-0",n),children:t.jsxs(B,{plain:!0,onClick:e,disabled:a,"aria-label":"Previous page",className:s("gap-1",a&&"invisible"),children:[t.jsx("svg",{className:"size-4 stroke-current",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:t.jsx("path",{d:"M2.75 8H13.25M2.75 8L5.25 5.5M2.75 8L5.25 10.5",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})}),r]})})}function _t({onClick:e,disabled:a=!1,className:n,children:r="Next"}){return t.jsx("span",{className:s("flex grow basis-0 justify-end",n),children:t.jsxs(B,{plain:!0,onClick:e,disabled:a,"aria-label":"Next page",className:s("gap-1",a&&"invisible"),children:[r,t.jsx("svg",{className:"size-4 stroke-current",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:t.jsx("path",{d:"M13.25 8L2.75 8M13.25 8L10.75 10.5M13.25 8L10.75 5.5",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})})]})})}function Bt({className:e,...a}){return t.jsx("span",{...a,className:s("hidden items-baseline gap-x-2 sm:flex",e)})}function Ft({page:e,current:a=!1,onClick:n,className:r,children:i}){return t.jsx(B,{plain:!a,outline:a,onClick:()=>null==n?void 0:n(e),"aria-label":`Page ${e}`,"aria-current":a?"page":void 0,className:s("min-w-[2.25rem] before:absolute before:-inset-px before:rounded-lg",a&&"before:bg-white/5",r),children:i??e})}function At({className:e,...a}){return t.jsx("span",{"aria-hidden":"true",...a,className:s("w-[2.25rem] select-none text-center text-sm text-text-muted",e),children:"…"})}function Dt(e){if(!e||e.length<8)return null;const t=parseInt(e.slice(0,2),16),s=parseInt(e.slice(2,4),16),a=parseInt(e.slice(4,6),16),n=parseInt(e.slice(6,8),16);return isNaN(t)||isNaN(s)||isNaN(a)||isNaN(n)?null:((t|s<<8|a<<16|n<<24)>>>0).toString(16).toUpperCase().padStart(8,"0")}function Lt(e){return e>=10?"excellent":e>=5?"good":e>=0?"fair":e>=-5?"poor":"critical"}function $t(e){if(!e.payload)return null;try{const t=me(e.payload),s=function(e){const t=e.original_path||e.forwarded_path||[];if("string"==typeof t)try{const e=JSON.parse(t);if(Array.isArray(e))return e.map(e=>parseInt(e,16))}catch{return[]}else if(Array.isArray(t))return t.map(e=>parseInt(e,16));return[]}(e),a=he(t,s);return a?{packet:e,decoded:a,timestamp:e.timestamp??0,hopCount:a.snrValues.length,rssi:e.rssi,snr:e.snr}:null}catch{return null}}const zt={rx:{icon:Me,label:"Rx",badgeColor:be.rx,avatarBg:"bg-emerald-500/15",avatarText:"text-emerald-400"},forward:{icon:He,label:"Fwd",badgeColor:be.forward,avatarBg:"bg-sky-500/15",avatarText:"text-sky-400"},duplicate:{icon:Pe,label:"Dupe",badgeColor:be.duplicate,avatarBg:"bg-zinc-500/15",avatarText:"text-zinc-400"},tx:{icon:Se,label:"Tx",badgeColor:be.tx,avatarBg:"bg-violet-500/15",avatarText:"text-violet-400"},dropped:{icon:Ke,label:"Drop",badgeColor:be.dropped,avatarBg:"bg-amber-500/15",avatarText:"text-amber-400"}},Rt={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},Et={sm:"w-7 h-7",md:"w-8 h-8",lg:"w-9 h-9"};function It(e){return"tx_local"===e.packet_origin?"tx":"tx_forward"===e.packet_origin?"forward":e.is_duplicate?"duplicate":e.transmitted?"forward":e.drop_reason?"dropped":"rx"}const Ut=e.memo(function({packet:e,showLabel:a=!0,variant:n="avatar",size:r="sm"}){const i=It(e),l=zt[i],c=l.icon;return"avatar"===n?t.jsx("div",{className:s("flex items-center justify-center rounded-full flex-shrink-0",l.avatarBg,Et[r]),children:t.jsx(c,{className:s(Rt[r],l.avatarText)})}):t.jsxs(F,{color:l.badgeColor,children:[t.jsx(c,{className:Rt[r]}),a&&l.label]})}),Vt=e.memo(function({path:e,localHash:a,className:n}){if(!e||0===e.length)return t.jsx("span",{className:s("text-white/30 text-[10px]",n),children:"—"});const r=a?(a.startsWith("0x")?a.slice(2,4):a.slice(0,2)).toUpperCase():null;return t.jsx("span",{className:s("flex items-center gap-0.5 font-mono text-[10px] overflow-hidden",n),children:e.map((s,a)=>{const n=a===e.length-1,i=r&&s.toUpperCase()===r;return t.jsxs("span",{className:"flex items-center flex-shrink-0",children:[i?t.jsx("span",{className:"px-1 py-0.5 rounded bg-amber-500/20 text-amber-400 text-[9px] font-medium",children:"You"}):t.jsx("span",{className:"px-1 py-0.5 rounded bg-white/[0.06] text-white/60",children:s.toUpperCase()}),!n&&t.jsx(_e,{className:"w-2.5 h-2.5 text-white/20 mx-0.5 flex-shrink-0"})]},`${s}-${a}`)})})}),Ot=e.memo(function({count:e,className:a}){const n=e>=2;return t.jsxs("span",{className:s("font-mono text-xs tabular-nums",n?"text-white/70":"text-white/30",a),children:[e,t.jsx("span",{className:"text-white/20",children:"→"})]})});function Wt(e){const t=e.payload_type_name||L(e.payload_type??e.type),s=e.route_type_name||$(e.route_type??e.route);return{payloadType:t,routeType:s,payloadColor:we[t]??"zinc",routeColor:Ne[s]??"zinc"}}function Qt(e){if(!e)return[];if(Array.isArray(e))return e;try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function Gt(e,t){if(!e||!t)return null;const s=e.startsWith("0x")?e.slice(2):e;for(const[a,n]of Object.entries(t))if((a.startsWith("0x")?a.slice(2):a).toLowerCase().startsWith(s.toLowerCase()))return n.name||n.node_name||null;return null}const qt=e.memo(function({packet:a,onClick:n,localHash:r,neighbors:i,isFlashing:l=!1,isPending:c,isTraceHighlighted:o,onTraceHover:d,traceTag:x,onViewTraceReport:p,dupeGroupPosition:m,isDupeGroupHovered:h=!1,onDupeGroupHover:u}){const f=A(a.is_duplicate),g=void 0!==m,{payloadType:y,routeType:j,payloadColor:b,routeColor:v}=Wt(a),N="tx_local"===a.packet_origin,w=c??a.isPending,k="TRACE"===y,C=Qt(a.original_path),S=Qt(a.forwarded_path),M=S.length>0?S:C,P=M.length,T=a.src_hash?(a.src_hash.startsWith("0x")?a.src_hash.slice(2,6):a.src_hash.slice(0,4)).toUpperCase():null,H=Gt(a.src_hash,i),_=a.payload_length??a.length??0;a.lbt_attempts;const B=e.useCallback(()=>{k&&x&&p?p(x):n(a)},[k,x,p,n,a]),L=e.useCallback(()=>{k&&x&&d&&d(x),g&&u&&a.packet_hash&&u(a.packet_hash)},[k,x,d,g,u,a.packet_hash]),$=e.useCallback(()=>{d&&d(null),u&&u(null)},[d,u]),z={lime:"rgb(132, 204, 22)",cyan:"rgb(34, 211, 238)",amber:"rgb(251, 191, 36)",violet:"rgb(167, 139, 250)",rose:"rgb(251, 113, 133)",emerald:"rgb(52, 211, 153)",sky:"rgb(56, 189, 248)",orange:"rgb(251, 146, 60)",pink:"rgb(244, 114, 182)",zinc:"rgb(161, 161, 170)",purple:"rgb(168, 85, 247)",indigo:"rgb(129, 140, 248)",teal:"rgb(45, 212, 191)",fuchsia:"rgb(232, 121, 249)",blue:"rgb(59, 130, 246)",green:"rgb(34, 197, 94)",yellow:"rgb(250, 204, 21)",red:"rgb(239, 68, 68)",brown:"rgb(168, 133, 107)"},R=z[b]||z.zinc,E=h;return t.jsxs("div",{onClick:B,onMouseEnter:L,onMouseLeave:$,className:s("group relative cursor-pointer","hover:bg-white/[0.02]",f&&!h&&"opacity-40",l&&"flash-row",w&&"opacity-70",N&&"bg-violet-500/5",o&&"bg-teal-500/10"),children:[t.jsx("div",{className:s("absolute pointer-events-none transition-opacity duration-75",g?E?"opacity-100":"opacity-0":"opacity-0 group-hover:opacity-100"),style:(()=>{const e={pointerEvents:"none"};return"first"===m?{...e,borderTop:`2px solid ${R}`,borderLeft:`2px solid ${R}`,borderRight:`2px solid ${R}`,borderBottom:"none",borderRadius:"8px 8px 0 0",inset:"-2px -2px 0 -2px"}:"middle"===m?{...e,borderTop:"none",borderLeft:`2px solid ${R}`,borderRight:`2px solid ${R}`,borderBottom:"none",borderRadius:0,inset:"0 -2px"}:"last"===m?{...e,borderTop:"none",borderLeft:`2px solid ${R}`,borderRight:`2px solid ${R}`,borderBottom:`2px solid ${R}`,borderRadius:"0 0 8px 8px",inset:"0 -2px -2px -2px"}:{...e,border:`2px solid ${R}`,borderRadius:"8px",inset:"-2px"}})()}),t.jsxs("div",{className:"relative flex items-center gap-2 min-[600px]:gap-3 px-2 py-2 min-[600px]:px-3 min-[600px]:py-2.5",children:[t.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[t.jsxs("div",{className:"relative flex-shrink-0",children:[t.jsx(Ut,{packet:a,variant:"avatar",size:"sm"}),w&&t.jsx(Be,{className:"absolute -right-1 -bottom-1 w-3 h-3 text-amber-400 animate-spin"})]}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"font-bold text-[13px] text-white font-sans truncate",children:T||"—"}),H&&t.jsx("div",{className:"hidden min-[900px]:block text-[9px] text-white/40 truncate max-w-[70px]",children:H})]})]}),t.jsxs("div",{className:"flex-1 flex items-center gap-1 min-[600px]:gap-1.5 min-[900px]:gap-2 min-w-0",children:[t.jsx("span",{className:"text-[10px] min-[600px]:text-[11px] text-white/50 font-mono tabular-nums whitespace-nowrap flex-shrink-0",children:D(a.timestamp)}),t.jsx(F,{color:b,className:"flex-shrink-0",children:y}),t.jsx("span",{className:"min-[600px]:hidden text-[10px] font-mono text-white/40 flex-shrink-0",children:j.charAt(0)}),t.jsx(F,{color:v,className:"flex-shrink-0 hidden min-[600px]:inline-flex",children:j}),t.jsx("div",{className:"flex-shrink-0 flex items-center",children:t.jsx(Ot,{count:P})}),t.jsxs("span",{className:"hidden min-[520px]:inline text-[10px] text-white/40 font-mono flex-shrink-0",children:[_,"B"]}),t.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:t.jsx(Vt,{path:M,localHash:r})})]}),t.jsx("div",{className:"flex-shrink-0",children:t.jsx(ve,{rssi:a.rssi,snr:a.snr,compact:!0,showValues:!0})})]})]})}),Kt=e.memo(function({packet:e,onClick:a,localHash:n,neighbors:r,isFlashing:i=!1,isPending:l,isTraceHighlighted:c,traceTag:o,onViewTraceReport:d,dupeGroupPosition:x,isDupeGroupHovered:p=!1,onDupeGroupHover:m}){const{payloadType:h,routeType:u,payloadColor:f,routeColor:g}=Wt(e),y="tx_local"===e.packet_origin,j=l??e.isPending,b="TRACE"===h,v=A(e.is_duplicate),N=Qt(e.original_path),w=Qt(e.forwarded_path),k=w.length>0?w:N,C=k.length,S=e.src_hash?(e.src_hash.startsWith("0x")?e.src_hash.slice(2,6):e.src_hash.slice(0,4)).toUpperCase():null,M=Gt(e.src_hash,r),P=e.payload_length??e.length??0,T=e.lbt_attempts??0,H={lime:"rgb(132, 204, 22)",cyan:"rgb(34, 211, 238)",amber:"rgb(251, 191, 36)",violet:"rgb(167, 139, 250)",rose:"rgb(251, 113, 133)",emerald:"rgb(52, 211, 153)",sky:"rgb(56, 189, 248)",orange:"rgb(251, 146, 60)",pink:"rgb(244, 114, 182)",zinc:"rgb(161, 161, 170)",purple:"rgb(168, 85, 247)",indigo:"rgb(129, 140, 248)",teal:"rgb(45, 212, 191)",fuchsia:"rgb(232, 121, 249)",blue:"rgb(59, 130, 246)",green:"rgb(34, 197, 94)",yellow:"rgb(250, 204, 21)",red:"rgb(239, 68, 68)"},_=H[f]||H.zinc;return t.jsxs("div",{onClick:()=>{b&&o&&d?d(o):a(e)},className:s("relative pl-3 pr-2.5 py-2 cursor-pointer","active:bg-white/[0.04]",v&&"opacity-40",i&&"flash-row",j&&"opacity-70",y&&"bg-violet-500/5",c&&"bg-teal-500/10"),children:[t.jsx("div",{className:"absolute left-0 transition-all",style:(()=>{if(!x)return{opacity:0};const e=p?1:.4,t=p?"3px":"2px";return"first"===x?{backgroundColor:_,opacity:e,width:t,top:"6px",bottom:0,borderRadius:"0 9999px 0 0"}:"middle"===x?{backgroundColor:_,opacity:e,width:t,top:0,bottom:0,borderRadius:0}:"last"===x?{backgroundColor:_,opacity:e,width:t,top:0,bottom:"6px",borderRadius:"0 0 9999px 0"}:{backgroundColor:_,opacity:e,width:t,top:"6px",bottom:"6px",borderRadius:"9999px"}})()}),t.jsxs("div",{className:"flex items-start gap-2",children:[t.jsxs("div",{className:"relative flex-shrink-0 mt-0.5",children:[t.jsx(Ut,{packet:e,variant:"avatar",size:"sm"}),j&&t.jsx(Be,{className:"absolute -right-1 -bottom-1 w-2.5 h-2.5 text-amber-400 animate-spin"})]}),t.jsxs("div",{className:"flex-1 min-w-0 space-y-0.5",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:"font-semibold text-[14px] text-white tracking-tight",children:S||"—"}),M&&t.jsx("span",{className:"text-[12px] text-white/40 truncate max-w-[80px]",children:M}),t.jsx("div",{className:"flex-1"}),t.jsx(F,{color:f,className:"flex-shrink-0 !text-[9px] !px-1.5 !py-0",children:h}),t.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[t.jsx("span",{className:"text-[10px] font-mono text-white/50 tabular-nums w-[28px] text-right",children:e.rssi}),t.jsx(ve,{rssi:e.rssi,compact:!0,showValues:!1})]})]}),t.jsxs("div",{className:"flex items-center gap-1 text-[10px] text-white/40 font-mono",children:[t.jsx("span",{className:"tabular-nums",children:D(e.timestamp)}),t.jsx(F,{color:g,className:"!text-[8px] !px-1 !py-0 !leading-none",children:u.charAt(0)}),C>0&&t.jsxs("span",{className:"text-white/30",children:[C,"h"]}),P>0&&t.jsxs("span",{className:"text-white/30",children:[P,"B"]}),T>0&&t.jsxs("span",{className:T>1?"text-amber-400/60":"text-white/30",children:["LBT:",T]}),null!=e.snr&&t.jsxs("span",{className:"text-white/30",children:[e.snr.toFixed(0),"dB"]})]}),C>0&&t.jsx("div",{className:"pt-0.5",children:t.jsx(Vt,{path:k,localHash:n})})]})]})]})});function Yt(e){if(e.contact_type){const t=e.contact_type.toLowerCase();if("repeater"===t||"rep"===t)return!0;if("companion"===t||"client"===t||"cli"===t)return!1;if("room server"===t||"room_server"===t||"room"===t||"server"===t)return!1}return!0===e.is_repeater||(e.is_repeater,!1)}const Jt=e.lazy(()=>Fe(()=>import("./PathMapMapLibre-CHzpOlxn.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23])));function Xt(e){return`${(100*e).toFixed(0)}%`}function Zt(e,t){const s=document.documentElement,a=getComputedStyle(s),n={success:a.getPropertyValue("--accent-success").trim()||"#39D98A",secondary:a.getPropertyValue("--accent-secondary").trim()||"#F9D26F",poor:a.getPropertyValue("--signal-poor").trim()||"#FF8A5C",danger:a.getPropertyValue("--accent-danger").trim()||"#FF5C7A",muted:a.getPropertyValue("--text-muted").trim()||"#767688"};let r;return r=0===t?n.muted:e>=1?n.success:e>=.5?n.secondary:e>=.25?n.poor:e>0?n.danger:n.muted,{color:r}}class es extends e.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}render(){return this.state.hasError?t.jsxs("div",{className:"h-[200px] flex items-center justify-center text-text-muted",children:[t.jsx($e,{className:"w-4 h-4 mr-2"}),"Map failed to load"]}):this.props.children}}function ts({path:a,neighbors:n,localNode:r,localHash:i,srcHash:l,dstHash:c,neighborAffinity:o,prefixLookup:d,hubNodes:x,traceSnr:p,advertiserSource:m}){const[h,u]=e.useState(null),f=e.useMemo(()=>{if(!m)return null;const e="wardrive"===m.nodeType;return{prefix:m.prefix||"??",candidates:[{hash:m.publicKey||m.prefix||"source",name:m.name,latitude:m.latitude,longitude:m.longitude,probability:1,isLocal:!1,isWardrive:e}],confidence:1,totalMatches:1,isSource:!0}},[m]),g=e.useMemo(()=>{if(m)return null;if(!l)return null;const e=R(l),t=n[l];if((null==t?void 0:t.latitude)&&(null==t?void 0:t.longitude)&&(0!==t.latitude||0!==t.longitude))return{prefix:e,candidates:[{hash:l,name:t.node_name||t.name||"Source",latitude:t.latitude,longitude:t.longitude,probability:1,isLocal:!1,isDirectNeighbor:!0===t.zero_hop}],confidence:1,totalMatches:1,isSource:!0};const s=(null==t?void 0:t.node_name)||(null==t?void 0:t.name)||l.slice(0,8);return{prefix:e,candidates:[{hash:l,name:s,latitude:0,longitude:0,probability:1,isLocal:!1}],confidence:1,totalMatches:1,isSource:!0}},[m,l,n]),y=e.useMemo(()=>{const e=(null==c?void 0:c.startsWith("0x"))?c.slice(2):c;if((!e||"00"===e||"0000000000000000"===e)&&r&&i){const e=R(i),t=0!==r.latitude||0!==r.longitude;return{prefix:e,candidates:[{hash:i,name:r.name||"Local Node",latitude:t?r.latitude:0,longitude:t?r.longitude:0,probability:1,isLocal:!0}],confidence:1,totalMatches:1,isDestination:!0}}if(!c)return null;const t=R(c);if(i&&c===i&&r){const e=0!==r.latitude||0!==r.longitude;return{prefix:t,candidates:[{hash:c,name:r.name||"Local Node",latitude:e?r.latitude:0,longitude:e?r.longitude:0,probability:1,isLocal:!0}],confidence:1,totalMatches:1,isDestination:!0}}const s=n[c];if((null==s?void 0:s.latitude)&&(null==s?void 0:s.longitude)&&(0!==s.latitude||0!==s.longitude))return{prefix:t,candidates:[{hash:c,name:s.node_name||s.name||"Destination",latitude:s.latitude,longitude:s.longitude,probability:1,isLocal:!1,isDirectNeighbor:!0===s.zero_hop}],confidence:1,totalMatches:1,isDestination:!0};const a=(null==s?void 0:s.node_name)||(null==s?void 0:s.name)||c.slice(0,8);return{prefix:t,candidates:[{hash:c,name:a,latitude:0,longitude:0,probability:1,isLocal:!1}],confidence:1,totalMatches:1,isDestination:!0}},[c,n,r,i]),j=e.useMemo(()=>function(e,t,s,a,n,r){if(!e||0===e.length)return{hops:[],overallConfidence:0,hasValidPath:!1};const i=e.length-1,l=e.map((l,c)=>{const o=c===i,d=e.length-c,{candidates:x,totalMatches:p}=function(e,t,s,a,n=!1,r,i,l){const c=function(e){const t={};for(const[s,a]of Object.entries(e))Yt(a)&&(t[s]=a);return t}(t);let o;if(i){const t=function(e,t,s){const a=t.toUpperCase(),n=e.get(a);if(!n||0===n.candidates.length)return{hash:null,confidence:0};if(null==s?void 0:s.isLastHop)return{hash:n.bestMatch,confidence:n.confidence};if(1===(null==s?void 0:s.position))return{hash:n.bestMatch,confidence:n.confidence};if((null==s?void 0:s.position)&&n.bestMatchForPosition.has(s.position)){const e=n.bestMatchForPosition.get(s.position),t=Math.max(e.confidence,n.confidence);return{hash:e.hash,confidence:t}}if((null==s?void 0:s.adjacentPrefixes)&&s.adjacentPrefixes.length>0){let e=n.bestMatch,t=0;for(const a of n.candidates){let n=0;for(const e of s.adjacentPrefixes)n+=a.adjacentPrefixCounts.get(e.toUpperCase())||0;const r=a.combinedScore+n/Math.max(1,a.totalAdjacentObservations)*.3;r>t&&(t=r,e=a.hash)}return{hash:e,confidence:n.confidence}}return{hash:n.bestMatch,confidence:n.confidence}}(i,e,{position:l,isLastHop:n});o=t.confidence}const{matches:d,probability:x}=function(e,t,s,a,n=!1){const r=e.toUpperCase(),i=[],l=s&&z(r,s);l&&i.push(s);for(const m of Object.keys(t))z(r,m)&&i.push(m);if(n&&l&&s&&1===i.length)return{matches:i,probability:1,bestMatch:s};if(n&&l&&i.length>1){const e=i.filter(e=>e!==s);if(1===e.length)return{matches:i,probability:1,bestMatch:e[0]}}const c=i.length>0?1/i.length:0,o=[...i].sort();let d=null,x=-1;if(1===o.length)d=o[0];else if(o.length>1&&a){for(const e of o){const t=a.get(e),s=t?"number"==typeof t?t:t.combinedScore:0;s>x&&(x=s,d=e)}d||(d=o[0])}else o.length>0&&(d=o[0]);let p=c;if(i.length>1&&a&&x>0){let e=0;for(const t of i){const s=a.get(t);e+=s?"number"==typeof s?s:s.combinedScore:0}e>0&&(p=Math.min(.95,x/e))}return{matches:i,probability:p,bestMatch:d}}(e,c,a,r,n),p=d.length,m=[],h=e.toUpperCase(),u=s&&void 0!==s.latitude&&void 0!==s.longitude&&(0!==s.latitude||0!==s.longitude);for(const g of d){if(a&&z(h,a)&&g===a&&u&&s){m.push({hash:g,name:s.name||"Local Node",latitude:s.latitude,longitude:s.longitude,probability:n?1:x,isLocal:!0});continue}const e=c[g];(null==e?void 0:e.latitude)&&(null==e?void 0:e.longitude)&&(0!==e.latitude||0!==e.longitude)&&m.push({hash:g,name:e.node_name||e.name||"Unknown",latitude:e.latitude,longitude:e.longitude,probability:x,isLocal:!1,isDirectNeighbor:!0===e.zero_hop})}const f=m.length;if(1===f)m[0].probability=o??1;else if(f>1)if(void 0!==o&&o>0){m[0].probability=o;const e=1-o,t=f-1;m.slice(1).forEach(s=>{s.probability=e/t})}else{let e=0;const t=m.map(t=>{if(t.isLocal)return{candidate:t,score:1};const a=null==r?void 0:r.get(t.hash);let n=.5;var i;let l;return u&&s&&(n=(i=function(e,t,s,a){const n=(s-e)*Math.PI/180,r=(a-t)*Math.PI/180,i=Math.sin(n/2)*Math.sin(n/2)+Math.cos(e*Math.PI/180)*Math.cos(s*Math.PI/180)*Math.sin(r/2)*Math.sin(r/2);return 2*Math.atan2(Math.sqrt(i),Math.sqrt(1-i))*6371e3}(s.latitude,s.longitude,t.latitude,t.longitude))<100?1:i<500?.9:i<1e3?.7:i<5e3?.5:i<1e4?.3:.1),a?l=.3*n+.3*a.hopConsistencyScore+.4*a.frequencyScore:(l=n,t.isDirectNeighbor&&(l=Math.max(l,.8))),e+=l,{candidate:t,score:l}});if(e>0)t.forEach(({candidate:t,score:s})=>{t.probability=Math.min(.95,s/e)});else{const e=1/f;m.forEach(t=>t.probability=e)}}return{candidates:m,totalMatches:p}}(l,t,s,a,o,n,r,d),m=x.length>0?Math.max(...x.map(e=>e.probability)):0;return{prefix:l,candidates:x,confidence:m,totalMatches:p}}),c=l.reduce((e,t)=>0===t.confidence?0:e*t.confidence,1),o=l.some(e=>e.candidates.length>0);return{hops:l,overallConfidence:c,hasValidPath:o}}(a,n,r,i,o,d),[a,n,r,i,o,d]),b=e.useMemo(()=>{const e=[];f?e.push(f):g&&e.push(g),e.push(...j.hops),y&&e.push(y);const t=e.reduce((e,t)=>0===t.confidence?0:e*t.confidence,1),s=e.some(e=>e.candidates.some(e=>0!==e.latitude||0!==e.longitude));return{hops:e,overallConfidence:t,hasValidPath:s}},[f,g,j,y]);return b.hasValidPath?t.jsxs("div",{className:"h-full flex flex-col space-y-2",children:[t.jsxs("div",{className:"flex items-center justify-between text-xs",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:"text-text-muted",children:"Path Confidence:"}),t.jsx("span",{className:(v=b.overallConfidence,v>=1?"text-accent-success":v>=.5?"text-accent-secondary":v>=.25?"text-signal-poor":v>0?"text-accent-danger":"text-text-muted"),children:Xt(b.overallConfidence)}),t.jsx("button",{className:"text-text-muted hover:text-text-secondary transition-colors",title:"Confidence is calculated based on how many known nodes match each path prefix. Multiple matches reduce confidence due to collision probability.",children:t.jsx(De,{className:"w-3 h-3"})})]}),t.jsxs("div",{className:"flex items-center gap-2 text-[10px]",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("div",{className:"w-2 h-2 rounded-full bg-accent-success"}),t.jsx("span",{className:"text-text-muted",children:"Exact"})]}),t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("div",{className:"w-2 h-2 rounded-full bg-accent-secondary"}),t.jsx("span",{className:"text-text-muted",children:"Multi"})]}),t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("div",{className:"w-2 h-2 rounded-full bg-text-muted"}),t.jsx("span",{className:"text-text-muted",children:"Unknown"})]})]})]}),t.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:t.jsx(es,{children:t.jsx(e.Suspense,{fallback:t.jsx("div",{className:"h-full bg-bg-elevated flex items-center justify-center text-text-muted text-sm",children:"Loading map..."}),children:t.jsx(Jt,{resolvedPath:b,localNode:r,hubNodes:x,hoveredHopIndex:h,onHoverHop:u,traceSnr:p})})})}),t.jsx("div",{className:"flex flex-wrap items-center gap-1.5",children:b.hops.map((e,a)=>{var n,r,i;const l=!0===e.isSource,c=!0===e.isDestination,o=h===a;let d;return d=l?`Source: ${(null==(n=e.candidates[0])?void 0:n.name)||"Unknown"}`:c?`Destination: ${(null==(r=e.candidates[0])?void 0:r.name)||"Unknown"}`:0===e.totalMatches?"No matching nodes found":1===e.totalMatches?`Exact match: ${(null==(i=e.candidates[0])?void 0:i.name)||"Unknown"}`:`${e.totalMatches} possible matches (${(100*e.confidence).toFixed(0)}% confidence)`,t.jsxs("div",{className:s("flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-mono cursor-pointer transition-all",o?"bg-accent-primary/20 ring-1 ring-accent-primary/50":"bg-bg-elevated hover:bg-bg-subtle",l&&"border border-accent-success/30",c&&"border border-accent-primary/30"),title:d,onMouseEnter:()=>u(a),onMouseLeave:()=>u(null),children:[l&&t.jsx("span",{className:"text-accent-success text-[8px] mr-0.5",children:"SRC"}),c&&t.jsx("span",{className:"text-accent-primary text-[8px] mr-0.5",children:"DST"}),t.jsx("span",{style:Zt(e.confidence,e.totalMatches),children:e.prefix}),!l&&!c&&e.totalMatches>1&&t.jsxs("span",{className:"text-text-muted",children:["×",e.totalMatches]}),!l&&!c&&0===e.totalMatches&&t.jsx("span",{className:"text-text-muted",children:"?"})]},a)})})]}):t.jsxs("div",{className:"flex items-center justify-center text-text-muted text-xs py-4",children:[t.jsx(Ae,{className:"w-3.5 h-3.5 mr-1.5 opacity-50"}),"No location data available for path nodes"]});var v}function ss(e){return e.match(/.{1,2}/g)||[]}function as(e){return null!==e&&e.startsWith("payload:")}const ns={red:"var(--sys-red)",orange:"var(--sys-orange)",amber:"var(--sys-amber)",yellow:"var(--sys-yellow)",lime:"var(--sys-green)",green:"var(--sys-green)",emerald:"var(--sys-green)",teal:"var(--sys-teal)",cyan:"var(--sys-cyan)",sky:"var(--sys-cyan)",blue:"var(--sys-blue)",indigo:"var(--sys-indigo)",violet:"var(--sys-indigo)",purple:"var(--sys-purple)",fuchsia:"var(--sys-pink)",pink:"var(--sys-pink)",rose:"var(--sys-red)",brown:"var(--sys-brown)",zinc:"var(--text-muted)"},rs=15,is="color-mix(in srgb, var(--bg-elevated) 60%, var(--bg-body))",ls="\n inset 0 0 0 1px color-mix(in srgb, var(--text-primary) 6%, transparent),\n inset 0 1px 0 color-mix(in srgb, white 3%, transparent),\n 0 1px 2px color-mix(in srgb, black 5%, transparent)\n ",cs=2,os={type:"tween",duration:.25,ease:[.25,.1,.25,1]};function ds(e,t){return e?`inset 0 0 0 ${cs}px ${ns[t]}`:ls}function xs(e,t){return e?t:`color-mix(in srgb, ${t} ${rs}%, transparent)`}function ps({segments:s,selectedSegment:a,onSegmentClick:n}){const[r,i]=e.useState(null),[l,c]=e.useState(null),o=s.some(e=>void 0!==e.id)&&n,d=[];for(const e of s){const t=ss(e.hex);for(const s of t)d.push({byte:s.toUpperCase(),color:e.color,id:e.id})}const x=[];for(let e=0;e{const d=e.length<16;return t.jsx("div",{className:"flex rounded-md overflow-hidden",children:e.map(({byte:s,color:x,id:p},m)=>{const h=m===e.length-1,u=d&&h,f=ns[x],g=p?r===p:l===x,y=Boolean(p&&a===p),j=g||y;return t.jsx("span",{className:"w-[1.75rem] text-xs text-center py-0.5 font-mono select-none "+(o?"cursor-pointer":""),style:{backgroundColor:xs(j,f),color:j?"rgba(255,255,255,0.95)":f,transition:j?"none":"background-color 0.15s ease-out, color 0.15s ease-out",touchAction:"manipulation",...u?{borderRadius:"0 0.375rem 0.375rem 0"}:{}},onMouseEnter:()=>{p?i(p):c(x)},onMouseLeave:()=>{i(null),c(null)},onClick:()=>p&&(null==n?void 0:n(p)),onTouchStart:()=>{p?i(p):c(x)},onTouchEnd:()=>{i(null),c(null)},children:s},m)})},s)})})}function ms({bits:e,field:s,value:a,binary:n}){return t.jsxs("tr",{children:[t.jsx("td",{className:"py-1.5 text-xs text-text-muted tabular-nums",children:e}),t.jsx("td",{className:"py-1.5 text-sm text-text-secondary",children:s}),t.jsx("td",{className:"py-1.5",children:(()=>{if("Payload Type"===s){const e=we[a]||"zinc";return t.jsx(F,{color:e,children:a})}if("Route Type"===s){const e=Ne[a]||"zinc";return t.jsx(F,{color:e,children:a})}return t.jsx("span",{className:"text-sm text-text-primary",children:a})})()}),t.jsx("td",{className:"py-1.5 font-mono text-xs text-sys-cyan",children:n})]})}function hs({id:e,title:s,color:a,hexBytes:n,startByte:r,endByte:i,isSelected:l,children:c}){const o=n?ss(n):[];return t.jsxs(U.div,{layout:"position",layoutId:e,transition:os,className:"w-full min-w-0 overflow-hidden rounded-xl p-4 sm:p-5 space-y-4",style:{backgroundColor:is,boxShadow:ds(l,a)},children:[t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-0.5 min-w-0",children:[t.jsx(F,{color:a,children:s}),o.length>0&&o.length<=16&&o.map((e,s)=>t.jsx(F,{color:a,className:"font-mono",children:e.toUpperCase()},s))]}),t.jsxs("span",{className:"text-[10px] text-text-muted font-mono flex-shrink-0",children:["Bytes ",r,"-",i]})]}),t.jsx("div",{className:"min-w-0 overflow-hidden",children:c})]})}function us({advert:e,timestamp:s}){const a=V(s||e.timestamp);return t.jsx("div",{className:"mb-4",children:t.jsxs("div",{className:"rounded-2xl overflow-hidden bg-purple-500/10 dark:bg-purple-400/10",style:{backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)"},children:[t.jsxs("div",{className:"px-4 pt-4 pb-3 flex items-center gap-3",children:[t.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center shadow-lg",style:{background:"linear-gradient(135deg, var(--sys-purple) 0%, var(--sys-blue) 100%)"},children:t.jsx(W,{className:"w-6 h-6 text-white"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("h3",{className:"text-lg font-semibold text-text-primary font-sans truncate leading-tight",children:e.name||"Unknown Node"}),t.jsx("p",{className:"text-sm text-text-muted font-sans mt-0.5",children:e.nodeType})]})]}),t.jsx("div",{className:"mx-4 border-t border-black/10 dark:border-white/10"}),t.jsxs("div",{className:"px-4 py-3 space-y-2",children:[void 0!==e.latitude&&void 0!==e.longitude&&t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(Ae,{className:"w-4 h-4 text-purple-600 dark:text-purple-400 flex-shrink-0"}),t.jsxs("span",{className:"text-sm text-text-secondary font-mono",children:[e.latitude.toFixed(5),"°, ",e.longitude.toFixed(5),"°"]})]}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(O,{className:"w-4 h-4 text-purple-600 dark:text-purple-400 flex-shrink-0"}),t.jsx("span",{className:"text-sm text-text-secondary font-sans",children:a})]})]})]})})}function fs({decoded:e,timestamp:s}){const a=s?V(s):"Unknown";return t.jsx("div",{className:"mb-4",children:t.jsxs("div",{className:"rounded-2xl overflow-hidden bg-teal-500/10 dark:bg-teal-400/10",style:{backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)"},children:[t.jsxs("div",{className:"px-4 pt-4 pb-3 flex items-center gap-3",children:[t.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center shadow-lg",style:{background:"linear-gradient(135deg, var(--sys-teal) 0%, var(--sys-cyan) 100%)"},children:t.jsx(Oe,{className:"w-6 h-6 text-white"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("h3",{className:"text-lg font-semibold text-text-primary font-sans truncate leading-tight",children:e.channelName||"Channel Data"}),t.jsxs("p",{className:"text-sm text-text-muted font-sans mt-0.5",children:[e.dataLength," bytes • ",e.decrypted?"Decrypted":"Encrypted"]})]})]}),t.jsx("div",{className:"mx-4 border-t border-black/10 dark:border-white/10"}),t.jsxs("div",{className:"px-4 py-3 space-y-2",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(Re,{className:"w-4 h-4 text-teal-600 dark:text-teal-400 flex-shrink-0"}),t.jsxs("span",{className:"text-sm text-text-secondary font-sans",children:["Channel: ",t.jsxs("span",{className:"font-mono",children:["0x",e.channelHash]})]})]}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(O,{className:"w-4 h-4 text-teal-600 dark:text-teal-400 flex-shrink-0"}),t.jsx("span",{className:"text-sm text-text-secondary font-sans",children:a})]}),e.decrypted&&e.decryptedHex&&t.jsxs("div",{className:"mt-2 pt-2 border-t border-black/10 dark:border-white/10",children:[t.jsx("p",{className:"text-[10px] uppercase tracking-wide text-text-muted mb-1 font-sans",children:"Decrypted Data"}),t.jsx("div",{className:"max-w-full overflow-x-auto",children:t.jsx(Te,{size:"compact",copy:!0,className:"inline-block",children:t.jsx("span",{className:"break-all text-xs",children:e.decryptedHex.toUpperCase()})})})]})]})]})})}function gs({decoded:e,timestamp:s,isLoading:a=!1}){const n=s?V(s):"Unknown";return a?t.jsx("div",{className:"mb-4",children:t.jsxs("div",{className:"rounded-xl p-4 sm:p-5",style:{backgroundColor:"color-mix(in srgb, var(--bg-elevated) 60%, var(--bg-body))",boxShadow:"\n inset 0 0 0 1px color-mix(in srgb, var(--text-primary) 6%, transparent),\n inset 0 1px 0 color-mix(in srgb, white 3%, transparent),\n 0 1px 2px color-mix(in srgb, black 5%, transparent)\n "},children:[t.jsxs("div",{className:"flex items-center gap-2 mb-3 h-[15px]",children:[t.jsx("div",{className:"h-2.5 w-12 rounded bg-white/[0.08] animate-pulse"}),t.jsx("div",{className:"h-2.5 w-16 rounded bg-white/[0.08] animate-pulse"})]}),t.jsx("div",{className:"inline-block max-w-[85%] px-3.5 py-2 rounded-2xl rounded-tl-md",style:{background:"color-mix(in srgb, var(--sys-blue) 30%, transparent)"},children:t.jsxs("div",{className:"space-y-1.5",children:[t.jsx("div",{className:"h-3.5 w-48 rounded bg-white/[0.15] animate-pulse"}),t.jsx("div",{className:"h-3.5 w-32 rounded bg-white/[0.15] animate-pulse"})]})})]})}):e.decrypted?t.jsx("div",{className:"mb-4",children:t.jsxs("div",{className:"rounded-xl p-4 sm:p-5",style:{backgroundColor:"color-mix(in srgb, var(--bg-elevated) 60%, var(--bg-body))",boxShadow:"\n inset 0 0 0 1px color-mix(in srgb, var(--text-primary) 6%, transparent),\n inset 0 1px 0 color-mix(in srgb, white 3%, transparent),\n 0 1px 2px color-mix(in srgb, black 5%, transparent)\n "},children:[t.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.senderName&&t.jsxs("span",{className:"text-[11px] text-text-muted font-sans",children:["From ",t.jsx("span",{className:"text-text-secondary font-medium",children:e.senderName})]}),e.channelName&&t.jsxs("span",{className:"text-[11px] text-text-muted font-sans",children:["in ",t.jsx("span",{className:"text-sys-cyan font-medium",children:e.channelName})]})]}),t.jsx("div",{className:"inline-block max-w-[85%] px-3.5 py-2 rounded-2xl rounded-tl-md",style:{background:"linear-gradient(135deg, var(--sys-blue) 0%, color-mix(in srgb, var(--sys-blue) 85%, var(--sys-cyan)) 100%)"},children:t.jsx("p",{className:"text-sm text-white font-sans leading-relaxed whitespace-pre-wrap break-words",children:e.text})})]})}):t.jsx("div",{className:"mb-4",children:t.jsxs("div",{className:"rounded-2xl overflow-hidden bg-zinc-500/10 dark:bg-zinc-400/10",style:{backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)"},children:[t.jsxs("div",{className:"px-4 pt-4 pb-3 flex items-center gap-3",children:[t.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center shadow-lg",style:{background:"linear-gradient(135deg, var(--sys-zinc) 0%, color-mix(in srgb, var(--sys-zinc) 70%, black) 100%)"},children:t.jsx(Ye,{className:"w-6 h-6 text-white"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("h3",{className:"text-lg font-semibold text-text-primary font-sans truncate leading-tight",children:"Encrypted Message"}),t.jsxs("p",{className:"text-sm text-text-muted font-sans mt-0.5",children:["Channel hash: ",t.jsxs("span",{className:"font-mono",children:["0x",e.channelHash]})]})]})]}),t.jsx("div",{className:"mx-4 border-t border-black/10 dark:border-white/10"}),t.jsxs("div",{className:"px-4 py-3 space-y-2",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(O,{className:"w-4 h-4 text-zinc-500 dark:text-zinc-400 flex-shrink-0"}),t.jsx("span",{className:"text-sm text-text-secondary font-sans",children:n})]}),t.jsx("p",{className:"text-xs text-text-muted",children:"Private channel or unknown hash channel. Channel secret required for decryption."})]})]})})}function ys({decoded:e,timestamp:s}){const a=s?V(s):"Unknown";return t.jsxs("div",{className:"mb-4 flex items-center gap-3",children:[t.jsx("div",{className:"w-10 h-10 rounded-xl flex items-center justify-center shadow-md",style:{background:"linear-gradient(135deg, var(--sys-green) 0%, var(--sys-teal) 100%)"},children:t.jsx(Ve,{className:"w-5 h-5 text-white"})}),t.jsxs("div",{className:"flex-1",children:[t.jsx("p",{className:"text-sm font-semibold text-text-primary font-sans",children:"Acknowledgment"}),t.jsxs("p",{className:"text-xs text-text-muted font-sans mt-0.5",children:["CRC: ",t.jsxs("span",{className:"font-mono text-sys-green",children:["0x",e.crc]})," · ",a]})]})]})}function js({decoded:e,timestamp:s}){const a=s?V(s):"Unknown",n=e.path.length;return t.jsx("div",{className:"mb-4",children:t.jsxs("div",{className:"rounded-2xl overflow-hidden bg-amber-500/10 dark:bg-amber-400/10",style:{backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)"},children:[t.jsxs("div",{className:"px-4 pt-4 pb-3 flex items-center gap-3",children:[t.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center shadow-lg",style:{background:"linear-gradient(135deg, var(--sys-amber) 0%, var(--sys-orange) 100%)"},children:t.jsx(Ee,{className:"w-6 h-6 text-white"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("h3",{className:"text-lg font-semibold text-text-primary font-sans truncate leading-tight",children:"Path Response"}),t.jsxs("p",{className:"text-sm text-text-muted font-sans mt-0.5",children:[n," ",1===n?"hop":"hops"]})]})]}),t.jsx("div",{className:"mx-4 border-t border-black/10 dark:border-white/10"}),t.jsxs("div",{className:"px-4 py-3 space-y-2",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(O,{className:"w-4 h-4 text-amber-600 dark:text-amber-400 flex-shrink-0"}),t.jsx("span",{className:"text-sm text-text-secondary font-sans",children:a})]}),e.path.length>0&&t.jsx("div",{className:"mt-2 pt-2 border-t border-black/10 dark:border-white/10",children:t.jsx("div",{className:"flex flex-wrap items-center gap-2",children:e.path.map((e,s)=>t.jsxs("div",{className:"flex items-center gap-2",children:[s>0&&t.jsx(He,{className:"w-4 h-4 text-amber-500 dark:text-amber-400"}),t.jsx(F,{color:"amber",className:"font-mono",children:e})]},s))})})]})]})})}function bs({decoded:e,timestamp:s}){const a=s?V(s):"Unknown",n=e.pathHashes.length,r=e.snrValues.length;return t.jsx("div",{className:"mb-4",children:t.jsxs("div",{className:"rounded-2xl overflow-hidden bg-blue-500/10 dark:bg-blue-400/10",style:{backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)"},children:[t.jsxs("div",{className:"px-4 pt-4 pb-3 flex items-center gap-3",children:[t.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center shadow-lg",style:{background:"linear-gradient(135deg, var(--sys-blue) 0%, var(--sys-indigo) 100%)"},children:t.jsx(Ie,{className:"w-6 h-6 text-white"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("h3",{className:"text-lg font-medium text-text-primary truncate leading-tight",children:["Trace ",e.isComplete?"Complete":"In Progress"]}),t.jsxs("p",{className:"text-sm text-text-muted mt-0.5",children:["Tag: 0x",e.traceTag.slice(0,8),e.isComplete&&" • ✓"]})]})]}),t.jsx("div",{className:"mx-4 border-t border-black/10 dark:border-white/10"}),t.jsxs("div",{className:"px-4 py-3 space-y-3",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(O,{className:"w-4 h-4 text-blue-600 dark:text-blue-400 flex-shrink-0"}),t.jsx("span",{className:"text-sm text-text-secondary",children:a})]}),t.jsxs("div",{className:"flex items-center gap-4 text-xs text-text-muted",children:[t.jsxs("span",{children:[n," target ",1===n?"hop":"hops"]}),t.jsx("span",{children:"•"}),t.jsxs("span",{children:[r," SNR ",1===r?"sample":"samples"]}),0!==e.authCode&&t.jsxs(t.Fragment,{children:[t.jsx("span",{children:"•"}),t.jsxs("span",{children:["Auth: ",e.authCode]})]})]}),e.pathHashes.length>0&&t.jsx("div",{className:"flex flex-wrap items-center gap-2 pt-1",children:e.pathHashes.map((s,a)=>{const n=e.snrValues[a],r=void 0!==n?(e=>e>=7?"green":e>=0?"yellow":e>=-5?"orange":"red")(n):"zinc",i=void 0!==n;return t.jsxs("div",{className:"flex items-center gap-2",children:[a>0&&t.jsx(He,{className:"w-4 h-4 text-blue-500 dark:text-blue-400 flex-shrink-0"}),t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(F,{color:i?"blue":"zinc",className:"font-mono",children:s}),i&&t.jsxs(F,{color:r,className:"font-mono",children:[n>=0?"+":"",Number.isInteger(n)?n:n.toFixed(1),"dB"]})]})]},a)})})]})]})})}function vs({decoded:e,timestamp:s}){const a=s?V(s):"Unknown";return e.encrypted?t.jsxs("div",{className:"mb-4 flex items-center gap-3",children:[t.jsx("div",{className:"w-10 h-10 rounded-xl flex items-center justify-center shadow-md",style:{background:"linear-gradient(135deg, var(--sys-purple) 0%, var(--sys-indigo) 100%)"},children:t.jsx(Ye,{className:"w-5 h-5 text-white"})}),t.jsxs("div",{className:"flex-1",children:[t.jsx("p",{className:"text-sm font-semibold text-text-primary font-sans",children:"Encrypted Message"}),t.jsxs("p",{className:"text-xs text-text-muted font-sans mt-0.5",children:[e.srcHash," → ",e.destHash," · ",a]})]})]}):t.jsxs("div",{className:"mb-4",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-1.5 px-1",children:[t.jsxs("span",{className:"text-[11px] text-text-muted font-sans",children:[t.jsx("span",{className:"font-mono text-text-secondary",children:e.srcHash})," → ",t.jsx("span",{className:"font-mono text-text-secondary",children:e.destHash})]}),t.jsxs("span",{className:"text-[11px] text-text-muted font-sans",children:["· ",a]})]}),t.jsx("div",{className:"inline-block max-w-[85%] px-3.5 py-2 rounded-2xl rounded-tr-md ml-auto",style:{background:"linear-gradient(135deg, var(--sys-green) 0%, var(--sys-teal) 100%)"},children:t.jsx("p",{className:"text-sm text-white font-sans leading-relaxed whitespace-pre-wrap break-words",children:e.text})})]})}function Ns({decoded:e,timestamp:s}){const a=s?V(s):"Unknown",n=(e.partNumber+1)/e.totalParts*100;return t.jsx("div",{className:"mb-4",children:t.jsxs("div",{className:"rounded-2xl overflow-hidden bg-yellow-500/10 dark:bg-yellow-400/10",style:{backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)"},children:[t.jsxs("div",{className:"px-4 pt-4 pb-3 flex items-center gap-3",children:[t.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center shadow-lg",style:{background:"linear-gradient(135deg, var(--sys-yellow) 0%, var(--sys-amber) 100%)"},children:t.jsx(ze,{className:"w-6 h-6 text-white"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("h3",{className:"text-lg font-semibold text-text-primary font-sans truncate leading-tight",children:"Multipart Segment"}),t.jsxs("p",{className:"text-sm text-text-muted font-sans mt-0.5",children:["Part ",e.partNumber+1," of ",e.totalParts]})]})]}),t.jsx("div",{className:"mx-4 border-t border-black/10 dark:border-white/10"}),t.jsxs("div",{className:"px-4 py-3 space-y-3",children:[t.jsx("div",{children:t.jsx("div",{className:"h-2 bg-black/10 dark:bg-white/10 rounded-full overflow-hidden",children:t.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${n}%`,background:"linear-gradient(90deg, var(--sys-yellow), var(--sys-amber))"}})})}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(Re,{className:"w-4 h-4 text-yellow-600 dark:text-yellow-400 flex-shrink-0"}),t.jsxs("span",{className:"text-sm text-text-secondary font-sans",children:["Message ID: ",t.jsx("span",{className:"font-mono",children:e.messageId})]})]}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(O,{className:"w-4 h-4 text-yellow-600 dark:text-yellow-400 flex-shrink-0"}),t.jsx("span",{className:"text-sm text-text-secondary font-sans",children:a})]})]})]})})}function ws({decoded:e,timestamp:s,payloadType:a}){const n=s?V(s):"Unknown",r=(()=>{switch(a){case ue.REQ:return{icon:Q,gradient:"var(--sys-orange), var(--sys-red)",bg:"rgba(249, 115, 22, 0.15)",label:"Request"};case ue.RESPONSE:return{icon:Je,gradient:"var(--sys-green), var(--sys-teal)",bg:"rgba(34, 197, 94, 0.15)",label:"Response"};case ue.ANON_REQ:return{icon:Ye,gradient:"var(--sys-purple), var(--sys-pink)",bg:"rgba(168, 85, 247, 0.15)",label:"Anonymous Request"};default:return{icon:ke,gradient:"var(--sys-gray), var(--sys-slate)",bg:"rgba(107, 114, 128, 0.15)",label:e.payloadTypeName}}})(),i=r.icon;return t.jsxs("div",{className:"mb-4 flex items-center gap-3",children:[t.jsx("div",{className:"w-10 h-10 rounded-xl flex items-center justify-center shadow-md",style:{background:`linear-gradient(135deg, ${r.gradient})`},children:t.jsx(i,{className:"w-5 h-5 text-white"})}),t.jsxs("div",{className:"flex-1",children:[t.jsx("p",{className:"text-sm font-semibold text-text-primary font-sans",children:r.label}),t.jsxs("p",{className:"text-xs text-text-muted font-sans mt-0.5",children:[e.length," bytes · ",n]})]})]})}function ks({pathHex:e}){if(!e)return null;const s=ss(e);return t.jsx("div",{className:"flex flex-wrap items-center gap-2 py-2",children:s.map((e,s)=>t.jsxs("div",{className:"flex items-center gap-2",children:[s>0&&t.jsx(He,{className:"w-4 h-4 text-sys-amber flex-shrink-0"}),t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(Te,{size:"compact",copy:!0,children:e.toUpperCase()}),t.jsx("span",{className:"text-[10px] text-text-muted font-sans tabular-nums w-4 text-left",children:s+1})]})]},s))})}function Cs({decoded:e,payloadType:s}){const a=ye[s]||`TYPE_${s}`;switch(e.type){case"advert":{const s="chat"===e.nodeType?"companion":e.nodeType.replace("_"," "),a=void 0!==e.latitude&&void 0!==e.longitude&&!(0===e.latitude&&0===e.longitude);return t.jsxs("div",{className:"text-xs text-text-primary space-y-0.5",children:[t.jsxs("p",{children:[t.jsx("span",{className:"text-text-muted",children:"Role:"})," ",s]}),e.name&&t.jsxs("p",{children:[t.jsx("span",{className:"text-text-muted",children:"Name:"})," ",e.name]}),a&&t.jsxs("p",{children:[t.jsx("span",{className:"text-text-muted",children:"Location:"})," ",e.latitude.toFixed(4),"°, ",e.longitude.toFixed(4),"°"]}),t.jsxs("p",{children:[t.jsx("span",{className:"text-text-muted",children:"Time:"})," ",V(e.timestamp)]}),t.jsxs("p",{children:[t.jsx("span",{className:"text-text-muted",children:"Flags:"})," ",e.flagsDescription]})]})}case"ack":return t.jsx("div",{className:"text-xs text-text-primary space-y-0.5",children:t.jsxs("p",{children:[t.jsx("span",{className:"text-text-muted",children:"CRC:"})," 0x",e.crc]})});case"path":return t.jsx("div",{className:"text-xs text-text-primary space-y-1",children:t.jsxs("p",{children:[t.jsx("span",{className:"text-text-muted",children:"Path:"})," ",e.pathString||"(empty)"]})});case"trace":return t.jsxs("div",{className:"text-xs text-text-primary space-y-1",children:[t.jsxs("p",{children:[t.jsx("span",{className:"text-text-muted",children:"Tag:"})," 0x",e.traceTag]}),t.jsxs("p",{children:[t.jsx("span",{className:"text-text-muted",children:"Target Path:"})," ",e.pathString||"(empty)"]}),e.snrValues.length>0&&t.jsxs("p",{children:[t.jsx("span",{className:"text-text-muted",children:"SNR:"})," ",e.snrValues.map(e=>`${e>=0?"+":""}${Number.isInteger(e)?e:e.toFixed(1)}dB`).join(" → ")]}),t.jsxs("p",{children:[t.jsx("span",{className:"text-text-muted",children:"Status:"})," ",e.isComplete?"✓ Complete":`In progress (${e.snrValues.length}/${e.pathHashes.length})`]})]});case"txt_msg":return t.jsxs("div",{className:"text-xs text-text-primary space-y-0.5",children:[t.jsxs("p",{children:[t.jsx("span",{className:"text-text-muted",children:"Dest:"})," ",e.destHash]}),t.jsxs("p",{children:[t.jsx("span",{className:"text-text-muted",children:"Src:"})," ",e.srcHash]}),e.encrypted?t.jsx("p",{className:"text-text-muted italic",children:"Encrypted content"}):t.jsxs("p",{children:[t.jsx("span",{className:"text-text-muted",children:"Text:"})," ",e.text]})]});case"grp_txt":return t.jsxs("div",{className:"text-xs text-text-primary space-y-0.5",children:[t.jsxs("p",{children:[t.jsx("span",{className:"text-text-muted",children:"Channel:"})," ",e.channelName?t.jsx("span",{className:"text-accent-success",children:e.channelName}):t.jsxs("span",{className:"font-mono",children:["0x",e.channelHash]})]}),e.decrypted?t.jsxs(t.Fragment,{children:[e.senderName&&t.jsxs("p",{children:[t.jsx("span",{className:"text-text-muted",children:"From:"})," ",e.senderName]}),t.jsxs("p",{children:[t.jsx("span",{className:"text-text-muted",children:"Text:"})," ",e.text]})]}):t.jsx("p",{className:"text-text-muted italic",children:"Encrypted (unknown channel)"})]});case"grp_data":return t.jsxs("div",{className:"text-xs text-text-primary space-y-0.5",children:[t.jsxs("p",{children:[t.jsx("span",{className:"text-text-muted",children:"Channel:"})," ",e.channelName?t.jsx("span",{className:"text-sys-teal",children:e.channelName}):t.jsxs("span",{className:"font-mono",children:["0x",e.channelHash]})]}),t.jsxs("p",{children:[t.jsx("span",{className:"text-text-muted",children:"Data:"})," ",e.dataLength," bytes ",e.decrypted?"(decrypted)":"(encrypted)"]})]});case"multipart":return t.jsxs("div",{className:"text-xs text-text-primary space-y-0.5",children:[t.jsxs("p",{children:[t.jsx("span",{className:"text-text-muted",children:"Part:"})," ",e.partNumber+1,"/",e.totalParts]}),t.jsxs("p",{children:[t.jsx("span",{className:"text-text-muted",children:"Message ID:"})," ",e.messageId]})]});default:return t.jsxs("p",{className:"text-xs text-text-secondary",children:[a," (",e.length," bytes)"]})}}const Ss=e.memo(function({packet:s}){var a;const n=s.raw_packet||"",r=n.length/2,i=E(),[l,c]=e.useState(null),[o,d]=e.useState(null),[x,p]=e.useState(!1),[m,h]=e.useState(null),u=e.useCallback(e=>{h(t=>t===e?null:e)},[]),f=e.useMemo(()=>function(e){if(!e||e.length<4)return null;const t=oe.fromHex(e);if(!t.success||!t.packet)return null;const s=t.packet,a=function(e){const t=3&e,s=e>>2&15,a=e>>6&3;return[{bits:"0-1",field:"Route Type",value:xe(t),binary:(3&t).toString(2).padStart(2,"0")},{bits:"2-5",field:"Payload Type",value:pe(s),binary:(15&s).toString(2).padStart(4,"0")},{bits:"6-7",field:"Version",value:a.toString(),binary:(3&a).toString(2).padStart(2,"0")}]}(s.header),n=e.slice(0,2);let r=2,i="";s.hasTransportCodes()&&(i=e.slice(2,10),r=10);const l=e.slice(r,r+2),c=r+2,o=c+2*s.pathLen,d=e.slice(c,o),x=e.slice(o),p=de(s);return{packet:s,headerHex:n,headerFields:a,transportCodesHex:i,pathLengthHex:l,pathDataHex:d,payloadHex:x,payloadStartByte:Math.floor(o/2),decoded:p}}(n),[n]),g=(null==(a=null==f?void 0:f.packet)?void 0:a.payloadType)===ue.GRP_TXT&&(!i||x);if(e.useEffect(()=>{if(!(null==f?void 0:f.packet)||f.packet.payloadType!==ue.GRP_TXT)return c(null),void p(!1);if(!i)return void p(!0);p(!0);let e=!1;return fe(f.packet.payload).then(t=>{e||(t&&c(t),p(!1))}),()=>{e=!0}},[null==f?void 0:f.packet,i]),e.useEffect(()=>{if(!(null==f?void 0:f.packet)||f.packet.payloadType!==ue.GRP_DATA)return void d(null);if(!i)return;let e=!1;return ge(f.packet.payload).then(t=>{!e&&t&&d(t)}),()=>{e=!0}},[null==f?void 0:f.packet,i]),!f||0===n.length)return t.jsx("div",{className:"p-4 text-center text-text-muted",children:t.jsx("p",{className:"text-sm",children:"No raw packet data available"})});const{packet:y}=f;let j=f.decoded;l&&"grp_txt"===f.decoded.type?j=l:o&&"grp_data"===f.decoded.type&&(j=o);const b=e.useMemo(()=>function(e,s){switch(e.type){case"advert":return function(e,s){const a=[];let n=0;const r=s.slice(0,64);a.push({id:"payload:publicKey",title:"Public Key",color:"pink",hex:r,startByte:n,endByte:n+31,decoded:t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"text-[11px] text-text-secondary break-all p-2 rounded bg-bg-body/50 font-mono",children:e.publicKey.toUpperCase()}),t.jsx("p",{className:"text-xs text-text-muted mt-1",children:"Ed25519 public key (32 bytes)"})]})}),n+=32;const i=s.slice(64,72);a.push({id:"payload:timestamp",title:"Timestamp",color:"orange",hex:i,startByte:n,endByte:n+3,decoded:t.jsxs(t.Fragment,{children:[t.jsx(Te,{size:"standard",copy:!0,children:i.toUpperCase()}),t.jsxs("p",{className:"text-xs text-text-primary mt-1",children:[e.timestamp," (",V(e.timestamp),")"]})]})}),n+=4;const l=s.slice(72,200);a.push({id:"payload:signature",title:"Signature",color:"teal",hex:l,startByte:n,endByte:n+63,decoded:t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"text-[11px] text-text-secondary break-all p-2 rounded bg-bg-body/50 font-mono",children:e.signature.toUpperCase()}),t.jsx("p",{className:"text-xs text-text-muted mt-1",children:"Ed25519 signature (64 bytes)"})]})}),n+=64;const c=s.slice(200,202);if(a.push({id:"payload:flags",title:"Flags",color:"blue",hex:c,startByte:n,endByte:n,decoded:t.jsxs(t.Fragment,{children:[t.jsxs(Te,{size:"standard",copy:!0,children:["0x",e.flags.toString(16).padStart(2,"0").toUpperCase()]}),t.jsx("p",{className:"text-xs text-text-primary mt-1",children:e.flagsDescription}),t.jsxs("p",{className:"text-xs text-text-muted",children:["Node Type: ",e.nodeType]})]})}),n+=1,void 0!==e.latitude){const r=s.slice(2*n,2*n+8);a.push({id:"payload:latitude",title:"Latitude",color:"green",hex:r,startByte:n,endByte:n+3,decoded:t.jsxs(t.Fragment,{children:[t.jsx(Te,{size:"standard",copy:!0,children:r.toUpperCase()}),t.jsxs("p",{className:"text-xs text-text-primary mt-1",children:[e.latitude.toFixed(6),"°"]})]})}),n+=4}if(void 0!==e.longitude){const r=s.slice(2*n,2*n+8);a.push({id:"payload:longitude",title:"Longitude",color:"purple",hex:r,startByte:n,endByte:n+3,decoded:t.jsxs(t.Fragment,{children:[t.jsx(Te,{size:"standard",copy:!0,children:r.toUpperCase()}),t.jsxs("p",{className:"text-xs text-text-primary mt-1",children:[e.longitude.toFixed(6),"°"]})]})}),n+=4}if(e.name){const r=s.slice(2*n),i=r.length/2;a.push({id:"payload:name",title:"Name",color:"amber",hex:r,startByte:n,endByte:n+i-1,decoded:t.jsxs(t.Fragment,{children:[t.jsx(Te,{size:"standard",copy:!0,children:r.toUpperCase()}),t.jsxs("p",{className:"text-xs text-text-primary mt-1",children:['"',e.name,'"']})]})})}return a}(e,s);case"ack":return function(e,s){return[{id:"payload:crc",title:"CRC",color:"green",hex:s.slice(0,8),startByte:0,endByte:3,decoded:t.jsxs(t.Fragment,{children:[t.jsxs(Te,{size:"standard",copy:!0,children:["0x",e.crc]}),t.jsx("p",{className:"text-xs text-text-muted mt-1",children:"CRC32 of acknowledged packet"})]})}]}(e,s);case"grp_txt":return function(e,s){const a=[];a.push({id:"payload:channelHash",title:"Channel Hash",color:"blue",hex:s.slice(0,2),startByte:0,endByte:0,decoded:t.jsxs(t.Fragment,{children:[t.jsxs(Te,{size:"standard",copy:!0,children:["0x",e.channelHash]}),e.channelName&&t.jsxs("p",{className:"text-xs text-text-primary mt-1",children:["Channel: ",e.channelName]})]})}),e.macHex&&a.push({id:"payload:mac",title:"MAC",color:"purple",hex:s.slice(2,6),startByte:1,endByte:2,decoded:t.jsxs(t.Fragment,{children:[t.jsx(Te,{size:"standard",copy:!0,children:e.macHex.toUpperCase()}),t.jsx("p",{className:"text-xs text-text-muted mt-1",children:"Truncated HMAC-SHA256"})]})});const n=s.slice(6);return n&&a.push({id:"payload:ciphertext",title:e.decrypted?"Message":"Ciphertext",color:e.decrypted?"green":"zinc",hex:n,startByte:3,endByte:3+n.length/2-1,decoded:e.decrypted?t.jsxs(t.Fragment,{children:[t.jsxs("p",{className:"text-sm text-text-primary",children:['"',e.text,'"']}),e.senderName&&t.jsxs("p",{className:"text-xs text-text-muted mt-1",children:["From: ",e.senderName]})]}):t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"text-[11px] text-text-secondary break-all p-2 rounded bg-bg-body/50 font-mono",children:n.toUpperCase()}),t.jsx("p",{className:"text-xs text-text-muted mt-1",children:"AES-128-ECB encrypted"})]})}),a}(e,s);case"grp_data":return function(e,s){const a=[];a.push({id:"payload:channelHash",title:"Channel Hash",color:"blue",hex:s.slice(0,2),startByte:0,endByte:0,decoded:t.jsxs(t.Fragment,{children:[t.jsxs(Te,{size:"standard",copy:!0,children:["0x",e.channelHash]}),e.channelName&&t.jsxs("p",{className:"text-xs text-text-primary mt-1",children:["Channel: ",e.channelName]})]})}),e.macHex&&a.push({id:"payload:mac",title:"MAC",color:"purple",hex:s.slice(2,6),startByte:1,endByte:2,decoded:t.jsxs(t.Fragment,{children:[t.jsx(Te,{size:"standard",copy:!0,children:e.macHex.toUpperCase()}),t.jsx("p",{className:"text-xs text-text-muted mt-1",children:"Truncated HMAC-SHA256"})]})});const n=s.slice(6);return n&&a.push({id:"payload:ciphertext",title:e.decrypted?"Decrypted Data":"Encrypted Data",color:e.decrypted?"green":"zinc",hex:n,startByte:3,endByte:3+n.length/2-1,decoded:t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"text-[11px] text-text-secondary break-all p-2 rounded bg-bg-body/50 font-mono",children:(e.decryptedHex||n).toUpperCase()}),t.jsxs("p",{className:"text-xs text-text-muted mt-1",children:[e.dataLength," bytes",e.decrypted?"":" (AES-128-ECB encrypted)"]})]})}),a}(e,s);case"path":return function(e,s){return[{id:"payload:path",title:"Path Hops",color:"amber",hex:s,startByte:0,endByte:s.length/2-1,decoded:t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"flex flex-wrap items-center gap-1",children:e.path.map((e,s)=>t.jsxs("span",{className:"flex items-center gap-1",children:[s>0&&t.jsx(He,{className:"w-3 h-3 text-text-muted"}),t.jsx(F,{color:"amber",className:"font-mono",children:e})]},s))}),t.jsxs("p",{className:"text-xs text-text-muted mt-1",children:[e.path.length," hops"]})]})}]}(e,s);case"trace":return function(e,s){const a=[];a.push({id:"payload:crc",title:"Trace Tag",color:"blue",hex:s.slice(0,8),startByte:0,endByte:3,decoded:t.jsxs(t.Fragment,{children:[t.jsxs(Te,{size:"standard",copy:!0,children:["0x",e.traceTag]}),t.jsx("p",{className:"text-xs text-text-muted mt-1",children:"Unique trace request identifier"})]})}),a.push({id:"payload:mac",title:"Auth Code",color:"purple",hex:s.slice(8,16),startByte:4,endByte:7,decoded:t.jsxs(t.Fragment,{children:[t.jsx(Te,{size:"standard",copy:!0,children:e.authCode}),t.jsx("p",{className:"text-xs text-text-muted mt-1",children:"Authentication/verification code"})]})}),a.push({id:"payload:flags",title:"Flags",color:"amber",hex:s.slice(16,18),startByte:8,endByte:8,decoded:t.jsxs(t.Fragment,{children:[t.jsxs(Te,{size:"standard",copy:!0,children:["0x",e.flags.toString(16).toUpperCase().padStart(2,"0")]}),t.jsx("p",{className:"text-xs text-text-muted mt-1",children:0===e.flags?"No flags set":`Flags: ${e.flags.toString(2).padStart(8,"0")}b`})]})});const n=s.slice(18);if(n){const s=e=>e>=7?"green":e>=0?"yellow":e>=-5?"orange":"red";a.push({id:"payload:path",title:"Target Path",color:"indigo",hex:n,startByte:9,endByte:9+n.length/2-1,decoded:t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"flex flex-wrap items-center gap-1",children:e.pathHashes.map((a,n)=>{const r=e.snrValues[n],i=void 0!==r?s(r):"zinc";return t.jsxs("span",{className:"flex items-center gap-1",children:[n>0&&t.jsx(He,{className:"w-3 h-3 text-text-muted"}),t.jsx(F,{color:"indigo",className:"font-mono",children:a}),void 0!==r&&t.jsxs(F,{color:i,className:"font-mono",children:[r>=0?"+":"",Number.isInteger(r)?r:r.toFixed(1),"dB"]})]},n)})}),t.jsxs("p",{className:"text-xs text-text-muted mt-1",children:[e.pathHashes.length," target ",1===e.pathHashes.length?"hop":"hops",e.snrValues.length>0&&` • ${e.snrValues.length} SNR ${1===e.snrValues.length?"value":"values"} collected`,e.isComplete&&" • ✓ Complete"]})]})})}return a}(e,s);case"multipart":return function(e,s){const a=[];a.push({id:"payload:msgId",title:"Message ID",color:"blue",hex:s.slice(0,4),startByte:0,endByte:1,decoded:t.jsxs(t.Fragment,{children:[t.jsx(Te,{size:"standard",copy:!0,children:e.messageId.toUpperCase()}),t.jsx("p",{className:"text-xs text-text-muted mt-1",children:"Unique message identifier"})]})}),a.push({id:"payload:partNum",title:"Part Number",color:"amber",hex:s.slice(4,6),startByte:2,endByte:2,decoded:t.jsxs(t.Fragment,{children:[t.jsx(Te,{size:"standard",copy:!0,children:e.partNumber}),t.jsx("p",{className:"text-xs text-text-muted mt-1",children:"0-indexed part number"})]})}),a.push({id:"payload:totalParts",title:"Total Parts",color:"orange",hex:s.slice(6,8),startByte:3,endByte:3,decoded:t.jsxs(t.Fragment,{children:[t.jsx(Te,{size:"standard",copy:!0,children:e.totalParts}),t.jsxs("p",{className:"text-xs text-text-muted mt-1",children:["Part ",e.partNumber+1," of ",e.totalParts]})]})});const n=s.slice(8);return n&&a.push({id:"payload:partData",title:"Part Data",color:"cyan",hex:n,startByte:4,endByte:4+n.length/2-1,decoded:t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"text-[11px] text-text-secondary break-all p-2 rounded bg-bg-body/50 font-mono",children:n.toUpperCase()}),t.jsxs("p",{className:"text-xs text-text-muted mt-1",children:[n.length/2," bytes"]})]})}),a}(e,s);default:return[{id:"payload:ciphertext",title:"Raw Data",color:"zinc",hex:s,startByte:0,endByte:s.length/2-1,decoded:t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"text-[11px] text-text-secondary break-all p-2 rounded bg-bg-body/50 font-mono",children:s.toUpperCase()}),t.jsxs("p",{className:"text-xs text-text-muted mt-1",children:[s.length/2," bytes"]})]})}]}}(j,f.payloadHex),[j,f.payloadHex]),v="payload"===m||as(m),N=e.useMemo(()=>{const e=[{id:"header",hex:f.headerHex,color:"red"},...f.transportCodesHex?[{id:"transportCodes",hex:f.transportCodesHex,color:"purple"}]:[],{id:"pathLength",hex:f.pathLengthHex,color:"green"},...f.pathDataHex?[{id:"pathData",hex:f.pathDataHex,color:"amber"}]:[]];return v?[...e,...(t=b,t.map(e=>({id:e.id,hex:e.hex,color:e.color})))]:[...e,{id:"payload",hex:f.payloadHex,color:"cyan"}];var t},[f,v,b]);return t.jsxs("div",{className:"font-mono space-y-2 min-w-0 overflow-hidden",children:[(()=>{switch(j.type){case"advert":return t.jsx(us,{advert:j,timestamp:s.timestamp});case"grp_data":return t.jsx(fs,{decoded:j,timestamp:s.timestamp});case"grp_txt":return t.jsx(gs,{decoded:j,timestamp:s.timestamp,isLoading:g});case"ack":return t.jsx(ys,{decoded:j,timestamp:s.timestamp});case"path":return t.jsx(js,{decoded:j,timestamp:s.timestamp});case"trace":return t.jsx(bs,{decoded:j,timestamp:s.timestamp});case"txt_msg":return t.jsx(vs,{decoded:j,timestamp:s.timestamp});case"multipart":return t.jsx(Ns,{decoded:j,timestamp:s.timestamp});case"generic":return y.payloadType===ue.REQ||y.payloadType===ue.RESPONSE||y.payloadType===ue.ANON_REQ?t.jsx(ws,{decoded:j,timestamp:s.timestamp,payloadType:y.payloadType}):null;default:return null}})(),t.jsx("div",{className:"bg-black rounded-2xl p-6",children:t.jsx(ps,{segments:N,selectedSegment:m,onSegmentClick:u})}),t.jsx(I,{children:t.jsx(U.div,{layout:!0,transition:os,className:"space-y-2 min-w-0",children:(()=>{var e,s,a,n;const i=[{id:"header",title:"Header",color:"red",startByte:0,endByte:0,hexBytes:`0x${f.headerHex.toUpperCase()}`,condition:!0,content:t.jsxs("table",{className:"w-full text-left",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"text-[10px] uppercase tracking-wide text-text-muted border-b border-border-subtle font-sans",children:[t.jsx("th",{className:"py-1 font-medium",children:"Bits"}),t.jsx("th",{className:"py-1 font-medium",children:"Field"}),t.jsx("th",{className:"py-1 font-medium",children:"Value"}),t.jsx("th",{className:"py-1 font-medium",children:"Binary"})]})}),t.jsx("tbody",{children:f.headerFields.map(e=>t.jsx(ms,{...e},e.bits))})]})},{id:"transportCodes",title:"Transport Codes",color:"purple",startByte:1,endByte:4,hexBytes:(null==(e=f.transportCodesHex)?void 0:e.toUpperCase())||"",condition:!!f.transportCodesHex,content:t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"text-xs text-text-muted",children:"Two 16-bit transport codes for encrypted routing"}),t.jsxs("div",{className:"mt-1 text-xs text-text-secondary",children:["Code 1: 0x",null==(s=f.transportCodesHex)?void 0:s.slice(0,4).toUpperCase()," | Code 2: 0x",null==(a=f.transportCodesHex)?void 0:a.slice(4,8).toUpperCase()]})]})},{id:"pathLength",title:"Path Length",color:"green",startByte:f.transportCodesHex?5:1,endByte:f.transportCodesHex?5:1,hexBytes:`0x${f.pathLengthHex.toUpperCase()}`,condition:!0,content:t.jsxs("p",{className:"text-xs text-text-muted pt-1",children:[y.pathLen," bytes showing route taken (increases as packet floods)"]})},{id:"pathData",title:"Path Data",color:"amber",startByte:f.transportCodesHex?6:2,endByte:(f.transportCodesHex?5:1)+y.pathLen,hexBytes:(null==(n=f.pathDataHex)?void 0:n.toUpperCase())||"",condition:y.pathLen>0,content:t.jsxs("div",{className:"space-y-3",children:[t.jsx(ks,{pathHex:f.pathDataHex}),t.jsx("p",{className:"text-xs text-text-muted",children:"Historical route taken (bytes are added as packet floods through network)"})]})},{id:"payload",title:"Payload",color:"cyan",startByte:f.payloadStartByte,endByte:r-1,hexBytes:f.payloadHex.toUpperCase(),condition:!0,content:t.jsxs(t.Fragment,{children:[!as(m)&&t.jsxs("div",{className:"p-3 rounded-lg bg-black",children:[t.jsx("p",{className:"text-[10px] uppercase tracking-wide text-text-muted mb-1.5 font-sans",children:"Decoded"}),t.jsx(Cs,{decoded:j,payloadType:y.payloadType})]}),!as(m)&&b.length>0&&t.jsx("p",{className:"text-[10px] uppercase tracking-wide text-text-muted mt-3 font-sans",children:"Click a field below to highlight its bytes"}),as(m)&&t.jsx("p",{className:"text-[10px] uppercase tracking-wide text-text-muted font-sans",children:"↑ Selected field above • Other fields below ↓"})]})}].filter(e=>e.condition),l=as(m)?b.find(e=>e.id===m):null,c=as(m)?[...i].sort((e,t)=>"payload"===e.id?-1:"payload"===t.id?1:0):[...i].sort((e,t)=>e.id===m?-1:t.id===m?1:0),o=as(m)?b.filter(e=>e.id!==m):[];return t.jsxs(t.Fragment,{children:[l&&t.jsx(hs,{id:`subfield-${l.id}`,title:l.title,color:l.color,startByte:f.payloadStartByte+l.startByte,endByte:f.payloadStartByte+l.endByte,hexBytes:l.hex.toUpperCase(),isSelected:!0,children:l.decoded},l.id),c.map(e=>t.jsx(hs,{id:`section-${e.id}`,title:e.title,color:e.color,startByte:e.startByte,endByte:e.endByte,hexBytes:e.hexBytes,isSelected:e.id===m,children:e.content},e.id)),o.map(e=>t.jsxs(U.div,{layout:"position",layoutId:`subfield-${e.id}`,transition:os,className:"w-full min-w-0 overflow-hidden rounded-xl p-4 sm:p-5 space-y-4",style:{backgroundColor:is,boxShadow:ls},children:[t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-0.5 min-w-0",children:[t.jsx(F,{color:e.color,children:e.title}),e.hex.length<=32&&ss(e.hex).map((s,a)=>t.jsx(F,{color:e.color,className:"font-mono",children:s.toUpperCase()},a))]}),t.jsxs("span",{className:"text-[10px] text-text-muted font-mono flex-shrink-0",children:["Bytes ",f.payloadStartByte+e.startByte,"-",f.payloadStartByte+e.endByte]})]}),t.jsx("div",{className:"min-w-0 overflow-hidden p-3 rounded-lg bg-black",children:e.decoded})]},e.id))]})})()})})]})});function Ms(e){if(!e)return[];if(Array.isArray(e))return e;try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function Ps(e){return e?(e.startsWith("0x")?e.slice(2):e).slice(0,2).toUpperCase():""}function Ts({hop:a,compact:n=!1,index:r=0,highlightIndex:i=-1,isTrace:l=!1}){var c;const o=r===i,d=Pt();return e.useEffect(()=>{o&&l&&d.start({boxShadow:["0 0 0 0px rgba(113, 156, 223, 0)","0 0 0 2px rgba(113, 156, 223, 0.5)","0 0 0 2px rgba(113, 156, 223, 0.5)","0 0 0 0px rgba(113, 156, 223, 0)"],transition:{duration:.5,times:[0,.2,.7,1],ease:"easeInOut"}})},[o,l,d]),t.jsxs(U.div,{className:s("flex items-center gap-1.5",n?"flex-row":"flex-col"),animate:{scale:o?1.05:1,opacity:o?1:.85},transition:{duration:.3,ease:"easeInOut"},children:[t.jsxs(U.div,{className:s("flex items-center gap-1.5 px-2.5 py-1 rounded-md","font-mono text-xs font-semibold",a.isLocal?"bg-amber-500/20 text-amber-300 ring-1 ring-amber-500/30":"bg-zinc-700/50 text-zinc-200 ring-1 ring-zinc-600/50"),animate:d,initial:{boxShadow:"0 0 0 0px rgba(113, 156, 223, 0)"},children:[a.isLocal&&t.jsx(We,{className:"w-3 h-3"}),t.jsx("span",{children:a.prefix}),void 0!==a.confidence&&a.confidence<.9&&t.jsxs("span",{className:"text-[9px] opacity-70",children:[(100*a.confidence).toFixed(0),"%"]})]}),!n&&(null==(c=a.neighborInfo)?void 0:c.name)&&t.jsx("span",{className:"text-[10px] text-text-muted truncate max-w-[80px]",children:a.neighborInfo.name})]})}function Hs({snr:e}){const s=Ge(e),a=Qe()[s]||"#6b7280",n=Number.isInteger(e)?e.toString():e.toFixed(1);return t.jsxs(F,{customColor:a,compact:!0,className:"font-mono",children:[e>=0?"+":"",n,"dB"]})}function _s({hops:a,compact:n,isTrace:r=!1}){const[i,l]=e.useState(-1);return e.useEffect(()=>{if(0===a.length)return;const e=setTimeout(()=>{l(0)},400),t=setInterval(()=>{l(e=>{const s=e+1;return s>=a.length?(clearInterval(t),-1):s})},r?500:600);return()=>{clearTimeout(e),clearInterval(t)}},[a.length,r]),t.jsx("div",{className:"p-6",style:{display:"grid",gridTemplateColumns:"1fr auto 1fr",gap:"4px 8px"},children:a.map((e,l)=>{const c=l%2==0,o=l===a.length-1;return t.jsxs("div",{className:"contents",children:[t.jsx("div",{className:s("flex items-center","justify-end"),children:c&&t.jsx(Ts,{hop:e,compact:n,index:l,highlightIndex:i,isTrace:r})}),t.jsx("div",{className:"flex flex-col items-center justify-center min-h-[28px]",children:!o&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"w-px flex-1 bg-zinc-600/40 min-h-[8px]"}),void 0!==e.snr&&t.jsx(Hs,{snr:e.snr}),t.jsx("svg",{className:"w-3 h-3 text-zinc-500 flex-shrink-0",viewBox:"0 0 12 12",fill:"none",children:t.jsx("path",{d:"M6 2v8M3 7l3 3 3-3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]})}),t.jsx("div",{className:s("flex items-center","justify-start"),children:!c&&t.jsx(Ts,{hop:e,compact:n,index:l,highlightIndex:i,isTrace:r})})]},`${e.prefix}-${l}`)})})}const Bs=e.memo(function({packet:a,neighbors:n,localHash:r,neighborAffinity:i,ghostPrefixes:l,direction:c="horizontal",compact:o=!1,traceSnr:d,overridePath:x}){const p=void 0!==d&&d.length>0,m=Ms(a.original_path),h=Ms(a.forwarded_path),u=x??(h.length>0?h:m),f=Ps(r),g=e.useMemo(()=>u.map((e,t)=>{const s=e.toUpperCase(),a=s===f,r=(null==l?void 0:l.has(s))??!1,c=function(e,t,s){const a=e.toUpperCase();if(s){let e=null,n=0;if(s.forEach((t,s)=>{if(Ps(s)===a){const a=t.combinedScore??0;a>n&&(n=a,e=s)}}),e&&t[e])return{hash:e,info:t[e],confidence:n}}for(const[n,r]of Object.entries(t))if(Ps(n)===a)return{hash:n,info:r,confidence:void 0};return null}(s,n,i);return{prefix:s,fullHash:null==c?void 0:c.hash,neighborInfo:null==c?void 0:c.info,isLocal:a,isGhost:r,confidence:null==c?void 0:c.confidence,snr:null==d?void 0:d[t]}}),[u,n,i,f,l,d]);if(0===g.length)return t.jsxs("div",{className:"flex items-center gap-2 text-text-muted text-xs",children:[t.jsx(W,{className:"w-4 h-4 opacity-50"}),t.jsx("span",{children:"Direct / No path data"})]});if("flowchart"===c)return t.jsx(_s,{hops:g,compact:o,isTrace:p});const y="horizontal"===c?He:Me;return t.jsx("div",{className:s("flex gap-1.5","horizontal"===c?"flex-row flex-wrap items-center":"flex-col items-start"),children:g.map((e,a)=>t.jsxs("div",{className:s("flex items-center gap-1.5","vertical"===c&&"flex-col"),children:[t.jsx(Ts,{hop:e,compact:o}),a0,l=ai&&n(a-1),disabled:!i,className:s("p-0.5 rounded transition-colors",i?"text-text-muted hover:text-text-primary hover:bg-white/10":"text-white/20 cursor-not-allowed"),"aria-label":"Previous observation",children:t.jsx(qe,{className:r?"size-3":"size-4"})}),t.jsx("div",{className:"flex items-center gap-0.5",children:e.map((e,i)=>{const l=i===a,c=new Date(1e3*e.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"});return t.jsx(ee,{color:l?"cyan":"zinc",filled:l,compact:r,onClick:()=>n(i),title:`Observation ${i+1} at ${c}`,className:s("transition-all duration-150",!l&&"opacity-60 hover:opacity-100"),children:r?t.jsx("span",{className:"tabular-nums",children:i+1}):t.jsxs("span",{className:"tabular-nums text-[10px]",children:["#",i+1,null!=e.rssi&&t.jsx("span",{className:"ml-1 opacity-70",children:e.rssi})]})},`${e.timestamp}_${i}`)})}),t.jsx("button",{onClick:()=>l&&n(a+1),disabled:!l,className:s("p-0.5 rounded transition-colors",l?"text-text-muted hover:text-text-primary hover:bg-white/10":"text-white/20 cursor-not-allowed"),"aria-label":"Next observation",children:t.jsx(_e,{className:r?"size-3":"size-4"})}),t.jsxs("span",{className:s("text-text-muted ml-1",r?"text-[9px]":"text-[10px]"),children:[t.jsx(Pe,{className:"inline size-3 mr-0.5 opacity-50"}),e.length]})]})}function Ds({icon:e,label:a,disabled:n=!1}){return t.jsx(U.div,{className:"flex items-center gap-1 text-[10px]",title:a,animate:{opacity:n?.25:.6},transition:{duration:.15,ease:[.4,0,.2,1]},children:t.jsx("span",{className:s("flex items-center justify-center size-5 rounded border transition-colors duration-150",n?"bg-white/[0.02] border-white/5":"bg-white/5 border-white/10"),children:e})})}function Ls({hasDuplicates:e,hasPrev:s,hasNext:a,canPrevDupe:n,canNextDupe:r}){return t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsxs("div",{className:"flex items-center gap-0.5",children:[t.jsx(Ds,{icon:t.jsx(Ue,{className:"size-3"}),label:"Previous packet (↑)",disabled:!s}),t.jsx(Ds,{icon:t.jsx(te,{className:"size-3"}),label:"Next packet (↓)",disabled:!a})]}),e&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"w-px h-3 bg-white/10"}),t.jsxs("div",{className:"flex items-center gap-0.5",children:[t.jsx(Ds,{icon:t.jsx(qe,{className:"size-3"}),label:"Previous observation (←)",disabled:!n}),t.jsx(Ds,{icon:t.jsx(_e,{className:"size-3"}),label:"Next observation (→)",disabled:!r})]})]})]})}const $s=e.memo(function({packets:s,initialIndex:a=0,onClose:n,onNavigatePrev:r,onNavigateNext:i,hasPrev:l=!1,hasNext:c=!1}){const[o,d]=e.useState(a),x=s[o]??s[0],p=s.length>1,m=o>0,h=o{d(Math.max(0,Math.min(e,s.length-1)))},[s.length]);e.useEffect(()=>{const e=e=>{if(!(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement))switch(e.key){case"ArrowUp":e.preventDefault(),null==r||r();break;case"ArrowDown":e.preventDefault(),null==i||i();break;case"ArrowLeft":e.preventDefault(),m&&d(e=>e-1);break;case"ArrowRight":e.preventDefault(),h&&d(e=>e+1)}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[r,i,m,h]);const f=G(),g=q(),y=K(),j=Y(),b=e.useMemo(()=>new Set(j.map(e=>e.prefix.toUpperCase())),[j]),v=x.payload_type_name||L(x.payload_type??x.type),N=x.route_type_name||$(x.route_type??x.route),w=x.payload_length??x.length??0,k=Fs(x.original_path),C=Fs(x.forwarded_path),S=k.length>0||C.length>0,M=C.length>0?C:k,P=e.useMemo(()=>{var e;if(null==(e=null==f?void 0:f.config)?void 0:e.repeater)return{latitude:f.config.repeater.latitude,longitude:f.config.repeater.longitude,name:f.config.node_name||"Local Node"}},[f]),T=(null==f?void 0:f.neighbors)??{},H=y.size>0?y:void 0,_=x.raw_packet&&x.raw_packet.length>0,B=e.useMemo(()=>{if((x.payload_type??x.type)!==ue.TRACE||!x.payload)return null;try{const e=me(x.payload),t=x.original_path||x.forwarded_path||[];let s=[];if("string"==typeof t)try{const e=JSON.parse(t);Array.isArray(e)&&(s=e.map(e=>parseInt(e,16)))}catch{s=[]}else Array.isArray(t)&&(s=t.map(e=>parseInt(e,16)));return he(e,s)}catch{return null}},[x]),A=null==B?void 0:B.snrValues,D=e.useMemo(()=>{if((x.payload_type??x.type)!==ue.ADVERT||!x.payload)return null;try{const e=me(x.payload),t=je(e);if(!t)return null;const s=t.publicKey.slice(0,2).toUpperCase();return{...t,prefix:s}}catch{return null}},[x]),z=e.useMemo(()=>{if((null==D?void 0:D.latitude)&&(null==D?void 0:D.longitude))return{latitude:D.latitude,longitude:D.longitude,name:D.name||`Node ${D.prefix||"??"}`,prefix:D.prefix,publicKey:D.publicKey}},[D]),R=e=>e&&0!==e?new Date(1e3*e).toLocaleString():"Unknown",[E,I]=e.useState(null);e.useEffect(()=>{if((x.payload_type??x.type)!==ue.GRP_TXT||!x.payload)return void I(null);let e=!1;const t=me(x.payload);return fe(t).then(t=>{!e&&t&&I(t)}),()=>{e=!0}},[x]);const V=e.useCallback(e=>{if(!e)return null;const t=e.trim().match(/(-?\d+\.?\d*)\s*[,\s]\s*(-?\d+\.?\d*)/);if(!t)return null;const s=parseFloat(t[1]),a=parseFloat(t[2]);return isNaN(s)||isNaN(a)||s<-90||s>90||a<-180||a>180||0===s&&0===a?null:{lat:s,lon:a}},[]),Q=e.useMemo(()=>{var e,t;if(!(null==E?void 0:E.decrypted))return;if(!(null==(e=E.channelName)?void 0:e.toLowerCase().includes("wardrive")))return;const s=V(E.text);return s?{latitude:s.lat,longitude:s.lon,name:E.senderName||"Wardrive Ping",prefix:(null==(t=E.senderName)?void 0:t.slice(0,2).toUpperCase())||"WD",nodeType:"wardrive"}:void 0},[E,V]),ee=(x.payload_type??x.type)===ue.ADVERT&&(void 0!==z||S),te=void 0!==Q,se=z??Q;if(0===M.length)return null;const ae=(null==f?void 0:f.local_hash)?(f.local_hash.startsWith("0x")?f.local_hash.slice(2,4):f.local_hash.slice(0,2)).toUpperCase():"";for(const e of M){const t=e.toUpperCase();if(t!==ae)if(H){let e=0,s=0;if(H.forEach((a,n)=>{(n.startsWith("0x")?n.slice(2,4):n.slice(0,2)).toUpperCase()===t&&(e++,s=Math.max(s,a.combinedScore??0))}),0===e)for(const a of Object.keys(T))if((a.startsWith("0x")?a.slice(2,4):a.slice(0,2)).toUpperCase()===t)break}else for(const e of Object.keys(T))if((e.startsWith("0x")?e.slice(2,4):e.slice(0,2)).toUpperCase()===t)break}const ne={lime:"rgb(132, 204, 22)",cyan:"rgb(34, 211, 238)",amber:"rgb(251, 191, 36)",violet:"rgb(167, 139, 250)",rose:"rgb(251, 113, 133)",emerald:"rgb(52, 211, 153)",sky:"rgb(56, 189, 248)",orange:"rgb(251, 146, 60)",pink:"rgb(244, 114, 182)",zinc:"rgb(161, 161, 170)",purple:"rgb(168, 85, 247)",indigo:"rgb(129, 140, 248)",teal:"rgb(45, 212, 191)",fuchsia:"rgb(232, 121, 249)",blue:"rgb(59, 130, 246)",green:"rgb(34, 197, 94)",yellow:"rgb(250, 204, 21)",red:"rgb(239, 68, 68)"},re=ne[we[v]??"zinc"]||ne.zinc;return t.jsxs(J,{open:!0,onClose:n,size:"5xl",motionPlus:!0,className:"sm:h-[85vh] sm:max-h-[800px] md:h-[80vh] md:max-h-[900px]",children:[t.jsxs("div",{className:"sm:hidden",children:[t.jsx("div",{className:"flex justify-center pt-2 pb-1",children:t.jsx("div",{className:"w-9 h-1 rounded-full bg-white/30","aria-hidden":"true"})}),t.jsxs("div",{className:"flex items-center justify-between px-3 pb-2",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(F,{color:we[v]??"zinc",className:"!text-[9px] !px-1.5 !py-0",children:v}),t.jsx(F,{color:"DIRECT"===N||"T_DIRECT"===N?"cyan":"amber",className:"!text-[9px] !px-1.5 !py-0",children:N}),t.jsxs(F,{color:"zinc",className:"!text-[9px] !px-1.5 !py-0",children:[w,"B"]})]}),t.jsx("button",{onClick:n,className:"px-3 py-1.5 text-[15px] font-medium text-blue-400 active:text-blue-300 transition-colors flex-shrink-0 rounded-lg active:bg-white/5",children:"Done"})]}),p&&t.jsx("div",{className:"px-3 pb-2",children:t.jsx(As,{packets:s,selectedIndex:o,onSelect:u,compact:!0})})]}),t.jsx("div",{className:"hidden sm:block px-6 pt-5 pb-4",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(F,{color:we[v]??"zinc",children:v}),t.jsx(F,{color:"DIRECT"===N||"T_DIRECT"===N?"cyan":"amber",children:N}),t.jsxs(F,{color:"zinc",children:[w,"B"]}),p&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"w-px h-4 bg-white/10"}),t.jsx(As,{packets:s,selectedIndex:o,onSelect:u})]})]}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(Ls,{hasDuplicates:p,hasPrev:l,hasNext:c,canPrevDupe:m,canNextDupe:h}),t.jsx("button",{onClick:n,className:"p-1.5 -m-1.5 text-text-muted hover:text-text-primary transition-colors rounded-lg hover:bg-bg-elevated flex-shrink-0",children:t.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})]})}),t.jsx("div",{className:"sm:hidden h-[2px]",style:{backgroundColor:re,opacity:.6}}),t.jsxs(X,{className:"p-0 overflow-hidden flex-1 flex flex-col min-h-0",children:[t.jsx("div",{className:"md:hidden flex-1 overflow-y-auto overflow-x-hidden",children:t.jsxs("div",{className:"p-2 space-y-2",children:[(null!=x.rssi||null!=x.snr)&&t.jsxs("div",{className:"relative flex items-center justify-between px-2 py-1.5 rounded-lg bg-white/[0.03]",children:[t.jsx(Z,{mode:"popLayout",initial:!1,children:t.jsxs(U.div,{className:"flex items-center gap-3",initial:{opacity:0,scale:.96},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.96},transition:{duration:.15,ease:[.4,0,.2,1]},children:[t.jsx(ve,{rssi:x.rssi,snr:x.snr,compact:!0,showValues:!0}),t.jsx("span",{className:"text-[11px] text-white/50",children:Ce(x.rssi)})]},o)}),M.length>0&&t.jsxs("span",{className:"text-[10px] font-mono text-white/40",children:[M.length," hop",1!==M.length?"s":""]})]}),(S&&M.length>0||ee||te)&&t.jsx("div",{className:"overflow-hidden rounded-xl",children:t.jsx("div",{className:"aspect-[4/3] w-full",children:t.jsx(ts,{path:M,neighbors:T,localNode:P,localHash:null==f?void 0:f.local_hash,srcHash:x.src_hash,dstHash:x.dst_hash,neighborAffinity:H,hubNodes:[...g],traceSnr:A,advertiserSource:se})})}),B&&B.pathHashes.length>0&&t.jsxs("div",{className:"rounded-xl bg-black overflow-hidden",children:[t.jsx("div",{className:"px-3 py-2 space-y-1.5",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"text-[10px] font-medium text-text-muted uppercase tracking-wide",children:"Trace Route"}),t.jsx("div",{className:"flex items-center gap-1.5",children:t.jsx(F,{color:B.isComplete?"green":"amber",compact:!0,children:B.isComplete?"Complete":"In Progress"})})]})}),t.jsx(Bs,{packet:x,neighbors:T,localHash:null==f?void 0:f.local_hash,neighborAffinity:H,ghostPrefixes:b,direction:"flowchart",compact:!0,overridePath:B.pathHashes,traceSnr:B.snrValues})]}),S&&!B&&t.jsxs("div",{className:"rounded-xl bg-black overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between px-3 py-2",children:[t.jsx("span",{className:"text-[10px] font-medium text-text-muted uppercase tracking-wide",children:"Path"}),t.jsxs(F,{color:"zinc",compact:!0,children:[M.length," hop",1!==M.length?"s":""]})]}),t.jsx(Bs,{packet:x,neighbors:T,localHash:null==f?void 0:f.local_hash,neighborAffinity:H,ghostPrefixes:b,direction:"flowchart",compact:!0,traceSnr:A})]}),D&&t.jsxs("div",{className:"rounded-xl bg-white/[0.03] overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-white/5",children:[t.jsx("span",{className:"text-[10px] font-medium text-text-muted uppercase tracking-wide",children:"Advertiser Info"}),t.jsx(F,{color:"lime",compact:!0,children:D.nodeType})]}),t.jsxs("div",{className:"p-3 space-y-2",children:[D.name&&t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(tt,{className:"w-3.5 h-3.5 text-text-muted flex-shrink-0"}),t.jsx("span",{className:"text-sm font-medium text-text-primary truncate",children:D.name})]}),D.latitude&&D.longitude&&t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Ae,{className:"w-3.5 h-3.5 text-text-muted flex-shrink-0"}),t.jsxs("span",{className:"text-xs font-mono text-text-secondary",children:[D.latitude.toFixed(5),", ",D.longitude.toFixed(5)]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Xe,{className:"w-3.5 h-3.5 text-text-muted flex-shrink-0"}),t.jsxs("span",{className:"text-[10px] font-mono text-text-muted truncate",children:[D.publicKey.slice(0,16),"...",D.publicKey.slice(-8)]})]}),D.timestamp>0&&t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(O,{className:"w-3.5 h-3.5 text-text-muted flex-shrink-0"}),t.jsx("span",{className:"text-xs text-text-muted",children:R(D.timestamp)})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(W,{className:"w-3.5 h-3.5 text-text-muted flex-shrink-0"}),t.jsx("span",{className:"text-[10px] text-text-muted",children:D.flagsDescription||`Flags: 0x${D.flags.toString(16).padStart(2,"0")}`})]})]})]}),_&&t.jsx("div",{className:"pt-1",children:t.jsx(Ss,{packet:x})})]})}),t.jsxs("div",{className:"hidden md:grid md:grid-cols-2 flex-1 overflow-hidden",children:[t.jsx("div",{className:"overflow-y-auto overflow-x-hidden scrollbar-none p-4 border-r border-border-subtle",children:_&&t.jsx(Ss,{packet:x})}),t.jsxs("div",{className:"grid overflow-hidden",style:{gridTemplateRows:"minmax(280px, 1fr) auto"},children:[t.jsx("div",{className:"overflow-hidden p-2",children:S&&M.length>0||ee||te?t.jsx("div",{className:"h-full w-full",children:t.jsx(ts,{path:M,neighbors:T,localNode:P,localHash:null==f?void 0:f.local_hash,srcHash:x.src_hash,dstHash:x.dst_hash,neighborAffinity:H,hubNodes:[...g],traceSnr:A,advertiserSource:se})}):t.jsxs("div",{className:"h-full w-full flex flex-col items-center justify-center text-center px-4",children:[t.jsx(W,{className:"w-8 h-8 text-text-muted/50 mb-2"}),t.jsx("span",{className:"text-sm text-text-muted",children:"Direct Reception"}),t.jsx("span",{className:"text-xs text-text-muted/70 mt-1",children:"Zero-hop packet — received directly from sender"})]})}),t.jsxs("div",{className:"overflow-y-auto max-h-[200px] p-2 space-y-2",children:[!B&&M.length<=1&&(null!=x.rssi||null!=x.snr)&&t.jsx("div",{className:"glass-card rounded-xl p-4",children:t.jsxs("dl",{className:"text-xs grid grid-cols-2 gap-2",children:[t.jsxs("div",{children:[t.jsx("dt",{className:"text-text-muted mb-1",children:"Signal"}),t.jsx(Z,{mode:"popLayout",initial:!1,children:t.jsxs(U.dd,{className:"flex items-center gap-2",initial:{opacity:0,scale:.96},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.96},transition:{duration:.15,ease:[.4,0,.2,1]},children:[t.jsx(ve,{rssi:x.rssi,snr:x.snr}),t.jsx("span",{className:"font-medium text-text-primary",children:Ce(x.rssi)})]},o)})]}),t.jsxs("div",{children:[t.jsx("dt",{className:"text-text-muted mb-1",children:"RF"}),t.jsx(Z,{mode:"popLayout",initial:!1,children:t.jsxs(U.dd,{className:"font-mono text-text-secondary tabular-nums",initial:{opacity:0,scale:.96},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.96},transition:{duration:.15,ease:[.4,0,.2,1]},children:[null!=x.rssi&&`${x.rssi} dBm`,null!=x.snr&&` · ${x.snr.toFixed(1)} dB`]},o)})]})]})}),D&&t.jsxs("div",{className:"rounded-xl bg-white/[0.03] overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-white/5",children:[t.jsx("span",{className:"text-xs font-medium text-text-muted uppercase tracking-wide",children:"Advertiser"}),t.jsx(F,{color:"lime",compact:!0,children:D.nodeType})]}),t.jsxs("div",{className:"p-4 space-y-2.5",children:[D.name&&t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(tt,{className:"w-4 h-4 text-text-muted flex-shrink-0"}),t.jsx("span",{className:"text-sm font-medium text-text-primary truncate",children:D.name})]}),D.latitude&&D.longitude&&t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Ae,{className:"w-4 h-4 text-text-muted flex-shrink-0"}),t.jsxs("span",{className:"text-xs font-mono text-text-secondary",children:[D.latitude.toFixed(5),", ",D.longitude.toFixed(5)]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Xe,{className:"w-4 h-4 text-text-muted flex-shrink-0"}),t.jsxs("span",{className:"text-[11px] font-mono text-text-muted truncate",children:[D.publicKey.slice(0,16),"...",D.publicKey.slice(-8)]})]}),D.timestamp>0&&t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(O,{className:"w-4 h-4 text-text-muted flex-shrink-0"}),t.jsx("span",{className:"text-xs text-text-muted",children:R(D.timestamp)})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(W,{className:"w-4 h-4 text-text-muted flex-shrink-0"}),t.jsx("span",{className:"text-[11px] text-text-muted",children:D.flagsDescription||`Flags: 0x${D.flags.toString(16).padStart(2,"0")}`})]})]})]}),B&&B.pathHashes.length>0&&t.jsxs("div",{className:"rounded-xl bg-black overflow-hidden",children:[t.jsxs("div",{className:"px-4 py-2 flex items-center justify-between",children:[t.jsx("span",{className:"text-xs font-medium text-text-muted uppercase tracking-wide",children:"Trace Route"}),t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(F,{color:B.isComplete?"green":"amber",compact:!0,children:B.isComplete?"Complete":"In Progress"}),t.jsxs(F,{color:"teal",compact:!0,children:[B.pathHashes.length,"h"]})]})]}),t.jsx(Bs,{packet:x,neighbors:T,localHash:null==f?void 0:f.local_hash,neighborAffinity:H,ghostPrefixes:b,direction:"flowchart",compact:!0,overridePath:B.pathHashes,traceSnr:B.snrValues})]}),S&&!B&&t.jsxs("div",{className:"rounded-xl bg-black overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-2",children:[t.jsx("span",{className:"text-xs font-medium text-text-muted uppercase tracking-wide",children:"Path"}),t.jsxs(F,{color:"zinc",compact:!0,children:[M.length,"h"]})]}),t.jsx(Bs,{packet:x,neighbors:T,localHash:null==f?void 0:f.local_hash,neighborAffinity:H,ghostPrefixes:b,direction:"flowchart",compact:!0,traceSnr:A})]})]})]})]})]})]})}),zs="var(--mask-height, 0.15em)",Rs="var(--mask-width, 0.5em)",Es=`calc(${Rs} / var(--invert-x, 1))`,Is="#000 0, transparent 71%",Us=`linear-gradient(to right, transparent 0, #000 ${Es}, #000 calc(100% - ${Es}), transparent),linear-gradient(to bottom, transparent 0, #000 ${zs}, #000 calc(100% - ${zs}), transparent 100%),radial-gradient(at bottom right, ${Is}),radial-gradient(at bottom left, ${Is}), radial-gradient(at top left, ${Is}), radial-gradient(at top right, ${Is})`,Vs=`100% calc(100% - ${zs} * 2),calc(100% - ${Es} * 2) 100%,${Es} ${zs},${Es} ${zs},${Es} ${zs},${Es} ${zs}`;function Os({children:e,layoutDependency:s}){return t.jsx(U.span,{layout:!0,layoutDependency:s,"aria-hidden":!0,style:{display:"inline-flex","--invert-x":1,margin:`0 calc(-1*${Rs})`,padding:`calc(${zs}/2) ${Rs}`,position:"relative",zIndex:-1,overflow:"clip",WebkitMaskImage:Us,WebkitMaskSize:Vs,WebkitMaskPosition:"center, center, top left, top right, bottom right, bottom left",WebkitMaskRepeat:"no-repeat"},children:e})}function Ws(){const t=e.useRef(!0);return e.useEffect(()=>{t.current=!1},[]),t.current}function Qs(e){const{width:t,fontSize:s}=getComputedStyle(e);return parseFloat(t)/parseFloat(s)+"em"}se({"--invert-x":{correct:(e,{treeScale:t,projectionDelta:s})=>s.x.scale*t.x}});const Gs=new WeakMap,qs=e.forwardRef(function({value:s,initialValue:a=s,...n},r){const{transition:i}=e.useContext(c),l=e.useRef(a).current,o=Ws(),d=e.useRef(null),x=e.useRef(null);e.useImperativeHandle(r,()=>x.current,[]);const p=e.useRef(new Array(10)),m=ae(),h=m?s:0;e.useLayoutEffect(()=>{d.current&&p.current[l]&&(d.current.style.width=Qs(p.current[l]))},[]);const u=e.useRef(a);e.useLayoutEffect(()=>{var e;if(!d.current||h===u.current)return;const t=d.current.getBoundingClientRect(),s=null==(e=x.current)?void 0:e.getBoundingClientRect(),a=t.height*(h-u.current)+(t.top-(s?s.top||0:t.top));return St(d.current,{y:[a,0]},i),()=>{u.current=h}},[h]);const[f,g]=e.useState();e.useEffect(()=>{if(o&&l===h)return;if(!p.current[h])return;const e=Qs(p.current[h]);x.current&&Gs.set(x.current,e),g(e)},[h]);const y=e=>t.jsx("span",{style:{display:"inline-block",padding:`calc(${zs}/2) 0`},ref:t=>{p.current[e]=t},children:e},e);return t.jsx(U.span,{...n,ref:x,layout:"position","data-state":m?void 0:"exiting",style:{display:"inline-flex",justifyContent:"center",width:f},children:t.jsxs("span",{ref:d,style:{display:"inline-flex",justifyContent:"center",flexDirection:"column",alignItems:"center",position:"relative"},children:[0!==h&&t.jsx("span",{style:{...Ks,bottom:"100%",left:0},children:new Array(h).fill(null).map((e,t)=>y(t))}),y(h),9!==h&&t.jsx("span",{style:{...Ks,top:"100%",left:0},children:new Array(9-h).fill(null).map((e,t)=>y(h+t+1))})]})})}),Ks={display:"flex",flexDirection:"column",alignItems:"center",position:"absolute",width:"100%"},Ys=e.createContext({justify:"left"}),Js=e.forwardRef(function({partKey:s,type:a,children:n,layoutDependency:r,...i},l){const c=ae(),{justify:o}=e.useContext(Ys);return t.jsx(U.span,{...i,"data-state":c?void 0:"exiting",style:{display:"inline-flex",justifyContent:o,padding:`calc(${zs}/2) 0`,position:"relative"},layout:"position",layoutDependency:r,ref:l,children:t.jsx(Z,{mode:"popLayout",anchorX:o,initial:!1,children:t.jsx(U.span,{layout:"right"===o&&"position",layoutDependency:r,initial:{opacity:0},animate:{opacity:[null,1]},exit:{opacity:[null,0]},style:{display:"inline-block",whiteSpace:"pre"},children:n},n)})})}),Xs=e.forwardRef(function({parts:s,justify:a="left",mode:n,style:r,name:i,layoutDependency:l,...c},o){const d=e.useRef(null);e.useImperativeHandle(o,()=>d.current,[]);const x=e.useMemo(()=>({justify:a}),[a]),p=e.useRef(null),m=Ws(),[h,u]=e.useState();return e.useEffect(()=>{if(!p.current)return;if(m)return void(d.current&&(d.current.style.width=Qs(p.current)));const e=Array.from(p.current.children).map(e=>{if(!(e instanceof HTMLElement))return;if("exiting"===e.dataset.state){const t=e.nextSibling;return e.remove(),()=>{p.current&&p.current.insertBefore(e,t)}}const t=Gs.get(e);if(!t)return;const s=e.style.width;return e.style.width=t,()=>{e.style.width=s}});u(Qs(p.current));for(let t=e.length-1;t>=0;t--){const s=e[t];s&&s()}},[s.map(e=>e.value).join("")]),t.jsx(Ys.Provider,{value:x,children:t.jsx(U.span,{layoutDependency:l,...c,ref:d,className:`number-section-${i}`,style:{...r,display:"inline-flex",justifyContent:a,width:h},children:t.jsxs("span",{ref:p,style:{display:"inline-flex",justifyContent:"inherit",position:"relative"},children:["​",t.jsx(Z,{mode:n,anchorX:a,initial:!1,children:s.map(e=>"integer"===e.type||"fraction"===e.type?t.jsx(qs,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},value:e.value,initialValue:m?void 0:0,layoutDependency:l},e.key):t.jsx(Js,{type:e.type,partKey:e.key,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},layoutDependency:l,children:e.value},"literal"===e.type?`${e.key}:${e.value}`:e.key))})]})})})}),Zs={opacity:{duration:1,ease:ne},layout:{type:"spring",duration:1,bounce:0},y:{type:"spring",duration:1,bounce:0}},ea=e.forwardRef(function({children:s,locales:a,format:n,transition:r,style:i,suffix:l,prefix:o,...d},x){const p=e.useMemo(()=>((e,{locales:t,format:s},a,n)=>{const r=new Intl.NumberFormat(t,s).formatToParts(Number(e));a&&r.unshift({type:"prefix",value:a}),n&&r.push({type:"suffix",value:n});const i=[],l=[],c=[],o=[],d={},x=e=>`${e}:${d[e]=(d[e]??-1)+1}`;let p="",m=!1,h=!1;for(const f of r){p+=f.value;const e="minusSign"===f.type||"plusSign"===f.type?"sign":f.type;switch(e){case"integer":m=!0,l.push(...f.value.split("").map(t=>({type:e,value:parseInt(t)})));break;case"group":l.push({type:e,value:f.value});break;case"decimal":h=!0,c.push({type:e,value:f.value,key:x(e)});break;case"fraction":c.push(...f.value.split("").map(t=>({type:e,value:parseInt(t),key:x(e)})));break;default:(m||h?o:i).push({type:e,value:f.value,key:x(e)})}}const u=[];for(let f=l.length-1;f>=0;f--)u.unshift({...l[f],key:x(l[f].type)});return{pre:i,integer:u,fraction:c,post:o,formatted:p}})(s,{locales:a,format:n},o,l),[s,a,n]),{pre:m,integer:h,fraction:u,post:f,formatted:g}=p,y=e.useContext(c).transition;r=r??y??Zs;const{layoutDependency:j}=d,b=e.useMemo(()=>{if(void 0!==j)return{layoutDependency:j,value:s}},[j,s]);return t.jsx(I,{children:t.jsx(lt,{transition:r,children:t.jsx(U.div,{...d,ref:x,layout:!0,layoutDependency:b,style:{lineHeight:1,...i,display:"inline-flex",isolation:"isolate",whiteSpace:"nowrap"},children:t.jsxs(U.div,{layout:!0,layoutDependency:b,"aria-label":g,style:{display:"inline-flex",direction:"ltr",isolation:"isolate",position:"relative",zIndex:-1},children:[t.jsx(Xs,{style:{padding:`calc(${zs}/2) 0`},layoutDependency:b,"aria-hidden":!0,justify:"right",mode:"popLayout",parts:m,name:"pre"}),t.jsxs(Os,{layoutDependency:b,children:[t.jsx(Xs,{layoutDependency:b,justify:"right",parts:h,name:"integer"}),t.jsx(Xs,{layout:"position",layoutDependency:b,parts:u,name:"fraction"})]}),t.jsx(Xs,{style:{padding:`calc(${zs}/2) 0`},"aria-hidden":!0,layout:"position",layoutDependency:b,mode:"popLayout",parts:f,name:"post"})]})})})})});function ta(e,t){return e.length>t.length||e.length>0&&!t.startsWith(e)}function sa(e,t,s){return e+(t-e)*s}U.create(e.Fragment);const aa=new Set([".",",","!","?",":",";","'",'"',"-","(",")"]),na=new Set(["!","@","#","$","%","^","&","*","(",")","_","+","{","}","|",":",'"',"<",">","?"]);const ra={slow:130,normal:75,fast:30};e.forwardRef(function({children:s="",as:a,speed:n="normal",variance:r="natural",cursorClassName:i="motion-typewriter-cursor",cursorStyle:l,cursorBlinkDuration:x=.5,onComplete:p,play:m=!0,"aria-label":h,textClassName:u,textStyle:f,replace:g="type",backspace:y="character",backspaceFactor:j=.2,...b},v){const N=a||"span",w=e.useRef(s),k=function(){const t=o(()=>d("")),{isStatic:s}=e.useContext(c);if(s){const[,s]=e.useState("");e.useEffect(()=>t.on("change",s),[])}return t}(),C=e.useRef(null),S=e.useRef(null),M=e.useRef(null),P="number"==typeof n?n:ra[n],T=()=>{var e;null==(e=C.current)||e.call(C),C.current=null},H=()=>{S.current=St(M.current,{opacity:[1,1,0,0]},{duration:x,times:[0,.5,.5,1],ease:"linear",repeat:1/0,repeatType:"reverse"})};return e.useEffect(()=>{"all"===g&&s!==w.current&&k.set(""),w.current=s},[s,g]),e.useEffect(()=>{var e;if(!m)return H(),void T();null==(e=S.current)||e.cancel();const t=()=>{const e=function(e,t,s,a){if("type"===s&&ta(e,t)){if("all"===a)return t.slice(0,function(e,t){const s=Math.min(e.length,t.length);let a=0;for(let n=0;n=0&&/\s/.test(e[s]);)s--;for(;s>=0&&!/\s/.test(e[s]);)s--;return Math.max(0,s+1)}(e,e.length);return e.slice(0,t)}return e.slice(0,-1)}return t.slice(0,e.length+1)}(k.get(),s,g,y);k.set(e),e!==s?a():(H(),null==p||p())},a=()=>{C.current=re(t,function(e,t,s,a,n){if(ta(t,e))return s*n;if("natural"===a)return function(e,t,s){const a=t.length,n=e[a],r=e[a-1];if(!n)return s;const i=e.slice(0,a).lastIndexOf(" "),l=a-i-1,c=i+1,o=e.slice(a).indexOf(" "),d=(-1===o?e.length:a+o)-c;let x=1;r&&/[.!?]/.test(r)&&" "===n&&(x*=3),d<=3?x*=.7:(0===l&&" "!==n&&(x*=1.5),l===d-1&&(x*=1.4)),l>0&&l3&&(x*=1-Math.min(l/d,.4)),aa.has(n)&&(x*=1.5),na.has(n)&&(x*=1.5),/\d/.test(n)&&(x*=1.3),d>8&&(x*=1.3),n!==n.toLowerCase()&&(x*=1.25),a>200&&(x*=1+Math.min((a-200)/1e3,.3)),x*=1+sa(-.25,.25,Math.random());const p=s*x;return Math.max(.2*s,p)}(e,t,s);if("number"==typeof a&&a>0){const e=s*(a/100);return s+sa(-e,e,Math.random())}return s}(s,k.get(),P,r,j))};return C.current||a(),T},[m,p,s,P,r,j,y]),t.jsxs(N,{ref:v,...b,"aria-label":h||s,children:[t.jsx(U.span,{className:u,style:f,children:k}),t.jsx(U.span,{ref:M,className:i,style:{display:"inline-block",width:"2px",height:"1em",backgroundColor:"currentColor",position:"relative",top:"0.1em",left:"0.2em",...l}})]})});const ia={type:"spring",visualDuration:.6,bounce:.25,opacity:{duration:.2,ease:"linear"}};function la({value:s,format:a,prefix:n,className:r}){const[i,l]=e.useState("waiting");if(e.useEffect(()=>{const e=setTimeout(()=>{l("mounted")},400);return()=>clearTimeout(e)},[]),e.useEffect(()=>{if("mounted"===i){const e=requestAnimationFrame(()=>{l("animating")});return()=>cancelAnimationFrame(e)}},[i]),"waiting"===i){const e=(0).toLocaleString(void 0,a);return t.jsxs("span",{className:r,children:[n,e]})}return t.jsx(ea,{className:r,format:a,prefix:n,transition:ia,children:"animating"===i?s:0})}function ca({label:e,numericValue:s,unit:a,icon:n,subtext:r,showSign:i=!1}){return t.jsxs("div",{className:"rounded-lg p-3 sm:rounded-xl sm:p-4 bg-white/[0.03] ring-1 ring-inset ring-white/[0.06]",children:[t.jsx("div",{className:"mb-1.5 sm:mb-2",children:t.jsx("span",{className:"text-[10px] sm:text-[11px] font-medium uppercase tracking-wide text-text-muted",children:e})}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(la,{value:s,format:{minimumFractionDigits:1,maximumFractionDigits:1,signDisplay:i?"always":"auto"},className:"font-mono text-xl sm:text-2xl font-semibold tabular-nums tracking-tight text-white"}),t.jsxs("div",{className:"flex flex-col items-center justify-center",children:[t.jsx(n,{className:"w-[14px] h-[14px] text-text-muted"}),a&&t.jsx("span",{className:"text-[10px] sm:text-xs font-medium leading-tight text-text-muted",children:a})]})]}),r&&t.jsx("p",{className:"mt-1.5 sm:mt-2 font-mono text-[10px] sm:text-[11px] text-text-muted/80 truncate",children:r})]})}function oa({snr:e}){const a=e>=5?"bg-sys-teal":e>=0?"bg-sys-green":e>=-5?"bg-sys-amber":e>=-10?"bg-sys-orange":"bg-sys-red";return t.jsx("span",{className:s("w-1.5 h-1.5 rounded-full flex-shrink-0",a),title:`SNR: ${e.toFixed(1)} dB`})}function da({fromPrefix:e,toPrefix:a,fromName:n,toName:r,snr:i,maxSnr:l,isWeakest:c,isStrongest:o,index:d=0}){const x=Math.max(l+5,15),p=Math.max(0,Math.min(100,(i- -20)/(x- -20)*100)),m="bg-[#0074BE]",h=i>=5?"bg-sys-teal":i>=0?"bg-sys-green":i>=-5?"bg-sys-amber":i>=-10?"bg-sys-orange":"bg-sys-red",u=.3+.15*d;return t.jsxs("div",{className:"relative p-3 pl-5 rounded-lg bg-white/[0.03] ring-1 ring-inset ring-white/[0.06]",children:[t.jsx("span",{className:s("absolute left-0 top-1/2 -translate-y-1/2 h-4 w-0.5 rounded-full",h)}),t.jsx("span",{className:"absolute -top-0.5 -right-0.5",children:t.jsx(oa,{snr:i})}),t.jsxs("div",{className:"sm:hidden",children:[t.jsxs("div",{className:"flex items-center justify-between mb-1",children:[t.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[t.jsx("span",{className:"text-[13px] font-medium text-white/70 truncate",children:n||e}),t.jsx(He,{className:"w-3 h-3 text-white/30 flex-shrink-0"}),t.jsx("span",{className:"text-[13px] font-semibold text-white truncate",children:r||a})]}),t.jsxs("div",{className:"flex items-center gap-1.5 ml-2 flex-shrink-0",children:[c&&t.jsx(F,{color:"red",compact:!0,children:"Low"}),o&&!c&&t.jsxs(F,{color:"amber",compact:!0,children:[t.jsx(et,{className:"w-2.5 h-2.5"}),"Best"]}),t.jsxs("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded text-[12px] font-mono font-bold tabular-nums bg-white/[0.06] text-text-primary ring-1 ring-inset ring-white/[0.1]",children:[i>=0?"+":"−",Math.abs(i).toFixed(1)]})]})]}),t.jsx("div",{className:"h-1.5 bg-white/10 rounded-full overflow-hidden",children:t.jsx(U.div,{className:s("h-full rounded-full",m),initial:{width:0},animate:{width:`${p}%`},transition:{duration:1.5,delay:u,ease:[.25,.1,.25,1]}})})]}),t.jsxs("div",{className:"hidden sm:block",children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[t.jsx("code",{className:"font-mono text-xs text-text-muted",children:e}),n&&t.jsx("span",{className:"text-xs text-text-secondary truncate max-w-[100px]",children:n})]}),t.jsx(He,{className:"w-3 h-3 text-text-muted/40 flex-shrink-0"}),t.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[t.jsx("code",{className:"font-mono text-xs font-semibold text-text-primary",children:a}),r&&t.jsx("span",{className:"text-xs text-text-secondary truncate max-w-[100px]",children:r})]})]}),t.jsxs("div",{className:"flex items-center gap-1.5",children:[c&&t.jsx(F,{color:"red",compact:!0,children:"Bottleneck"}),o&&!c&&t.jsxs(F,{color:"amber",compact:!0,children:[t.jsx(et,{className:"w-3 h-3"}),"Strongest"]}),t.jsxs("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-sm font-mono font-semibold tabular-nums bg-white/[0.06] text-text-primary ring-1 ring-inset ring-white/[0.1]",children:[i>=0?"+":"−",Math.abs(i).toFixed(1)]})]})]}),t.jsx("div",{className:"h-1.5 bg-bg-elevated rounded-full overflow-hidden",children:t.jsx(U.div,{className:s("h-full rounded-full",m),initial:{width:0},animate:{width:`${p}%`},transition:{duration:1.5,delay:u,ease:[.25,.1,.25,1]}})})]})]})}function xa(e,t){if("You"===e)return"You";const s=e.toUpperCase();for(const[a,n]of Object.entries(t))if((a.startsWith("0x")?a.slice(2,4):a.slice(0,2)).toUpperCase()===s)return n.name||n.node_name||void 0}const pa=e.memo(function({report:e,onClose:s}){var a,n;const r=G(),i=(null==r?void 0:r.neighbors)??{},l=(null==(a=null==r?void 0:r.config)?void 0:a.repeater)?{latitude:r.config.repeater.latitude,longitude:r.config.repeater.longitude,name:r.config.node_name||"Local Node"}:void 0,c=null==(n=e.bestObservation)?void 0:n.decoded.snrValues,o=e.linkQuality?e.linkQuality.avgSnr>=5?"excellent":e.linkQuality.avgSnr>=0?"good":e.linkQuality.avgSnr>=-5?"fair":"poor":"unknown",d={excellent:"var(--signal-excellent)",good:"var(--signal-good)",fair:"var(--signal-fair)",poor:"var(--signal-poor)",unknown:"var(--text-muted)"}[o];return t.jsxs(J,{open:!0,onClose:s,size:"5xl",motionPlus:!0,children:[t.jsxs("div",{className:"sm:hidden",children:[t.jsx("div",{className:"flex justify-center pt-2 pb-1",children:t.jsx("div",{className:"w-9 h-1 rounded-full bg-white/30","aria-hidden":"true"})}),t.jsxs("div",{className:"flex items-center justify-between px-4 pb-2",children:[t.jsx("h2",{className:"font-semibold text-[17px] text-white",children:"Trace Report"}),t.jsx("button",{onClick:s,className:"text-[17px] font-medium text-blue-400 active:text-blue-300",children:"Done"})]})]}),t.jsx("div",{className:"sm:hidden h-[2px]",style:{backgroundColor:d,opacity:.6}}),t.jsx("div",{className:"hidden sm:block px-6 pt-5 pb-4",children:t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2 sm:gap-3",children:[t.jsx("h2",{className:"text-base sm:text-lg font-semibold text-text-primary",children:"Trace Report"}),t.jsxs(F,{color:"excellent"===o||"good"===o?"green":"fair"===o?"amber":"red",children:[t.jsx(Ze,{className:"w-3 h-3 mr-1"}),"excellent"===o?"Excellent":"good"===o?"Good":"fair"===o?"Fair":"Poor"]})]}),t.jsx("p",{className:"mt-1 text-xs sm:text-sm font-mono text-text-muted tabular-nums",children:e.traceTag})]}),t.jsx("button",{onClick:s,className:"p-1.5 -m-1.5 text-text-muted hover:text-text-primary transition-colors rounded-lg hover:bg-bg-elevated flex-shrink-0",children:t.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})}),t.jsxs("div",{className:"hidden sm:flex flex-wrap items-center gap-1.5 sm:gap-2 px-4 sm:px-6 pb-3 sm:pb-4 border-b border-border-subtle",children:[t.jsxs(F,{color:"teal",children:[t.jsx("span",{className:"font-mono tabular-nums",children:e.targetHopCount}),t.jsxs("span",{className:"ml-1",children:["hop",1!==e.targetHopCount?"s":""]})]}),t.jsxs(F,{color:"zinc",children:[t.jsx("span",{className:"font-mono tabular-nums",children:e.observationCount}),t.jsx("span",{className:"ml-1",children:"obs"})]}),e.linkQuality&&t.jsxs(F,{color:"purple",children:[t.jsx("span",{className:"font-mono tabular-nums",children:e.linkQuality.avgSnr.toFixed(1)}),t.jsx("span",{className:"ml-1",children:"dB avg"})]}),t.jsx("span",{className:"font-mono text-xs text-text-muted tabular-nums",children:ie(e.duration)}),e.linkQuality&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"text-text-muted/40",children:"•"}),t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium bg-sys-red/15 text-sys-red ring-1 ring-inset ring-sys-red/25",children:[t.jsx("span",{className:"opacity-70",children:"Min"}),t.jsx("span",{className:"font-mono tabular-nums",children:e.linkQuality.minSnr.toFixed(1)})]}),t.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium bg-sys-teal/15 text-sys-teal ring-1 ring-inset ring-sys-teal/25",children:[t.jsx("span",{className:"opacity-70",children:"Max"}),t.jsx("span",{className:"font-mono tabular-nums",children:e.linkQuality.maxSnr.toFixed(1)})]})]})]})]}),t.jsxs(X,{className:"p-0 overflow-hidden",children:[t.jsx("div",{className:"md:hidden h-[75vh] max-h-[calc(100vh-80px)] overflow-y-auto overflow-x-hidden",children:t.jsxs("div",{className:"px-4 py-3 space-y-3",children:[e.linkQuality&&t.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[t.jsxs("div",{className:"rounded-lg bg-white/[0.03] ring-1 ring-inset ring-white/[0.06] p-2.5 text-center",children:[t.jsx(la,{value:Math.abs(e.linkQuality.minSnr),format:{maximumFractionDigits:0,signDisplay:"never"},prefix:e.linkQuality.minSnr<0?"-":"",className:"text-[20px] font-bold font-mono tabular-nums flex items-center justify-center text-white"}),t.jsxs("div",{className:"flex items-center justify-center gap-1 mt-1",children:[t.jsx($e,{className:"w-2.5 h-2.5 text-text-muted"}),t.jsx("span",{className:"text-[10px] text-white/40",children:"Min dB"})]})]}),t.jsxs("div",{className:"rounded-lg bg-white/[0.03] ring-1 ring-inset ring-white/[0.06] p-2.5 text-center",children:[t.jsx(la,{value:e.linkQuality.maxSnr,format:{maximumFractionDigits:0,signDisplay:"always"},className:"text-[20px] font-bold font-mono text-white tabular-nums flex items-center justify-center"}),t.jsxs("div",{className:"flex items-center justify-center gap-1 mt-1",children:[t.jsx(Le,{className:"w-2.5 h-2.5 text-text-muted"}),t.jsx("span",{className:"text-[10px] text-white/40",children:"Max dB"})]})]})]}),t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsxs(F,{color:"excellent"===o||"good"===o?"green":"fair"===o?"amber":"red",compact:!0,children:[t.jsx(Ze,{className:"w-2.5 h-2.5 mr-0.5"}),"excellent"===o?"Excellent":"good"===o?"Good":"fair"===o?"Fair":"Poor"]}),t.jsxs(F,{color:"teal",compact:!0,children:[e.targetHopCount," hops"]}),t.jsxs(F,{color:"zinc",compact:!0,children:[e.observationCount," obs"]}),t.jsx("span",{className:"text-[10px] font-mono text-white/30 ml-auto",children:e.traceTag.slice(0,8)})]}),e.targetPath.length>0&&t.jsx("div",{className:"overflow-hidden rounded-xl",children:t.jsx("div",{className:"aspect-[4/3] w-full",children:t.jsx(ts,{path:e.targetPath,neighbors:i,localNode:l,localHash:null==r?void 0:r.local_hash,srcHash:e.srcHash,dstHash:e.dstHash,traceSnr:c})})}),t.jsxs("div",{className:"rounded-xl bg-black overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-white/5",children:[t.jsx("span",{className:"text-[11px] font-medium text-white/60",children:"Route Path"}),e.linkQuality&&t.jsxs("span",{className:"text-[10px] font-mono text-white/40",children:["SNR ",e.linkQuality.minSnr.toFixed(1)," → ",e.linkQuality.maxSnr.toFixed(1)," dB"]})]}),e.bestObservation?t.jsx(Bs,{packet:e.bestObservation.packet,neighbors:i,localHash:null==r?void 0:r.local_hash,direction:"flowchart",compact:!0,overridePath:e.targetPath,traceSnr:e.bestObservation.decoded.snrValues}):t.jsx("div",{className:"p-6 text-center text-text-muted text-[11px]",children:"No path data available"})]}),t.jsxs("div",{children:[t.jsxs("h3",{className:"text-[11px] font-medium uppercase tracking-wide text-white/40 mb-2",children:["Link Quality · ",e.hopStats.length," hops"]}),t.jsx("div",{className:"space-y-1.5",children:e.hopStats.length>0?e.hopStats.map((s,a)=>{var n,r,l;const c=a{const s=e.targetPath[e.linkQuality.weakestLinkPosition],a=e.targetPath[e.linkQuality.weakestLinkPosition+1]||"You",n=xa(s,i),r=xa(a,i),l=e.targetPath[e.linkQuality.strongestLinkPosition],c=e.targetPath[e.linkQuality.strongestLinkPosition+1]||"You",o=xa(l,i),d=xa(c,i);return t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsx(ca,{label:"Weakest Link",numericValue:e.linkQuality.minSnr,unit:"dB",icon:$e,subtext:`${n||s} → ${r||a}`}),t.jsx(ca,{label:"Best Link",numericValue:e.linkQuality.maxSnr,showSign:!0,unit:"dB",icon:Le,subtext:`${o||l} → ${d||c}`})]})})(),t.jsxs("div",{children:[t.jsx("h3",{className:"text-[11px] font-medium uppercase tracking-wide text-text-muted mb-3",children:"Link Details"}),t.jsx("div",{className:"space-y-2",children:e.hopStats.length>0?e.hopStats.map((s,a)=>{var n,r,l;const c=a0&&t.jsx("div",{className:"overflow-hidden",children:t.jsx("div",{className:"aspect-square w-full",children:t.jsx(ts,{path:e.targetPath,neighbors:i,localNode:l,localHash:null==r?void 0:r.local_hash,srcHash:e.srcHash,dstHash:e.dstHash,traceSnr:c})})}),t.jsxs("div",{className:"rounded-xl bg-black overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-3",children:[t.jsx("span",{className:"text-xs font-medium text-text-muted uppercase tracking-wide",children:"Trace Route"}),t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(F,{color:e.isComplete?"green":"amber",compact:!0,children:e.isComplete?"Complete":`${e.maxHopsObserved}/${e.targetHopCount}`}),t.jsxs(F,{color:"teal",compact:!0,children:[e.targetHopCount," hop",1!==e.targetHopCount?"s":""]})]})]}),e.linkQuality&&e.bestObservation&&t.jsxs("div",{className:"flex items-center gap-4 px-4 pb-2 font-mono text-[10px] text-text-muted",children:[t.jsxs("span",{children:[t.jsx("span",{className:"opacity-60",children:"Tag"})," ",t.jsx("code",{className:"text-teal-400 tabular-nums",children:e.traceTag.slice(0,8)})]}),t.jsxs("span",{children:[t.jsx("span",{className:"opacity-60",children:"SNR"})," ",t.jsxs("code",{className:"text-accent-secondary tabular-nums",children:[e.linkQuality.minSnr.toFixed(1),"–",e.linkQuality.maxSnr.toFixed(1)]}),t.jsx("span",{className:"opacity-60",children:" dB"})]})]}),e.bestObservation?t.jsx(Bs,{packet:e.bestObservation.packet,neighbors:i,localHash:null==r?void 0:r.local_hash,direction:"flowchart",compact:!0,overridePath:e.targetPath,traceSnr:e.bestObservation.decoded.snrValues}):t.jsx("div",{className:"p-8 text-center text-text-muted text-xs",children:"No path data available"})]})]})]})]})]})});function ma({message:e}){return t.jsxs("div",{className:"flex flex-col items-center justify-center py-14 text-center",children:[t.jsx(W,{className:"size-6 text-text-muted mb-2"}),t.jsx("p",{className:"text-sm text-text-primary",children:e}),t.jsx("p",{className:"text-xs text-text-muted",children:"Packets will appear here"})]})}function ha(){return t.jsx("div",{className:"py-14 text-center text-sm text-text-muted",children:"Loading packets…"})}function ua({showPagination:e,currentPage:s,perPage:a,displayCount:n,totalCount:r,action:i}){const l=e?(s-1)*a+1:1,c=e?Math.min(s*a,r):n;return t.jsxs("div",{className:"flex items-center justify-between gap-4 border-t border-white/5 px-4 py-3 text-xs text-text-muted sm:px-6",children:[t.jsxs("span",{children:["Showing"," ",t.jsx("span",{className:"font-medium text-text-secondary",children:e?`${l}–${c}`:n})," ","of"," ",t.jsx("span",{className:"font-medium text-text-secondary",children:r})," ","packets"]}),i]})}function fa({packets:a,allPackets:n,localHash:r,neighbors:i,loading:l=!1,maxPackets:c,perPage:o=50,showPagination:d=!1,onPacketSelect:x,flashNewest:p=!1,emptyMessage:m="No packets found",className:h,footerAction:u}){const[f,g]=e.useState(null),[y,j]=e.useState(null),[b,v]=e.useState({traceTag:null,dupeGroup:null});e.useLayoutEffect(()=>{v({traceTag:null,dupeGroup:null})},[a]);const N=n??a,w=e.useMemo(()=>c&&c>0?a.slice(0,c):a,[a,c]),{currentPage:k,totalPages:C,goToPage:S,pageRange:M}=function(t,s,a){const[n,r]=e.useState(1),i=a?Math.ceil(t/s):1;e.useEffect(()=>{n>i&&i>0&&queueMicrotask(()=>r(1))},[i,n]);const l=e.useCallback(e=>r(Math.max(1,Math.min(e,i))),[i]),c=e.useMemo(()=>function(e,t,s=1){if(t<=7)return Array.from({length:t},(e,t)=>t+1);const a=Math.max(e-s,1),n=Math.min(e+s,t),r=a>2,i=nt+1),"gap",t]}if(r&&!i){const e=3+2*s;return[1,"gap",...Array.from({length:e},(s,a)=>t-e+a+1)]}return[1,"gap",...Array.from({length:n-a+1},(e,t)=>a+t),"gap",t]}(n,i),[n,i]);return{currentPage:n,totalPages:i,goToPage:l,pageRange:c}}(w.length,o,d),P=e.useMemo(()=>{if(!d)return w;const e=(k-1)*o;return w.slice(e,e+o)},[w,d,k,o]),T=e.useMemo(()=>function(e){const t=new Map;for(const s of e)if((s.payload_type??s.type)===ce.TRACE&&s.payload&&s.packet_hash){const e=Dt(s.payload);e&&t.set(s.packet_hash,e)}return t}(P),[P]),H=e.useMemo(()=>function(e){const t=new Map;if(0===e.length)return t;for(let s=0;s{var e,a;if(!s||!t.length)return;const i=(null==(e=t[0])?void 0:e.timestamp)??0,l=i>r.current&&r.current>0;if(r.current=i,!l)return;const c=null==(a=t[0])?void 0:a.packet_hash;if(!c)return;const o=requestAnimationFrame(()=>n(c)),d=setTimeout(()=>n(null),600);return()=>{cancelAnimationFrame(o),clearTimeout(d)}},[t,s]),a}(a,p),B=e.useCallback((e,t)=>{var s,a;const n=e.packet_hash;if(!n)return[e];let r=t;for(;r>0&&(null==(s=P[r-1])?void 0:s.packet_hash)===n;)r--;let i=t;for(;i{var t,s;const a=null==(t=P[e])?void 0:t.packet_hash;if(!a)return e;let n=e;for(;n>0&&(null==(s=P[n-1])?void 0:s.packet_hash)===a;)n--;return n},[P]),A=e.useCallback(e=>{var t,s;const a=null==(t=P[e])?void 0:t.packet_hash;if(!a)return e;let n=e;for(;n{if(x)x(e);else if(void 0!==t){const s=B(e,t),a=s.indexOf(e);g({packets:s,initialIndex:a>=0?a:0,rowIndex:t})}else g({packets:[e],initialIndex:0,rowIndex:0})},[x,B]),L=e.useCallback(()=>{if(!f)return;const e=F(f.rowIndex)-1;if(e<0)return;const t=P[e];if(!t)return;const s=B(t,e);g({packets:s,initialIndex:0,rowIndex:e})},[f,P,F,B]),$=e.useCallback(()=>{if(!f)return;const e=A(f.rowIndex)+1;if(e>=P.length)return;const t=P[e];if(!t)return;const s=B(t,e);g({packets:s,initialIndex:0,rowIndex:e})},[f,P,A,B]),z=e.useMemo(()=>!!f&&F(f.rowIndex)>0,[f,F]),R=e.useMemo(()=>!!f&&A(f.rowIndex)v(t=>({...t,traceTag:e})),[]),I=e.useCallback(e=>v(t=>({...t,dupeGroup:e})),[]),U=e.useCallback(()=>{v({traceTag:null,dupeGroup:null})},[]),V=e.useCallback(e=>{const t=N.filter(t=>(t.payload_type??t.type)===ce.TRACE&&t.payload&&Dt(t.payload)===e);if(0===t.length)return;const s=function(e){const t=new Map;for(const s of e){const e=$t(s);if(!e)continue;const a=e.decoded.traceTag,n=t.get(a)||[];n.push(e),t.set(a,n)}for(const[s,a]of t)a.sort((e,t)=>e.timestamp-t.timestamp),t.set(s,a);return t}(t),a=s.get(e);(null==a?void 0:a.length)&&j(function(e,t){if(0===t.length)return{traceTag:e,traceTagValue:0,targetPath:[],targetHopCount:0,observations:[],observationCount:0,firstSeen:0,lastSeen:0,duration:0,isComplete:!1,maxHopsObserved:0,progressPercent:0,bestObservation:null,hopStats:[],linkQuality:null};const s=[...t].sort((e,t)=>e.timestamp-t.timestamp),a=s.reduce((e,t)=>t.hopCount>e.hopCount?t:e,s[0]),n=s[0].timestamp,r=s[s.length-1].timestamp,i=a.decoded.pathHashes,l=i.length,c=a.hopCount,o=a.decoded.isComplete,d=[],x=a.decoded.snrValues;for(let m=0;m0){const e=Math.min(...x),t=Math.max(...x);p={minSnr:e,maxSnr:t,avgSnr:x.reduce((e,t)=>e+t,0)/x.length,weakestLinkPosition:x.indexOf(e),strongestLinkPosition:x.indexOf(t)}}return{traceTag:e,traceTagValue:a.decoded.traceTagValue,targetPath:i,targetHopCount:l,observations:s,observationCount:s.length,firstSeen:n,lastSeen:r,duration:r-n,isComplete:o,maxHopsObserved:c,progressPercent:l>0?Math.round(c/l*100):0,bestObservation:a,hopStats:d,linkQuality:p,srcHash:a.packet.src_hash,dstHash:a.packet.dst_hash}}(e,a))},[N]),O=e.useCallback(e=>{const t=N.find(t=>t.packet_hash===e);t&&(j(null),D(t))},[N,D]),W=e=>{if(l&&0===a.length)return t.jsx(ha,{});if(0===P.length)return t.jsx(ma,{message:m});const s=e?Kt:qt;return P.map((e,a)=>{const n=e.packet_hash?T.get(e.packet_hash):void 0,l=null!==b.traceTag&&n===b.traceTag,c=H.get(a),o=void 0!==c&&null!==b.dupeGroup&&e.packet_hash===b.dupeGroup;return t.jsx(s,{packet:e,onClick:e=>D(e,a),localHash:r,neighbors:i,isFlashing:p&&_===e.packet_hash,traceTag:n,isTraceHighlighted:l,onTraceHover:E,onViewTraceReport:V,dupeGroupPosition:c,isDupeGroupHovered:o,onDupeGroupHover:I},`${e.packet_hash}_${e.timestamp}_${a}`)})};return t.jsxs("div",{className:s("flex flex-col",h),onMouseLeave:U,children:[t.jsx("div",{className:"hidden divide-y divide-white/5 py-1 sm:block",children:W(!1)}),t.jsx("div",{className:"divide-y divide-white/5 sm:hidden",children:W(!0)}),d&&C>1&&t.jsx("nav",{className:"border-t border-white/5 px-4 py-3",children:t.jsxs(Tt,{className:"justify-center",children:[t.jsx(Ht,{onClick:()=>S(k-1),disabled:1===k}),t.jsx(Bt,{children:M.map((e,s)=>"gap"===e?t.jsx(At,{},`gap-${s}`):t.jsx(Ft,{page:e,current:e===k,onClick:S},e))}),t.jsx(_t,{onClick:()=>S(k+1),disabled:k===C})]})}),t.jsx(ua,{showPagination:d,currentPage:k,perPage:o,displayCount:P.length,totalCount:d?w.length:a.length,action:u}),!x&&f&&t.jsx($s,{packets:f.packets,initialIndex:f.initialIndex,onClose:()=>g(null),onNavigatePrev:L,onNavigateNext:$,hasPrev:z,hasNext:R}),y&&t.jsx(pa,{report:y,onClose:()=>j(null),onViewPacket:O})]})}export{fa as P,Ze as S,et as T,It as g,Pt as u}; diff --git a/frontend/dist/assets/Packets-BHJJxf8a.js b/frontend/dist/assets/Packets-BHJJxf8a.js deleted file mode 100644 index 4ed4198e..00000000 --- a/frontend/dist/assets/Packets-BHJJxf8a.js +++ /dev/null @@ -1 +0,0 @@ -import{r as e,j as a,ae as s,af as l,ag as t,C as i,ah as r,ai as n,$ as o,aj as c,a1 as d,ad as m,a0 as u,ak as p,al as x,am as h,E as b,X as g}from"./vendor-react-C341c8YC.js";import{n as v}from"./recharts-6XUQYgRA.js";import{u as j,e as f,d as y,v as N,x as w,R as k,L as C,y as S}from"./index-BJEgt3tp.js";import{g as P,P as R}from"./PacketList-BPeOqxkB.js";import{P as L,b as M,a as F}from"./PageLayout-CnF5SScd.js";import{C as _}from"./Card-2pQSGkKC.js";import"./vendor-core-WoOfkQwm.js";import"./deckgl-DTsmDcfs.js";import"./channel-keys-DJWRrSwE.js";import"./SignalIndicator-BLrEkFNb.js";import"./DataBox-CRX76VsB.js";import"./useThemeColors-AeHMyThq.js";function D({options:n,value:o,onChange:c,defaultValue:d,displayValue:m,filter:u,placeholder:p,disabled:x,invalid:h,name:b,"aria-label":g,className:j,children:f}){const[y,N]=e.useState(""),w=m??(e=>null!=e?String(e):""),k=u??((e,a)=>w(e).toLowerCase().includes(a.toLowerCase())),C=e.useMemo(()=>y?n.filter(e=>k(e,y)):n,[n,y,k]);return a.jsx(s,{value:o,onChange:c,defaultValue:d,disabled:x,name:b,onClose:()=>N(""),children:a.jsxs("div",{className:v("relative",j),children:[a.jsxs("div",{className:"relative",children:[a.jsx(l,{"aria-label":g,displayValue:w,onChange:e=>N(e.target.value),placeholder:p,className:v(["w-full rounded-lg py-2 pl-3 pr-10","text-sm text-text-primary placeholder:text-text-muted","bg-bg-subtle border",h?"border-accent-danger":"border-border-subtle","focus:outline-none focus:border-accent-primary/50 focus:ring-1 focus:ring-accent-primary/20","hover:border-border-strong","disabled:opacity-50 disabled:cursor-not-allowed","transition-colors duration-150"])}),a.jsx(t,{className:"absolute inset-y-0 right-0 flex items-center pr-3 group",children:a.jsx(i,{className:"w-4 h-4 text-text-muted transition-transform duration-200 group-data-[open]:rotate-180"})})]}),a.jsx(r,{anchor:"bottom start",transition:!0,className:v(["w-[var(--input-width)] min-w-[180px]","max-h-60 overflow-y-auto overscroll-contain scroll-py-1","rounded-lg p-1 mt-1","glass-card-elevated","focus:outline-none","transition-opacity duration-150 ease-out","data-[closed]:opacity-0","data-[enter]:duration-150 data-[leave]:duration-100","z-50"]),children:0===C.length&&""!==y?a.jsx("div",{className:"px-3 py-2 text-sm text-text-muted",children:"No results found"}):C.map((s,l)=>a.jsx(e.Fragment,{children:f(s)},l))})]})})}function A({value:s,disabled:l,className:t,children:i}){return a.jsx(n,{as:e.Fragment,value:s,disabled:l,children:({selected:e,focus:s})=>a.jsxs("div",{className:v("flex items-center gap-2 px-3 py-2 rounded-md cursor-default","text-sm",s&&"bg-accent-primary text-white",!s&&"text-text-primary",e&&!s&&"text-accent-primary",l&&"opacity-50 cursor-not-allowed",t),children:[a.jsx("span",{className:"w-4 flex-shrink-0",children:e&&a.jsx(o,{className:"w-4 h-4"})}),a.jsx("span",{className:"truncate flex-1",children:i})]})})}function T({className:e,...s}){return a.jsx("span",{...s,className:v("truncate",e)})}function V({value:e,onChange:s,options:l,placeholder:t,disabled:i,className:r,"aria-label":n}){const o=l.find(a=>a.value===e);return a.jsx(D,{options:l,value:o,onChange:e=>{e&&s(e.value)},displayValue:e=>(null==e?void 0:e.label)??"",filter:(e,a)=>e.label.toLowerCase().includes(a.toLowerCase()),placeholder:t,disabled:i,className:r,"aria-label":n,children:e=>a.jsx(A,{value:e,disabled:e.disabled,children:a.jsx(T,{children:e.label})})})}function q({icon:e,label:s,value:l,color:t,percentage:i}){return a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:v("p-1.5 rounded-md",t),children:e}),a.jsxs("div",{className:"flex flex-col",children:[a.jsx("span",{className:"text-sm font-semibold text-text-primary",children:l.toLocaleString()}),a.jsxs("span",{className:"text-[10px] text-text-muted leading-tight",children:[s,void 0!==i&&a.jsxs("span",{className:"ml-1 opacity-70",children:["(",i,"%)"]})]})]})]})}const H=e.memo(function({packets:s}){const l=e.useMemo(()=>{let e=0,a=0,l=0;const t=new Set;let i=0,r=0;for(const c of s){switch(P(c)){case"forward":e++;break;case"dropped":a++;break;case"duplicate":l++}c.src_hash&&t.add(c.src_hash),c.rssi&&(i+=c.rssi,r++)}const n=s.length,o=r>0?Math.round(i/r):0;return{total:n,rx:n,fwd:e,dropped:a,duplicate:l,uniqueSources:t.size,avgRssi:o,rxPercent:100,fwdPercent:n>0?Math.round(e/n*100):0,droppedPercent:n>0?Math.round(a/n*100):0}},[s]);return 0===s.length?null:a.jsx("div",{className:"glass-card p-3 pr-4",children:a.jsxs("div",{className:"grid grid-cols-2 gap-3 sm:flex sm:items-center sm:justify-between sm:gap-6",children:[a.jsx(q,{icon:a.jsx(c,{className:"w-3.5 h-3.5 text-accent-primary"}),label:"Received",value:l.rx,color:"bg-accent-primary/10",percentage:l.rxPercent}),a.jsx(q,{icon:a.jsx(d,{className:"w-3.5 h-3.5 text-accent-success"}),label:"Forwarded",value:l.fwd,color:"bg-accent-success/10",percentage:l.fwdPercent}),a.jsx(q,{icon:a.jsx(m,{className:"w-3.5 h-3.5 text-accent-danger"}),label:"Dropped",value:l.dropped,color:"bg-accent-danger/10",percentage:l.droppedPercent}),a.jsx(q,{icon:a.jsx(u,{className:"w-3.5 h-3.5 text-text-muted"}),label:"Duplicates",value:l.duplicate,color:"bg-white/5"}),a.jsxs("div",{className:"hidden sm:flex items-center gap-6 ml-auto",children:[a.jsx(q,{icon:a.jsx(p,{className:"w-3.5 h-3.5 text-accent-secondary"}),label:"Sources",value:l.uniqueSources,color:"bg-accent-secondary/10"}),a.jsxs("div",{className:"flex flex-col items-end pr-1",children:[a.jsxs("span",{className:"text-sm font-mono text-text-secondary",children:[l.avgRssi," dBm"]}),a.jsx("span",{className:"text-[10px] text-text-muted",children:"Avg Signal"})]})]})]})})});function z(){const s=j(),l=f(),t=y(),i=N(),r=null==l?void 0:l.local_hash,n=null==l?void 0:l.neighbors,[o,c]=e.useState(!1),[d,m]=e.useState({limit:500,status:"all"}),[u,p]=e.useState(Date.now);e.useEffect(()=>{d.timeRange&&d.timeRange>0&&queueMicrotask(()=>p(Date.now()))},[d.timeRange,s]);const D=e.useMemo(()=>{const e=d.limit??500;return[...s.length<=e?s:s.slice(-e)].sort((e,a)=>(a.timestamp??0)-(e.timestamp??0))},[s,d.limit]),A=0===s.length,T=e.useMemo(()=>{let e=D;if(void 0!==d.type){const a=w[d.type];e=e.filter(e=>{const s=e.type??e.payload_type,l=e.payload_type_name;return s===d.type||l===a})}if(void 0!==d.route){const a=k[d.route];e=e.filter(e=>{const s=e.route??e.route_type,l=e.route_type_name;return s===d.route||l===a})}if(d.status&&"all"!==d.status&&(e=e.filter(e=>P(e)===d.status)),void 0!==d.signalMin&&(e=e.filter(e=>e.rssi>=d.signalMin)),d.timeRange&&d.timeRange>0){const a=u/1e3-3600*d.timeRange;e=e.filter(e=>e.timestamp>=a)}return e},[D,d.type,d.route,d.status,d.signalMin,d.timeRange,u]),q=(e,a)=>m(s=>({...s,[e]:a})),z=void 0!==d.type||void 0!==d.route||d.status&&"all"!==d.status||void 0!==d.signalMin||d.timeRange&&d.timeRange>0;return a.jsxs(L,{children:[a.jsx(M,{title:"Packet History",icon:a.jsx(b,{}),controls:a.jsxs(a.Fragment,{children:[t&&a.jsx(C,{showLabel:!0}),a.jsxs(S,{outline:!0,color:z?"primary":"muted",onClick:()=>c(!o),className:"sm:hidden",children:[a.jsx(x,{"data-slot":"icon"}),z&&a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-accent-primary"})]}),a.jsxs(S,{outline:!0,color:t?"success":"muted",onClick:()=>i(!t),children:[a.jsx(h,{"data-slot":"icon",className:v(t&&"animate-spin")}),a.jsx("span",{className:"hidden xs:inline",children:t?"Live":"Paused"})]})]})}),a.jsxs(F,{noPadding:!0,className:v("overflow-hidden transition-all duration-200",o?"max-h-96 opacity-100":"max-h-0 opacity-0 sm:max-h-96 sm:opacity-100"),children:[a.jsx(_,{listHeader:!0,icon:a.jsx(x,{className:"icon-sm"}),title:"Filters",actions:z?a.jsxs(S,{plain:!0,color:"muted",onClick:()=>m({limit:d.limit,status:"all"}),className:"!text-xs !py-0.5 !px-1.5",children:[a.jsx(g,{"data-slot":"icon",className:"!w-3 !h-3"}),"Clear"]}):void 0}),a.jsx("div",{className:"p-3 sm:p-4",children:a.jsxs("div",{className:"grid grid-cols-2 sm:flex sm:flex-wrap gap-3",children:[a.jsxs("div",{className:"flex-1 min-w-[140px]",children:[a.jsx("label",{className:"type-micro block mb-1",children:"Type"}),a.jsx(V,{value:d.type??"",onChange:e=>q("type",""===e?void 0:Number(e)),options:[{value:"",label:"All Types"},...Object.entries(w).map(([e,a])=>({value:Number(e),label:a}))],placeholder:"Search types...","aria-label":"Filter by packet type"})]}),a.jsxs("div",{className:"flex-1 min-w-[140px]",children:[a.jsx("label",{className:"type-micro block mb-1",children:"Route"}),a.jsx(V,{value:d.route??"",onChange:e=>q("route",""===e?void 0:Number(e)),options:[{value:"",label:"All Routes"},...Object.entries(k).map(([e,a])=>({value:Number(e),label:a}))],placeholder:"Search routes...","aria-label":"Filter by route type"})]}),a.jsxs("div",{className:"flex-1 min-w-[140px]",children:[a.jsx("label",{className:"type-micro block mb-1",children:"Status"}),a.jsx(V,{value:d.status??"all",onChange:e=>q("status",e),options:[{value:"all",label:"All Status"},{value:"rx",label:"Received"},{value:"forward",label:"Forwarded"},{value:"dropped",label:"Dropped"},{value:"duplicate",label:"Duplicate"}],placeholder:"Search status...","aria-label":"Filter by status"})]}),a.jsxs("div",{className:"flex-1 min-w-[120px]",children:[a.jsx("label",{className:"type-micro block mb-1",children:"Time"}),a.jsx(V,{value:d.timeRange??0,onChange:e=>q("timeRange",0===e?void 0:e),options:[{value:0,label:"All Time"},{value:1,label:"Last 1h"},{value:6,label:"Last 6h"},{value:24,label:"Last 24h"},{value:168,label:"Last 7d"}],placeholder:"Search time...","aria-label":"Filter by time range"})]}),a.jsxs("div",{className:"flex-1 min-w-[130px]",children:[a.jsx("label",{className:"type-micro block mb-1",children:"Signal"}),a.jsx(V,{value:d.signalMin??"",onChange:e=>q("signalMin",""===e?void 0:Number(e)),options:[{value:"",label:"Any Signal"},{value:-90,label:"Strong (≥-90)"},{value:-100,label:"Good (≥-100)"},{value:-110,label:"Fair (≥-110)"},{value:-120,label:"Weak (≥-120)"}],placeholder:"Search signal...","aria-label":"Filter by signal strength"})]}),a.jsxs("div",{className:"flex-1 min-w-[100px]",children:[a.jsx("label",{className:"type-micro block mb-1",children:"Limit"}),a.jsx(V,{value:d.limit??500,onChange:e=>q("limit",e),options:[{value:100,label:"100"},{value:200,label:"200"},{value:500,label:"500"},{value:1e3,label:"1000"},{value:2e3,label:"2000"}],placeholder:"Limit...","aria-label":"Packet limit"})]})]})})]}),a.jsx(H,{packets:T}),a.jsx(F,{noPadding:!0,className:"!overflow-visible",children:a.jsx(R,{packets:T,allPackets:s,localHash:r,neighbors:n,loading:A,showPagination:!0,perPage:50,emptyMessage:"No packets found"})})]})}export{z as default}; diff --git a/frontend/dist/assets/Packets-DiXDa-F_.js b/frontend/dist/assets/Packets-DiXDa-F_.js new file mode 100644 index 00000000..a60c3813 --- /dev/null +++ b/frontend/dist/assets/Packets-DiXDa-F_.js @@ -0,0 +1 @@ +import{a as e,j as a,H as s,k as l,B as t,U as r,g as i}from"./vendor-react-DCIF8YoJ.js";import{n as o}from"./recharts-DVj1EL-m.js";import{C as n,u as c,f as d,e as m,y as u,z as p,E as x,L as h,G as b,R as j,X as g}from"./index-BGs2yNOg.js";import{C as v}from"./check-qb29v-su.js";import{g as f,P as y}from"./PacketList-CFuBvjqk.js";import{A as N}from"./arrow-up-ce4_7z5E.js";import{A as w}from"./arrow-right-C9AHsGJs.js";import{C as k}from"./SignalIndicator-DWWkJgSd.js";import{C}from"./DataBox-nCNZLfvU.js";import{U as S}from"./users-D0iUt2so.js";import{P as R,b as P,a as L}from"./PageLayout-DIXn4UXM.js";import{F as M}from"./funnel-DZRnHLZd.js";import{R as F}from"./refresh-cw-ccP9GKH1.js";import{C as A}from"./Card-CPlTPCY8.js";import"./deckgl-DTsmDcfs.js";import"./vendor-core-Dl9MTgSr.js";import"./channel-keys-DJWRrSwE.js";import"./chevron-right-7sotkg9l.js";import"./loader-circle-CwUrmZrV.js";import"./map-pin-x5eP-WEg.js";import"./zap-CQ3I2hAj.js";import"./triangle-alert-2-1YN-Am.js";import"./route-DRIRJjaN.js";import"./chevron-up-ClXInh9N.js";import"./circle-check-Bd9Kbu6i.js";import"./house-CCeK_0TO.js";import"./useThemeColors-CGx-Jxyf.js";function _({options:i,value:c,onChange:d,defaultValue:m,displayValue:u,filter:p,placeholder:x,disabled:h,invalid:b,name:j,"aria-label":g,className:v,children:f}){const[y,N]=e.useState(""),w=u??(e=>null!=e?String(e):""),k=p??((e,a)=>w(e).toLowerCase().includes(a.toLowerCase())),C=e.useMemo(()=>y?i.filter(e=>k(e,y)):i,[i,y,k]);return a.jsx(s,{value:c,onChange:d,defaultValue:m,disabled:h,name:j,onClose:()=>N(""),children:a.jsxs("div",{className:o("relative",v),children:[a.jsxs("div",{className:"relative",children:[a.jsx(l,{"aria-label":g,displayValue:w,onChange:e=>N(e.target.value),placeholder:x,className:o(["w-full rounded-lg py-2 pl-3 pr-10","text-sm text-text-primary placeholder:text-text-muted","bg-bg-subtle border",b?"border-accent-danger":"border-border-subtle","focus:outline-none focus:border-accent-primary/50 focus:ring-1 focus:ring-accent-primary/20","hover:border-border-strong","disabled:opacity-50 disabled:cursor-not-allowed","transition-colors duration-150"])}),a.jsx(t,{className:"absolute inset-y-0 right-0 flex items-center pr-3 group",children:a.jsx(n,{className:"w-4 h-4 text-text-muted transition-transform duration-200 group-data-[open]:rotate-180"})})]}),a.jsx(r,{anchor:"bottom start",transition:!0,className:o(["w-[var(--input-width)] min-w-[180px]","max-h-60 overflow-y-auto overscroll-contain scroll-py-1","rounded-lg p-1 mt-1","glass-card-elevated","focus:outline-none","transition-opacity duration-150 ease-out","data-[closed]:opacity-0","data-[enter]:duration-150 data-[leave]:duration-100","z-50"]),children:0===C.length&&""!==y?a.jsx("div",{className:"px-3 py-2 text-sm text-text-muted",children:"No results found"}):C.map((s,l)=>a.jsx(e.Fragment,{children:f(s)},l))})]})})}function D({value:s,disabled:l,className:t,children:r}){return a.jsx(i,{as:e.Fragment,value:s,disabled:l,children:({selected:e,focus:s})=>a.jsxs("div",{className:o("flex items-center gap-2 px-3 py-2 rounded-md cursor-default","text-sm",s&&"bg-accent-primary text-white",!s&&"text-text-primary",e&&!s&&"text-accent-primary",l&&"opacity-50 cursor-not-allowed",t),children:[a.jsx("span",{className:"w-4 flex-shrink-0",children:e&&a.jsx(v,{className:"w-4 h-4"})}),a.jsx("span",{className:"truncate flex-1",children:r})]})})}function z({className:e,...s}){return a.jsx("span",{...s,className:o("truncate",e)})}function H({value:e,onChange:s,options:l,placeholder:t,disabled:r,className:i,"aria-label":o}){const n=l.find(a=>a.value===e);return a.jsx(_,{options:l,value:n,onChange:e=>{e&&s(e.value)},displayValue:e=>(null==e?void 0:e.label)??"",filter:(e,a)=>e.label.toLowerCase().includes(a.toLowerCase()),placeholder:t,disabled:r,className:i,"aria-label":o,children:e=>a.jsx(D,{value:e,disabled:e.disabled,children:a.jsx(z,{children:e.label})})})}function T({icon:e,label:s,value:l,color:t,percentage:r}){return a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:o("p-1.5 rounded-md",t),children:e}),a.jsxs("div",{className:"flex flex-col",children:[a.jsx("span",{className:"text-sm font-semibold text-text-primary",children:l.toLocaleString()}),a.jsxs("span",{className:"text-[10px] text-text-muted leading-tight",children:[s,void 0!==r&&a.jsxs("span",{className:"ml-1 opacity-70",children:["(",r,"%)"]})]})]})]})}const V=e.memo(function({packets:s}){const l=e.useMemo(()=>{let e=0,a=0,l=0;const t=new Set;let r=0,i=0;for(const c of s){switch(f(c)){case"forward":e++;break;case"dropped":a++;break;case"duplicate":l++}c.src_hash&&t.add(c.src_hash),c.rssi&&(r+=c.rssi,i++)}const o=s.length,n=i>0?Math.round(r/i):0;return{total:o,rx:o,fwd:e,dropped:a,duplicate:l,uniqueSources:t.size,avgRssi:n,rxPercent:100,fwdPercent:o>0?Math.round(e/o*100):0,droppedPercent:o>0?Math.round(a/o*100):0}},[s]);return 0===s.length?null:a.jsx("div",{className:"glass-card p-3 pr-4",children:a.jsxs("div",{className:"grid grid-cols-2 gap-3 sm:flex sm:items-center sm:justify-between sm:gap-6",children:[a.jsx(T,{icon:a.jsx(N,{className:"w-3.5 h-3.5 text-accent-primary"}),label:"Received",value:l.rx,color:"bg-accent-primary/10",percentage:l.rxPercent}),a.jsx(T,{icon:a.jsx(w,{className:"w-3.5 h-3.5 text-accent-success"}),label:"Forwarded",value:l.fwd,color:"bg-accent-success/10",percentage:l.fwdPercent}),a.jsx(T,{icon:a.jsx(k,{className:"w-3.5 h-3.5 text-accent-danger"}),label:"Dropped",value:l.dropped,color:"bg-accent-danger/10",percentage:l.droppedPercent}),a.jsx(T,{icon:a.jsx(C,{className:"w-3.5 h-3.5 text-text-muted"}),label:"Duplicates",value:l.duplicate,color:"bg-white/5"}),a.jsxs("div",{className:"hidden sm:flex items-center gap-6 ml-auto",children:[a.jsx(T,{icon:a.jsx(S,{className:"w-3.5 h-3.5 text-accent-secondary"}),label:"Sources",value:l.uniqueSources,color:"bg-accent-secondary/10"}),a.jsxs("div",{className:"flex flex-col items-end pr-1",children:[a.jsxs("span",{className:"text-sm font-mono text-text-secondary",children:[l.avgRssi," dBm"]}),a.jsx("span",{className:"text-[10px] text-text-muted",children:"Avg Signal"})]})]})]})})});function q(){const s=c(),l=d(),t=m(),r=u(),i=null==l?void 0:l.local_hash,n=null==l?void 0:l.neighbors,[v,N]=e.useState(!1),[w,k]=e.useState({limit:500,status:"all"}),[C,S]=e.useState(Date.now);e.useEffect(()=>{w.timeRange&&w.timeRange>0&&queueMicrotask(()=>S(Date.now()))},[w.timeRange,s]);const _=e.useMemo(()=>{const e=w.limit??500;return[...s.length<=e?s:s.slice(-e)].sort((e,a)=>(a.timestamp??0)-(e.timestamp??0))},[s,w.limit]),D=0===s.length,z=e.useMemo(()=>{let e=_;if(void 0!==w.type){const a=p[w.type];e=e.filter(e=>{const s=e.type??e.payload_type,l=e.payload_type_name;return s===w.type||l===a})}if(void 0!==w.route){const a=x[w.route];e=e.filter(e=>{const s=e.route??e.route_type,l=e.route_type_name;return s===w.route||l===a})}if(w.status&&"all"!==w.status&&(e=e.filter(e=>f(e)===w.status)),void 0!==w.signalMin&&(e=e.filter(e=>e.rssi>=w.signalMin)),w.timeRange&&w.timeRange>0){const a=C/1e3-3600*w.timeRange;e=e.filter(e=>e.timestamp>=a)}return e},[_,w.type,w.route,w.status,w.signalMin,w.timeRange,C]),T=(e,a)=>k(s=>({...s,[e]:a})),q=void 0!==w.type||void 0!==w.route||w.status&&"all"!==w.status||void 0!==w.signalMin||w.timeRange&&w.timeRange>0;return a.jsxs(R,{children:[a.jsx(P,{title:"Packet History",icon:a.jsx(j,{}),controls:a.jsxs(a.Fragment,{children:[t&&a.jsx(h,{showLabel:!0}),a.jsxs(b,{outline:!0,color:q?"primary":"muted",onClick:()=>N(!v),className:"sm:hidden",children:[a.jsx(M,{"data-slot":"icon"}),q&&a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-accent-primary"})]}),a.jsxs(b,{outline:!0,color:t?"success":"muted",onClick:()=>r(!t),children:[a.jsx(F,{"data-slot":"icon",className:o(t&&"animate-spin")}),a.jsx("span",{className:"hidden xs:inline",children:t?"Live":"Paused"})]})]})}),a.jsxs(L,{noPadding:!0,className:o("overflow-hidden transition-all duration-200",v?"max-h-96 opacity-100":"max-h-0 opacity-0 sm:max-h-96 sm:opacity-100"),children:[a.jsx(A,{listHeader:!0,icon:a.jsx(M,{className:"icon-sm"}),title:"Filters",actions:q?a.jsxs(b,{plain:!0,color:"muted",onClick:()=>k({limit:w.limit,status:"all"}),className:"!text-xs !py-0.5 !px-1.5",children:[a.jsx(g,{"data-slot":"icon",className:"!w-3 !h-3"}),"Clear"]}):void 0}),a.jsx("div",{className:"p-3 sm:p-4",children:a.jsxs("div",{className:"grid grid-cols-2 sm:flex sm:flex-wrap gap-3",children:[a.jsxs("div",{className:"flex-1 min-w-[140px]",children:[a.jsx("label",{className:"type-micro block mb-1",children:"Type"}),a.jsx(H,{value:w.type??"",onChange:e=>T("type",""===e?void 0:Number(e)),options:[{value:"",label:"All Types"},...Object.entries(p).map(([e,a])=>({value:Number(e),label:a}))],placeholder:"Search types...","aria-label":"Filter by packet type"})]}),a.jsxs("div",{className:"flex-1 min-w-[140px]",children:[a.jsx("label",{className:"type-micro block mb-1",children:"Route"}),a.jsx(H,{value:w.route??"",onChange:e=>T("route",""===e?void 0:Number(e)),options:[{value:"",label:"All Routes"},...Object.entries(x).map(([e,a])=>({value:Number(e),label:a}))],placeholder:"Search routes...","aria-label":"Filter by route type"})]}),a.jsxs("div",{className:"flex-1 min-w-[140px]",children:[a.jsx("label",{className:"type-micro block mb-1",children:"Status"}),a.jsx(H,{value:w.status??"all",onChange:e=>T("status",e),options:[{value:"all",label:"All Status"},{value:"rx",label:"Received"},{value:"forward",label:"Forwarded"},{value:"dropped",label:"Dropped"},{value:"duplicate",label:"Duplicate"}],placeholder:"Search status...","aria-label":"Filter by status"})]}),a.jsxs("div",{className:"flex-1 min-w-[120px]",children:[a.jsx("label",{className:"type-micro block mb-1",children:"Time"}),a.jsx(H,{value:w.timeRange??0,onChange:e=>T("timeRange",0===e?void 0:e),options:[{value:0,label:"All Time"},{value:1,label:"Last 1h"},{value:6,label:"Last 6h"},{value:24,label:"Last 24h"},{value:168,label:"Last 7d"}],placeholder:"Search time...","aria-label":"Filter by time range"})]}),a.jsxs("div",{className:"flex-1 min-w-[130px]",children:[a.jsx("label",{className:"type-micro block mb-1",children:"Signal"}),a.jsx(H,{value:w.signalMin??"",onChange:e=>T("signalMin",""===e?void 0:Number(e)),options:[{value:"",label:"Any Signal"},{value:-90,label:"Strong (≥-90)"},{value:-100,label:"Good (≥-100)"},{value:-110,label:"Fair (≥-110)"},{value:-120,label:"Weak (≥-120)"}],placeholder:"Search signal...","aria-label":"Filter by signal strength"})]}),a.jsxs("div",{className:"flex-1 min-w-[100px]",children:[a.jsx("label",{className:"type-micro block mb-1",children:"Limit"}),a.jsx(H,{value:w.limit??500,onChange:e=>T("limit",e),options:[{value:100,label:"100"},{value:200,label:"200"},{value:500,label:"500"},{value:1e3,label:"1000"},{value:2e3,label:"2000"}],placeholder:"Limit...","aria-label":"Packet limit"})]})]})})]}),a.jsx(V,{packets:z}),a.jsx(L,{noPadding:!0,className:"!overflow-visible",children:a.jsx(y,{packets:z,allPackets:s,localHash:i,neighbors:n,loading:D,showPagination:!0,perPage:50,emptyMessage:"No packets found"})})]})}export{q as default}; diff --git a/frontend/dist/assets/PageLayout-CnF5SScd.js b/frontend/dist/assets/PageLayout-DIXn4UXM.js similarity index 96% rename from frontend/dist/assets/PageLayout-CnF5SScd.js rename to frontend/dist/assets/PageLayout-DIXn4UXM.js index 070b63e5..a9ff1a3a 100644 --- a/frontend/dist/assets/PageLayout-CnF5SScd.js +++ b/frontend/dist/assets/PageLayout-DIXn4UXM.js @@ -1 +1 @@ -import{j as s}from"./vendor-react-C341c8YC.js";import{n as e}from"./recharts-6XUQYgRA.js";import"./index-BJEgt3tp.js";const a=[45,72,33,58,80,42,65,28,55,75,38,62];function l({className:a,style:l}){return s.jsx("div",{className:e("animate-pulse bg-white/[0.06] rounded",a),style:l})}function c(){return s.jsx("div",{className:"p-3 rounded-lg border border-border-subtle bg-bg-subtle",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(l,{className:"w-14 h-6 rounded shrink-0"}),s.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[s.jsx(l,{className:"h-4 w-full"}),s.jsx(l,{className:"h-4 w-3/4"}),s.jsx(l,{className:"h-3 w-32 mt-1"})]})]})})}function r({count:e=8}){return s.jsx("div",{className:"space-y-2",children:Array.from({length:e}).map((e,a)=>s.jsx(c,{},a))})}function i(){return s.jsxs("div",{className:"flex flex-col gap-3 h-full","aria-hidden":"true",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(l,{className:"w-5 h-5"}),s.jsx(l,{className:"h-4 w-24"})]}),s.jsx(l,{className:"h-8 w-20"}),s.jsxs("div",{className:"flex-1 flex flex-col justify-end gap-2",children:[s.jsx(l,{className:"h-3 w-full"}),s.jsx(l,{className:"h-3 w-3/4"})]})]})}function n(){return s.jsxs("div",{className:"flex flex-col gap-3 h-full","aria-hidden":"true",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(l,{className:"w-5 h-5"}),s.jsx(l,{className:"h-4 w-24"})]}),s.jsx("div",{className:"flex-1 flex items-end gap-1",children:a.slice(0,8).map((e,a)=>s.jsx(l,{className:"flex-1",style:{height:`${e}%`}},a))})]})}function t({rows:e=5}){return s.jsxs("div",{className:"flex flex-col h-full","aria-hidden":"true",children:[s.jsx("div",{className:"pb-3 border-b border-border-subtle",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(l,{className:"w-5 h-5"}),s.jsx(l,{className:"h-4 w-24"})]})}),s.jsx("div",{className:"flex-1 pt-3 flex flex-col gap-3",children:Array.from({length:e}).map((e,a)=>s.jsx(l,{className:"h-6 w-full"},a))})]})}function d({children:a,className:l}){return s.jsx("div",{className:e("section-gap",l),children:a})}function x({title:e,icon:a,controls:l,subtitle:c}){return s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between sm:gap-3",children:[s.jsxs("h1",{className:"type-title text-text-primary flex items-center gap-2 sm:gap-3 h-9 min-w-0",children:[a&&s.jsx("span",{className:"w-5 h-5 sm:w-6 sm:h-6 text-icon-page-title flex-shrink-0",children:a}),s.jsx("span",{className:"truncate",children:e})]}),l&&s.jsx("div",{className:"flex items-center gap-2 sm:gap-3 h-9 flex-shrink-0",children:l})]}),c&&s.jsx("div",{children:c})]})}const m={sm:"card-sm",md:"card-md",lg:"card-lg",hero:"card-hero",auto:"card-auto"};function h({children:a,size:l,compact:c,noPadding:r,className:d,style:x,onClick:h,isLoaded:o=!0,skeletonType:f="card"}){return s.jsxs("div",{className:e("glass-card h-full flex flex-col relative",!r&&(c?"card-padding-sm":"card-padding"),l&&m[l],d),style:x,onClick:h,children:[a,!o&&(()=>{switch(f){case"chart":return s.jsx(n,{});case"list":return s.jsx(t,{});default:return s.jsx(i,{})}})()]})}export{i as C,r as L,d as P,l as S,h as a,x as b}; +import{j as s}from"./vendor-react-DCIF8YoJ.js";import{n as e}from"./recharts-DVj1EL-m.js";import"./index-BGs2yNOg.js";const a=[45,72,33,58,80,42,65,28,55,75,38,62];function l({className:a,style:l}){return s.jsx("div",{className:e("animate-pulse bg-white/[0.06] rounded",a),style:l})}function c(){return s.jsx("div",{className:"p-3 rounded-lg border border-border-subtle bg-bg-subtle",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(l,{className:"w-14 h-6 rounded shrink-0"}),s.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[s.jsx(l,{className:"h-4 w-full"}),s.jsx(l,{className:"h-4 w-3/4"}),s.jsx(l,{className:"h-3 w-32 mt-1"})]})]})})}function r({count:e=8}){return s.jsx("div",{className:"space-y-2",children:Array.from({length:e}).map((e,a)=>s.jsx(c,{},a))})}function i(){return s.jsxs("div",{className:"flex flex-col gap-3 h-full","aria-hidden":"true",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(l,{className:"w-5 h-5"}),s.jsx(l,{className:"h-4 w-24"})]}),s.jsx(l,{className:"h-8 w-20"}),s.jsxs("div",{className:"flex-1 flex flex-col justify-end gap-2",children:[s.jsx(l,{className:"h-3 w-full"}),s.jsx(l,{className:"h-3 w-3/4"})]})]})}function n(){return s.jsxs("div",{className:"flex flex-col gap-3 h-full","aria-hidden":"true",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(l,{className:"w-5 h-5"}),s.jsx(l,{className:"h-4 w-24"})]}),s.jsx("div",{className:"flex-1 flex items-end gap-1",children:a.slice(0,8).map((e,a)=>s.jsx(l,{className:"flex-1",style:{height:`${e}%`}},a))})]})}function t({rows:e=5}){return s.jsxs("div",{className:"flex flex-col h-full","aria-hidden":"true",children:[s.jsx("div",{className:"pb-3 border-b border-border-subtle",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(l,{className:"w-5 h-5"}),s.jsx(l,{className:"h-4 w-24"})]})}),s.jsx("div",{className:"flex-1 pt-3 flex flex-col gap-3",children:Array.from({length:e}).map((e,a)=>s.jsx(l,{className:"h-6 w-full"},a))})]})}function d({children:a,className:l}){return s.jsx("div",{className:e("section-gap",l),children:a})}function x({title:e,icon:a,controls:l,subtitle:c}){return s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between sm:gap-3",children:[s.jsxs("h1",{className:"type-title text-text-primary flex items-center gap-2 sm:gap-3 h-9 min-w-0",children:[a&&s.jsx("span",{className:"w-5 h-5 sm:w-6 sm:h-6 text-icon-page-title flex-shrink-0",children:a}),s.jsx("span",{className:"truncate",children:e})]}),l&&s.jsx("div",{className:"flex items-center gap-2 sm:gap-3 h-9 flex-shrink-0",children:l})]}),c&&s.jsx("div",{children:c})]})}const m={sm:"card-sm",md:"card-md",lg:"card-lg",hero:"card-hero",auto:"card-auto"};function h({children:a,size:l,compact:c,noPadding:r,className:d,style:x,onClick:h,isLoaded:o=!0,skeletonType:f="card"}){return s.jsxs("div",{className:e("glass-card h-full flex flex-col relative",!r&&(c?"card-padding-sm":"card-padding"),l&&m[l],d),style:x,onClick:h,children:[a,!o&&(()=>{switch(f){case"chart":return s.jsx(n,{});case"list":return s.jsx(t,{});default:return s.jsx(i,{})}})()]})}export{i as C,r as L,d as P,l as S,h as a,x as b}; diff --git a/frontend/dist/assets/PathMapMapLibre-CHzpOlxn.js b/frontend/dist/assets/PathMapMapLibre-CHzpOlxn.js new file mode 100644 index 00000000..af9c9552 --- /dev/null +++ b/frontend/dist/assets/PathMapMapLibre-CHzpOlxn.js @@ -0,0 +1 @@ +import{a as e,j as t}from"./vendor-react-DCIF8YoJ.js";import{u as o,M as r,B as n,S as i,L as a,a as s,P as l}from"./BasemapLayer-g9CXC1Ky.js";import"./maplibre-gl-Bk5DsYkB.js";import{n as d}from"./recharts-DVj1EL-m.js";import{h as c,s as u,p as m}from"./useThemeColors-CGx-Jxyf.js";import{ai as p,B as h,m as g}from"./index-BGs2yNOg.js";import{C as x}from"./car-DXNv2W8D.js";import{H as f}from"./house-CCeK_0TO.js";import{u as b}from"./PacketList-CFuBvjqk.js";import"./deckgl-DTsmDcfs.js";import"./vendor-core-Dl9MTgSr.js";import"./channel-keys-DJWRrSwE.js";import"./SignalIndicator-DWWkJgSd.js";import"./arrow-up-ce4_7z5E.js";import"./DataBox-nCNZLfvU.js";import"./check-qb29v-su.js";import"./arrow-right-C9AHsGJs.js";import"./chevron-right-7sotkg9l.js";import"./loader-circle-CwUrmZrV.js";import"./map-pin-x5eP-WEg.js";import"./zap-CQ3I2hAj.js";import"./triangle-alert-2-1YN-Am.js";import"./route-DRIRJjaN.js";import"./chevron-up-ClXInh9N.js";import"./circle-check-Bd9Kbu6i.js";const j={version:8,sources:{},layers:[],glyphs:"https://demotiles.maplibre.org/font/{fontstack}/{range}.pbf"},v={nodeColor:"#4338CA",localColor:"#4F46E5",hubColor:"#6366F1",edgeColor:"#3B3F4A",ambiguousColor:"#F9D26F",highlightColor:"#B49DFF",sourceColor:"#39D98A",destinationColor:"#B49DFF"};function y(e,t){if(!e)return t;if(e.startsWith("#"))return e;const o=m(e);return o?`#${o.r.toString(16).padStart(2,"0")}${o.g.toString(16).padStart(2,"0")}${o.b.toString(16).padStart(2,"0")}`:t}function C(){if("undefined"==typeof document)return v;const e=document.documentElement,t=getComputedStyle(e);return{nodeColor:y(t.getPropertyValue("--map-node-stroke").trim(),v.nodeColor),localColor:y(t.getPropertyValue("--map-local-color").trim(),v.localColor),hubColor:y(t.getPropertyValue("--map-hub-color").trim(),v.hubColor),edgeColor:y(t.getPropertyValue("--map-edge-rest").trim(),v.edgeColor),ambiguousColor:y(t.getPropertyValue("--accent-secondary").trim(),v.ambiguousColor),highlightColor:y(t.getPropertyValue("--accent-primary").trim(),v.highlightColor),sourceColor:y(t.getPropertyValue("--accent-success").trim(),v.sourceColor),destinationColor:y(t.getPropertyValue("--accent-primary").trim(),v.destinationColor)}}function k({prefix:o,isLocal:r,isSource:n,isDestination:i,isLastHop:a,isHighlighted:s,isAnimating:l,isWardrive:c,candidate:u,onHover:m,onLeave:p,onClick:j}){const v=b(),[y,C]=e.useState(!1);e.useEffect(()=>{l&&v.start({boxShadow:["0 0 0 0px rgba(113, 156, 223, 0)","0 0 0 2px rgba(113, 156, 223, 0.5)","0 0 0 2px rgba(113, 156, 223, 0.5)","0 0 0 0px rgba(113, 156, 223, 0)"],transition:{duration:.5,times:[0,.2,.7,1],ease:"easeInOut"}})},[l,v]);const k=e.useCallback(()=>{C(!0),m()},[m]),N=e.useCallback(()=>{C(!1),p()},[p]);return c?t.jsxs(g.div,{className:d("flex items-center cursor-pointer","transition-all duration-150",s&&"ring-2 ring-accent-primary/50 rounded-full",y&&"relative z-50"),animate:v,initial:{boxShadow:"0 0 0 0px rgba(249, 115, 22, 0)"},onMouseEnter:k,onMouseLeave:N,onClick:j,style:{pointerEvents:"auto"},children:[t.jsx("div",{className:d("flex items-center justify-center","w-7 h-7 rounded-full","bg-orange-500 text-white","shadow-lg border-2 border-orange-300/50","transition-transform duration-150",y&&"scale-110"),children:t.jsx(x,{className:"w-4 h-4",strokeWidth:2.5})}),y&&t.jsxs(h,{color:"orange",filled:!0,className:"ml-1 text-[10px] font-mono shadow-lg",children:[o,u.name&&t.jsx("span",{className:"ml-1 opacity-75",children:u.name})]})]}):t.jsx(g.div,{className:d("flex items-center cursor-pointer","transition-all duration-150",s&&"ring-2 ring-accent-primary/50 rounded",y&&"relative z-50"),animate:v,initial:{boxShadow:"0 0 0 0px rgba(113, 156, 223, 0)"},onMouseEnter:k,onMouseLeave:N,onClick:j,style:{pointerEvents:"auto"},children:t.jsxs(h,{color:c?"orange":r?"amber":n?"green":a?"amber":i?"purple":"blue",filled:!0,className:"font-mono text-[10px] shadow-lg border border-current/30",children:[r&&t.jsx(f,{className:"w-2.5 h-2.5 mr-1"}),o,y&&u.name&&t.jsx("span",{className:"ml-1 opacity-75",children:u.name})]})})}function N({hopNumber:e,snr:o,edgeColor:r}){return t.jsxs("div",{className:"flex flex-col items-center gap-0.5 pointer-events-none",children:[t.jsx("span",{className:"w-3.5 h-3.5 rounded-full flex items-center justify-center font-mono font-bold tabular-nums shadow-md",style:{backgroundColor:r||"#71717a",color:"#fff",fontSize:"8px",lineHeight:1,textShadow:"0 1px 1px rgba(0,0,0,0.4)"},children:e}),void 0!==o&&t.jsx(h,{color:"zinc",compact:!0,className:"!text-[9px] font-mono tabular-nums shadow-sm",children:o.toFixed(1)})]})}function S({resolvedPath:m,localNode:h,hubNodes:g=[],hoveredHopIndex:x,onHoverHop:f,traceSnr:b}){const v=void 0!==b&&b.length>0,y=e.useRef(null),S=o(),w=e.useMemo(()=>new Set(g),[g]),[F,L]=e.useState(null),D=p(),[E,P]=e.useState(!1),[M,H]=e.useState(0);e.useEffect(()=>{var e;const t=null==(e=y.current)?void 0:e.getMap();if(!t)return;const o=t.getCanvas();if(!o)return;const r=e=>{e.preventDefault()},n=()=>{H(e=>e+1)};return o.addEventListener("webglcontextlost",r),o.addEventListener("webglcontextrestored",n),()=>{o.removeEventListener("webglcontextlost",r),o.removeEventListener("webglcontextrestored",n)}},[M]);const{positions:$,markers:B,edges:I}=e.useMemo(()=>{const e=[],t=[],o=[],r=[];let n=0,i=!1;return m.hops.forEach((a,s)=>{const l=a.candidates.filter(e=>{return t=e.latitude,o=e.longitude,0!==t||0!==o;var t,o});if(0===l.length)return;const d=[...l].sort((e,t)=>t.probability-e.probability)[0],m=[d.longitude,d.latitude];if(r.push(m),r.length>=2){const e=r[r.length-2],t=r.length-2,n=null==b?void 0:b[t],a=m[0]-e[0],s=m[1]-e[1],l=Math.atan2(a,s)*(180/Math.PI),d=C();let p;p=i?"#F97316":void 0!==n?c()[u(n)]||"#71717a":d.edgeColor,o.push({from:e,to:m,snrFwd:n,midpoint:[(e[0]+m[0])/2,(e[1]+m[1])/2],bearing:l,color:p,isFromWardrive:i})}const p=!0===a.isSource,h=!0===a.isDestination,g=!0===d.isWardrive;i=g,l.forEach((o,r)=>{const i=[o.latitude,o.longitude];e.push(i);const d=0===r;t.push({position:i,prefix:a.prefix,confidence:a.confidence,candidateCount:l.length,hopIndex:s,candidate:o,isHub:w.has(o.hash),isPrimary:d,isSource:p,isDestination:h,validIndex:n})}),n++}),{positions:e,markers:t,edges:o}},[m,w,b]),V=e.useMemo(()=>{const e=B.filter(e=>e.isPrimary&&(e.confidence>=.5||e.isSource||e.isDestination));if(0===e.length)return null;let t=1/0,o=-1/0,r=1/0,n=-1/0;for(const i of e){const[e,a]=i.position;eo&&(o=e),an&&(n=a)}return[[r,t],[n,o]]},[B]),A=e.useMemo(()=>{if(0===$.length)return h?[h.longitude,h.latitude]:[0,0];let e=0,t=0;for(const[o,r]of $)e+=o,t+=r;return[t/$.length,e/$.length]},[$,h]),W=e.useCallback(()=>{var e;const t=null==(e=y.current)?void 0:e.getMap();t&&V?(t.fitBounds(V,{padding:{top:50,bottom:50,left:50,right:50},maxZoom:15,duration:0}),setTimeout(()=>{P(!0)},50)):P(!0)},[V]),z=e.useMemo(()=>V?`${V[0][0].toFixed(5)},${V[0][1].toFixed(5)},${V[1][0].toFixed(5)},${V[1][1].toFixed(5)}`:"",[V]);e.useEffect(()=>{var e;if(!E)return;const t=null==(e=y.current)?void 0:e.getMap();t&&V&&t.fitBounds(V,{padding:{top:50,bottom:50,left:50,right:50},maxZoom:15,duration:300})},[z,E,V]);const R=D&&E,O=e.useCallback(e=>{L({longitude:e.position[1],latitude:e.position[0],marker:e})},[]);return 0===$.length?t.jsx("div",{className:"h-full flex items-center justify-center text-text-muted text-sm bg-bg-elevated",children:"No mappable path data"}):t.jsxs("div",{className:"h-full w-full relative",children:[t.jsx("div",{className:d("absolute inset-0 bg-bg-elevated flex items-center justify-center","transition-opacity duration-200 ease-out pointer-events-none",R?"opacity-0":"opacity-100"),children:t.jsx("div",{className:"w-5 h-5 border-2 border-text-muted/30 border-t-text-muted rounded-full animate-spin"})}),t.jsx("div",{className:"h-full w-full transition-opacity duration-300 ease-out",style:{opacity:R?1:0},children:t.jsxs(r,{ref:y,initialViewState:{longitude:A[0],latitude:A[1],zoom:10},onLoad:W,style:{height:"100%",width:"100%"},mapStyle:j,attributionControl:!1,children:[t.jsx(n,{mode:S}),I.map((e,o)=>{const r={type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:{type:"LineString",coordinates:[e.from,e.to]}}]};return t.jsx(i,{id:`edge-${o}`,type:"geojson",data:r,children:t.jsx(a,{id:`edge-line-${o}`,type:"line",paint:{"line-color":e.color,"line-width":4,"line-opacity":1},layout:{"line-cap":"round","line-join":"round"}})},`edge-${o}`)}),I.map((e,o)=>t.jsx(s,{longitude:e.midpoint[0],latitude:e.midpoint[1],anchor:"center",children:t.jsx(N,{hopNumber:o+1,snr:v?e.snrFwd:void 0,edgeColor:e.color})},`hop-${o}`)),(()=>{const e=B.filter(e=>e.isPrimary),o=e.length>1?e.length-2:-1;return e.map((e,r)=>{const n=x===e.hopIndex,i=r===o&&!e.candidate.isLocal&&!e.isDestination;return t.jsx(s,{longitude:e.position[1],latitude:e.position[0],anchor:"center",children:t.jsx(k,{prefix:e.prefix,isLocal:e.candidate.isLocal||!1,isSource:e.isSource,isDestination:e.isDestination,isLastHop:i,isHighlighted:n,isAnimating:!1,isWardrive:e.candidate.isWardrive||!1,candidate:e.candidate,onHover:()=>null==f?void 0:f(e.hopIndex),onLeave:()=>null==f?void 0:f(null),onClick:()=>O(e)})},`${e.hopIndex}-${e.candidate.hash}`)})})(),F&&t.jsx(l,{longitude:F.longitude,latitude:F.latitude,anchor:"bottom",offset:[0,-12],closeOnClick:!1,onClose:()=>L(null),className:"maplibre-popup",children:t.jsxs("div",{className:"text-xs",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:"font-semibold",children:F.marker.candidate.name}),(()=>{const e=C();return t.jsxs(t.Fragment,{children:[F.marker.isSource&&t.jsx("span",{className:"px-1 py-0.5 text-[8px] font-bold rounded",style:{backgroundColor:e.sourceColor,color:"#000"},children:"SRC"}),F.marker.isDestination&&t.jsx("span",{className:"px-1 py-0.5 text-[8px] font-bold rounded",style:{backgroundColor:e.destinationColor,color:"#000"},children:"DST"}),F.marker.isHub&&t.jsx("span",{className:"px-1 py-0.5 text-[8px] font-bold rounded",style:{backgroundColor:e.hubColor,color:"#000"},children:"HUB"}),F.marker.candidate.isLocal&&t.jsx("span",{className:"px-1 py-0.5 text-[8px] font-bold rounded",style:{backgroundColor:e.localColor,color:"#fff"},children:"LOCAL"}),F.marker.candidate.isWardrive&&t.jsx("span",{className:"px-1 py-0.5 text-[8px] font-bold rounded",style:{backgroundColor:"#F97316",color:"#fff"},children:"WARDRIVE"})]})})()]}),t.jsxs("div",{className:"text-text-muted font-mono text-[10px]",children:[F.marker.prefix," • ",F.marker.candidate.hash.slice(0,10),"..."]}),!F.marker.isPrimary&&F.marker.candidateCount>1&&t.jsxs("div",{style:{color:C().ambiguousColor},children:["Alternative (",(100*F.marker.candidate.probability).toFixed(0),"%)"]}),F.marker.isPrimary&&F.marker.candidateCount>1&&t.jsxs("div",{className:"text-text-muted",children:[F.marker.candidateCount," candidates"]})]})})]},M)})]})}export{S as default}; diff --git a/frontend/dist/assets/PathMapMapLibre-ChIFu4o3.js b/frontend/dist/assets/PathMapMapLibre-ChIFu4o3.js deleted file mode 100644 index 84cace77..00000000 --- a/frontend/dist/assets/PathMapMapLibre-ChIFu4o3.js +++ /dev/null @@ -1 +0,0 @@ -import{r as e,j as t,bj as o,bk as r,bl as n,bm as a,bM as i,aD as s,m as l,bN as d,ab as c}from"./vendor-react-C341c8YC.js";import"./maplibre-gl-Bk5DsYkB.js";import{n as u}from"./recharts-6XUQYgRA.js";import{u as m,B as p}from"./BasemapLayer-S9Ush6Hh.js";import{h,s as x,p as g}from"./useThemeColors-AeHMyThq.js";import{H as f,B as b}from"./index-BJEgt3tp.js";import"./vendor-core-WoOfkQwm.js";import"./deckgl-DTsmDcfs.js";const v={version:8,sources:{},layers:[],glyphs:"https://demotiles.maplibre.org/font/{fontstack}/{range}.pbf"},y={nodeColor:"#4338CA",localColor:"#4F46E5",hubColor:"#6366F1",edgeColor:"#3B3F4A",ambiguousColor:"#F9D26F",highlightColor:"#B49DFF",sourceColor:"#39D98A",destinationColor:"#B49DFF"};function C(e,t){if(!e)return t;if(e.startsWith("#"))return e;const o=g(e);return o?`#${o.r.toString(16).padStart(2,"0")}${o.g.toString(16).padStart(2,"0")}${o.b.toString(16).padStart(2,"0")}`:t}function j(){if("undefined"==typeof document)return y;const e=document.documentElement,t=getComputedStyle(e);return{nodeColor:C(t.getPropertyValue("--map-node-stroke").trim(),y.nodeColor),localColor:C(t.getPropertyValue("--map-local-color").trim(),y.localColor),hubColor:C(t.getPropertyValue("--map-hub-color").trim(),y.hubColor),edgeColor:C(t.getPropertyValue("--map-edge-rest").trim(),y.edgeColor),ambiguousColor:C(t.getPropertyValue("--accent-secondary").trim(),y.ambiguousColor),highlightColor:C(t.getPropertyValue("--accent-primary").trim(),y.highlightColor),sourceColor:C(t.getPropertyValue("--accent-success").trim(),y.sourceColor),destinationColor:C(t.getPropertyValue("--accent-primary").trim(),y.destinationColor)}}function k({prefix:o,isLocal:r,isSource:n,isDestination:a,isLastHop:i,isHighlighted:m,isAnimating:p,isWardrive:h,candidate:x,onHover:g,onLeave:f,onClick:v}){const y=s(),[C,j]=e.useState(!1);e.useEffect(()=>{p&&y.start({boxShadow:["0 0 0 0px rgba(113, 156, 223, 0)","0 0 0 2px rgba(113, 156, 223, 0.5)","0 0 0 2px rgba(113, 156, 223, 0.5)","0 0 0 0px rgba(113, 156, 223, 0)"],transition:{duration:.5,times:[0,.2,.7,1],ease:"easeInOut"}})},[p,y]);const k=e.useCallback(()=>{j(!0),g()},[g]),N=e.useCallback(()=>{j(!1),f()},[f]);return h?t.jsxs(l.div,{className:u("flex items-center cursor-pointer","transition-all duration-150",m&&"ring-2 ring-accent-primary/50 rounded-full",C&&"relative z-50"),animate:y,initial:{boxShadow:"0 0 0 0px rgba(249, 115, 22, 0)"},onMouseEnter:k,onMouseLeave:N,onClick:v,style:{pointerEvents:"auto"},children:[t.jsx("div",{className:u("flex items-center justify-center","w-7 h-7 rounded-full","bg-orange-500 text-white","shadow-lg border-2 border-orange-300/50","transition-transform duration-150",C&&"scale-110"),children:t.jsx(d,{className:"w-4 h-4",strokeWidth:2.5})}),C&&t.jsxs(b,{color:"orange",filled:!0,className:"ml-1 text-[10px] font-mono shadow-lg",children:[o,x.name&&t.jsx("span",{className:"ml-1 opacity-75",children:x.name})]})]}):t.jsx(l.div,{className:u("flex items-center cursor-pointer","transition-all duration-150",m&&"ring-2 ring-accent-primary/50 rounded",C&&"relative z-50"),animate:y,initial:{boxShadow:"0 0 0 0px rgba(113, 156, 223, 0)"},onMouseEnter:k,onMouseLeave:N,onClick:v,style:{pointerEvents:"auto"},children:t.jsxs(b,{color:h?"orange":r?"amber":n?"green":i?"amber":a?"purple":"blue",filled:!0,className:"font-mono text-[10px] shadow-lg border border-current/30",children:[r&&t.jsx(c,{className:"w-2.5 h-2.5 mr-1"}),o,C&&x.name&&t.jsx("span",{className:"ml-1 opacity-75",children:x.name})]})})}function N({hopNumber:e,snr:o,edgeColor:r}){return t.jsxs("div",{className:"flex flex-col items-center gap-0.5 pointer-events-none",children:[t.jsx("span",{className:"w-3.5 h-3.5 rounded-full flex items-center justify-center font-mono font-bold tabular-nums shadow-md",style:{backgroundColor:r||"#71717a",color:"#fff",fontSize:"8px",lineHeight:1,textShadow:"0 1px 1px rgba(0,0,0,0.4)"},children:e}),void 0!==o&&t.jsx(b,{color:"zinc",compact:!0,className:"!text-[9px] font-mono tabular-nums shadow-sm",children:o.toFixed(1)})]})}function S({resolvedPath:s,localNode:l,hubNodes:d=[],hoveredHopIndex:c,onHoverHop:g,traceSnr:b}){const y=void 0!==b&&b.length>0,C=e.useRef(null),S=m(),w=e.useMemo(()=>new Set(d),[d]),[F,L]=e.useState(null),D=f(),[E,M]=e.useState(!1),[P,H]=e.useState(0);e.useEffect(()=>{var e;const t=null==(e=C.current)?void 0:e.getMap();if(!t)return;const o=t.getCanvas();if(!o)return;const r=e=>{e.preventDefault()},n=()=>{H(e=>e+1)};return o.addEventListener("webglcontextlost",r),o.addEventListener("webglcontextrestored",n),()=>{o.removeEventListener("webglcontextlost",r),o.removeEventListener("webglcontextrestored",n)}},[P]);const{positions:$,markers:V,edges:B}=e.useMemo(()=>{const e=[],t=[],o=[],r=[];let n=0,a=!1;return s.hops.forEach((i,s)=>{const l=i.candidates.filter(e=>{return t=e.latitude,o=e.longitude,0!==t||0!==o;var t,o});if(0===l.length)return;const d=[...l].sort((e,t)=>t.probability-e.probability)[0],c=[d.longitude,d.latitude];if(r.push(c),r.length>=2){const e=r[r.length-2],t=r.length-2,n=null==b?void 0:b[t],i=c[0]-e[0],s=c[1]-e[1],l=Math.atan2(i,s)*(180/Math.PI),d=j();let u;u=a?"#F97316":void 0!==n?h()[x(n)]||"#71717a":d.edgeColor,o.push({from:e,to:c,snrFwd:n,midpoint:[(e[0]+c[0])/2,(e[1]+c[1])/2],bearing:l,color:u,isFromWardrive:a})}const u=!0===i.isSource,m=!0===i.isDestination,p=!0===d.isWardrive;a=p,l.forEach((o,r)=>{const a=[o.latitude,o.longitude];e.push(a);const d=0===r;t.push({position:a,prefix:i.prefix,confidence:i.confidence,candidateCount:l.length,hopIndex:s,candidate:o,isHub:w.has(o.hash),isPrimary:d,isSource:u,isDestination:m,validIndex:n})}),n++}),{positions:e,markers:t,edges:o}},[s,w,b]),I=e.useMemo(()=>{const e=V.filter(e=>e.isPrimary&&(e.confidence>=.5||e.isSource||e.isDestination));if(0===e.length)return null;let t=1/0,o=-1/0,r=1/0,n=-1/0;for(const a of e){const[e,i]=a.position;eo&&(o=e),in&&(n=i)}return[[r,t],[n,o]]},[V]),W=e.useMemo(()=>{if(0===$.length)return l?[l.longitude,l.latitude]:[0,0];let e=0,t=0;for(const[o,r]of $)e+=o,t+=r;return[t/$.length,e/$.length]},[$,l]),A=e.useCallback(()=>{var e;const t=null==(e=C.current)?void 0:e.getMap();t&&I?(t.fitBounds(I,{padding:{top:50,bottom:50,left:50,right:50},maxZoom:15,duration:0}),setTimeout(()=>{M(!0)},50)):M(!0)},[I]),z=e.useMemo(()=>I?`${I[0][0].toFixed(5)},${I[0][1].toFixed(5)},${I[1][0].toFixed(5)},${I[1][1].toFixed(5)}`:"",[I]);e.useEffect(()=>{var e;if(!E)return;const t=null==(e=C.current)?void 0:e.getMap();t&&I&&t.fitBounds(I,{padding:{top:50,bottom:50,left:50,right:50},maxZoom:15,duration:300})},[z,E,I]);const R=D&&E,O=e.useCallback(e=>{L({longitude:e.position[1],latitude:e.position[0],marker:e})},[]);return 0===$.length?t.jsx("div",{className:"h-full flex items-center justify-center text-text-muted text-sm bg-bg-elevated",children:"No mappable path data"}):t.jsxs("div",{className:"h-full w-full relative",children:[t.jsx("div",{className:u("absolute inset-0 bg-bg-elevated flex items-center justify-center","transition-opacity duration-200 ease-out pointer-events-none",R?"opacity-0":"opacity-100"),children:t.jsx("div",{className:"w-5 h-5 border-2 border-text-muted/30 border-t-text-muted rounded-full animate-spin"})}),t.jsx("div",{className:"h-full w-full transition-opacity duration-300 ease-out",style:{opacity:R?1:0},children:t.jsxs(o,{ref:C,initialViewState:{longitude:W[0],latitude:W[1],zoom:10},onLoad:A,style:{height:"100%",width:"100%"},mapStyle:v,attributionControl:!1,children:[t.jsx(p,{mode:S}),B.map((e,o)=>{const a={type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:{type:"LineString",coordinates:[e.from,e.to]}}]};return t.jsx(r,{id:`edge-${o}`,type:"geojson",data:a,children:t.jsx(n,{id:`edge-line-${o}`,type:"line",paint:{"line-color":e.color,"line-width":4,"line-opacity":1},layout:{"line-cap":"round","line-join":"round"}})},`edge-${o}`)}),B.map((e,o)=>t.jsx(a,{longitude:e.midpoint[0],latitude:e.midpoint[1],anchor:"center",children:t.jsx(N,{hopNumber:o+1,snr:y?e.snrFwd:void 0,edgeColor:e.color})},`hop-${o}`)),(()=>{const e=V.filter(e=>e.isPrimary),o=e.length>1?e.length-2:-1;return e.map((e,r)=>{const n=c===e.hopIndex,i=r===o&&!e.candidate.isLocal&&!e.isDestination;return t.jsx(a,{longitude:e.position[1],latitude:e.position[0],anchor:"center",children:t.jsx(k,{prefix:e.prefix,isLocal:e.candidate.isLocal||!1,isSource:e.isSource,isDestination:e.isDestination,isLastHop:i,isHighlighted:n,isAnimating:!1,isWardrive:e.candidate.isWardrive||!1,candidate:e.candidate,onHover:()=>null==g?void 0:g(e.hopIndex),onLeave:()=>null==g?void 0:g(null),onClick:()=>O(e)})},`${e.hopIndex}-${e.candidate.hash}`)})})(),F&&t.jsx(i,{longitude:F.longitude,latitude:F.latitude,anchor:"bottom",offset:[0,-12],closeOnClick:!1,onClose:()=>L(null),className:"maplibre-popup",children:t.jsxs("div",{className:"text-xs",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:"font-semibold",children:F.marker.candidate.name}),(()=>{const e=j();return t.jsxs(t.Fragment,{children:[F.marker.isSource&&t.jsx("span",{className:"px-1 py-0.5 text-[8px] font-bold rounded",style:{backgroundColor:e.sourceColor,color:"#000"},children:"SRC"}),F.marker.isDestination&&t.jsx("span",{className:"px-1 py-0.5 text-[8px] font-bold rounded",style:{backgroundColor:e.destinationColor,color:"#000"},children:"DST"}),F.marker.isHub&&t.jsx("span",{className:"px-1 py-0.5 text-[8px] font-bold rounded",style:{backgroundColor:e.hubColor,color:"#000"},children:"HUB"}),F.marker.candidate.isLocal&&t.jsx("span",{className:"px-1 py-0.5 text-[8px] font-bold rounded",style:{backgroundColor:e.localColor,color:"#fff"},children:"LOCAL"}),F.marker.candidate.isWardrive&&t.jsx("span",{className:"px-1 py-0.5 text-[8px] font-bold rounded",style:{backgroundColor:"#F97316",color:"#fff"},children:"WARDRIVE"})]})})()]}),t.jsxs("div",{className:"text-text-muted font-mono text-[10px]",children:[F.marker.prefix," • ",F.marker.candidate.hash.slice(0,10),"..."]}),!F.marker.isPrimary&&F.marker.candidateCount>1&&t.jsxs("div",{style:{color:j().ambiguousColor},children:["Alternative (",(100*F.marker.candidate.probability).toFixed(0),"%)"]}),F.marker.isPrimary&&F.marker.candidateCount>1&&t.jsxs("div",{className:"text-text-muted",children:[F.marker.candidateCount," candidates"]})]})})]},P)})]})}export{S as default}; diff --git a/frontend/dist/assets/SignalIndicator-BLrEkFNb.js b/frontend/dist/assets/SignalIndicator-BLrEkFNb.js deleted file mode 100644 index 85ccde41..00000000 --- a/frontend/dist/assets/SignalIndicator-BLrEkFNb.js +++ /dev/null @@ -1 +0,0 @@ -import{j as e,a_ as n,a$ as r,b0 as a,b1 as t,aB as s,r as o}from"./vendor-react-C341c8YC.js";import{n as i}from"./recharts-6XUQYgRA.js";const l={ADVERT:"purple",ACK:"emerald",REQ:"sky",RESPONSE:"sky",TXT_MSG:"teal",GRP_TXT:"teal",FLOOD:"sky",GRP_DATA:"indigo",PATH:"amber",MULTIPART:"violet",TRACE:"orange",ANON_REQ:"pink",RAW_CUSTOM:"fuchsia"},c={FLOOD:"sky",T_FLOOD:"sky",DIRECT:"cyan",T_DIRECT:"cyan"},u={rx:"sky",forward:"teal",duplicate:"zinc",tx:"amber",dropped:"rose"},d={neighbor:"amber",hub:"purple",gateway:"indigo",backbone:"purple",repeater:"teal",room:"pink",companion:"blue",client:"indigo",mobile:"orange"},x={hub:"amber",backbone:"purple",relay:"cyan",edge:"brown"},f={high:"green",medium:"amber",low:"orange",insufficient:"brown"},g={direct:"amber",multihop:"brown"},p={5:-2.5,6:-5,7:-7.5,8:-10,9:-12.5,10:-15,11:-17.5,12:-20},m={62500:{5:-123,6:-125,7:-127,8:-130,9:-133,10:-136,11:-138,12:-140},125e3:{5:-120,6:-122,7:-124,8:-127,9:-130,10:-133,11:-135,12:-137},25e4:{5:-117,6:-119,7:-121,8:-124,9:-127,10:-130,11:-132,12:-134},5e5:{5:-114,6:-116,7:-118,8:-121,9:-124,10:-127,11:-129,12:-131}};function h(e,n,r){if(null==e||!Number.isFinite(e))return null;if(null==n||!Number.isFinite(n))return null;const{sf:a,bwHz:t}=r,s=function(e){const n=Math.max(5,Math.min(12,Math.round(e)));return p[n]??p[7]}(a),o=function(e,n){let r=62500;r=e>=375e3?5e5:e>=187500?25e4:e>=93750?125e3:62500;const a=m[r];return a[Math.max(5,Math.min(12,Math.round(n)))]??a[7]}(t,a),i=e-s,l=n-o;return{snrMargin:i,rssiMargin:l,worstMargin:Math.min(i,l)}}const w={EXCELLENT:6,GOOD:3,FAIR:0},b={EXCELLENT:10,GOOD:6,FAIR:2},M=["excellent","good","fair","poor","critical"];function N(e,n){return e>=n.EXCELLENT?"excellent":e>=n.GOOD?"good":e>=n.FAIR?"fair":e>=n.FAIR-3?"poor":"critical"}function y(e,n){if(0===n)return e;const r=M.indexOf(e),a=Math.min(r+n,M.length-1);return M[a]}function E(e,n,r,a){const t=(s=N(e.snrMargin,w),o=N(e.rssiMargin,b),M.indexOf(s)>=M.indexOf(o)?s:o);var s,o;const i=y(t,n);return{baseGrade:t,finalGrade:i,snrMargin:e.snrMargin,rssiMargin:e.rssiMargin,worstMargin:e.worstMargin,nfPenalty:n,wasDowngraded:n>0&&i!==t,confidence:r,isMarginBased:a}}function k(e,n,r,a=0){return r&&null!=e?function(e,n,r,a=0){const t=h(e,n,r);return t?E(t,a,"high",!0):null}(e,n,r,a):null!=e&&null!=n?function(e,n,r=0){const a=function(e,n){return h(e,n,{sf:7,bwHz:62500})}(e,n);return a?E(a,r,"low",!0):null}(e,n,a):function(e,n=0){if(null==e||!Number.isFinite(e))return null;const r=function(e){return e>=-90?"excellent":e>=-100?"good":e>=-110?"fair":e>=-120?"poor":"critical"}(e),a=y(r,n);return{baseGrade:r,finalGrade:a,snrMargin:null,rssiMargin:null,worstMargin:null,nfPenalty:n,wasDowngraded:n>0&&a!==r,confidence:"low",isMarginBased:!1}}(n,a)}const A={excellent:"color(display-p3 0.00 1.00 0.00)",good:"color(display-p3 0.55 0.90 0.15)",fair:"color(display-p3 1.00 0.85 0.00)",weak:"color(display-p3 1.00 0.55 0.15)",poor:"color(display-p3 1.00 0.20 0.20)"},j={excellent:"#4ADE80",good:"#A3E635",fair:"#FACC15",weak:"#FB923C",poor:"#EF4444"};function O(e){return e>=-90?"excellent":e>=-100?"good":e>=-110?"fair":e>=-120?"weak":"poor"}function T(e,n){return n?{backgroundColor:j[e],"--p3-color":A[e]}:{backgroundColor:"rgba(255, 255, 255, 0.1)"}}function C(e){return e?"signal-bar-active":""}function R({rssi:o,className:l="w-4 h-4"}){const c=O(o),u=function(e){switch(e){case"excellent":return"text-signal-excellent";case"good":return"text-signal-good";case"fair":return"text-signal-fair";case"weak":return"text-signal-poor";case"poor":return"text-signal-critical";default:return"text-text-muted"}}(c),d=i(u,l);switch(c){case"excellent":return e.jsx(s,{className:d});case"good":return e.jsx(t,{className:d});case"fair":return e.jsx(a,{className:d});case"weak":return e.jsx(r,{className:d});default:return e.jsx(n,{className:d})}}const D=o.memo(function({rssi:n,snr:r,compact:a=!1,showValues:t=!0,radioConfig:s,nfPenalty:o=0}){const l=void 0!==r?function(e,n,r,a=0){const t=k(n,e,r,a);return t?function(e){switch(e){case"excellent":return"excellent";case"good":return"good";case"fair":return"fair";case"poor":return"weak";case"critical":return"poor"}}(t.finalGrade):O(e)}(n,r,s,o):O(n),c={excellent:4,good:3,fair:2,weak:1,poor:0}[l];return a?e.jsxs("div",{className:"flex items-center gap-1.5",children:[t&&e.jsx("span",{className:"text-[10px] font-mono text-text-secondary tabular-nums w-[32px] text-left",children:n}),e.jsx("div",{className:"flex items-end gap-[2px] h-3 w-[14px]",children:Array.from({length:4}).map((n,r)=>e.jsx("div",{className:i("w-[3px] rounded-[1px] transition-colors",C(re.jsx("div",{className:i("w-[3px] rounded-[1px] transition-colors",C(r=375e3?5e5:e>=187500?25e4:e>=93750?125e3:62500;const r=y[a];return r[Math.max(5,Math.min(12,Math.round(n)))]??r[7]}(t,r),o=e-s,l=n-i;return{snrMargin:o,rssiMargin:l,worstMargin:Math.min(o,l)}}const k={EXCELLENT:6,GOOD:3,FAIR:0},b={EXCELLENT:10,GOOD:6,FAIR:2},w=["excellent","good","fair","poor","critical"];function j(e,n){return e>=n.EXCELLENT?"excellent":e>=n.GOOD?"good":e>=n.FAIR?"fair":e>=n.FAIR-3?"poor":"critical"}function N(e,n){if(0===n)return e;const a=w.indexOf(e),r=Math.min(a+n,w.length-1);return w[r]}function v(e,n,a,r){const t=(s=j(e.snrMargin,k),i=j(e.rssiMargin,b),w.indexOf(s)>=w.indexOf(i)?s:i);var s,i;const o=N(t,n);return{baseGrade:t,finalGrade:o,snrMargin:e.snrMargin,rssiMargin:e.rssiMargin,worstMargin:e.worstMargin,nfPenalty:n,wasDowngraded:n>0&&o!==t,confidence:a,isMarginBased:r}}function E(e,n,a,r=0){return a&&null!=e?function(e,n,a,r=0){const t=M(e,n,a);return t?v(t,r,"high",!0):null}(e,n,a,r):null!=e&&null!=n?function(e,n,a=0){const r=function(e,n){return M(e,n,{sf:7,bwHz:62500})}(e,n);return r?v(r,a,"low",!0):null}(e,n,r):function(e,n=0){if(null==e||!Number.isFinite(e))return null;const a=function(e){return e>=-90?"excellent":e>=-100?"good":e>=-110?"fair":e>=-120?"poor":"critical"}(e),r=N(a,n);return{baseGrade:a,finalGrade:r,snrMargin:null,rssiMargin:null,worstMargin:null,nfPenalty:n,wasDowngraded:n>0&&r!==a,confidence:"low",isMarginBased:!1}}(n,r)}const A={excellent:"color(display-p3 0.00 1.00 0.00)",good:"color(display-p3 0.55 0.90 0.15)",fair:"color(display-p3 1.00 0.85 0.00)",weak:"color(display-p3 1.00 0.55 0.15)",poor:"color(display-p3 1.00 0.20 0.20)"},O={excellent:"#4ADE80",good:"#A3E635",fair:"#FACC15",weak:"#FB923C",poor:"#EF4444"};function T(e){return e>=-90?"excellent":e>=-100?"good":e>=-110?"fair":e>=-120?"weak":"poor"}function C(e,n){return n?{backgroundColor:O[e],"--p3-color":A[e]}:{backgroundColor:"rgba(255, 255, 255, 0.1)"}}function R(e){return e?"signal-bar-active":""}function D({rssi:e,className:a="w-4 h-4"}){const t=T(e),u=function(e){switch(e){case"excellent":return"text-signal-excellent";case"good":return"text-signal-good";case"fair":return"text-signal-fair";case"weak":return"text-signal-poor";case"poor":return"text-signal-critical";default:return"text-text-muted"}}(t),d=r(u,a);switch(t){case"excellent":return n.jsx(c,{className:d});case"good":return n.jsx(s,{className:d});case"fair":return n.jsx(o,{className:d});case"weak":return n.jsx(i,{className:d});default:return n.jsx(l,{className:d})}}const F=a.memo(function({rssi:e,snr:a,compact:t=!1,showValues:s=!0,radioConfig:i,nfPenalty:o=0}){const l=void 0!==a?function(e,n,a,r=0){const t=E(n,e,a,r);return t?function(e){switch(e){case"excellent":return"excellent";case"good":return"good";case"fair":return"fair";case"poor":return"weak";case"critical":return"poor"}}(t.finalGrade):T(e)}(e,a,i,o):T(e),c={excellent:4,good:3,fair:2,weak:1,poor:0}[l];return t?n.jsxs("div",{className:"flex items-center gap-1.5",children:[s&&n.jsx("span",{className:"text-[10px] font-mono text-text-secondary tabular-nums w-[32px] text-left",children:e}),n.jsx("div",{className:"flex items-end gap-[2px] h-3 w-[14px]",children:Array.from({length:4}).map((e,a)=>n.jsx("div",{className:r("w-[3px] rounded-[1px] transition-colors",R(an.jsx("div",{className:r("w-[3px] rounded-[1px] transition-colors",R(a((e,t,a)=>t in e?s(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a)(e,"symbol"!=typeof t?t+"":t,a);import{a as n,j as r}from"./vendor-react-DCIF8YoJ.js";import{aN as l,aO as i,aP as o,az as c,c as C,aQ as A,aR as D,aS as B,al as F,aT as E,z as m,F as d,aU as u,aV as h,aW as x,aB as p,aX as g,aY as f,aC as y,f as b,j as v,h as j,u as k,r as N,v as w,k as M,t as S,aZ as T,n as R,a_ as P,a$ as $,R as L}from"./index-BGs2yNOg.js";import{u as z}from"./usePolling-DIhP09j-.js";import{b as H,c as _,a as O,d as I,e as W,f as V,s as q}from"./useThemeColors-CGx-Jxyf.js";import{L as G,H as X,R as K}from"./route-DRIRJjaN.js";import{R as Y,x as U,L as Q,C as Z,X as J,Y as ee,T as te,u as se}from"./recharts-DVj1EL-m.js";import{C as ae}from"./compass-DMvXEtHv.js";import{E as ne,T as re}from"./TimeRangeSelector-DUE1rBOu.js";import{a as le,P as ie,b as oe}from"./PageLayout-DIXn4UXM.js";import{D as ce}from"./DataBox-nCNZLfvU.js";import{C as Ce}from"./CollisionExplorerModal-CyK7TMsS.js";import{C as Ae,a as De}from"./Card-CPlTPCY8.js";import{I as Be}from"./info-HmV1qkUD.js";import{T as Fe}from"./triangle-alert-2-1YN-Am.js";import{G as Ee}from"./git-branch-Sfdze11O.js";import{R as me,C as de}from"./Grid-DkfcBkoo.js";import{N as ue}from"./network-DpalqfB8.js";import"./deckgl-DTsmDcfs.js";import"./vendor-core-Dl9MTgSr.js";import"./check-qb29v-su.js";import"./BasemapLayer-g9CXC1Ky.js";import"./maplibre-gl-Bk5DsYkB.js";import"./map-pin-x5eP-WEg.js";const he={acton:{discrete:["#260D40","#2B1345","#2F194B","#342152","#382657","#3C2C5C","#403261","#443766","#483E6C","#4C4371","#504876","#544D7B","#57527F","#5D5884","#625C88","#685F8A","#6E618C","#74628D","#7B638D","#81638E","#88648E","#8E648E","#95658F","#9D658F","#A4668F","#AB6690","#B26790","#BB6992","#C26B94","#C86F97","#CD749B","#D07AA0","#D382A7","#D688AC","#D88FB2","#D995B8","#DB9CBD","#DEA4C4","#DFABC9","#E1B1CE","#E3B7D3","#E5BED8","#E6C5DE","#E8CBE2","#E9D0E6","#EBD6EA","#ECDBEE","#EDE1F3","#EFE6F6","#F0EAFA"],categorical:["#260D40","#F0EAFA","#A76690","#DDA1C2","#585380","#7D638E","#E8CAE1","#CF789E","#403261","#4C4371","#ECDBEE","#69608B","#E3B6D2","#D78CB0","#91648F","#BE6A92","#342152","#EAD3E8","#524B79","#73628D","#463A69","#605B86","#E5C0DA","#D382A7","#C86F97","#86648E","#EEE3F4","#DA97B9","#9B658F","#B26790","#2D1749","#E0ACCA","#3A2959","#8B648E","#311C4D","#EBD7EB","#EDDFF1","#AC6790","#A1668F","#6E618C","#E6C5DE","#78628D","#433665","#DEA7C6","#81638E","#554F7C","#B86891","#3D2D5D","#4F4775","#EFE7F7","#E9CEE4","#D27DA3","#2A1244","#655D89","#C36C94","#E1B1CE","#493F6D","#5C5783","#CC739A","#DB9CBD","#D892B4","#D587AB","#96658F","#E4BBD6","#362455","#4E4573","#7F638E","#D37FA5","#E1AECC","#382657","#EBD9ED","#DFA9C8","#A4668F","#8E648E","#99658F","#675F8A","#B56891","#BB6992","#E5BED8","#E2B4D0","#D07AA0","#71618C","#E6C2DC","#AA6690","#625C88","#EDE1F3","#E8CCE3","#AF6790","#CA7199","#C16B93","#453867","#57517E","#84638E","#4B416F","#E7C7DF","#423463","#514977","#3E2F5F","#544D7B","#93658F"]},bam:{discrete:["#65024B","#701057","#7B1B61","#88276E","#923078","#9B3881","#A4418A","#AC4993","#B5549C","#BC5CA3","#C266AB","#C970B2","#CF7AB9","#D587C1","#DA93C8","#DF9ECE","#E3AAD4","#E7B5DA","#EBC2E0","#EECCE5","#F1D5E9","#F3DDED","#F5E4F0","#F6EBF1","#F6EFF1","#F5F2F0","#F3F3ED","#EFF3E6","#EBF1DF","#E5EFD5","#DDEBCA","#D4E6BD","#C8DEAB","#BCD79B","#B0CE8C","#A3C67D","#97BC6F","#88B161","#7CA856","#72A04D","#679845","#5E903D","#538735","#4B7F2E","#427827","#397021","#306819","#245D10","#195507","#0D4C00"],categorical:["#65024B","#701057","#7B1B61","#88276E","#923078","#9B3881","#A4418A","#AC4993","#B5549C","#BC5CA3","#C266AB","#C970B2","#CF7AB9","#D587C1","#DA93C8","#DF9ECE","#E3AAD4","#E7B5DA","#EBC2E0","#EECCE5","#F1D5E9","#F3DDED","#F5E4F0","#F6EBF1","#F6EFF1","#F5F2F0","#F3F3ED","#EFF3E6","#EBF1DF","#E5EFD5","#DDEBCA","#D4E6BD","#C8DEAB","#BCD79B","#B0CE8C","#A3C67D","#97BC6F","#88B161","#7CA856","#72A04D","#679845","#5E903D","#538735","#4B7F2E","#427827","#397021","#306819","#245D10","#195507","#0D4C00"]},bamako:{discrete:["#003B47","#023C46","#053E45","#083F43","#0A4141","#0D4340","#0F443E","#12463C","#16483A","#194A38","#1C4D36","#204F34","#235132","#28542F","#2C572C","#305A2A","#355C27","#395F24","#3F6321","#44661E","#49691A","#4E6D17","#537014","#5A7410","#5F780D","#657C09","#6A7F05","#718302","#788501","#7F8700","#858800","#8C8A00","#948C01","#9B8E04","#A1920B","#A89713","#AE9C1B","#B7A225","#BEA82E","#C5AD37","#CBB341","#D2B84D","#D9BF5B","#DEC567","#E4CA73","#E9D07E","#EFD58A","#F5DB97","#FAE0A3","#FFE5AD"],categorical:["#003B47","#FFE5AD","#61790B","#B4A022","#245231","#406420","#898900","#DDC464","#0F443E","#EFD58A","#CAB23F","#194A38","#748401","#506E16","#9E9108","#315A29","#083F43","#A99815","#948C01","#6A7F05","#BFA930","#7F8700","#14473B","#1E4E35","#F7DD9C","#2A562D","#043D45","#597411","#E6CC77","#385F25","#48691B","#D4BB51","#0B4241","#8F8A00","#44661E","#1B4C37","#547113","#6F8203","#12463D","#998E03","#27542F","#4C6B18","#A4940E","#2E582B","#355C27","#B9A529","#215033","#EAD181","#FBE1A5","#C5AD37","#3C6122","#848800","#063E44","#E2C86E","#D9BF5B","#CFB648","#16493A","#798600","#023C46","#667C08","#5D770E","#0D433F","#AE9C1B","#F3D993","#094042","#A69611","#8C8A00","#053E45","#0C4240","#365E26","#6D8004","#9C8F05","#4A6A1A","#D6BD56","#B19E1F","#F9DFA0","#647B0A","#2F592A","#10453D","#818800","#C7AF3B","#46681C","#0E443F","#265330","#174A39","#335B28","#5B750F","#778501","#5F780D","#E8CF7C","#718302","#F1D78E","#978D02","#F5DB97","#204F34","#AC9A18","#29552E","#A1920B","#B7A225","#033C46"]},bamo:{discrete:["#4F3043","#56304B","#603354","#6D3961","#793F6B","#834675","#8D4E7E","#965587","#A05E91","#A86698","#B06EA0","#B877A7","#BF81AF","#C78DB8","#CD98BE","#D2A3C4","#D6ADC8","#D9B5CB","#DABECC","#DAC3CC","#D9C7CA","#D8CAC8","#D6CBC6","#D4CDC2","#D1CDBE","#CCCDB9","#C6CBB1","#BCC5A4","#B2BE97","#A7B58A","#9CAB7E","#92A174","#889669","#808D62","#79855C","#737D56","#6D7552","#666C4C","#616548","#5C5D45","#575642","#54503F","#50493D","#4D453C","#4B403B","#4A3C3A","#49393A","#49343B","#4A313E","#4E3042"],categorical:["#4F3043","#56304B","#603354","#6D3961","#793F6B","#834675","#8D4E7E","#965587","#A05E91","#A86698","#B06EA0","#B877A7","#BF81AF","#C78DB8","#CD98BE","#D2A3C4","#D6ADC8","#D9B5CB","#DABECC","#DAC3CC","#D9C7CA","#D8CAC8","#D6CBC6","#D4CDC2","#D1CDBE","#CCCDB9","#C6CBB1","#BCC5A4","#B2BE97","#A7B58A","#9CAB7E","#92A174","#889669","#808D62","#79855C","#737D56","#6D7552","#666C4C","#616548","#5C5D45","#575642","#54503F","#50493D","#4D453C","#4B403B","#4A3C3A","#49393A","#49343B","#4A313E","#4E3042"]},batlow:{discrete:["#011959","#06215B","#0A285C","#0D315D","#0E375E","#103D5F","#114260","#124761","#144D62","#165162","#195662","#1C5A62","#205E61","#26635F","#2C665D","#33695A","#3A6C57","#416F53","#4A724E","#52744A","#5A7745","#627941","#6A7B3D","#747E38","#7D8134","#868330","#8F862D","#9B892B","#A58B2C","#AF8D2E","#B98F32","#C29037","#CD923F","#D69446","#DE964F","#E69858","#ED9A62","#F39E70","#F8A17B","#FAA587","#FCA993","#FDAC9E","#FDB1AB","#FDB4B6","#FDB8C0","#FDBCCB","#FCBFD6","#FCC4E3","#FBC8EF","#FACCFA"],categorical:["#011959","#FACCFA","#828231","#226061","#F29D6D","#4D734D","#114360","#C09036","#FDB4B4","#DD954D","#356A59","#FCBFD6","#175262","#677B3E","#A18A2B","#0D315D","#FCA890","#FBC6E8","#2B655E","#B18D2F","#5A7745","#FDAEA2","#CF9340","#0F3B5F","#E9995C","#FDBAC4","#416F53","#91862D","#1B5962","#08255B","#747E38","#134B61","#F9A380","#8A842F","#0E365E","#124761","#154F62","#E39754","#7B8034","#1E5D62","#99882C","#195662","#0B2B5C","#FDB7BC","#C8913B","#FCC3DF","#EE9B64","#A98C2C","#FDB1AB","#FDBCCD","#FBC9F1","#051F5A","#F6A077","#607942","#FDAB9A","#477150","#3B6D56","#B98F32","#26635F","#537549","#D69446","#6D7C3B","#30685C","#103F60","#FBA689","#BD8F34","#CB923E","#EB9A60","#FDB8C0","#FBC7EC","#F09C69","#8E852E","#FDBBC9","#7F8133","#031C5A","#114160","#FDAC9E","#5D7844","#FCA995","#185462","#787F36","#A58B2C","#0A285C","#9D892B","#33695A","#0D335E","#637A40","#165062","#124561","#205E61","#144D62","#1D5B62","#0C2E5D","#D9954A","#3E6E55","#AD8C2D","#F49F72","#868330","#B58E30","#577647"]},batlowk:{discrete:["#04050A","#0A0D15","#0F141E","#121B29","#152233","#18293D","#1C3146","#21384F","#274156","#2C485B","#314E5E","#36535F","#3B575F","#405C5E","#445F5D","#49625B","#4D6558","#526756","#586B52","#5E6E4F","#63724B","#6A7548","#717845","#797D41","#81813E","#8A853B","#938839","#9F8D38","#A99139","#B3943B","#BE973E","#C89A43","#D39D4C","#DB9F54","#E2A15D","#E8A366","#EEA570","#F3A77C","#F6A986","#F8AC91","#FAAE9A","#FCB1A4","#FDB4B0","#FDB7B9","#FDBAC3","#FDBDCD","#FDC1D8","#FCC5E4","#FBC8EF","#FACCFA"],categorical:["#04050A","#FDC0D6","#787C41","#38555F","#E5A160","#536855","#AF933A","#FAAE9A","#1A2E43","#FDB6B7","#294458","#455F5C","#63724B","#CD9B47","#91883A","#F3A77E","#111A27","#F7AB8D","#FDBBC5","#FCB2AA","#D99E52","#A18E38","#4C6459","#21384F","#3F5B5E","#152335","#0C1019","#EEA570","#5B6D50","#6C7647","#314E5E","#85823D","#BE973E","#7E7F3F","#FBB0A2","#49625B","#576A53","#0F151F","#2D495B","#DFA059","#727944","#FDBDCD","#253E54","#EAA368","#C69942","#3C585F","#998B38","#677449","#F1A678","#F9AC92","#141F2F","#1D3248","#506657","#090C13","#A99139","#5F6F4E","#35525F","#435D5D","#FDB8BD","#F5A984","#B5953B","#FDB5B2","#17273B","#D39D4C","#8C853B","#9D8C38","#415C5E","#1F354B","#33505E","#FCB1A6","#101723","#3E595F","#121C2B","#757B43","#06080F","#FCB3AE","#3A565F","#274156","#61704D","#88843C","#2B475A","#FDBED1","#6A7548","#596C51","#192B3F","#6F7845","#233B51","#C99A45","#F0A574","#DC9F55","#2F4B5D","#47615C","#F6AA88","#FDB9C1","#C29840","#4A635A","#FAAD96","#81813E","#7B7E40","#E7A264"]},batloww:{discrete:["#011959","#06215B","#0A285C","#0D315D","#0E375E","#103D5F","#114260","#124761","#144C62","#165062","#185562","#1B5962","#1F5D62","#246261","#2A665F","#30695D","#366C5A","#3D7056","#467352","#4E764E","#56794A","#5E7C46","#667F42","#70823D","#798539","#828936","#8C8C33","#989032","#A29433","#AD9738","#B79B3F","#C19E48","#CBA154","#D3A45E","#D9A669","#DFA872","#E4AA7C","#E9AC88","#EEAF91","#F2B39C","#F6B9A8","#F9C0B5","#FCCAC4","#FED3CF","#FFDBDA","#FFE3E2","#FFEAEA","#FFF2F2","#FFF8F8","#FFFEFE"],categorical:["#FFFEFE","#011959","#7E8737","#205F61","#E7AB84","#497451","#114360","#FED1CD","#BF9D46","#637E44","#9E9233","#FFEAEA","#0D315D","#326B5C","#F5B7A6","#165162","#D7A564","#0F3B5F","#1A5862","#3D7056","#FFF5F5","#FFDFDD","#FAC3BA","#134A61","#08255B","#70823D","#EEB094","#56794A","#E0A874","#8E8D33","#28655F","#AF9839","#CBA154","#EBAD8B","#1D5C62","#051F5A","#124761","#FFE5E4","#B79B3F","#A79535","#386D59","#5C7B47","#185562","#DBA76D","#F8BDAF","#FFF0F0","#246261","#F2B39C","#868A35","#4F774D","#E4AA7C","#2D685E","#77853A","#FED8D6","#103F60","#FFFAF9","#968F32","#D1A35C","#144E62","#FCCAC4","#437254","#698040","#0E365E","#0B2B5C","#C59F4C","#30695D","#1C5A62","#A29433","#407155","#FFDBDA","#0C2E5D","#F7BAAA","#E5AB80","#175362","#828936","#1F5D62","#BB9C42","#E9AC88","#FFF7F7","#3A6E58","#9A9132","#8A8B34","#4C754F","#FFEDED","#D9A669","#144C62","#266460","#FDCDC9","#FCC6BF","#FFE2E1","#FFFCFC","#7B8639","#2B675E","#155062","#5F7C45","#F9C0B5","#356C5A","#F3B5A1","#EDAF8F","#FED5D2"]},berlin:{discrete:["#9EB0FF","#93AFFA","#87ADF4","#79ABED","#6CA9E6","#60A5DF","#54A0D5","#489ACA","#3E90BC","#3787AF","#327EA3","#2D7597","#296B8B","#25607C","#225771","#1E4E65","#1B465A","#183D4F","#153342","#122C38","#11242E","#101D25","#11181C","#121214","#160E0D","#1B0B07","#210B03","#270D01","#2D0E00","#340F00","#3B1100","#421301","#4B1602","#541905","#5D1E09","#68240F","#732B16","#803620","#8A3F2A","#944834","#9E513F","#A85A4A","#B46658","#BE6F63","#C8796F","#D2837A","#DD8D86","#EA9995","#F4A3A1","#FFADAD"],categorical:["#9EB0FF","#93AFFA","#87ADF4","#79ABED","#6CA9E6","#60A5DF","#54A0D5","#489ACA","#3E90BC","#3787AF","#327EA3","#2D7597","#296B8B","#25607C","#225771","#1E4E65","#1B465A","#183D4F","#153342","#122C38","#11242E","#101D25","#11181C","#121214","#160E0D","#1B0B07","#210B03","#270D01","#2D0E00","#340F00","#3B1100","#421301","#4B1602","#541905","#5D1E09","#68240F","#732B16","#803620","#8A3F2A","#944834","#9E513F","#A85A4A","#B46658","#BE6F63","#C8796F","#D2837A","#DD8D86","#EA9995","#F4A3A1","#FFADAD"]},bilbao:{discrete:["#4C0001","#54070B","#5B0E13","#64161A","#6B1D20","#712227","#77282D","#7D2E34","#84343B","#8A3A41","#8F4047","#94464B","#984C4F","#9B5253","#9D5754","#9E5C56","#A06057","#A16458","#A26959","#A36D5A","#A4715B","#A5745B","#A6785C","#A77C5D","#A8805E","#A9845F","#AA875F","#AC8C60","#AD9061","#AE9463","#AF9864","#B19D68","#B3A36E","#B6A975","#B8AD7E","#BBB287","#BDB590","#C0B99A","#C2BCA3","#C4BFAA","#C6C2B2","#C8C5B9","#CBCAC1","#CFCEC9","#D5D4D1","#DBDBDA","#E3E3E2","#EDEDED","#F6F6F6","#FFFFFF"],categorical:["#4C0001","#F8F8F8","#A9815E","#984D50","#BEB794","#AF9965","#CCCAC3","#78292F","#A26A59","#9F5D56","#64161A","#B6AA77","#C4C0AC","#A6765C","#8A3A41","#AC8C60","#DDDDDB","#A16358","#C7C5B7","#B3A16B","#A4705A","#6E2024","#EAEAE9","#92434A","#BAB185","#9C5554","#AD9262","#580B10","#813137","#C1BCA1","#AA865F","#D2D2CE","#A77C5D","#D7D7D4","#BCB48D","#B4A571","#C0B99A","#9E5955","#AB8960","#A6795C","#A36D5A","#8E3F46","#85353C","#A16758","#732529","#CAC7BD","#F1F1F0","#520509","#AC8F61","#5E1115","#C6C2B2","#E3E3E2","#691B1F","#B8AD7E","#95484D","#AE9663","#B19D68","#A5735B","#A06057","#9A5152","#A87E5D","#7D2E34","#A9835E","#C3BEA6","#CFCEC9","#A46E5A","#F4F4F4","#DADAD8","#B29F69","#EDEDED","#BBB289","#9D5754","#AF9764","#904148","#994F51","#B3A36E","#A87F5E","#A26859","#AC8D61","#BDB590","#AA875F","#A77A5D","#AB8A60","#A4715B","#611418","#BFB897","#E6E6E6","#9B5353","#D5D4D1","#974A4F","#C8C6BA","#A16558","#9F5E56","#76272C","#67191D","#8C3C43","#B9AF82","#C3BFA9","#B5A874","#4F0205"]},broc:{discrete:["#2C1A4C","#2B2154","#2B295B","#2A3164","#29396C","#284174","#29497C","#2A5183","#305C8C","#376593","#416D9A","#4B76A0","#567FA6","#6489AD","#6F92B3","#7B9BBA","#86A3C0","#92ACC6","#A0B7CD","#ACC0D3","#B8C9DA","#C4D2E0","#D0DBE6","#DEE5EC","#E7ECED","#EDEFE9","#EDEEE1","#E9E9D4","#E4E4C8","#DEDEBD","#D8D8B1","#D2D2A5","#C9C996","#C1C18A","#B8B87E","#AEAE73","#A3A369","#97975E","#8D8D56","#83834D","#797945","#70703D","#646434","#5B5B2C","#525224","#49491D","#404016","#36360F","#2E2E08","#262600"],categorical:["#2C1A4C","#2B2154","#2B295B","#2A3164","#29396C","#284174","#29497C","#2A5183","#305C8C","#376593","#416D9A","#4B76A0","#567FA6","#6489AD","#6F92B3","#7B9BBA","#86A3C0","#92ACC6","#A0B7CD","#ACC0D3","#B8C9DA","#C4D2E0","#D0DBE6","#DEE5EC","#E7ECED","#EDEFE9","#EDEEE1","#E9E9D4","#E4E4C8","#DEDEBD","#D8D8B1","#D2D2A5","#C9C996","#C1C18A","#B8B87E","#AEAE73","#A3A369","#97975E","#8D8D56","#83834D","#797945","#70703D","#646434","#5B5B2C","#525224","#49491D","#404016","#36360F","#2E2E08","#262600"]},broco:{discrete:["#372F38","#36303D","#363144","#36354E","#363957","#373F60","#39456A","#3C4D75","#415780","#47608A","#4D6992","#55729A","#5D7BA2","#6886AA","#728FB1","#7C97B7","#86A0BD","#91A8C2","#9DB2C8","#A7BACC","#B1C1CE","#BAC8D0","#C2CDD0","#CAD1CD","#CED3C8","#CFD3C2","#CFD1B9","#CBCCAD","#C6C6A2","#BFBF96","#B8B78B","#AFAF7F","#A4A472","#9B9A68","#91915E","#888755","#7E7E4C","#737243","#6B693D","#626137","#5B5932","#54512E","#4C482B","#474229","#423D29","#3F3829","#3C352B","#39322E","#383032","#372F37"],categorical:["#372F38","#36303D","#363144","#36354E","#363957","#373F60","#39456A","#3C4D75","#415780","#47608A","#4D6992","#55729A","#5D7BA2","#6886AA","#728FB1","#7C97B7","#86A0BD","#91A8C2","#9DB2C8","#A7BACC","#B1C1CE","#BAC8D0","#C2CDD0","#CAD1CD","#CED3C8","#CFD3C2","#CFD1B9","#CBCCAD","#C6C6A2","#BFBF96","#B8B78B","#AFAF7F","#A4A472","#9B9A68","#91915E","#888755","#7E7E4C","#737243","#6B693D","#626137","#5B5932","#54512E","#4C482B","#474229","#423D29","#3F3829","#3C352B","#39322E","#383032","#372F37"]},buda:{discrete:["#B301B3","#B30BAE","#B314AA","#B31CA6","#B323A2","#B3289F","#B32E9D","#B4339A","#B53998","#B63E96","#B84394","#B94892","#BB4C91","#BD528F","#BE568D","#C05B8C","#C15F8A","#C36389","#C46987","#C66D86","#C77184","#C97583","#CA7982","#CB7E80","#CD837F","#CE877E","#CF8B7D","#D0917B","#D1957A","#D29979","#D49E78","#D5A277","#D6A776","#D7AC75","#D8B073","#D9B572","#DAB971","#DCBF70","#DDC36F","#DEC86E","#DFCC6C","#E0D16B","#E2D76A","#E4DC69","#E6E168","#E9E667","#EDEC67","#F3F366","#F9F966","#FFFF66"],categorical:["#B301B3","#FFFF66","#CD857E","#BC4E90","#DBBD70","#C56A87","#B32F9C","#E3DB69","#D4A177","#EDEC67","#D1937B","#B73F95","#C05C8B","#DFCB6D","#C97882","#B31CA6","#D8AE74","#E7E368","#DAB572","#B311AC","#D39A79","#C36389","#C77184","#B53798","#E1D36B","#BE558E","#B94793","#CB7E80","#CF8C7C","#DDC46E","#B326A0","#F6F566","#D6A875","#DAB971","#C66E86","#E2D76A","#B32B9E","#B317A9","#B4339A","#BA4B91","#C46788","#C2608A","#B309AF","#D49E78","#B63B97","#BD528F","#DCC06F","#EAE767","#FAFA66","#D2977A","#F1F066","#D0907C","#CE897D","#C87483","#CC827F","#D5A576","#B321A3","#E5DF68","#B84394","#D9B273","#E0CF6C","#CA7B81","#DEC86E","#BF598C","#D7AB75","#E6E168","#D1957A","#CC8080","#D39C78","#E0CD6C","#CD847F","#B63D96","#C87384","#C66C86","#F8F866","#D49F78","#D9B473","#DAB772","#BF578D","#CB7D81","#CF8A7D","#B32D9D","#D08E7C","#DBBB71","#C2628A","#E2D56A","#DCBF70","#BC508F","#C46987","#C05B8C","#DFCA6D","#DDC26F","#C15E8B","#D7AD74","#F3F366","#DEC66E","#D5A377","#B31AA7","#BA4992","#CE877E"]},bukavu:{discrete:["#1A3333","#1B373D","#1C3C47","#1E4255","#1F4762","#214E71","#235582","#255E92","#2969A1","#2C73AD","#2F7CB8","#3485C2","#3B8EC7","#4799C8","#50A1C9","#59AAC9","#62B2CA","#6BBACB","#76C3CB","#81CCCD","#92D5D1","#A4DED5","#B6E7DA","#CCF2DF","#DDFBE3","#034224","#08491F","#115119","#1C5914","#2B6212","#3D6915","#4E6E1B","#617224","#6F742B","#7B7631","#867836","#917B3C","#9E7E45","#AA844F","#B48D5D","#BC976C","#C3A27C","#CAB08F","#CFBBA0","#D5C6B0","#DACFC1","#DFD7D0","#E4DFE0","#E9E6ED","#EDEDFC"],categorical:["#1A3333","#1B373D","#1C3C47","#1E4255","#1F4762","#214E71","#235582","#255E92","#2969A1","#2C73AD","#2F7CB8","#3485C2","#3B8EC7","#4799C8","#50A1C9","#59AAC9","#62B2CA","#6BBACB","#76C3CB","#81CCCD","#92D5D1","#A4DED5","#B6E7DA","#CCF2DF","#DDFBE3","#034224","#08491F","#115119","#1C5914","#2B6212","#3D6915","#4E6E1B","#617224","#6F742B","#7B7631","#867836","#917B3C","#9E7E45","#AA844F","#B48D5D","#BC976C","#C3A27C","#CAB08F","#CFBBA0","#D5C6B0","#DACFC1","#DFD7D0","#E4DFE0","#E9E6ED","#EDEDFC"]},cork:{discrete:["#2C194C","#2B2254","#2B295C","#2A3265","#293A6D","#284275","#284A7C","#2A5284","#2F5C8D","#366493","#3F6C99","#49749F","#527CA4","#5E85AA","#688DB0","#7395B6","#7E9DBB","#8AA6C2","#99B1C9","#A5BBD0","#B2C5D7","#C0CFDE","#CDD9E5","#DCE5EB","#E5ECED","#E6EEEA","#E0EAE1","#D4E2D4","#C8DBC8","#BCD3BC","#B0CAB0","#A4C2A3","#95B895","#89B088","#7DA87D","#71A071","#669966","#599059","#4F894E","#458244","#3B7B3A","#317430","#266A25","#1F611D","#1A5816","#174E12","#14450E","#123A0A","#103107","#0F2903"],categorical:["#2C194C","#2B2254","#2B295C","#2A3265","#293A6D","#284275","#284A7C","#2A5284","#2F5C8D","#366493","#3F6C99","#49749F","#527CA4","#5E85AA","#688DB0","#7395B6","#7E9DBB","#8AA6C2","#99B1C9","#A5BBD0","#B2C5D7","#C0CFDE","#CDD9E5","#DCE5EB","#E5ECED","#E6EEEA","#E0EAE1","#D4E2D4","#C8DBC8","#BCD3BC","#B0CAB0","#A4C2A3","#95B895","#89B088","#7DA87D","#71A071","#669966","#599059","#4F894E","#458244","#3B7B3A","#317430","#266A25","#1F611D","#1A5816","#174E12","#14450E","#123A0A","#103107","#0F2903"]},corko:{discrete:["#3F3E3A","#3E3D3F","#3E3D44","#3E3D4B","#3E3F52","#3E425A","#3F4762","#414C6C","#445578","#485D82","#4E658B","#546E94","#5C779C","#6581A5","#6E8AAC","#7792B2","#809BB8","#89A3BD","#94ACC2","#9CB3C5","#A3BAC7","#A9C0C8","#AEC5C7","#B0C9C4","#B0CABF","#ADCAB9","#A9C9B2","#A2C5A8","#9BC19F","#93BC95","#8BB68B","#82B081","#78A775","#709F6A","#689760","#608E56","#5A864C","#537B42","#4F733B","#4B6B35","#486431","#465D2E","#44562C","#43512C","#424D2D","#42492E","#414630","#404333","#404036","#3F3E3A"],categorical:["#3F3E3A","#3E3D3F","#3E3D44","#3E3D4B","#3E3F52","#3E425A","#3F4762","#414C6C","#445578","#485D82","#4E658B","#546E94","#5C779C","#6581A5","#6E8AAC","#7792B2","#809BB8","#89A3BD","#94ACC2","#9CB3C5","#A3BAC7","#A9C0C8","#AEC5C7","#B0C9C4","#B0CABF","#ADCAB9","#A9C9B2","#A2C5A8","#9BC19F","#93BC95","#8BB68B","#82B081","#78A775","#709F6A","#689760","#608E56","#5A864C","#537B42","#4F733B","#4B6B35","#486431","#465D2E","#44562C","#43512C","#424D2D","#42492E","#414630","#404333","#404036","#3F3E3A"]},davos:{discrete:["#00054A","#010E51","#041459","#081C61","#0C2368","#102A6F","#133075","#17377C","#1C3F83","#204588","#244C8D","#295291","#2D5895","#335F98","#38649A","#3C699C","#416E9D","#46729D","#4C779D","#517B9C","#567F9B","#5A829A","#5F8598","#658996","#698C94","#6E8F92","#739290","#78968D","#7D998C","#829D8A","#88A089","#8DA488","#95AA87","#9BAF88","#A3B489","#ABBB8C","#B4C190","#BFCA96","#C9D29E","#D2D9A6","#DBE0AF","#E3E7B8","#EBEDC4","#F0F1CD","#F4F4D6","#F7F7DE","#FAF9E6","#FCFCF0","#FDFDF7","#FEFEFE"],categorical:["#00054A","#FDFDF4","#688B94","#2D5895","#B2C08F","#E8EBC0","#87A089","#133075","#4B769D","#5A829A","#204588","#76958E","#D0D8A4","#99AD88","#F6F6DB","#3C699C","#081C61","#031256","#1A3B7F","#537C9C","#A4B68A","#C1CC98","#7E9A8B","#FAFAE8","#356199","#0E266B","#DEE3B3","#274F90","#6F9091","#618697","#8FA588","#F0F1CD","#43709D","#1D4084","#47739D","#F3F4D4","#658996","#567F9B","#17367A","#FCFBEE","#4F799D","#C9D29E","#93A987","#39659B","#D8DEAB","#ABBB8C","#739290","#B9C693","#F8F8E1","#234A8C","#112B70","#7A978D","#9EB188","#315C97","#829D8A","#05175B","#010C50","#3F6C9D","#0B2065","#5D8499","#2A5392","#8BA388","#6B8D93","#EDEFC7","#E3E7B8","#22488A","#638897","#122E73","#00094D","#AEBD8D","#4D789D","#CDD5A1","#5F8598","#58819A","#071A5E","#0C2368","#18387D","#91A787","#37639A","#EBEDC4","#F2F2D0","#FBFBEB","#74938F","#2F5A96","#335F98","#809B8B","#BDC995","#49759D","#719191","#9BAF88","#F7F7DE","#1B3E82","#A8B88B","#849E89","#557E9B","#E6E9BC","#45719D","#1E4386","#96AB87","#89A188"]},devon:{discrete:["#2C1A4C","#2B1E51","#2B2356","#2A295B","#2A2D60","#293265","#29376A","#283B6E","#274174","#27467A","#274C7F","#275186","#28568C","#2A5C95","#2D609C","#3064A3","#3468AA","#396BB1","#3F70B9","#4774C0","#4F79C6","#597DCC","#6382D1","#6F88D7","#798CDB","#8290DF","#8C95E2","#969AE6","#9E9EE9","#A6A3EB","#ACA7ED","#B1ACEF","#B7B1F0","#BBB5F1","#BFB9F2","#C3BEF3","#C7C2F4","#CCC7F4","#D0CCF5","#D4D0F6","#D8D4F7","#DCD9F8","#E1DEF9","#E5E3FA","#E9E7FB","#EDECFB","#F2F0FC","#F7F6FD","#FBFAFE","#FFFFFF"],categorical:["#2C1A4C","#F8F8FE","#758AD9","#C6C0F3","#28568C","#29376A","#AAA5ED","#DEDCF8","#3D6EB7","#EBE9FB","#9197E4","#3063A2","#274579","#577CCB","#D2CEF6","#2A285A","#BAB3F1","#B2ADEF","#F2F0FC","#274E82","#2A2F62","#CCC7F4","#9E9EE9","#4875C1","#C0BAF2","#2B5D98","#3669AD","#2B2154","#E4E2FA","#8290DF","#D8D4F7","#6784D3","#283E71","#C9C4F4","#BDB7F1","#DBD8F8","#283A6D","#4F79C6","#A4A2EB","#EEEDFC","#CFCBF5","#E8E5FA","#5F80CF","#4272BC","#B6B0F0","#2B1D50","#AEA9EE","#275287","#2A2B5E","#989BE7","#293366","#27497D","#8A94E1","#295A92","#3266A7","#F5F4FD","#7B8DDC","#274174","#2D609C","#2B2558","#6F88D7","#E1DEF9","#3A6CB2","#D5D1F6","#C3BEF3","#2E629F","#3165A4","#8D95E3","#3468AA","#DAD6F7","#D1CDF5","#9B9CE8","#275084","#B8B2F0","#27477B","#6382D1","#4573BF","#A2A0EA","#F7F6FD","#C7C2F4","#F3F2FD","#274376","#8692E0","#2B1F52","#CAC6F4","#ACA7ED","#E3E0F9","#F0EEFC","#E6E4FA","#386AB0","#2C1C4E","#6B86D5","#28396B","#283C6F","#2A5C95","#2A2D60","#BEB9F2","#C2BCF2","#7E8FDD","#3F70B9"]},fes:{discrete:["#0D0D0D","#181818","#212121","#2B2B2B","#343434","#3C3C3C","#454545","#4D4D4D","#565656","#5E5E5E","#656565","#6D6D6D","#747474","#7C7C7C","#848484","#8B8B8B","#939393","#9C9C9C","#A7A7A7","#B1B1B1","#BBBBBB","#C5C5C5","#D1D1D1","#DFDFDF","#ECECEC","#094225","#184822","#2B4F20","#3A5420","#485822","#555B24","#615E26","#6F6229","#7A652B","#86682E","#926B30","#9F7035","#AD7940","#B6834D","#BD8E5C","#C2996C","#C6A47C","#CCB18F","#D1BCA0","#D5C6B0","#DACFC1","#DFD7CF","#E4DFE0","#E8E6ED","#EDEDFC"],categorical:["#0D0D0D","#181818","#212121","#2B2B2B","#343434","#3C3C3C","#454545","#4D4D4D","#565656","#5E5E5E","#656565","#6D6D6D","#747474","#7C7C7C","#848484","#8B8B8B","#939393","#9C9C9C","#A7A7A7","#B1B1B1","#BBBBBB","#C5C5C5","#D1D1D1","#DFDFDF","#ECECEC","#094225","#184822","#2B4F20","#3A5420","#485822","#555B24","#615E26","#6F6229","#7A652B","#86682E","#926B30","#9F7035","#AD7940","#B6834D","#BD8E5C","#C2996C","#C6A47C","#CCB18F","#D1BCA0","#D5C6B0","#DACFC1","#DFD7CF","#E4DFE0","#E8E6ED","#EDEDFC"]},glasgow:{discrete:["#361338","#3B1434","#401530","#45172C","#491828","#4D1924","#511B21","#561C1D","#5B1E18","#602014","#662210","#6B260B","#6F2B07","#723203","#743802","#743E01","#754300","#744900","#744F01","#745402","#735905","#725F0B","#716413","#70691E","#6E6E27","#6C7231","#6B763A","#697B46","#677F4F","#658359","#648763","#628B6C","#618F78","#609381","#60978A","#619B94","#659F9D","#6CA5A8","#74A9B0","#7DADB8","#86B1BF","#8EB4C6","#99B9CE","#A1BCD5","#AABFDB","#B2C3E1","#BBC6E7","#C6CBF0","#D0CFF7","#DBD3FF"],categorical:["#361338","#DBD3FF","#6D702B","#69A3A5","#702D06","#A0BBD3","#638968","#521B20","#745101","#84B0BE","#754001","#5F9587","#BBC6E7","#612013","#45172C","#687D4A","#726210","#618F78","#4B1926","#3E1532","#629C96","#658359","#CACCF3","#76AAB2","#6B763A","#744900","#6A250C","#ADC1DD","#735905","#92B6C9","#591D1A","#743702","#70681C","#4F1A23","#754400","#6D2909","#60998E","#41162F","#744D00","#745503","#B4C3E2","#697A42","#7DADB8","#628C70","#8BB3C3","#561C1D","#D2D0F9","#99B9CE","#3A1435","#6F6C23","#743B01","#60927F","#662210","#648661","#659F9D","#678051","#725E0A","#481829","#6FA6AB","#6C7332","#5D1E17","#A6BED8","#C2C9ED","#723203","#716617","#68240E","#6F6A20","#C6CBF0","#79ABB5","#72600D","#754200","#43162D","#67A1A1","#6B7536","#5F1F15","#735B07","#571C1B","#72A8AF","#744F01","#BEC8EA","#381337","#8EB4C6","#628B6C","#677E4D","#60917B","#639E9A","#4A1827","#A3BDD6","#3C1433","#743901","#632112","#B7C5E5","#4D1924","#65845D","#618E74","#609483","#9CBAD1","#46172A","#87B1C1","#6D712F"]},grayc:{discrete:["#000000","#090909","#111111","#171717","#1C1C1C","#212121","#252525","#2A2A2A","#303030","#343434","#393939","#3D3D3D","#424242","#474747","#4B4B4B","#505050","#545454","#585858","#5D5D5D","#616161","#656565","#696969","#6D6D6D","#717171","#757575","#797979","#7D7D7D","#818181","#858585","#898989","#8E8E8E","#929292","#979797","#9C9C9C","#A1A1A1","#A6A6A6","#ABABAB","#B1B1B1","#B6B6B6","#BCBCBC","#C1C1C1","#C7C7C7","#CECECE","#D5D5D5","#DBDBDB","#E2E2E2","#E8E8E8","#F1F1F1","#F8F8F8","#FFFFFF"],categorical:["#070707","#F9F9F9","#777777","#454545","#AEAEAE","#909090","#292929","#5F5F5F","#D1D1D1","#9E9E9E","#525252","#E4E4E4","#6C6C6C","#BFBFBF","#1A1A1A","#373737","#848484","#595959","#222222","#B6B6B6","#A6A6A6","#3E3E3E","#7D7D7D","#666666","#969696","#8A8A8A","#4B4B4B","#DADADA","#C8C8C8","#313131","#717171","#131313","#EFEFEF","#C4C4C4","#A2A2A2","#424242","#878787","#252525","#2D2D2D","#4F4F4F","#3B3B3B","#808080","#1E1E1E","#BBBBBB","#AAAAAA","#EAEAEA","#696969","#7A7A7A","#DFDFDF","#636363","#565656","#B2B2B2","#0E0E0E","#9A9A9A","#5C5C5C","#747474","#F3F3F3","#333333","#6E6E6E","#D5D5D5","#8D8D8D","#939393","#494949","#CCCCCC","#171717","#BDBDBD","#575757","#C1C1C1","#404040","#828282","#E2E2E2","#151515","#1C1C1C","#0B0B0B","#9C9C9C","#858585","#2F2F2F","#B4B4B4","#888888","#242424","#272727","#3C3C3C","#B0B0B0","#353535","#545454","#5B5B5B","#393939","#D7D7D7","#A4A4A4","#A8A8A8","#959595","#767676","#646464","#989898","#444444","#474747","#111111","#F6F6F6","#ECECEC","#4D4D4D"]},hawaii:{discrete:["#8C0273","#8E0D6E","#8F1569","#901D63","#91235F","#91285A","#922D56","#933252","#94384D","#943D4A","#954246","#964742","#964C3F","#97523B","#985638","#985C34","#996131","#9A662E","#9B6C2A","#9B7226","#9C7823","#9C7E20","#9D841E","#9D8C1C","#9C921C","#9B991D","#9AA021","#97A828","#94AE30","#91B439","#8CB942","#88BE4C","#82C359","#7EC663","#79CA6E","#74CE79","#70D183","#6AD591","#66D89C","#62DCA7","#60DFB2","#5FE2BD","#61E6CA","#67E9D5","#6FEBDE","#7AEEE7","#87EFEE","#98F1F5","#A6F1F9","#B3F2FD"],categorical:["#8C0273","#B3F2FD","#9C951C","#6CD48C","#964D3E","#8ABC48","#9B6D29","#66E8D3","#922E55","#9C801F","#87EFEE","#995D34","#7BC969","#901D63","#60DEB0","#96AA2B","#943D4A","#975439","#82C359","#5FE4C2","#9AA021","#73CE7B","#65D99E","#954544","#9D8A1C","#8E126B","#91B439","#9DF1F7","#73ECE2","#91265C","#9C7724","#9A652E","#93364F","#922A59","#996131","#9D851D","#9D901C","#9A692C","#68D695","#902160","#9B9A1E","#985836","#9B7226","#933252","#77CC72","#9C7B21","#954147","#8D0A6F","#93AF32","#62DCA7","#92F0F3","#8F1867","#7DEEE8","#97513C","#6CEBDB","#61E6CA","#A8F2FA","#964941","#7FC661","#86BF50","#98A526","#70D183","#5FE1B9","#8DB840","#94394D","#9C7923","#8F1569","#985A35","#60E0B4","#9A6B2A","#91245E","#97A828","#9B7425","#6AD591","#95AD2E","#5FE2BD","#60E5C6","#953F48","#933054","#63E7CF","#84C154","#8D0671","#82EFEB","#9B9D1F","#99A323","#88BE4C","#6ED288","#6FEBDE","#9A672D","#91285A","#75CD76","#995F32","#68E9D7","#9B7028","#61DDAB","#943B4B","#933450","#8DF0F0","#8F1A65","#81C45D"]},imola:{discrete:["#1A33B3","#1C37B1","#1E3AAF","#203EAD","#2242AB","#2345AA","#2548A8","#274CA6","#2950A4","#2A53A3","#2C56A1","#2E599F","#2F5D9E","#32609B","#346499","#366797","#386A95","#3B6C92","#3E708F","#41738C","#44768A","#467987","#4A7C85","#4E8082","#518480","#56887E","#5A8C7D","#5F927B","#64967A","#689B79","#6DA078","#72A576","#78AB75","#7DB074","#82B572","#87BA71","#8CBF70","#93C66E","#98CB6D","#9ED06C","#A4D66A","#ACDB69","#B5E268","#BFE767","#C8EB67","#D3F066","#DDF466","#EAF866","#F5FB66","#FFFF66"],categorical:["#1A33B3","#FFFF66","#54867F","#305E9D","#91C36F","#3F718E","#2549A8","#BDE667","#70A377","#2B53A2","#376896","#80B373","#A3D56B","#DDF466","#203EAD","#487B86","#62947A","#2D59A0","#88BB71","#5B8D7D","#CDED66","#4E8082","#EEF966","#33639A","#284EA5","#44768A","#2344AA","#AFDE69","#3B6C92","#78AB75","#1D39B0","#99CC6D","#699C79","#3D6F90","#2C56A1","#2F5B9E","#5E917B","#4B7D84","#9ED06C","#1F3CAE","#C4EA67","#84B772","#274CA6","#D5F066","#2951A4","#74A776","#578A7E","#2446A9","#1C36B1","#A9D96A","#95C86E","#467888","#2141AC","#7CAF74","#356598","#B5E268","#66987A","#396A94","#F7FC66","#8CBF70","#E6F666","#32609B","#518380","#41738C","#6DA078","#6B9E78","#B9E468","#7AAD74","#528580","#32629B","#86B971","#3C6E91","#5C8F7C","#C8EB67","#ACDB69","#D1EF66","#E2F566","#97CA6D","#1B35B2","#1C37B0","#2345AA","#2F5D9E","#1F3DAE","#457789","#3A6B93","#598B7D","#D9F266","#346499","#386995","#A6D76A","#366797","#274DA6","#56887E","#A1D36B","#42748B","#7EB173","#72A576","#477987","#4C7F83","#F2FB66"]},lajolla:{discrete:["#191900","#1E1B02","#221C05","#271E08","#2C200B","#31220E","#362411","#3C2614","#442817","#4B2B1B","#532D1F","#5B3023","#633328","#6E362D","#783932","#813C37","#8B3F3B","#96423F","#A24543","#AD4746","#B74A48","#C04D49","#C9514B","#D1564C","#D75C4D","#DB634E","#DD694F","#E0714F","#E17750","#E37D50","#E48351","#E58951","#E79052","#E89652","#E99C52","#EAA253","#EBA853","#EDAF54","#EEB555","#F0BC57","#F1C25A","#F3CA5F","#F5D369","#F7DA74","#F9E282","#FBE890","#FCEF9F","#FDF5B0","#FEFABE","#FFFECB"],categorical:["#191900","#FFFECB","#D85F4D","#ECAC54","#653329","#F7D971","#A44544","#E58751","#362411","#E1744F","#C44E4A","#E99A52","#4B2B1B","#833D38","#F1C159","#FCEF9F","#271E08","#FEF7B6","#402716","#D0554C","#FAE587","#E79052","#EFB655","#B54947","#201C04","#E37D50","#743830","#DD694F","#EBA353","#94413E","#572F21","#F4CD61","#2E210C","#FDF3AB","#32220F","#241D06","#F5D369","#7B3B34","#1D1B02","#F0BC57","#5E3125","#F8DF7C","#512D1E","#CA514B","#E48251","#E68C51","#EA9E53","#E89552","#BC4C49","#6C362C","#EDB154","#9C4341","#E27950","#FBEA93","#3B2513","#FEFBC0","#452918","#EBA853","#F2C75C","#8B3F3B","#DB644E","#AD4746","#DF6E4F","#D55A4D","#2B200A","#783932","#E79352","#D75C4D","#FEF9BB","#EDAF54","#E0714F","#7F3C36","#613227","#F7DC77","#C7504B","#F1C45A","#30210D","#F4D065","#1E1B03","#FAE78D","#F9E282","#DA614E","#392412","#4E2C1D","#E99C52","#EFB956","#221C05","#EBA553","#FDF5B0","#984240","#E38050","#8F403D","#542E20","#ECAA54","#E68E51","#70372E","#DE6C4F","#B94A48","#291F09","#1B1A01"]},lapaz:{discrete:["#1A0C64","#1C1368","#1E196D","#202071","#212675","#222B79","#23317D","#253681","#263C85","#274189","#29478C","#2A4C8F","#2C5192","#2E5795","#305C98","#32609A","#35659C","#386A9E","#3C70A0","#3F74A1","#4379A2","#487DA3","#4D81A3","#5386A4","#588AA3","#5E8EA3","#6591A2","#6C95A1","#7398A0","#7A9A9E","#809D9D","#879F9B","#90A199","#97A397","#9EA596","#A5A795","#ADAA95","#B7AD96","#BFB199","#C8B69C","#D2BBA2","#DAC1A8","#E4C9B2","#EBCFBB","#F1D5C4","#F5DBCD","#F9E1D6","#FBE8E1","#FDEDEA","#FEF2F3"],categorical:["#1A0C64","#FEF2F3","#5B8BA3","#B3AC96","#2C5292","#3C70A0","#EACEB9","#859E9C","#24327E","#6F96A1","#33619A","#202071","#D0BAA0","#9BA496","#F9E1D6","#4A7FA3","#284289","#90A199","#FCEAE5","#1D176B","#37699D","#F3D8C8","#A7A895","#5285A4","#7A9A9E","#2F5A97","#4278A2","#263A84","#6591A2","#C1B299","#DEC3AB","#222978","#2A4B8E","#5688A4","#D7BEA6","#FDEEEC","#608EA3","#EFD3C0","#A1A696","#6A94A1","#FBE6DD","#ADAA95","#F6DDCF","#4E82A3","#2E5695","#3A6D9F","#C8B69C","#1C1268","#232D7B","#3F74A1","#467BA3","#1E1C6E","#7F9C9D","#BAAF97","#253681","#315E99","#29478C","#E4C9B2","#74989F","#273E87","#212575","#95A398","#8AA09A","#35659C","#2B4F91","#23307C","#E7CBB5","#F1D5C4","#2B4D90","#202373","#588AA3","#D3BCA3","#5487A4","#447AA2","#6792A2","#24347F","#253882","#ECD0BD","#879F9B","#305C98","#E1C6AF","#1E196D","#5D8DA3","#AAA995","#386B9E","#487DA3","#77999F","#F7DFD3","#BEB098","#1F1E70","#325F99","#4176A2","#F4DACB","#4C80A3","#2D5494","#8DA099","#6C95A1","#FAE3DA","#FDECE8","#B7AD96"]},lipari:{discrete:["#031326","#05192F","#062038","#092844","#0C2E4D","#103557","#163C5F","#1E4368","#294B70","#345075","#3E5578","#47587A","#4F5B7B","#575C7A","#5D5D79","#635E78","#695E76","#6E5F75","#765F73","#7C6071","#826070","#89606E","#90616C","#98616A","#A06268","#A86266","#B06364","#BA6462","#C36660","#CB685F","#D46B5E","#DB705F","#E27760","#E77E63","#E98567","#EA8D6B","#EA946F","#E89C75","#E7A279","#E6A87E","#E5AF84","#E5B58A","#E6BD92","#E7C49A","#EACCA3","#EDD3AD","#F0DBB7","#F5E5C4","#F9EDCF","#FDF5DA"],categorical:["#031326","#FDF5DA","#A56267","#525B7A","#E99B74","#785F72","#DA6F5E","#183E61","#E7C398","#8D616D","#365176","#092844","#655E77","#E98466","#BF6561","#F0DBB7","#E5AD82","#B26364","#EBCFA7","#5C5D79","#061D35","#25486D","#0E3353","#EA906D","#98616A","#E37861","#E5B88C","#826070","#CD685F","#6E5F75","#45587A","#F6E8C9","#E7A37A","#615E78","#E77E63","#D46B5E","#9F6268","#E99570","#93616B","#87606E","#7D6071","#F3E1C0","#575C7A","#0B2D4B","#2D4D72","#E6A87E","#E9C99F","#FAEED1","#1E4368","#EA8A69","#B86462","#6A5E76","#AB6365","#735F74","#DF735F","#E5B287","#13385A","#05182D","#E6BD92","#3E5578","#EDD5AF","#07223C","#C6665F","#4C5A7A","#E8A077","#B56363","#FBF1D6","#A26267","#E6C095","#0A2A48","#F8EBCD","#EACCA3","#AE6364","#7A5F72","#635E78","#E98768","#041629","#715F74","#ECD2AB","#A86266","#8A606E","#96616B","#545C7A","#EFD8B3","#F5E5C4","#9B6169","#F2DEBB","#765F73","#6C5F75","#294B70","#22466B","#E89D76","#E88165","#BC6461","#E6A67C","#85606F","#C36660","#1B4064","#D06A5E","#103557"]},lisbon:{discrete:["#E6E5FF","#D8DCF7","#CBD2EF","#BBC6E5","#ADBCDE","#A0B3D6","#93A9CE","#86A0C6","#7794BD","#6A8BB5","#5E81AC","#5177A4","#456E9B","#38628F","#2F5984","#274F78","#20476D","#1B3F61","#173653","#142E48","#12283E","#112233","#111D2A","#121921","#15181B","#181A18","#1E1D17","#252419","#2D2B1C","#353220","#3E3A25","#46422A","#514C31","#5A5536","#645E3C","#6D6741","#777047","#837B4F","#8D8556","#988F5E","#A29A67","#ADA470","#B9B17D","#C3BC89","#CDC795","#D7D2A2","#E0DCAF","#ECE9BE","#F5F4CB","#FFFFD9"],categorical:["#E6E5FF","#D8DCF7","#CBD2EF","#BBC6E5","#ADBCDE","#A0B3D6","#93A9CE","#86A0C6","#7794BD","#6A8BB5","#5E81AC","#5177A4","#456E9B","#38628F","#2F5984","#274F78","#20476D","#1B3F61","#173653","#142E48","#12283E","#112233","#111D2A","#121921","#15181B","#181A18","#1E1D17","#252419","#2D2B1C","#353220","#3E3A25","#46422A","#514C31","#5A5536","#645E3C","#6D6741","#777047","#837B4F","#8D8556","#988F5E","#A29A67","#ADA470","#B9B17D","#C3BC89","#CDC795","#D7D2A2","#E0DCAF","#ECE9BE","#F5F4CB","#FFFFD9"]},managua:{discrete:["#FFCF67","#F9C564","#F3BB60","#EBB05D","#E5A659","#DF9D56","#D99554","#D38C51","#CC824D","#C67B4B","#C07348","#B96C46","#B36444","#AB5C41","#A4553F","#9D4F3D","#95483C","#8E423A","#843B39","#7C3639","#743139","#6D2D3A","#662A3D","#5F2941","#5A2846","#552A4C","#522C53","#4F315D","#4D3566","#4C3B6F","#4C4179","#4C4883","#4D518E","#4F5897","#51609F","#5367A7","#556FAE","#5878B6","#5B80BC","#5E88C2","#6190C8","#6498CE","#68A3D5","#6BACDB","#6FB5E1","#72BEE6","#76C7EC","#7AD3F3","#7DDDF9","#81E7FF"],categorical:["#FFCF67","#F9C564","#F3BB60","#EBB05D","#E5A659","#DF9D56","#D99554","#D38C51","#CC824D","#C67B4B","#C07348","#B96C46","#B36444","#AB5C41","#A4553F","#9D4F3D","#95483C","#8E423A","#843B39","#7C3639","#743139","#6D2D3A","#662A3D","#5F2941","#5A2846","#552A4C","#522C53","#4F315D","#4D3566","#4C3B6F","#4C4179","#4C4883","#4D518E","#4F5897","#51609F","#5367A7","#556FAE","#5878B6","#5B80BC","#5E88C2","#6190C8","#6498CE","#68A3D5","#6BACDB","#6FB5E1","#72BEE6","#76C7EC","#7AD3F3","#7DDDF9","#81E7FF"]},navia:{discrete:["#031327","#041930","#051E3A","#052546","#062B50","#06315A","#073764","#083E6D","#0B4578","#0E4C80","#115286","#15588B","#195E8E","#1E6491","#216991","#246D91","#27718F","#2A748E","#2D788C","#307A8A","#337D89","#368087","#398385","#3C8683","#3F8981","#428C7F","#468F7D","#4A937A","#4E9678","#529A76","#579E73","#5BA271","#62A86E","#67AD6B","#6EB269","#76B768","#7FBD68","#8CC56A","#98CB6F","#A4D176","#B1D67F","#BCDB89","#C9E096","#D3E3A1","#DCE7AC","#E3EAB6","#EAEDBF","#F1F0CA","#F7F2D2","#FCF4D9"],categorical:["#031327","#FCF4D9","#408A80","#87C269","#1B608F","#59A072","#073966","#D1E39F","#2F798B","#EAEDBF","#052546","#266F90","#6BB06A","#0E4D81","#AED57D","#4C947A","#378186","#DFE8B0","#337D89","#2A748E","#14578A","#051C36","#9ACC70","#0A4374","#468F7D","#529A76","#F4F1CD","#062F56","#C1DC8D","#206891","#78B968","#62A86E","#3C8583","#569D74","#236C91","#F8F3D3","#D8E5A8","#0C487B","#04182E","#71B469","#B8D985","#07345E","#05213E","#4F9778","#5DA470","#3E8882","#062A4E","#7FBD68","#EFEFC6","#C9E096","#115286","#2C768D","#1E6491","#49917B","#66AC6C","#28718F","#A4D176","#90C76C","#438C7F","#175C8D","#083E6D","#E5EAB8","#317B8A","#357F87","#398385","#B3D781","#0D4A7E","#1C6290","#052342","#579F73","#9FCE73","#448D7E","#051A32","#FAF3D6","#428B7F","#29738F","#104F84","#5FA66F","#509877","#8CC56A","#094071","#2D788C","#083B6A","#D5E4A3","#2B758D","#226A91","#04162B","#BCDB89","#47907C","#4D9579","#E2E9B4","#7BBB68","#6EB269","#135488","#4A937A","#F1F0CA","#5BA271","#C5DE92","#F6F2D0","#CDE19B"]},naviaw:{discrete:["#041427","#051A31","#05203B","#062747","#072D52","#08345C","#0A3A66","#0C416F","#0F4979","#135080","#175686","#1B5D8A","#1F628D","#23698F","#276D8F","#2A728F","#2D758E","#30798D","#347D8B","#378089","#3A8388","#3D8686","#408984","#448C82","#489080","#4B937E","#50977C","#559C79","#5AA077","#5FA575","#65AA73","#6CAF71","#76B671","#7FBD71","#89C474","#95CB78","#A2D27F","#B1D98A","#BEDF95","#C9E5A1","#D3E9AD","#DBEDB9","#E4F1C6","#E9F4D0","#EEF6D9","#F2F8E1","#F6FAE9","#F9FCF1","#FCFDF7","#FEFEFD"],categorical:["#041427","#FBFDF6","#478F80","#9FD07D","#1F628D","#64A973","#E3F0C4","#0A3A66","#337C8B","#C7E49E","#7DBC71","#549B7A","#2A718F","#135080","#F2F8E1","#3C8586","#062747","#D7EBB2","#418A83","#B4DB8C","#2E778D","#6FB271","#EBF5D4","#0E4574","#051D37","#4D957D","#256B8F","#195A88","#388189","#F7FAEC","#5CA276","#8CC574","#073056","#31798C","#367E8A","#69AD72","#E7F3CC","#104A7A","#95CB78","#EFF6DB","#0B406D","#2C748E","#4A927F","#DDEEBB","#50987C","#165584","#589E78","#76B671","#3F8785","#05192F","#BEDF95","#448C82","#22678E","#06223F","#A9D684","#08355E","#CFE8A8","#F9FCF1","#286E8F","#85C172","#072C50","#F5F9E7","#1C5F8B","#3A8387","#60A675","#F3F9E4","#0C4271","#266D8F","#81BE72","#0A3D6A","#4B937E","#9ACD7B","#EDF5D7","#90C876","#A4D381","#378089","#1B5D8A","#489080","#145282","#DAECB6","#67AB73","#CBE6A3","#B9DD90","#3D8686","#23698F","#6CAF71","#FAFCF3","#79B971","#D3E9AD","#5AA077","#458E81","#72B471","#327B8C","#E5F1C8","#051B33","#F8FBEE","#062443","#398288","#2B728F","#06294C"]},nuuk:{discrete:["#05598C","#0E5B8B","#155C89","#1C5E87","#226085","#276184","#2C6383","#326682","#386982","#3E6C82","#446F82","#4A7283","#517584","#587A86","#5F7D88","#66818A","#6C858C","#73898E","#7B8E91","#819192","#879594","#8D9996","#939C97","#99A097","#9EA498","#A2A798","#A6AA97","#ABAD96","#AEAF95","#B1B194","#B3B492","#B6B690","#B8B88E","#BABA8C","#BDBC8A","#BFBE88","#C1C187","#C4C385","#C7C684","#CAC983","#CDCD83","#D2D184","#D7D787","#DDDD8B","#E3E290","#E8E895","#EEEE9C","#F4F4A4","#F9F9AB","#FEFEB2"],categorical:["#05598C","#FEFEB2","#A1A698","#537785","#C3C385","#B5B591","#7D8F91","#2D6483","#DDDD8B","#919B96","#BCBC8B","#3F6C82","#CDCD83","#1C5E87","#ADAE95","#68838B","#EEEE9C","#A7AA97","#879594","#C8C783","#F6F6A7","#135C89","#B9B98E","#497183","#73898E","#366882","#C0BF88","#D4D486","#99A097","#B1B293","#5E7D88","#256185","#E6E693","#829293","#788C90","#9DA398","#AAAC96","#E1E18F","#3B6A82","#638089","#B3B492","#A4A897","#446F82","#BABA8C","#D8D888","#185D88","#8C9895","#215F86","#BEBD89","#B7B78F","#CACA83","#4E7484","#C1C186","#959E97","#F2F2A1","#AFB094","#326682","#587A86","#296284","#FAFAAD","#6E868C","#C5C584","#D1D084","#0D5B8B","#E9E997","#DFDF8D","#66818A","#B0B194","#5B7B87","#2B6383","#859493","#CCCB83","#F8F8AA","#D2D285","#1F5F86","#70878D","#4B7383","#768B8F","#FCFCAF","#A9AB97","#BFBE88","#C9C983","#346782","#DBDA89","#236085","#BDBD8A","#BAB98D","#B8B88E","#2F6583","#939C97","#9FA498","#A2A798","#CFCF84","#B4B591","#C4C485","#979F97","#F0F09E","#155C89","#9BA298","#517584"]},oleron:{discrete:["#1A2659","#212E61","#293568","#323F72","#3A477A","#424F82","#4A578A","#535F92","#5D699C","#6572A5","#6E7BAE","#7784B7","#808DC0","#8B97CA","#94A1D3","#9DAADC","#A6B3E5","#AFBCEC","#B9C6F2","#C0CDF5","#C7D4F7","#CEDAF9","#D4E1FB","#DCE9FD","#E3F0FE","#1F4E00","#2C5100","#3A5600","#445900","#4F5C02","#5A6005","#65660C","#736D18","#7E7423","#8A7B2E","#94823A","#9F8945","#AC9253","#B79A5E","#C3A36A","#CEAC75","#D9B581","#E5C090","#EDC99D","#F2D2A9","#F6DAB5","#F8E2C0","#FAECCE","#FBF4DA","#FDFDE6"],categorical:["#1A2659","#212E61","#293568","#323F72","#3A477A","#424F82","#4A578A","#535F92","#5D699C","#6572A5","#6E7BAE","#7784B7","#808DC0","#8B97CA","#94A1D3","#9DAADC","#A6B3E5","#AFBCEC","#B9C6F2","#C0CDF5","#C7D4F7","#CEDAF9","#D4E1FB","#DCE9FD","#E3F0FE","#1F4E00","#2C5100","#3A5600","#445900","#4F5C02","#5A6005","#65660C","#736D18","#7E7423","#8A7B2E","#94823A","#9F8945","#AC9253","#B79A5E","#C3A36A","#CEAC75","#D9B581","#E5C090","#EDC99D","#F2D2A9","#F6DAB5","#F8E2C0","#FAECCE","#FBF4DA","#FDFDE6"]},oslo:{discrete:["#010101","#04070B","#060C13","#0A121B","#0C1620","#0D1927","#0E1D2D","#0F2133","#10263C","#112A43","#122E4A","#133251","#153758","#173C61","#194169","#1B4670","#1E4A78","#214F80","#255589","#295A91","#2E5F99","#3364A1","#3A6AA9","#4371B2","#4B77B9","#537DBE","#5B83C3","#6489C6","#6B8EC8","#7292C9","#7896C9","#7E9ACA","#859ECA","#8BA2C9","#91A6C9","#97A9C9","#9DADC9","#A4B2CA","#AAB6CA","#B1BBCB","#B8BFCD","#BFC5CF","#C7CCD3","#CFD2D8","#D7D9DD","#DEE0E2","#E6E7E9","#EFF0F1","#F7F7F8","#FFFFFF"],categorical:["#030609","#F9F9F9","#507BBC","#163B5E","#A0AFC9","#7B98CA","#27588E","#0E2032","#CACED5","#122D48","#3767A6","#1D4875","#8DA3C9","#E2E3E5","#678BC7","#B4BDCC","#0C151F","#BFC5CF","#97A9C9","#4371B2","#10263D","#080E16","#7292C9","#215081","#2E5F99","#AAB6CA","#ECEDEE","#0D1A28","#143454","#D5D8DC","#5B83C3","#19426A","#859ECA","#13314E","#0E1D2D","#3D6CAC","#6C8FC8","#7795C9","#F3F3F4","#4976B8","#245488","#DBDDE0","#112A43","#92A6C9","#C5C9D2","#809BCA","#0F2337","#3263A0","#050A10","#B9C1CD","#1F4C7B","#183E64","#A5B3CA","#0A121B","#9CACC9","#6187C5","#0D1824","#8AA1CA","#2A5B93","#547EBF","#D1D3D9","#E6E7E9","#1B456F","#B0BACB","#153758","#7494C9","#D8DADE","#6A8DC8","#90A5C9","#99ABC9","#235285","#133251","#060C13","#406EAF","#7E9ACA","#173C61","#4C78BA","#122F4B","#1C4772","#87A0CA","#CED1D7","#C2C7D1","#0F253A","#2C5D96","#C7CCD3","#112B45","#EFF0F1","#6F90C9","#0E1E2F","#ADB8CB","#7997CA","#4673B5","#15395B","#091018","#194067","#30619C","#94A8C9","#F6F6F6","#0F2135","#A3B1CA"]},roma:{discrete:["#7E1700","#832504","#883008","#8F3C0C","#934610","#984E14","#9C5717","#A05F1B","#A5681F","#A97023","#AD7826","#B0802B","#B58930","#BA9437","#BE9D3E","#C2A647","#C7B051","#CBBA5D","#CFC66D","#D1CF7B","#D2D78A","#D2DE98","#D0E4A6","#CBE8B4","#C4EABE","#BDEAC6","#B3E9CD","#A6E6D2","#9BE2D5","#8EDDD7","#81D7D7","#74CFD6","#64C6D5","#59BDD2","#4FB5D0","#46ACCC","#3EA4C9","#379AC5","#3292C2","#2E8ABF","#2B82BB","#287AB8","#2471B4","#2269B0","#1F60AD","#1C58A9","#194FA5","#1344A0","#0C3B9C","#033198"],categorical:["#7E1700","#832504","#883008","#8F3C0C","#934610","#984E14","#9C5717","#A05F1B","#A5681F","#A97023","#AD7826","#B0802B","#B58930","#BA9437","#BE9D3E","#C2A647","#C7B051","#CBBA5D","#CFC66D","#D1CF7B","#D2D78A","#D2DE98","#D0E4A6","#CBE8B4","#C4EABE","#BDEAC6","#B3E9CD","#A6E6D2","#9BE2D5","#8EDDD7","#81D7D7","#74CFD6","#64C6D5","#59BDD2","#4FB5D0","#46ACCC","#3EA4C9","#379AC5","#3292C2","#2E8ABF","#2B82BB","#287AB8","#2471B4","#2269B0","#1F60AD","#1C58A9","#194FA5","#1344A0","#0C3B9C","#033198"]},romao:{discrete:["#733957","#773850","#7A3849","#7E3942","#823C3D","#863F38","#8A4334","#8E4831","#94502E","#98572C","#9D5F2B","#A3672C","#A8712E","#AF7D32","#B58837","#BB933F","#C19F47","#C6AA52","#CDB761","#D1C26E","#D4CB7B","#D6D388","#D5D995","#D3DEA3","#CEE0AD","#C8E1B6","#C1E1BE","#B6DEC5","#ABDBC9","#A0D6CC","#94D0CE","#88C9CF","#7BC0CE","#70B8CD","#67AFCA","#5FA6C7","#589CC4","#5291BE","#4F88B9","#4E7EB3","#4F75AC","#516BA4","#55609A","#595891","#5D5087","#62497D","#664474","#6B3F69","#6F3B60","#723959"],categorical:["#733957","#773850","#7A3849","#7E3942","#823C3D","#863F38","#8A4334","#8E4831","#94502E","#98572C","#9D5F2B","#A3672C","#A8712E","#AF7D32","#B58837","#BB933F","#C19F47","#C6AA52","#CDB761","#D1C26E","#D4CB7B","#D6D388","#D5D995","#D3DEA3","#CEE0AD","#C8E1B6","#C1E1BE","#B6DEC5","#ABDBC9","#A0D6CC","#94D0CE","#88C9CF","#7BC0CE","#70B8CD","#67AFCA","#5FA6C7","#589CC4","#5291BE","#4F88B9","#4E7EB3","#4F75AC","#516BA4","#55609A","#595891","#5D5087","#62497D","#664474","#6B3F69","#6F3B60","#723959"]},tofino:{discrete:["#DED9FF","#D0CFF9","#C3C6F3","#B3BBEC","#A6B1E6","#98A8E1","#8B9FDB","#7E95D4","#6E89CB","#617FC3","#5575B8","#4A6BAC","#4262A0","#395790","#334F83","#2E4776","#293F6A","#24385D","#1F304F","#1B2943","#172338","#141D2E","#111824","#0F151B","#0D1516","#0D1712","#0F1B12","#112113","#142716","#162F19","#1A361C","#1D3E20","#224825","#26512A","#2A5A2E","#2E6233","#336C38","#39773E","#3F8144","#488B4A","#529551","#5FA059","#70AB63","#7FB46B","#8EBD73","#9DC57B","#ACCD83","#BDD68C","#CCDE94","#DBE69B"],categorical:["#DED9FF","#D0CFF9","#C3C6F3","#B3BBEC","#A6B1E6","#98A8E1","#8B9FDB","#7E95D4","#6E89CB","#617FC3","#5575B8","#4A6BAC","#4262A0","#395790","#334F83","#2E4776","#293F6A","#24385D","#1F304F","#1B2943","#172338","#141D2E","#111824","#0F151B","#0D1516","#0D1712","#0F1B12","#112113","#142716","#162F19","#1A361C","#1D3E20","#224825","#26512A","#2A5A2E","#2E6233","#336C38","#39773E","#3F8144","#488B4A","#529551","#5FA059","#70AB63","#7FB46B","#8EBD73","#9DC57B","#ACCD83","#BDD68C","#CCDE94","#DBE69B"]},tokyo:{discrete:["#1C0E34","#241036","#2D1339","#37163D","#3F1A40","#481E43","#4F2345","#562948","#5D304A","#62354C","#663B4D","#69404E","#6B454F","#6D4B50","#6E4F50","#6F5251","#6F5651","#705951","#715C52","#715F52","#716252","#726452","#726753","#736B53","#736E53","#747153","#757554","#757A54","#767E55","#778355","#788856","#798E57","#7B9558","#7C9B5A","#7EA25C","#81A95E","#84B062","#88B968","#8DC16E","#93CA76","#9BD27F","#A4DA8A","#AFE398","#BAEAA4","#C5EFB0","#CFF4BB","#D8F7C5","#E2F9CF","#E9FBD7","#EFFCDD"],categorical:["#1C0E34","#EFFCDD","#747053","#6C4750","#87B666","#B8E8A1","#512446","#715D52","#798B56","#7D9F5B","#37163D","#726653","#99D07D","#63374C","#6F5451","#D8F7C5","#767C54","#705951","#5B2D49","#7B9558","#441D41","#291238","#E5FAD2","#C9F1B4","#716252","#81AA5F","#683F4E","#736B53","#6E4E50","#757654","#8EC370","#A7DD8E","#778455","#747354","#84B062","#231036","#93CA76","#DFF9CC","#30143A","#A0D785","#7FA45D","#EAFBD8","#6A434F","#C1EDAB","#736D53","#562948","#6D4B50","#7A9057","#7C9A59","#4B2044","#715F52","#663B4D","#D1F4BD","#705651","#8ABD6A","#6E5151","#AFE398","#5F324B","#757954","#3E193F","#726853","#726452","#778055","#705B52","#788756","#61344C","#746E53","#ABE093","#532747","#85B364","#7EA25C","#261137","#736C53","#E8FBD5","#4E2245","#88B968","#798E57","#767E55","#726753","#757754","#715E52","#3A183E","#6E4F51","#778255","#7B9759","#DCF8C9","#EDFCDA","#411B40","#7D9C5A","#767B54","#726352","#6F5551","#726552","#82AD60","#D5F6C1","#34153C","#9CD481","#747454","#C5EFB0","#481E43"]},turku:{discrete:["#000000","#090908","#111110","#181816","#1D1D1A","#22221F","#272723","#2C2C27","#33322B","#38382F","#3D3D32","#424235","#474738","#4E4D3C","#53523E","#585841","#5D5D43","#626246","#686848","#6E6D4B","#73724D","#797750","#7F7D52","#878356","#8E8859","#968E5C","#9D9360","#A79864","#AF9C68","#B69F6C","#BEA270","#C4A474","#CCA579","#D1A67D","#D7A781","#DBA886","#E0A98B","#E6AB92","#EAAD98","#EFB09F","#F2B4A7","#F6B9AE","#F9BFB7","#FBC4BF","#FDC9C6","#FECFCC","#FED4D3","#FFDBDA","#FFE0E0","#FFE6E6"],categorical:["#070707","#FFE6E6","#948D5B","#E5AA90","#4D4C3B","#2C2C27","#C3A374","#6D6C4A","#FBC4BF","#D6A780","#F2B4A7","#1C1C19","#3D3D32","#AC9A67","#7E7C52","#FED6D4","#5D5D43","#35342D","#DDA888","#141312","#55543F","#242420","#FDCDCA","#F7BCB3","#898456","#B8A06D","#ECAE9B","#CDA57A","#FFDEDD","#646447","#454537","#9F9461","#76744E","#71704C","#30302A","#414135","#181816","#FCC8C4","#EFB1A1","#838054","#F5B8AD","#E1A98C","#C8A477","#686848","#595941","#20201D","#8E8859","#D1A67D","#B29D6A","#E9AC95","#BEA270","#FED1CF","#0E0E0D","#A59764","#DAA784","#282823","#F9C0B9","#51503D","#393930","#FFDAD9","#49493A","#606045","#FFE2E1","#9A915E","#797750","#F4B6AA","#F6BAB0","#CBA578","#FFD8D6","#FECFCC","#262622","#C0A272","#868255","#1A1A18","#FAC2BC","#8B8658","#E3AA8E","#161614","#4F4E3C","#C6A475","#2E2E28","#BBA16F","#6B6A49","#E7AB93","#CFA67C","#626246","#53523E","#5B5B42","#FED3D1","#7C7A51","#817E53","#73724D","#FFDCDB","#37372E","#F8BEB6","#0B0B0A","#575740","#DFA98A","#474738","#B59F6C"]},vanimo:{discrete:["#FFCDFD","#F7BEF2","#F0B0E8","#E6A0DC","#DE93D2","#D786C8","#CF7ABF","#C76FB5","#BD63AA","#B45AA1","#AB5198","#A1498E","#964184","#883977","#7C326B","#6E2C60","#612654","#542148","#451C3B","#391931","#2F1728","#281521","#22141C","#1D1417","#1A1414","#191612","#191811","#1B1D11","#1D2212","#212913","#253014","#2B3916","#324419","#384D1B","#3F561E","#456021","#4C6924","#547427","#5A7C2A","#60852E","#678E32","#6E9737","#77A33F","#7FAE47","#88BA51","#92C65D","#9CD26B","#A9E27F","#B3EF92","#BEFDA5"],categorical:["#FFCDFD","#F7BEF2","#F0B0E8","#E6A0DC","#DE93D2","#D786C8","#CF7ABF","#C76FB5","#BD63AA","#B45AA1","#AB5198","#A1498E","#964184","#883977","#7C326B","#6E2C60","#612654","#542148","#451C3B","#391931","#2F1728","#281521","#22141C","#1D1417","#1A1414","#191612","#191811","#1B1D11","#1D2212","#212913","#253014","#2B3916","#324419","#384D1B","#3F561E","#456021","#4C6924","#547427","#5A7C2A","#60852E","#678E32","#6E9737","#77A33F","#7FAE47","#88BA51","#92C65D","#9CD26B","#A9E27F","#B3EF92","#BEFDA5"]},vik:{discrete:["#001261","#011A66","#02226B","#022B71","#023376","#023A7B","#034280","#034A85","#06548B","#0B5D91","#136697","#1E6F9D","#2B79A4","#3C85AC","#4B90B3","#5A9ABA","#6AA4C1","#7AAEC8","#8DBAD0","#9DC4D6","#ADCDDD","#BDD6E3","#CCDFE8","#DEE6E9","#E8E7E5","#EEE3DC","#EEDBD0","#EBD0C0","#E7C6B2","#E3BCA5","#DFB298","#DBA88B","#D69D7C","#D29470","#CE8B64","#CA8258","#C6794C","#C26E3F","#BE6533","#B85C28","#B2511D","#A94512","#9C3709","#912D06","#872406","#7E1D06","#741506","#6A0D07","#620607","#590008"],categorical:["#001261","#011A66","#02226B","#022B71","#023376","#023A7B","#034280","#034A85","#06548B","#0B5D91","#136697","#1E6F9D","#2B79A4","#3C85AC","#4B90B3","#5A9ABA","#6AA4C1","#7AAEC8","#8DBAD0","#9DC4D6","#ADCDDD","#BDD6E3","#CCDFE8","#DEE6E9","#E8E7E5","#EEE3DC","#EEDBD0","#EBD0C0","#E7C6B2","#E3BCA5","#DFB298","#DBA88B","#D69D7C","#D29470","#CE8B64","#CA8258","#C6794C","#C26E3F","#BE6533","#B85C28","#B2511D","#A94512","#9C3709","#912D06","#872406","#7E1D06","#741506","#6A0D07","#620607","#590008"]},viko:{discrete:["#4F1A3D","#4B1D43","#48214A","#432653","#3F2C5B","#3C3263","#38396C","#354174","#334B7F","#345487","#365E8F","#3B6797","#42719E","#4D7DA6","#5787AD","#6391B4","#709ABA","#7DA4BF","#8EAEC4","#9BB5C7","#A9BBC8","#B5C0C8","#C0C2C5","#CBC2BF","#D2C0B8","#D6BDAF","#D9B7A6","#D9AF99","#D8A88D","#D6A082","#D39776","#CF8D6B","#C8825D","#C27752","#BB6D47","#B3623D","#AA5633","#9F492A","#953E25","#8C3521","#822C1F","#7A251E","#721F1F","#6B1A21","#661824","#611627","#5C152B","#571631","#531736","#50193C"],categorical:["#4F1A3D","#4B1D43","#48214A","#432653","#3F2C5B","#3C3263","#38396C","#354174","#334B7F","#345487","#365E8F","#3B6797","#42719E","#4D7DA6","#5787AD","#6391B4","#709ABA","#7DA4BF","#8EAEC4","#9BB5C7","#A9BBC8","#B5C0C8","#C0C2C5","#CBC2BF","#D2C0B8","#D6BDAF","#D9B7A6","#D9AF99","#D8A88D","#D6A082","#D39776","#CF8D6B","#C8825D","#C27752","#BB6D47","#B3623D","#AA5633","#9F492A","#953E25","#8C3521","#822C1F","#7A251E","#721F1F","#6B1A21","#661824","#611627","#5C152B","#571631","#531736","#50193C"]}};function xe(e){const t=e.replace("#","");return{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16)}}const pe={waves:"batlow",blksand:"tokyo",breeze:"imola",magma:"batlow",ribbon:"hawaii",stars:"batlow",folds:"imola"},ge={[c.ADVERT]:1,[c.TXT_MSG]:4,[c.GRP_TXT]:2,[c.RESPONSE]:8,[c.REQ]:13,[c.ANON_REQ]:7,[c.ACK]:11,[c.PATH]:24,[c.TRACE]:16,[c.GRP_DATA]:34,[c.MULTIPART]:52,[c.RAW_CUSTOM]:14};function fe(){let e="waves",t=!0;if("undefined"!=typeof window){e=localStorage.getItem("pymc-color-scheme")||"waves";const s=o(e);t=(null==s?void 0:s.meta.isDark)??!0}const s=pe[e]??"batlow",a=he[s],n=a.discrete.length,r=Math.floor(n/2);return{colormap:a,colormapName:s,isDark:t,baseIndex:t?r:0,halfSize:r}}let ye=null;function be(e){const{colormap:t,isDark:s}=fe();if("number"!=typeof e)return s?"#A5A5A5":"#666666";const a=ge[e];if(void 0===a)return s?"#A5A5A5":"#666666";const n=t.categorical;return n[Math.min(a,n.length-1)]}function ve(e){return xe(be(e))}const je=C("chart-line",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]]),ke=C("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]),Ne=C("columns-2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]]),we=C("columns-3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]),Me=C("columns-4",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7.5 3v18",key:"w0wo6v"}],["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M16.5 3v18",key:"10tjh1"}]]),Se=C("expand",[["path",{d:"m15 15 6 6",key:"1s409w"}],["path",{d:"m15 9 6-6",key:"ko1vev"}],["path",{d:"M21 16v5h-5",key:"1ck2sf"}],["path",{d:"M21 8V3h-5",key:"1qoq8a"}],["path",{d:"M3 16v5h5",key:"1t08am"}],["path",{d:"m3 21 6-6",key:"wwnumi"}],["path",{d:"M3 8V3h5",key:"1ln10m"}],["path",{d:"M9 9 3 3",key:"v551iv"}]]),Te=C("grid-3x3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]),Re=C("grip",[["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"19",cy:"5",r:"1",key:"w8mnmm"}],["circle",{cx:"5",cy:"5",r:"1",key:"lttvr7"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}],["circle",{cx:"19",cy:"19",r:"1",key:"shf9b7"}],["circle",{cx:"5",cy:"19",r:"1",key:"bfqh0e"}]]),Pe=C("id-card",[["path",{d:"M16 10h2",key:"8sgtl7"}],["path",{d:"M16 14h2",key:"epxaof"}],["path",{d:"M6.17 15a3 3 0 0 1 5.66 0",key:"n6f512"}],["circle",{cx:"9",cy:"11",r:"2",key:"yxgjnd"}],["rect",{x:"2",y:"5",width:"20",height:"14",rx:"2",key:"qneu4z"}]]),$e=C("radar",[["path",{d:"M19.07 4.93A10 10 0 0 0 6.99 3.34",key:"z3du51"}],["path",{d:"M4 6h.01",key:"oypzma"}],["path",{d:"M2.29 9.62A10 10 0 1 0 21.31 8.35",key:"qzzz0"}],["path",{d:"M16.24 7.76A6 6 0 1 0 8.23 16.67",key:"1yjesh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M17.99 11.66A6 6 0 0 1 15.77 16.67",key:"1u2y91"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"m13.41 10.59 5.66-5.66",key:"mhq4k0"}]]),Le=C("settings-2",[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]),ze=C("shrink",[["path",{d:"m15 15 6 6m-6-6v4.8m0-4.8h4.8",key:"17vawe"}],["path",{d:"M9 19.8V15m0 0H4.2M9 15l-6 6",key:"chjx8e"}],["path",{d:"M15 4.2V9m0 0h4.8M15 9l6-6",key:"lav6yq"}],["path",{d:"M9 4.2V9m0 0H4.2M9 9 3 3",key:"1pxi2q"}]]),He=C("sparkle",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}]]),_e=C("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]),Oe=C("waves",[["path",{d:"M2 6c.6.5 1.2 1 2.5 1C7 7 7 5 9.5 5c2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"knzxuh"}],["path",{d:"M2 12c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"2jd2cc"}],["path",{d:"M2 18c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"rd2r6e"}]]),Ie={useAbsoluteThresholds:!0,baselinePercentile:6,spikePercentile:50,baselineDbm:-107,spikeDbm:-100,mergeGapSeconds:45,minSequenceLength:16,similarityToleranceDbm:5};function We(e,t){if(0===e.length)return 0;const s=t/100*(e.length-1),a=Math.floor(s),n=Math.ceil(s);return a===n?e[a]:e[a]+(e[n]-e[a])*(s-a)}function Ve(e){if(0===e.length)return{median:0,p90:0,p95:0,p99:0,max:0,min:0};const t=[...e].sort((e,t)=>e-t);return{median:We(t,50),p90:We(t,90),p95:We(t,95),p99:We(t,99),max:t[t.length-1],min:t[0]}}function qe(e,t,s){const a=s-t;if(0===a)return"moderate";const n=(e-t)/a;return n>.66?"critical":n>.33?"severe":"moderate"}n.memo(function({options:e,data:t,className:s="",onCreate:a}){const l=n.useRef(null),i=n.useRef(null);return n.useEffect(()=>{const s=l.current;if(!s)return;const n=s.getBoundingClientRect(),r=Math.floor(n.width)||400,o=Math.floor(n.height)||200,c=new A({...e,width:r,height:o},t,s);return i.current=c,null==a||a(c),()=>{c.destroy(),i.current=null}},[e]),n.useEffect(()=>{i.current&&t&&i.current.setData(t)},[t]),n.useEffect(()=>{const e=l.current;if(!e)return;const t=new ResizeObserver(e=>{const t=e[0];if(!t||!i.current)return;const{width:s,height:a}=t.contentRect;s>0&&a>0&&i.current.setSize({width:Math.floor(s),height:Math.floor(a)})});return t.observe(e),()=>{t.disconnect()}},[]),r.jsx("div",{ref:l,className:`w-full h-full ${s}`,style:{minHeight:100}})});const Ge=new Map;function Xe(e){var t;if(!e.startsWith("var("))return e;const s=Ge.get(e);if(s)return s;const a=e.match(/var\(([^,)]+)(?:,\s*([^)]+))?\)/);if(!a)return e;const n=a[1].trim(),r=(null==(t=a[2])?void 0:t.trim())||"#888888",l=getComputedStyle(document.documentElement).getPropertyValue(n).trim()||r;return Ge.set(e,l),l}function Ke(e,t,s=!1){if(t.length<2)return;if(e.beginPath(),e.moveTo(t[0].x,t[0].y),2===t.length)return void e.lineTo(t[1].x,t[1].y);const a=.5;for(let n=0;n{E.current=e,m.current=t,d.current=a,u.current=s});const x=n.useRef({band:l,innerBand:i,mean:o,median:c,average:C,cursor:D});n.useLayoutEffect(()=>{x.current={band:l,innerBand:i,mean:o,median:c,average:C,cursor:D}});const p=n.useMemo(()=>[e.map(e=>e.timestamp),e.map(e=>e.max)],[e]),g=n.useMemo(()=>{const e=function(e,t,s,a){return{hooks:{draw:n=>{const r=e.current,l=t.current,i=s.current,o=a.current;if(0===r.length)return;const c=n.ctx,C=n.bbox,A=C.left,D=C.top,B=C.width,F=C.height;if(B<=0||F<=0)return;const E=n.data[0],m=E.length;if(0===m)return;const d=E[0],u=E[m-1]-d||1,h=e=>A+(e-d)/u*B,x=e=>D+F*(1-e/l),p={min:r.map(e=>({x:h(e.timestamp),y:x(e.min)})),max:r.map(e=>({x:h(e.timestamp),y:x(e.max)})),p5:r.map(e=>({x:h(e.timestamp),y:x(e.p5)})),p95:r.map(e=>({x:h(e.timestamp),y:x(e.p95)})),p25:r.map(e=>({x:h(e.timestamp),y:x(e.p25)})),p75:r.map(e=>({x:h(e.timestamp),y:x(e.p75)})),mean:r.map(e=>({x:h(e.timestamp),y:x(e.mean)})),median:r.map(e=>({x:h(e.timestamp),y:x(e.median)})),average:r.map(e=>({x:h(e.timestamp),y:x(e.average)}))},g=(e,t)=>i?i===e?Math.min(1,1.5*t):"minMax"===i||"p5p95"===i||"p25p75"===i?.3*t:t:t,f=e=>i?i===e?1:"mean"===i||"median"===i||"average"===i?.3:1:1,y={band:Xe(o.band),innerBand:Xe(o.innerBand),mean:Xe(o.mean),median:Xe(o.median),average:Xe(o.average)};c.save(),c.strokeStyle=y.average,c.lineWidth=4,c.globalAlpha=f("average"),Ke(c,p.average),c.stroke(),c.globalAlpha=g("minMax",.15),c.fillStyle=y.band,c.beginPath(),Ke(c,p.max);const b=[...p.min].reverse();for(const e of b)c.lineTo(e.x,e.y);c.closePath(),c.fill(),c.globalAlpha=g("p5p95",.3),c.fillStyle=y.band,c.beginPath(),Ke(c,p.p95);const v=[...p.p5].reverse();for(const e of v)c.lineTo(e.x,e.y);c.closePath(),c.fill(),c.globalAlpha=g("p25p75",.55),c.fillStyle=y.innerBand,c.beginPath(),Ke(c,p.p75);const j=[...p.p25].reverse();for(const e of j)c.lineTo(e.x,e.y);c.closePath(),c.fill(),c.strokeStyle=y.median,c.lineWidth=1.5,c.globalAlpha=f("median"),c.setLineDash([4,4]),Ke(c,p.median),c.stroke(),c.strokeStyle=y.mean,c.lineWidth=1.5,c.globalAlpha=f("mean"),c.setLineDash([]),Ke(c,p.mean),c.stroke(),c.restore()}}}}(E,m,d,x);return{width:400,height:200,padding:[4,4,4,4],cursor:{show:!0,x:!0,y:!1,drag:{x:!1,y:!1},points:{show:!1}},scales:{x:{time:!0},y:{range:[0,t]}},axes:[{show:!1},{show:!1}],series:[{},{show:!1}],hooks:{setCursor:[e=>{var t,s;const a=e.cursor.idx;null!=a&&a>=0?null==(t=u.current)||t.call(u,a):null==(s=u.current)||s.call(u,null)}]},plugins:[e]}},[t]);n.useEffect(()=>{const t=B.current;if(!t||0===e.length)return;const s=h.current,a=e.length,n=Math.abs(a-s);if(!(!F.current||n>100||s>0&&n/s>.1)&&F.current)return F.current.setData(p),void(h.current=a);F.current&&F.current.destroy();const r=t.getBoundingClientRect(),l=Math.floor(r.width)||400,i=Math.floor(r.height)||200,o=new A({...g,width:l,height:i},p,t);return F.current=o,h.current=a,()=>{o.destroy(),F.current=null}},[g,p,e.length]),n.useEffect(()=>{const e=B.current;if(!e)return;const t=new ResizeObserver(e=>{const t=e[0];if(!t||!F.current)return;const{width:s,height:a}=t.contentRect;s>0&&a>0&&F.current.setSize({width:Math.floor(s),height:Math.floor(a)})});return t.observe(e),()=>{t.disconnect()}},[]),n.useEffect(()=>{F.current&&F.current.redraw()},[a,e]);const f=n.useCallback(()=>{null==s||s(null)},[s]);return 0===e.length?r.jsx("div",{className:"h-full flex items-center justify-center text-text-muted",children:"No data available"}):r.jsx("div",{ref:B,className:"w-full h-full rounded-2xl overflow-hidden",onMouseLeave:f})});const Ye="undefined"!=typeof window&&(null==(t=null==(e=window.matchMedia)?void 0:e.call(window,"(color-gamut: p3)"))?void 0:t.matches);function Ue(){const e=getComputedStyle(document.documentElement);return{fontFamily:e.getPropertyValue("--font-data").trim()||'"JetBrains Mono", ui-monospace, monospace',axisColor:e.getPropertyValue("--chart-axis-tick").trim()||"rgba(255, 255, 255, 0.4)",gridColor:e.getPropertyValue("--chart-grid").trim()||"rgba(255, 255, 255, 0.06)",textMuted:e.getPropertyValue("--text-muted").trim()||"#727272",textPrimary:e.getPropertyValue("--text-primary").trim()||"#FFFFFF"}}const Qe=["min","max","p75","p95","p99","mean","median","average","midpoint"];function Ze(e){const t=xe(function(e){const{colormap:t,baseIndex:s,halfSize:a}=fe(),n=Math.max(0,Math.min(1,e)),r=Math.min(s+Math.floor(n*(a-1)),t.discrete.length-1);return t.discrete[r]}(e)),s=`color(display-p3 ${(t.r/255).toFixed(3)} ${(t.g/255).toFixed(3)} ${(t.b/255).toFixed(3)})`;return{...t,p3:s}}function Je(e,t,s,a,n,r,l,i,o,c=null,C=null,A=1,D=null,B="airtime",F=.5){if(0===t.length)return;const E=e.ctx,{left:m,top:d,width:u,height:h}=e.bbox,x=window.devicePixelRatio||1;if(u<=0||h<=0)return;const p=e.data[0],g=p.length;if(0===g)return;const f=p[0],y=p[g-1],b=s,v="share"===B,j=v?function(e){const t=[10,20,25,50,100,200,250,500,1e3],s=e/4.5;for(const a of t)if(a>=s)return a;return e>5e3?1e3*Math.ceil(s/1e3):100*Math.ceil(s/100)}(b):5,k=getComputedStyle(document.documentElement),N=k.getPropertyValue("--signal-critical").trim()||"#EF4444",w=k.getPropertyValue("--bg-body").trim()||"#171717";E.save(),E.fillStyle="#000000";const M=8*x;E.beginPath(),E.roundRect(m,d,u,h,M),E.fill(),E.restore();const S=parseInt(w.slice(1,3),16)||23,T=parseInt(w.slice(3,5),16)||23,R=parseInt(w.slice(5,7),16)||23;if(!v&&b>=20){E.save();const e=d+h*(1-20/b);E.fillStyle=`rgba(${S}, ${T}, ${R}, 0.5)`,E.fillRect(m,d,u,e-d),E.restore()}E.save(),E.lineWidth=1*x,E.setLineDash([4*x,4*x]);for(let $=j;$s+n)return;const i=getComputedStyle(document.documentElement).getPropertyValue("--text-primary").trim()||"#FFFFFF";e.save(),e.strokeStyle=i,e.globalAlpha=.5,e.lineWidth=1*l,e.setLineDash([4*l,4*l]),e.beginPath(),e.moveTo(Math.round(t)+.5,a),e.lineTo(Math.round(t)+.5,a+r),e.stroke(),e.restore()}(E,D,m,d,u,h,x),l){!function(e,t,s,a,n,r,l=null,i=null,o=1,c=25){const{points:C,rawValues:A,count:D,packetTypes:B,timestamps:F}=t,E=1*o*(window.devicePixelRatio||1);e.globalCompositeOperation="source-over";const m=l?parseInt(l.replace("TYPE_",""),10):null;for(let d=0;d=i.start&&e0&&function(e,t,s,a,n,r,l,i,o,c,C=.5){if(0===t.length)return;const A=o-i||1,D=function(e,t=1.3,s=.15){const a=function(e){const t=e.match(/color\(display-p3\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)/);if(t){const e=parseFloat(t[1]),s=parseFloat(t[2]),a=parseFloat(t[3]);return{r:Math.round(255*e),g:Math.round(255*s),b:Math.round(255*a),p3r:e,p3g:s,p3b:a}}if(e.startsWith("#")){const t=e.replace("#",""),s=parseInt(t.slice(0,2),16),a=parseInt(t.slice(2,4),16),n=parseInt(t.slice(4,6),16);return{r:s,g:a,b:n,p3r:s/255,p3g:a/255,p3b:n/255}}const s=e.match(/rgba?\(([\d.]+),?\s*([\d.]+),?\s*([\d.]+)/);if(s){const e=Math.round(parseFloat(s[1])),t=Math.round(parseFloat(s[2])),a=Math.round(parseFloat(s[3]));return{r:e,g:t,b:a,p3r:e/255,p3g:t/255,p3b:a/255}}return{r:255,g:255,b:255,p3r:1,p3g:1,p3b:1}}(e),n=function(e,t,s,a=1.25,n=.15){const r=(Math.max(e,t,s)+Math.min(e,t,s))/2;return{p3r:Math.min(1,r+(e-r)*a+n),p3g:Math.min(1,r+(t-r)*a+n),p3b:Math.min(1,r+(s-r)*a+n)}}(a.p3r,a.p3g,a.p3b,t,s);return{r:Math.round(255*Math.min(1,n.p3r)),g:Math.round(255*Math.min(1,n.p3g)),b:Math.round(255*Math.min(1,n.p3b)),p3r:Math.min(1,n.p3r),p3g:Math.min(1,n.p3g),p3b:Math.min(1,n.p3b)}}(getComputedStyle(document.documentElement).getPropertyValue("--signal-critical").trim()||"#EF4444");e.save(),e.globalAlpha=C,e.fillStyle=Ye?`color(display-p3 ${D.p3r} ${D.p3g} ${D.p3b})`:`rgb(${D.r}, ${D.g}, ${D.b})`;for(const B of t){if(B.endTso)continue;const t=a+(Math.max(B.startTs,i)-i)/A*r,s=a+(Math.min(B.endTs,o)-i)/A*r,C=Math.max(s-t,2*c);e.fillRect(t,n,C,l)}e.restore()}(E,i,0,m,d,u,h,f,y,x,C?Math.max(.03,.03*F):F)}const et=n.memo(function({data:e,maxValue:t,visibleLines:s=Qe,highlightedLine:a=null,onHover:l,scatterData:i=null,noiseFloorAnomalies:o=null,showNoiseFloorOverlay:c=!1,overlayOpacity:C=.5,highlightedType:D=null,hoveredTimeRange:B=null,timeRangeHours:F=24,yAxisMode:E="airtime"}){const m=n.useRef(null),d=n.useRef(null),u=n.useRef(e),h=n.useRef(t),x=n.useRef(s),p=n.useRef(a),g=n.useRef(l),f=n.useRef(i),y=n.useRef(o),b=n.useRef(c),v=n.useRef(D),j=n.useRef(B),k=n.useRef(null),N=n.useRef(null),w=n.useRef(E),M=n.useRef(C),S=F<=12?1.2:1,T=n.useRef(S),R=n.useRef(e.length);n.useLayoutEffect(()=>{u.current=e,h.current=t,x.current=s,p.current=a,g.current=l,f.current=i,y.current=o,b.current=c,v.current=D,j.current=B,T.current=S,w.current=E,M.current=C}),n.useEffect(()=>{k.current=Ue()},[]);const P=n.useMemo(()=>[e.map(e=>e.timestamp),new Array(e.length).fill(1)],[e]),$=n.useMemo(()=>({hooks:{draw:e=>{const t=k.current||Ue();Je(e,u.current,h.current,x.current,p.current,t,f.current,y.current,b.current,v.current,j.current,T.current,N.current,w.current,M.current)}}}),[]),L=n.useMemo(()=>({width:400,height:200,padding:[8,0,8,28],cursor:{show:!1,x:!1,y:!1,drag:{x:!1,y:!1},points:{show:!1}},scales:{x:{time:!0},y:{range:[0,1]}},axes:[{show:!1},{show:!1}],series:[{},{show:!1}],plugins:[$]}),[$]);n.useEffect(()=>{const t=m.current;if(!t||0===e.length)return;const s=R.current,a=e.length,n=Math.abs(a-s);if(!(!d.current||n>100||s>0&&n/s>.1)&&d.current)return d.current.setData(P),void(R.current=a);d.current&&d.current.destroy();const r=t.getBoundingClientRect(),l=Math.floor(r.width)||400,i=Math.floor(r.height)||200,o=new A({...L,width:l,height:i},P,t);return d.current=o,R.current=a,()=>{o.destroy(),d.current=null}},[L,P,e.length]),n.useEffect(()=>{const e=m.current;if(!e)return;const t=new ResizeObserver(e=>{const t=e[0];if(!t||!d.current)return;const{width:s,height:a}=t.contentRect;s>0&&a>0&&d.current.setSize({width:Math.floor(s),height:Math.floor(a)})});return t.observe(e),()=>{t.disconnect()}},[]),n.useEffect(()=>{d.current&&d.current.redraw()},[a,s,e,i,o,c,C,D,B,S]);const z=n.useCallback(t=>{var s,a;const n=m.current,r=d.current;if(!n||!r||0===e.length)return;const l=n.getBoundingClientRect(),i=t.clientX-l.left,o=window.devicePixelRatio||1,c=r.bbox,C=c.left/o,A=c.width/o;if(iC+A)return N.current=null,r.redraw(),void(null==(s=g.current)||s.call(g,null));N.current=i*o;const D=(i-C)/A,B=e.length,F=Math.floor(D*B),E=Math.max(0,Math.min(B-1,F));r.redraw(),null==(a=g.current)||a.call(g,E)},[e.length]),H=n.useCallback(()=>{var e;N.current=null,d.current&&d.current.redraw(),null==(e=g.current)||e.call(g,null)},[]);return 0===e.length?r.jsx("div",{className:"h-full flex items-center justify-center text-text-muted",children:"No data available"}):r.jsx("div",{ref:m,className:"w-full h-full rounded-lg overflow-hidden",onMouseMove:z,onMouseLeave:H})}),tt=function(e){const t=be(e);return null===ye&&(ye=i()),ye?l(t):t};function st({sortedTypes:e,highlightedType:t,onTypeHover:s,aggregateShares:a,hoverData:l}){const i=n.useMemo(()=>{if(!l)return null;const e=new Map;for(const t of l.items)e.set(t.key,t.value);return e},[l]),o=null!==i;return r.jsx("div",{className:"flex-shrink-0 pt-3 mt-2",children:r.jsx("div",{className:"grid ml-9 gap-y-0.5",style:{gridTemplateColumns:"repeat(auto-fill, minmax(105px, 1fr))"},onMouseLeave:()=>s(null),children:e.map(e=>{const n=tt(e.typeNum),l=(null==i?void 0:i.get(e.key))??0,c=a.get(e.key)??0,C=o?l:c,A=C>1e-4,D=t===e.key,B=["legend-item",D&&"legend-item-active",(t&&!D||o&&l<=1e-4)&&"legend-item-dimmed",!t&&o&&l>1e-4&&"legend-item-chart-active"].filter(Boolean).join(" ");return r.jsxs("div",{className:B,onMouseEnter:()=>s(e.key),children:[r.jsx("div",{className:"flex-shrink-0",style:{backgroundColor:n,width:9,height:16,borderRadius:1}}),r.jsx("span",{className:"legend-label",children:e.label}),A&&r.jsxs("span",{className:"legend-value "+(o?"legend-value-live":""),children:[(100*C).toFixed(1),"%"]})]},e.key)})})})}const at='ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace';function nt({x:e,y:t,width:s,height:a,name:n,size:l,index:i,depth:o,hoveredIndex:c,onHover:C,total:A,typeNum:D}){if(1!==o)return null;const B=null!==c&&!(c===i),F=tt(D),E=A>0?l/A*100:0,m=s>36&&a>20,d=s>36&&a>32;return r.jsxs("g",{onMouseEnter:e=>C(i,e),onMouseLeave:()=>C(null),style:{cursor:"default"},children:[r.jsx("rect",{x:e,y:t,width:s,height:a,fill:F,opacity:B?.4:1,stroke:"rgba(0,0,0,0.2)",strokeWidth:1,rx:3,style:{transition:"opacity 150ms ease"}}),m&&r.jsxs(r.Fragment,{children:[d&&r.jsxs("text",{x:e+4,y:t+a-4-11,textAnchor:"start",dominantBaseline:"auto",fill:"rgba(0,0,0,0.6)",fontSize:8,fontFamily:at,fontWeight:500,style:{pointerEvents:"none"},children:[E.toFixed(1),"%"]}),r.jsx("text",{x:e+4,y:t+a-4,textAnchor:"start",dominantBaseline:"auto",fill:"rgba(0,0,0,0.85)",fontSize:9,fontFamily:at,fontWeight:600,style:{pointerEvents:"none"},children:n})]})]})}function rt({data:e,total:t,color:s,position:a,containerWidth:n}){if(!e||!a)return null;const l=(e.value/t*100).toFixed(1),i=n-a.x<184?Math.max(8,a.x-160-8):a.x+16;return r.jsx("div",{className:"absolute z-50 pointer-events-none",style:{left:i,top:Math.max(8,a.y-60)},children:r.jsxs("div",{className:"bg-tooltip-bg border border-border-subtle rounded-lg px-3 py-2 shadow-xl min-w-[140px]",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("span",{className:"w-2.5 h-2.5 rounded-sm flex-shrink-0",style:{backgroundColor:s}}),r.jsx("span",{className:"type-data-sm font-semibold text-text-primary",children:e.name})]}),r.jsxs("div",{className:"space-y-0.5 type-data-xs text-text-muted",children:[r.jsxs("div",{className:"flex justify-between gap-4",children:[r.jsx("span",{children:"Count"}),r.jsx("span",{className:"text-text-primary tabular-nums font-medium",children:e.value.toLocaleString()})]}),r.jsxs("div",{className:"flex justify-between gap-4",children:[r.jsx("span",{children:"Share"}),r.jsxs("span",{className:"text-text-primary tabular-nums font-medium",children:[l,"%"]})]}),r.jsxs("div",{className:"flex justify-between gap-4",children:[r.jsx("span",{children:"Total"}),r.jsx("span",{className:"text-text-primary tabular-nums font-medium",children:t.toLocaleString()})]})]})]})})}function lt({sortedTypes:e,aggregateShares:t}){var s,a,l;const[i,o]=n.useState(null),[c,C]=n.useState(null),[A,D]=n.useState(0),[B,F]=n.useState(null),E=n.useRef(null),m=n.useMemo(()=>e.reduce((e,t)=>e+t.totalCount,0),[e]),d=n.useMemo(()=>e.map((e,t)=>({name:e.label,size:e.totalCount,index:t,typeNum:e.typeNum,key:e.key})),[e]),u=n.useCallback((e,t)=>{if(o(e),t&&null!==e){const e=E.current;if(e){const s=e.getBoundingClientRect();D(s.width),C({x:t.clientX-s.left,y:t.clientY-s.top})}}else C(null)},[]),h=n.useCallback(e=>{if(F(e),e){const t=d.findIndex(t=>t.key===e);o(t>=0?t:null)}else o(null)},[d]),x=null!==i?{name:(null==(s=d[i])?void 0:s.name)??"",value:(null==(a=d[i])?void 0:a.size)??0}:null,p=null!==i?tt(null==(l=d[i])?void 0:l.typeNum):"";return 0===e.length||0===m?r.jsxs("div",{className:"h-full flex items-center justify-center text-text-muted",children:[r.jsx(G,{className:"w-6 h-6 mr-2 opacity-50"}),r.jsx("span",{children:"No packet type data available"})]}):r.jsxs("div",{className:"flex flex-col",children:[r.jsxs("div",{className:"analyzer-chart-height relative flex-shrink-0",ref:E,children:[r.jsx(Y,{width:"100%",height:"100%",children:r.jsx(U,{data:d,dataKey:"size",aspectRatio:4/3,stroke:"none",isAnimationActive:!1,content:r.jsx(nt,{x:0,y:0,width:0,height:0,name:"",size:0,index:0,depth:0,hoveredIndex:i,onHover:u,total:m,typeNum:0})})}),r.jsx(rt,{data:x,total:m,color:p,position:c,containerWidth:A})]}),r.jsx(st,{sortedTypes:e,highlightedType:B,onTypeHover:h,aggregateShares:t})]})}function it(e){return e>=1e9?`${(e/1e9).toFixed(1)} Gb`:e>=1e6?`${(e/1e6).toFixed(1)} Mb`:e>=1e3?`${(e/1e3).toFixed(1)} Kb`:`${e.toFixed(0)} B`}function ot({active:e,payload:t,label:s,mode:a}){if(!e||!t||0===t.length)return null;const n=t.filter(e=>null!==e.value&&void 0!==e.value);if(0===n.length)return null;const l=s?new Date(1e3*s).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}):"";return r.jsxs("div",{className:"bg-tooltip-bg border border-border-subtle rounded-lg px-3 py-2 text-sm shadow-xl",children:[r.jsx("div",{className:"font-medium text-text-primary mb-1 font-mono",children:l}),n.map((e,t)=>r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-3 h-0.5",style:{backgroundColor:e.color}}),r.jsxs("span",{className:"text-text-muted",children:[e.name,":"]}),r.jsx("span",{className:"text-text-primary tabular-nums font-mono",children:"share"===a?`${Number(e.value).toLocaleString()} B`:`${Number(e.value).toFixed(2)}%`})]},t))]})}function ct({packets:e,mode:t,startTs:s,endTs:a,radioConfig:l,bucketCount:i}){const o=H(),c=_(),C=o.primary,A=o.tertiary,[E,m]=n.useState(null),{trendData:d,totals:u}=n.useMemo(()=>{if(0===e.length)return{trendData:[],totals:{rxBytes:0,txBytes:0,rxAirtime:0,txAirtime:0}};const n=a-s,r=Math.min(Math.ceil(n/300),i),o=n/r,c=[];let C=0,A=0,F=0,E=0;for(const t of e){const e=t.timestamp;if(e=a)continue;const n=D(t),r=B(t,{spreadingFactor:l.sf,bandwidthHz:l.bw,codingRate:l.cr,preambleLength:l.preamble}),i={timestamp:e,rxAirtime:0,txAirtime:0,rxBytes:0,txBytes:0};t.transmitted?(i.txAirtime=r,i.txBytes=n,A+=n,E+=r):(i.rxAirtime=r,i.rxBytes=n,C+=n,F+=r),c.push(i)}c.sort((e,t)=>e.timestamp-t.timestamp);const m=new Float64Array(c.length+1),d=new Float64Array(c.length+1),u=new Float64Array(c.length+1),h=new Float64Array(c.length+1),x=new Float64Array(c.length);for(let e=0;e{let t=0,s=x.length;for(;t>>1;x[a]0?e:null,tx:t>0?t:null})}else{const e=(m[l]-m[r])/f*100,t=(d[l]-d[r])/f*100;g.push({timestamp:a,rx:e>0?e:null,tx:t>0?t:null})}}const y=2/31;let b=null;return{trendData:g.map(e=>{const t=e.rx;return null!==t&&t>0&&(b=null===b?t:y*t+(1-y)*b),{...e,rxSmooth:null!==b&&b>0?b:null}}),totals:{rxBytes:C,txBytes:A,rxAirtime:F,txAirtime:E}}},[e,s,a,i,t,l]),h=n.useMemo(()=>{if(0===d.length)return"share"===t?100:10;let e=0;for(const t of d){const s=t.rx??0,a=t.tx??0;s>e&&(e=s),a>e&&(e=a)}const s=1.1*e;return"share"===t?s<=100?100:s<=500?100*Math.ceil(s/100):s<=1e3?200*Math.ceil(s/200):s<=5e3?500*Math.ceil(s/500):s<=1e4?1e3*Math.ceil(s/1e3):5e3*Math.ceil(s/5e3):Math.max(1,Math.ceil(s))},[d,t]),x=n.useMemo(()=>{if(null!==E&&d[E]){const e=d[E],s=e.rx??0,a=e.tx??0;return"share"===t?{rx:it(s),tx:it(a),total:it(s+a),isHovered:!0}:{rx:`${s.toFixed(2)}%`,tx:`${a.toFixed(2)}%`,total:`${(s+a).toFixed(2)}%`,isHovered:!0}}if("share"===t)return{rx:it(u.rxBytes),tx:it(u.txBytes),total:it(u.rxBytes+u.txBytes),isHovered:!1};{let e=0,t=0,s=0;for(const r of d)null===r.rx&&null===r.tx||(e+=r.rx??0,t+=r.tx??0,s++);const a=s>0?e/s:0,n=s>0?t/s:0;return{rx:`${a.toFixed(2)}%`,tx:`${n.toFixed(2)}%`,total:`${(a+n).toFixed(2)}%`,isHovered:!1}}},[E,d,u,t]),p=n.useMemo(()=>{const e=a-s,t=e/3600;return[0,.25,.5,.75,1].map(a=>{const n=new Date(1e3*(s+e*a)),r=n.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}),l=n.toLocaleDateString([],{weekday:"short"});return{pct:a,label:t>24?`${l} ${r}`:r,mobileHidden:.25===a||.75===a}})},[s,a]),g=n.useCallback(e=>{const t=null==e?void 0:e.activeTooltipIndex;m("number"==typeof t?t:null)},[]),f=n.useCallback(e=>"share"===t?e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(0)}K`:e.toFixed(0):`${e.toFixed(0)}%`,[t]);return 0===d.length?r.jsxs("div",{className:"h-full flex items-center justify-center text-text-muted",children:[r.jsx(G,{className:"w-6 h-6 mr-2 opacity-50"}),r.jsx("span",{children:"No packet data available"})]}):r.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[r.jsx("div",{className:"flex items-center flex-shrink-0 text-text-secondary",style:{height:20,paddingLeft:44,paddingRight:8},children:r.jsx("div",{className:"relative w-full h-full flex items-center",children:p.map((e,t)=>r.jsxs("div",{className:"absolute flex items-center gap-0.5 sm:gap-1 type-data-xs "+(e.mobileHidden?"hidden sm:flex":""),style:{left:100*e.pct+"%",transform:0===e.pct?"translateX(0)":1===e.pct?"translateX(-100%)":"translateX(-50%)"},children:[r.jsx(F,{className:"w-2.5 h-2.5 opacity-60 hidden sm:block"}),r.jsx("span",{className:"tabular-nums",children:e.label})]},t))})}),r.jsx("div",{className:"flex-1 min-h-0 relative overflow-hidden",children:r.jsx(Y,{width:"100%",height:"100%",minWidth:1,minHeight:1,children:r.jsxs(Q,{data:d,margin:{top:4,right:8,bottom:4,left:0},onMouseMove:g,onMouseLeave:()=>m(null),children:[r.jsx(Z,{strokeDasharray:"3 3",stroke:c.secondary,strokeOpacity:.3,vertical:!1}),r.jsx(J,{dataKey:"timestamp",type:"number",domain:[s,a],axisLine:!1,tickLine:!1,tick:!1,height:0}),r.jsx(ee,{axisLine:!1,tickLine:!1,tick:{fill:c.secondary,fontSize:10,fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace'},dx:-8,width:44,tickFormatter:f,domain:[0,h]}),r.jsx(te,{content:r.jsx(ot,{mode:t})}),r.jsx(se,{type:"linear",dataKey:"rx",name:"RX",stroke:C,strokeWidth:2.5,strokeOpacity:.9,dot:!1,connectNulls:!1,isAnimationActive:!1}),r.jsx(se,{type:"linear",dataKey:"tx",name:"TX",stroke:A,strokeWidth:2.5,strokeOpacity:.9,dot:!1,connectNulls:!1,isAnimationActive:!1}),r.jsx(se,{type:"basis",dataKey:"rxSmooth",name:"RX Avg",stroke:"var(--sys-brown)",strokeWidth:2,strokeOpacity:1,dot:!1,connectNulls:!0,isAnimationActive:!1})]})})}),r.jsxs("div",{className:"flex-shrink-0 flex items-center justify-between mt-1.5 sm:mt-2",children:[r.jsxs("div",{className:"flex items-center gap-2 sm:gap-4 text-xs font-mono pl-2 sm:pl-11",children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("div",{className:"w-3 sm:w-4 h-0.5",style:{backgroundColor:C}}),r.jsx("span",{className:"text-text-secondary",children:"RX"})]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("div",{className:"w-3 sm:w-4 h-0.5",style:{backgroundColor:A}}),r.jsx("span",{className:"text-text-secondary",children:"TX"})]}),r.jsxs("div",{className:"hidden sm:flex items-center gap-1.5",children:[r.jsx("div",{className:"w-4 h-0.5",style:{backgroundColor:"var(--sys-brown)"}}),r.jsx("span",{className:"text-text-secondary",children:"Avg"})]})]}),r.jsxs("div",{className:"flex items-center gap-2 sm:gap-4 text-right pr-1 sm:pr-2 font-mono",children:[r.jsxs("div",{className:"flex items-center gap-1 sm:gap-1.5",children:[r.jsx("span",{className:"text-xs font-medium",style:{color:C},children:"RX"}),r.jsx("span",{className:"font-bold text-lg sm:text-xl text-text-primary",children:x.rx})]}),r.jsxs("div",{className:"flex items-center gap-1 sm:gap-1.5",children:[r.jsx("span",{className:"text-xs font-medium",style:{color:A},children:"TX"}),r.jsx("span",{className:"font-bold text-lg sm:text-xl text-text-primary",children:x.tx})]}),x.isHovered&&r.jsx("span",{className:"text-xs text-text-muted hidden sm:inline",children:"bucket"})]})]})]})}function Ct(e){const{values:t,sum:s}=e;if(0===t.length)return{min:0,mean:0,median:0,p75:0,p95:0,p99:0,max:0};const a=[...t].sort((e,t)=>e-t),n=a.length,r=s/n,l=a[0],i=a[n-1],o=e=>{const t=Math.min(Math.ceil(e*n)-1,n-1);return a[Math.max(0,t)]};return{min:l,mean:r,median:n%2==0?(a[n/2-1]+a[n/2])/2:a[Math.floor(n/2)],p75:o(.75),p95:o(.95),p99:o(.99),max:i}}function At({statsBuckets:e,mode:t,packets:s,startTs:a,endTs:l,radioConfig:i,sortedTypes:o,aggregateShares:c,noiseFloorAnomalies:C,showNoiseFloorOverlay:A,overlayOpacity:F=.5}){const[E,m]=n.useState(null),[d,u]=n.useState(null),h=n.useMemo(()=>(l-a)/3600,[a,l]),x=n.useCallback(e=>{u(e)},[]),p=function(e,t,s,a,r){return n.useMemo(()=>{if(0===e.length||!r)return null;const n=e.filter(e=>e.timestamp>=t&&e.timestamp<=s);if(0===n.length)return null;const l=[],i=new Map;for(const e of n){const s=e.type??e.payload_type??-1,n=D(e);let o;if(o="airtime"===a?B(e,{spreadingFactor:r.sf,bandwidthHz:r.bw,codingRate:r.cr,preambleLength:r.preamble}):1,n<=0)continue;const c=Math.floor((e.timestamp-t)/300),C={timestamp:e.timestamp,airtimeMs:o,byteSize:n,packetType:s,bucketIndex:c};l.push(C),i.has(c)||i.set(c,[]),i.get(c).push(C)}if(0===l.length)return null;const o=[],c=[],C=[],A=new Map;if("share"===a)for(const[,e]of i)for(const t of e)A.set(t,t.byteSize);else for(const[,e]of i){const t=e.reduce((e,t)=>e+t.airtimeMs,0)/3e5*100;let s=0;for(const a of e)a.airtimeMs>s&&(s=a.airtimeMs);for(const a of e){const e=a.airtimeMs/s*t;A.set(a,e)}}for(const e of l){const t=A.get(e);void 0!==t&&(o.push(t),c.push(e.timestamp),C.push(e.packetType))}let F=c[0],E=c[0];for(let e=1;eE&&(E=c[e]);const m=E-F||1,d=[...o].sort((e,t)=>e-t),u=d[0],h=d[d.length-1],x=Math.floor(.05*d.length),p=Math.floor(.5*d.length),g=Math.min(Math.ceil(.95*d.length),d.length-1),f=d[x],y=d[p],b=d[g],v=new Map;for(const e of o){const t=Math.round(100*e)/100;v.set(t,(v.get(t)??0)+1)}const j=v.size,k=[...v.entries()].sort((e,t)=>t[1]-e[1]).slice(0,5).map(([e,t])=>({value:e,count:t,percent:t/o.length*100}));let N;if("share"===a)N=200;else{const e=5,t=Math.ceil(h/e)*e;N=t<=10?10:t+e}const w=new Float32Array(2*o.length),M=new Float32Array(o.length),S=new Uint8Array(o.length),T=new Float32Array(o.length);for(let e=0;e=0?C[e]:255,T[e]=c[e]}return{points:w,rawValues:M,packetTypes:S,timestamps:T,count:o.length,minTime:F,maxTime:E,minValue:0,maxValue:N,rawMinValue:u,rawMaxValue:h,unit:"%",stats:{p5:f,p50:y,p95:b,uniqueValues:j,topValues:k}}},[e,t,s,a,r])}(s,a,l,"share"===t?"share":"airtime",i),{data:g}=n.useMemo(()=>function(e,t){var s;const a=e.length;if(0===a)return{data:[],windowSize:0,windowDurationMs:0};const n=(null==(s=e[0])?void 0:s.bucketDurationMs)??1e3,r=Math.min(Math.max(5,Math.round(3e5/n)),a),l=Math.floor(r/2),i=[];let o=0,c=0;for(let C=0;Cg.map(e=>({timestamp:e.timestamp,min:e.min,max:e.max,p75:e.p75,p95:e.p95,p99:e.p99,mean:e.mean,median:e.median,average:e.average,midpoint:e.midpoint})),[g]),y=n.useMemo(()=>(null==p?void 0:p.maxValue)?p.maxValue:"share"===t?200:10,[p,t]),b=n.useCallback(e=>{m(e)},[]),v=n.useMemo(()=>{if(null===E||!g[E])return null;const e=g[E];let t;t=h>=168?75:h>=72?35:h>=24?15:h>=3?10:5;const s=60*t/2,a=e.timestamp;return{start:a-s,end:a+s}},[E,g,h]),j=n.useMemo(()=>{if(null===E||!g[E]||!v)return null;const e=g[E].time,{start:a,end:n}=v,r=s.filter(e=>e.timestamp>=a&&e.timestamp({key:e.key,label:e.label,value:0,color:tt(e.typeNum)}))};const l=new Map,c=new Map;let C=0,A=0;for(const t of r){const e=`TYPE_${t.type??t.payload_type??-1}`;if(l.set(e,(l.get(e)??0)+1),C++,i){const s=B(t,{spreadingFactor:i.sf,bandwidthHz:i.bw,codingRate:i.cr,preambleLength:i.preamble});c.set(e,(c.get(e)??0)+s),A+=s}}const D=o.map(e=>{let s;return s="airtime"===t?A>0?(c.get(e.key)??0)/A:0:C>0?(l.get(e.key)??0)/C:0,{key:e.key,label:e.label,value:s,color:tt(e.typeNum)}});return{timestamp:g[E].timestamp,timeLabel:e,items:D}},[E,g,v,s,o,t,i]);if(0===g.length)return r.jsxs("div",{className:"h-full flex items-center justify-center text-text-muted",children:[r.jsx(G,{className:"w-6 h-6 mr-2 opacity-50"}),r.jsx("span",{children:"No packet data available"})]});const k=(null==j?void 0:j.timeLabel)??null;return r.jsxs("div",{className:"flex flex-col",children:[r.jsxs("div",{className:"analyzer-chart-height relative flex-shrink-0",children:[r.jsx("div",{className:"absolute inset-0 rounded-lg overflow-hidden",children:r.jsx(et,{data:f,maxValue:y,onHover:b,scatterData:p,noiseFloorAnomalies:C,showNoiseFloorOverlay:A,overlayOpacity:F,highlightedType:d,hoveredTimeRange:v,timeRangeHours:h,yAxisMode:"share"===t?"share":"airtime"})}),k&&r.jsx("div",{className:"absolute top-1 right-1 px-2 py-0.5 bg-bg-elevated/90 rounded text-xs text-accent-secondary font-mono pointer-events-none",children:k})]}),r.jsx(st,{sortedTypes:o,highlightedType:d,onTypeHover:x,aggregateShares:c,hoverData:j})]})}const Dt=new class{constructor(){a(this,"buckets",new Map),a(this,"lastProcessedTimestamp",0),a(this,"processedPacketCount",0),a(this,"cacheKey",null),a(this,"bucketDuration",60),a(this,"bucketDurationMs",6e4)}getBuckets(e,t,s,a){const n={startTs:t,endTs:s,radioConfigHash:this.hashRadioConfig(a)};return this.isCacheValid(n)?this.processPackets(e,t,s,a,!1):(this.invalidate(n),this.processPackets(e,t,s,a,!0)),this.toBucketDataArray(t,s)}processPackets(e,t,s,a,n){const r=Math.ceil((s-t)/this.bucketDuration);let l=0;for(const i of e){const e=i.timestamp;if(e=s)continue;if(!n&&e<=this.lastProcessedTimestamp)continue;const o=Math.min(Math.floor((e-t)/this.bucketDuration),r-1),c=this.buckets.get(o)??{total:0,totalAirtime:0};c.total+=1,c.totalAirtime+=B(i,{spreadingFactor:a.sf,bandwidthHz:a.bw,codingRate:a.cr,preambleLength:a.preamble}),this.buckets.set(o,c),e>this.lastProcessedTimestamp&&(this.lastProcessedTimestamp=e),l++}this.processedPacketCount+=l}toBucketDataArray(e,t){const s=t-e,a=Math.ceil(s/this.bucketDuration),n=s/3600,r=[];for(let l=0;l24?s.toLocaleDateString([],{weekday:"short",hour:"2-digit",minute:"2-digit",hour12:!1}):s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}),i=this.buckets.get(l)??{total:0,totalAirtime:0};r.push({timestamp:t,time:a,total:i.total,totalAirtime:i.totalAirtime,bucketDurationMs:this.bucketDurationMs})}return r}isCacheValid(e){return!!this.cacheKey&&this.cacheKey.startTs===e.startTs&&this.cacheKey.endTs===e.endTs&&this.cacheKey.radioConfigHash===e.radioConfigHash}invalidate(e){this.buckets.clear(),this.lastProcessedTimestamp=0,this.processedPacketCount=0,this.cacheKey=e}hashRadioConfig(e){return`${e.sf}-${e.bw}-${e.cr}-${e.preamble}`}clear(){this.buckets.clear(),this.lastProcessedTimestamp=0,this.processedPacketCount=0,this.cacheKey=null}getStats(){return{bucketCount:this.buckets.size,processedPackets:this.processedPacketCount,lastTimestamp:this.lastProcessedTimestamp,cacheKey:this.cacheKey}}};function Bt({mode:e,onChange:t}){return r.jsxs("div",{className:"toggle-group toggle-group-sm",children:[r.jsx("button",{onClick:()=>t("share"),className:"toggle-group-item "+("share"===e?"active":""),children:"Total"}),r.jsx("button",{onClick:()=>t("airtime"),className:"toggle-group-item "+("airtime"===e?"active":""),children:"Airtime"})]})}function Ft({smoothing:e,onChange:t}){return r.jsxs("div",{className:"toggle-group toggle-group-sm",children:[r.jsx("button",{onClick:()=>t("stats"),className:"toggle-group-item "+("stats"===e?"active":""),title:"Statistics view (scatter plot)",children:r.jsx(Re,{className:"w-3.5 h-3.5"})}),r.jsx("button",{onClick:()=>t("trend"),className:"toggle-group-item "+("trend"===e?"active":""),title:"Trend line chart",children:r.jsx(je,{className:"w-3.5 h-3.5"})}),r.jsx("button",{onClick:()=>t("raw"),className:"toggle-group-item "+("raw"===e?"active":""),title:"No smoothing (raw values)",children:r.jsx(Me,{className:"w-3.5 h-3.5"})}),r.jsx("button",{onClick:()=>t("zlema"),className:"toggle-group-item "+("zlema"===e?"active":""),title:"Light smoothing",children:r.jsx(we,{className:"w-3.5 h-3.5"})}),r.jsx("button",{onClick:()=>t("ema"),className:"toggle-group-item "+("ema"===e?"active":""),title:"Moderate smoothing",children:r.jsx(Ne,{className:"w-3.5 h-3.5"})}),r.jsx("button",{onClick:()=>t("smooth"),className:"toggle-group-item "+("smooth"===e?"active":""),title:"Heavy smoothing",children:r.jsx(_e,{className:"w-3.5 h-3.5"})}),r.jsx("button",{onClick:()=>t("ultra"),className:"toggle-group-item "+("ultra"===e?"active":""),title:"Ultra smoothing",children:r.jsx(Oe,{className:"w-3.5 h-3.5"})}),r.jsx("button",{onClick:()=>t("mosaic"),className:"toggle-group-item "+("mosaic"===e?"active":""),title:"Mosaic view (treemap)",children:r.jsx(Te,{className:"w-3.5 h-3.5"})})]})}function Et({enabled:e,onChange:t,anomalyCount:s=0,showTuning:a=!1,onTuningChange:n}){return r.jsxs("div",{className:"relative inline-flex items-center gap-1",children:[e&&n&&r.jsx("button",{onClick:()=>n(!a),className:"toggle-group toggle-group-sm "+(a?"active":""),title:a?"Hide tuning panel":"Show tuning panel",children:r.jsx("span",{className:"toggle-group-item "+(a?"active":""),children:r.jsx(Le,{className:"w-3.5 h-3.5"})})}),r.jsx("button",{onClick:()=>t(!e),className:"toggle-group toggle-group-sm "+(e?"active":""),title:e?"Hide noise floor anomalies":"Show noise floor anomalies",children:r.jsx("span",{className:"toggle-group-item "+(e?"active":""),children:r.jsx(ne,{className:"w-3.5 h-3.5"})})}),s>0&&r.jsx("span",{className:"absolute -top-2 -right-2 min-w-[18px] h-[18px] px-1 rounded-full bg-accent-danger text-white text-[10px] font-bold flex items-center justify-center pointer-events-none z-10",children:s>99?"99+":s})]})}const mt={sf:10,bw:25e4,cr:5,preamble:8};function dt(e){return m[e]??`TYPE_${e.toString(16).toUpperCase()}`}function ut(e,t){if(0===e.length)return[];const s=Math.floor((t-1)/2),a=[];for(let n=0;n=s?e[n-s]:e[0];a.push(e[n]+(e[n]-t))}return function(e,t){if(0===e.length)return[];const s=2/(t+1),a=[e[0]];for(let n=1;n{const t=Math.abs(e.length-g.current);if(0===t&&h.length>0)return;p.current&&clearTimeout(p.current);const s=t>100?50:500;return p.current=setTimeout(()=>{g.current=e.length,x(e)},s),()=>{p.current&&clearTimeout(p.current)}},[e,h.length]);const f=n.useMemo(()=>function(e,t){const s=new Map;for(const n of e){const e=n.type??n.payload_type??-1,a=B(n,{spreadingFactor:t.sf,bandwidthHz:t.bw,codingRate:t.cr,preambleLength:t.preamble}),r=s.get(e)??{count:0,airtime:0};s.set(e,{count:r.count+1,airtime:r.airtime+a})}const a=[];for(const[n,r]of s)a.push({typeNum:n,key:`TYPE_${n}`,label:dt(n),totalCount:r.count,totalAirtime:r.airtime});return a.sort((e,t)=>t.totalCount-e.totalCount)}(h,l),[h,l]),y=n.useMemo(()=>function(e,t,s,a,n,r){const l=s-t,i=l/a,o=1e3*i,c=l/3600,C=[];for(let A=0;A24?s.toLocaleDateString([],{weekday:"short",hour:"2-digit",minute:"2-digit",hour12:!1}):s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}),counts:{},shares:{},airtimes:{},total:0,totalAirtime:0,bucketDurationMs:o};for(const t of r)a.counts[t.key]=0,a.airtimes[t.key]=0;C.push(a)}for(const A of e){const e=A.timestamp;if(e=s)continue;const r=Math.min(Math.floor((e-t)/i),a-1),l=`TYPE_${A.type??A.payload_type??-1}`;C[r].counts[l]=(C[r].counts[l]??0)+1,C[r].total++;const o=B(A,{spreadingFactor:n.sf,bandwidthHz:n.bw,codingRate:n.cr,preambleLength:n.preamble});C[r].airtimes[l]=(C[r].airtimes[l]??0)+o,C[r].totalAirtime+=o}for(const A of C)for(const e of r)A.shares[e.key]=A.total>0?A.counts[e.key]/A.total*100:0;return C}(h,t,s,a,l,f),[h,t,s,a,l,f]),b=n.useMemo(()=>Dt.getBuckets(h,t,s,l),[h,t,s,l]),v=n.useMemo(()=>f.reduce((e,t)=>e+t.totalCount,0),[f]),j=n.useMemo(()=>f.reduce((e,t)=>e+t.totalAirtime,0),[f]),{sortedTypes:k,aggregateShares:N}=n.useMemo(()=>{const e=new Map,t="share"===i?v:j;if(t>0)for(const s of f){const a="share"===i?s.totalCount:s.totalAirtime;e.set(s.key,a/t)}return{sortedTypes:[...f].sort((t,s)=>(e.get(s.key)??0)-(e.get(t.key)??0)),aggregateShares:e}},[f,v,j,i]),w=n.useMemo(()=>function(e,t,s,a="raw"){const n=function(e,t,s){if(e.length<=360)return e;const a=Math.ceil(e.length/360),n=[];for(let r=0;r0?l.counts[e.key]/l.total*100:0;n.push(l)}return n}(e,0,s),r=n.length,l=s.length,i=Array.from({length:l},()=>new Array(r).fill(0));for(let D=0;D0?(e.counts[s[t].key]??0)/e.total:0;else{let t=0;for(let a=0;a0?(e.airtimes[s[a].key]??0)/t:0}}const o=Array.from({length:l},()=>new Array(r).fill(0));for(let D=0;Dfunction(e,t){switch(t){case"zlema":return ut(e,6);case"ema":return ut(e,12);case"smooth":return ut(e,24);case"ultra":return ut(e,96);default:return e}}(e,a)),C=Array.from({length:l},()=>new Array(r).fill(0));for(let D=0;D0?c[D-1][e]:0;C[D][e]=Math.min(1,Math.max(0,c[D][e]-t))}for(let D=0;D0&&Math.abs(e-1)>1e-6){const t=1/e;for(let e=0;em(e),[]),S=n.useCallback(e=>u(e),[]),T=n.useMemo(()=>{if(null===d||!w[d])return null;const e=w[d];return{timestamp:e.timestamp,timeLabel:e.time,items:k.map(t=>({key:t.key,label:t.label,value:e[t.key]??0,color:tt(t.typeNum)}))}},[d,w,k]),R=n.useMemo(()=>({timestamps:w.map(e=>e.timestamp),series:k.map(e=>({key:e.key,label:e.label,color:tt(e.typeNum),values:w.map(t=>t[e.key]??0)}))}),[w,k]);return 0===h.length?0===e.length?r.jsxs("div",{className:"h-full flex items-center justify-center text-text-muted",children:[r.jsx(G,{className:"w-6 h-6 mr-2 opacity-50"}),r.jsx("span",{children:"No packet data available"})]}):null:"mosaic"===o?r.jsx(lt,{sortedTypes:k,aggregateShares:N}):"stats"===o?r.jsx(At,{statsBuckets:b,mode:i,packets:h,startTs:t,endTs:s,radioConfig:l,sortedTypes:k,aggregateShares:N,noiseFloorAnomalies:c,showNoiseFloorOverlay:C,overlayOpacity:A}):"trend"===o?r.jsx(ct,{packets:h,mode:i,startTs:t,endTs:s,radioConfig:l,bucketCount:a}):r.jsxs("div",{className:"flex flex-col",children:[r.jsx("div",{className:"analyzer-chart-height relative flex-shrink-0",children:r.jsx("div",{className:"absolute inset-0 rounded-lg overflow-hidden",children:r.jsx(E,{timestamps:R.timestamps,series:R.series,highlightedKey:F,cursorColor:D.cursor,onHover:S})})}),r.jsx(st,{sortedTypes:k,highlightedType:F,onTypeHover:M,aggregateShares:N,hoverData:T})]})}),xt={"1x":1,"2x":2,"4x":4,"8x":8,"16x":16,"36x":36},pt=[1,5,10,25,50,100,150];function gt(e,t,s,a){const n=Math.PI/180,r=(a-t)*n,l=e*n,i=s*n,o=Math.sin(r)*Math.cos(i),c=Math.cos(l)*Math.sin(i)-Math.sin(l)*Math.cos(i)*Math.cos(r);return(180*Math.atan2(o,c)/Math.PI+360)%360}function ft(e,t,s,a){const n=Math.PI/180,r=(s-e)*n,l=(a-t)*n,i=Math.sin(r/2)**2+Math.cos(e*n)*Math.cos(s*n)*Math.sin(l/2)**2;return 12742*Math.atan2(Math.sqrt(i),Math.sqrt(1-i))}const yt=[{min:10,label:"Excellent"},{min:7,label:"Very Good"},{min:4,label:"Good"},{min:1,label:"Fair+"},{min:-2,label:"Fair"},{min:-5,label:"Fair-"},{min:-8,label:"Poor"},{min:-11,label:"Bad"},{min:-1/0,label:"Critical"}];function bt(e,t){return t[q(e)]||"#808080"}const vt=n.memo(function({neighbors:e,quickNeighbors:t,localLat:s,localLon:a,onStatsChange:l}){const[i,o]=n.useState(null),[c,C]=n.useState(new Set),[A,D]=n.useState({width:0,height:0}),[B,F]=n.useState("1x"),[E,m]=n.useState(1),u=n.useRef(null),h=n.useRef({}),x=n.useRef(null),p=n.useRef(null),g=n.useRef(E);g.current=E;const f=I(),y=H(),b=W(),v=_(),j=V(),k=j?v.secondary:v.primary,N=j?.4:.15,w=j?.25:.08,M=j?v.primary:y.primary;n.useEffect(()=>{const e=p.current;if(!e)return;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:s}=t.contentRect;e>0&&s>0&&D({width:e,height:s})}});t.observe(e);const s=e.getBoundingClientRect();return s.width>0&&s.height>0&&D({width:s.width,height:s.height}),()=>t.disconnect()},[]);const S=n.useMemo(()=>{const e=new Set;if(t)for(const s of t)e.add(s.hash);return e},[t]),T=n.useMemo(()=>{const e=new Map;if(t)for(const s of t)e.set(s.hash,{snr:s.avgSnr,rssi:s.avgRssi});return e},[t]),{processedNeighbors:R,maxDistance:P,totalNeighbors:$,zeroHopCount:L}=n.useMemo(()=>{const t=[];for(const[r,l]of Object.entries(e)){if(!l.latitude||!l.longitude||0===l.latitude||0===l.longitude)continue;if(!S.has(r))continue;const e=gt(s,a,l.latitude,l.longitude),n=ft(s,a,l.latitude,l.longitude),i=T.get(r);t.push({hash:r.slice(0,8),name:l.node_name||l.name||"Unknown",snr:(null==i?void 0:i.snr)??l.snr??null,rssi:(null==i?void 0:i.rssi)??l.rssi??null,bearing:e,distance:n,normalizedDistance:0,lastSeen:l.last_seen,isZeroHop:!0})}const n=1.08*(t.length>0?Math.max(...t.map(e=>e.distance)):0);return t.sort((e,t)=>(e.snr??-1/0)-(t.snr??-1/0)),{processedNeighbors:t,maxDistance:n,totalNeighbors:t.length,zeroHopCount:t.length}},[e,s,a,S,T]);n.useEffect(()=>{null==l||l({zeroHopCount:L,totalCount:$,maxDistanceKm:P})},[L,$,P]),n.useEffect(()=>{const e=xt[B],t=g.current;u.current&&cancelAnimationFrame(u.current);const s=performance.now(),a=n=>{const r=n-s,l=Math.min(r/400,1),i=(o=l)<.5?8*o*o*o*o:1-Math.pow(-2*o+2,4)/2;var o;m(t+(e-t)*i),u.current=l<1?requestAnimationFrame(a):null};return u.current=requestAnimationFrame(a),()=>{u.current&&cancelAnimationFrame(u.current)}},[B]);const z=P/E,O=n.useMemo(()=>pt.filter(e=>e<=1.1*z),[z]);n.useEffect(()=>{const e=[];for(const s of R){const t=h.current[s.hash];void 0!==t&&t!==s.lastSeen&&e.push(s.hash),h.current[s.hash]=s.lastSeen}if(0===e.length)return;queueMicrotask(()=>{C(t=>new Set([...t,...e]))});const t=setTimeout(()=>{C(t=>{const s=new Set(t);return e.forEach(e=>s.delete(e)),s})},600);return()=>clearTimeout(t)},[R]);const q=0!==s&&0!==a,G=n.useMemo(()=>{const{width:e,height:t}=A,s=e/2,a=t/2,n=Math.max(10,e/2-12),r=Math.max(10,t/2-12),l=Math.max(10,n-16),i=Math.max(10,r-16);return{width:e,height:t,centerX:s,centerY:a,maxRadiusX:l,maxRadiusY:i,labelRadiusX:n,labelRadiusY:r,cornerRadius:.2*Math.min(l,i)}},[A]),{width:X,height:K,centerX:Y,centerY:U,maxRadiusX:Q,maxRadiusY:Z,labelRadiusX:J,labelRadiusY:ee,cornerRadius:te}=G,se=n.useCallback((e,t=1)=>{const s=Q*t,a=Z*t,n=Math.min(te*t,s,a),r=(e%360+360)%360,l=r*Math.PI/180,i=180*Math.atan2(a-n,s-n)/Math.PI;let o,c;if(r<=45-i||r>315+i){const e=Math.tan(l);o=Math.max(Y-s+n,Math.min(Y+s-n,Y+a*e*(s/a))),c=U-a}else if(r>45-i&&r<=45+i)o=Y+s-n+n*Math.sin(l),c=U-a+n-n*Math.cos(l);else if(r>45+i&&r<=135-i){const e=1/Math.tan(l);c=Math.max(U-a+n,Math.min(U+a-n,U-s*e*(a/s))),o=Y+s}else if(r>135-i&&r<=135+i)o=Y+s-n+n*Math.sin(l),c=U+a-n-n*Math.cos(l);else if(r>135+i&&r<=225-i){const e=Math.tan(l);o=Math.max(Y-s+n,Math.min(Y+s-n,Y-a*e*(s/a))),c=U+a}else if(r>225-i&&r<=225+i)o=Y-s+n+n*Math.sin(l),c=U+a-n-n*Math.cos(l);else if(r>225+i&&r<=315-i){const e=1/Math.tan(l);c=Math.max(U-a+n,Math.min(U+a-n,U-s*e*(a/s))),o=Y-s}else o=Y-s+n+n*Math.sin(l),c=U-a+n-n*Math.cos(l);return{x:o,y:c}},[Y,U,Q,Z,te]),ne=n.useCallback((e,t)=>{const s=se(e,1);return{x:Y+(s.x-Y)*t,y:U+(s.y-U)*t}},[se,Y,U]),re=n.useCallback(e=>({N:{x:Y,y:U-ee},S:{x:Y,y:U+ee},E:{x:Y+J,y:U},W:{x:Y-J,y:U},NE:{x:Y+J,y:U-ee},SE:{x:Y+J,y:U+ee},SW:{x:Y-J,y:U+ee},NW:{x:Y-J,y:U-ee}}[e]),[Y,U,J,ee]),le=n.useCallback(e=>{const t=Q*e,s=Z*e,a=Math.min(te*e,t,s),n=Y-t,r=Y+t,l=U-s,i=U+s;return[`M ${n+a} ${l}`,`L ${r-a} ${l}`,`Q ${r} ${l} ${r} ${l+a}`,`L ${r} ${i-a}`,`Q ${r} ${i} ${r-a} ${i}`,`L ${n+a} ${i}`,`Q ${n} ${i} ${n} ${i-a}`,`L ${n} ${l+a}`,`Q ${n} ${l} ${n+a} ${l}`,"Z"].join(" ")},[Y,U,Q,Z,te]),ie=n.useCallback(e=>{o(e)},[]),oe=n.useCallback(e=>{F(e)},[]),ce=n.useCallback(e=>P<=0?0:e/P*E,[P,E]),Ce=e=>`${e}km`,Ae=n.useMemo(()=>{const e=O.map(e=>{const t=e/P*E;return{km:e,scale:t,labelY:U-Z*t*.71}}).filter(e=>e.scale<=1.05&&e.scale>=.02).sort((e,t)=>t.km-e.km),t=[];for(const s of e)t.some(e=>Math.abs(e.labelY-s.labelY)<28)||t.push(s);return t},[O,P,E,U,Z]),De=A.width>0&&A.height>0;return q?0===$?r.jsxs("div",{ref:x,className:"flex flex-col items-center justify-center h-full text-text-secondary",children:[r.jsx(ae,{className:"w-8 h-8 mb-2 opacity-50"}),r.jsx("p",{children:"No nodes with location data"})]}):r.jsxs("div",{ref:x,className:"relative h-full w-full flex overflow-hidden",children:[r.jsx("div",{ref:p,className:"relative flex-1 min-w-0 h-full",children:De&&r.jsxs("svg",{width:X,height:K,className:"absolute inset-0 z-0",children:[r.jsxs("defs",{children:[r.jsx("style",{children:"\n @keyframes neighbor-blink-scale {\n 0%, 100% {\n transform: scale(1);\n opacity: 0;\n }\n 50% {\n transform: scale(1.3);\n opacity: 0.8;\n }\n }\n .neighbor-blink-ring {\n transform-origin: center;\n animation: neighbor-blink-scale 600ms ease-out forwards;\n }\n "}),r.jsx("clipPath",{id:"radar-clip",children:r.jsx("path",{d:le(1)})})]}),O.map(e=>{const t=ce(e);if(t>1.05||t<.02)return null;const s=Ae.some(t=>t.km===e),a=Y+Q*t*.71,n=U-Z*t*.71;return r.jsxs("g",{children:[r.jsx("path",{d:le(t),fill:"none",stroke:k,strokeOpacity:N,strokeWidth:1}),s&&r.jsx("text",{x:a+4,y:n-2,textAnchor:"start",dominantBaseline:"auto",className:"fill-text-secondary",fontSize:10,fontFamily:d,children:Ce(e)})]},`ring-${e}`)}),["N","E","S","W"].map(e=>{const t="N"===e||"S"===e,s=t?Y:"E"===e?Y+Q:Y-Q,a=t?"N"===e?U-Z:U+Z:U;return r.jsx("line",{x1:Y,y1:U,x2:s,y2:a,stroke:k,strokeOpacity:N,strokeWidth:1,strokeDasharray:"4 4"},e)}),["NE","SE","SW","NW"].map(e=>{const t=re(e);return r.jsx("line",{x1:Y,y1:U,x2:t.x,y2:t.y,stroke:k,strokeOpacity:w,strokeWidth:1,strokeDasharray:"4 4"},`diag-${e}`)}),["N","E","S","W"].map(e=>{const t=re(e),s="E"===e?"end":"W"===e?"start":"middle",a="N"===e?"hanging":"S"===e?"auto":"middle";return r.jsx("text",{x:t.x,y:t.y,textAnchor:s,dominantBaseline:a,fill:M,fontSize:16,fontWeight:600,fontFamily:d,"aria-hidden":"true",children:e},e)}),["NE","SE","SW","NW"].map(e=>{const t=re(e),s="NE"===e||"SE"===e?"end":"start",a="NE"===e||"NW"===e?"hanging":"auto";return r.jsx("text",{x:t.x,y:t.y,textAnchor:s,dominantBaseline:a,fill:M,fontSize:16,fontWeight:600,fontFamily:d,"aria-hidden":"true",children:e},e)}),r.jsx("circle",{cx:Y,cy:U,r:5,fill:b.chart6,stroke:"rgba(255,255,255,0.3)",strokeWidth:1,role:"img","aria-label":"Local node"}),r.jsx("g",{clipPath:"url(#radar-clip)",children:R.map(e=>{const t=P>0?e.distance/P*E:0;if(t>1)return null;const{x:s,y:a}=ne(e.bearing,t),n=null!==e.snr?bt(e.snr,f):"#808080",l=(null==i?void 0:i.hash)===e.hash,o=c.has(e.hash);return r.jsxs("g",{role:"img","aria-label":`${e.name}: ${e.distance.toFixed(1)}km ${e.bearing.toFixed(0)}°`,children:[o&&r.jsx("circle",{cx:s,cy:a,r:10.5,fill:"none",stroke:"rgba(255,255,255,0.9)",strokeWidth:2,className:"neighbor-blink-ring"}),l&&r.jsx("circle",{cx:s,cy:a,r:10.5,fill:n,opacity:.3}),r.jsx("circle",{cx:s,cy:a,r:l?7:5,fill:n,stroke:"rgba(0,0,0,0.5)",strokeWidth:1,style:{cursor:"pointer",transition:"r 0.15s"},onMouseEnter:()=>ie(e),onMouseLeave:()=>ie(null)})]},e.hash)})})]})}),r.jsx("div",{className:"flex flex-col h-full items-stretch gap-1 py-2 pl-2 flex-shrink-0",role:"group","aria-label":"Zoom level",children:["1x","2x","4x","8x","16x","36x"].map(e=>r.jsx("button",{onClick:()=>oe(e),"aria-pressed":B===e,className:"flex flex-1 items-center justify-center px-1.5 text-xs font-medium rounded transition-colors "+(B===e?"bg-accent-primary/20 text-accent-primary":"bg-white/5 text-text-secondary hover:bg-white/10 hover:text-text-primary"),children:e},e))}),i&&r.jsxs("div",{className:"absolute bg-tooltip-bg border border-border-subtle rounded-lg px-3 py-2 text-sm pointer-events-none z-10 shadow-xl",style:{left:"50%",bottom:8,transform:"translateX(-50%)"},children:[r.jsx("div",{className:"font-medium text-text-primary",children:i.name}),r.jsx("div",{className:"text-text-secondary text-xs font-mono",children:i.hash}),null!==i.snr?r.jsx("div",{className:"flex gap-3 mt-1 text-xs",children:r.jsxs("span",{children:[r.jsx("span",{className:"text-text-secondary",children:"SNR:"})," ",r.jsxs("span",{className:"tabular-nums",style:{color:bt(i.snr,f)},children:[i.snr.toFixed(1)," dB"]}),r.jsxs("span",{className:"text-text-secondary ml-1",children:["(",(Be=i.snr,(null==(Fe=yt.find(e=>Be>=e.min))?void 0:Fe.label)??"Critical"),")"]})]})}):r.jsx("div",{className:"text-xs text-text-secondary mt-1",children:"No SNR data"}),r.jsxs("div",{className:"flex gap-3 text-xs",children:[r.jsxs("span",{children:[r.jsx("span",{className:"text-text-secondary",children:"Distance:"})," ",r.jsxs("span",{className:"tabular-nums text-text-primary",children:[i.distance.toFixed(2)," km"]})]}),r.jsxs("span",{children:[r.jsx("span",{className:"text-text-secondary",children:"Bearing:"})," ",r.jsxs("span",{className:"tabular-nums text-text-primary",children:[i.bearing.toFixed(0),"°"]})]})]})]})]}):r.jsxs("div",{ref:x,className:"flex flex-col items-center justify-center h-full text-text-secondary",children:[r.jsx(ae,{className:"w-8 h-8 mb-2 opacity-50"}),r.jsx("p",{children:"Local node coordinates not configured"}),r.jsx("p",{className:"text-xs mt-1",children:"Set latitude/longitude in config to enable"})]});var Be,Fe});function jt(e,t){if(0===e.length)return 0;const s=t/100*(e.length-1),a=Math.floor(s),n=Math.ceil(s);return a===n?e[a]:e[a]+(e[n]-e[a])*(s-a)}const kt=n.memo(function({timestamps:e,values:t,onStatsChange:s}){var a,l;const{theme:i}=u(),[o,c]=n.useState(!0),C=n.useMemo(()=>{if(0===t.length)return null;const e=Math.min(...t),s=Math.max(...t),a=t.reduce((e,t)=>e+t,0)/t.length,n=[...t].sort((e,t)=>e-t);return{min:e,max:s,avg:a,p5:jt(n,5),p95:jt(n,95)}},[t]);n.useEffect(()=>{null==s||s(C)},[C]);const A=n.useCallback(()=>{c(e=>!e)},[]),{heatmapData:D,xLabels:B,yLabels:F}=n.useMemo(()=>{if(0===e.length||0===t.length||!C)return{heatmapData:null,xLabels:[],yLabels:[]};let s,a;if(o){const e=.1*(C.p95-C.p5||1);s=C.p5-e,a=C.p95+e}else{const e=.1*(C.max-C.min||1);s=C.min-e,a=C.max+e}const n=a-s,r=e[0],l=e[e.length-1]-r||1,i=new Float32Array(2*e.length);for(let o=0;o{const e=m.current;if(!e)return;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:s}=t.contentRect;e>0&&s>0&&h({width:e,height:s})}});t.observe(e);const s=e.getBoundingClientRect();return s.width>0&&s.height>0&&h({width:s.width,height:s.height}),()=>t.disconnect()},[]),n.useEffect(()=>{const e=E.current;if(!e||!D||0===d.width)return;const t=e.getContext("2d");if(!t)return;const{width:s,height:a}=d,n=window.devicePixelRatio||1;e.width=s*n,e.height=a*n,e.style.width=`${s}px`,e.style.height=`${a}px`,t.scale(n,n),t.clearRect(0,0,s,a);const r=getComputedStyle(document.documentElement).getPropertyValue("--accent-primary").trim(),{r:l,g:i,b:o}=(e=>{const t=e.match(/color\(display-p3\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)\)/);if(t)return{r:Math.round(255*parseFloat(t[1])),g:Math.round(255*parseFloat(t[2])),b:Math.round(255*parseFloat(t[3]))};const s=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return s?{r:parseInt(s[1],16),g:parseInt(s[2],16),b:parseInt(s[3],16)}:{r:250,g:189,b:47}})(r),{points:c,count:C}=D,A=Math.max(3,Math.min(8,s/C*4));t.globalCompositeOperation="source-over";for(let D=0;Dr.jsx("span",{className:"type-data-xs text-text-secondary tabular-nums text-right pr-1.5",style:{position:"absolute",top:`${e.pos}%`,transform:"translateY(-50%)",right:0},children:e.label},t))}),r.jsxs("div",{ref:m,className:"absolute overflow-hidden",style:{left:32,right:0,top:0,bottom:20},children:[r.jsx("svg",{className:"absolute inset-0 w-full h-full",preserveAspectRatio:"none","aria-hidden":"true",children:[0,25,50,75,100].map(e=>r.jsx("line",{x1:"0",y1:`${e}%`,x2:"100%",y2:`${e}%`,stroke:"var(--chart-grid-line, rgba(255,255,255,0.06))",strokeDasharray:"3 3"},e))}),r.jsx("canvas",{ref:E,className:"absolute inset-0 w-full h-full","aria-hidden":"true"}),r.jsx("button",{type:"button",onClick:A,className:"absolute bottom-1 right-1 p-1.5 rounded bg-tooltip-bg/80 hover:bg-tooltip-bg active:bg-tooltip-bg transition-colors touch-manipulation",title:o?"Show full range (min/max)":"Show trimmed range (P5-P95)","aria-label":o?"Expand to show full data range":"Shrink to show trimmed percentile range","aria-pressed":!o,children:o?r.jsx(Se,{className:"w-3.5 h-3.5 text-text-muted","aria-hidden":"true"}):r.jsx(ze,{className:"w-3.5 h-3.5 text-text-muted","aria-hidden":"true"})})]}),r.jsx("div",{className:"absolute left-0 right-0 bottom-0",style:{left:32,height:20},"aria-hidden":"true",children:B.map((e,t)=>r.jsx("span",{className:"type-data-xs text-text-secondary tabular-nums absolute top-1",style:{left:`${e.pos}%`,transform:"translateX(-50%)"},children:e.label},t))})]}):r.jsx("div",{className:"h-full flex items-center justify-center text-text-muted",children:"No noise floor data available"})}),Nt={repeater:"var(--accent-primary)",companion:"var(--accent-tertiary)",room_server:"var(--accent-secondary)"};function wt(e){if(e.contact_type){const t=e.contact_type.toLowerCase();if("repeater"===t||"rep"===t)return"repeater";if("room server"===t||"room_server"===t||"room"===t||"server"===t)return"room_server";if("companion"===t||"client"===t||"cli"===t)return"companion"}return e.is_repeater?"repeater":"companion"}const Mt=n.memo(function({neighbors:e}){const t=n.useMemo(()=>{const t={repeater:0,companion:0,room_server:0};for(const a of Object.values(e)){const e=wt(a);t[e]=(t[e]||0)+1}const s=Object.values(t).reduce((e,t)=>e+t,0);return{items:[{label:"Repeaters",count:t.repeater,percent:0,color:Nt.repeater},{label:"Companions",count:t.companion,percent:0,color:Nt.companion},{label:"Room Servers",count:t.room_server,percent:0,color:Nt.room_server}].map(e=>({...e,percent:s>0?e.count/s*100:0})).filter(e=>e.count>0).sort((e,t)=>t.count-e.count),total:s}},[e]);return 0===t.total?r.jsx("div",{className:"h-full flex items-center justify-center text-text-muted type-body-sm",children:"No neighbors discovered yet"}):r.jsxs("div",{className:"h-full flex flex-col",children:[r.jsx("div",{className:"flex-1 flex flex-col justify-evenly",children:t.items.map(e=>r.jsxs("div",{className:"flex flex-col gap-1.5",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"type-data-sm text-text-secondary",children:e.label}),r.jsxs("span",{className:"type-data-sm text-text-secondary tabular-nums",children:[e.count," ",r.jsxs("span",{className:"text-text-secondary/60",children:["(",e.percent.toFixed(0),"%)"]})]})]}),r.jsx("div",{className:"h-2.5 bg-bg-elevated overflow-hidden",children:r.jsx("div",{className:"h-full transition-all duration-500 ease-out",style:{width:`${e.percent}%`,backgroundColor:e.color,minWidth:e.count>0?"4px":"0"}})})]},e.label))}),r.jsxs("div",{className:"flex items-center justify-between pt-2 border-t border-border-subtle",children:[r.jsx("span",{className:"type-data-xs text-text-secondary",children:"Total Nodes"}),r.jsx("span",{className:"type-data-sm text-text-primary font-medium tabular-nums",children:t.total})]})]})});function St({children:e,minHeight:t="100%",rootMargin:s="200px 0px",keepMounted:a=!0,className:l=""}){const i=n.useRef(null),[o,c]=n.useState(!1),[C,A]=n.useState(!1);n.useEffect(()=>{const e=i.current;if(!e)return;const t=new IntersectionObserver(([e])=>{const t=e.isIntersecting;A(t),t&&c(!0)},{rootMargin:s,threshold:0});return t.observe(e),()=>{t.disconnect()}},[s]);const D=C||a&&o;return r.jsx("div",{ref:i,className:`h-full w-full ${l}`,style:{minHeight:t},children:D?e:r.jsx("div",{className:"h-full w-full flex items-center justify-center text-text-muted/50",children:r.jsx("div",{className:"animate-pulse text-xs",children:"Loading chart..."})})})}const Tt={excellent:"text-signal-excellent",good:"text-signal-good",fair:"text-signal-fair",poor:"text-accent-primary"},Rt={excellent:"bg-signal-excellent/10",good:"bg-signal-good/10",fair:"bg-signal-fair/10",poor:"bg-accent-primary/10"};function Pt(){const e=h(),t=x(),[s,a]=n.useState(null),l=n.useCallback((e,t)=>{a({prefix:e,candidateHashes:t})},[]),i=n.useCallback(()=>{a(null)},[]);if(!t)return r.jsxs(le,{children:[r.jsx(Ae,{icon:r.jsx(X,{}),title:"Prefix Conflicts",largeTitle:!0}),r.jsx("div",{className:"flex-1 flex items-center justify-center",children:r.jsxs("div",{className:"text-center text-text-secondary",children:[r.jsx(Be,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),r.jsx("p",{className:"type-data-xs",children:"No topology data available"}),r.jsx("p",{className:"type-data-xs opacity-70",children:"Run deep analysis to see stats"})]})})]});const o=(c=e.avgConfidence)>=.9?"excellent":c>=.7?"good":c>=.5?"fair":"poor";var c;const C=(A=e.collisionRate)<=10?"excellent":A<=25?"good":"poor";var A;const D="poor"===o||"poor"===C?"poor":"fair"===o||"fair"===C?"fair":"good"===o||"good"===C?"good":"excellent",B="excellent"===D||"good"===D?ke:Fe;return r.jsxs(le,{className:"flex flex-col overflow-hidden",children:[r.jsx(Ae,{icon:r.jsx(X,{}),title:"Prefix Conflicts",largeTitle:!0,actions:r.jsxs("div",{className:`flex items-center gap-1.5 px-2.5 py-1 rounded-full ${Rt[D]}`,children:[r.jsx(B,{className:`w-3.5 h-3.5 ${Tt[D]}`}),r.jsx("span",{className:`type-data-xs font-medium ${Tt[D]}`,children:"excellent"===D?"Excellent":"good"===D?"Good":"fair"===D?"Fair":"Needs Attention"})]})}),r.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[r.jsxs("div",{className:"grid grid-cols-3 gap-1.5 sm:gap-2 py-3 sm:py-4",children:[r.jsxs("div",{className:"flex flex-col items-center cursor-help bg-white/5 rounded-lg sm:rounded-xl py-2 sm:py-3 px-1.5 sm:px-2",title:"Total unique 2-character prefixes observed in packet paths.",children:[r.jsx("span",{className:"font-mono text-2xl sm:text-3xl font-semibold tabular-nums text-text-primary",style:{letterSpacing:"-0.05em"},children:e.totalPrefixes}),r.jsx("span",{className:"type-data-xs sm:type-data-sm text-text-secondary mt-0.5 sm:mt-1",children:"Prefixes"})]}),r.jsxs("div",{className:"flex flex-col items-center cursor-help bg-white/5 rounded-lg sm:rounded-xl py-2 sm:py-3 px-1.5 sm:px-2",title:"Prefixes that map to exactly one known node. No disambiguation needed.",children:[r.jsx("span",{className:"font-mono text-2xl sm:text-3xl font-semibold tabular-nums text-text-primary",style:{letterSpacing:"-0.05em"},children:e.unambiguousPrefixes}),r.jsx("span",{className:"type-data-xs sm:type-data-sm text-text-secondary mt-0.5 sm:mt-1",children:"Unique"})]}),r.jsxs("div",{className:"flex flex-col items-center cursor-help rounded-lg sm:rounded-xl py-2 sm:py-3 px-1.5 sm:px-2 "+(e.collisionPrefixes>0?"bg-accent-primary/15":"bg-white/5"),title:"Prefixes matching multiple known nodes. Click a prefix below to explore candidates.",children:[r.jsx("span",{className:"font-mono text-2xl sm:text-3xl font-semibold tabular-nums "+(e.collisionPrefixes>0?"text-accent-primary":"text-text-primary"),style:{letterSpacing:"-0.05em"},children:e.collisionPrefixes}),r.jsx("span",{className:"type-data-xs sm:type-data-sm mt-0.5 sm:mt-1 "+(e.collisionPrefixes>0?"text-accent-primary":"text-text-secondary"),children:"Conflicts"})]})]}),e.highCollisionPrefixes.length>0&&r.jsxs("div",{children:[r.jsx("div",{className:"type-data-xs text-text-secondary mb-1.5",children:"Problem Prefixes"}),r.jsx("div",{className:"flex flex-wrap gap-1.5 content-start",children:e.highCollisionPrefixes.map(({prefix:e,candidateCount:t,candidateHashes:s})=>r.jsxs("button",{type:"button",onClick:()=>l(e,s),className:"inline-flex items-center gap-0.5 group",title:`${t} candidates - click to explore`,children:[r.jsx(ce,{children:e}),r.jsxs("span",{className:"text-text-muted type-data-xs group-hover:text-text-secondary transition-colors",children:["×",t]})]},e))})]}),0===e.lowConfidencePrefixes.length&&0===e.collisionPrefixes&&r.jsx("div",{className:"flex-1 flex items-center",children:r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(ke,{className:"w-3.5 h-3.5 text-signal-excellent"}),r.jsx("span",{className:"type-data-xs text-signal-excellent",children:"All prefixes uniquely identified"})]})}),r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2 sm:gap-4 mt-auto pt-3",children:[r.jsxs("div",{className:"flex items-center gap-2 cursor-help",title:"Average confidence score across all disambiguated prefixes. Higher = more certain node identification.",children:[r.jsx("span",{className:"type-data-xs text-text-secondary",children:"Confidence"}),r.jsxs("span",{className:`data-box ${Tt[o]}`,children:[(100*e.avgConfidence).toFixed(1),"%"]})]}),r.jsxs("div",{className:"flex items-center gap-2 cursor-help",title:"Percentage of 2-character prefixes that match multiple known nodes. Lower is better.",children:[r.jsx("span",{className:"type-data-xs text-text-secondary",children:"Collisions"}),r.jsxs("span",{className:`data-box ${Tt[C]}`,children:[e.collisionRate.toFixed(1),"%"]})]})]})]}),r.jsx(Ce,{isOpen:!!s,prefix:(null==s?void 0:s.prefix)||"",candidateHashes:(null==s?void 0:s.candidateHashes)||[],onClose:i})]})}function $t({icon:e,label:t,value:s,sublabel:a,highlight:n,tooltip:l}){return r.jsxs("div",{className:"flex items-center justify-between gap-2 py-1.5 "+(l?"cursor-help":""),title:l,children:[r.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 min-w-0",children:[r.jsx("span",{className:"icon-xs text-icon-widget flex-shrink-0",children:e}),r.jsx("span",{className:"type-body-sm text-text-secondary truncate",children:t})]}),r.jsxs("div",{className:"flex items-center gap-1 sm:gap-1.5 flex-shrink-0",children:[r.jsx("span",{className:"data-box",style:n?{"--data-box-color":"var(--accent-primary)"}:void 0,children:s}),a&&r.jsx("span",{className:"type-data-xs text-text-secondary hidden sm:inline",children:a})]})]})}function Lt(){const e=p(),t=g().length;if(!e||0===e.totalPaths)return null;const{totalPaths:s,pathsWithGhosts:a,observationOverrideCount:n,tracePacketsProcessed:l,pathPacketsProcessed:i,distantEdgesDiscovered:o,duplicateGroupsFound:c,duplicatePathsUnique:C,echolocationEdgesInferred:A}=e,D=s>0?((s-a)/s*100).toFixed(1):"0",B=s>0?(n/s*100).toFixed(1):"0",F=l+i,E=F>0||o>0,m=c>0||A>0;return r.jsxs(le,{children:[r.jsx(Ae,{title:"Path Decoder",icon:r.jsx(K,{}),largeTitle:!0,badge:t>0?`${t} hidden`:void 0}),r.jsxs(De,{children:[r.jsxs("div",{children:[r.jsx($t,{icon:r.jsx(Pe,{className:"w-3.5 h-3.5"}),label:"Traceable",value:`${D}%`,sublabel:`of ${s.toLocaleString()} paths`,tooltip:"Percentage of packet journeys where every hop was identified. Higher = better visibility into how traffic flows through your mesh."}),r.jsx($t,{icon:r.jsx(He,{className:"w-3.5 h-3.5"}),label:"Learning Rate",value:`${B}%`,sublabel:"adapted",tooltip:"How often real traffic patterns improved our predictions over geography alone. Higher values mean the decoder is learning your mesh's actual behavior — which routes are preferred, which nodes are most active."})]}),E&&r.jsxs("div",{className:"mt-3",children:[r.jsx("p",{className:"type-micro mb-2",children:"Beyond Line-of-Sight"}),r.jsxs("div",{children:[r.jsx($t,{icon:r.jsx($e,{className:"w-3.5 h-3.5"}),label:"Route Reports",value:F.toLocaleString(),sublabel:l>0?`(${l} TRACE)`:void 0,tooltip:"TRACE/PATH packets from distant nodes share their routing tables. This reveals connections we can't directly observe — mapping parts of the mesh we don't touch."}),r.jsx($t,{icon:r.jsx(Ee,{className:"w-3.5 h-3.5"}),label:"Remote Links",value:o.toLocaleString(),highlight:o>0,tooltip:"Node-to-node connections discovered from route reports. These links exist outside our RF range but help complete the topology picture."})]})]}),m&&r.jsx($t,{icon:r.jsx(f,{className:"w-3.5 h-3.5"}),label:"Multi-Path Packets",value:c.toLocaleString(),sublabel:C>0?`(${C} routes)`:void 0,tooltip:"Packets received via multiple paths simultaneously. Like sonar, these 'echoes' reveal redundant routes — important for understanding mesh resilience."}),t>0&&r.jsx($t,{icon:r.jsx(y,{className:"w-3.5 h-3.5 text-accent-primary"}),label:"Ghost Repeaters",value:t,highlight:!0,tooltip:"High-confidence hidden repeaters: appear in 10+ paths, have 2+ known neighbors, ≥30% confidence, and plausible location. View them on the Contacts map."})]})]})}function zt(){var e,t,s,a,l,i,o,c,C,A,D,B,F,E,m,d,u;const h=b(),x=v(),p=j(),g=k(),f=N(),y=w(),H=M(),_=S(),[O,I]=n.useState([]),[W,V]=n.useState(null),[q,X]=n.useState(null),[K,Y]=n.useState(!0),[U,Q]=n.useState(null),[Z,J]=n.useState(()=>{const e=localStorage.getItem("statistics-view-mode");return"share"===e||"airtime"===e?e:"airtime"});n.useEffect(()=>{localStorage.setItem("statistics-view-mode",Z)},[Z]);const[ee,te]=n.useState(()=>{const e=localStorage.getItem("statistics-smoothing-mode");return["raw","ema","zlema","smooth","ultra","mosaic","stats","trend"].includes(e)?e:"trend"});n.useEffect(()=>{localStorage.setItem("statistics-smoothing-mode",ee)},[ee]);const[se,ne]=n.useState(!1),[ce,Ce]=n.useState(!1),[De,Be]=n.useState(Ie),[Fe,Ee]=n.useState(.5),he=n.useMemo(()=>({0:0,1:0,2:1,3:2,4:3,5:4,6:5,7:6}[H]??3),[H]),xe=T[he].hours,pe=60*xe,ge=T[he],fe=P(xe),ye=y.isBackgroundLoading,be=n.useCallback(e=>{_({0:1,1:2,2:3,3:4,4:5,5:6,6:7}[e]??4)},[_]),ve=n.useMemo(()=>{var e;if(!(null==(e=null==h?void 0:h.config)?void 0:e.radio))return null;const t=h.config.radio;return{sf:t.spreading_factor??10,bw:t.bandwidth??25e4,cr:t.coding_rate??5,preamble:t.preamble_length??8}},[null==(t=null==(e=null==h?void 0:h.config)?void 0:e.radio)?void 0:t.spreading_factor,null==(a=null==(s=null==h?void 0:h.config)?void 0:s.radio)?void 0:a.bandwidth,null==(i=null==(l=null==h?void 0:h.config)?void 0:l.radio)?void 0:i.coding_rate,null==(c=null==(o=null==h?void 0:h.config)?void 0:o.radio)?void 0:c.preamble_length]);n.useEffect(()=>{!async function(){var e;Q(null);try{const t=await R(xe);t.success&&(null==(e=t.data)?void 0:e.history)&&I(t.data.history)}catch(t){Q(t instanceof Error?t.message:"Failed to load chart data")}finally{Y(!1)}}()},[xe]);const je=n.useMemo(()=>72===xe?6e5:168===xe?18e5:336===xe?36e5:3e5,[xe]),ke=n.useCallback(async()=>{var e;try{const t=await R(xe);t.success&&(null==(e=t.data)?void 0:e.history)&&I(t.data.history)}catch{}},[xe]);z(ke,je,!0,!0);const Ne=n.useMemo(()=>0===O.length?{timestamps:[],values:[]}:{timestamps:O.map(e=>e.timestamp),values:O.map(e=>e.noise_floor_dbm)},[O]),we=n.useMemo(()=>{if(O.length<10)return{anomalies:[],debug:void 0};const e=function(e,t={}){const s={...Ie,...t};if(e.length<10)return{anomalies:[],thresholds:Ve([]),totalSamples:e.length,anomalySamples:0};const a=e.map(e=>e.noise_floor_dbm),n=Ve(a),r=[...a].sort((e,t)=>e-t);let l,i;s.useAbsoluteThresholds?(l=s.baselineDbm,i=s.spikeDbm):(l=We(r,s.baselinePercentile),i=We(r,s.spikePercentile));const o=[...e].sort((e,t)=>e.timestamp-t.timestamp),c=[];let C=null,A=0;for(const D of o)if(D.noise_floor_dbm>l&&D.noise_floor_dbme+t,0)/C.values.length):(C.values.length>=s.minSequenceLength&&c.push(C),C={startTs:D.timestamp,endTs:D.timestamp,values:[D.noise_floor_dbm],timestamps:[D.timestamp],rollingAvg:D.noise_floor_dbm})}else C={startTs:D.timestamp,endTs:D.timestamp,values:[D.noise_floor_dbm],timestamps:[D.timestamp],rollingAvg:D.noise_floor_dbm};else C&&C.values.length>=s.minSequenceLength&&c.push(C),C=null;return C&&C.values.length>=s.minSequenceLength&&c.push(C),0===c.length?{anomalies:[],thresholds:n,totalSamples:e.length,anomalySamples:A,debug:{baselineCutoff:l,spikeCutoff:i,midBandSamples:A}}:{anomalies:c.map(e=>{const t=Math.max(...e.values),s=e.values.reduce((e,t)=>e+t,0)/e.values.length;return{startTs:e.startTs,endTs:e.endTs,peakValue:t,avgValue:s,severity:qe(s,l,i),sampleCount:e.values.length}}),thresholds:n,totalSamples:e.length,anomalySamples:A,debug:{baselineCutoff:l,spikeCutoff:i,midBandSamples:A}}}(O,De);return{anomalies:e.anomalies,debug:e.debug}},[O,De]),Me=we.anomalies,Se=n.useMemo(()=>{const e=(null==h?void 0:h.neighbors)??{};return Object.fromEntries(Object.entries(e).filter(([e])=>!x.has(e)))},[null==h?void 0:h.neighbors,x]),Te=n.useMemo(()=>{const e=Date.now()/1e3-3600*xe;return Object.fromEntries(Object.entries(Se).filter(([,t])=>t.last_seen>=e))},[Se,xe]),Re=n.useMemo(()=>{const e=60*pe/fe,t=Math.floor(Date.now()/1e3),s=Math.floor(t/e)*e;return{start:s-60*pe,end:s}},[pe,fe]);return r.jsxs(ie,{children:[r.jsx(oe,{title:"Statistics",icon:r.jsx($,{}),controls:r.jsx(re,{ranges:T,selectedIndex:he,onSelect:be,isPending:ye})}),U&&r.jsx(le,{className:"border border-accent-red/50 bg-accent-red/10",children:r.jsx("p",{className:"text-accent-red",children:U})}),se&&ce&&r.jsxs(le,{className:"border border-accent-purple/30 bg-glass-surface/50",children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"type-label",children:"Anomaly Detection Tuning"}),r.jsxs("span",{className:"type-data-xs text-text-muted",children:["(",ge.label,")"]})]}),r.jsx("button",{onClick:()=>Be(e=>({...e,useAbsoluteThresholds:!e.useAbsoluteThresholds})),className:"type-data-xs px-2 py-1 rounded transition-colors "+(De.useAbsoluteThresholds?"bg-accent-purple/30 text-accent-purple":"bg-glass-elevated text-text-muted hover:text-text-secondary"),children:De.useAbsoluteThresholds?"Absolute dBm":"Percentile"})]}),r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[r.jsxs("div",{children:[r.jsx("span",{className:"type-micro",children:"Baseline"}),r.jsxs("span",{className:"ml-2 type-data-sm text-status-warning",children:[(null==(A=null==(C=we.debug)?void 0:C.baselineCutoff)?void 0:A.toFixed(1))??"—"," dBm"]})]}),r.jsxs("div",{children:[r.jsx("span",{className:"type-micro",children:"Spike"}),r.jsxs("span",{className:"ml-2 type-data-sm text-status-warning",children:[(null==(B=null==(D=we.debug)?void 0:D.spikeCutoff)?void 0:B.toFixed(1))??"—"," dBm"]})]}),r.jsxs("div",{children:[r.jsx("span",{className:"type-micro",children:"Mid-band"}),r.jsx("span",{className:"ml-2 type-data-sm text-accent-purple",children:(null==(F=we.debug)?void 0:F.midBandSamples)??0})]}),r.jsxs("div",{children:[r.jsx("span",{className:"type-micro",children:"Anomalies"}),r.jsx("span",{className:"ml-2 type-data-sm text-status-danger",children:Me.length})]})]}),r.jsxs("div",{className:"mt-4 pt-4 border-t border-border-subtle space-y-4",children:[De.useAbsoluteThresholds?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[r.jsxs("div",{children:[r.jsxs("label",{className:"type-micro block mb-1",children:["Baseline (",De.baselineDbm," dBm)"]}),r.jsx("input",{type:"range",min:"-120",max:"-60",value:De.baselineDbm,onChange:e=>Be(t=>({...t,baselineDbm:Number(e.target.value)})),className:"w-full accent-accent-purple"})]}),r.jsxs("div",{children:[r.jsxs("label",{className:"type-micro block mb-1",children:["Spike (",De.spikeDbm," dBm)"]}),r.jsx("input",{type:"range",min:"-100",max:"-20",value:De.spikeDbm,onChange:e=>Be(t=>({...t,spikeDbm:Number(e.target.value)})),className:"w-full accent-accent-purple"})]}),r.jsxs("div",{children:[r.jsxs("label",{className:"type-micro block mb-1",children:["Merge Gap (",De.mergeGapSeconds,"s)"]}),r.jsx("input",{type:"range",min:"5",max:"120",step:"5",value:De.mergeGapSeconds,onChange:e=>Be(t=>({...t,mergeGapSeconds:Number(e.target.value)})),className:"w-full accent-accent-purple"})]})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[r.jsxs("div",{children:[r.jsxs("label",{className:"type-micro block mb-1",children:["Min Sequence (",De.minSequenceLength,")"]}),r.jsx("input",{type:"range",min:"2",max:"20",value:De.minSequenceLength,onChange:e=>Be(t=>({...t,minSequenceLength:Number(e.target.value)})),className:"w-full accent-accent-purple"})]}),r.jsxs("div",{children:[r.jsxs("label",{className:"type-micro block mb-1",children:["Similarity (±",De.similarityToleranceDbm," dBm)"]}),r.jsx("input",{type:"range",min:"1",max:"15",value:De.similarityToleranceDbm,onChange:e=>Be(t=>({...t,similarityToleranceDbm:Number(e.target.value)})),className:"w-full accent-accent-purple"})]}),r.jsxs("div",{children:[r.jsxs("label",{className:"type-micro block mb-1",children:["Opacity (",Math.round(100*Fe),"%)"]}),r.jsx("input",{type:"range",min:"0.1",max:"1",step:"0.05",value:Fe,onChange:e=>Ee(Number(e.target.value)),className:"w-full accent-accent-purple"})]})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[r.jsxs("div",{children:[r.jsxs("label",{className:"type-micro block mb-1",children:["Baseline (P",De.baselinePercentile,")"]}),r.jsx("input",{type:"range",min:"1",max:"50",value:De.baselinePercentile,onChange:e=>Be(t=>({...t,baselinePercentile:Number(e.target.value)})),className:"w-full accent-accent-purple"})]}),r.jsxs("div",{children:[r.jsxs("label",{className:"type-micro block mb-1",children:["Spike (P",De.spikePercentile,")"]}),r.jsx("input",{type:"range",min:"50",max:"99",value:De.spikePercentile,onChange:e=>Be(t=>({...t,spikePercentile:Number(e.target.value)})),className:"w-full accent-accent-purple"})]}),r.jsxs("div",{children:[r.jsxs("label",{className:"type-micro block mb-1",children:["Merge Gap (",De.mergeGapSeconds,"s)"]}),r.jsx("input",{type:"range",min:"5",max:"120",step:"5",value:De.mergeGapSeconds,onChange:e=>Be(t=>({...t,mergeGapSeconds:Number(e.target.value)})),className:"w-full accent-accent-purple"})]})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[r.jsxs("div",{children:[r.jsxs("label",{className:"type-micro block mb-1",children:["Min Sequence (",De.minSequenceLength,")"]}),r.jsx("input",{type:"range",min:"2",max:"20",value:De.minSequenceLength,onChange:e=>Be(t=>({...t,minSequenceLength:Number(e.target.value)})),className:"w-full accent-accent-purple"})]}),r.jsxs("div",{children:[r.jsxs("label",{className:"type-micro block mb-1",children:["Similarity (±",De.similarityToleranceDbm," dBm)"]}),r.jsx("input",{type:"range",min:"1",max:"15",value:De.similarityToleranceDbm,onChange:e=>Be(t=>({...t,similarityToleranceDbm:Number(e.target.value)})),className:"w-full accent-accent-purple"})]}),r.jsxs("div",{children:[r.jsxs("label",{className:"type-micro block mb-1",children:["Opacity (",Math.round(100*Fe),"%)"]}),r.jsx("input",{type:"range",min:"0.1",max:"1",step:"0.05",value:Fe,onChange:e=>Ee(Number(e.target.value)),className:"w-full accent-accent-purple"})]})]})]}),r.jsxs("div",{className:"mt-4 p-3 bg-glass-elevated rounded-lg",children:[r.jsx("div",{className:"type-micro mb-1",children:"Config output"}),r.jsxs("div",{className:"type-data-sm text-status-success",children:[De.useAbsoluteThresholds?`useAbsoluteThresholds: true, baselineDbm: ${De.baselineDbm}, spikeDbm: ${De.spikeDbm}`:`useAbsoluteThresholds: false, baselinePercentile: ${De.baselinePercentile}, spikePercentile: ${De.spikePercentile}`,", mergeGapSeconds: ",De.mergeGapSeconds,", minSequenceLength: ",De.minSequenceLength,", similarityToleranceDbm: ",De.similarityToleranceDbm]})]})]})]}),ye&&r.jsx(me,{template:"auto",children:r.jsx(le,{className:"border border-accent-primary/30 bg-accent-primary/5",children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("div",{className:"relative flex h-3 w-3",children:[r.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-accent-primary opacity-75"}),r.jsx("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-accent-primary"})]}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("p",{className:"type-body-sm text-text-primary",children:["Loading ",ge.label," data..."]}),y.loadProgress&&r.jsxs("p",{className:"type-data-xs text-text-muted mt-0.5",children:[y.loadProgress.loaded.toLocaleString()," packets (",y.loadProgress.percent,"%)"]})]})]})})}),K?r.jsx(me,{template:"auto",children:r.jsx(le,{className:"text-center py-12",children:r.jsx("div",{className:"animate-pulse text-text-muted",children:"Loading statistics..."})})}):r.jsxs(r.Fragment,{children:[r.jsx(me,{template:"hero-auto",children:r.jsx(le,{isLoaded:f,skeletonType:"chart",children:f&&r.jsxs(r.Fragment,{children:[r.jsx(Ae,{icon:r.jsx(G,{}),title:"Packet Analyzer",badge:ge.label,largeTitle:!0,stackActionsOnMobile:!0,actions:r.jsxs("div",{className:"flex flex-wrap items-center gap-2 justify-end",children:["stats"===ee&&r.jsx(Et,{enabled:se,onChange:ne,anomalyCount:Me.length,showTuning:ce,onTuningChange:Ce}),r.jsx(Ft,{smoothing:ee,onChange:te}),r.jsx(Bt,{mode:Z,onChange:J})]})}),r.jsx("div",{className:"flex-1 min-h-0",children:r.jsx(ht,{packets:g,startTs:Re.start,endTs:Re.end,bucketCount:fe,radioConfig:ve??void 0,mode:Z,smoothing:ee,noiseFloorAnomalies:Me,showNoiseFloorOverlay:se,overlayOpacity:Fe})})]})})}),r.jsxs(me,{template:"panel",children:[r.jsx(de,{span:12,md:6,children:r.jsx(le,{isLoaded:f,skeletonType:"chart",children:f&&r.jsxs(r.Fragment,{children:[r.jsx(Ae,{icon:r.jsx(ae,{}),title:"Link Quality",badge:ge.label,largeTitle:!0,actions:q?r.jsxs("div",{className:"flex items-center gap-3 type-data-xs text-text-muted",children:[r.jsxs("span",{children:[r.jsx("span",{className:"text-text-secondary tabular-nums font-medium",children:q.zeroHopCount})," nbr"]}),r.jsxs("span",{children:[r.jsx("span",{className:"text-text-secondary tabular-nums font-medium",children:q.totalCount})," obs"]}),r.jsxs("span",{children:[r.jsx("span",{className:"text-text-secondary tabular-nums font-medium",children:q.maxDistanceKm.toFixed(0)})," km"]})]}):null}),r.jsx("div",{className:"flex-1 min-h-0",children:r.jsx(St,{children:r.jsx(vt,{neighbors:Te,quickNeighbors:p,localLat:(null==(m=null==(E=null==h?void 0:h.config)?void 0:E.repeater)?void 0:m.latitude)??0,localLon:(null==(u=null==(d=null==h?void 0:h.config)?void 0:d.repeater)?void 0:u.longitude)??0,onStatsChange:X})})})]})})}),r.jsx(de,{span:12,md:6,children:r.jsx(le,{isLoaded:f,skeletonType:"chart",children:f&&r.jsxs(r.Fragment,{children:[r.jsx(Ae,{icon:r.jsx(ue,{}),title:"Network Composition",badge:ge.label,largeTitle:!0}),r.jsx("div",{className:"flex-1 min-h-0",children:r.jsx(St,{children:r.jsx(Mt,{neighbors:Te})})})]})})})]}),r.jsxs(me,{template:"panel",children:[r.jsx(de,{span:12,md:6,children:r.jsx(Pt,{})}),r.jsx(de,{span:12,md:6,children:r.jsx(Lt,{})})]}),r.jsx(me,{template:"panel",children:r.jsx(de,{span:12,children:r.jsx(le,{isLoaded:f,skeletonType:"chart",children:f&&r.jsxs(r.Fragment,{children:[r.jsx(Ae,{icon:r.jsx(L,{}),title:"RF Noise Floor",largeTitle:!0,stackActionsOnMobile:!0,actions:W?r.jsxs("div",{className:"flex items-center gap-2 sm:gap-3",children:[r.jsxs("span",{className:"type-data-xs text-text-muted whitespace-nowrap",children:["min ",r.jsx("span",{className:"text-text-secondary tabular-nums",children:W.min.toFixed(0)})]}),r.jsxs("span",{className:"type-data-xs text-text-muted whitespace-nowrap",children:["avg ",r.jsx("span",{className:"text-text-secondary tabular-nums",children:W.avg.toFixed(0)})]}),r.jsxs("span",{className:"type-data-xs text-text-muted whitespace-nowrap",children:["max ",r.jsx("span",{className:"text-text-secondary tabular-nums",children:W.max.toFixed(0)})]}),r.jsx("span",{className:"type-data-xs text-text-muted",children:"dBm"})]}):r.jsx("span",{className:"type-data-xs text-text-muted",children:"dBm"})}),r.jsx("div",{className:"flex-1 min-h-0",children:r.jsx(St,{children:r.jsx(kt,{timestamps:Ne.timestamps,values:Ne.values,onStatsChange:V})})})]})})})})]})]})}export{zt as default}; diff --git a/frontend/dist/assets/Statistics-sXHAGtEF.js b/frontend/dist/assets/Statistics-sXHAGtEF.js deleted file mode 100644 index 40930941..00000000 --- a/frontend/dist/assets/Statistics-sXHAGtEF.js +++ /dev/null @@ -1 +0,0 @@ -var e,t,s=Object.defineProperty,a=(e,t,a)=>((e,t,a)=>t in e?s(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a)(e,"symbol"!=typeof t?t+"":t,a);import{r as n,j as r,au as l,D as i,b2 as o,a3 as c,b3 as C,b4 as A,b5 as D,b6 as B,b7 as F,b8 as E,b9 as m,ba as d,bb as u,bc as h,bd as x,av as p,be as g,bf as f,at as b,ay as y,bg as v,bh as j,bi as N,aJ as w,W as k,q as M,o as S,aX as T,E as R}from"./vendor-react-C341c8YC.js";import{a7 as $,a8 as P,a9 as L,W as z,aa as _,ab as H,ac as O,ad as W,x as I,F as V,ae as q,af as G,ag as X,Y as K,ah as Y,e as U,h as Q,f as Z,u as J,p as ee,r as te,j as se,q as ae,ai as ne,k as re,aj as le}from"./index-BJEgt3tp.js";import{u as ie}from"./usePolling-CtRLadGa.js";import{b as oe,c as ce,a as Ce,d as Ae,e as De,f as Be,s as Fe}from"./useThemeColors-AeHMyThq.js";import{R as Ee,w as me,L as de,C as ue,X as he,Y as xe,T as pe,u as ge}from"./recharts-6XUQYgRA.js";import{T as fe}from"./TimeRangeSelector-DGCfekAv.js";import{a as be,P as ye,b as ve}from"./PageLayout-CnF5SScd.js";import{D as je}from"./DataBox-CRX76VsB.js";import{C as Ne}from"./CollisionExplorerModal-DTnzK_xA.js";import{C as we,a as ke}from"./Card-2pQSGkKC.js";import{R as Me,C as Se}from"./Grid-BOO-7ObJ.js";import"./vendor-core-WoOfkQwm.js";import"./deckgl-DTsmDcfs.js";import"./maplibre-gl-Bk5DsYkB.js";import"./BasemapLayer-S9Ush6Hh.js";const Te={acton:{discrete:["#260D40","#2B1345","#2F194B","#342152","#382657","#3C2C5C","#403261","#443766","#483E6C","#4C4371","#504876","#544D7B","#57527F","#5D5884","#625C88","#685F8A","#6E618C","#74628D","#7B638D","#81638E","#88648E","#8E648E","#95658F","#9D658F","#A4668F","#AB6690","#B26790","#BB6992","#C26B94","#C86F97","#CD749B","#D07AA0","#D382A7","#D688AC","#D88FB2","#D995B8","#DB9CBD","#DEA4C4","#DFABC9","#E1B1CE","#E3B7D3","#E5BED8","#E6C5DE","#E8CBE2","#E9D0E6","#EBD6EA","#ECDBEE","#EDE1F3","#EFE6F6","#F0EAFA"],categorical:["#260D40","#F0EAFA","#A76690","#DDA1C2","#585380","#7D638E","#E8CAE1","#CF789E","#403261","#4C4371","#ECDBEE","#69608B","#E3B6D2","#D78CB0","#91648F","#BE6A92","#342152","#EAD3E8","#524B79","#73628D","#463A69","#605B86","#E5C0DA","#D382A7","#C86F97","#86648E","#EEE3F4","#DA97B9","#9B658F","#B26790","#2D1749","#E0ACCA","#3A2959","#8B648E","#311C4D","#EBD7EB","#EDDFF1","#AC6790","#A1668F","#6E618C","#E6C5DE","#78628D","#433665","#DEA7C6","#81638E","#554F7C","#B86891","#3D2D5D","#4F4775","#EFE7F7","#E9CEE4","#D27DA3","#2A1244","#655D89","#C36C94","#E1B1CE","#493F6D","#5C5783","#CC739A","#DB9CBD","#D892B4","#D587AB","#96658F","#E4BBD6","#362455","#4E4573","#7F638E","#D37FA5","#E1AECC","#382657","#EBD9ED","#DFA9C8","#A4668F","#8E648E","#99658F","#675F8A","#B56891","#BB6992","#E5BED8","#E2B4D0","#D07AA0","#71618C","#E6C2DC","#AA6690","#625C88","#EDE1F3","#E8CCE3","#AF6790","#CA7199","#C16B93","#453867","#57517E","#84638E","#4B416F","#E7C7DF","#423463","#514977","#3E2F5F","#544D7B","#93658F"]},bam:{discrete:["#65024B","#701057","#7B1B61","#88276E","#923078","#9B3881","#A4418A","#AC4993","#B5549C","#BC5CA3","#C266AB","#C970B2","#CF7AB9","#D587C1","#DA93C8","#DF9ECE","#E3AAD4","#E7B5DA","#EBC2E0","#EECCE5","#F1D5E9","#F3DDED","#F5E4F0","#F6EBF1","#F6EFF1","#F5F2F0","#F3F3ED","#EFF3E6","#EBF1DF","#E5EFD5","#DDEBCA","#D4E6BD","#C8DEAB","#BCD79B","#B0CE8C","#A3C67D","#97BC6F","#88B161","#7CA856","#72A04D","#679845","#5E903D","#538735","#4B7F2E","#427827","#397021","#306819","#245D10","#195507","#0D4C00"],categorical:["#65024B","#701057","#7B1B61","#88276E","#923078","#9B3881","#A4418A","#AC4993","#B5549C","#BC5CA3","#C266AB","#C970B2","#CF7AB9","#D587C1","#DA93C8","#DF9ECE","#E3AAD4","#E7B5DA","#EBC2E0","#EECCE5","#F1D5E9","#F3DDED","#F5E4F0","#F6EBF1","#F6EFF1","#F5F2F0","#F3F3ED","#EFF3E6","#EBF1DF","#E5EFD5","#DDEBCA","#D4E6BD","#C8DEAB","#BCD79B","#B0CE8C","#A3C67D","#97BC6F","#88B161","#7CA856","#72A04D","#679845","#5E903D","#538735","#4B7F2E","#427827","#397021","#306819","#245D10","#195507","#0D4C00"]},bamako:{discrete:["#003B47","#023C46","#053E45","#083F43","#0A4141","#0D4340","#0F443E","#12463C","#16483A","#194A38","#1C4D36","#204F34","#235132","#28542F","#2C572C","#305A2A","#355C27","#395F24","#3F6321","#44661E","#49691A","#4E6D17","#537014","#5A7410","#5F780D","#657C09","#6A7F05","#718302","#788501","#7F8700","#858800","#8C8A00","#948C01","#9B8E04","#A1920B","#A89713","#AE9C1B","#B7A225","#BEA82E","#C5AD37","#CBB341","#D2B84D","#D9BF5B","#DEC567","#E4CA73","#E9D07E","#EFD58A","#F5DB97","#FAE0A3","#FFE5AD"],categorical:["#003B47","#FFE5AD","#61790B","#B4A022","#245231","#406420","#898900","#DDC464","#0F443E","#EFD58A","#CAB23F","#194A38","#748401","#506E16","#9E9108","#315A29","#083F43","#A99815","#948C01","#6A7F05","#BFA930","#7F8700","#14473B","#1E4E35","#F7DD9C","#2A562D","#043D45","#597411","#E6CC77","#385F25","#48691B","#D4BB51","#0B4241","#8F8A00","#44661E","#1B4C37","#547113","#6F8203","#12463D","#998E03","#27542F","#4C6B18","#A4940E","#2E582B","#355C27","#B9A529","#215033","#EAD181","#FBE1A5","#C5AD37","#3C6122","#848800","#063E44","#E2C86E","#D9BF5B","#CFB648","#16493A","#798600","#023C46","#667C08","#5D770E","#0D433F","#AE9C1B","#F3D993","#094042","#A69611","#8C8A00","#053E45","#0C4240","#365E26","#6D8004","#9C8F05","#4A6A1A","#D6BD56","#B19E1F","#F9DFA0","#647B0A","#2F592A","#10453D","#818800","#C7AF3B","#46681C","#0E443F","#265330","#174A39","#335B28","#5B750F","#778501","#5F780D","#E8CF7C","#718302","#F1D78E","#978D02","#F5DB97","#204F34","#AC9A18","#29552E","#A1920B","#B7A225","#033C46"]},bamo:{discrete:["#4F3043","#56304B","#603354","#6D3961","#793F6B","#834675","#8D4E7E","#965587","#A05E91","#A86698","#B06EA0","#B877A7","#BF81AF","#C78DB8","#CD98BE","#D2A3C4","#D6ADC8","#D9B5CB","#DABECC","#DAC3CC","#D9C7CA","#D8CAC8","#D6CBC6","#D4CDC2","#D1CDBE","#CCCDB9","#C6CBB1","#BCC5A4","#B2BE97","#A7B58A","#9CAB7E","#92A174","#889669","#808D62","#79855C","#737D56","#6D7552","#666C4C","#616548","#5C5D45","#575642","#54503F","#50493D","#4D453C","#4B403B","#4A3C3A","#49393A","#49343B","#4A313E","#4E3042"],categorical:["#4F3043","#56304B","#603354","#6D3961","#793F6B","#834675","#8D4E7E","#965587","#A05E91","#A86698","#B06EA0","#B877A7","#BF81AF","#C78DB8","#CD98BE","#D2A3C4","#D6ADC8","#D9B5CB","#DABECC","#DAC3CC","#D9C7CA","#D8CAC8","#D6CBC6","#D4CDC2","#D1CDBE","#CCCDB9","#C6CBB1","#BCC5A4","#B2BE97","#A7B58A","#9CAB7E","#92A174","#889669","#808D62","#79855C","#737D56","#6D7552","#666C4C","#616548","#5C5D45","#575642","#54503F","#50493D","#4D453C","#4B403B","#4A3C3A","#49393A","#49343B","#4A313E","#4E3042"]},batlow:{discrete:["#011959","#06215B","#0A285C","#0D315D","#0E375E","#103D5F","#114260","#124761","#144D62","#165162","#195662","#1C5A62","#205E61","#26635F","#2C665D","#33695A","#3A6C57","#416F53","#4A724E","#52744A","#5A7745","#627941","#6A7B3D","#747E38","#7D8134","#868330","#8F862D","#9B892B","#A58B2C","#AF8D2E","#B98F32","#C29037","#CD923F","#D69446","#DE964F","#E69858","#ED9A62","#F39E70","#F8A17B","#FAA587","#FCA993","#FDAC9E","#FDB1AB","#FDB4B6","#FDB8C0","#FDBCCB","#FCBFD6","#FCC4E3","#FBC8EF","#FACCFA"],categorical:["#011959","#FACCFA","#828231","#226061","#F29D6D","#4D734D","#114360","#C09036","#FDB4B4","#DD954D","#356A59","#FCBFD6","#175262","#677B3E","#A18A2B","#0D315D","#FCA890","#FBC6E8","#2B655E","#B18D2F","#5A7745","#FDAEA2","#CF9340","#0F3B5F","#E9995C","#FDBAC4","#416F53","#91862D","#1B5962","#08255B","#747E38","#134B61","#F9A380","#8A842F","#0E365E","#124761","#154F62","#E39754","#7B8034","#1E5D62","#99882C","#195662","#0B2B5C","#FDB7BC","#C8913B","#FCC3DF","#EE9B64","#A98C2C","#FDB1AB","#FDBCCD","#FBC9F1","#051F5A","#F6A077","#607942","#FDAB9A","#477150","#3B6D56","#B98F32","#26635F","#537549","#D69446","#6D7C3B","#30685C","#103F60","#FBA689","#BD8F34","#CB923E","#EB9A60","#FDB8C0","#FBC7EC","#F09C69","#8E852E","#FDBBC9","#7F8133","#031C5A","#114160","#FDAC9E","#5D7844","#FCA995","#185462","#787F36","#A58B2C","#0A285C","#9D892B","#33695A","#0D335E","#637A40","#165062","#124561","#205E61","#144D62","#1D5B62","#0C2E5D","#D9954A","#3E6E55","#AD8C2D","#F49F72","#868330","#B58E30","#577647"]},batlowk:{discrete:["#04050A","#0A0D15","#0F141E","#121B29","#152233","#18293D","#1C3146","#21384F","#274156","#2C485B","#314E5E","#36535F","#3B575F","#405C5E","#445F5D","#49625B","#4D6558","#526756","#586B52","#5E6E4F","#63724B","#6A7548","#717845","#797D41","#81813E","#8A853B","#938839","#9F8D38","#A99139","#B3943B","#BE973E","#C89A43","#D39D4C","#DB9F54","#E2A15D","#E8A366","#EEA570","#F3A77C","#F6A986","#F8AC91","#FAAE9A","#FCB1A4","#FDB4B0","#FDB7B9","#FDBAC3","#FDBDCD","#FDC1D8","#FCC5E4","#FBC8EF","#FACCFA"],categorical:["#04050A","#FDC0D6","#787C41","#38555F","#E5A160","#536855","#AF933A","#FAAE9A","#1A2E43","#FDB6B7","#294458","#455F5C","#63724B","#CD9B47","#91883A","#F3A77E","#111A27","#F7AB8D","#FDBBC5","#FCB2AA","#D99E52","#A18E38","#4C6459","#21384F","#3F5B5E","#152335","#0C1019","#EEA570","#5B6D50","#6C7647","#314E5E","#85823D","#BE973E","#7E7F3F","#FBB0A2","#49625B","#576A53","#0F151F","#2D495B","#DFA059","#727944","#FDBDCD","#253E54","#EAA368","#C69942","#3C585F","#998B38","#677449","#F1A678","#F9AC92","#141F2F","#1D3248","#506657","#090C13","#A99139","#5F6F4E","#35525F","#435D5D","#FDB8BD","#F5A984","#B5953B","#FDB5B2","#17273B","#D39D4C","#8C853B","#9D8C38","#415C5E","#1F354B","#33505E","#FCB1A6","#101723","#3E595F","#121C2B","#757B43","#06080F","#FCB3AE","#3A565F","#274156","#61704D","#88843C","#2B475A","#FDBED1","#6A7548","#596C51","#192B3F","#6F7845","#233B51","#C99A45","#F0A574","#DC9F55","#2F4B5D","#47615C","#F6AA88","#FDB9C1","#C29840","#4A635A","#FAAD96","#81813E","#7B7E40","#E7A264"]},batloww:{discrete:["#011959","#06215B","#0A285C","#0D315D","#0E375E","#103D5F","#114260","#124761","#144C62","#165062","#185562","#1B5962","#1F5D62","#246261","#2A665F","#30695D","#366C5A","#3D7056","#467352","#4E764E","#56794A","#5E7C46","#667F42","#70823D","#798539","#828936","#8C8C33","#989032","#A29433","#AD9738","#B79B3F","#C19E48","#CBA154","#D3A45E","#D9A669","#DFA872","#E4AA7C","#E9AC88","#EEAF91","#F2B39C","#F6B9A8","#F9C0B5","#FCCAC4","#FED3CF","#FFDBDA","#FFE3E2","#FFEAEA","#FFF2F2","#FFF8F8","#FFFEFE"],categorical:["#FFFEFE","#011959","#7E8737","#205F61","#E7AB84","#497451","#114360","#FED1CD","#BF9D46","#637E44","#9E9233","#FFEAEA","#0D315D","#326B5C","#F5B7A6","#165162","#D7A564","#0F3B5F","#1A5862","#3D7056","#FFF5F5","#FFDFDD","#FAC3BA","#134A61","#08255B","#70823D","#EEB094","#56794A","#E0A874","#8E8D33","#28655F","#AF9839","#CBA154","#EBAD8B","#1D5C62","#051F5A","#124761","#FFE5E4","#B79B3F","#A79535","#386D59","#5C7B47","#185562","#DBA76D","#F8BDAF","#FFF0F0","#246261","#F2B39C","#868A35","#4F774D","#E4AA7C","#2D685E","#77853A","#FED8D6","#103F60","#FFFAF9","#968F32","#D1A35C","#144E62","#FCCAC4","#437254","#698040","#0E365E","#0B2B5C","#C59F4C","#30695D","#1C5A62","#A29433","#407155","#FFDBDA","#0C2E5D","#F7BAAA","#E5AB80","#175362","#828936","#1F5D62","#BB9C42","#E9AC88","#FFF7F7","#3A6E58","#9A9132","#8A8B34","#4C754F","#FFEDED","#D9A669","#144C62","#266460","#FDCDC9","#FCC6BF","#FFE2E1","#FFFCFC","#7B8639","#2B675E","#155062","#5F7C45","#F9C0B5","#356C5A","#F3B5A1","#EDAF8F","#FED5D2"]},berlin:{discrete:["#9EB0FF","#93AFFA","#87ADF4","#79ABED","#6CA9E6","#60A5DF","#54A0D5","#489ACA","#3E90BC","#3787AF","#327EA3","#2D7597","#296B8B","#25607C","#225771","#1E4E65","#1B465A","#183D4F","#153342","#122C38","#11242E","#101D25","#11181C","#121214","#160E0D","#1B0B07","#210B03","#270D01","#2D0E00","#340F00","#3B1100","#421301","#4B1602","#541905","#5D1E09","#68240F","#732B16","#803620","#8A3F2A","#944834","#9E513F","#A85A4A","#B46658","#BE6F63","#C8796F","#D2837A","#DD8D86","#EA9995","#F4A3A1","#FFADAD"],categorical:["#9EB0FF","#93AFFA","#87ADF4","#79ABED","#6CA9E6","#60A5DF","#54A0D5","#489ACA","#3E90BC","#3787AF","#327EA3","#2D7597","#296B8B","#25607C","#225771","#1E4E65","#1B465A","#183D4F","#153342","#122C38","#11242E","#101D25","#11181C","#121214","#160E0D","#1B0B07","#210B03","#270D01","#2D0E00","#340F00","#3B1100","#421301","#4B1602","#541905","#5D1E09","#68240F","#732B16","#803620","#8A3F2A","#944834","#9E513F","#A85A4A","#B46658","#BE6F63","#C8796F","#D2837A","#DD8D86","#EA9995","#F4A3A1","#FFADAD"]},bilbao:{discrete:["#4C0001","#54070B","#5B0E13","#64161A","#6B1D20","#712227","#77282D","#7D2E34","#84343B","#8A3A41","#8F4047","#94464B","#984C4F","#9B5253","#9D5754","#9E5C56","#A06057","#A16458","#A26959","#A36D5A","#A4715B","#A5745B","#A6785C","#A77C5D","#A8805E","#A9845F","#AA875F","#AC8C60","#AD9061","#AE9463","#AF9864","#B19D68","#B3A36E","#B6A975","#B8AD7E","#BBB287","#BDB590","#C0B99A","#C2BCA3","#C4BFAA","#C6C2B2","#C8C5B9","#CBCAC1","#CFCEC9","#D5D4D1","#DBDBDA","#E3E3E2","#EDEDED","#F6F6F6","#FFFFFF"],categorical:["#4C0001","#F8F8F8","#A9815E","#984D50","#BEB794","#AF9965","#CCCAC3","#78292F","#A26A59","#9F5D56","#64161A","#B6AA77","#C4C0AC","#A6765C","#8A3A41","#AC8C60","#DDDDDB","#A16358","#C7C5B7","#B3A16B","#A4705A","#6E2024","#EAEAE9","#92434A","#BAB185","#9C5554","#AD9262","#580B10","#813137","#C1BCA1","#AA865F","#D2D2CE","#A77C5D","#D7D7D4","#BCB48D","#B4A571","#C0B99A","#9E5955","#AB8960","#A6795C","#A36D5A","#8E3F46","#85353C","#A16758","#732529","#CAC7BD","#F1F1F0","#520509","#AC8F61","#5E1115","#C6C2B2","#E3E3E2","#691B1F","#B8AD7E","#95484D","#AE9663","#B19D68","#A5735B","#A06057","#9A5152","#A87E5D","#7D2E34","#A9835E","#C3BEA6","#CFCEC9","#A46E5A","#F4F4F4","#DADAD8","#B29F69","#EDEDED","#BBB289","#9D5754","#AF9764","#904148","#994F51","#B3A36E","#A87F5E","#A26859","#AC8D61","#BDB590","#AA875F","#A77A5D","#AB8A60","#A4715B","#611418","#BFB897","#E6E6E6","#9B5353","#D5D4D1","#974A4F","#C8C6BA","#A16558","#9F5E56","#76272C","#67191D","#8C3C43","#B9AF82","#C3BFA9","#B5A874","#4F0205"]},broc:{discrete:["#2C1A4C","#2B2154","#2B295B","#2A3164","#29396C","#284174","#29497C","#2A5183","#305C8C","#376593","#416D9A","#4B76A0","#567FA6","#6489AD","#6F92B3","#7B9BBA","#86A3C0","#92ACC6","#A0B7CD","#ACC0D3","#B8C9DA","#C4D2E0","#D0DBE6","#DEE5EC","#E7ECED","#EDEFE9","#EDEEE1","#E9E9D4","#E4E4C8","#DEDEBD","#D8D8B1","#D2D2A5","#C9C996","#C1C18A","#B8B87E","#AEAE73","#A3A369","#97975E","#8D8D56","#83834D","#797945","#70703D","#646434","#5B5B2C","#525224","#49491D","#404016","#36360F","#2E2E08","#262600"],categorical:["#2C1A4C","#2B2154","#2B295B","#2A3164","#29396C","#284174","#29497C","#2A5183","#305C8C","#376593","#416D9A","#4B76A0","#567FA6","#6489AD","#6F92B3","#7B9BBA","#86A3C0","#92ACC6","#A0B7CD","#ACC0D3","#B8C9DA","#C4D2E0","#D0DBE6","#DEE5EC","#E7ECED","#EDEFE9","#EDEEE1","#E9E9D4","#E4E4C8","#DEDEBD","#D8D8B1","#D2D2A5","#C9C996","#C1C18A","#B8B87E","#AEAE73","#A3A369","#97975E","#8D8D56","#83834D","#797945","#70703D","#646434","#5B5B2C","#525224","#49491D","#404016","#36360F","#2E2E08","#262600"]},broco:{discrete:["#372F38","#36303D","#363144","#36354E","#363957","#373F60","#39456A","#3C4D75","#415780","#47608A","#4D6992","#55729A","#5D7BA2","#6886AA","#728FB1","#7C97B7","#86A0BD","#91A8C2","#9DB2C8","#A7BACC","#B1C1CE","#BAC8D0","#C2CDD0","#CAD1CD","#CED3C8","#CFD3C2","#CFD1B9","#CBCCAD","#C6C6A2","#BFBF96","#B8B78B","#AFAF7F","#A4A472","#9B9A68","#91915E","#888755","#7E7E4C","#737243","#6B693D","#626137","#5B5932","#54512E","#4C482B","#474229","#423D29","#3F3829","#3C352B","#39322E","#383032","#372F37"],categorical:["#372F38","#36303D","#363144","#36354E","#363957","#373F60","#39456A","#3C4D75","#415780","#47608A","#4D6992","#55729A","#5D7BA2","#6886AA","#728FB1","#7C97B7","#86A0BD","#91A8C2","#9DB2C8","#A7BACC","#B1C1CE","#BAC8D0","#C2CDD0","#CAD1CD","#CED3C8","#CFD3C2","#CFD1B9","#CBCCAD","#C6C6A2","#BFBF96","#B8B78B","#AFAF7F","#A4A472","#9B9A68","#91915E","#888755","#7E7E4C","#737243","#6B693D","#626137","#5B5932","#54512E","#4C482B","#474229","#423D29","#3F3829","#3C352B","#39322E","#383032","#372F37"]},buda:{discrete:["#B301B3","#B30BAE","#B314AA","#B31CA6","#B323A2","#B3289F","#B32E9D","#B4339A","#B53998","#B63E96","#B84394","#B94892","#BB4C91","#BD528F","#BE568D","#C05B8C","#C15F8A","#C36389","#C46987","#C66D86","#C77184","#C97583","#CA7982","#CB7E80","#CD837F","#CE877E","#CF8B7D","#D0917B","#D1957A","#D29979","#D49E78","#D5A277","#D6A776","#D7AC75","#D8B073","#D9B572","#DAB971","#DCBF70","#DDC36F","#DEC86E","#DFCC6C","#E0D16B","#E2D76A","#E4DC69","#E6E168","#E9E667","#EDEC67","#F3F366","#F9F966","#FFFF66"],categorical:["#B301B3","#FFFF66","#CD857E","#BC4E90","#DBBD70","#C56A87","#B32F9C","#E3DB69","#D4A177","#EDEC67","#D1937B","#B73F95","#C05C8B","#DFCB6D","#C97882","#B31CA6","#D8AE74","#E7E368","#DAB572","#B311AC","#D39A79","#C36389","#C77184","#B53798","#E1D36B","#BE558E","#B94793","#CB7E80","#CF8C7C","#DDC46E","#B326A0","#F6F566","#D6A875","#DAB971","#C66E86","#E2D76A","#B32B9E","#B317A9","#B4339A","#BA4B91","#C46788","#C2608A","#B309AF","#D49E78","#B63B97","#BD528F","#DCC06F","#EAE767","#FAFA66","#D2977A","#F1F066","#D0907C","#CE897D","#C87483","#CC827F","#D5A576","#B321A3","#E5DF68","#B84394","#D9B273","#E0CF6C","#CA7B81","#DEC86E","#BF598C","#D7AB75","#E6E168","#D1957A","#CC8080","#D39C78","#E0CD6C","#CD847F","#B63D96","#C87384","#C66C86","#F8F866","#D49F78","#D9B473","#DAB772","#BF578D","#CB7D81","#CF8A7D","#B32D9D","#D08E7C","#DBBB71","#C2628A","#E2D56A","#DCBF70","#BC508F","#C46987","#C05B8C","#DFCA6D","#DDC26F","#C15E8B","#D7AD74","#F3F366","#DEC66E","#D5A377","#B31AA7","#BA4992","#CE877E"]},bukavu:{discrete:["#1A3333","#1B373D","#1C3C47","#1E4255","#1F4762","#214E71","#235582","#255E92","#2969A1","#2C73AD","#2F7CB8","#3485C2","#3B8EC7","#4799C8","#50A1C9","#59AAC9","#62B2CA","#6BBACB","#76C3CB","#81CCCD","#92D5D1","#A4DED5","#B6E7DA","#CCF2DF","#DDFBE3","#034224","#08491F","#115119","#1C5914","#2B6212","#3D6915","#4E6E1B","#617224","#6F742B","#7B7631","#867836","#917B3C","#9E7E45","#AA844F","#B48D5D","#BC976C","#C3A27C","#CAB08F","#CFBBA0","#D5C6B0","#DACFC1","#DFD7D0","#E4DFE0","#E9E6ED","#EDEDFC"],categorical:["#1A3333","#1B373D","#1C3C47","#1E4255","#1F4762","#214E71","#235582","#255E92","#2969A1","#2C73AD","#2F7CB8","#3485C2","#3B8EC7","#4799C8","#50A1C9","#59AAC9","#62B2CA","#6BBACB","#76C3CB","#81CCCD","#92D5D1","#A4DED5","#B6E7DA","#CCF2DF","#DDFBE3","#034224","#08491F","#115119","#1C5914","#2B6212","#3D6915","#4E6E1B","#617224","#6F742B","#7B7631","#867836","#917B3C","#9E7E45","#AA844F","#B48D5D","#BC976C","#C3A27C","#CAB08F","#CFBBA0","#D5C6B0","#DACFC1","#DFD7D0","#E4DFE0","#E9E6ED","#EDEDFC"]},cork:{discrete:["#2C194C","#2B2254","#2B295C","#2A3265","#293A6D","#284275","#284A7C","#2A5284","#2F5C8D","#366493","#3F6C99","#49749F","#527CA4","#5E85AA","#688DB0","#7395B6","#7E9DBB","#8AA6C2","#99B1C9","#A5BBD0","#B2C5D7","#C0CFDE","#CDD9E5","#DCE5EB","#E5ECED","#E6EEEA","#E0EAE1","#D4E2D4","#C8DBC8","#BCD3BC","#B0CAB0","#A4C2A3","#95B895","#89B088","#7DA87D","#71A071","#669966","#599059","#4F894E","#458244","#3B7B3A","#317430","#266A25","#1F611D","#1A5816","#174E12","#14450E","#123A0A","#103107","#0F2903"],categorical:["#2C194C","#2B2254","#2B295C","#2A3265","#293A6D","#284275","#284A7C","#2A5284","#2F5C8D","#366493","#3F6C99","#49749F","#527CA4","#5E85AA","#688DB0","#7395B6","#7E9DBB","#8AA6C2","#99B1C9","#A5BBD0","#B2C5D7","#C0CFDE","#CDD9E5","#DCE5EB","#E5ECED","#E6EEEA","#E0EAE1","#D4E2D4","#C8DBC8","#BCD3BC","#B0CAB0","#A4C2A3","#95B895","#89B088","#7DA87D","#71A071","#669966","#599059","#4F894E","#458244","#3B7B3A","#317430","#266A25","#1F611D","#1A5816","#174E12","#14450E","#123A0A","#103107","#0F2903"]},corko:{discrete:["#3F3E3A","#3E3D3F","#3E3D44","#3E3D4B","#3E3F52","#3E425A","#3F4762","#414C6C","#445578","#485D82","#4E658B","#546E94","#5C779C","#6581A5","#6E8AAC","#7792B2","#809BB8","#89A3BD","#94ACC2","#9CB3C5","#A3BAC7","#A9C0C8","#AEC5C7","#B0C9C4","#B0CABF","#ADCAB9","#A9C9B2","#A2C5A8","#9BC19F","#93BC95","#8BB68B","#82B081","#78A775","#709F6A","#689760","#608E56","#5A864C","#537B42","#4F733B","#4B6B35","#486431","#465D2E","#44562C","#43512C","#424D2D","#42492E","#414630","#404333","#404036","#3F3E3A"],categorical:["#3F3E3A","#3E3D3F","#3E3D44","#3E3D4B","#3E3F52","#3E425A","#3F4762","#414C6C","#445578","#485D82","#4E658B","#546E94","#5C779C","#6581A5","#6E8AAC","#7792B2","#809BB8","#89A3BD","#94ACC2","#9CB3C5","#A3BAC7","#A9C0C8","#AEC5C7","#B0C9C4","#B0CABF","#ADCAB9","#A9C9B2","#A2C5A8","#9BC19F","#93BC95","#8BB68B","#82B081","#78A775","#709F6A","#689760","#608E56","#5A864C","#537B42","#4F733B","#4B6B35","#486431","#465D2E","#44562C","#43512C","#424D2D","#42492E","#414630","#404333","#404036","#3F3E3A"]},davos:{discrete:["#00054A","#010E51","#041459","#081C61","#0C2368","#102A6F","#133075","#17377C","#1C3F83","#204588","#244C8D","#295291","#2D5895","#335F98","#38649A","#3C699C","#416E9D","#46729D","#4C779D","#517B9C","#567F9B","#5A829A","#5F8598","#658996","#698C94","#6E8F92","#739290","#78968D","#7D998C","#829D8A","#88A089","#8DA488","#95AA87","#9BAF88","#A3B489","#ABBB8C","#B4C190","#BFCA96","#C9D29E","#D2D9A6","#DBE0AF","#E3E7B8","#EBEDC4","#F0F1CD","#F4F4D6","#F7F7DE","#FAF9E6","#FCFCF0","#FDFDF7","#FEFEFE"],categorical:["#00054A","#FDFDF4","#688B94","#2D5895","#B2C08F","#E8EBC0","#87A089","#133075","#4B769D","#5A829A","#204588","#76958E","#D0D8A4","#99AD88","#F6F6DB","#3C699C","#081C61","#031256","#1A3B7F","#537C9C","#A4B68A","#C1CC98","#7E9A8B","#FAFAE8","#356199","#0E266B","#DEE3B3","#274F90","#6F9091","#618697","#8FA588","#F0F1CD","#43709D","#1D4084","#47739D","#F3F4D4","#658996","#567F9B","#17367A","#FCFBEE","#4F799D","#C9D29E","#93A987","#39659B","#D8DEAB","#ABBB8C","#739290","#B9C693","#F8F8E1","#234A8C","#112B70","#7A978D","#9EB188","#315C97","#829D8A","#05175B","#010C50","#3F6C9D","#0B2065","#5D8499","#2A5392","#8BA388","#6B8D93","#EDEFC7","#E3E7B8","#22488A","#638897","#122E73","#00094D","#AEBD8D","#4D789D","#CDD5A1","#5F8598","#58819A","#071A5E","#0C2368","#18387D","#91A787","#37639A","#EBEDC4","#F2F2D0","#FBFBEB","#74938F","#2F5A96","#335F98","#809B8B","#BDC995","#49759D","#719191","#9BAF88","#F7F7DE","#1B3E82","#A8B88B","#849E89","#557E9B","#E6E9BC","#45719D","#1E4386","#96AB87","#89A188"]},devon:{discrete:["#2C1A4C","#2B1E51","#2B2356","#2A295B","#2A2D60","#293265","#29376A","#283B6E","#274174","#27467A","#274C7F","#275186","#28568C","#2A5C95","#2D609C","#3064A3","#3468AA","#396BB1","#3F70B9","#4774C0","#4F79C6","#597DCC","#6382D1","#6F88D7","#798CDB","#8290DF","#8C95E2","#969AE6","#9E9EE9","#A6A3EB","#ACA7ED","#B1ACEF","#B7B1F0","#BBB5F1","#BFB9F2","#C3BEF3","#C7C2F4","#CCC7F4","#D0CCF5","#D4D0F6","#D8D4F7","#DCD9F8","#E1DEF9","#E5E3FA","#E9E7FB","#EDECFB","#F2F0FC","#F7F6FD","#FBFAFE","#FFFFFF"],categorical:["#2C1A4C","#F8F8FE","#758AD9","#C6C0F3","#28568C","#29376A","#AAA5ED","#DEDCF8","#3D6EB7","#EBE9FB","#9197E4","#3063A2","#274579","#577CCB","#D2CEF6","#2A285A","#BAB3F1","#B2ADEF","#F2F0FC","#274E82","#2A2F62","#CCC7F4","#9E9EE9","#4875C1","#C0BAF2","#2B5D98","#3669AD","#2B2154","#E4E2FA","#8290DF","#D8D4F7","#6784D3","#283E71","#C9C4F4","#BDB7F1","#DBD8F8","#283A6D","#4F79C6","#A4A2EB","#EEEDFC","#CFCBF5","#E8E5FA","#5F80CF","#4272BC","#B6B0F0","#2B1D50","#AEA9EE","#275287","#2A2B5E","#989BE7","#293366","#27497D","#8A94E1","#295A92","#3266A7","#F5F4FD","#7B8DDC","#274174","#2D609C","#2B2558","#6F88D7","#E1DEF9","#3A6CB2","#D5D1F6","#C3BEF3","#2E629F","#3165A4","#8D95E3","#3468AA","#DAD6F7","#D1CDF5","#9B9CE8","#275084","#B8B2F0","#27477B","#6382D1","#4573BF","#A2A0EA","#F7F6FD","#C7C2F4","#F3F2FD","#274376","#8692E0","#2B1F52","#CAC6F4","#ACA7ED","#E3E0F9","#F0EEFC","#E6E4FA","#386AB0","#2C1C4E","#6B86D5","#28396B","#283C6F","#2A5C95","#2A2D60","#BEB9F2","#C2BCF2","#7E8FDD","#3F70B9"]},fes:{discrete:["#0D0D0D","#181818","#212121","#2B2B2B","#343434","#3C3C3C","#454545","#4D4D4D","#565656","#5E5E5E","#656565","#6D6D6D","#747474","#7C7C7C","#848484","#8B8B8B","#939393","#9C9C9C","#A7A7A7","#B1B1B1","#BBBBBB","#C5C5C5","#D1D1D1","#DFDFDF","#ECECEC","#094225","#184822","#2B4F20","#3A5420","#485822","#555B24","#615E26","#6F6229","#7A652B","#86682E","#926B30","#9F7035","#AD7940","#B6834D","#BD8E5C","#C2996C","#C6A47C","#CCB18F","#D1BCA0","#D5C6B0","#DACFC1","#DFD7CF","#E4DFE0","#E8E6ED","#EDEDFC"],categorical:["#0D0D0D","#181818","#212121","#2B2B2B","#343434","#3C3C3C","#454545","#4D4D4D","#565656","#5E5E5E","#656565","#6D6D6D","#747474","#7C7C7C","#848484","#8B8B8B","#939393","#9C9C9C","#A7A7A7","#B1B1B1","#BBBBBB","#C5C5C5","#D1D1D1","#DFDFDF","#ECECEC","#094225","#184822","#2B4F20","#3A5420","#485822","#555B24","#615E26","#6F6229","#7A652B","#86682E","#926B30","#9F7035","#AD7940","#B6834D","#BD8E5C","#C2996C","#C6A47C","#CCB18F","#D1BCA0","#D5C6B0","#DACFC1","#DFD7CF","#E4DFE0","#E8E6ED","#EDEDFC"]},glasgow:{discrete:["#361338","#3B1434","#401530","#45172C","#491828","#4D1924","#511B21","#561C1D","#5B1E18","#602014","#662210","#6B260B","#6F2B07","#723203","#743802","#743E01","#754300","#744900","#744F01","#745402","#735905","#725F0B","#716413","#70691E","#6E6E27","#6C7231","#6B763A","#697B46","#677F4F","#658359","#648763","#628B6C","#618F78","#609381","#60978A","#619B94","#659F9D","#6CA5A8","#74A9B0","#7DADB8","#86B1BF","#8EB4C6","#99B9CE","#A1BCD5","#AABFDB","#B2C3E1","#BBC6E7","#C6CBF0","#D0CFF7","#DBD3FF"],categorical:["#361338","#DBD3FF","#6D702B","#69A3A5","#702D06","#A0BBD3","#638968","#521B20","#745101","#84B0BE","#754001","#5F9587","#BBC6E7","#612013","#45172C","#687D4A","#726210","#618F78","#4B1926","#3E1532","#629C96","#658359","#CACCF3","#76AAB2","#6B763A","#744900","#6A250C","#ADC1DD","#735905","#92B6C9","#591D1A","#743702","#70681C","#4F1A23","#754400","#6D2909","#60998E","#41162F","#744D00","#745503","#B4C3E2","#697A42","#7DADB8","#628C70","#8BB3C3","#561C1D","#D2D0F9","#99B9CE","#3A1435","#6F6C23","#743B01","#60927F","#662210","#648661","#659F9D","#678051","#725E0A","#481829","#6FA6AB","#6C7332","#5D1E17","#A6BED8","#C2C9ED","#723203","#716617","#68240E","#6F6A20","#C6CBF0","#79ABB5","#72600D","#754200","#43162D","#67A1A1","#6B7536","#5F1F15","#735B07","#571C1B","#72A8AF","#744F01","#BEC8EA","#381337","#8EB4C6","#628B6C","#677E4D","#60917B","#639E9A","#4A1827","#A3BDD6","#3C1433","#743901","#632112","#B7C5E5","#4D1924","#65845D","#618E74","#609483","#9CBAD1","#46172A","#87B1C1","#6D712F"]},grayc:{discrete:["#000000","#090909","#111111","#171717","#1C1C1C","#212121","#252525","#2A2A2A","#303030","#343434","#393939","#3D3D3D","#424242","#474747","#4B4B4B","#505050","#545454","#585858","#5D5D5D","#616161","#656565","#696969","#6D6D6D","#717171","#757575","#797979","#7D7D7D","#818181","#858585","#898989","#8E8E8E","#929292","#979797","#9C9C9C","#A1A1A1","#A6A6A6","#ABABAB","#B1B1B1","#B6B6B6","#BCBCBC","#C1C1C1","#C7C7C7","#CECECE","#D5D5D5","#DBDBDB","#E2E2E2","#E8E8E8","#F1F1F1","#F8F8F8","#FFFFFF"],categorical:["#070707","#F9F9F9","#777777","#454545","#AEAEAE","#909090","#292929","#5F5F5F","#D1D1D1","#9E9E9E","#525252","#E4E4E4","#6C6C6C","#BFBFBF","#1A1A1A","#373737","#848484","#595959","#222222","#B6B6B6","#A6A6A6","#3E3E3E","#7D7D7D","#666666","#969696","#8A8A8A","#4B4B4B","#DADADA","#C8C8C8","#313131","#717171","#131313","#EFEFEF","#C4C4C4","#A2A2A2","#424242","#878787","#252525","#2D2D2D","#4F4F4F","#3B3B3B","#808080","#1E1E1E","#BBBBBB","#AAAAAA","#EAEAEA","#696969","#7A7A7A","#DFDFDF","#636363","#565656","#B2B2B2","#0E0E0E","#9A9A9A","#5C5C5C","#747474","#F3F3F3","#333333","#6E6E6E","#D5D5D5","#8D8D8D","#939393","#494949","#CCCCCC","#171717","#BDBDBD","#575757","#C1C1C1","#404040","#828282","#E2E2E2","#151515","#1C1C1C","#0B0B0B","#9C9C9C","#858585","#2F2F2F","#B4B4B4","#888888","#242424","#272727","#3C3C3C","#B0B0B0","#353535","#545454","#5B5B5B","#393939","#D7D7D7","#A4A4A4","#A8A8A8","#959595","#767676","#646464","#989898","#444444","#474747","#111111","#F6F6F6","#ECECEC","#4D4D4D"]},hawaii:{discrete:["#8C0273","#8E0D6E","#8F1569","#901D63","#91235F","#91285A","#922D56","#933252","#94384D","#943D4A","#954246","#964742","#964C3F","#97523B","#985638","#985C34","#996131","#9A662E","#9B6C2A","#9B7226","#9C7823","#9C7E20","#9D841E","#9D8C1C","#9C921C","#9B991D","#9AA021","#97A828","#94AE30","#91B439","#8CB942","#88BE4C","#82C359","#7EC663","#79CA6E","#74CE79","#70D183","#6AD591","#66D89C","#62DCA7","#60DFB2","#5FE2BD","#61E6CA","#67E9D5","#6FEBDE","#7AEEE7","#87EFEE","#98F1F5","#A6F1F9","#B3F2FD"],categorical:["#8C0273","#B3F2FD","#9C951C","#6CD48C","#964D3E","#8ABC48","#9B6D29","#66E8D3","#922E55","#9C801F","#87EFEE","#995D34","#7BC969","#901D63","#60DEB0","#96AA2B","#943D4A","#975439","#82C359","#5FE4C2","#9AA021","#73CE7B","#65D99E","#954544","#9D8A1C","#8E126B","#91B439","#9DF1F7","#73ECE2","#91265C","#9C7724","#9A652E","#93364F","#922A59","#996131","#9D851D","#9D901C","#9A692C","#68D695","#902160","#9B9A1E","#985836","#9B7226","#933252","#77CC72","#9C7B21","#954147","#8D0A6F","#93AF32","#62DCA7","#92F0F3","#8F1867","#7DEEE8","#97513C","#6CEBDB","#61E6CA","#A8F2FA","#964941","#7FC661","#86BF50","#98A526","#70D183","#5FE1B9","#8DB840","#94394D","#9C7923","#8F1569","#985A35","#60E0B4","#9A6B2A","#91245E","#97A828","#9B7425","#6AD591","#95AD2E","#5FE2BD","#60E5C6","#953F48","#933054","#63E7CF","#84C154","#8D0671","#82EFEB","#9B9D1F","#99A323","#88BE4C","#6ED288","#6FEBDE","#9A672D","#91285A","#75CD76","#995F32","#68E9D7","#9B7028","#61DDAB","#943B4B","#933450","#8DF0F0","#8F1A65","#81C45D"]},imola:{discrete:["#1A33B3","#1C37B1","#1E3AAF","#203EAD","#2242AB","#2345AA","#2548A8","#274CA6","#2950A4","#2A53A3","#2C56A1","#2E599F","#2F5D9E","#32609B","#346499","#366797","#386A95","#3B6C92","#3E708F","#41738C","#44768A","#467987","#4A7C85","#4E8082","#518480","#56887E","#5A8C7D","#5F927B","#64967A","#689B79","#6DA078","#72A576","#78AB75","#7DB074","#82B572","#87BA71","#8CBF70","#93C66E","#98CB6D","#9ED06C","#A4D66A","#ACDB69","#B5E268","#BFE767","#C8EB67","#D3F066","#DDF466","#EAF866","#F5FB66","#FFFF66"],categorical:["#1A33B3","#FFFF66","#54867F","#305E9D","#91C36F","#3F718E","#2549A8","#BDE667","#70A377","#2B53A2","#376896","#80B373","#A3D56B","#DDF466","#203EAD","#487B86","#62947A","#2D59A0","#88BB71","#5B8D7D","#CDED66","#4E8082","#EEF966","#33639A","#284EA5","#44768A","#2344AA","#AFDE69","#3B6C92","#78AB75","#1D39B0","#99CC6D","#699C79","#3D6F90","#2C56A1","#2F5B9E","#5E917B","#4B7D84","#9ED06C","#1F3CAE","#C4EA67","#84B772","#274CA6","#D5F066","#2951A4","#74A776","#578A7E","#2446A9","#1C36B1","#A9D96A","#95C86E","#467888","#2141AC","#7CAF74","#356598","#B5E268","#66987A","#396A94","#F7FC66","#8CBF70","#E6F666","#32609B","#518380","#41738C","#6DA078","#6B9E78","#B9E468","#7AAD74","#528580","#32629B","#86B971","#3C6E91","#5C8F7C","#C8EB67","#ACDB69","#D1EF66","#E2F566","#97CA6D","#1B35B2","#1C37B0","#2345AA","#2F5D9E","#1F3DAE","#457789","#3A6B93","#598B7D","#D9F266","#346499","#386995","#A6D76A","#366797","#274DA6","#56887E","#A1D36B","#42748B","#7EB173","#72A576","#477987","#4C7F83","#F2FB66"]},lajolla:{discrete:["#191900","#1E1B02","#221C05","#271E08","#2C200B","#31220E","#362411","#3C2614","#442817","#4B2B1B","#532D1F","#5B3023","#633328","#6E362D","#783932","#813C37","#8B3F3B","#96423F","#A24543","#AD4746","#B74A48","#C04D49","#C9514B","#D1564C","#D75C4D","#DB634E","#DD694F","#E0714F","#E17750","#E37D50","#E48351","#E58951","#E79052","#E89652","#E99C52","#EAA253","#EBA853","#EDAF54","#EEB555","#F0BC57","#F1C25A","#F3CA5F","#F5D369","#F7DA74","#F9E282","#FBE890","#FCEF9F","#FDF5B0","#FEFABE","#FFFECB"],categorical:["#191900","#FFFECB","#D85F4D","#ECAC54","#653329","#F7D971","#A44544","#E58751","#362411","#E1744F","#C44E4A","#E99A52","#4B2B1B","#833D38","#F1C159","#FCEF9F","#271E08","#FEF7B6","#402716","#D0554C","#FAE587","#E79052","#EFB655","#B54947","#201C04","#E37D50","#743830","#DD694F","#EBA353","#94413E","#572F21","#F4CD61","#2E210C","#FDF3AB","#32220F","#241D06","#F5D369","#7B3B34","#1D1B02","#F0BC57","#5E3125","#F8DF7C","#512D1E","#CA514B","#E48251","#E68C51","#EA9E53","#E89552","#BC4C49","#6C362C","#EDB154","#9C4341","#E27950","#FBEA93","#3B2513","#FEFBC0","#452918","#EBA853","#F2C75C","#8B3F3B","#DB644E","#AD4746","#DF6E4F","#D55A4D","#2B200A","#783932","#E79352","#D75C4D","#FEF9BB","#EDAF54","#E0714F","#7F3C36","#613227","#F7DC77","#C7504B","#F1C45A","#30210D","#F4D065","#1E1B03","#FAE78D","#F9E282","#DA614E","#392412","#4E2C1D","#E99C52","#EFB956","#221C05","#EBA553","#FDF5B0","#984240","#E38050","#8F403D","#542E20","#ECAA54","#E68E51","#70372E","#DE6C4F","#B94A48","#291F09","#1B1A01"]},lapaz:{discrete:["#1A0C64","#1C1368","#1E196D","#202071","#212675","#222B79","#23317D","#253681","#263C85","#274189","#29478C","#2A4C8F","#2C5192","#2E5795","#305C98","#32609A","#35659C","#386A9E","#3C70A0","#3F74A1","#4379A2","#487DA3","#4D81A3","#5386A4","#588AA3","#5E8EA3","#6591A2","#6C95A1","#7398A0","#7A9A9E","#809D9D","#879F9B","#90A199","#97A397","#9EA596","#A5A795","#ADAA95","#B7AD96","#BFB199","#C8B69C","#D2BBA2","#DAC1A8","#E4C9B2","#EBCFBB","#F1D5C4","#F5DBCD","#F9E1D6","#FBE8E1","#FDEDEA","#FEF2F3"],categorical:["#1A0C64","#FEF2F3","#5B8BA3","#B3AC96","#2C5292","#3C70A0","#EACEB9","#859E9C","#24327E","#6F96A1","#33619A","#202071","#D0BAA0","#9BA496","#F9E1D6","#4A7FA3","#284289","#90A199","#FCEAE5","#1D176B","#37699D","#F3D8C8","#A7A895","#5285A4","#7A9A9E","#2F5A97","#4278A2","#263A84","#6591A2","#C1B299","#DEC3AB","#222978","#2A4B8E","#5688A4","#D7BEA6","#FDEEEC","#608EA3","#EFD3C0","#A1A696","#6A94A1","#FBE6DD","#ADAA95","#F6DDCF","#4E82A3","#2E5695","#3A6D9F","#C8B69C","#1C1268","#232D7B","#3F74A1","#467BA3","#1E1C6E","#7F9C9D","#BAAF97","#253681","#315E99","#29478C","#E4C9B2","#74989F","#273E87","#212575","#95A398","#8AA09A","#35659C","#2B4F91","#23307C","#E7CBB5","#F1D5C4","#2B4D90","#202373","#588AA3","#D3BCA3","#5487A4","#447AA2","#6792A2","#24347F","#253882","#ECD0BD","#879F9B","#305C98","#E1C6AF","#1E196D","#5D8DA3","#AAA995","#386B9E","#487DA3","#77999F","#F7DFD3","#BEB098","#1F1E70","#325F99","#4176A2","#F4DACB","#4C80A3","#2D5494","#8DA099","#6C95A1","#FAE3DA","#FDECE8","#B7AD96"]},lipari:{discrete:["#031326","#05192F","#062038","#092844","#0C2E4D","#103557","#163C5F","#1E4368","#294B70","#345075","#3E5578","#47587A","#4F5B7B","#575C7A","#5D5D79","#635E78","#695E76","#6E5F75","#765F73","#7C6071","#826070","#89606E","#90616C","#98616A","#A06268","#A86266","#B06364","#BA6462","#C36660","#CB685F","#D46B5E","#DB705F","#E27760","#E77E63","#E98567","#EA8D6B","#EA946F","#E89C75","#E7A279","#E6A87E","#E5AF84","#E5B58A","#E6BD92","#E7C49A","#EACCA3","#EDD3AD","#F0DBB7","#F5E5C4","#F9EDCF","#FDF5DA"],categorical:["#031326","#FDF5DA","#A56267","#525B7A","#E99B74","#785F72","#DA6F5E","#183E61","#E7C398","#8D616D","#365176","#092844","#655E77","#E98466","#BF6561","#F0DBB7","#E5AD82","#B26364","#EBCFA7","#5C5D79","#061D35","#25486D","#0E3353","#EA906D","#98616A","#E37861","#E5B88C","#826070","#CD685F","#6E5F75","#45587A","#F6E8C9","#E7A37A","#615E78","#E77E63","#D46B5E","#9F6268","#E99570","#93616B","#87606E","#7D6071","#F3E1C0","#575C7A","#0B2D4B","#2D4D72","#E6A87E","#E9C99F","#FAEED1","#1E4368","#EA8A69","#B86462","#6A5E76","#AB6365","#735F74","#DF735F","#E5B287","#13385A","#05182D","#E6BD92","#3E5578","#EDD5AF","#07223C","#C6665F","#4C5A7A","#E8A077","#B56363","#FBF1D6","#A26267","#E6C095","#0A2A48","#F8EBCD","#EACCA3","#AE6364","#7A5F72","#635E78","#E98768","#041629","#715F74","#ECD2AB","#A86266","#8A606E","#96616B","#545C7A","#EFD8B3","#F5E5C4","#9B6169","#F2DEBB","#765F73","#6C5F75","#294B70","#22466B","#E89D76","#E88165","#BC6461","#E6A67C","#85606F","#C36660","#1B4064","#D06A5E","#103557"]},lisbon:{discrete:["#E6E5FF","#D8DCF7","#CBD2EF","#BBC6E5","#ADBCDE","#A0B3D6","#93A9CE","#86A0C6","#7794BD","#6A8BB5","#5E81AC","#5177A4","#456E9B","#38628F","#2F5984","#274F78","#20476D","#1B3F61","#173653","#142E48","#12283E","#112233","#111D2A","#121921","#15181B","#181A18","#1E1D17","#252419","#2D2B1C","#353220","#3E3A25","#46422A","#514C31","#5A5536","#645E3C","#6D6741","#777047","#837B4F","#8D8556","#988F5E","#A29A67","#ADA470","#B9B17D","#C3BC89","#CDC795","#D7D2A2","#E0DCAF","#ECE9BE","#F5F4CB","#FFFFD9"],categorical:["#E6E5FF","#D8DCF7","#CBD2EF","#BBC6E5","#ADBCDE","#A0B3D6","#93A9CE","#86A0C6","#7794BD","#6A8BB5","#5E81AC","#5177A4","#456E9B","#38628F","#2F5984","#274F78","#20476D","#1B3F61","#173653","#142E48","#12283E","#112233","#111D2A","#121921","#15181B","#181A18","#1E1D17","#252419","#2D2B1C","#353220","#3E3A25","#46422A","#514C31","#5A5536","#645E3C","#6D6741","#777047","#837B4F","#8D8556","#988F5E","#A29A67","#ADA470","#B9B17D","#C3BC89","#CDC795","#D7D2A2","#E0DCAF","#ECE9BE","#F5F4CB","#FFFFD9"]},managua:{discrete:["#FFCF67","#F9C564","#F3BB60","#EBB05D","#E5A659","#DF9D56","#D99554","#D38C51","#CC824D","#C67B4B","#C07348","#B96C46","#B36444","#AB5C41","#A4553F","#9D4F3D","#95483C","#8E423A","#843B39","#7C3639","#743139","#6D2D3A","#662A3D","#5F2941","#5A2846","#552A4C","#522C53","#4F315D","#4D3566","#4C3B6F","#4C4179","#4C4883","#4D518E","#4F5897","#51609F","#5367A7","#556FAE","#5878B6","#5B80BC","#5E88C2","#6190C8","#6498CE","#68A3D5","#6BACDB","#6FB5E1","#72BEE6","#76C7EC","#7AD3F3","#7DDDF9","#81E7FF"],categorical:["#FFCF67","#F9C564","#F3BB60","#EBB05D","#E5A659","#DF9D56","#D99554","#D38C51","#CC824D","#C67B4B","#C07348","#B96C46","#B36444","#AB5C41","#A4553F","#9D4F3D","#95483C","#8E423A","#843B39","#7C3639","#743139","#6D2D3A","#662A3D","#5F2941","#5A2846","#552A4C","#522C53","#4F315D","#4D3566","#4C3B6F","#4C4179","#4C4883","#4D518E","#4F5897","#51609F","#5367A7","#556FAE","#5878B6","#5B80BC","#5E88C2","#6190C8","#6498CE","#68A3D5","#6BACDB","#6FB5E1","#72BEE6","#76C7EC","#7AD3F3","#7DDDF9","#81E7FF"]},navia:{discrete:["#031327","#041930","#051E3A","#052546","#062B50","#06315A","#073764","#083E6D","#0B4578","#0E4C80","#115286","#15588B","#195E8E","#1E6491","#216991","#246D91","#27718F","#2A748E","#2D788C","#307A8A","#337D89","#368087","#398385","#3C8683","#3F8981","#428C7F","#468F7D","#4A937A","#4E9678","#529A76","#579E73","#5BA271","#62A86E","#67AD6B","#6EB269","#76B768","#7FBD68","#8CC56A","#98CB6F","#A4D176","#B1D67F","#BCDB89","#C9E096","#D3E3A1","#DCE7AC","#E3EAB6","#EAEDBF","#F1F0CA","#F7F2D2","#FCF4D9"],categorical:["#031327","#FCF4D9","#408A80","#87C269","#1B608F","#59A072","#073966","#D1E39F","#2F798B","#EAEDBF","#052546","#266F90","#6BB06A","#0E4D81","#AED57D","#4C947A","#378186","#DFE8B0","#337D89","#2A748E","#14578A","#051C36","#9ACC70","#0A4374","#468F7D","#529A76","#F4F1CD","#062F56","#C1DC8D","#206891","#78B968","#62A86E","#3C8583","#569D74","#236C91","#F8F3D3","#D8E5A8","#0C487B","#04182E","#71B469","#B8D985","#07345E","#05213E","#4F9778","#5DA470","#3E8882","#062A4E","#7FBD68","#EFEFC6","#C9E096","#115286","#2C768D","#1E6491","#49917B","#66AC6C","#28718F","#A4D176","#90C76C","#438C7F","#175C8D","#083E6D","#E5EAB8","#317B8A","#357F87","#398385","#B3D781","#0D4A7E","#1C6290","#052342","#579F73","#9FCE73","#448D7E","#051A32","#FAF3D6","#428B7F","#29738F","#104F84","#5FA66F","#509877","#8CC56A","#094071","#2D788C","#083B6A","#D5E4A3","#2B758D","#226A91","#04162B","#BCDB89","#47907C","#4D9579","#E2E9B4","#7BBB68","#6EB269","#135488","#4A937A","#F1F0CA","#5BA271","#C5DE92","#F6F2D0","#CDE19B"]},naviaw:{discrete:["#041427","#051A31","#05203B","#062747","#072D52","#08345C","#0A3A66","#0C416F","#0F4979","#135080","#175686","#1B5D8A","#1F628D","#23698F","#276D8F","#2A728F","#2D758E","#30798D","#347D8B","#378089","#3A8388","#3D8686","#408984","#448C82","#489080","#4B937E","#50977C","#559C79","#5AA077","#5FA575","#65AA73","#6CAF71","#76B671","#7FBD71","#89C474","#95CB78","#A2D27F","#B1D98A","#BEDF95","#C9E5A1","#D3E9AD","#DBEDB9","#E4F1C6","#E9F4D0","#EEF6D9","#F2F8E1","#F6FAE9","#F9FCF1","#FCFDF7","#FEFEFD"],categorical:["#041427","#FBFDF6","#478F80","#9FD07D","#1F628D","#64A973","#E3F0C4","#0A3A66","#337C8B","#C7E49E","#7DBC71","#549B7A","#2A718F","#135080","#F2F8E1","#3C8586","#062747","#D7EBB2","#418A83","#B4DB8C","#2E778D","#6FB271","#EBF5D4","#0E4574","#051D37","#4D957D","#256B8F","#195A88","#388189","#F7FAEC","#5CA276","#8CC574","#073056","#31798C","#367E8A","#69AD72","#E7F3CC","#104A7A","#95CB78","#EFF6DB","#0B406D","#2C748E","#4A927F","#DDEEBB","#50987C","#165584","#589E78","#76B671","#3F8785","#05192F","#BEDF95","#448C82","#22678E","#06223F","#A9D684","#08355E","#CFE8A8","#F9FCF1","#286E8F","#85C172","#072C50","#F5F9E7","#1C5F8B","#3A8387","#60A675","#F3F9E4","#0C4271","#266D8F","#81BE72","#0A3D6A","#4B937E","#9ACD7B","#EDF5D7","#90C876","#A4D381","#378089","#1B5D8A","#489080","#145282","#DAECB6","#67AB73","#CBE6A3","#B9DD90","#3D8686","#23698F","#6CAF71","#FAFCF3","#79B971","#D3E9AD","#5AA077","#458E81","#72B471","#327B8C","#E5F1C8","#051B33","#F8FBEE","#062443","#398288","#2B728F","#06294C"]},nuuk:{discrete:["#05598C","#0E5B8B","#155C89","#1C5E87","#226085","#276184","#2C6383","#326682","#386982","#3E6C82","#446F82","#4A7283","#517584","#587A86","#5F7D88","#66818A","#6C858C","#73898E","#7B8E91","#819192","#879594","#8D9996","#939C97","#99A097","#9EA498","#A2A798","#A6AA97","#ABAD96","#AEAF95","#B1B194","#B3B492","#B6B690","#B8B88E","#BABA8C","#BDBC8A","#BFBE88","#C1C187","#C4C385","#C7C684","#CAC983","#CDCD83","#D2D184","#D7D787","#DDDD8B","#E3E290","#E8E895","#EEEE9C","#F4F4A4","#F9F9AB","#FEFEB2"],categorical:["#05598C","#FEFEB2","#A1A698","#537785","#C3C385","#B5B591","#7D8F91","#2D6483","#DDDD8B","#919B96","#BCBC8B","#3F6C82","#CDCD83","#1C5E87","#ADAE95","#68838B","#EEEE9C","#A7AA97","#879594","#C8C783","#F6F6A7","#135C89","#B9B98E","#497183","#73898E","#366882","#C0BF88","#D4D486","#99A097","#B1B293","#5E7D88","#256185","#E6E693","#829293","#788C90","#9DA398","#AAAC96","#E1E18F","#3B6A82","#638089","#B3B492","#A4A897","#446F82","#BABA8C","#D8D888","#185D88","#8C9895","#215F86","#BEBD89","#B7B78F","#CACA83","#4E7484","#C1C186","#959E97","#F2F2A1","#AFB094","#326682","#587A86","#296284","#FAFAAD","#6E868C","#C5C584","#D1D084","#0D5B8B","#E9E997","#DFDF8D","#66818A","#B0B194","#5B7B87","#2B6383","#859493","#CCCB83","#F8F8AA","#D2D285","#1F5F86","#70878D","#4B7383","#768B8F","#FCFCAF","#A9AB97","#BFBE88","#C9C983","#346782","#DBDA89","#236085","#BDBD8A","#BAB98D","#B8B88E","#2F6583","#939C97","#9FA498","#A2A798","#CFCF84","#B4B591","#C4C485","#979F97","#F0F09E","#155C89","#9BA298","#517584"]},oleron:{discrete:["#1A2659","#212E61","#293568","#323F72","#3A477A","#424F82","#4A578A","#535F92","#5D699C","#6572A5","#6E7BAE","#7784B7","#808DC0","#8B97CA","#94A1D3","#9DAADC","#A6B3E5","#AFBCEC","#B9C6F2","#C0CDF5","#C7D4F7","#CEDAF9","#D4E1FB","#DCE9FD","#E3F0FE","#1F4E00","#2C5100","#3A5600","#445900","#4F5C02","#5A6005","#65660C","#736D18","#7E7423","#8A7B2E","#94823A","#9F8945","#AC9253","#B79A5E","#C3A36A","#CEAC75","#D9B581","#E5C090","#EDC99D","#F2D2A9","#F6DAB5","#F8E2C0","#FAECCE","#FBF4DA","#FDFDE6"],categorical:["#1A2659","#212E61","#293568","#323F72","#3A477A","#424F82","#4A578A","#535F92","#5D699C","#6572A5","#6E7BAE","#7784B7","#808DC0","#8B97CA","#94A1D3","#9DAADC","#A6B3E5","#AFBCEC","#B9C6F2","#C0CDF5","#C7D4F7","#CEDAF9","#D4E1FB","#DCE9FD","#E3F0FE","#1F4E00","#2C5100","#3A5600","#445900","#4F5C02","#5A6005","#65660C","#736D18","#7E7423","#8A7B2E","#94823A","#9F8945","#AC9253","#B79A5E","#C3A36A","#CEAC75","#D9B581","#E5C090","#EDC99D","#F2D2A9","#F6DAB5","#F8E2C0","#FAECCE","#FBF4DA","#FDFDE6"]},oslo:{discrete:["#010101","#04070B","#060C13","#0A121B","#0C1620","#0D1927","#0E1D2D","#0F2133","#10263C","#112A43","#122E4A","#133251","#153758","#173C61","#194169","#1B4670","#1E4A78","#214F80","#255589","#295A91","#2E5F99","#3364A1","#3A6AA9","#4371B2","#4B77B9","#537DBE","#5B83C3","#6489C6","#6B8EC8","#7292C9","#7896C9","#7E9ACA","#859ECA","#8BA2C9","#91A6C9","#97A9C9","#9DADC9","#A4B2CA","#AAB6CA","#B1BBCB","#B8BFCD","#BFC5CF","#C7CCD3","#CFD2D8","#D7D9DD","#DEE0E2","#E6E7E9","#EFF0F1","#F7F7F8","#FFFFFF"],categorical:["#030609","#F9F9F9","#507BBC","#163B5E","#A0AFC9","#7B98CA","#27588E","#0E2032","#CACED5","#122D48","#3767A6","#1D4875","#8DA3C9","#E2E3E5","#678BC7","#B4BDCC","#0C151F","#BFC5CF","#97A9C9","#4371B2","#10263D","#080E16","#7292C9","#215081","#2E5F99","#AAB6CA","#ECEDEE","#0D1A28","#143454","#D5D8DC","#5B83C3","#19426A","#859ECA","#13314E","#0E1D2D","#3D6CAC","#6C8FC8","#7795C9","#F3F3F4","#4976B8","#245488","#DBDDE0","#112A43","#92A6C9","#C5C9D2","#809BCA","#0F2337","#3263A0","#050A10","#B9C1CD","#1F4C7B","#183E64","#A5B3CA","#0A121B","#9CACC9","#6187C5","#0D1824","#8AA1CA","#2A5B93","#547EBF","#D1D3D9","#E6E7E9","#1B456F","#B0BACB","#153758","#7494C9","#D8DADE","#6A8DC8","#90A5C9","#99ABC9","#235285","#133251","#060C13","#406EAF","#7E9ACA","#173C61","#4C78BA","#122F4B","#1C4772","#87A0CA","#CED1D7","#C2C7D1","#0F253A","#2C5D96","#C7CCD3","#112B45","#EFF0F1","#6F90C9","#0E1E2F","#ADB8CB","#7997CA","#4673B5","#15395B","#091018","#194067","#30619C","#94A8C9","#F6F6F6","#0F2135","#A3B1CA"]},roma:{discrete:["#7E1700","#832504","#883008","#8F3C0C","#934610","#984E14","#9C5717","#A05F1B","#A5681F","#A97023","#AD7826","#B0802B","#B58930","#BA9437","#BE9D3E","#C2A647","#C7B051","#CBBA5D","#CFC66D","#D1CF7B","#D2D78A","#D2DE98","#D0E4A6","#CBE8B4","#C4EABE","#BDEAC6","#B3E9CD","#A6E6D2","#9BE2D5","#8EDDD7","#81D7D7","#74CFD6","#64C6D5","#59BDD2","#4FB5D0","#46ACCC","#3EA4C9","#379AC5","#3292C2","#2E8ABF","#2B82BB","#287AB8","#2471B4","#2269B0","#1F60AD","#1C58A9","#194FA5","#1344A0","#0C3B9C","#033198"],categorical:["#7E1700","#832504","#883008","#8F3C0C","#934610","#984E14","#9C5717","#A05F1B","#A5681F","#A97023","#AD7826","#B0802B","#B58930","#BA9437","#BE9D3E","#C2A647","#C7B051","#CBBA5D","#CFC66D","#D1CF7B","#D2D78A","#D2DE98","#D0E4A6","#CBE8B4","#C4EABE","#BDEAC6","#B3E9CD","#A6E6D2","#9BE2D5","#8EDDD7","#81D7D7","#74CFD6","#64C6D5","#59BDD2","#4FB5D0","#46ACCC","#3EA4C9","#379AC5","#3292C2","#2E8ABF","#2B82BB","#287AB8","#2471B4","#2269B0","#1F60AD","#1C58A9","#194FA5","#1344A0","#0C3B9C","#033198"]},romao:{discrete:["#733957","#773850","#7A3849","#7E3942","#823C3D","#863F38","#8A4334","#8E4831","#94502E","#98572C","#9D5F2B","#A3672C","#A8712E","#AF7D32","#B58837","#BB933F","#C19F47","#C6AA52","#CDB761","#D1C26E","#D4CB7B","#D6D388","#D5D995","#D3DEA3","#CEE0AD","#C8E1B6","#C1E1BE","#B6DEC5","#ABDBC9","#A0D6CC","#94D0CE","#88C9CF","#7BC0CE","#70B8CD","#67AFCA","#5FA6C7","#589CC4","#5291BE","#4F88B9","#4E7EB3","#4F75AC","#516BA4","#55609A","#595891","#5D5087","#62497D","#664474","#6B3F69","#6F3B60","#723959"],categorical:["#733957","#773850","#7A3849","#7E3942","#823C3D","#863F38","#8A4334","#8E4831","#94502E","#98572C","#9D5F2B","#A3672C","#A8712E","#AF7D32","#B58837","#BB933F","#C19F47","#C6AA52","#CDB761","#D1C26E","#D4CB7B","#D6D388","#D5D995","#D3DEA3","#CEE0AD","#C8E1B6","#C1E1BE","#B6DEC5","#ABDBC9","#A0D6CC","#94D0CE","#88C9CF","#7BC0CE","#70B8CD","#67AFCA","#5FA6C7","#589CC4","#5291BE","#4F88B9","#4E7EB3","#4F75AC","#516BA4","#55609A","#595891","#5D5087","#62497D","#664474","#6B3F69","#6F3B60","#723959"]},tofino:{discrete:["#DED9FF","#D0CFF9","#C3C6F3","#B3BBEC","#A6B1E6","#98A8E1","#8B9FDB","#7E95D4","#6E89CB","#617FC3","#5575B8","#4A6BAC","#4262A0","#395790","#334F83","#2E4776","#293F6A","#24385D","#1F304F","#1B2943","#172338","#141D2E","#111824","#0F151B","#0D1516","#0D1712","#0F1B12","#112113","#142716","#162F19","#1A361C","#1D3E20","#224825","#26512A","#2A5A2E","#2E6233","#336C38","#39773E","#3F8144","#488B4A","#529551","#5FA059","#70AB63","#7FB46B","#8EBD73","#9DC57B","#ACCD83","#BDD68C","#CCDE94","#DBE69B"],categorical:["#DED9FF","#D0CFF9","#C3C6F3","#B3BBEC","#A6B1E6","#98A8E1","#8B9FDB","#7E95D4","#6E89CB","#617FC3","#5575B8","#4A6BAC","#4262A0","#395790","#334F83","#2E4776","#293F6A","#24385D","#1F304F","#1B2943","#172338","#141D2E","#111824","#0F151B","#0D1516","#0D1712","#0F1B12","#112113","#142716","#162F19","#1A361C","#1D3E20","#224825","#26512A","#2A5A2E","#2E6233","#336C38","#39773E","#3F8144","#488B4A","#529551","#5FA059","#70AB63","#7FB46B","#8EBD73","#9DC57B","#ACCD83","#BDD68C","#CCDE94","#DBE69B"]},tokyo:{discrete:["#1C0E34","#241036","#2D1339","#37163D","#3F1A40","#481E43","#4F2345","#562948","#5D304A","#62354C","#663B4D","#69404E","#6B454F","#6D4B50","#6E4F50","#6F5251","#6F5651","#705951","#715C52","#715F52","#716252","#726452","#726753","#736B53","#736E53","#747153","#757554","#757A54","#767E55","#778355","#788856","#798E57","#7B9558","#7C9B5A","#7EA25C","#81A95E","#84B062","#88B968","#8DC16E","#93CA76","#9BD27F","#A4DA8A","#AFE398","#BAEAA4","#C5EFB0","#CFF4BB","#D8F7C5","#E2F9CF","#E9FBD7","#EFFCDD"],categorical:["#1C0E34","#EFFCDD","#747053","#6C4750","#87B666","#B8E8A1","#512446","#715D52","#798B56","#7D9F5B","#37163D","#726653","#99D07D","#63374C","#6F5451","#D8F7C5","#767C54","#705951","#5B2D49","#7B9558","#441D41","#291238","#E5FAD2","#C9F1B4","#716252","#81AA5F","#683F4E","#736B53","#6E4E50","#757654","#8EC370","#A7DD8E","#778455","#747354","#84B062","#231036","#93CA76","#DFF9CC","#30143A","#A0D785","#7FA45D","#EAFBD8","#6A434F","#C1EDAB","#736D53","#562948","#6D4B50","#7A9057","#7C9A59","#4B2044","#715F52","#663B4D","#D1F4BD","#705651","#8ABD6A","#6E5151","#AFE398","#5F324B","#757954","#3E193F","#726853","#726452","#778055","#705B52","#788756","#61344C","#746E53","#ABE093","#532747","#85B364","#7EA25C","#261137","#736C53","#E8FBD5","#4E2245","#88B968","#798E57","#767E55","#726753","#757754","#715E52","#3A183E","#6E4F51","#778255","#7B9759","#DCF8C9","#EDFCDA","#411B40","#7D9C5A","#767B54","#726352","#6F5551","#726552","#82AD60","#D5F6C1","#34153C","#9CD481","#747454","#C5EFB0","#481E43"]},turku:{discrete:["#000000","#090908","#111110","#181816","#1D1D1A","#22221F","#272723","#2C2C27","#33322B","#38382F","#3D3D32","#424235","#474738","#4E4D3C","#53523E","#585841","#5D5D43","#626246","#686848","#6E6D4B","#73724D","#797750","#7F7D52","#878356","#8E8859","#968E5C","#9D9360","#A79864","#AF9C68","#B69F6C","#BEA270","#C4A474","#CCA579","#D1A67D","#D7A781","#DBA886","#E0A98B","#E6AB92","#EAAD98","#EFB09F","#F2B4A7","#F6B9AE","#F9BFB7","#FBC4BF","#FDC9C6","#FECFCC","#FED4D3","#FFDBDA","#FFE0E0","#FFE6E6"],categorical:["#070707","#FFE6E6","#948D5B","#E5AA90","#4D4C3B","#2C2C27","#C3A374","#6D6C4A","#FBC4BF","#D6A780","#F2B4A7","#1C1C19","#3D3D32","#AC9A67","#7E7C52","#FED6D4","#5D5D43","#35342D","#DDA888","#141312","#55543F","#242420","#FDCDCA","#F7BCB3","#898456","#B8A06D","#ECAE9B","#CDA57A","#FFDEDD","#646447","#454537","#9F9461","#76744E","#71704C","#30302A","#414135","#181816","#FCC8C4","#EFB1A1","#838054","#F5B8AD","#E1A98C","#C8A477","#686848","#595941","#20201D","#8E8859","#D1A67D","#B29D6A","#E9AC95","#BEA270","#FED1CF","#0E0E0D","#A59764","#DAA784","#282823","#F9C0B9","#51503D","#393930","#FFDAD9","#49493A","#606045","#FFE2E1","#9A915E","#797750","#F4B6AA","#F6BAB0","#CBA578","#FFD8D6","#FECFCC","#262622","#C0A272","#868255","#1A1A18","#FAC2BC","#8B8658","#E3AA8E","#161614","#4F4E3C","#C6A475","#2E2E28","#BBA16F","#6B6A49","#E7AB93","#CFA67C","#626246","#53523E","#5B5B42","#FED3D1","#7C7A51","#817E53","#73724D","#FFDCDB","#37372E","#F8BEB6","#0B0B0A","#575740","#DFA98A","#474738","#B59F6C"]},vanimo:{discrete:["#FFCDFD","#F7BEF2","#F0B0E8","#E6A0DC","#DE93D2","#D786C8","#CF7ABF","#C76FB5","#BD63AA","#B45AA1","#AB5198","#A1498E","#964184","#883977","#7C326B","#6E2C60","#612654","#542148","#451C3B","#391931","#2F1728","#281521","#22141C","#1D1417","#1A1414","#191612","#191811","#1B1D11","#1D2212","#212913","#253014","#2B3916","#324419","#384D1B","#3F561E","#456021","#4C6924","#547427","#5A7C2A","#60852E","#678E32","#6E9737","#77A33F","#7FAE47","#88BA51","#92C65D","#9CD26B","#A9E27F","#B3EF92","#BEFDA5"],categorical:["#FFCDFD","#F7BEF2","#F0B0E8","#E6A0DC","#DE93D2","#D786C8","#CF7ABF","#C76FB5","#BD63AA","#B45AA1","#AB5198","#A1498E","#964184","#883977","#7C326B","#6E2C60","#612654","#542148","#451C3B","#391931","#2F1728","#281521","#22141C","#1D1417","#1A1414","#191612","#191811","#1B1D11","#1D2212","#212913","#253014","#2B3916","#324419","#384D1B","#3F561E","#456021","#4C6924","#547427","#5A7C2A","#60852E","#678E32","#6E9737","#77A33F","#7FAE47","#88BA51","#92C65D","#9CD26B","#A9E27F","#B3EF92","#BEFDA5"]},vik:{discrete:["#001261","#011A66","#02226B","#022B71","#023376","#023A7B","#034280","#034A85","#06548B","#0B5D91","#136697","#1E6F9D","#2B79A4","#3C85AC","#4B90B3","#5A9ABA","#6AA4C1","#7AAEC8","#8DBAD0","#9DC4D6","#ADCDDD","#BDD6E3","#CCDFE8","#DEE6E9","#E8E7E5","#EEE3DC","#EEDBD0","#EBD0C0","#E7C6B2","#E3BCA5","#DFB298","#DBA88B","#D69D7C","#D29470","#CE8B64","#CA8258","#C6794C","#C26E3F","#BE6533","#B85C28","#B2511D","#A94512","#9C3709","#912D06","#872406","#7E1D06","#741506","#6A0D07","#620607","#590008"],categorical:["#001261","#011A66","#02226B","#022B71","#023376","#023A7B","#034280","#034A85","#06548B","#0B5D91","#136697","#1E6F9D","#2B79A4","#3C85AC","#4B90B3","#5A9ABA","#6AA4C1","#7AAEC8","#8DBAD0","#9DC4D6","#ADCDDD","#BDD6E3","#CCDFE8","#DEE6E9","#E8E7E5","#EEE3DC","#EEDBD0","#EBD0C0","#E7C6B2","#E3BCA5","#DFB298","#DBA88B","#D69D7C","#D29470","#CE8B64","#CA8258","#C6794C","#C26E3F","#BE6533","#B85C28","#B2511D","#A94512","#9C3709","#912D06","#872406","#7E1D06","#741506","#6A0D07","#620607","#590008"]},viko:{discrete:["#4F1A3D","#4B1D43","#48214A","#432653","#3F2C5B","#3C3263","#38396C","#354174","#334B7F","#345487","#365E8F","#3B6797","#42719E","#4D7DA6","#5787AD","#6391B4","#709ABA","#7DA4BF","#8EAEC4","#9BB5C7","#A9BBC8","#B5C0C8","#C0C2C5","#CBC2BF","#D2C0B8","#D6BDAF","#D9B7A6","#D9AF99","#D8A88D","#D6A082","#D39776","#CF8D6B","#C8825D","#C27752","#BB6D47","#B3623D","#AA5633","#9F492A","#953E25","#8C3521","#822C1F","#7A251E","#721F1F","#6B1A21","#661824","#611627","#5C152B","#571631","#531736","#50193C"],categorical:["#4F1A3D","#4B1D43","#48214A","#432653","#3F2C5B","#3C3263","#38396C","#354174","#334B7F","#345487","#365E8F","#3B6797","#42719E","#4D7DA6","#5787AD","#6391B4","#709ABA","#7DA4BF","#8EAEC4","#9BB5C7","#A9BBC8","#B5C0C8","#C0C2C5","#CBC2BF","#D2C0B8","#D6BDAF","#D9B7A6","#D9AF99","#D8A88D","#D6A082","#D39776","#CF8D6B","#C8825D","#C27752","#BB6D47","#B3623D","#AA5633","#9F492A","#953E25","#8C3521","#822C1F","#7A251E","#721F1F","#6B1A21","#661824","#611627","#5C152B","#571631","#531736","#50193C"]}};function Re(e){const t=e.replace("#","");return{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16)}}const $e={waves:"batlow",blksand:"tokyo",breeze:"imola",magma:"batlow",ribbon:"hawaii",stars:"batlow",folds:"imola"},Pe={[z.ADVERT]:1,[z.TXT_MSG]:4,[z.GRP_TXT]:2,[z.RESPONSE]:8,[z.REQ]:13,[z.ANON_REQ]:7,[z.ACK]:11,[z.PATH]:24,[z.TRACE]:16,[z.GRP_DATA]:34,[z.MULTIPART]:52,[z.RAW_CUSTOM]:14};function Le(){let e="waves",t=!0;if("undefined"!=typeof window){e=localStorage.getItem("pymc-color-scheme")||"waves";const s=L(e);t=(null==s?void 0:s.meta.isDark)??!0}const s=$e[e]??"batlow",a=Te[s],n=a.discrete.length,r=Math.floor(n/2);return{colormap:a,colormapName:s,isDark:t,baseIndex:t?r:0,halfSize:r}}let ze=null;function _e(e){const{colormap:t,isDark:s}=Le();if("number"!=typeof e)return s?"#A5A5A5":"#666666";const a=Pe[e];if(void 0===a)return s?"#A5A5A5":"#666666";const n=t.categorical;return n[Math.min(a,n.length-1)]}function He(e){return Re(_e(e))}const Oe={useAbsoluteThresholds:!0,baselinePercentile:6,spikePercentile:50,baselineDbm:-107,spikeDbm:-100,mergeGapSeconds:45,minSequenceLength:16,similarityToleranceDbm:5};function We(e,t){if(0===e.length)return 0;const s=t/100*(e.length-1),a=Math.floor(s),n=Math.ceil(s);return a===n?e[a]:e[a]+(e[n]-e[a])*(s-a)}function Ie(e){if(0===e.length)return{median:0,p90:0,p95:0,p99:0,max:0,min:0};const t=[...e].sort((e,t)=>e-t);return{median:We(t,50),p90:We(t,90),p95:We(t,95),p99:We(t,99),max:t[t.length-1],min:t[0]}}function Ve(e,t,s){const a=s-t;if(0===a)return"moderate";const n=(e-t)/a;return n>.66?"critical":n>.33?"severe":"moderate"}n.memo(function({options:e,data:t,className:s="",onCreate:a}){const l=n.useRef(null),i=n.useRef(null);return n.useEffect(()=>{const s=l.current;if(!s)return;const n=s.getBoundingClientRect(),r=Math.floor(n.width)||400,o=Math.floor(n.height)||200,c=new _({...e,width:r,height:o},t,s);return i.current=c,null==a||a(c),()=>{c.destroy(),i.current=null}},[e]),n.useEffect(()=>{i.current&&t&&i.current.setData(t)},[t]),n.useEffect(()=>{const e=l.current;if(!e)return;const t=new ResizeObserver(e=>{const t=e[0];if(!t||!i.current)return;const{width:s,height:a}=t.contentRect;s>0&&a>0&&i.current.setSize({width:Math.floor(s),height:Math.floor(a)})});return t.observe(e),()=>{t.disconnect()}},[]),r.jsx("div",{ref:l,className:`w-full h-full ${s}`,style:{minHeight:100}})});const qe=new Map;function Ge(e){var t;if(!e.startsWith("var("))return e;const s=qe.get(e);if(s)return s;const a=e.match(/var\(([^,)]+)(?:,\s*([^)]+))?\)/);if(!a)return e;const n=a[1].trim(),r=(null==(t=a[2])?void 0:t.trim())||"#888888",l=getComputedStyle(document.documentElement).getPropertyValue(n).trim()||r;return qe.set(e,l),l}function Xe(e,t,s=!1){if(t.length<2)return;if(e.beginPath(),e.moveTo(t[0].x,t[0].y),2===t.length)return void e.lineTo(t[1].x,t[1].y);const a=.5;for(let n=0;n{F.current=e,E.current=t,m.current=a,d.current=s});const h=n.useRef({band:l,innerBand:i,mean:o,median:c,average:C,cursor:A});n.useLayoutEffect(()=>{h.current={band:l,innerBand:i,mean:o,median:c,average:C,cursor:A}});const x=n.useMemo(()=>[e.map(e=>e.timestamp),e.map(e=>e.max)],[e]),p=n.useMemo(()=>{const e=function(e,t,s,a){return{hooks:{draw:n=>{const r=e.current,l=t.current,i=s.current,o=a.current;if(0===r.length)return;const c=n.ctx,C=n.bbox,A=C.left,D=C.top,B=C.width,F=C.height;if(B<=0||F<=0)return;const E=n.data[0],m=E.length;if(0===m)return;const d=E[0],u=E[m-1]-d||1,h=e=>A+(e-d)/u*B,x=e=>D+F*(1-e/l),p={min:r.map(e=>({x:h(e.timestamp),y:x(e.min)})),max:r.map(e=>({x:h(e.timestamp),y:x(e.max)})),p5:r.map(e=>({x:h(e.timestamp),y:x(e.p5)})),p95:r.map(e=>({x:h(e.timestamp),y:x(e.p95)})),p25:r.map(e=>({x:h(e.timestamp),y:x(e.p25)})),p75:r.map(e=>({x:h(e.timestamp),y:x(e.p75)})),mean:r.map(e=>({x:h(e.timestamp),y:x(e.mean)})),median:r.map(e=>({x:h(e.timestamp),y:x(e.median)})),average:r.map(e=>({x:h(e.timestamp),y:x(e.average)}))},g=(e,t)=>i?i===e?Math.min(1,1.5*t):"minMax"===i||"p5p95"===i||"p25p75"===i?.3*t:t:t,f=e=>i?i===e?1:"mean"===i||"median"===i||"average"===i?.3:1:1,b={band:Ge(o.band),innerBand:Ge(o.innerBand),mean:Ge(o.mean),median:Ge(o.median),average:Ge(o.average)};c.save(),c.strokeStyle=b.average,c.lineWidth=4,c.globalAlpha=f("average"),Xe(c,p.average),c.stroke(),c.globalAlpha=g("minMax",.15),c.fillStyle=b.band,c.beginPath(),Xe(c,p.max);const y=[...p.min].reverse();for(const e of y)c.lineTo(e.x,e.y);c.closePath(),c.fill(),c.globalAlpha=g("p5p95",.3),c.fillStyle=b.band,c.beginPath(),Xe(c,p.p95);const v=[...p.p5].reverse();for(const e of v)c.lineTo(e.x,e.y);c.closePath(),c.fill(),c.globalAlpha=g("p25p75",.55),c.fillStyle=b.innerBand,c.beginPath(),Xe(c,p.p75);const j=[...p.p25].reverse();for(const e of j)c.lineTo(e.x,e.y);c.closePath(),c.fill(),c.strokeStyle=b.median,c.lineWidth=1.5,c.globalAlpha=f("median"),c.setLineDash([4,4]),Xe(c,p.median),c.stroke(),c.strokeStyle=b.mean,c.lineWidth=1.5,c.globalAlpha=f("mean"),c.setLineDash([]),Xe(c,p.mean),c.stroke(),c.restore()}}}}(F,E,m,h);return{width:400,height:200,padding:[4,4,4,4],cursor:{show:!0,x:!0,y:!1,drag:{x:!1,y:!1},points:{show:!1}},scales:{x:{time:!0},y:{range:[0,t]}},axes:[{show:!1},{show:!1}],series:[{},{show:!1}],hooks:{setCursor:[e=>{var t,s;const a=e.cursor.idx;null!=a&&a>=0?null==(t=d.current)||t.call(d,a):null==(s=d.current)||s.call(d,null)}]},plugins:[e]}},[t]);n.useEffect(()=>{const t=D.current;if(!t||0===e.length)return;const s=u.current,a=e.length,n=Math.abs(a-s);if(!(!B.current||n>100||s>0&&n/s>.1)&&B.current)return B.current.setData(x),void(u.current=a);B.current&&B.current.destroy();const r=t.getBoundingClientRect(),l=Math.floor(r.width)||400,i=Math.floor(r.height)||200,o=new _({...p,width:l,height:i},x,t);return B.current=o,u.current=a,()=>{o.destroy(),B.current=null}},[p,x,e.length]),n.useEffect(()=>{const e=D.current;if(!e)return;const t=new ResizeObserver(e=>{const t=e[0];if(!t||!B.current)return;const{width:s,height:a}=t.contentRect;s>0&&a>0&&B.current.setSize({width:Math.floor(s),height:Math.floor(a)})});return t.observe(e),()=>{t.disconnect()}},[]),n.useEffect(()=>{B.current&&B.current.redraw()},[a,e]);const g=n.useCallback(()=>{null==s||s(null)},[s]);return 0===e.length?r.jsx("div",{className:"h-full flex items-center justify-center text-text-muted",children:"No data available"}):r.jsx("div",{ref:D,className:"w-full h-full rounded-2xl overflow-hidden",onMouseLeave:g})});const Ke="undefined"!=typeof window&&(null==(t=null==(e=window.matchMedia)?void 0:e.call(window,"(color-gamut: p3)"))?void 0:t.matches);function Ye(){const e=getComputedStyle(document.documentElement);return{fontFamily:e.getPropertyValue("--font-data").trim()||'"JetBrains Mono", ui-monospace, monospace',axisColor:e.getPropertyValue("--chart-axis-tick").trim()||"rgba(255, 255, 255, 0.4)",gridColor:e.getPropertyValue("--chart-grid").trim()||"rgba(255, 255, 255, 0.06)",textMuted:e.getPropertyValue("--text-muted").trim()||"#727272",textPrimary:e.getPropertyValue("--text-primary").trim()||"#FFFFFF"}}const Ue=["min","max","p75","p95","p99","mean","median","average","midpoint"];function Qe(e){const t=Re(function(e){const{colormap:t,baseIndex:s,halfSize:a}=Le(),n=Math.max(0,Math.min(1,e)),r=Math.min(s+Math.floor(n*(a-1)),t.discrete.length-1);return t.discrete[r]}(e)),s=`color(display-p3 ${(t.r/255).toFixed(3)} ${(t.g/255).toFixed(3)} ${(t.b/255).toFixed(3)})`;return{...t,p3:s}}function Ze(e,t,s,a,n,r,l,i,o,c=null,C=null,A=1,D=null,B="airtime",F=.5){if(0===t.length)return;const E=e.ctx,{left:m,top:d,width:u,height:h}=e.bbox,x=window.devicePixelRatio||1;if(u<=0||h<=0)return;const p=e.data[0],g=p.length;if(0===g)return;const f=p[0],b=p[g-1],y=s,v="share"===B,j=v?function(e){const t=[10,20,25,50,100,200,250,500,1e3],s=e/4.5;for(const a of t)if(a>=s)return a;return e>5e3?1e3*Math.ceil(s/1e3):100*Math.ceil(s/100)}(y):5,N=getComputedStyle(document.documentElement),w=N.getPropertyValue("--signal-critical").trim()||"#EF4444",k=N.getPropertyValue("--bg-body").trim()||"#171717";E.save(),E.fillStyle="#000000";const M=8*x;E.beginPath(),E.roundRect(m,d,u,h,M),E.fill(),E.restore();const S=parseInt(k.slice(1,3),16)||23,T=parseInt(k.slice(3,5),16)||23,R=parseInt(k.slice(5,7),16)||23;if(!v&&y>=20){E.save();const e=d+h*(1-20/y);E.fillStyle=`rgba(${S}, ${T}, ${R}, 0.5)`,E.fillRect(m,d,u,e-d),E.restore()}E.save(),E.lineWidth=1*x,E.setLineDash([4*x,4*x]);for(let P=j;Ps+n)return;const i=getComputedStyle(document.documentElement).getPropertyValue("--text-primary").trim()||"#FFFFFF";e.save(),e.strokeStyle=i,e.globalAlpha=.5,e.lineWidth=1*l,e.setLineDash([4*l,4*l]),e.beginPath(),e.moveTo(Math.round(t)+.5,a),e.lineTo(Math.round(t)+.5,a+r),e.stroke(),e.restore()}(E,D,m,d,u,h,x),l){!function(e,t,s,a,n,r,l=null,i=null,o=1,c=25){const{points:C,rawValues:A,count:D,packetTypes:B,timestamps:F}=t,E=1*o*(window.devicePixelRatio||1);e.globalCompositeOperation="source-over";const m=l?parseInt(l.replace("TYPE_",""),10):null;for(let d=0;d=i.start&&e0&&function(e,t,s,a,n,r,l,i,o,c,C=.5){if(0===t.length)return;const A=o-i||1,D=function(e,t=1.3,s=.15){const a=function(e){const t=e.match(/color\(display-p3\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)/);if(t){const e=parseFloat(t[1]),s=parseFloat(t[2]),a=parseFloat(t[3]);return{r:Math.round(255*e),g:Math.round(255*s),b:Math.round(255*a),p3r:e,p3g:s,p3b:a}}if(e.startsWith("#")){const t=e.replace("#",""),s=parseInt(t.slice(0,2),16),a=parseInt(t.slice(2,4),16),n=parseInt(t.slice(4,6),16);return{r:s,g:a,b:n,p3r:s/255,p3g:a/255,p3b:n/255}}const s=e.match(/rgba?\(([\d.]+),?\s*([\d.]+),?\s*([\d.]+)/);if(s){const e=Math.round(parseFloat(s[1])),t=Math.round(parseFloat(s[2])),a=Math.round(parseFloat(s[3]));return{r:e,g:t,b:a,p3r:e/255,p3g:t/255,p3b:a/255}}return{r:255,g:255,b:255,p3r:1,p3g:1,p3b:1}}(e),n=function(e,t,s,a=1.25,n=.15){const r=(Math.max(e,t,s)+Math.min(e,t,s))/2;return{p3r:Math.min(1,r+(e-r)*a+n),p3g:Math.min(1,r+(t-r)*a+n),p3b:Math.min(1,r+(s-r)*a+n)}}(a.p3r,a.p3g,a.p3b,t,s);return{r:Math.round(255*Math.min(1,n.p3r)),g:Math.round(255*Math.min(1,n.p3g)),b:Math.round(255*Math.min(1,n.p3b)),p3r:Math.min(1,n.p3r),p3g:Math.min(1,n.p3g),p3b:Math.min(1,n.p3b)}}(getComputedStyle(document.documentElement).getPropertyValue("--signal-critical").trim()||"#EF4444");e.save(),e.globalAlpha=C,e.fillStyle=Ke?`color(display-p3 ${D.p3r} ${D.p3g} ${D.p3b})`:`rgb(${D.r}, ${D.g}, ${D.b})`;for(const B of t){if(B.endTso)continue;const t=a+(Math.max(B.startTs,i)-i)/A*r,s=a+(Math.min(B.endTs,o)-i)/A*r,C=Math.max(s-t,2*c);e.fillRect(t,n,C,l)}e.restore()}(E,i,0,m,d,u,h,f,b,x,C?Math.max(.03,.03*F):F)}const Je=n.memo(function({data:e,maxValue:t,visibleLines:s=Ue,highlightedLine:a=null,onHover:l,scatterData:i=null,noiseFloorAnomalies:o=null,showNoiseFloorOverlay:c=!1,overlayOpacity:C=.5,highlightedType:A=null,hoveredTimeRange:D=null,timeRangeHours:B=24,yAxisMode:F="airtime"}){const E=n.useRef(null),m=n.useRef(null),d=n.useRef(e),u=n.useRef(t),h=n.useRef(s),x=n.useRef(a),p=n.useRef(l),g=n.useRef(i),f=n.useRef(o),b=n.useRef(c),y=n.useRef(A),v=n.useRef(D),j=n.useRef(null),N=n.useRef(null),w=n.useRef(F),k=n.useRef(C),M=B<=12?1.2:1,S=n.useRef(M),T=n.useRef(e.length);n.useLayoutEffect(()=>{d.current=e,u.current=t,h.current=s,x.current=a,p.current=l,g.current=i,f.current=o,b.current=c,y.current=A,v.current=D,S.current=M,w.current=F,k.current=C}),n.useEffect(()=>{j.current=Ye()},[]);const R=n.useMemo(()=>[e.map(e=>e.timestamp),new Array(e.length).fill(1)],[e]),$=n.useMemo(()=>({hooks:{draw:e=>{const t=j.current||Ye();Ze(e,d.current,u.current,h.current,x.current,t,g.current,f.current,b.current,y.current,v.current,S.current,N.current,w.current,k.current)}}}),[]),P=n.useMemo(()=>({width:400,height:200,padding:[8,0,8,28],cursor:{show:!1,x:!1,y:!1,drag:{x:!1,y:!1},points:{show:!1}},scales:{x:{time:!0},y:{range:[0,1]}},axes:[{show:!1},{show:!1}],series:[{},{show:!1}],plugins:[$]}),[$]);n.useEffect(()=>{const t=E.current;if(!t||0===e.length)return;const s=T.current,a=e.length,n=Math.abs(a-s);if(!(!m.current||n>100||s>0&&n/s>.1)&&m.current)return m.current.setData(R),void(T.current=a);m.current&&m.current.destroy();const r=t.getBoundingClientRect(),l=Math.floor(r.width)||400,i=Math.floor(r.height)||200,o=new _({...P,width:l,height:i},R,t);return m.current=o,T.current=a,()=>{o.destroy(),m.current=null}},[P,R,e.length]),n.useEffect(()=>{const e=E.current;if(!e)return;const t=new ResizeObserver(e=>{const t=e[0];if(!t||!m.current)return;const{width:s,height:a}=t.contentRect;s>0&&a>0&&m.current.setSize({width:Math.floor(s),height:Math.floor(a)})});return t.observe(e),()=>{t.disconnect()}},[]),n.useEffect(()=>{m.current&&m.current.redraw()},[a,s,e,i,o,c,C,A,D,M]);const L=n.useCallback(t=>{var s,a;const n=E.current,r=m.current;if(!n||!r||0===e.length)return;const l=n.getBoundingClientRect(),i=t.clientX-l.left,o=window.devicePixelRatio||1,c=r.bbox,C=c.left/o,A=c.width/o;if(iC+A)return N.current=null,r.redraw(),void(null==(s=p.current)||s.call(p,null));N.current=i*o;const D=(i-C)/A,B=e.length,F=Math.floor(D*B),d=Math.max(0,Math.min(B-1,F));r.redraw(),null==(a=p.current)||a.call(p,d)},[e.length]),z=n.useCallback(()=>{var e;N.current=null,m.current&&m.current.redraw(),null==(e=p.current)||e.call(p,null)},[]);return 0===e.length?r.jsx("div",{className:"h-full flex items-center justify-center text-text-muted",children:"No data available"}):r.jsx("div",{ref:E,className:"w-full h-full rounded-lg overflow-hidden",onMouseMove:L,onMouseLeave:z})}),et=function(e){const t=_e(e);return null===ze&&(ze=P()),ze?$(t):t};function tt({sortedTypes:e,highlightedType:t,onTypeHover:s,aggregateShares:a,hoverData:l}){const i=n.useMemo(()=>{if(!l)return null;const e=new Map;for(const t of l.items)e.set(t.key,t.value);return e},[l]),o=null!==i;return r.jsx("div",{className:"flex-shrink-0 pt-3 mt-2",children:r.jsx("div",{className:"grid ml-9 gap-y-0.5",style:{gridTemplateColumns:"repeat(auto-fill, minmax(105px, 1fr))"},onMouseLeave:()=>s(null),children:e.map(e=>{const n=et(e.typeNum),l=(null==i?void 0:i.get(e.key))??0,c=a.get(e.key)??0,C=o?l:c,A=C>1e-4,D=t===e.key,B=["legend-item",D&&"legend-item-active",(t&&!D||o&&l<=1e-4)&&"legend-item-dimmed",!t&&o&&l>1e-4&&"legend-item-chart-active"].filter(Boolean).join(" ");return r.jsxs("div",{className:B,onMouseEnter:()=>s(e.key),children:[r.jsx("div",{className:"flex-shrink-0",style:{backgroundColor:n,width:9,height:16,borderRadius:1}}),r.jsx("span",{className:"legend-label",children:e.label}),A&&r.jsxs("span",{className:"legend-value "+(o?"legend-value-live":""),children:[(100*C).toFixed(1),"%"]})]},e.key)})})})}const st='ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace';function at({x:e,y:t,width:s,height:a,name:n,size:l,index:i,depth:o,hoveredIndex:c,onHover:C,total:A,typeNum:D}){if(1!==o)return null;const B=null!==c&&!(c===i),F=et(D),E=A>0?l/A*100:0,m=s>36&&a>20,d=s>36&&a>32;return r.jsxs("g",{onMouseEnter:e=>C(i,e),onMouseLeave:()=>C(null),style:{cursor:"default"},children:[r.jsx("rect",{x:e,y:t,width:s,height:a,fill:F,opacity:B?.4:1,stroke:"rgba(0,0,0,0.2)",strokeWidth:1,rx:3,style:{transition:"opacity 150ms ease"}}),m&&r.jsxs(r.Fragment,{children:[d&&r.jsxs("text",{x:e+4,y:t+a-4-11,textAnchor:"start",dominantBaseline:"auto",fill:"rgba(0,0,0,0.6)",fontSize:8,fontFamily:st,fontWeight:500,style:{pointerEvents:"none"},children:[E.toFixed(1),"%"]}),r.jsx("text",{x:e+4,y:t+a-4,textAnchor:"start",dominantBaseline:"auto",fill:"rgba(0,0,0,0.85)",fontSize:9,fontFamily:st,fontWeight:600,style:{pointerEvents:"none"},children:n})]})]})}function nt({data:e,total:t,color:s,position:a,containerWidth:n}){if(!e||!a)return null;const l=(e.value/t*100).toFixed(1),i=n-a.x<184?Math.max(8,a.x-160-8):a.x+16;return r.jsx("div",{className:"absolute z-50 pointer-events-none",style:{left:i,top:Math.max(8,a.y-60)},children:r.jsxs("div",{className:"bg-tooltip-bg border border-border-subtle rounded-lg px-3 py-2 shadow-xl min-w-[140px]",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("span",{className:"w-2.5 h-2.5 rounded-sm flex-shrink-0",style:{backgroundColor:s}}),r.jsx("span",{className:"type-data-sm font-semibold text-text-primary",children:e.name})]}),r.jsxs("div",{className:"space-y-0.5 type-data-xs text-text-muted",children:[r.jsxs("div",{className:"flex justify-between gap-4",children:[r.jsx("span",{children:"Count"}),r.jsx("span",{className:"text-text-primary tabular-nums font-medium",children:e.value.toLocaleString()})]}),r.jsxs("div",{className:"flex justify-between gap-4",children:[r.jsx("span",{children:"Share"}),r.jsxs("span",{className:"text-text-primary tabular-nums font-medium",children:[l,"%"]})]}),r.jsxs("div",{className:"flex justify-between gap-4",children:[r.jsx("span",{children:"Total"}),r.jsx("span",{className:"text-text-primary tabular-nums font-medium",children:t.toLocaleString()})]})]})]})})}function rt({sortedTypes:e,aggregateShares:t}){var s,a,i;const[o,c]=n.useState(null),[C,A]=n.useState(null),[D,B]=n.useState(0),[F,E]=n.useState(null),m=n.useRef(null),d=n.useMemo(()=>e.reduce((e,t)=>e+t.totalCount,0),[e]),u=n.useMemo(()=>e.map((e,t)=>({name:e.label,size:e.totalCount,index:t,typeNum:e.typeNum,key:e.key})),[e]),h=n.useCallback((e,t)=>{if(c(e),t&&null!==e){const e=m.current;if(e){const s=e.getBoundingClientRect();B(s.width),A({x:t.clientX-s.left,y:t.clientY-s.top})}}else A(null)},[]),x=n.useCallback(e=>{if(E(e),e){const t=u.findIndex(t=>t.key===e);c(t>=0?t:null)}else c(null)},[u]),p=null!==o?{name:(null==(s=u[o])?void 0:s.name)??"",value:(null==(a=u[o])?void 0:a.size)??0}:null,g=null!==o?et(null==(i=u[o])?void 0:i.typeNum):"";return 0===e.length||0===d?r.jsxs("div",{className:"h-full flex items-center justify-center text-text-muted",children:[r.jsx(l,{className:"w-6 h-6 mr-2 opacity-50"}),r.jsx("span",{children:"No packet type data available"})]}):r.jsxs("div",{className:"flex flex-col",children:[r.jsxs("div",{className:"analyzer-chart-height relative flex-shrink-0",ref:m,children:[r.jsx(Ee,{width:"100%",height:"100%",children:r.jsx(me,{data:u,dataKey:"size",aspectRatio:4/3,stroke:"none",isAnimationActive:!1,content:r.jsx(at,{x:0,y:0,width:0,height:0,name:"",size:0,index:0,depth:0,hoveredIndex:o,onHover:h,total:d,typeNum:0})})}),r.jsx(nt,{data:p,total:d,color:g,position:C,containerWidth:D})]}),r.jsx(tt,{sortedTypes:e,highlightedType:F,onTypeHover:x,aggregateShares:t})]})}function lt(e){return e>=1e9?`${(e/1e9).toFixed(1)} Gb`:e>=1e6?`${(e/1e6).toFixed(1)} Mb`:e>=1e3?`${(e/1e3).toFixed(1)} Kb`:`${e.toFixed(0)} B`}function it({active:e,payload:t,label:s,mode:a}){if(!e||!t||0===t.length)return null;const n=t.filter(e=>null!==e.value&&void 0!==e.value);if(0===n.length)return null;const l=s?new Date(1e3*s).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}):"";return r.jsxs("div",{className:"bg-tooltip-bg border border-border-subtle rounded-lg px-3 py-2 text-sm shadow-xl",children:[r.jsx("div",{className:"font-medium text-text-primary mb-1 font-mono",children:l}),n.map((e,t)=>r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-3 h-0.5",style:{backgroundColor:e.color}}),r.jsxs("span",{className:"text-text-muted",children:[e.name,":"]}),r.jsx("span",{className:"text-text-primary tabular-nums font-mono",children:"share"===a?`${Number(e.value).toLocaleString()} B`:`${Number(e.value).toFixed(2)}%`})]},t))]})}function ot({packets:e,mode:t,startTs:s,endTs:a,radioConfig:o,bucketCount:c}){const C=oe(),A=ce(),D=C.primary,B=C.tertiary,[F,E]=n.useState(null),{trendData:m,totals:d}=n.useMemo(()=>{if(0===e.length)return{trendData:[],totals:{rxBytes:0,txBytes:0,rxAirtime:0,txAirtime:0}};const n=a-s,r=Math.min(Math.ceil(n/300),c),l=n/r,i=[];let C=0,A=0,D=0,B=0;for(const t of e){const e=t.timestamp;if(e=a)continue;const n=H(t),r=O(t,{spreadingFactor:o.sf,bandwidthHz:o.bw,codingRate:o.cr,preambleLength:o.preamble}),l={timestamp:e,rxAirtime:0,txAirtime:0,rxBytes:0,txBytes:0};t.transmitted?(l.txAirtime=r,l.txBytes=n,A+=n,B+=r):(l.rxAirtime=r,l.rxBytes=n,C+=n,D+=r),i.push(l)}i.sort((e,t)=>e.timestamp-t.timestamp);const F=new Float64Array(i.length+1),E=new Float64Array(i.length+1),m=new Float64Array(i.length+1),d=new Float64Array(i.length+1),u=new Float64Array(i.length);for(let e=0;e{let t=0,s=u.length;for(;t>>1;u[a]0?e:null,tx:t>0?t:null})}else{const e=(F[i]-F[r])/p*100,t=(E[i]-E[r])/p*100;x.push({timestamp:a,rx:e>0?e:null,tx:t>0?t:null})}}const g=2/31;let f=null;return{trendData:x.map(e=>{const t=e.rx;return null!==t&&t>0&&(f=null===f?t:g*t+(1-g)*f),{...e,rxSmooth:null!==f&&f>0?f:null}}),totals:{rxBytes:C,txBytes:A,rxAirtime:D,txAirtime:B}}},[e,s,a,c,t,o]),u=n.useMemo(()=>{if(0===m.length)return"share"===t?100:10;let e=0;for(const t of m){const s=t.rx??0,a=t.tx??0;s>e&&(e=s),a>e&&(e=a)}const s=1.1*e;return"share"===t?s<=100?100:s<=500?100*Math.ceil(s/100):s<=1e3?200*Math.ceil(s/200):s<=5e3?500*Math.ceil(s/500):s<=1e4?1e3*Math.ceil(s/1e3):5e3*Math.ceil(s/5e3):Math.max(1,Math.ceil(s))},[m,t]),h=n.useMemo(()=>{if(null!==F&&m[F]){const e=m[F],s=e.rx??0,a=e.tx??0;return"share"===t?{rx:lt(s),tx:lt(a),total:lt(s+a),isHovered:!0}:{rx:`${s.toFixed(2)}%`,tx:`${a.toFixed(2)}%`,total:`${(s+a).toFixed(2)}%`,isHovered:!0}}if("share"===t)return{rx:lt(d.rxBytes),tx:lt(d.txBytes),total:lt(d.rxBytes+d.txBytes),isHovered:!1};{let e=0,t=0,s=0;for(const r of m)null===r.rx&&null===r.tx||(e+=r.rx??0,t+=r.tx??0,s++);const a=s>0?e/s:0,n=s>0?t/s:0;return{rx:`${a.toFixed(2)}%`,tx:`${n.toFixed(2)}%`,total:`${(a+n).toFixed(2)}%`,isHovered:!1}}},[F,m,d,t]),x=n.useMemo(()=>{const e=a-s,t=e/3600;return[0,.25,.5,.75,1].map(a=>{const n=new Date(1e3*(s+e*a)),r=n.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}),l=n.toLocaleDateString([],{weekday:"short"});return{pct:a,label:t>24?`${l} ${r}`:r,mobileHidden:.25===a||.75===a}})},[s,a]),p=n.useCallback(e=>{const t=null==e?void 0:e.activeTooltipIndex;E("number"==typeof t?t:null)},[]),g=n.useCallback(e=>"share"===t?e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(0)}K`:e.toFixed(0):`${e.toFixed(0)}%`,[t]);return 0===m.length?r.jsxs("div",{className:"h-full flex items-center justify-center text-text-muted",children:[r.jsx(l,{className:"w-6 h-6 mr-2 opacity-50"}),r.jsx("span",{children:"No packet data available"})]}):r.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[r.jsx("div",{className:"flex items-center flex-shrink-0 text-text-secondary",style:{height:20,paddingLeft:44,paddingRight:8},children:r.jsx("div",{className:"relative w-full h-full flex items-center",children:x.map((e,t)=>r.jsxs("div",{className:"absolute flex items-center gap-0.5 sm:gap-1 type-data-xs "+(e.mobileHidden?"hidden sm:flex":""),style:{left:100*e.pct+"%",transform:0===e.pct?"translateX(0)":1===e.pct?"translateX(-100%)":"translateX(-50%)"},children:[r.jsx(i,{className:"w-2.5 h-2.5 opacity-60 hidden sm:block"}),r.jsx("span",{className:"tabular-nums",children:e.label})]},t))})}),r.jsx("div",{className:"flex-1 min-h-0 relative overflow-hidden",children:r.jsx(Ee,{width:"100%",height:"100%",minWidth:1,minHeight:1,children:r.jsxs(de,{data:m,margin:{top:4,right:8,bottom:4,left:0},onMouseMove:p,onMouseLeave:()=>E(null),children:[r.jsx(ue,{strokeDasharray:"3 3",stroke:A.secondary,strokeOpacity:.3,vertical:!1}),r.jsx(he,{dataKey:"timestamp",type:"number",domain:[s,a],axisLine:!1,tickLine:!1,tick:!1,height:0}),r.jsx(xe,{axisLine:!1,tickLine:!1,tick:{fill:A.secondary,fontSize:10,fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace'},dx:-8,width:44,tickFormatter:g,domain:[0,u]}),r.jsx(pe,{content:r.jsx(it,{mode:t})}),r.jsx(ge,{type:"linear",dataKey:"rx",name:"RX",stroke:D,strokeWidth:2.5,strokeOpacity:.9,dot:!1,connectNulls:!1,isAnimationActive:!1}),r.jsx(ge,{type:"linear",dataKey:"tx",name:"TX",stroke:B,strokeWidth:2.5,strokeOpacity:.9,dot:!1,connectNulls:!1,isAnimationActive:!1}),r.jsx(ge,{type:"basis",dataKey:"rxSmooth",name:"RX Avg",stroke:"var(--sys-brown)",strokeWidth:2,strokeOpacity:1,dot:!1,connectNulls:!0,isAnimationActive:!1})]})})}),r.jsxs("div",{className:"flex-shrink-0 flex items-center justify-between mt-1.5 sm:mt-2",children:[r.jsxs("div",{className:"flex items-center gap-2 sm:gap-4 text-xs font-mono pl-2 sm:pl-11",children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("div",{className:"w-3 sm:w-4 h-0.5",style:{backgroundColor:D}}),r.jsx("span",{className:"text-text-secondary",children:"RX"})]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("div",{className:"w-3 sm:w-4 h-0.5",style:{backgroundColor:B}}),r.jsx("span",{className:"text-text-secondary",children:"TX"})]}),r.jsxs("div",{className:"hidden sm:flex items-center gap-1.5",children:[r.jsx("div",{className:"w-4 h-0.5",style:{backgroundColor:"var(--sys-brown)"}}),r.jsx("span",{className:"text-text-secondary",children:"Avg"})]})]}),r.jsxs("div",{className:"flex items-center gap-2 sm:gap-4 text-right pr-1 sm:pr-2 font-mono",children:[r.jsxs("div",{className:"flex items-center gap-1 sm:gap-1.5",children:[r.jsx("span",{className:"text-xs font-medium",style:{color:D},children:"RX"}),r.jsx("span",{className:"font-bold text-lg sm:text-xl text-text-primary",children:h.rx})]}),r.jsxs("div",{className:"flex items-center gap-1 sm:gap-1.5",children:[r.jsx("span",{className:"text-xs font-medium",style:{color:B},children:"TX"}),r.jsx("span",{className:"font-bold text-lg sm:text-xl text-text-primary",children:h.tx})]}),h.isHovered&&r.jsx("span",{className:"text-xs text-text-muted hidden sm:inline",children:"bucket"})]})]})]})}function ct(e){const{values:t,sum:s}=e;if(0===t.length)return{min:0,mean:0,median:0,p75:0,p95:0,p99:0,max:0};const a=[...t].sort((e,t)=>e-t),n=a.length,r=s/n,l=a[0],i=a[n-1],o=e=>{const t=Math.min(Math.ceil(e*n)-1,n-1);return a[Math.max(0,t)]};return{min:l,mean:r,median:n%2==0?(a[n/2-1]+a[n/2])/2:a[Math.floor(n/2)],p75:o(.75),p95:o(.95),p99:o(.99),max:i}}function Ct({statsBuckets:e,mode:t,packets:s,startTs:a,endTs:i,radioConfig:o,sortedTypes:c,aggregateShares:C,noiseFloorAnomalies:A,showNoiseFloorOverlay:D,overlayOpacity:B=.5}){const[F,E]=n.useState(null),[m,d]=n.useState(null),u=n.useMemo(()=>(i-a)/3600,[a,i]),h=n.useCallback(e=>{d(e)},[]),x=function(e,t,s,a,r){return n.useMemo(()=>{if(0===e.length||!r)return null;const n=e.filter(e=>e.timestamp>=t&&e.timestamp<=s);if(0===n.length)return null;const l=[],i=new Map;for(const e of n){const s=e.type??e.payload_type??-1,n=H(e);let o;if(o="airtime"===a?O(e,{spreadingFactor:r.sf,bandwidthHz:r.bw,codingRate:r.cr,preambleLength:r.preamble}):1,n<=0)continue;const c=Math.floor((e.timestamp-t)/300),C={timestamp:e.timestamp,airtimeMs:o,byteSize:n,packetType:s,bucketIndex:c};l.push(C),i.has(c)||i.set(c,[]),i.get(c).push(C)}if(0===l.length)return null;const o=[],c=[],C=[],A=new Map;if("share"===a)for(const[,e]of i)for(const t of e)A.set(t,t.byteSize);else for(const[,e]of i){const t=e.reduce((e,t)=>e+t.airtimeMs,0)/3e5*100;let s=0;for(const a of e)a.airtimeMs>s&&(s=a.airtimeMs);for(const a of e){const e=a.airtimeMs/s*t;A.set(a,e)}}for(const e of l){const t=A.get(e);void 0!==t&&(o.push(t),c.push(e.timestamp),C.push(e.packetType))}let D=c[0],B=c[0];for(let e=1;eB&&(B=c[e]);const F=B-D||1,E=[...o].sort((e,t)=>e-t),m=E[0],d=E[E.length-1],u=Math.floor(.05*E.length),h=Math.floor(.5*E.length),x=Math.min(Math.ceil(.95*E.length),E.length-1),p=E[u],g=E[h],f=E[x],b=new Map;for(const e of o){const t=Math.round(100*e)/100;b.set(t,(b.get(t)??0)+1)}const y=b.size,v=[...b.entries()].sort((e,t)=>t[1]-e[1]).slice(0,5).map(([e,t])=>({value:e,count:t,percent:t/o.length*100}));let j;if("share"===a)j=200;else{const e=5,t=Math.ceil(d/e)*e;j=t<=10?10:t+e}const N=new Float32Array(2*o.length),w=new Float32Array(o.length),k=new Uint8Array(o.length),M=new Float32Array(o.length);for(let e=0;e=0?C[e]:255,M[e]=c[e]}return{points:N,rawValues:w,packetTypes:k,timestamps:M,count:o.length,minTime:D,maxTime:B,minValue:0,maxValue:j,rawMinValue:m,rawMaxValue:d,unit:"%",stats:{p5:p,p50:g,p95:f,uniqueValues:y,topValues:v}}},[e,t,s,a,r])}(s,a,i,"share"===t?"share":"airtime",o),{data:p}=n.useMemo(()=>function(e,t){var s;const a=e.length;if(0===a)return{data:[],windowSize:0,windowDurationMs:0};const n=(null==(s=e[0])?void 0:s.bucketDurationMs)??1e3,r=Math.min(Math.max(5,Math.round(3e5/n)),a),l=Math.floor(r/2),i=[];let o=0,c=0;for(let C=0;Cp.map(e=>({timestamp:e.timestamp,min:e.min,max:e.max,p75:e.p75,p95:e.p95,p99:e.p99,mean:e.mean,median:e.median,average:e.average,midpoint:e.midpoint})),[p]),f=n.useMemo(()=>(null==x?void 0:x.maxValue)?x.maxValue:"share"===t?200:10,[x,t]),b=n.useCallback(e=>{E(e)},[]),y=n.useMemo(()=>{if(null===F||!p[F])return null;const e=p[F];let t;t=u>=168?75:u>=72?35:u>=24?15:u>=3?10:5;const s=60*t/2,a=e.timestamp;return{start:a-s,end:a+s}},[F,p,u]),v=n.useMemo(()=>{if(null===F||!p[F]||!y)return null;const e=p[F].time,{start:a,end:n}=y,r=s.filter(e=>e.timestamp>=a&&e.timestamp({key:e.key,label:e.label,value:0,color:et(e.typeNum)}))};const l=new Map,i=new Map;let C=0,A=0;for(const t of r){const e=`TYPE_${t.type??t.payload_type??-1}`;if(l.set(e,(l.get(e)??0)+1),C++,o){const s=O(t,{spreadingFactor:o.sf,bandwidthHz:o.bw,codingRate:o.cr,preambleLength:o.preamble});i.set(e,(i.get(e)??0)+s),A+=s}}const D=c.map(e=>{let s;return s="airtime"===t?A>0?(i.get(e.key)??0)/A:0:C>0?(l.get(e.key)??0)/C:0,{key:e.key,label:e.label,value:s,color:et(e.typeNum)}});return{timestamp:p[F].timestamp,timeLabel:e,items:D}},[F,p,y,s,c,t,o]);if(0===p.length)return r.jsxs("div",{className:"h-full flex items-center justify-center text-text-muted",children:[r.jsx(l,{className:"w-6 h-6 mr-2 opacity-50"}),r.jsx("span",{children:"No packet data available"})]});const j=(null==v?void 0:v.timeLabel)??null;return r.jsxs("div",{className:"flex flex-col",children:[r.jsxs("div",{className:"analyzer-chart-height relative flex-shrink-0",children:[r.jsx("div",{className:"absolute inset-0 rounded-lg overflow-hidden",children:r.jsx(Je,{data:g,maxValue:f,onHover:b,scatterData:x,noiseFloorAnomalies:A,showNoiseFloorOverlay:D,overlayOpacity:B,highlightedType:m,hoveredTimeRange:y,timeRangeHours:u,yAxisMode:"share"===t?"share":"airtime"})}),j&&r.jsx("div",{className:"absolute top-1 right-1 px-2 py-0.5 bg-bg-elevated/90 rounded text-xs text-accent-secondary font-mono pointer-events-none",children:j})]}),r.jsx(tt,{sortedTypes:c,highlightedType:m,onTypeHover:h,aggregateShares:C,hoverData:v})]})}const At=new class{constructor(){a(this,"buckets",new Map),a(this,"lastProcessedTimestamp",0),a(this,"processedPacketCount",0),a(this,"cacheKey",null),a(this,"bucketDuration",60),a(this,"bucketDurationMs",6e4)}getBuckets(e,t,s,a){const n={startTs:t,endTs:s,radioConfigHash:this.hashRadioConfig(a)};return this.isCacheValid(n)?this.processPackets(e,t,s,a,!1):(this.invalidate(n),this.processPackets(e,t,s,a,!0)),this.toBucketDataArray(t,s)}processPackets(e,t,s,a,n){const r=Math.ceil((s-t)/this.bucketDuration);let l=0;for(const i of e){const e=i.timestamp;if(e=s)continue;if(!n&&e<=this.lastProcessedTimestamp)continue;const o=Math.min(Math.floor((e-t)/this.bucketDuration),r-1),c=this.buckets.get(o)??{total:0,totalAirtime:0};c.total+=1,c.totalAirtime+=O(i,{spreadingFactor:a.sf,bandwidthHz:a.bw,codingRate:a.cr,preambleLength:a.preamble}),this.buckets.set(o,c),e>this.lastProcessedTimestamp&&(this.lastProcessedTimestamp=e),l++}this.processedPacketCount+=l}toBucketDataArray(e,t){const s=t-e,a=Math.ceil(s/this.bucketDuration),n=s/3600,r=[];for(let l=0;l24?s.toLocaleDateString([],{weekday:"short",hour:"2-digit",minute:"2-digit",hour12:!1}):s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}),i=this.buckets.get(l)??{total:0,totalAirtime:0};r.push({timestamp:t,time:a,total:i.total,totalAirtime:i.totalAirtime,bucketDurationMs:this.bucketDurationMs})}return r}isCacheValid(e){return!!this.cacheKey&&this.cacheKey.startTs===e.startTs&&this.cacheKey.endTs===e.endTs&&this.cacheKey.radioConfigHash===e.radioConfigHash}invalidate(e){this.buckets.clear(),this.lastProcessedTimestamp=0,this.processedPacketCount=0,this.cacheKey=e}hashRadioConfig(e){return`${e.sf}-${e.bw}-${e.cr}-${e.preamble}`}clear(){this.buckets.clear(),this.lastProcessedTimestamp=0,this.processedPacketCount=0,this.cacheKey=null}getStats(){return{bucketCount:this.buckets.size,processedPackets:this.processedPacketCount,lastTimestamp:this.lastProcessedTimestamp,cacheKey:this.cacheKey}}};function Dt({mode:e,onChange:t}){return r.jsxs("div",{className:"toggle-group toggle-group-sm",children:[r.jsx("button",{onClick:()=>t("share"),className:"toggle-group-item "+("share"===e?"active":""),children:"Total"}),r.jsx("button",{onClick:()=>t("airtime"),className:"toggle-group-item "+("airtime"===e?"active":""),children:"Airtime"})]})}function Bt({smoothing:e,onChange:t}){return r.jsxs("div",{className:"toggle-group toggle-group-sm",children:[r.jsx("button",{onClick:()=>t("stats"),className:"toggle-group-item "+("stats"===e?"active":""),title:"Statistics view (scatter plot)",children:r.jsx(C,{className:"w-3.5 h-3.5"})}),r.jsx("button",{onClick:()=>t("trend"),className:"toggle-group-item "+("trend"===e?"active":""),title:"Trend line chart",children:r.jsx(A,{className:"w-3.5 h-3.5"})}),r.jsx("button",{onClick:()=>t("raw"),className:"toggle-group-item "+("raw"===e?"active":""),title:"No smoothing (raw values)",children:r.jsx(D,{className:"w-3.5 h-3.5"})}),r.jsx("button",{onClick:()=>t("zlema"),className:"toggle-group-item "+("zlema"===e?"active":""),title:"Light smoothing",children:r.jsx(B,{className:"w-3.5 h-3.5"})}),r.jsx("button",{onClick:()=>t("ema"),className:"toggle-group-item "+("ema"===e?"active":""),title:"Moderate smoothing",children:r.jsx(F,{className:"w-3.5 h-3.5"})}),r.jsx("button",{onClick:()=>t("smooth"),className:"toggle-group-item "+("smooth"===e?"active":""),title:"Heavy smoothing",children:r.jsx(E,{className:"w-3.5 h-3.5"})}),r.jsx("button",{onClick:()=>t("ultra"),className:"toggle-group-item "+("ultra"===e?"active":""),title:"Ultra smoothing",children:r.jsx(m,{className:"w-3.5 h-3.5"})}),r.jsx("button",{onClick:()=>t("mosaic"),className:"toggle-group-item "+("mosaic"===e?"active":""),title:"Mosaic view (treemap)",children:r.jsx(d,{className:"w-3.5 h-3.5"})})]})}function Ft({enabled:e,onChange:t,anomalyCount:s=0,showTuning:a=!1,onTuningChange:n}){return r.jsxs("div",{className:"relative inline-flex items-center gap-1",children:[e&&n&&r.jsx("button",{onClick:()=>n(!a),className:"toggle-group toggle-group-sm "+(a?"active":""),title:a?"Hide tuning panel":"Show tuning panel",children:r.jsx("span",{className:"toggle-group-item "+(a?"active":""),children:r.jsx(o,{className:"w-3.5 h-3.5"})})}),r.jsx("button",{onClick:()=>t(!e),className:"toggle-group toggle-group-sm "+(e?"active":""),title:e?"Hide noise floor anomalies":"Show noise floor anomalies",children:r.jsx("span",{className:"toggle-group-item "+(e?"active":""),children:r.jsx(c,{className:"w-3.5 h-3.5"})})}),s>0&&r.jsx("span",{className:"absolute -top-2 -right-2 min-w-[18px] h-[18px] px-1 rounded-full bg-accent-danger text-white text-[10px] font-bold flex items-center justify-center pointer-events-none z-10",children:s>99?"99+":s})]})}const Et={sf:10,bw:25e4,cr:5,preamble:8};function mt(e){return I[e]??`TYPE_${e.toString(16).toUpperCase()}`}function dt(e,t){if(0===e.length)return[];const s=Math.floor((t-1)/2),a=[];for(let n=0;n=s?e[n-s]:e[0];a.push(e[n]+(e[n]-t))}return function(e,t){if(0===e.length)return[];const s=2/(t+1),a=[e[0]];for(let n=1;n{const t=Math.abs(e.length-p.current);if(0===t&&u.length>0)return;x.current&&clearTimeout(x.current);const s=t>100?50:500;return x.current=setTimeout(()=>{p.current=e.length,h(e)},s),()=>{x.current&&clearTimeout(x.current)}},[e,u.length]);const g=n.useMemo(()=>function(e,t){const s=new Map;for(const n of e){const e=n.type??n.payload_type??-1,a=O(n,{spreadingFactor:t.sf,bandwidthHz:t.bw,codingRate:t.cr,preambleLength:t.preamble}),r=s.get(e)??{count:0,airtime:0};s.set(e,{count:r.count+1,airtime:r.airtime+a})}const a=[];for(const[n,r]of s)a.push({typeNum:n,key:`TYPE_${n}`,label:mt(n),totalCount:r.count,totalAirtime:r.airtime});return a.sort((e,t)=>t.totalCount-e.totalCount)}(u,i),[u,i]),f=n.useMemo(()=>function(e,t,s,a,n,r){const l=s-t,i=l/a,o=1e3*i,c=l/3600,C=[];for(let A=0;A24?s.toLocaleDateString([],{weekday:"short",hour:"2-digit",minute:"2-digit",hour12:!1}):s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}),counts:{},shares:{},airtimes:{},total:0,totalAirtime:0,bucketDurationMs:o};for(const t of r)a.counts[t.key]=0,a.airtimes[t.key]=0;C.push(a)}for(const A of e){const e=A.timestamp;if(e=s)continue;const r=Math.min(Math.floor((e-t)/i),a-1),l=`TYPE_${A.type??A.payload_type??-1}`;C[r].counts[l]=(C[r].counts[l]??0)+1,C[r].total++;const o=O(A,{spreadingFactor:n.sf,bandwidthHz:n.bw,codingRate:n.cr,preambleLength:n.preamble});C[r].airtimes[l]=(C[r].airtimes[l]??0)+o,C[r].totalAirtime+=o}for(const A of C)for(const e of r)A.shares[e.key]=A.total>0?A.counts[e.key]/A.total*100:0;return C}(u,t,s,a,i,g),[u,t,s,a,i,g]),b=n.useMemo(()=>At.getBuckets(u,t,s,i),[u,t,s,i]),y=n.useMemo(()=>g.reduce((e,t)=>e+t.totalCount,0),[g]),v=n.useMemo(()=>g.reduce((e,t)=>e+t.totalAirtime,0),[g]),{sortedTypes:j,aggregateShares:N}=n.useMemo(()=>{const e=new Map,t="share"===o?y:v;if(t>0)for(const s of g){const a="share"===o?s.totalCount:s.totalAirtime;e.set(s.key,a/t)}return{sortedTypes:[...g].sort((t,s)=>(e.get(s.key)??0)-(e.get(t.key)??0)),aggregateShares:e}},[g,y,v,o]),w=n.useMemo(()=>function(e,t,s,a="raw"){const n=function(e,t,s){if(e.length<=360)return e;const a=Math.ceil(e.length/360),n=[];for(let r=0;r0?l.counts[e.key]/l.total*100:0;n.push(l)}return n}(e,0,s),r=n.length,l=s.length,i=Array.from({length:l},()=>new Array(r).fill(0));for(let D=0;D0?(e.counts[s[t].key]??0)/e.total:0;else{let t=0;for(let a=0;a0?(e.airtimes[s[a].key]??0)/t:0}}const o=Array.from({length:l},()=>new Array(r).fill(0));for(let D=0;Dfunction(e,t){switch(t){case"zlema":return dt(e,6);case"ema":return dt(e,12);case"smooth":return dt(e,24);case"ultra":return dt(e,96);default:return e}}(e,a)),C=Array.from({length:l},()=>new Array(r).fill(0));for(let D=0;D0?c[D-1][e]:0;C[D][e]=Math.min(1,Math.max(0,c[D][e]-t))}for(let D=0;D0&&Math.abs(e-1)>1e-6){const t=1/e;for(let e=0;eE(e),[]),M=n.useCallback(e=>d(e),[]),S=n.useMemo(()=>{if(null===m||!w[m])return null;const e=w[m];return{timestamp:e.timestamp,timeLabel:e.time,items:j.map(t=>({key:t.key,label:t.label,value:e[t.key]??0,color:et(t.typeNum)}))}},[m,w,j]),T=n.useMemo(()=>({timestamps:w.map(e=>e.timestamp),series:j.map(e=>({key:e.key,label:e.label,color:et(e.typeNum),values:w.map(t=>t[e.key]??0)}))}),[w,j]);return 0===u.length?0===e.length?r.jsxs("div",{className:"h-full flex items-center justify-center text-text-muted",children:[r.jsx(l,{className:"w-6 h-6 mr-2 opacity-50"}),r.jsx("span",{children:"No packet data available"})]}):null:"mosaic"===c?r.jsx(rt,{sortedTypes:j,aggregateShares:N}):"stats"===c?r.jsx(Ct,{statsBuckets:b,mode:o,packets:u,startTs:t,endTs:s,radioConfig:i,sortedTypes:j,aggregateShares:N,noiseFloorAnomalies:C,showNoiseFloorOverlay:A,overlayOpacity:D}):"trend"===c?r.jsx(ot,{packets:u,mode:o,startTs:t,endTs:s,radioConfig:i,bucketCount:a}):r.jsxs("div",{className:"flex flex-col",children:[r.jsx("div",{className:"analyzer-chart-height relative flex-shrink-0",children:r.jsx("div",{className:"absolute inset-0 rounded-lg overflow-hidden",children:r.jsx(W,{timestamps:T.timestamps,series:T.series,highlightedKey:F,cursorColor:B.cursor,onHover:M})})}),r.jsx(tt,{sortedTypes:j,highlightedType:F,onTypeHover:k,aggregateShares:N,hoverData:S})]})}),ht={"1x":1,"2x":2,"4x":4,"8x":8,"16x":16,"36x":36},xt=[1,5,10,25,50,100,150];function pt(e,t,s,a){const n=Math.PI/180,r=(a-t)*n,l=e*n,i=s*n,o=Math.sin(r)*Math.cos(i),c=Math.cos(l)*Math.sin(i)-Math.sin(l)*Math.cos(i)*Math.cos(r);return(180*Math.atan2(o,c)/Math.PI+360)%360}function gt(e,t,s,a){const n=Math.PI/180,r=(s-e)*n,l=(a-t)*n,i=Math.sin(r/2)**2+Math.cos(e*n)*Math.cos(s*n)*Math.sin(l/2)**2;return 12742*Math.atan2(Math.sqrt(i),Math.sqrt(1-i))}const ft=[{min:10,label:"Excellent"},{min:7,label:"Very Good"},{min:4,label:"Good"},{min:1,label:"Fair+"},{min:-2,label:"Fair"},{min:-5,label:"Fair-"},{min:-8,label:"Poor"},{min:-11,label:"Bad"},{min:-1/0,label:"Critical"}];function bt(e,t){return t[Fe(e)]||"#808080"}const yt=n.memo(function({neighbors:e,quickNeighbors:t,localLat:s,localLon:a,onStatsChange:l}){const[i,o]=n.useState(null),[c,C]=n.useState(new Set),[A,D]=n.useState({width:0,height:0}),[B,F]=n.useState("1x"),[E,m]=n.useState(1),d=n.useRef(null),h=n.useRef({}),x=n.useRef(null),p=n.useRef(null),g=n.useRef(E);g.current=E;const f=Ae(),b=oe(),y=De(),v=ce(),j=Be(),N=j?v.secondary:v.primary,w=j?.4:.15,k=j?.25:.08,M=j?v.primary:b.primary;n.useEffect(()=>{const e=p.current;if(!e)return;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:s}=t.contentRect;e>0&&s>0&&D({width:e,height:s})}});t.observe(e);const s=e.getBoundingClientRect();return s.width>0&&s.height>0&&D({width:s.width,height:s.height}),()=>t.disconnect()},[]);const S=n.useMemo(()=>{const e=new Set;if(t)for(const s of t)e.add(s.hash);return e},[t]),T=n.useMemo(()=>{const e=new Map;if(t)for(const s of t)e.set(s.hash,{snr:s.avgSnr,rssi:s.avgRssi});return e},[t]),{processedNeighbors:R,maxDistance:$,totalNeighbors:P,zeroHopCount:L}=n.useMemo(()=>{const t=[];for(const[r,l]of Object.entries(e)){if(!l.latitude||!l.longitude||0===l.latitude||0===l.longitude)continue;if(!S.has(r))continue;const e=pt(s,a,l.latitude,l.longitude),n=gt(s,a,l.latitude,l.longitude),i=T.get(r);t.push({hash:r.slice(0,8),name:l.node_name||l.name||"Unknown",snr:(null==i?void 0:i.snr)??l.snr??null,rssi:(null==i?void 0:i.rssi)??l.rssi??null,bearing:e,distance:n,normalizedDistance:0,lastSeen:l.last_seen,isZeroHop:!0})}const n=1.08*(t.length>0?Math.max(...t.map(e=>e.distance)):0);return t.sort((e,t)=>(e.snr??-1/0)-(t.snr??-1/0)),{processedNeighbors:t,maxDistance:n,totalNeighbors:t.length,zeroHopCount:t.length}},[e,s,a,S,T]);n.useEffect(()=>{null==l||l({zeroHopCount:L,totalCount:P,maxDistanceKm:$})},[L,P,$]),n.useEffect(()=>{const e=ht[B],t=g.current;d.current&&cancelAnimationFrame(d.current);const s=performance.now(),a=n=>{const r=n-s,l=Math.min(r/400,1),i=(o=l)<.5?8*o*o*o*o:1-Math.pow(-2*o+2,4)/2;var o;m(t+(e-t)*i),d.current=l<1?requestAnimationFrame(a):null};return d.current=requestAnimationFrame(a),()=>{d.current&&cancelAnimationFrame(d.current)}},[B]);const z=$/E,_=n.useMemo(()=>xt.filter(e=>e<=1.1*z),[z]);n.useEffect(()=>{const e=[];for(const s of R){const t=h.current[s.hash];void 0!==t&&t!==s.lastSeen&&e.push(s.hash),h.current[s.hash]=s.lastSeen}if(0===e.length)return;queueMicrotask(()=>{C(t=>new Set([...t,...e]))});const t=setTimeout(()=>{C(t=>{const s=new Set(t);return e.forEach(e=>s.delete(e)),s})},600);return()=>clearTimeout(t)},[R]);const H=0!==s&&0!==a,O=n.useMemo(()=>{const{width:e,height:t}=A,s=e/2,a=t/2,n=Math.max(10,e/2-12),r=Math.max(10,t/2-12),l=Math.max(10,n-16),i=Math.max(10,r-16);return{width:e,height:t,centerX:s,centerY:a,maxRadiusX:l,maxRadiusY:i,labelRadiusX:n,labelRadiusY:r,cornerRadius:.2*Math.min(l,i)}},[A]),{width:W,height:I,centerX:q,centerY:G,maxRadiusX:X,maxRadiusY:K,labelRadiusX:Y,labelRadiusY:U,cornerRadius:Q}=O,Z=n.useCallback((e,t=1)=>{const s=X*t,a=K*t,n=Math.min(Q*t,s,a),r=(e%360+360)%360,l=r*Math.PI/180,i=180*Math.atan2(a-n,s-n)/Math.PI;let o,c;if(r<=45-i||r>315+i){const e=Math.tan(l);o=Math.max(q-s+n,Math.min(q+s-n,q+a*e*(s/a))),c=G-a}else if(r>45-i&&r<=45+i)o=q+s-n+n*Math.sin(l),c=G-a+n-n*Math.cos(l);else if(r>45+i&&r<=135-i){const e=1/Math.tan(l);c=Math.max(G-a+n,Math.min(G+a-n,G-s*e*(a/s))),o=q+s}else if(r>135-i&&r<=135+i)o=q+s-n+n*Math.sin(l),c=G+a-n-n*Math.cos(l);else if(r>135+i&&r<=225-i){const e=Math.tan(l);o=Math.max(q-s+n,Math.min(q+s-n,q-a*e*(s/a))),c=G+a}else if(r>225-i&&r<=225+i)o=q-s+n+n*Math.sin(l),c=G+a-n-n*Math.cos(l);else if(r>225+i&&r<=315-i){const e=1/Math.tan(l);c=Math.max(G-a+n,Math.min(G+a-n,G-s*e*(a/s))),o=q-s}else o=q-s+n+n*Math.sin(l),c=G-a+n-n*Math.cos(l);return{x:o,y:c}},[q,G,X,K,Q]),J=n.useCallback((e,t)=>{const s=Z(e,1);return{x:q+(s.x-q)*t,y:G+(s.y-G)*t}},[Z,q,G]),ee=n.useCallback(e=>({N:{x:q,y:G-U},S:{x:q,y:G+U},E:{x:q+Y,y:G},W:{x:q-Y,y:G},NE:{x:q+Y,y:G-U},SE:{x:q+Y,y:G+U},SW:{x:q-Y,y:G+U},NW:{x:q-Y,y:G-U}}[e]),[q,G,Y,U]),te=n.useCallback(e=>{const t=X*e,s=K*e,a=Math.min(Q*e,t,s),n=q-t,r=q+t,l=G-s,i=G+s;return[`M ${n+a} ${l}`,`L ${r-a} ${l}`,`Q ${r} ${l} ${r} ${l+a}`,`L ${r} ${i-a}`,`Q ${r} ${i} ${r-a} ${i}`,`L ${n+a} ${i}`,`Q ${n} ${i} ${n} ${i-a}`,`L ${n} ${l+a}`,`Q ${n} ${l} ${n+a} ${l}`,"Z"].join(" ")},[q,G,X,K,Q]),se=n.useCallback(e=>{o(e)},[]),ae=n.useCallback(e=>{F(e)},[]),ne=n.useCallback(e=>$<=0?0:e/$*E,[$,E]),re=e=>`${e}km`,le=n.useMemo(()=>{const e=_.map(e=>{const t=e/$*E;return{km:e,scale:t,labelY:G-K*t*.71}}).filter(e=>e.scale<=1.05&&e.scale>=.02).sort((e,t)=>t.km-e.km),t=[];for(const s of e)t.some(e=>Math.abs(e.labelY-s.labelY)<28)||t.push(s);return t},[_,$,E,G,K]),ie=A.width>0&&A.height>0;return H?0===P?r.jsxs("div",{ref:x,className:"flex flex-col items-center justify-center h-full text-text-secondary",children:[r.jsx(u,{className:"w-8 h-8 mb-2 opacity-50"}),r.jsx("p",{children:"No nodes with location data"})]}):r.jsxs("div",{ref:x,className:"relative h-full w-full flex overflow-hidden",children:[r.jsx("div",{ref:p,className:"relative flex-1 min-w-0 h-full",children:ie&&r.jsxs("svg",{width:W,height:I,className:"absolute inset-0 z-0",children:[r.jsxs("defs",{children:[r.jsx("style",{children:"\n @keyframes neighbor-blink-scale {\n 0%, 100% {\n transform: scale(1);\n opacity: 0;\n }\n 50% {\n transform: scale(1.3);\n opacity: 0.8;\n }\n }\n .neighbor-blink-ring {\n transform-origin: center;\n animation: neighbor-blink-scale 600ms ease-out forwards;\n }\n "}),r.jsx("clipPath",{id:"radar-clip",children:r.jsx("path",{d:te(1)})})]}),_.map(e=>{const t=ne(e);if(t>1.05||t<.02)return null;const s=le.some(t=>t.km===e),a=q+X*t*.71,n=G-K*t*.71;return r.jsxs("g",{children:[r.jsx("path",{d:te(t),fill:"none",stroke:N,strokeOpacity:w,strokeWidth:1}),s&&r.jsx("text",{x:a+4,y:n-2,textAnchor:"start",dominantBaseline:"auto",className:"fill-text-secondary",fontSize:10,fontFamily:V,children:re(e)})]},`ring-${e}`)}),["N","E","S","W"].map(e=>{const t="N"===e||"S"===e,s=t?q:"E"===e?q+X:q-X,a=t?"N"===e?G-K:G+K:G;return r.jsx("line",{x1:q,y1:G,x2:s,y2:a,stroke:N,strokeOpacity:w,strokeWidth:1,strokeDasharray:"4 4"},e)}),["NE","SE","SW","NW"].map(e=>{const t=ee(e);return r.jsx("line",{x1:q,y1:G,x2:t.x,y2:t.y,stroke:N,strokeOpacity:k,strokeWidth:1,strokeDasharray:"4 4"},`diag-${e}`)}),["N","E","S","W"].map(e=>{const t=ee(e),s="E"===e?"end":"W"===e?"start":"middle",a="N"===e?"hanging":"S"===e?"auto":"middle";return r.jsx("text",{x:t.x,y:t.y,textAnchor:s,dominantBaseline:a,fill:M,fontSize:16,fontWeight:600,fontFamily:V,"aria-hidden":"true",children:e},e)}),["NE","SE","SW","NW"].map(e=>{const t=ee(e),s="NE"===e||"SE"===e?"end":"start",a="NE"===e||"NW"===e?"hanging":"auto";return r.jsx("text",{x:t.x,y:t.y,textAnchor:s,dominantBaseline:a,fill:M,fontSize:16,fontWeight:600,fontFamily:V,"aria-hidden":"true",children:e},e)}),r.jsx("circle",{cx:q,cy:G,r:5,fill:y.chart6,stroke:"rgba(255,255,255,0.3)",strokeWidth:1,role:"img","aria-label":"Local node"}),r.jsx("g",{clipPath:"url(#radar-clip)",children:R.map(e=>{const t=$>0?e.distance/$*E:0;if(t>1)return null;const{x:s,y:a}=J(e.bearing,t),n=null!==e.snr?bt(e.snr,f):"#808080",l=(null==i?void 0:i.hash)===e.hash,o=c.has(e.hash);return r.jsxs("g",{role:"img","aria-label":`${e.name}: ${e.distance.toFixed(1)}km ${e.bearing.toFixed(0)}°`,children:[o&&r.jsx("circle",{cx:s,cy:a,r:10.5,fill:"none",stroke:"rgba(255,255,255,0.9)",strokeWidth:2,className:"neighbor-blink-ring"}),l&&r.jsx("circle",{cx:s,cy:a,r:10.5,fill:n,opacity:.3}),r.jsx("circle",{cx:s,cy:a,r:l?7:5,fill:n,stroke:"rgba(0,0,0,0.5)",strokeWidth:1,style:{cursor:"pointer",transition:"r 0.15s"},onMouseEnter:()=>se(e),onMouseLeave:()=>se(null)})]},e.hash)})})]})}),r.jsx("div",{className:"flex flex-col h-full items-stretch gap-1 py-2 pl-2 flex-shrink-0",role:"group","aria-label":"Zoom level",children:["1x","2x","4x","8x","16x","36x"].map(e=>r.jsx("button",{onClick:()=>ae(e),"aria-pressed":B===e,className:"flex flex-1 items-center justify-center px-1.5 text-xs font-medium rounded transition-colors "+(B===e?"bg-accent-primary/20 text-accent-primary":"bg-white/5 text-text-secondary hover:bg-white/10 hover:text-text-primary"),children:e},e))}),i&&r.jsxs("div",{className:"absolute bg-tooltip-bg border border-border-subtle rounded-lg px-3 py-2 text-sm pointer-events-none z-10 shadow-xl",style:{left:"50%",bottom:8,transform:"translateX(-50%)"},children:[r.jsx("div",{className:"font-medium text-text-primary",children:i.name}),r.jsx("div",{className:"text-text-secondary text-xs font-mono",children:i.hash}),null!==i.snr?r.jsx("div",{className:"flex gap-3 mt-1 text-xs",children:r.jsxs("span",{children:[r.jsx("span",{className:"text-text-secondary",children:"SNR:"})," ",r.jsxs("span",{className:"tabular-nums",style:{color:bt(i.snr,f)},children:[i.snr.toFixed(1)," dB"]}),r.jsxs("span",{className:"text-text-secondary ml-1",children:["(",(Ce=i.snr,(null==(Fe=ft.find(e=>Ce>=e.min))?void 0:Fe.label)??"Critical"),")"]})]})}):r.jsx("div",{className:"text-xs text-text-secondary mt-1",children:"No SNR data"}),r.jsxs("div",{className:"flex gap-3 text-xs",children:[r.jsxs("span",{children:[r.jsx("span",{className:"text-text-secondary",children:"Distance:"})," ",r.jsxs("span",{className:"tabular-nums text-text-primary",children:[i.distance.toFixed(2)," km"]})]}),r.jsxs("span",{children:[r.jsx("span",{className:"text-text-secondary",children:"Bearing:"})," ",r.jsxs("span",{className:"tabular-nums text-text-primary",children:[i.bearing.toFixed(0),"°"]})]})]})]})]}):r.jsxs("div",{ref:x,className:"flex flex-col items-center justify-center h-full text-text-secondary",children:[r.jsx(u,{className:"w-8 h-8 mb-2 opacity-50"}),r.jsx("p",{children:"Local node coordinates not configured"}),r.jsx("p",{className:"text-xs mt-1",children:"Set latitude/longitude in config to enable"})]});var Ce,Fe});function vt(e,t){if(0===e.length)return 0;const s=t/100*(e.length-1),a=Math.floor(s),n=Math.ceil(s);return a===n?e[a]:e[a]+(e[n]-e[a])*(s-a)}const jt=n.memo(function({timestamps:e,values:t,onStatsChange:s}){var a,l;const{theme:i}=q(),[o,c]=n.useState(!0),C=n.useMemo(()=>{if(0===t.length)return null;const e=Math.min(...t),s=Math.max(...t),a=t.reduce((e,t)=>e+t,0)/t.length,n=[...t].sort((e,t)=>e-t);return{min:e,max:s,avg:a,p5:vt(n,5),p95:vt(n,95)}},[t]);n.useEffect(()=>{null==s||s(C)},[C]);const A=n.useCallback(()=>{c(e=>!e)},[]),{heatmapData:D,xLabels:B,yLabels:F}=n.useMemo(()=>{if(0===e.length||0===t.length||!C)return{heatmapData:null,xLabels:[],yLabels:[]};let s,a;if(o){const e=.1*(C.p95-C.p5||1);s=C.p5-e,a=C.p95+e}else{const e=.1*(C.max-C.min||1);s=C.min-e,a=C.max+e}const n=a-s,r=e[0],l=e[e.length-1]-r||1,i=new Float32Array(2*e.length);for(let o=0;o{const e=m.current;if(!e)return;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:s}=t.contentRect;e>0&&s>0&&u({width:e,height:s})}});t.observe(e);const s=e.getBoundingClientRect();return s.width>0&&s.height>0&&u({width:s.width,height:s.height}),()=>t.disconnect()},[]),n.useEffect(()=>{const e=E.current;if(!e||!D||0===d.width)return;const t=e.getContext("2d");if(!t)return;const{width:s,height:a}=d,n=window.devicePixelRatio||1;e.width=s*n,e.height=a*n,e.style.width=`${s}px`,e.style.height=`${a}px`,t.scale(n,n),t.clearRect(0,0,s,a);const r=getComputedStyle(document.documentElement).getPropertyValue("--accent-primary").trim(),{r:l,g:i,b:o}=(e=>{const t=e.match(/color\(display-p3\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)\)/);if(t)return{r:Math.round(255*parseFloat(t[1])),g:Math.round(255*parseFloat(t[2])),b:Math.round(255*parseFloat(t[3]))};const s=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return s?{r:parseInt(s[1],16),g:parseInt(s[2],16),b:parseInt(s[3],16)}:{r:250,g:189,b:47}})(r),{points:c,count:C}=D,A=Math.max(3,Math.min(8,s/C*4));t.globalCompositeOperation="source-over";for(let D=0;Dr.jsx("span",{className:"type-data-xs text-text-secondary tabular-nums text-right pr-1.5",style:{position:"absolute",top:`${e.pos}%`,transform:"translateY(-50%)",right:0},children:e.label},t))}),r.jsxs("div",{ref:m,className:"absolute overflow-hidden",style:{left:32,right:0,top:0,bottom:20},children:[r.jsx("svg",{className:"absolute inset-0 w-full h-full",preserveAspectRatio:"none","aria-hidden":"true",children:[0,25,50,75,100].map(e=>r.jsx("line",{x1:"0",y1:`${e}%`,x2:"100%",y2:`${e}%`,stroke:"var(--chart-grid-line, rgba(255,255,255,0.06))",strokeDasharray:"3 3"},e))}),r.jsx("canvas",{ref:E,className:"absolute inset-0 w-full h-full","aria-hidden":"true"}),r.jsx("button",{type:"button",onClick:A,className:"absolute bottom-1 right-1 p-1.5 rounded bg-tooltip-bg/80 hover:bg-tooltip-bg active:bg-tooltip-bg transition-colors touch-manipulation",title:o?"Show full range (min/max)":"Show trimmed range (P5-P95)","aria-label":o?"Expand to show full data range":"Shrink to show trimmed percentile range","aria-pressed":!o,children:o?r.jsx(h,{className:"w-3.5 h-3.5 text-text-muted","aria-hidden":"true"}):r.jsx(x,{className:"w-3.5 h-3.5 text-text-muted","aria-hidden":"true"})})]}),r.jsx("div",{className:"absolute left-0 right-0 bottom-0",style:{left:32,height:20},"aria-hidden":"true",children:B.map((e,t)=>r.jsx("span",{className:"type-data-xs text-text-secondary tabular-nums absolute top-1",style:{left:`${e.pos}%`,transform:"translateX(-50%)"},children:e.label},t))})]}):r.jsx("div",{className:"h-full flex items-center justify-center text-text-muted",children:"No noise floor data available"})}),Nt={repeater:"var(--accent-primary)",companion:"var(--accent-tertiary)",room_server:"var(--accent-secondary)"};function wt(e){if(e.contact_type){const t=e.contact_type.toLowerCase();if("repeater"===t||"rep"===t)return"repeater";if("room server"===t||"room_server"===t||"room"===t||"server"===t)return"room_server";if("companion"===t||"client"===t||"cli"===t)return"companion"}return e.is_repeater?"repeater":"companion"}const kt=n.memo(function({neighbors:e}){const t=n.useMemo(()=>{const t={repeater:0,companion:0,room_server:0};for(const a of Object.values(e)){const e=wt(a);t[e]=(t[e]||0)+1}const s=Object.values(t).reduce((e,t)=>e+t,0);return{items:[{label:"Repeaters",count:t.repeater,percent:0,color:Nt.repeater},{label:"Companions",count:t.companion,percent:0,color:Nt.companion},{label:"Room Servers",count:t.room_server,percent:0,color:Nt.room_server}].map(e=>({...e,percent:s>0?e.count/s*100:0})).filter(e=>e.count>0).sort((e,t)=>t.count-e.count),total:s}},[e]);return 0===t.total?r.jsx("div",{className:"h-full flex items-center justify-center text-text-muted type-body-sm",children:"No neighbors discovered yet"}):r.jsxs("div",{className:"h-full flex flex-col",children:[r.jsx("div",{className:"flex-1 flex flex-col justify-evenly",children:t.items.map(e=>r.jsxs("div",{className:"flex flex-col gap-1.5",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"type-data-sm text-text-secondary",children:e.label}),r.jsxs("span",{className:"type-data-sm text-text-secondary tabular-nums",children:[e.count," ",r.jsxs("span",{className:"text-text-secondary/60",children:["(",e.percent.toFixed(0),"%)"]})]})]}),r.jsx("div",{className:"h-2.5 bg-bg-elevated overflow-hidden",children:r.jsx("div",{className:"h-full transition-all duration-500 ease-out",style:{width:`${e.percent}%`,backgroundColor:e.color,minWidth:e.count>0?"4px":"0"}})})]},e.label))}),r.jsxs("div",{className:"flex items-center justify-between pt-2 border-t border-border-subtle",children:[r.jsx("span",{className:"type-data-xs text-text-secondary",children:"Total Nodes"}),r.jsx("span",{className:"type-data-sm text-text-primary font-medium tabular-nums",children:t.total})]})]})});function Mt({children:e,minHeight:t="100%",rootMargin:s="200px 0px",keepMounted:a=!0,className:l=""}){const i=n.useRef(null),[o,c]=n.useState(!1),[C,A]=n.useState(!1);n.useEffect(()=>{const e=i.current;if(!e)return;const t=new IntersectionObserver(([e])=>{const t=e.isIntersecting;A(t),t&&c(!0)},{rootMargin:s,threshold:0});return t.observe(e),()=>{t.disconnect()}},[s]);const D=C||a&&o;return r.jsx("div",{ref:i,className:`h-full w-full ${l}`,style:{minHeight:t},children:D?e:r.jsx("div",{className:"h-full w-full flex items-center justify-center text-text-muted/50",children:r.jsx("div",{className:"animate-pulse text-xs",children:"Loading chart..."})})})}const St={excellent:"text-signal-excellent",good:"text-signal-good",fair:"text-signal-fair",poor:"text-accent-primary"},Tt={excellent:"bg-signal-excellent/10",good:"bg-signal-good/10",fair:"bg-signal-fair/10",poor:"bg-accent-primary/10"};function Rt(){const e=G(),t=X(),[s,a]=n.useState(null),l=n.useCallback((e,t)=>{a({prefix:e,candidateHashes:t})},[]),i=n.useCallback(()=>{a(null)},[]);if(!t)return r.jsxs(be,{children:[r.jsx(we,{icon:r.jsx(p,{}),title:"Prefix Conflicts",largeTitle:!0}),r.jsx("div",{className:"flex-1 flex items-center justify-center",children:r.jsxs("div",{className:"text-center text-text-secondary",children:[r.jsx(g,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),r.jsx("p",{className:"type-data-xs",children:"No topology data available"}),r.jsx("p",{className:"type-data-xs opacity-70",children:"Run deep analysis to see stats"})]})})]});const o=(c=e.avgConfidence)>=.9?"excellent":c>=.7?"good":c>=.5?"fair":"poor";var c;const C=(A=e.collisionRate)<=10?"excellent":A<=25?"good":"poor";var A;const D="poor"===o||"poor"===C?"poor":"fair"===o||"fair"===C?"fair":"good"===o||"good"===C?"good":"excellent",B="excellent"===D||"good"===D?f:b;return r.jsxs(be,{className:"flex flex-col overflow-hidden",children:[r.jsx(we,{icon:r.jsx(p,{}),title:"Prefix Conflicts",largeTitle:!0,actions:r.jsxs("div",{className:`flex items-center gap-1.5 px-2.5 py-1 rounded-full ${Tt[D]}`,children:[r.jsx(B,{className:`w-3.5 h-3.5 ${St[D]}`}),r.jsx("span",{className:`type-data-xs font-medium ${St[D]}`,children:"excellent"===D?"Excellent":"good"===D?"Good":"fair"===D?"Fair":"Needs Attention"})]})}),r.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[r.jsxs("div",{className:"grid grid-cols-3 gap-1.5 sm:gap-2 py-3 sm:py-4",children:[r.jsxs("div",{className:"flex flex-col items-center cursor-help bg-white/5 rounded-lg sm:rounded-xl py-2 sm:py-3 px-1.5 sm:px-2",title:"Total unique 2-character prefixes observed in packet paths.",children:[r.jsx("span",{className:"font-mono text-2xl sm:text-3xl font-semibold tabular-nums text-text-primary",style:{letterSpacing:"-0.05em"},children:e.totalPrefixes}),r.jsx("span",{className:"type-data-xs sm:type-data-sm text-text-secondary mt-0.5 sm:mt-1",children:"Prefixes"})]}),r.jsxs("div",{className:"flex flex-col items-center cursor-help bg-white/5 rounded-lg sm:rounded-xl py-2 sm:py-3 px-1.5 sm:px-2",title:"Prefixes that map to exactly one known node. No disambiguation needed.",children:[r.jsx("span",{className:"font-mono text-2xl sm:text-3xl font-semibold tabular-nums text-text-primary",style:{letterSpacing:"-0.05em"},children:e.unambiguousPrefixes}),r.jsx("span",{className:"type-data-xs sm:type-data-sm text-text-secondary mt-0.5 sm:mt-1",children:"Unique"})]}),r.jsxs("div",{className:"flex flex-col items-center cursor-help rounded-lg sm:rounded-xl py-2 sm:py-3 px-1.5 sm:px-2 "+(e.collisionPrefixes>0?"bg-accent-primary/15":"bg-white/5"),title:"Prefixes matching multiple known nodes. Click a prefix below to explore candidates.",children:[r.jsx("span",{className:"font-mono text-2xl sm:text-3xl font-semibold tabular-nums "+(e.collisionPrefixes>0?"text-accent-primary":"text-text-primary"),style:{letterSpacing:"-0.05em"},children:e.collisionPrefixes}),r.jsx("span",{className:"type-data-xs sm:type-data-sm mt-0.5 sm:mt-1 "+(e.collisionPrefixes>0?"text-accent-primary":"text-text-secondary"),children:"Conflicts"})]})]}),e.highCollisionPrefixes.length>0&&r.jsxs("div",{children:[r.jsx("div",{className:"type-data-xs text-text-secondary mb-1.5",children:"Problem Prefixes"}),r.jsx("div",{className:"flex flex-wrap gap-1.5 content-start",children:e.highCollisionPrefixes.map(({prefix:e,candidateCount:t,candidateHashes:s})=>r.jsxs("button",{type:"button",onClick:()=>l(e,s),className:"inline-flex items-center gap-0.5 group",title:`${t} candidates - click to explore`,children:[r.jsx(je,{children:e}),r.jsxs("span",{className:"text-text-muted type-data-xs group-hover:text-text-secondary transition-colors",children:["×",t]})]},e))})]}),0===e.lowConfidencePrefixes.length&&0===e.collisionPrefixes&&r.jsx("div",{className:"flex-1 flex items-center",children:r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(f,{className:"w-3.5 h-3.5 text-signal-excellent"}),r.jsx("span",{className:"type-data-xs text-signal-excellent",children:"All prefixes uniquely identified"})]})}),r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2 sm:gap-4 mt-auto pt-3",children:[r.jsxs("div",{className:"flex items-center gap-2 cursor-help",title:"Average confidence score across all disambiguated prefixes. Higher = more certain node identification.",children:[r.jsx("span",{className:"type-data-xs text-text-secondary",children:"Confidence"}),r.jsxs("span",{className:`data-box ${St[o]}`,children:[(100*e.avgConfidence).toFixed(1),"%"]})]}),r.jsxs("div",{className:"flex items-center gap-2 cursor-help",title:"Percentage of 2-character prefixes that match multiple known nodes. Lower is better.",children:[r.jsx("span",{className:"type-data-xs text-text-secondary",children:"Collisions"}),r.jsxs("span",{className:`data-box ${St[C]}`,children:[e.collisionRate.toFixed(1),"%"]})]})]})]}),r.jsx(Ne,{isOpen:!!s,prefix:(null==s?void 0:s.prefix)||"",candidateHashes:(null==s?void 0:s.candidateHashes)||[],onClose:i})]})}function $t({icon:e,label:t,value:s,sublabel:a,highlight:n,tooltip:l}){return r.jsxs("div",{className:"flex items-center justify-between gap-2 py-1.5 "+(l?"cursor-help":""),title:l,children:[r.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 min-w-0",children:[r.jsx("span",{className:"icon-xs text-icon-widget flex-shrink-0",children:e}),r.jsx("span",{className:"type-body-sm text-text-secondary truncate",children:t})]}),r.jsxs("div",{className:"flex items-center gap-1 sm:gap-1.5 flex-shrink-0",children:[r.jsx("span",{className:"data-box",style:n?{"--data-box-color":"var(--accent-primary)"}:void 0,children:s}),a&&r.jsx("span",{className:"type-data-xs text-text-secondary hidden sm:inline",children:a})]})]})}function Pt(){const e=K(),t=Y().length;if(!e||0===e.totalPaths)return null;const{totalPaths:s,pathsWithGhosts:a,observationOverrideCount:n,tracePacketsProcessed:l,pathPacketsProcessed:i,distantEdgesDiscovered:o,duplicateGroupsFound:c,duplicatePathsUnique:C,echolocationEdgesInferred:A}=e,D=s>0?((s-a)/s*100).toFixed(1):"0",B=s>0?(n/s*100).toFixed(1):"0",F=l+i,E=F>0||o>0,m=c>0||A>0;return r.jsxs(be,{children:[r.jsx(we,{title:"Path Decoder",icon:r.jsx(y,{}),largeTitle:!0,badge:t>0?`${t} hidden`:void 0}),r.jsxs(ke,{children:[r.jsxs("div",{children:[r.jsx($t,{icon:r.jsx(v,{className:"w-3.5 h-3.5"}),label:"Traceable",value:`${D}%`,sublabel:`of ${s.toLocaleString()} paths`,tooltip:"Percentage of packet journeys where every hop was identified. Higher = better visibility into how traffic flows through your mesh."}),r.jsx($t,{icon:r.jsx(j,{className:"w-3.5 h-3.5"}),label:"Learning Rate",value:`${B}%`,sublabel:"adapted",tooltip:"How often real traffic patterns improved our predictions over geography alone. Higher values mean the decoder is learning your mesh's actual behavior — which routes are preferred, which nodes are most active."})]}),E&&r.jsxs("div",{className:"mt-3",children:[r.jsx("p",{className:"type-micro mb-2",children:"Beyond Line-of-Sight"}),r.jsxs("div",{children:[r.jsx($t,{icon:r.jsx(N,{className:"w-3.5 h-3.5"}),label:"Route Reports",value:F.toLocaleString(),sublabel:l>0?`(${l} TRACE)`:void 0,tooltip:"TRACE/PATH packets from distant nodes share their routing tables. This reveals connections we can't directly observe — mapping parts of the mesh we don't touch."}),r.jsx($t,{icon:r.jsx(w,{className:"w-3.5 h-3.5"}),label:"Remote Links",value:o.toLocaleString(),highlight:o>0,tooltip:"Node-to-node connections discovered from route reports. These links exist outside our RF range but help complete the topology picture."})]})]}),m&&r.jsx($t,{icon:r.jsx(k,{className:"w-3.5 h-3.5"}),label:"Multi-Path Packets",value:c.toLocaleString(),sublabel:C>0?`(${C} routes)`:void 0,tooltip:"Packets received via multiple paths simultaneously. Like sonar, these 'echoes' reveal redundant routes — important for understanding mesh resilience."}),t>0&&r.jsx($t,{icon:r.jsx(M,{className:"w-3.5 h-3.5 text-accent-primary"}),label:"Ghost Repeaters",value:t,highlight:!0,tooltip:"High-confidence hidden repeaters: appear in 10+ paths, have 2+ known neighbors, ≥30% confidence, and plausible location. View them on the Contacts map."})]})]})}function Lt(){var e,t,s,a,i,o,c,C,A,D,B,F,E,m,d,h,x;const p=U(),g=Q(),f=Z(),b=J(),y=ee(),v=te(),j=se(),N=ae(),[w,k]=n.useState([]),[M,$]=n.useState(null),[P,L]=n.useState(null),[z,_]=n.useState(!0),[H,O]=n.useState(null),[W,I]=n.useState(()=>{const e=localStorage.getItem("statistics-view-mode");return"share"===e||"airtime"===e?e:"airtime"});n.useEffect(()=>{localStorage.setItem("statistics-view-mode",W)},[W]);const[V,q]=n.useState(()=>{const e=localStorage.getItem("statistics-smoothing-mode");return["raw","ema","zlema","smooth","ultra","mosaic","stats","trend"].includes(e)?e:"trend"});n.useEffect(()=>{localStorage.setItem("statistics-smoothing-mode",V)},[V]);const[G,X]=n.useState(!1),[K,Y]=n.useState(!1),[oe,ce]=n.useState(Oe),[Ce,Ae]=n.useState(.5),De=n.useMemo(()=>({0:0,1:0,2:1,3:2,4:3,5:4,6:5,7:6}[j]??3),[j]),Be=ne[De].hours,Fe=60*Be,Ee=ne[De],me=le(Be),de=v.isBackgroundLoading,ue=n.useCallback(e=>{N({0:1,1:2,2:3,3:4,4:5,5:6,6:7}[e]??4)},[N]),he=n.useMemo(()=>{var e;if(!(null==(e=null==p?void 0:p.config)?void 0:e.radio))return null;const t=p.config.radio;return{sf:t.spreading_factor??10,bw:t.bandwidth??25e4,cr:t.coding_rate??5,preamble:t.preamble_length??8}},[null==(t=null==(e=null==p?void 0:p.config)?void 0:e.radio)?void 0:t.spreading_factor,null==(a=null==(s=null==p?void 0:p.config)?void 0:s.radio)?void 0:a.bandwidth,null==(o=null==(i=null==p?void 0:p.config)?void 0:i.radio)?void 0:o.coding_rate,null==(C=null==(c=null==p?void 0:p.config)?void 0:c.radio)?void 0:C.preamble_length]);n.useEffect(()=>{!async function(){var e;O(null);try{const t=await re(Be);t.success&&(null==(e=t.data)?void 0:e.history)&&k(t.data.history)}catch(t){O(t instanceof Error?t.message:"Failed to load chart data")}finally{_(!1)}}()},[Be]);const xe=n.useMemo(()=>72===Be?6e5:168===Be?18e5:336===Be?36e5:3e5,[Be]),pe=n.useCallback(async()=>{var e;try{const t=await re(Be);t.success&&(null==(e=t.data)?void 0:e.history)&&k(t.data.history)}catch{}},[Be]);ie(pe,xe,!0,!0);const ge=n.useMemo(()=>0===w.length?{timestamps:[],values:[]}:{timestamps:w.map(e=>e.timestamp),values:w.map(e=>e.noise_floor_dbm)},[w]),je=n.useMemo(()=>{if(w.length<10)return{anomalies:[],debug:void 0};const e=function(e,t={}){const s={...Oe,...t};if(e.length<10)return{anomalies:[],thresholds:Ie([]),totalSamples:e.length,anomalySamples:0};const a=e.map(e=>e.noise_floor_dbm),n=Ie(a),r=[...a].sort((e,t)=>e-t);let l,i;s.useAbsoluteThresholds?(l=s.baselineDbm,i=s.spikeDbm):(l=We(r,s.baselinePercentile),i=We(r,s.spikePercentile));const o=[...e].sort((e,t)=>e.timestamp-t.timestamp),c=[];let C=null,A=0;for(const D of o)if(D.noise_floor_dbm>l&&D.noise_floor_dbme+t,0)/C.values.length):(C.values.length>=s.minSequenceLength&&c.push(C),C={startTs:D.timestamp,endTs:D.timestamp,values:[D.noise_floor_dbm],timestamps:[D.timestamp],rollingAvg:D.noise_floor_dbm})}else C={startTs:D.timestamp,endTs:D.timestamp,values:[D.noise_floor_dbm],timestamps:[D.timestamp],rollingAvg:D.noise_floor_dbm};else C&&C.values.length>=s.minSequenceLength&&c.push(C),C=null;return C&&C.values.length>=s.minSequenceLength&&c.push(C),0===c.length?{anomalies:[],thresholds:n,totalSamples:e.length,anomalySamples:A,debug:{baselineCutoff:l,spikeCutoff:i,midBandSamples:A}}:{anomalies:c.map(e=>{const t=Math.max(...e.values),s=e.values.reduce((e,t)=>e+t,0)/e.values.length;return{startTs:e.startTs,endTs:e.endTs,peakValue:t,avgValue:s,severity:Ve(s,l,i),sampleCount:e.values.length}}),thresholds:n,totalSamples:e.length,anomalySamples:A,debug:{baselineCutoff:l,spikeCutoff:i,midBandSamples:A}}}(w,oe);return{anomalies:e.anomalies,debug:e.debug}},[w,oe]),Ne=je.anomalies,ke=n.useMemo(()=>{const e=(null==p?void 0:p.neighbors)??{};return Object.fromEntries(Object.entries(e).filter(([e])=>!g.has(e)))},[null==p?void 0:p.neighbors,g]),Te=n.useMemo(()=>{const e=Date.now()/1e3-3600*Be;return Object.fromEntries(Object.entries(ke).filter(([,t])=>t.last_seen>=e))},[ke,Be]),Re=n.useMemo(()=>{const e=60*Fe/me,t=Math.floor(Date.now()/1e3),s=Math.floor(t/e)*e;return{start:s-60*Fe,end:s}},[Fe,me]);return r.jsxs(ye,{children:[r.jsx(ve,{title:"Statistics",icon:r.jsx(S,{}),controls:r.jsx(fe,{ranges:ne,selectedIndex:De,onSelect:ue,isPending:de})}),H&&r.jsx(be,{className:"border border-accent-red/50 bg-accent-red/10",children:r.jsx("p",{className:"text-accent-red",children:H})}),G&&K&&r.jsxs(be,{className:"border border-accent-purple/30 bg-glass-surface/50",children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"type-label",children:"Anomaly Detection Tuning"}),r.jsxs("span",{className:"type-data-xs text-text-muted",children:["(",Ee.label,")"]})]}),r.jsx("button",{onClick:()=>ce(e=>({...e,useAbsoluteThresholds:!e.useAbsoluteThresholds})),className:"type-data-xs px-2 py-1 rounded transition-colors "+(oe.useAbsoluteThresholds?"bg-accent-purple/30 text-accent-purple":"bg-glass-elevated text-text-muted hover:text-text-secondary"),children:oe.useAbsoluteThresholds?"Absolute dBm":"Percentile"})]}),r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[r.jsxs("div",{children:[r.jsx("span",{className:"type-micro",children:"Baseline"}),r.jsxs("span",{className:"ml-2 type-data-sm text-status-warning",children:[(null==(D=null==(A=je.debug)?void 0:A.baselineCutoff)?void 0:D.toFixed(1))??"—"," dBm"]})]}),r.jsxs("div",{children:[r.jsx("span",{className:"type-micro",children:"Spike"}),r.jsxs("span",{className:"ml-2 type-data-sm text-status-warning",children:[(null==(F=null==(B=je.debug)?void 0:B.spikeCutoff)?void 0:F.toFixed(1))??"—"," dBm"]})]}),r.jsxs("div",{children:[r.jsx("span",{className:"type-micro",children:"Mid-band"}),r.jsx("span",{className:"ml-2 type-data-sm text-accent-purple",children:(null==(E=je.debug)?void 0:E.midBandSamples)??0})]}),r.jsxs("div",{children:[r.jsx("span",{className:"type-micro",children:"Anomalies"}),r.jsx("span",{className:"ml-2 type-data-sm text-status-danger",children:Ne.length})]})]}),r.jsxs("div",{className:"mt-4 pt-4 border-t border-border-subtle space-y-4",children:[oe.useAbsoluteThresholds?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[r.jsxs("div",{children:[r.jsxs("label",{className:"type-micro block mb-1",children:["Baseline (",oe.baselineDbm," dBm)"]}),r.jsx("input",{type:"range",min:"-120",max:"-60",value:oe.baselineDbm,onChange:e=>ce(t=>({...t,baselineDbm:Number(e.target.value)})),className:"w-full accent-accent-purple"})]}),r.jsxs("div",{children:[r.jsxs("label",{className:"type-micro block mb-1",children:["Spike (",oe.spikeDbm," dBm)"]}),r.jsx("input",{type:"range",min:"-100",max:"-20",value:oe.spikeDbm,onChange:e=>ce(t=>({...t,spikeDbm:Number(e.target.value)})),className:"w-full accent-accent-purple"})]}),r.jsxs("div",{children:[r.jsxs("label",{className:"type-micro block mb-1",children:["Merge Gap (",oe.mergeGapSeconds,"s)"]}),r.jsx("input",{type:"range",min:"5",max:"120",step:"5",value:oe.mergeGapSeconds,onChange:e=>ce(t=>({...t,mergeGapSeconds:Number(e.target.value)})),className:"w-full accent-accent-purple"})]})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[r.jsxs("div",{children:[r.jsxs("label",{className:"type-micro block mb-1",children:["Min Sequence (",oe.minSequenceLength,")"]}),r.jsx("input",{type:"range",min:"2",max:"20",value:oe.minSequenceLength,onChange:e=>ce(t=>({...t,minSequenceLength:Number(e.target.value)})),className:"w-full accent-accent-purple"})]}),r.jsxs("div",{children:[r.jsxs("label",{className:"type-micro block mb-1",children:["Similarity (±",oe.similarityToleranceDbm," dBm)"]}),r.jsx("input",{type:"range",min:"1",max:"15",value:oe.similarityToleranceDbm,onChange:e=>ce(t=>({...t,similarityToleranceDbm:Number(e.target.value)})),className:"w-full accent-accent-purple"})]}),r.jsxs("div",{children:[r.jsxs("label",{className:"type-micro block mb-1",children:["Opacity (",Math.round(100*Ce),"%)"]}),r.jsx("input",{type:"range",min:"0.1",max:"1",step:"0.05",value:Ce,onChange:e=>Ae(Number(e.target.value)),className:"w-full accent-accent-purple"})]})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[r.jsxs("div",{children:[r.jsxs("label",{className:"type-micro block mb-1",children:["Baseline (P",oe.baselinePercentile,")"]}),r.jsx("input",{type:"range",min:"1",max:"50",value:oe.baselinePercentile,onChange:e=>ce(t=>({...t,baselinePercentile:Number(e.target.value)})),className:"w-full accent-accent-purple"})]}),r.jsxs("div",{children:[r.jsxs("label",{className:"type-micro block mb-1",children:["Spike (P",oe.spikePercentile,")"]}),r.jsx("input",{type:"range",min:"50",max:"99",value:oe.spikePercentile,onChange:e=>ce(t=>({...t,spikePercentile:Number(e.target.value)})),className:"w-full accent-accent-purple"})]}),r.jsxs("div",{children:[r.jsxs("label",{className:"type-micro block mb-1",children:["Merge Gap (",oe.mergeGapSeconds,"s)"]}),r.jsx("input",{type:"range",min:"5",max:"120",step:"5",value:oe.mergeGapSeconds,onChange:e=>ce(t=>({...t,mergeGapSeconds:Number(e.target.value)})),className:"w-full accent-accent-purple"})]})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[r.jsxs("div",{children:[r.jsxs("label",{className:"type-micro block mb-1",children:["Min Sequence (",oe.minSequenceLength,")"]}),r.jsx("input",{type:"range",min:"2",max:"20",value:oe.minSequenceLength,onChange:e=>ce(t=>({...t,minSequenceLength:Number(e.target.value)})),className:"w-full accent-accent-purple"})]}),r.jsxs("div",{children:[r.jsxs("label",{className:"type-micro block mb-1",children:["Similarity (±",oe.similarityToleranceDbm," dBm)"]}),r.jsx("input",{type:"range",min:"1",max:"15",value:oe.similarityToleranceDbm,onChange:e=>ce(t=>({...t,similarityToleranceDbm:Number(e.target.value)})),className:"w-full accent-accent-purple"})]}),r.jsxs("div",{children:[r.jsxs("label",{className:"type-micro block mb-1",children:["Opacity (",Math.round(100*Ce),"%)"]}),r.jsx("input",{type:"range",min:"0.1",max:"1",step:"0.05",value:Ce,onChange:e=>Ae(Number(e.target.value)),className:"w-full accent-accent-purple"})]})]})]}),r.jsxs("div",{className:"mt-4 p-3 bg-glass-elevated rounded-lg",children:[r.jsx("div",{className:"type-micro mb-1",children:"Config output"}),r.jsxs("div",{className:"type-data-sm text-status-success",children:[oe.useAbsoluteThresholds?`useAbsoluteThresholds: true, baselineDbm: ${oe.baselineDbm}, spikeDbm: ${oe.spikeDbm}`:`useAbsoluteThresholds: false, baselinePercentile: ${oe.baselinePercentile}, spikePercentile: ${oe.spikePercentile}`,", mergeGapSeconds: ",oe.mergeGapSeconds,", minSequenceLength: ",oe.minSequenceLength,", similarityToleranceDbm: ",oe.similarityToleranceDbm]})]})]})]}),de&&r.jsx(Me,{template:"auto",children:r.jsx(be,{className:"border border-accent-primary/30 bg-accent-primary/5",children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("div",{className:"relative flex h-3 w-3",children:[r.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-accent-primary opacity-75"}),r.jsx("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-accent-primary"})]}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("p",{className:"type-body-sm text-text-primary",children:["Loading ",Ee.label," data..."]}),v.loadProgress&&r.jsxs("p",{className:"type-data-xs text-text-muted mt-0.5",children:[v.loadProgress.loaded.toLocaleString()," packets (",v.loadProgress.percent,"%)"]})]})]})})}),z?r.jsx(Me,{template:"auto",children:r.jsx(be,{className:"text-center py-12",children:r.jsx("div",{className:"animate-pulse text-text-muted",children:"Loading statistics..."})})}):r.jsxs(r.Fragment,{children:[r.jsx(Me,{template:"hero-auto",children:r.jsx(be,{isLoaded:y,skeletonType:"chart",children:y&&r.jsxs(r.Fragment,{children:[r.jsx(we,{icon:r.jsx(l,{}),title:"Packet Analyzer",badge:Ee.label,largeTitle:!0,stackActionsOnMobile:!0,actions:r.jsxs("div",{className:"flex flex-wrap items-center gap-2 justify-end",children:["stats"===V&&r.jsx(Ft,{enabled:G,onChange:X,anomalyCount:Ne.length,showTuning:K,onTuningChange:Y}),r.jsx(Bt,{smoothing:V,onChange:q}),r.jsx(Dt,{mode:W,onChange:I})]})}),r.jsx("div",{className:"flex-1 min-h-0",children:r.jsx(ut,{packets:b,startTs:Re.start,endTs:Re.end,bucketCount:me,radioConfig:he??void 0,mode:W,smoothing:V,noiseFloorAnomalies:Ne,showNoiseFloorOverlay:G,overlayOpacity:Ce})})]})})}),r.jsxs(Me,{template:"panel",children:[r.jsx(Se,{span:12,md:6,children:r.jsx(be,{isLoaded:y,skeletonType:"chart",children:y&&r.jsxs(r.Fragment,{children:[r.jsx(we,{icon:r.jsx(u,{}),title:"Link Quality",badge:Ee.label,largeTitle:!0,actions:P?r.jsxs("div",{className:"flex items-center gap-3 type-data-xs text-text-muted",children:[r.jsxs("span",{children:[r.jsx("span",{className:"text-text-secondary tabular-nums font-medium",children:P.zeroHopCount})," nbr"]}),r.jsxs("span",{children:[r.jsx("span",{className:"text-text-secondary tabular-nums font-medium",children:P.totalCount})," obs"]}),r.jsxs("span",{children:[r.jsx("span",{className:"text-text-secondary tabular-nums font-medium",children:P.maxDistanceKm.toFixed(0)})," km"]})]}):null}),r.jsx("div",{className:"flex-1 min-h-0",children:r.jsx(Mt,{children:r.jsx(yt,{neighbors:Te,quickNeighbors:f,localLat:(null==(d=null==(m=null==p?void 0:p.config)?void 0:m.repeater)?void 0:d.latitude)??0,localLon:(null==(x=null==(h=null==p?void 0:p.config)?void 0:h.repeater)?void 0:x.longitude)??0,onStatsChange:L})})})]})})}),r.jsx(Se,{span:12,md:6,children:r.jsx(be,{isLoaded:y,skeletonType:"chart",children:y&&r.jsxs(r.Fragment,{children:[r.jsx(we,{icon:r.jsx(T,{}),title:"Network Composition",badge:Ee.label,largeTitle:!0}),r.jsx("div",{className:"flex-1 min-h-0",children:r.jsx(Mt,{children:r.jsx(kt,{neighbors:Te})})})]})})})]}),r.jsxs(Me,{template:"panel",children:[r.jsx(Se,{span:12,md:6,children:r.jsx(Rt,{})}),r.jsx(Se,{span:12,md:6,children:r.jsx(Pt,{})})]}),r.jsx(Me,{template:"panel",children:r.jsx(Se,{span:12,children:r.jsx(be,{isLoaded:y,skeletonType:"chart",children:y&&r.jsxs(r.Fragment,{children:[r.jsx(we,{icon:r.jsx(R,{}),title:"RF Noise Floor",largeTitle:!0,stackActionsOnMobile:!0,actions:M?r.jsxs("div",{className:"flex items-center gap-2 sm:gap-3",children:[r.jsxs("span",{className:"type-data-xs text-text-muted whitespace-nowrap",children:["min ",r.jsx("span",{className:"text-text-secondary tabular-nums",children:M.min.toFixed(0)})]}),r.jsxs("span",{className:"type-data-xs text-text-muted whitespace-nowrap",children:["avg ",r.jsx("span",{className:"text-text-secondary tabular-nums",children:M.avg.toFixed(0)})]}),r.jsxs("span",{className:"type-data-xs text-text-muted whitespace-nowrap",children:["max ",r.jsx("span",{className:"text-text-secondary tabular-nums",children:M.max.toFixed(0)})]}),r.jsx("span",{className:"type-data-xs text-text-muted",children:"dBm"})]}):r.jsx("span",{className:"type-data-xs text-text-muted",children:"dBm"})}),r.jsx("div",{className:"flex-1 min-h-0",children:r.jsx(Mt,{children:r.jsx(jt,{timestamps:ge.timestamps,values:ge.values,onStatsChange:$})})})]})})})})]})]})}export{Lt as default}; diff --git a/frontend/dist/assets/System-BPwbPFCW.js b/frontend/dist/assets/System-BPwbPFCW.js deleted file mode 100644 index b3bd5fb3..00000000 --- a/frontend/dist/assets/System-BPwbPFCW.js +++ /dev/null @@ -1 +0,0 @@ -import{r as e,j as t,am as s,bx as a,ax as n,ao as r,aX as l,aj as c,by as i,bz as o,aH as m,C as x,at as d}from"./vendor-react-C341c8YC.js";import{n as u,R as p,A as h,C as j,X as f,Y as g,T as y,v as b}from"./recharts-6XUQYgRA.js";import{ao as v,ap as N,aq as w,ar as k,S as _,as as C,at as M,F as S}from"./index-BJEgt3tp.js";import{a as F,b as T}from"./useThemeColors-AeHMyThq.js";import{P as B,b as R,a as L}from"./PageLayout-CnF5SScd.js";import{R as $,C as P}from"./Grid-BOO-7ObJ.js";import{C as A}from"./Card-2pQSGkKC.js";import"./vendor-core-WoOfkQwm.js";import"./deckgl-DTsmDcfs.js";const U=_.hero,D=_.hero,E={warning:80,danger:95},G={warning:85,danger:95},K={warning:70,danger:85},O=[{threshold:30,color:"var(--accent-tertiary)"},{threshold:50,color:"var(--accent-primary)"},{threshold:65,color:"var(--accent-secondary)"},{threshold:80,color:"var(--signal-poor)"}];function W(e,t,s){const a=s-t,n={cold:(30-t)/a*100,normal:(50-t)/a*100,warm:(65-t)/a*100,hot:(80-t)/a*100};return`linear-gradient(to right, ${[{pos:0,color:"var(--accent-tertiary)"},{pos:n.cold,color:"var(--accent-tertiary)"},{pos:n.cold,color:"var(--accent-primary)"},{pos:n.normal,color:"var(--accent-primary)"},{pos:n.normal,color:"var(--accent-secondary)"},{pos:n.warm,color:"var(--accent-secondary)"},{pos:n.warm,color:"var(--signal-poor)"},{pos:n.hot,color:"var(--signal-poor)"},{pos:n.hot,color:"var(--accent-danger)"},{pos:100,color:"var(--accent-danger)"}].map(t=>{const s=e>0?t.pos/e*100:0;return`${t.color} ${Math.min(s,100)}%`}).join(", ")})`}function I(e,t){return e>=t.danger?"danger":e>=t.warning?"warning":"none"}function X(e){let t="none";for(const s of Object.values(e)){const e=I(s,K);if("danger"===e)return"danger";"warning"===e&&(t="warning")}return t}function z(e){let t,s,a;return e>=1073741824?(t=e/1073741824,s="GB/s"):e>=1048576?(t=e/1048576,s="MB/s"):e>=1024?(t=e/1024,s="KB/s"):(t=e,s="B/s"),a=t>=100?t.toFixed(0):t.toFixed(1),`${a} ${s}`}function H(e){return e>=1073741824?{value:(e/1073741824).toFixed(1),unit:"GiB"}:e>=1048576?{value:(e/1048576).toFixed(1),unit:"MiB"}:e>=1024?{value:(e/1024).toFixed(1),unit:"KiB"}:{value:String(e),unit:"B"}}const q=e.memo(function({level:e}){return"none"===e?null:t.jsxs("span",{className:u("inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium","danger"===e&&"bg-accent-danger/20 text-accent-danger","warning"===e&&"bg-accent-secondary/20 text-accent-secondary"),children:[t.jsx(d,{className:"w-3 h-3"}),"danger"===e?"High":"Warn"]})}),Y=e.memo(function({data:e,color:s,flipped:a=!1,fixedSlots:n}){const r=[...Array(Math.max(0,n-e.length)).fill(0),...e.slice(-n)],l=Math.max(...r,1),c=r.map(e=>0===e?0:Math.max(e/l*100,3));return t.jsx("div",{className:"w-full h-full flex items-end",style:{transform:a?"scaleY(-1)":void 0},children:c.map((e,a)=>t.jsx("div",{className:"flex-1 min-w-0",style:{height:e>0?`${e}%`:"0%",backgroundColor:e>0?s:"transparent"}},a))})}),J=e.memo(function({value:e,max:s=100,width:a=10,color:n="primary"}){const r=Math.min(e/s,1),l=Math.round(r*a),c=a-l,i="■".repeat(l),o="·".repeat(c),m={primary:"text-accent-primary",secondary:"text-accent-secondary",success:"text-accent-success",danger:"text-accent-danger"}[n];return t.jsxs("span",{className:"font-mono text-[10px] tracking-tight",children:[t.jsx("span",{className:m,children:i}),t.jsx("span",{className:"text-text-muted/40",children:o})]})}),Q=e.memo(function({index:e,usage:s}){const a=s>90?"danger":s>70?"secondary":"primary";return t.jsxs("div",{className:"flex items-center gap-1 text-xs font-mono",children:[t.jsxs("span",{className:"text-text-muted w-5",children:["C",e]}),t.jsx(J,{value:s,width:8,color:a}),t.jsxs("span",{className:u("w-7 text-right tabular-nums",s>90?"text-accent-danger":s>70?"text-accent-secondary":"text-accent-success"),children:[s.toFixed(0),"%"]})]})}),V=e.memo(function({pid:e,name:s,cpu:a,mem:n,isTopCpu:r=!1,isTopMem:l=!1}){return t.jsxs("div",{className:"flex items-center gap-2 py-1 text-sm font-mono hover:bg-subtle-fill -mx-1 px-1 rounded",children:[t.jsx("span",{className:"text-text-muted w-14 tabular-nums",children:e}),t.jsx("span",{className:"flex-1 truncate text-text-primary",children:s}),t.jsx(J,{value:a,max:100,width:6,color:a>50?"danger":a>20?"secondary":"success"}),t.jsx("span",{className:u("w-12 text-right tabular-nums",r?"text-text-primary":a>50?"text-accent-danger":a>20?"text-accent-secondary":"text-text-muted"),children:a.toFixed(1)}),t.jsx("span",{className:u("w-12 text-right tabular-nums",l?"text-text-primary":n>50?"text-accent-danger":n>20?"text-accent-secondary":"text-text-muted"),children:n.toFixed(1)})]})}),Z=e.memo(function({value:e,label:s,min:a=20,max:n=100}){const r=Math.min(Math.max((e-a)/(n-a)*100,0),100),l=function(e){return e<30?{text:"Cool",color:"text-accent-tertiary"}:e<50?{text:"Normal",color:"text-accent-primary"}:e<65?{text:"Warm",color:"text-accent-secondary"}:e<80?{text:"Hot",color:"text-signal-poor"}:{text:"Danger",color:"text-accent-danger"}}(e),c=n-a;return t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsx("span",{className:"text-sm font-mono text-text-muted",children:s}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-sm font-mono text-text-muted",children:l.text}),t.jsxs("span",{className:"px-1.5 py-0.5 bg-subtle-fill-strong rounded text-sm font-mono tabular-nums",children:[t.jsx("span",{className:l.color,children:e.toFixed(1)}),t.jsx("span",{className:"text-text-primary",children:"°C"})]})]})]}),t.jsxs("div",{className:"relative h-3 bg-subtle-fill overflow-hidden",children:[t.jsx("div",{className:"absolute inset-y-0 left-0 transition-all duration-300 ease-out",style:{background:W(r,a,n),width:`${r}%`}}),t.jsx("div",{className:"absolute inset-0 flex items-center pointer-events-none",children:O.map(({threshold:e,color:s})=>{const n=(e-a)/c*100;return n<0||n>100?null:t.jsx("div",{className:"absolute w-px h-full",style:{left:`${n}%`,backgroundColor:s}},e)})})]})]})});function ee({active:e,payload:s,label:a}){return e&&(null==s?void 0:s.length)?t.jsxs("div",{className:"bg-tooltip-bg border border-border-subtle rounded-lg px-3 py-2 text-sm shadow-xl",children:[t.jsx("div",{className:"font-medium text-text-primary mb-1",children:a}),s.map((e,s)=>t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:e.color}}),t.jsxs("span",{className:"text-text-muted",children:[e.name,":"]}),t.jsxs("span",{className:"text-text-primary tabular-nums",children:[e.value.toFixed(1),"%"]})]},s))]}):null}const te=e.memo(function({data:e,cpuColor:s,memoryColor:a,chartGridColors:n}){const r=function(e){const t=[],s=Math.max(0,U-e.length),a=Date.now(),n=C.system;for(let l=0;l`${e}%`}),t.jsx(y,{content:t.jsx(ee,{})}),t.jsx(b,{type:"stepAfter",dataKey:"cpu",name:"CPU",stroke:"none",fill:s,fillOpacity:1,isAnimationActive:!1,connectNulls:!1}),t.jsx(b,{type:"stepAfter",dataKey:"memory",name:"Memory",stroke:a,strokeWidth:2.5,fill:"none",isAnimationActive:!1,connectNulls:!1})]})})})});function se(){var d;const[p,h]=e.useState(null),[j,f]=e.useState([]),[g,y]=e.useState(!0),[b,S]=e.useState(null),[K,O]=e.useState(!1),[W,J]=e.useState(!1),[ee,se]=e.useState([]),[ae,ne]=e.useState(0),[re,le]=e.useState(0),ce=e.useRef(null),ie=v(),oe=N(),me=F(),xe=T(),de=xe.primary,ue=xe.tertiary,pe=function(){const[t,s]=e.useState("undefined"!=typeof window&&window.matchMedia("(max-width: 767px)").matches);return e.useEffect(()=>{const e=window.matchMedia("(max-width: 767px)");s(e.matches);const t=e=>s(e.matches);return e.addEventListener("change",t),()=>e.removeEventListener("change",t)},[]),t?_.hero:40}(),he=e.useCallback(async()=>{var e;try{const[t,s]=await Promise.all([w(),k()]);if(t.success&&t.data){const e=t.data;h(e),S(null),oe(e.cpu.usage_percent,e.memory.usage_percent,U);const s=Date.now(),a={timestamp:s,bytesRecv:e.network.bytes_recv,bytesSent:e.network.bytes_sent};if(ce.current){const e=(s-ce.current.timestamp)/1e3;if(e>0){const t=(a.bytesRecv-ce.current.bytesRecv)/e,s=(a.bytesSent-ce.current.bytesSent)/e;t>=0&&s>=0&&(ne(t),le(s))}}ce.current=a,se(e=>[...e,a].slice(-D))}else S(t.error??"Failed to fetch hardware stats");s.success&&(null==(e=s.data)?void 0:e.processes)&&f(s.data.processes)}catch(t){S(t instanceof Error?t.message:"Failed to fetch hardware stats")}},[oe]);return e.useEffect(()=>{let e=!0,t=null;if((async()=>{e&&(await he(),e&&y(!1))})(),"undefined"==typeof Worker){const t=setInterval(he,C.system);return()=>{e=!1,clearInterval(t)}}{const s=`setInterval(() => postMessage('tick'), ${C.system});`,a=new Blob([s],{type:"application/javascript"});t=new Worker(URL.createObjectURL(a)),t.onmessage=()=>{e&&he()}}return()=>{e=!1,null==t||t.terminate()}},[he]),t.jsxs(B,{children:[t.jsx(R,{title:"System Stats",icon:t.jsx(a,{}),controls:t.jsxs("button",{onClick:async()=>{O(!0),await he(),O(!1)},disabled:K,className:"flex items-center gap-2 px-3 py-1.5 sm:px-4 sm:py-2 bg-bg-subtle hover:bg-bg-elevated rounded-lg transition-colors text-sm text-text-muted hover:text-text-primary self-start sm:self-auto",children:[t.jsx(s,{className:u("w-4 h-4",K&&"animate-spin")}),"Refresh"]})}),b&&t.jsx(L,{className:"border border-accent-danger/50 bg-accent-danger/10",children:t.jsx("p",{className:"text-accent-danger",children:b})}),g?t.jsx(L,{className:"p-12 text-center",children:t.jsx("div",{className:"animate-pulse text-text-muted",children:"Loading system stats..."})}):p?t.jsxs(t.Fragment,{children:[t.jsx($,{template:"hero",children:t.jsxs(L,{children:[t.jsx(A,{icon:t.jsx(n,{}),title:"System Resources",largeTitle:!0,actions:t.jsxs("div",{className:"flex items-center gap-4",children:[(null==(d=p.system)?void 0:d.uptime)&&t.jsx("span",{className:"px-2 py-0.5 bg-white/[0.04] rounded text-sm font-mono tabular-nums text-text-primary",children:M(p.system.uptime)}),t.jsx(q,{level:I(p.cpu.usage_percent,E)}),t.jsx(q,{level:I(p.memory.usage_percent,G)}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-sm font-mono text-text-muted",children:"CPU"}),t.jsxs("span",{className:"text-base font-mono font-semibold tabular-nums",style:{color:de},children:[p.cpu.usage_percent.toFixed(0),"%"]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-sm font-mono text-text-muted",children:"MEM"}),t.jsxs("span",{className:"text-base font-mono font-semibold tabular-nums",style:{color:ue},children:[p.memory.usage_percent.toFixed(0),"%"]})]})]})}),t.jsx("div",{className:"flex-1 min-h-0 mt-2",children:t.jsx(te,{data:ie,cpuColor:de,memoryColor:ue,chartGridColors:me})}),p.cpu.per_core_percent&&p.cpu.per_core_percent.length>0&&t.jsx("div",{className:"mt-3 pt-3 border-t border-border-subtle",children:t.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 lg:grid-cols-8 gap-x-3 gap-y-0.5",children:p.cpu.per_core_percent.map((e,s)=>t.jsx(Q,{index:s,usage:e},s))})})]})}),t.jsxs($,{template:"compact",children:[t.jsx(P,{span:12,md:6,children:t.jsxs(L,{className:"flex flex-col",children:[t.jsx(A,{icon:t.jsx(l,{}),title:"Network",largeTitle:!0,actions:t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(r,{className:"w-3.5 h-3.5",style:{color:ue}}),t.jsx("span",{className:"text-xs font-mono",style:{color:ue},children:"TX"}),t.jsx("span",{className:"px-2 py-1 bg-subtle-fill-strong rounded text-sm font-mono tabular-nums text-text-primary",children:z(re)})]})}),t.jsxs("div",{className:"flex-1 flex flex-col min-h-[80px]",children:[t.jsx("div",{className:"flex-1 min-h-[40px]",children:t.jsx(Y,{data:ee.map((e,t,s)=>{if(0===t)return 0;const a=(e.timestamp-s[t-1].timestamp)/1e3;return a>0?(e.bytesSent-s[t-1].bytesSent)/a:0}),color:ue,fixedSlots:pe})}),t.jsx("div",{className:"flex-1 min-h-[40px]",children:t.jsx(Y,{data:ee.map((e,t,s)=>{if(0===t)return 0;const a=(e.timestamp-s[t-1].timestamp)/1e3;return a>0?(e.bytesRecv-s[t-1].bytesRecv)/a:0}),color:de,flipped:!0,fixedSlots:pe})})]}),t.jsxs("div",{className:"pt-2 flex justify-between items-center text-sm font-mono",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-text-muted",children:"Total"}),t.jsxs("span",{className:"px-2 py-1 bg-subtle-fill-strong rounded tabular-nums",children:[t.jsx("span",{className:"text-accent-tertiary",children:H(p.network.bytes_sent).value})," ",t.jsx("span",{className:"text-text-muted",children:H(p.network.bytes_sent).unit})]}),t.jsxs("span",{className:"px-2 py-1 bg-subtle-fill-strong rounded tabular-nums",children:[t.jsx("span",{className:"text-accent-primary",children:H(p.network.bytes_recv).value})," ",t.jsx("span",{className:"text-text-muted",children:H(p.network.bytes_recv).unit})]})]}),t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(c,{className:"w-3.5 h-3.5",style:{color:de}}),t.jsx("span",{className:"text-xs font-mono",style:{color:de},children:"RX"}),t.jsx("span",{className:"px-2 py-1 bg-subtle-fill-strong rounded tabular-nums text-text-primary",children:z(ae)})]})]})]})}),t.jsx(P,{span:12,md:6,children:t.jsxs(L,{className:"flex flex-col",children:[t.jsx(A,{icon:t.jsx(i,{}),title:"Temperature",largeTitle:!0,actions:p.temperatures&&t.jsx(q,{level:X(p.temperatures)})}),t.jsx("div",{className:"flex-1 flex flex-col justify-center min-h-0",children:p.temperatures&&Object.keys(p.temperatures).length>0?t.jsxs("div",{className:"space-y-3",children:[void 0!==p.temperatures.cpu_thermal&&t.jsx(Z,{value:p.temperatures.cpu_thermal,label:"CPU",min:20,max:100}),Object.entries(p.temperatures).filter(([e])=>"cpu_thermal"!==e).slice(0,2).map(([e,s])=>t.jsx(Z,{value:s,label:e.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()),min:20,max:100},e))]}):t.jsxs("div",{className:"flex items-center justify-center text-text-muted text-sm",children:[t.jsx(n,{className:"w-4 h-4 mr-2"}),"No sensors"]})})]})})]}),t.jsxs($,{template:"compact",children:[t.jsx(P,{span:6,children:t.jsxs(L,{className:"flex flex-col",children:[t.jsx(A,{icon:t.jsx(n,{}),title:"Memory",largeTitle:!0,actions:t.jsxs("span",{className:"px-2 py-0.5 bg-subtle-fill-strong rounded text-base font-mono tabular-nums",style:{color:ue},children:[p.memory.usage_percent.toFixed(0),"%"]})}),t.jsxs("div",{className:"flex-1 flex flex-col justify-center min-h-0",children:[t.jsxs("div",{className:"flex gap-1 h-12",children:[t.jsx("div",{className:"h-full transition-all duration-300 bg-accent-primary",style:{width:`${p.memory.usage_percent}%`}}),t.jsx("div",{className:"h-full transition-all duration-300 bg-accent-tertiary",style:{width:100-p.memory.usage_percent+"%"}})]}),t.jsxs("div",{className:"flex items-center justify-between text-xs font-mono pt-2",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("div",{className:"w-2.5 h-2.5 rounded-sm bg-accent-primary"}),t.jsx("span",{className:"text-text-muted",children:"Used"}),t.jsxs("span",{className:"px-1.5 py-0.5 bg-subtle-fill-strong rounded tabular-nums text-text-primary",children:[(p.memory.used/1048576).toFixed(0)," MB"]})]}),t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("div",{className:"w-2.5 h-2.5 rounded-sm bg-accent-tertiary"}),t.jsx("span",{className:"text-text-muted",children:"Avail"}),t.jsxs("span",{className:"px-1.5 py-0.5 bg-subtle-fill-strong rounded tabular-nums text-text-muted",children:[(p.memory.available/1048576).toFixed(0)," MB"]})]})]})]})]})}),t.jsx(P,{span:6,children:t.jsxs(L,{className:"flex flex-col",children:[t.jsx(A,{icon:t.jsx(o,{}),title:"Disk",largeTitle:!0,actions:t.jsxs("span",{className:"px-2 py-0.5 bg-subtle-fill-strong rounded text-base font-mono tabular-nums",style:{color:de},children:[p.disk.usage_percent.toFixed(0),"%"]})}),t.jsxs("div",{className:"flex-1 flex flex-col justify-center min-h-0",children:[t.jsxs("div",{className:"flex gap-1 h-12",children:[t.jsx("div",{className:"h-full transition-all duration-300 bg-accent-primary",style:{width:`${p.disk.usage_percent}%`}}),t.jsx("div",{className:"h-full transition-all duration-300 bg-accent-tertiary",style:{width:100-p.disk.usage_percent+"%"}})]}),t.jsxs("div",{className:"flex items-center justify-between text-xs font-mono pt-2",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("div",{className:"w-2.5 h-2.5 rounded-sm bg-accent-primary"}),t.jsx("span",{className:"text-text-muted",children:"Used"}),t.jsxs("span",{className:"px-1.5 py-0.5 bg-subtle-fill-strong rounded tabular-nums text-text-primary",children:[(p.disk.used/1073741824).toFixed(1)," GB"]})]}),t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("div",{className:"w-2.5 h-2.5 rounded-sm bg-accent-tertiary"}),t.jsx("span",{className:"text-text-muted",children:"Free"}),t.jsxs("span",{className:"px-1.5 py-0.5 bg-subtle-fill-strong rounded tabular-nums text-text-muted",children:[(p.disk.free/1073741824).toFixed(1)," GB"]})]})]})]})]})})]}),j.length>0&&t.jsx($,{template:"auto",children:t.jsx(L,{noPadding:!0,children:t.jsxs("div",{className:"px-4 py-3",children:[t.jsx(A,{icon:t.jsx(n,{}),title:"Processes",largeTitle:!0,actions:t.jsxs("button",{onClick:()=>J(!W),className:"text-xs text-text-muted hover:text-text-primary flex items-center gap-1",children:[W?"Less":"More",W?t.jsx(m,{className:"w-3 h-3"}):t.jsx(x,{className:"w-3 h-3"})]})}),t.jsxs("div",{className:"flex items-center gap-2 py-1.5 text-sm text-text-muted border-b border-border-subtle font-mono",children:[t.jsx("span",{className:"w-14",children:"PID"}),t.jsx("span",{className:"flex-1",children:"Program"}),t.jsx("span",{className:"w-[52px]"}),t.jsx("span",{className:"w-12 text-right",children:"CPU%"}),t.jsx("span",{className:"w-12 text-right",children:"MEM%"})]}),(()=>{const e=j.slice(0,W?10:5),s=Math.max(...e.map(e=>e.cpu_percent)),a=Math.max(...e.map(e=>e.memory_percent));return e.map(e=>t.jsx(V,{pid:e.pid,name:e.name,cpu:e.cpu_percent,mem:e.memory_percent,isTopCpu:e.cpu_percent===s&&s>0,isTopMem:e.memory_percent===a&&a>0},e.pid))})()]})})})]}):null]})}export{se as default}; diff --git a/frontend/dist/assets/System-DA9azmQv.js b/frontend/dist/assets/System-DA9azmQv.js new file mode 100644 index 00000000..7fb3833e --- /dev/null +++ b/frontend/dist/assets/System-DA9azmQv.js @@ -0,0 +1 @@ +import{a as e,j as t}from"./vendor-react-DCIF8YoJ.js";import{n as s,R as a,A as r,C as n,X as l,Y as c,T as i,v as o}from"./recharts-DVj1EL-m.js";import{c as m,b6 as x,b7 as d,b8 as p,b9 as u,S as h,ba as j,bb as y,C as f,F as g}from"./index-BGs2yNOg.js";import{a as b,b as v}from"./useThemeColors-CGx-Jxyf.js";import{P as N,b as w,a as k}from"./PageLayout-DIXn4UXM.js";import{R as M}from"./refresh-cw-ccP9GKH1.js";import{R as _,C}from"./Grid-DkfcBkoo.js";import{C as S}from"./Card-CPlTPCY8.js";import{A as F,C as T}from"./chevron-up-ClXInh9N.js";import{a as R,A as B}from"./arrow-up-ce4_7z5E.js";import{N as A}from"./network-DpalqfB8.js";import{T as L}from"./triangle-alert-2-1YN-Am.js";import"./deckgl-DTsmDcfs.js";import"./vendor-core-Dl9MTgSr.js";const $=m("cpu",[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]),P=m("hard-drive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]),U=m("thermometer",[["path",{d:"M14 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z",key:"17jzev"}]]),E=h.hero,D=h.hero,G={warning:80,danger:95},z={warning:85,danger:95},I={warning:70,danger:85},K=[{threshold:30,color:"var(--accent-tertiary)"},{threshold:50,color:"var(--accent-primary)"},{threshold:65,color:"var(--accent-secondary)"},{threshold:80,color:"var(--signal-poor)"}];function O(e,t,s){const a=s-t,r={cold:(30-t)/a*100,normal:(50-t)/a*100,warm:(65-t)/a*100,hot:(80-t)/a*100};return`linear-gradient(to right, ${[{pos:0,color:"var(--accent-tertiary)"},{pos:r.cold,color:"var(--accent-tertiary)"},{pos:r.cold,color:"var(--accent-primary)"},{pos:r.normal,color:"var(--accent-primary)"},{pos:r.normal,color:"var(--accent-secondary)"},{pos:r.warm,color:"var(--accent-secondary)"},{pos:r.warm,color:"var(--signal-poor)"},{pos:r.hot,color:"var(--signal-poor)"},{pos:r.hot,color:"var(--accent-danger)"},{pos:100,color:"var(--accent-danger)"}].map(t=>{const s=e>0?t.pos/e*100:0;return`${t.color} ${Math.min(s,100)}%`}).join(", ")})`}function W(e,t){return e>=t.danger?"danger":e>=t.warning?"warning":"none"}function H(e){let t="none";for(const s of Object.values(e)){const e=W(s,I);if("danger"===e)return"danger";"warning"===e&&(t="warning")}return t}function X(e){let t,s,a;return e>=1073741824?(t=e/1073741824,s="GB/s"):e>=1048576?(t=e/1048576,s="MB/s"):e>=1024?(t=e/1024,s="KB/s"):(t=e,s="B/s"),a=t>=100?t.toFixed(0):t.toFixed(1),`${a} ${s}`}function Y(e){return e>=1073741824?{value:(e/1073741824).toFixed(1),unit:"GiB"}:e>=1048576?{value:(e/1048576).toFixed(1),unit:"MiB"}:e>=1024?{value:(e/1024).toFixed(1),unit:"KiB"}:{value:String(e),unit:"B"}}const q=e.memo(function({level:e}){return"none"===e?null:t.jsxs("span",{className:s("inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium","danger"===e&&"bg-accent-danger/20 text-accent-danger","warning"===e&&"bg-accent-secondary/20 text-accent-secondary"),children:[t.jsx(L,{className:"w-3 h-3"}),"danger"===e?"High":"Warn"]})}),Q=e.memo(function({data:e,color:s,flipped:a=!1,fixedSlots:r}){const n=[...Array(Math.max(0,r-e.length)).fill(0),...e.slice(-r)],l=Math.max(...n,1),c=n.map(e=>0===e?0:Math.max(e/l*100,3));return t.jsx("div",{className:"w-full h-full flex items-end",style:{transform:a?"scaleY(-1)":void 0},children:c.map((e,a)=>t.jsx("div",{className:"flex-1 min-w-0",style:{height:e>0?`${e}%`:"0%",backgroundColor:e>0?s:"transparent"}},a))})}),V=e.memo(function({value:e,max:s=100,width:a=10,color:r="primary"}){const n=Math.min(e/s,1),l=Math.round(n*a),c=a-l,i="■".repeat(l),o="·".repeat(c),m={primary:"text-accent-primary",secondary:"text-accent-secondary",success:"text-accent-success",danger:"text-accent-danger"}[r];return t.jsxs("span",{className:"font-mono text-[10px] tracking-tight",children:[t.jsx("span",{className:m,children:i}),t.jsx("span",{className:"text-text-muted/40",children:o})]})}),Z=e.memo(function({index:e,usage:a}){const r=a>90?"danger":a>70?"secondary":"primary";return t.jsxs("div",{className:"flex items-center gap-1 text-xs font-mono",children:[t.jsxs("span",{className:"text-text-muted w-5",children:["C",e]}),t.jsx(V,{value:a,width:8,color:r}),t.jsxs("span",{className:s("w-7 text-right tabular-nums",a>90?"text-accent-danger":a>70?"text-accent-secondary":"text-accent-success"),children:[a.toFixed(0),"%"]})]})}),J=e.memo(function({pid:e,name:a,cpu:r,mem:n,isTopCpu:l=!1,isTopMem:c=!1}){return t.jsxs("div",{className:"flex items-center gap-2 py-1 text-sm font-mono hover:bg-subtle-fill -mx-1 px-1 rounded",children:[t.jsx("span",{className:"text-text-muted w-14 tabular-nums",children:e}),t.jsx("span",{className:"flex-1 truncate text-text-primary",children:a}),t.jsx(V,{value:r,max:100,width:6,color:r>50?"danger":r>20?"secondary":"success"}),t.jsx("span",{className:s("w-12 text-right tabular-nums",l?"text-text-primary":r>50?"text-accent-danger":r>20?"text-accent-secondary":"text-text-muted"),children:r.toFixed(1)}),t.jsx("span",{className:s("w-12 text-right tabular-nums",c?"text-text-primary":n>50?"text-accent-danger":n>20?"text-accent-secondary":"text-text-muted"),children:n.toFixed(1)})]})}),ee=e.memo(function({value:e,label:s,min:a=20,max:r=100}){const n=Math.min(Math.max((e-a)/(r-a)*100,0),100),l=function(e){return e<30?{text:"Cool",color:"text-accent-tertiary"}:e<50?{text:"Normal",color:"text-accent-primary"}:e<65?{text:"Warm",color:"text-accent-secondary"}:e<80?{text:"Hot",color:"text-signal-poor"}:{text:"Danger",color:"text-accent-danger"}}(e),c=r-a;return t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsx("span",{className:"text-sm font-mono text-text-muted",children:s}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-sm font-mono text-text-muted",children:l.text}),t.jsxs("span",{className:"px-1.5 py-0.5 bg-subtle-fill-strong rounded text-sm font-mono tabular-nums",children:[t.jsx("span",{className:l.color,children:e.toFixed(1)}),t.jsx("span",{className:"text-text-primary",children:"°C"})]})]})]}),t.jsxs("div",{className:"relative h-3 bg-subtle-fill overflow-hidden",children:[t.jsx("div",{className:"absolute inset-y-0 left-0 transition-all duration-300 ease-out",style:{background:O(n,a,r),width:`${n}%`}}),t.jsx("div",{className:"absolute inset-0 flex items-center pointer-events-none",children:K.map(({threshold:e,color:s})=>{const r=(e-a)/c*100;return r<0||r>100?null:t.jsx("div",{className:"absolute w-px h-full",style:{left:`${r}%`,backgroundColor:s}},e)})})]})]})});function te({active:e,payload:s,label:a}){return e&&(null==s?void 0:s.length)?t.jsxs("div",{className:"bg-tooltip-bg border border-border-subtle rounded-lg px-3 py-2 text-sm shadow-xl",children:[t.jsx("div",{className:"font-medium text-text-primary mb-1",children:a}),s.map((e,s)=>t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:e.color}}),t.jsxs("span",{className:"text-text-muted",children:[e.name,":"]}),t.jsxs("span",{className:"text-text-primary tabular-nums",children:[e.value.toFixed(1),"%"]})]},s))]}):null}const se=e.memo(function({data:e,cpuColor:s,memoryColor:m,chartGridColors:x}){const d=function(e){const t=[],s=Math.max(0,E-e.length),a=Date.now(),r=j.system;for(let l=0;l`${e}%`}),t.jsx(i,{content:t.jsx(te,{})}),t.jsx(o,{type:"stepAfter",dataKey:"cpu",name:"CPU",stroke:"none",fill:s,fillOpacity:1,isAnimationActive:!1,connectNulls:!1}),t.jsx(o,{type:"stepAfter",dataKey:"memory",name:"Memory",stroke:m,strokeWidth:2.5,fill:"none",isAnimationActive:!1,connectNulls:!1})]})})})});function ae(){var a;const[r,n]=e.useState(null),[l,c]=e.useState([]),[i,o]=e.useState(!0),[m,g]=e.useState(null),[L,I]=e.useState(!1),[K,O]=e.useState(!1),[V,te]=e.useState([]),[ae,re]=e.useState(0),[ne,le]=e.useState(0),ce=e.useRef(null),ie=x(),oe=d(),me=b(),xe=v(),de=xe.primary,pe=xe.tertiary,ue=function(){const[t,s]=e.useState("undefined"!=typeof window&&window.matchMedia("(max-width: 767px)").matches);return e.useEffect(()=>{const e=window.matchMedia("(max-width: 767px)");s(e.matches);const t=e=>s(e.matches);return e.addEventListener("change",t),()=>e.removeEventListener("change",t)},[]),t?h.hero:40}(),he=e.useCallback(async()=>{var e;try{const[t,s]=await Promise.all([p(),u()]);if(t.success&&t.data){const e=t.data;n(e),g(null),oe(e.cpu.usage_percent,e.memory.usage_percent,E);const s=Date.now(),a={timestamp:s,bytesRecv:e.network.bytes_recv,bytesSent:e.network.bytes_sent};if(ce.current){const e=(s-ce.current.timestamp)/1e3;if(e>0){const t=(a.bytesRecv-ce.current.bytesRecv)/e,s=(a.bytesSent-ce.current.bytesSent)/e;t>=0&&s>=0&&(re(t),le(s))}}ce.current=a,te(e=>[...e,a].slice(-D))}else g(t.error??"Failed to fetch hardware stats");s.success&&(null==(e=s.data)?void 0:e.processes)&&c(s.data.processes)}catch(t){g(t instanceof Error?t.message:"Failed to fetch hardware stats")}},[oe]);return e.useEffect(()=>{let e=!0,t=null;if((async()=>{e&&(await he(),e&&o(!1))})(),"undefined"==typeof Worker){const t=setInterval(he,j.system);return()=>{e=!1,clearInterval(t)}}{const s=`setInterval(() => postMessage('tick'), ${j.system});`,a=new Blob([s],{type:"application/javascript"});t=new Worker(URL.createObjectURL(a)),t.onmessage=()=>{e&&he()}}return()=>{e=!1,null==t||t.terminate()}},[he]),t.jsxs(N,{children:[t.jsx(w,{title:"System Stats",icon:t.jsx($,{}),controls:t.jsxs("button",{onClick:async()=>{I(!0),await he(),I(!1)},disabled:L,className:"flex items-center gap-2 px-3 py-1.5 sm:px-4 sm:py-2 bg-bg-subtle hover:bg-bg-elevated rounded-lg transition-colors text-sm text-text-muted hover:text-text-primary self-start sm:self-auto",children:[t.jsx(M,{className:s("w-4 h-4",L&&"animate-spin")}),"Refresh"]})}),m&&t.jsx(k,{className:"border border-accent-danger/50 bg-accent-danger/10",children:t.jsx("p",{className:"text-accent-danger",children:m})}),i?t.jsx(k,{className:"p-12 text-center",children:t.jsx("div",{className:"animate-pulse text-text-muted",children:"Loading system stats..."})}):r?t.jsxs(t.Fragment,{children:[t.jsx(_,{template:"hero",children:t.jsxs(k,{children:[t.jsx(S,{icon:t.jsx(F,{}),title:"System Resources",largeTitle:!0,actions:t.jsxs("div",{className:"flex items-center gap-4",children:[(null==(a=r.system)?void 0:a.uptime)&&t.jsx("span",{className:"px-2 py-0.5 bg-white/[0.04] rounded text-sm font-mono tabular-nums text-text-primary",children:y(r.system.uptime)}),t.jsx(q,{level:W(r.cpu.usage_percent,G)}),t.jsx(q,{level:W(r.memory.usage_percent,z)}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-sm font-mono text-text-muted",children:"CPU"}),t.jsxs("span",{className:"text-base font-mono font-semibold tabular-nums",style:{color:de},children:[r.cpu.usage_percent.toFixed(0),"%"]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-sm font-mono text-text-muted",children:"MEM"}),t.jsxs("span",{className:"text-base font-mono font-semibold tabular-nums",style:{color:pe},children:[r.memory.usage_percent.toFixed(0),"%"]})]})]})}),t.jsx("div",{className:"flex-1 min-h-0 mt-2",children:t.jsx(se,{data:ie,cpuColor:de,memoryColor:pe,chartGridColors:me})}),r.cpu.per_core_percent&&r.cpu.per_core_percent.length>0&&t.jsx("div",{className:"mt-3 pt-3 border-t border-border-subtle",children:t.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 lg:grid-cols-8 gap-x-3 gap-y-0.5",children:r.cpu.per_core_percent.map((e,s)=>t.jsx(Z,{index:s,usage:e},s))})})]})}),t.jsxs(_,{template:"compact",children:[t.jsx(C,{span:12,md:6,children:t.jsxs(k,{className:"flex flex-col",children:[t.jsx(S,{icon:t.jsx(A,{}),title:"Network",largeTitle:!0,actions:t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(R,{className:"w-3.5 h-3.5",style:{color:pe}}),t.jsx("span",{className:"text-xs font-mono",style:{color:pe},children:"TX"}),t.jsx("span",{className:"px-2 py-1 bg-subtle-fill-strong rounded text-sm font-mono tabular-nums text-text-primary",children:X(ne)})]})}),t.jsxs("div",{className:"flex-1 flex flex-col min-h-[80px]",children:[t.jsx("div",{className:"flex-1 min-h-[40px]",children:t.jsx(Q,{data:V.map((e,t,s)=>{if(0===t)return 0;const a=(e.timestamp-s[t-1].timestamp)/1e3;return a>0?(e.bytesSent-s[t-1].bytesSent)/a:0}),color:pe,fixedSlots:ue})}),t.jsx("div",{className:"flex-1 min-h-[40px]",children:t.jsx(Q,{data:V.map((e,t,s)=>{if(0===t)return 0;const a=(e.timestamp-s[t-1].timestamp)/1e3;return a>0?(e.bytesRecv-s[t-1].bytesRecv)/a:0}),color:de,flipped:!0,fixedSlots:ue})})]}),t.jsxs("div",{className:"pt-2 flex justify-between items-center text-sm font-mono",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-text-muted",children:"Total"}),t.jsxs("span",{className:"px-2 py-1 bg-subtle-fill-strong rounded tabular-nums",children:[t.jsx("span",{className:"text-accent-tertiary",children:Y(r.network.bytes_sent).value})," ",t.jsx("span",{className:"text-text-muted",children:Y(r.network.bytes_sent).unit})]}),t.jsxs("span",{className:"px-2 py-1 bg-subtle-fill-strong rounded tabular-nums",children:[t.jsx("span",{className:"text-accent-primary",children:Y(r.network.bytes_recv).value})," ",t.jsx("span",{className:"text-text-muted",children:Y(r.network.bytes_recv).unit})]})]}),t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(B,{className:"w-3.5 h-3.5",style:{color:de}}),t.jsx("span",{className:"text-xs font-mono",style:{color:de},children:"RX"}),t.jsx("span",{className:"px-2 py-1 bg-subtle-fill-strong rounded tabular-nums text-text-primary",children:X(ae)})]})]})]})}),t.jsx(C,{span:12,md:6,children:t.jsxs(k,{className:"flex flex-col",children:[t.jsx(S,{icon:t.jsx(U,{}),title:"Temperature",largeTitle:!0,actions:r.temperatures&&t.jsx(q,{level:H(r.temperatures)})}),t.jsx("div",{className:"flex-1 flex flex-col justify-center min-h-0",children:r.temperatures&&Object.keys(r.temperatures).length>0?t.jsxs("div",{className:"space-y-3",children:[void 0!==r.temperatures.cpu_thermal&&t.jsx(ee,{value:r.temperatures.cpu_thermal,label:"CPU",min:20,max:100}),Object.entries(r.temperatures).filter(([e])=>"cpu_thermal"!==e).slice(0,2).map(([e,s])=>t.jsx(ee,{value:s,label:e.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()),min:20,max:100},e))]}):t.jsxs("div",{className:"flex items-center justify-center text-text-muted text-sm",children:[t.jsx(F,{className:"w-4 h-4 mr-2"}),"No sensors"]})})]})})]}),t.jsxs(_,{template:"compact",children:[t.jsx(C,{span:6,children:t.jsxs(k,{className:"flex flex-col",children:[t.jsx(S,{icon:t.jsx(F,{}),title:"Memory",largeTitle:!0,actions:t.jsxs("span",{className:"px-2 py-0.5 bg-subtle-fill-strong rounded text-base font-mono tabular-nums",style:{color:pe},children:[r.memory.usage_percent.toFixed(0),"%"]})}),t.jsxs("div",{className:"flex-1 flex flex-col justify-center min-h-0",children:[t.jsxs("div",{className:"flex gap-1 h-12",children:[t.jsx("div",{className:"h-full transition-all duration-300 bg-accent-primary",style:{width:`${r.memory.usage_percent}%`}}),t.jsx("div",{className:"h-full transition-all duration-300 bg-accent-tertiary",style:{width:100-r.memory.usage_percent+"%"}})]}),t.jsxs("div",{className:"flex items-center justify-between text-xs font-mono pt-2",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("div",{className:"w-2.5 h-2.5 rounded-sm bg-accent-primary"}),t.jsx("span",{className:"text-text-muted",children:"Used"}),t.jsxs("span",{className:"px-1.5 py-0.5 bg-subtle-fill-strong rounded tabular-nums text-text-primary",children:[(r.memory.used/1048576).toFixed(0)," MB"]})]}),t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("div",{className:"w-2.5 h-2.5 rounded-sm bg-accent-tertiary"}),t.jsx("span",{className:"text-text-muted",children:"Avail"}),t.jsxs("span",{className:"px-1.5 py-0.5 bg-subtle-fill-strong rounded tabular-nums text-text-muted",children:[(r.memory.available/1048576).toFixed(0)," MB"]})]})]})]})]})}),t.jsx(C,{span:6,children:t.jsxs(k,{className:"flex flex-col",children:[t.jsx(S,{icon:t.jsx(P,{}),title:"Disk",largeTitle:!0,actions:t.jsxs("span",{className:"px-2 py-0.5 bg-subtle-fill-strong rounded text-base font-mono tabular-nums",style:{color:de},children:[r.disk.usage_percent.toFixed(0),"%"]})}),t.jsxs("div",{className:"flex-1 flex flex-col justify-center min-h-0",children:[t.jsxs("div",{className:"flex gap-1 h-12",children:[t.jsx("div",{className:"h-full transition-all duration-300 bg-accent-primary",style:{width:`${r.disk.usage_percent}%`}}),t.jsx("div",{className:"h-full transition-all duration-300 bg-accent-tertiary",style:{width:100-r.disk.usage_percent+"%"}})]}),t.jsxs("div",{className:"flex items-center justify-between text-xs font-mono pt-2",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("div",{className:"w-2.5 h-2.5 rounded-sm bg-accent-primary"}),t.jsx("span",{className:"text-text-muted",children:"Used"}),t.jsxs("span",{className:"px-1.5 py-0.5 bg-subtle-fill-strong rounded tabular-nums text-text-primary",children:[(r.disk.used/1073741824).toFixed(1)," GB"]})]}),t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("div",{className:"w-2.5 h-2.5 rounded-sm bg-accent-tertiary"}),t.jsx("span",{className:"text-text-muted",children:"Free"}),t.jsxs("span",{className:"px-1.5 py-0.5 bg-subtle-fill-strong rounded tabular-nums text-text-muted",children:[(r.disk.free/1073741824).toFixed(1)," GB"]})]})]})]})]})})]}),l.length>0&&t.jsx(_,{template:"auto",children:t.jsx(k,{noPadding:!0,children:t.jsxs("div",{className:"px-4 py-3",children:[t.jsx(S,{icon:t.jsx(F,{}),title:"Processes",largeTitle:!0,actions:t.jsxs("button",{onClick:()=>O(!K),className:"text-xs text-text-muted hover:text-text-primary flex items-center gap-1",children:[K?"Less":"More",K?t.jsx(T,{className:"w-3 h-3"}):t.jsx(f,{className:"w-3 h-3"})]})}),t.jsxs("div",{className:"flex items-center gap-2 py-1.5 text-sm text-text-muted border-b border-border-subtle font-mono",children:[t.jsx("span",{className:"w-14",children:"PID"}),t.jsx("span",{className:"flex-1",children:"Program"}),t.jsx("span",{className:"w-[52px]"}),t.jsx("span",{className:"w-12 text-right",children:"CPU%"}),t.jsx("span",{className:"w-12 text-right",children:"MEM%"})]}),(()=>{const e=l.slice(0,K?10:5),s=Math.max(...e.map(e=>e.cpu_percent)),a=Math.max(...e.map(e=>e.memory_percent));return e.map(e=>t.jsx(J,{pid:e.pid,name:e.name,cpu:e.cpu_percent,mem:e.memory_percent,isTopCpu:e.cpu_percent===s&&s>0,isTopMem:e.memory_percent===a&&a>0},e.pid))})()]})})})]}):null]})}export{ae as default}; diff --git a/frontend/dist/assets/Terminal-Dv2-3e-b.js b/frontend/dist/assets/Terminal-Dv2-3e-b.js new file mode 100644 index 00000000..f23d75fa --- /dev/null +++ b/frontend/dist/assets/Terminal-Dv2-3e-b.js @@ -0,0 +1 @@ +import{a as e,j as t}from"./vendor-react-DCIF8YoJ.js";import{n as a}from"./recharts-DVj1EL-m.js";import{bh as r,E as s,z as n,f as o,u as i,bi as l,bj as c,bk as d,bl as p,bm as m,bn as u,bo as y}from"./index-BGs2yNOg.js";import{a as g}from"./ping-HGVILoRV.js";import{c as h}from"./vendor-core-Dl9MTgSr.js";import{P as f,d as v,h as b,k as x}from"./channel-keys-DJWRrSwE.js";import{P as w,b as _,a as S}from"./PageLayout-DIXn4UXM.js";import"./deckgl-DTsmDcfs.js";function k(){const e=new Date;return`${e.toISOString().slice(0,10)}_${e.toTimeString().slice(0,8).replace(/:/g,"-")}`}function O(e,t){return`pymc-${e.toISOString().slice(0,10)}-${e.toTimeString().slice(0,5).replace(":","")}-${t}s.json`}const $=h((e,t)=>({isCapturing:!1,captureStartTime:null,captureStartPacketHashes:new Set,captureTimer:null,reports:[],startCapture:a=>{const{captureTimer:r}=t();r&&clearTimeout(r),e({isCapturing:!0,captureStartTime:new Date,captureStartPacketHashes:new Set(a.map(e=>e.packet_hash))})},stopCapture:a=>{const{isCapturing:r,captureStartTime:s,captureStartPacketHashes:n,captureTimer:o}=t();if(!r||!s)return null;o&&clearTimeout(o);const i=new Date,l=Math.round((i.getTime()-s.getTime())/1e3),c=s.getTime()/1e3,d=a.filter(e=>!n.has(e.packet_hash)&&e.timestamp>=c).sort((e,t)=>e.timestamp-t.timestamp),p={id:k(),filename:O(s,l),startTime:s,endTime:i,durationSec:l,packetCount:d.length,packets:d,sizeBytes:500*d.length};return e(e=>({isCapturing:!1,captureStartTime:null,captureStartPacketHashes:new Set,captureTimer:null,reports:[p,...e.reports].slice(0,10)})),p},getReport:e=>t().reports.find(t=>t.id===e),_setTimer:t=>e({captureTimer:t})}));function P(e){var t;return(null==(t=e.match(/.{1,2}/g))?void 0:t.join(" ").toUpperCase())||""}function T(e){return void 0===e?"UNKNOWN":n[e]??`TYPE_${e}`}function C(e){return void 0===e?"UNKNOWN":s[e]??`ROUTE_${e}`}function E(e,t){switch(e){case 4:return function(e){const t=[];let a=0;if(e.length>=32&&(t.push({name:"public_key",offset:a,length:32,bytes:P(x(e.slice(a,a+32))),decoded:{value:x(e.slice(a,a+32))}}),a+=32),e.length>=a+4){const r=e.slice(a,a+4),s=r[0]|r[1]<<8|r[2]<<16|r[3]<<24;t.push({name:"timestamp",offset:a,length:4,bytes:P(x(r)),decoded:{value:s>>>0,iso:new Date(1e3*s).toISOString()}}),a+=4}if(e.length>=a+64&&(t.push({name:"signature",offset:a,length:64,bytes:P(x(e.slice(a,a+64))),decoded:{value:x(e.slice(a,a+64))}}),a+=64),e.length>a){const r=e[a],s=[];if(1&r&&s.push("CHAT_NODE"),2&r&&s.push("REPEATER"),3&r&&s.push("ROOM_SERVER"),16&r&&s.push("HAS_LOCATION"),128&r&&s.push("HAS_NAME"),t.push({name:"flags",offset:a,length:1,bytes:P(x(e.slice(a,a+1))),decoded:{value:r,binary:r.toString(2).padStart(8,"0"),flags:s}}),a+=1,16&r&&e.length>=a+8){const r=e.slice(a,a+8),s=new ArrayBuffer(8);new Uint8Array(s).set(r);const n=new DataView(s),o=n.getInt32(0,!0),i=n.getInt32(4,!0);t.push({name:"location",offset:a,length:8,bytes:P(x(r)),decoded:{lat_raw:o,lon_raw:i,latitude:o/1e6,longitude:i/1e6}}),a+=8}if(128&r&&e.length>a){const r=e.slice(a);let s=r.indexOf(0);-1===s&&(s=r.length);const n=(new TextDecoder).decode(r.slice(0,s));t.push({name:"name",offset:a,length:s+(0===r[s]?1:0),bytes:P(x(r.slice(0,s+1))),decoded:{value:n,encoding:"utf-8",null_terminated:0===r[s]}})}}return t}(t);case 3:return function(e){if(e.length<4)return[];const t=e.slice(0,4),a=t[0]|t[1]<<8|t[2]<<16|t[3]<<24;return[{name:"crc",offset:0,length:4,bytes:P(x(t)),decoded:{value:a>>>0,hex:(a>>>0).toString(16).toUpperCase().padStart(8,"0"),note:"CRC of the acknowledged packet (little-endian)"}}]}(t);case 9:return function(e){const t=[];if(e.length<9)return t;const a=e.slice(0,4),r=a[0]|a[1]<<8|a[2]<<16|a[3]<<24;t.push({name:"trace_tag",offset:0,length:4,bytes:P(x(a)),decoded:{value:r>>>0,hex:(r>>>0).toString(16).toUpperCase().padStart(8,"0")}});const s=e.slice(4,8),n=s[0]|s[1]<<8|s[2]<<16|s[3]<<24;if(t.push({name:"auth_code",offset:4,length:4,bytes:P(x(s)),decoded:{value:n>>>0}}),t.push({name:"flags",offset:8,length:1,bytes:P(x(e.slice(8,9))),decoded:{value:e[8],binary:e[8].toString(2).padStart(8,"0")}}),e.length>9){const a=e.slice(9),r=Array.from(a).map(e=>e.toString(16).toUpperCase().padStart(2,"0"));t.push({name:"target_path",offset:9,length:a.length,bytes:P(x(a)),decoded:{hops:r,path_string:r.join("->")}})}return t}(t);case 8:return function(e){if(0===e.length)return[];const t=Array.from(e).map(e=>e.toString(16).toUpperCase().padStart(2,"0"));return[{name:"path_hops",offset:0,length:e.length,bytes:P(x(e)),decoded:{hops:t,path_string:t.join("->")}}]}(t);case 5:return function(e){const t=[];if(e.length<1)return t;if(t.push({name:"channel_hash",offset:0,length:1,bytes:P(x(e.slice(0,1))),decoded:{value:e[0].toString(16).toUpperCase().padStart(2,"0")}}),e.length>13){const a=12,r=e.length-1-a;t.push({name:"ciphertext",offset:1,length:r,bytes:P(x(e.slice(1,1+r))),decoded:{length:r,note:"Encrypted message content"}}),t.push({name:"mac",offset:1+r,length:a,bytes:P(x(e.slice(-a))),decoded:{note:"Message authentication code"}})}return t}(t);default:return function(e){return 0===e.length?[]:[{name:"raw_data",offset:0,length:e.length,bytes:P(x(e)),decoded:{length:e.length}}]}(t)}}function N(e){const t=e.type??e.payload_type??0,a=e.route??e.route_type??0,r=e.raw_packet||"";let s,n=null;if(r){const t=f.fromHex(r);if(t.success&&t.packet){const e=t.packet;try{n=v(e)}catch{n=null}const a=b(r);let o=0;const i={offset:0,length:1,bytes:P(r.slice(0,2)),decoded:{route_type:e.routeType,route_name:e.routeTypeName,payload_type:e.payloadType,payload_name:e.payloadTypeName,version:e.payloadVersion}};o+=1,e.hasTransportCodes()&&(o+=4);const l={offset:o,length:1,bytes:P(x(a.slice(o,o+1))),decoded:{value:e.pathLen}};o+=1;const c=o,d=a.slice(o,o+e.pathLen),p=Array.from(e.path).map(e=>e.toString(16).toUpperCase().padStart(2,"0")),m=9===e.payloadType,u={offset:c,length:e.pathLen,bytes:P(x(d)),decoded:{hops:p,path_string:p.length>0?p.join("->"):"(direct)",...m&&{note:"For TRACE packets, path bytes are SNR×4 values, not node hashes",snr_values:Array.from(e.path).map(e=>{let t=e;return t>127&&(t-=256),t/4})}}};o+=e.pathLen,s={header:i,path_length:l,path:u,payload:{offset:o,length:e.payload.length,bytes:P(e.payloadHex),sections:E(e.payloadType,e.payload)}}}else s=j(e)}else s=j(e);return{timestamp:e.timestamp,packet_hash:e.packet_hash,type:t,type_name:T(t),route:a,route_name:C(a),rssi:e.rssi,snr:e.snr,length:e.length??0,src_hash:e.src_hash,dst_hash:e.dst_hash,transmitted:e.transmitted,drop_reason:e.drop_reason,is_duplicate:e.is_duplicate,lbt_attempts:e.lbt_attempts,lbt_backoff_delays_ms:e.lbt_backoff_delays_ms,lbt_channel_busy:e.lbt_channel_busy,raw_packet:r,structure:s,decoded:n}}function j(e){var t;const a=e.type??e.payload_type??0,r=e.route??e.route_type??0,s=e.original_path??e.forwarded_path??[];return{header:{offset:0,length:1,bytes:"??",decoded:{route_type:r,route_name:C(r),payload_type:a,payload_name:T(a),version:0}},path_length:{offset:1,length:1,bytes:s.length.toString(16).toUpperCase().padStart(2,"0"),decoded:{value:s.length}},path:{offset:2,length:s.length,bytes:s.join(" "),decoded:{hops:s,path_string:s.length>0?s.join("->"):"(direct)"}},payload:{offset:2+s.length,length:(null==(t=e.payload)?void 0:t.length)??0,bytes:e.payload??"",sections:e.payload?E(a,b(e.payload)):[]}}}function D(e,t){const a=function(e,t){var a;return{capture:{start:e.startTime.toISOString(),end:e.endTime.toISOString(),duration_sec:e.durationSec,packet_count:e.packetCount,node_name:(null==t?void 0:t.node_name)??"unknown",local_hash:(null==t?void 0:t.local_hash)??"unknown",pymc_console_version:r,pymc_repeater_version:(null==t?void 0:t.version)??"unknown",radio_config:(null==(a=null==t?void 0:t.config)?void 0:a.radio)?{frequency:t.config.radio.frequency,tx_power:t.config.radio.tx_power,bandwidth:t.config.radio.bandwidth,spreading_factor:t.config.radio.spreading_factor}:null},packets:e.packets.map(N)}}(e,t),s=JSON.stringify(a,null,2),n=new Blob([s],{type:"application/json"}),o=URL.createObjectURL(n),i=document.createElement("a");i.href=o,i.download=e.filename,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(o)}function R(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}const I=h(e=>({entries:[],commandHistory:[],isInitialized:!1,addEntry:t=>{const a="undefined"!=typeof crypto&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}),r={...t,id:a,timestamp:Date.now()};return e(e=>({entries:[...e.entries,r]})),a},updateEntry:(t,a)=>{e(e=>({entries:e.entries.map(e=>e.id===t?{...e,...a}:e)}))},addCommand:t=>{e(e=>({commandHistory:[...e.commandHistory,t]}))},clearEntries:()=>{e({entries:[],commandHistory:[]})},setInitialized:t=>{e({isInitialized:t})}})),G=new Set(["start ota","erase","reboot"]),A=["gps","sensor"],L=[{cmd:"help",desc:"Show available commands"},{cmd:"clear",desc:"Clear terminal screen"},{cmd:"status",desc:"Get repeater status summary"},{cmd:"uptime",desc:"Show system uptime"},{cmd:"packets",desc:"Show packet statistics"},{cmd:"board",desc:"Show board/platform info"},{cmd:"ping",desc:"Ping neighbor (name or 0xXX)",params:"{target} [timeout]",required:!0},{cmd:"convert hex",desc:"Hex → base64 (for config.yaml)",params:"{hex}",required:!0},{cmd:"convert base64",desc:"Base64 → hex",params:"{base64}",required:!0},{cmd:"cap",desc:"Show capture help"},{cmd:"start cap",desc:"Start packet capture (default 120s)",params:"[seconds]"},{cmd:"end cap",desc:"Stop current capture"},{cmd:"list cap",desc:"List capture reports (clickable download)"},{cmd:"export cap",desc:"Download a capture report",params:"{id}"},...[{name:"get adc.multiplier",category:"get",params:[],description:"Get ADC multiplier for battery",serialOnly:!1,hasParam:!1},{name:"get advert.interval",category:"get",params:[],description:"Get local advert interval (minutes)",serialOnly:!1,hasParam:!1},{name:"get af",category:"get",params:[],description:"Get airtime factor",serialOnly:!1,hasParam:!1},{name:"get agc.reset.interval",category:"get",params:[],description:"Get AGC reset interval (seconds)",serialOnly:!1,hasParam:!1},{name:"get allow.read.only",category:"get",params:[],description:"Get read-only access setting",serialOnly:!1,hasParam:!1},{name:"get bridge.baud",category:"get",params:[],description:"Get bridge baud rate",serialOnly:!1,hasParam:!1},{name:"get bridge.channel",category:"get",params:[],description:"Get bridge channel (ESP-NOW)",serialOnly:!1,hasParam:!1},{name:"get bridge.delay",category:"get",params:[],description:"Get bridge delay (ms)",serialOnly:!1,hasParam:!1},{name:"get bridge.enabled",category:"get",params:[],description:"Get bridge enabled status",serialOnly:!1,hasParam:!1},{name:"get bridge.secret",category:"get",params:[],description:"Get bridge encryption secret",serialOnly:!1,hasParam:!1},{name:"get bridge.source",category:"get",params:[],description:"Get bridge packet source",serialOnly:!1,hasParam:!1},{name:"get bridge.type",category:"get",params:[],description:"Get bridge type (rs232/espnow/none)",serialOnly:!1,hasParam:!1},{name:"get direct.txdelay",category:"get",params:[],description:"Get direct TX delay factor",serialOnly:!1,hasParam:!1},{name:"get flood.advert.interval",category:"get",params:[],description:"Get flood advert interval (hours)",serialOnly:!1,hasParam:!1},{name:"get flood.max",category:"get",params:[],description:"Get max flood hops",serialOnly:!1,hasParam:!1},{name:"get freq",category:"get",params:[],description:"Get frequency (MHz)",serialOnly:!1,hasParam:!1},{name:"get guest.password",category:"get",params:[],description:"Get guest password",serialOnly:!1,hasParam:!1},{name:"get int.thresh",category:"get",params:[],description:"Get interference threshold",serialOnly:!1,hasParam:!1},{name:"get lat",category:"get",params:[],description:"Get latitude",serialOnly:!1,hasParam:!1},{name:"get lon",category:"get",params:[],description:"Get longitude",serialOnly:!1,hasParam:!1},{name:"get multi.acks",category:"get",params:[],description:"Get multi-ack setting",serialOnly:!1,hasParam:!1},{name:"get name",category:"get",params:[],description:"Get node name",serialOnly:!1,hasParam:!1},{name:"get prv.key",category:"get",params:[],description:"Get private key (hex)",serialOnly:!1,hasParam:!1},{name:"get public.key",category:"get",params:[],description:"Get public key (hex)",serialOnly:!1,hasParam:!1},{name:"get radio",category:"get",params:[],description:"Get radio params (freq,bw,sf,cr)",serialOnly:!1,hasParam:!1},{name:"get repeat",category:"get",params:[],description:"Get repeat/forward status (on/off)",serialOnly:!1,hasParam:!1},{name:"get role",category:"get",params:[],description:"Get device role",serialOnly:!1,hasParam:!1},{name:"get rxdelay",category:"get",params:[],description:"Get RX delay base",serialOnly:!1,hasParam:!1},{name:"get tx",category:"get",params:[],description:"Get TX power (dBm)",serialOnly:!1,hasParam:!1},{name:"get txdelay",category:"get",params:[],description:"Get TX delay factor",serialOnly:!1,hasParam:!1},{name:"gps",category:"gps",params:[],description:"Show GPS status",serialOnly:!1,hasParam:!1},{name:"gps advert",category:"gps",params:[],description:"Get/set GPS advert location policy",serialOnly:!1,hasParam:!0},{name:"gps off",category:"gps",params:[],description:"Disable GPS",serialOnly:!1,hasParam:!0},{name:"gps on",category:"gps",params:[],description:"Enable GPS",serialOnly:!1,hasParam:!0},{name:"gps setloc",category:"gps",params:[],description:"Set node location from GPS",serialOnly:!1,hasParam:!0},{name:"gps sync",category:"gps",params:[],description:"Sync time from GPS",serialOnly:!1,hasParam:!0},{name:"log",category:"logging",params:[],description:"Dump log file (serial only)",serialOnly:!0,hasParam:!1},{name:"log erase",category:"logging",params:[],description:"Erase log file",serialOnly:!1,hasParam:!0},{name:"log start",category:"logging",params:[],description:"Start packet logging",serialOnly:!1,hasParam:!0},{name:"log stop",category:"logging",params:[],description:"Stop packet logging",serialOnly:!1,hasParam:!0},{name:"neighbor.remove",category:"neighbor",params:[],description:"Remove neighbor by pubkey",serialOnly:!1,hasParam:!0},{name:"neighbors",category:"neighbor",params:[],description:"List neighbors",serialOnly:!1,hasParam:!1},{name:"get",category:"other",params:[],description:"Execute get command",serialOnly:!1,hasParam:!0},{name:"set",category:"other",params:[{name:"value",type:"float"},{name:"value",type:"int"},{name:"value",type:"int"}],description:"Execute set command",serialOnly:!1,hasParam:!0},{name:"tempradio",category:"radio",params:[{name:"value",type:"int"},{name:"value",type:"int"},{name:"value",type:"int"}],description:"Apply temporary radio params (freq bw sf cr timeout_mins)",serialOnly:!1,hasParam:!0},{name:"sensor get",category:"sensor",params:[],description:"Get sensor/custom variable value",serialOnly:!1,hasParam:!0},{name:"sensor list",category:"sensor",params:[{name:"value",type:"int"}],description:"List all sensor/custom variables",serialOnly:!1,hasParam:!0},{name:"sensor set",category:"sensor",params:[],description:"Set sensor/custom variable value",serialOnly:!1,hasParam:!0},{name:"set adc.multiplier",category:"set",params:[{name:"value",type:"float"}],description:"Set ADC multiplier",serialOnly:!1,hasParam:!0},{name:"set advert.interval",category:"set",params:[{name:"value",type:"int"},{name:"value",type:"string"}],description:"Set local advert interval (1-10080 min, 0=off)",serialOnly:!1,hasParam:!0},{name:"set af",category:"set",params:[{name:"value",type:"float"},{name:"value",type:"int"},{name:"value",type:"int"},{name:"value",type:"int"}],description:"Set airtime factor (0-9)",serialOnly:!1,hasParam:!0},{name:"set agc.reset.interval",category:"set",params:[{name:"value",type:"int"},{name:"value",type:"int"},{name:"value",type:"int"}],description:"Set AGC reset interval (seconds, rounded to 4)",serialOnly:!1,hasParam:!0},{name:"set allow.read.only",category:"set",params:[{name:"value",type:"int"}],description:"Set read-only access (on/off)",serialOnly:!1,hasParam:!0},{name:"set bridge.baud",category:"set",params:[{name:"value",type:"int"},{name:"value",type:"int"}],description:"Set bridge baud (9600-115200)",serialOnly:!1,hasParam:!0},{name:"set bridge.channel",category:"set",params:[{name:"value",type:"int"},{name:"value",type:"string"}],description:"Set bridge channel (1-14)",serialOnly:!1,hasParam:!0},{name:"set bridge.delay",category:"set",params:[{name:"value",type:"int"}],description:"Set bridge delay (0-10000 ms)",serialOnly:!1,hasParam:!0},{name:"set bridge.enabled",category:"set",params:[{name:"value",type:"int"}],description:"Enable/disable bridge",serialOnly:!1,hasParam:!0},{name:"set bridge.secret",category:"set",params:[{name:"value",type:"string"},{name:"value",type:"float"}],description:"Set bridge encryption secret",serialOnly:!1,hasParam:!0},{name:"set bridge.source",category:"set",params:[{name:"value",type:"int"}],description:"Set bridge source (rx/tx)",serialOnly:!1,hasParam:!0},{name:"set direct.txdelay",category:"set",params:[{name:"value",type:"float"},{name:"value",type:"int"}],description:"Set direct TX delay factor",serialOnly:!1,hasParam:!0},{name:"set flood.advert.interval",category:"set",params:[{name:"value",type:"int"},{name:"value",type:"int"}],description:"Set flood advert interval (3-48 hours, 0=off)",serialOnly:!1,hasParam:!0},{name:"set flood.max",category:"set",params:[{name:"value",type:"int"},{name:"value",type:"float"}],description:"Set max flood hops (0-64)",serialOnly:!1,hasParam:!0},{name:"set freq",category:"set",params:[{name:"value",type:"float"},{name:"value",type:"int"}],description:"Set frequency MHz (serial only, reboot required)",serialOnly:!0,hasParam:!0},{name:"set guest.password",category:"set",params:[{name:"value",type:"string"}],description:"Set guest password",serialOnly:!1,hasParam:!0},{name:"set int.thresh",category:"set",params:[{name:"value",type:"int"},{name:"value",type:"int"},{name:"value",type:"int"}],description:"Set interference threshold",serialOnly:!1,hasParam:!0},{name:"set lat",category:"set",params:[{name:"value",type:"float"},{name:"value",type:"float"},{name:"value",type:"float"}],description:"Set latitude",serialOnly:!1,hasParam:!0},{name:"set lon",category:"set",params:[{name:"value",type:"float"},{name:"value",type:"float"},{name:"value",type:"float"}],description:"Set longitude",serialOnly:!1,hasParam:!0},{name:"set multi.acks",category:"set",params:[{name:"value",type:"int"},{name:"value",type:"int"}],description:"Set multi-ack (0/1)",serialOnly:!1,hasParam:!0},{name:"set name",category:"set",params:[{name:"value",type:"string"},{name:"value",type:"int"}],description:"Set node name",serialOnly:!1,hasParam:!0},{name:"set prv.key",category:"set",params:[{name:"value",type:"string"}],description:"Set private key (hex, restart required)",serialOnly:!1,hasParam:!0},{name:"set radio",category:"set",params:[{name:"value",type:"int"},{name:"value",type:"int"}],description:"Set radio params (freq bw sf cr)",serialOnly:!1,hasParam:!0},{name:"set repeat",category:"set",params:[{name:"value",type:"int"},{name:"value",type:"int"}],description:"Set repeat/forward (on/off)",serialOnly:!1,hasParam:!0},{name:"set rxdelay",category:"set",params:[{name:"value",type:"float"},{name:"value",type:"float"}],description:"Set RX delay base",serialOnly:!1,hasParam:!0},{name:"set tx",category:"set",params:[{name:"value",type:"int"},{name:"value",type:"float"}],description:"Set TX power (dBm)",serialOnly:!1,hasParam:!0},{name:"set txdelay",category:"set",params:[{name:"value",type:"float"},{name:"value",type:"int"}],description:"Set TX delay factor",serialOnly:!1,hasParam:!0},{name:"stats-core",category:"stats",params:[],description:"Show core statistics (serial only)",serialOnly:!0,hasParam:!1},{name:"stats-packets",category:"stats",params:[],description:"Show packet statistics (serial only)",serialOnly:!0,hasParam:!1},{name:"stats-radio",category:"stats",params:[],description:"Show radio statistics (serial only)",serialOnly:!0,hasParam:!1},{name:"advert",category:"system",params:[],description:"Send self advertisement",serialOnly:!1,hasParam:!1},{name:"board",category:"system",params:[],description:"Show board/manufacturer name",serialOnly:!1,hasParam:!1},{name:"clear stats",category:"system",params:[],description:"Reset statistics counters",serialOnly:!1,hasParam:!0},{name:"clock",category:"system",params:[{name:"value",type:"int"}],description:"Display current time",serialOnly:!1,hasParam:!0},{name:"clock sync",category:"system",params:[],description:"Sync clock from sender timestamp",serialOnly:!1,hasParam:!0},{name:"password",category:"system",params:[{name:"value",type:"string"}],description:"Change admin password",serialOnly:!1,hasParam:!0},{name:"reboot",category:"system",params:[],description:"Reboot the device",serialOnly:!1,hasParam:!1},{name:"start ota",category:"system",params:[{name:"value",type:"int"}],description:"Start OTA firmware update",serialOnly:!1,hasParam:!0},{name:"time",category:"system",params:[{name:"value",type:"int"}],description:"Set time to epoch seconds",serialOnly:!1,hasParam:!0},{name:"ver",category:"system",params:[],description:"Show firmware version and build date",serialOnly:!1,hasParam:!1}].filter(e=>!e.serialOnly&&!G.has(e.name)&&!A.some(t=>e.name.startsWith(t))).map(e=>({cmd:e.name,desc:e.description,params:e.hasParam?"{value}":void 0,required:e.hasParam}))],W={"set mode":["forward","monitor"],"set duty":["on","off"],"set repeat":["on","off"],"set tx":["10","14","17","20","22"],"set sf":["7","8","9","10","11","12"],"set bw":["125","250","500"],"set af":["0.5","1.0","1.5","2.0"],"set txdelay":["0.5","0.7","1.0","1.5"],"set direct.txdelay":["0.3","0.5","0.7"],"set log":["debug","info","warning"],"start cap":["30","60","120","300"]};function U(e){switch(e){case"success":return"text-accent-success";case"error":return"text-accent-danger";case"warning":return"text-amber-400";case"info":return"text-accent-tertiary";case"value":return"text-accent-primary";case"system":return"text-text-muted";default:return"text-text-secondary"}}const F=e.memo(function({entry:r}){const s=$(),n=o(),i=e.useCallback(e=>{const t=s.getReport(e);t?D(t,n):alert("Report no longer available. Captures are stored in session memory only.")},[s,n]);return"command"===r.type?t.jsxs("div",{className:"flex items-center gap-2 py-1",children:[t.jsx("span",{className:"text-text-muted font-medium select-none",children:"$"}),t.jsx("span",{className:"text-text-primary font-semibold",children:r.content})]}):"system"===r.type?t.jsx("div",{className:a("py-0.5",U(r.outputType||"system")),children:r.content}):r.content.includes("██")?t.jsx("pre",{className:a("terminal-ascii font-mono leading-none py-2 whitespace-pre",U(r.outputType||"value")),children:r.content}):t.jsx("div",{className:"ml-4 font-mono text-[13px] py-1",children:r.content.split("\n").map((e,a)=>{const s=function(e,t){if(e.startsWith("REC:::"))return[{text:"●",color:"text-red-500 animate-pulse",isRecording:!0},{text:` ${e.slice(6)}`,color:"text-text-muted"}];const a=e.trimStart();if(a.startsWith("DOWNLOAD:::")){const t=e.slice(0,e.length-a.length),r=a.slice(11).split(":::"),[s,n]=r;return[{text:`${t}⇓ download "${n}"`,color:"text-accent-primary underline cursor-pointer hover:text-accent-secondary",isDownload:!0,downloadId:s,downloadFilename:n}]}if(e.startsWith("HELP_HEADER:::"))return[{text:e.slice(14),color:"text-text-primary font-bold"}];if(e.startsWith("HELP_NOTE:::"))return[{text:e.slice(12),color:"text-text-muted italic"}];const r=e.match(/^([a-z][a-z0-9.]*(?:\s+[a-z][a-z0-9.]*)?):::(.+)$/);if(r){const[,e,t]=r,a=e.split(" "),s=a[0];let n="text-accent-tertiary";"get"===s?n="text-accent-success":"set"===s&&(n="text-amber-400");const o=[{text:` ${s}`,color:`${n} font-semibold`}];a.length>1&&o.push({text:` ${a.slice(1).join(" ")}`,color:"text-accent-primary"});const i=" ".repeat(Math.max(1,22-e.length));return o.push({text:`${i}${t}`,color:"text-text-muted"}),o}if("error"===t||"warning"===t)return[{text:e,color:U(t)}];if("value"===t)return[{text:e,color:U("value")}];const s=e.match(/^([\w\s.]+):\s*(.+)$/);if(s){const[,e,t]=s;return[{text:`${e}: `,color:"text-text-muted"},{text:t,color:"text-accent-primary font-semibold"}]}return e.startsWith("OK")?[{text:e,color:U("success")}]:[{text:e,color:U(t)}]}(e,r.outputType||"default");return t.jsx("div",{className:"leading-relaxed",children:s.map((e,a)=>e.isDownload?t.jsx("span",{className:e.color,onClick:()=>i(e.downloadId),role:"button",tabIndex:0,onKeyDown:t=>"Enter"===t.key&&i(e.downloadId),children:e.text},a):t.jsx("span",{className:e.color,children:e.text},a))},a)})})});function H(){const r=o(),s=i(),n=$(),h=I(e=>e.entries),f=I(e=>e.commandHistory),v=I(e=>e.isInitialized),{addEntry:b,updateEntry:x,addCommand:k,clearEntries:O,setInitialized:P}=I(),[T,C]=e.useState(""),[E,N]=e.useState(-1),[j,G]=e.useState(!1),[A,U]=e.useState([]),[H,M]=e.useState(0),[z,q]=e.useState(0),[K,B]=e.useState(!1),X=e.useRef(null),V=e.useRef(null),J=e.useRef(null),Q=e.useRef(s);e.useEffect(()=>{Q.current=s},[s]),e.useEffect(()=>{v||(async()=>{b({type:"output",content:"██████ ██ ██ ███ ███ ██████\n██ ██ ██ ██ ████ ████ ██ \n██████ ████ ██ ████ ██ ██ \n██ ██ ██ ██ ██ ██ \n██ ██ ██ ██ ██████",outputType:"value"}),await new Promise(e=>setTimeout(e,200));const e=b({type:"system",content:"● Initializing terminal...",outputType:"system"});await new Promise(e=>setTimeout(e,400)),x(e,{content:"✓ Initializing terminal...",outputType:"success"});const t=b({type:"system",content:"● Connecting to repeater...",outputType:"system"});await new Promise(e=>setTimeout(e,600)),x(t,{content:"✓ Connected to repeater",outputType:"success"}),b({type:"system",content:"Ready. Type 'help' for commands.",outputType:"system"}),P(!0)})()},[v,b,x,P]),e.useEffect(()=>{V.current&&(V.current.scrollTop=V.current.scrollHeight)},[h]);const Y=e.useCallback(()=>{var e;const t=window.getSelection();t&&t.toString().length>0||null==(e=X.current)||e.focus()},[]),Z=e.useMemo(()=>(null==r?void 0:r.neighbors)?Object.values(r.neighbors).map(e=>e.node_name||e.name).filter(e=>!!e).sort():[],[null==r?void 0:r.neighbors]),ee=e.useCallback(e=>{const t=e.trim().toLowerCase();if(!t)return G(!1),void U([]);const a=L.filter(e=>e.cmd.toLowerCase().startsWith(t));if(a.length>0)return U(a),M(0),void G(!0);if(t.includes(" ")){const e=t.lastIndexOf(" "),a=t.substring(0,e),r=t.substring(e+1);if("ping"===a&&Z.length>0){const e=Z.filter(e=>e.toLowerCase().startsWith(r)).slice(0,10).map(e=>({cmd:`ping ${e}`,desc:`→ ${e}`}));if(e.length>0)return U(e),M(0),void G(!0)}if("export cap"===a&&n.reports.length>0){const e=n.reports.map((e,t)=>({id:e.id,index:String(t+1),pkts:e.packetCount,duration:e.durationSec})).filter(e=>e.id.toLowerCase().startsWith(r)||e.index.startsWith(r)).slice(0,10).map(e=>({cmd:`export cap ${e.index}`,desc:`${e.pkts} pkts • ${e.duration}s`}));if(e.length>0)return U(e),M(0),void G(!0)}const s=L.find(e=>e.cmd.toLowerCase()===a);if(s&&W[s.cmd]){const e=W[s.cmd].filter(e=>e.toLowerCase().startsWith(r)).map(e=>({cmd:`${s.cmd} ${e}`,desc:`→ ${e}`}));if(e.length>0)return U(e),M(0),void G(!0)}}G(!1),U([])},[Z,n.reports]),te=e.useCallback(e=>{var t;const a=A[e];a&&(a.required&&a.params?(C(a.cmd+" "),ee(a.cmd+" ")):(C(a.cmd),G(!1)),null==(t=X.current)||t.focus())},[A,ee]),ae=e.useCallback(async e=>{var t,a,o,i,y,h,f,v,w;const _=e.trim();if(!_)return;const S=_.toLowerCase();if(k(_),b({type:"command",content:_}),"clear"===S)return void O();if("help"===S){const e=L.map(e=>`${e.cmd}:::${e.desc}`).join("\n");return void b({type:"output",content:`HELP_HEADER:::Available commands\n${e}\nHELP_NOTE:::Some MeshCore commands not available via HTTP.`,outputType:"default"})}const P=b({type:"output",content:"processing...",outputType:"system"});try{const e=await l();let k="",O="info";const E=e=>{const t=Math.floor(e/86400),a=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return t>0?`${t}d ${a}h ${r}m`:a>0?`${a}h ${r}m`:`${r}m`};if("status"===S){k=`Mode: ${(null==(a=null==(t=e.config)?void 0:t.repeater)?void 0:a.mode)||"unknown"} | Neighbors: ${Object.keys(e.neighbors||{}).length} | Uptime: ${E(e.uptime_seconds||0)}`}else if("uptime"===S)k=E(e.uptime_seconds||0),O="value";else if("packets"===S)k=`rx: ${e.rx_count??0}\ntx: ${e.tx_count??0}\nfwd: ${e.forwarded_count??0}\ndrop: ${e.dropped_count??0}`;else if("neighbors"===S){const t=e.neighbors||{},a=Object.entries(t);if(0===a.length)k="No neighbors discovered yet.",O="warning";else{const e=a.map(([e,t])=>{const a=t.name||t.node_name||"Unknown";return` ${e.slice(0,8)} ${a}`});k=`Neighbors (${a.length}):\n${e.join("\n")}`}}else if("board"===S)k="pyMC_Repeater (Linux/RPi)",O="value";else if(S.startsWith("get ")){const t=S.slice(4).trim(),a=null==(o=e.config)?void 0:o.delays,r=null==(i=e.config)?void 0:i.radio,s=null==(y=e.config)?void 0:y.repeater,n=null==(h=e.config)?void 0:h.duty_cycle;switch(t){case"name":k=(null==(f=e.config)?void 0:f.node_name)||"Unknown";break;case"role":k="repeater";break;case"lat":k=null!=(null==s?void 0:s.latitude)?String(s.latitude):"not set";break;case"lon":k=null!=(null==s?void 0:s.longitude)?String(s.longitude):"not set";break;case"freq":k=(null==r?void 0:r.frequency)?(r.frequency/1e6).toFixed(3):"?";break;case"tx":k=String((null==r?void 0:r.tx_power)??"?");break;case"bw":k=(null==r?void 0:r.bandwidth)?String(r.bandwidth/1e3):"?";break;case"sf":k=String((null==r?void 0:r.spreading_factor)??"?");break;case"cr":k=String((null==r?void 0:r.coding_rate)??"?");break;case"radio":k=r?`freq: ${(r.frequency/1e6).toFixed(3)} MHz\nbw: ${r.bandwidth/1e3} kHz\nsf: ${r.spreading_factor}\ncr: 4/${r.coding_rate}`:"?";break;case"af":case"txdelay":k=String((null==a?void 0:a.tx_delay_factor)??"1.0");break;case"direct.txdelay":k=String((null==a?void 0:a.direct_tx_delay_factor)??"0.5");break;case"mode":k=(null==s?void 0:s.mode)||"forward";break;case"repeat":k="forward"===(null==s?void 0:s.mode)?"on":"off";break;case"flood.max":k=String((null==s?void 0:s.max_flood_hops)??"3");break;case"flood.advert.interval":k=null!=(null==s?void 0:s.send_advert_interval_hours)?`${s.send_advert_interval_hours}h`:"?";break;case"advert.interval":k=null!=(null==s?void 0:s.advert_interval_minutes)?`${s.advert_interval_minutes}m`:"120m";break;case"rxdelay":k=String((null==a?void 0:a.rx_delay_base)??"0.0");break;case"duty":case"duty.enabled":k=(null==n?void 0:n.enforcement_enabled)?"on":"off";break;case"duty.max":k=null!=(null==n?void 0:n.max_airtime_percent)?`${n.max_airtime_percent}%`:"?";break;case"public.key":k=e.public_key||"not available";break;case"prv.key":k="Private key stored in /etc/pymc_repeater/config.yaml\n\nTo view: sudo grep identity_key /etc/pymc_repeater/config.yaml\nTo set: sudo ./convert_firmware_key.sh <64-byte-hex>",O="info";break;case"guest.password":case"allow.read.only":k="Security settings not exposed via stats API.\nCheck /etc/pymc_repeater/config.yaml",O="warning";break;default:k=`Unknown parameter: ${t}\nAvailable: name, role, lat, lon, freq, tx, bw, sf, cr, radio, af, txdelay, direct.txdelay, rxdelay, mode, repeat, flood.max, advert.interval, duty, public.key`,O="error"}"error"!==O&&(O="value")}else if("advert"===S){const e=await c();k=e.success?"OK - Advert sent":`Error: ${e.error||"Failed"}`,O=e.success?"success":"error"}else if(S.startsWith("set mode ")){const e=S.split(" ")[2];if("forward"!==e&&"monitor"!==e)k='Error: Mode must be "forward" or "monitor"',O="error";else{const t=await d(e);k=t.success?`OK - Mode set to ${e}`:"Error: Failed",O=t.success?"success":"error"}}else if(S.startsWith("set duty ")){const e=S.split(" ")[2],t="on"===e||"1"===e,a=await p(t);k=a.success?"OK - Duty cycle "+(t?"enabled":"disabled"):"Error: Failed",O=a.success?"success":"error"}else if(S.startsWith("set tx ")){const e=parseInt(S.split(" ")[2]);if(isNaN(e)||e<2||e>22)k="Error: TX power must be 2-22 dBm (SX1262 chip max)",O="error";else{const t=await m({tx_power:e});k=t.success?`OK - TX power set to ${e}dBm`:`Error: ${t.error||"Failed"}`,O=t.success?"success":"error"}}else if(S.startsWith("set af ")||S.startsWith("set txdelay ")){const e=parseFloat(S.split(" ")[2]);if(isNaN(e)||e<0||e>5)k="Error: TX delay factor must be 0.0-5.0",O="error";else{const t=await m({tx_delay_factor:e});k=t.success?`OK - TX delay set to ${e}`:`Error: ${t.error||"Failed"}`,O=t.success?"success":"error"}}else if(S.startsWith("set direct.txdelay ")){const e=parseFloat(S.split(" ")[2]);if(isNaN(e)||e<0||e>5)k="Error: Direct TX delay must be 0.0-5.0",O="error";else{const t=await m({direct_tx_delay_factor:e});k=t.success?`OK - Direct TX delay set to ${e}`:`Error: ${t.error||"Failed"}`,O=t.success?"success":"error"}}else if(S.startsWith("set log ")){const e=null==(v=S.split(" ")[2])?void 0:v.toUpperCase();if(["DEBUG","INFO","WARNING","ERROR"].includes(e)){const t=await u(e);k=t.success?`OK - Log level set to ${e}`:`Error: ${t.error||"Failed"}`,O=t.success?"success":"error"}else k="Error: Level must be debug, info, warning, or error",O="error"}else if(S.startsWith("set rxdelay ")){const e=parseFloat(S.split(" ")[2]);if(isNaN(e)||e<0)k="Error: RX delay must be >= 0",O="error";else{const t=await m({rx_delay_base:e});k=t.success?`OK - RX delay base set to ${e}s`:`Error: ${t.error||"Failed"}`,O=t.success?"success":"error"}}else if(S.startsWith("set name ")){const e=_.substring(9).trim();if(e){const t=await m({node_name:e});k=t.success?`OK - Node name set to "${e}"`:`Error: ${t.error||"Failed"}`,O=t.success?"success":"error"}else k="Error: Node name cannot be empty",O="error"}else if(S.startsWith("set lat ")){const e=parseFloat(S.split(" ")[2]);if(isNaN(e)||e<-90||e>90)k="Error: Latitude must be -90 to 90",O="error";else{const t=await m({latitude:e});k=t.success?`OK - Latitude set to ${e}°`:`Error: ${t.error||"Failed"}`,O=t.success?"success":"error"}}else if(S.startsWith("set lon ")){const e=parseFloat(S.split(" ")[2]);if(isNaN(e)||e<-180||e>180)k="Error: Longitude must be -180 to 180",O="error";else{const t=await m({longitude:e});k=t.success?`OK - Longitude set to ${e}°`:`Error: ${t.error||"Failed"}`,O=t.success?"success":"error"}}else if(S.startsWith("set flood.max ")){const e=parseInt(S.split(" ")[2]);if(isNaN(e)||e<0||e>64)k="Error: Max flood hops must be 0-64",O="error";else{const t=await m({max_flood_hops:e});k=t.success?`OK - Max flood hops set to ${e}`:`Error: ${t.error||"Failed"}`,O=t.success?"success":"error"}}else if(S.startsWith("set flood.advert.interval ")){const e=parseInt(S.split(" ")[2]);if(isNaN(e)||0!==e&&(e<3||e>48))k="Error: Flood advert interval must be 0 (off) or 3-48 hours",O="error";else{const t=await m({flood_advert_interval_hours:e});k=t.success?0===e?"OK - Flood adverts disabled":`OK - Flood advert interval set to ${e}h`:`Error: ${t.error||"Failed"}`,O=t.success?"success":"error"}}else if(S.startsWith("set advert.interval ")){const e=parseInt(S.split(" ")[2]);if(isNaN(e)||0!==e&&(e<1||e>10080))k="Error: Advert interval must be 0 (off) or 1-10080 minutes",O="error";else{const t=await m({advert_interval_minutes:e});k=t.success?0===e?"OK - Local adverts disabled":`OK - Local advert interval set to ${e}m`:`Error: ${t.error||"Failed"}`,O=t.success?"success":"error"}}else if(S.startsWith("set prv.key ")){const e=_.substring(12).trim();e?/^[0-9a-fA-F]+$/.test(e)?128!==e.length?(k=`Error: Key must be 64 bytes (128 hex chars), got ${e.length} chars`,O="error"):(k=`To set this key, run on the Pi:\n\n sudo ./convert_firmware_key.sh ${e}\n\nThen restart: sudo systemctl restart pymc-repeater`,O="info"):(k="Error: Private key must be a hex string",O="error"):(k="Error: Private key cannot be empty",O="error")}else if(S.startsWith("convert hex ")){const e=_.substring(12).trim();if(e)if(/^[0-9a-fA-F]+$/.test(e))if(e.length%2!=0)k="Error: Hex string must have even length",O="error";else try{const t=new Uint8Array(e.length/2);for(let s=0;s1&&!isNaN(r)&&r>0,n=s?t.slice(0,-1).join(" "):e,o=s?r:30;if(n){let e=1;const t=setInterval(()=>{e=e%3+1,x(P,{content:`Pinging ${n}${".".repeat(e)}`,outputType:"system"})},800);try{const e=await g(n,o);if(clearInterval(t),e.success&&e.data){const t=e.data,a=(null==(w=t.path)?void 0:w.length)?t.path.join(" → "):"direct";k=`Reply from ${t.target_id}\n RTT: ${t.rtt_ms.toFixed(1)}ms\n RSSI: ${t.rssi}dBm\n SNR: ${t.snr_db}dB\n Path: ${a}\n Quality: ${t.quality}`,O="success"}else k=e.error||"Ping failed",O="error"}catch(C){throw clearInterval(t),C}}else k="Usage: ping [timeout]",O="error"}else if("cap"===S||"cap help"===S){const e=n.isCapturing?'\nREC:::Recording in progress... use "end cap" to stop':"",t=n.reports.length;k=`HELP_HEADER:::Packet Capture\n\nstart cap:::Start capture (default: 120s)\nend cap:::Stop capture early\nlist cap:::List saved captures${t>0?` (${t} saved)`:""}\nexport cap:::Download capture by ID\n\nHELP_NOTE:::Captures stored in session memory. JSON includes decoded payloads.${e}`,O="info"}else if("start cap"===S||S.startsWith("start cap ")){const e=S.slice(10).trim(),t=e?parseInt(e):120;if(isNaN(t)||t<1||t>3600)k="Error: Duration must be 1-3600 seconds",O="error";else{if(!n.isCapturing){n.startCapture(s);let e=t;x(P,{content:`REC:::Capturing... ${e}s remaining`,outputType:"system"});const a=setInterval(()=>{e--;const t=$.getState();if(e>=0&&t.isCapturing){const a=Q.current.filter(e=>{if(!t.captureStartTime)return!1;const a=t.captureStartTime.getTime()/1e3;return e.timestamp>=a&&!t.captureStartPacketHashes.has(e.packet_hash)}).length;x(P,{content:`REC:::Capturing... ${e>0?`${e}s remaining`:"finishing..."} (${a} captured)`,outputType:"system"})}},1e3),r=setTimeout(()=>{clearInterval(a);const e=$.getState();if(e.isCapturing){const t=Q.current,a=e.stopCapture(t);b(a?{type:"output",content:`✓ Capture complete!\n Captured: ${a.packetCount} packets\n Duration: ${a.durationSec}s\n Size: ~${R(a.sizeBytes)}\n\nDOWNLOAD:::${a.id}:::${a.filename}`,outputType:"success"}:{type:"output",content:"Capture completed with no packets.",outputType:"warning"})}},1e3*t);return void n._setTimer(r)}k='Error: Capture already in progress. Use "end cap" first.',O="error"}}else if("end cap"===S)if(n.isCapturing){const e=n.stopCapture(s);e?(k=`✓ Capture complete!\n Captured: ${e.packetCount} packets\n Duration: ${e.durationSec}s\n Size: ~${R(e.sizeBytes)}\n\nDOWNLOAD:::${e.id}:::${e.filename}`,O="success"):(k="Capture stopped with no packets.",O="warning")}else k="No capture in progress.",O="warning";else if("list cap"===S){const e=n.reports;if(0===e.length)k="No capture reports available.\nStart a capture with: start cap [seconds]",O="info";else{const t=e.map((e,t)=>` ${t+1}. ${e.packetCount} pkts • ${e.durationSec}s • ~${R(e.sizeBytes)}\n DOWNLOAD:::${e.id}:::${e.filename}`);k=`Capture Reports (${e.length}):\n${t.join("\n")}`,O="info"}}else if("export cap"===S||S.startsWith("export cap ")){const e=S.slice(11).trim();if(e){const t=n.getReport(e);if(t)D(t,r),k=`✓ Downloading ${t.filename}...`,O="success";else{const t=parseInt(e)-1,a=n.reports[t];a?(D(a,r),k=`✓ Downloading ${a.filename}...`,O="success"):(k=`Error: Report "${e}" not found.\nUse "list cap" to see available reports.`,O="error")}}else{const e=n.reports;0===e.length?(k="No capture reports available.\nStart a capture with: start cap [seconds]",O="info"):(k=`Usage: export cap \n\nAvailable reports:\n${e.map((e,t)=>` ${t+1}. ${e.id}`).join("\n")}`,O="info")}}else k=`Unknown command: ${_}\nType 'help' for available commands.`,O="error";x(P,{content:k,outputType:O})}catch(E){x(P,{content:`Error: ${E instanceof Error?E.message:"Command failed"}`,outputType:"error"})}},[b,k,x,O,n,s,r]),re=e.useCallback(e=>{var t,a,r,s,n,o;if(j&&A.length>0){if("ArrowDown"===e.key){e.preventDefault();const s=Math.min(H+1,A.length-1);return M(s),void(null==(r=null==(a=null==(t=J.current)?void 0:t.children[0])?void 0:a.children[s])||r.scrollIntoView({block:"nearest"}))}if("ArrowUp"===e.key){e.preventDefault();const t=Math.max(H-1,0);return M(t),void(null==(o=null==(n=null==(s=J.current)?void 0:s.children[0])?void 0:n.children[t])||o.scrollIntoView({block:"nearest"}))}if("Tab"===e.key)return e.preventDefault(),void te(H);if("Escape"===e.key)return e.preventDefault(),void G(!1)}if("Enter"===e.key){if(e.preventDefault(),j&&A.length>0){const e=A[H].cmd;return C(""),N(-1),G(!1),void ae(e)}const t=T;return C(""),N(-1),G(!1),void ae(t)}if("ArrowUp"!==e.key||j)if("ArrowDown"!==e.key||j);else if(e.preventDefault(),E>0){const e=E-1;N(e),C(f[f.length-1-e]||"")}else 0===E&&(N(-1),C(""));else if(e.preventDefault(),f.length>0&&E{C(e.target.value),q(e.target.selectionStart||e.target.value.length),ee(e.target.value)},[ee]),ne=e.useCallback(e=>{const t=e.target;q(t.selectionStart||0)},[]);return t.jsxs(w,{children:[t.jsx(_,{title:"Terminal",icon:t.jsx(y,{})}),t.jsxs(S,{noPadding:!0,className:"terminal-card overflow-hidden flex flex-col isolate",onClick:Y,children:[t.jsx("div",{ref:V,className:"flex-1 overflow-y-auto font-mono text-sm p-3 sm:p-4 md:p-5",style:{background:"var(--terminal-bg)"},children:h.map(e=>t.jsx(F,{entry:e},e.id))}),t.jsxs("div",{className:"relative",style:{borderTop:"1px solid var(--terminal-border)",background:"var(--terminal-bg-input)"},children:[t.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 px-3 sm:px-4 py-2 sm:py-3",children:[t.jsx("span",{className:"text-text-muted font-mono font-bold select-none",children:"$"}),t.jsxs("div",{className:"flex-1 relative font-mono text-sm",children:[t.jsx("input",{ref:X,type:"text",value:T,onChange:se,onKeyDown:re,onSelect:ne,onFocus:()=>B(!0),onBlur:()=>B(!1),disabled:!v,className:"absolute inset-0 w-full bg-transparent text-transparent outline-none disabled:opacity-50 selection:bg-transparent",style:{caretColor:"transparent"},autoFocus:!0,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1}),t.jsx("div",{className:"relative pointer-events-none select-none","aria-hidden":!0,children:v?t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"text-text-primary",children:T.slice(0,z)}),t.jsx("span",{className:a("inline-block w-[0.6em] h-[1.2em] align-text-bottom",K?"bg-accent-primary":"bg-text-muted/30"),style:{marginBottom:"-0.1em"},children:t.jsx("span",{className:"text-bg-primary",children:T[z]||""})}),t.jsx("span",{className:"text-text-primary",children:T.slice(z+1)})]}):t.jsx("span",{className:"text-text-muted",children:"Connecting..."})})]})]}),t.jsxs("div",{className:"px-3 sm:px-4 py-1 flex justify-between text-[10px] text-text-muted",style:{borderTop:"1px solid var(--terminal-border)",background:"var(--terminal-bg-status)"},children:[t.jsx("span",{className:"hidden sm:inline",children:"↑↓ History"}),t.jsx("span",{className:"sm:hidden",children:"Terminal"}),(null==r?void 0:r.version)&&t.jsxs("span",{children:["pyMC v",r.version]})]})]}),j&&A.length>0&&t.jsxs("div",{ref:J,className:"absolute left-2 right-2 bottom-[72px] rounded-xl shadow-2xl overflow-hidden z-50 backdrop-blur-xl",style:{border:"1px solid var(--terminal-autocomplete-border)",background:"var(--terminal-autocomplete-bg)"},children:[t.jsx("div",{className:"max-h-64 overflow-y-auto",children:A.map((e,r)=>t.jsxs("div",{onClick:()=>te(r),className:a("px-4 py-2.5 cursor-pointer last:border-b-0 transition-colors",r===H?"bg-accent-primary/25":""),style:{borderBottom:"1px solid var(--terminal-border)",...r!==H?{"--tw-bg-opacity":0}:{}},onMouseEnter:e=>{r!==H&&(e.currentTarget.style.background="var(--terminal-autocomplete-hover)")},onMouseLeave:e=>{r!==H&&(e.currentTarget.style.background="transparent")},children:[t.jsx("span",{className:a("font-mono text-sm",r===H?"text-accent-primary":"text-text-primary"),children:e.cmd}),t.jsx("span",{className:"text-xs text-text-muted ml-4",children:e.desc})]},e.cmd))}),t.jsx("div",{className:"px-3 py-1.5 text-[10px] text-text-muted text-right",style:{borderTop:"1px solid var(--terminal-border)",background:"var(--terminal-autocomplete-hover)"},children:"Tab to select"})]})]})]})}export{H as default}; diff --git a/frontend/dist/assets/Terminal-jVZnyeIH.js b/frontend/dist/assets/Terminal-jVZnyeIH.js deleted file mode 100644 index abebb669..00000000 --- a/frontend/dist/assets/Terminal-jVZnyeIH.js +++ /dev/null @@ -1 +0,0 @@ -import{i as e,r as t,j as a,S as r}from"./vendor-react-C341c8YC.js";import{n as s}from"./recharts-6XUQYgRA.js";import{ay as n,R as o,x as i,e as l,u as c,az as d,aA as p,aB as m,aC as u,aD as y,aE as g}from"./index-BJEgt3tp.js";import{a as h}from"./ping-DvLgBqTv.js";import{P as f,d as v,h as b,k as x}from"./channel-keys-DJWRrSwE.js";import{P as w,b as _,a as S}from"./PageLayout-CnF5SScd.js";import"./vendor-core-WoOfkQwm.js";import"./deckgl-DTsmDcfs.js";function k(){const e=new Date;return`${e.toISOString().slice(0,10)}_${e.toTimeString().slice(0,8).replace(/:/g,"-")}`}function O(e,t){return`pymc-${e.toISOString().slice(0,10)}-${e.toTimeString().slice(0,5).replace(":","")}-${t}s.json`}const $=e((e,t)=>({isCapturing:!1,captureStartTime:null,captureStartPacketHashes:new Set,captureTimer:null,reports:[],startCapture:a=>{const{captureTimer:r}=t();r&&clearTimeout(r),e({isCapturing:!0,captureStartTime:new Date,captureStartPacketHashes:new Set(a.map(e=>e.packet_hash))})},stopCapture:a=>{const{isCapturing:r,captureStartTime:s,captureStartPacketHashes:n,captureTimer:o}=t();if(!r||!s)return null;o&&clearTimeout(o);const i=new Date,l=Math.round((i.getTime()-s.getTime())/1e3),c=s.getTime()/1e3,d=a.filter(e=>!n.has(e.packet_hash)&&e.timestamp>=c).sort((e,t)=>e.timestamp-t.timestamp),p={id:k(),filename:O(s,l),startTime:s,endTime:i,durationSec:l,packetCount:d.length,packets:d,sizeBytes:500*d.length};return e(e=>({isCapturing:!1,captureStartTime:null,captureStartPacketHashes:new Set,captureTimer:null,reports:[p,...e.reports].slice(0,10)})),p},getReport:e=>t().reports.find(t=>t.id===e),_setTimer:t=>e({captureTimer:t})}));function P(e){var t;return(null==(t=e.match(/.{1,2}/g))?void 0:t.join(" ").toUpperCase())||""}function T(e){return void 0===e?"UNKNOWN":i[e]??`TYPE_${e}`}function C(e){return void 0===e?"UNKNOWN":o[e]??`ROUTE_${e}`}function E(e,t){switch(e){case 4:return function(e){const t=[];let a=0;if(e.length>=32&&(t.push({name:"public_key",offset:a,length:32,bytes:P(x(e.slice(a,a+32))),decoded:{value:x(e.slice(a,a+32))}}),a+=32),e.length>=a+4){const r=e.slice(a,a+4),s=r[0]|r[1]<<8|r[2]<<16|r[3]<<24;t.push({name:"timestamp",offset:a,length:4,bytes:P(x(r)),decoded:{value:s>>>0,iso:new Date(1e3*s).toISOString()}}),a+=4}if(e.length>=a+64&&(t.push({name:"signature",offset:a,length:64,bytes:P(x(e.slice(a,a+64))),decoded:{value:x(e.slice(a,a+64))}}),a+=64),e.length>a){const r=e[a],s=[];if(1&r&&s.push("CHAT_NODE"),2&r&&s.push("REPEATER"),3&r&&s.push("ROOM_SERVER"),16&r&&s.push("HAS_LOCATION"),128&r&&s.push("HAS_NAME"),t.push({name:"flags",offset:a,length:1,bytes:P(x(e.slice(a,a+1))),decoded:{value:r,binary:r.toString(2).padStart(8,"0"),flags:s}}),a+=1,16&r&&e.length>=a+8){const r=e.slice(a,a+8),s=new ArrayBuffer(8);new Uint8Array(s).set(r);const n=new DataView(s),o=n.getInt32(0,!0),i=n.getInt32(4,!0);t.push({name:"location",offset:a,length:8,bytes:P(x(r)),decoded:{lat_raw:o,lon_raw:i,latitude:o/1e6,longitude:i/1e6}}),a+=8}if(128&r&&e.length>a){const r=e.slice(a);let s=r.indexOf(0);-1===s&&(s=r.length);const n=(new TextDecoder).decode(r.slice(0,s));t.push({name:"name",offset:a,length:s+(0===r[s]?1:0),bytes:P(x(r.slice(0,s+1))),decoded:{value:n,encoding:"utf-8",null_terminated:0===r[s]}})}}return t}(t);case 3:return function(e){if(e.length<4)return[];const t=e.slice(0,4),a=t[0]|t[1]<<8|t[2]<<16|t[3]<<24;return[{name:"crc",offset:0,length:4,bytes:P(x(t)),decoded:{value:a>>>0,hex:(a>>>0).toString(16).toUpperCase().padStart(8,"0"),note:"CRC of the acknowledged packet (little-endian)"}}]}(t);case 9:return function(e){const t=[];if(e.length<9)return t;const a=e.slice(0,4),r=a[0]|a[1]<<8|a[2]<<16|a[3]<<24;t.push({name:"trace_tag",offset:0,length:4,bytes:P(x(a)),decoded:{value:r>>>0,hex:(r>>>0).toString(16).toUpperCase().padStart(8,"0")}});const s=e.slice(4,8),n=s[0]|s[1]<<8|s[2]<<16|s[3]<<24;if(t.push({name:"auth_code",offset:4,length:4,bytes:P(x(s)),decoded:{value:n>>>0}}),t.push({name:"flags",offset:8,length:1,bytes:P(x(e.slice(8,9))),decoded:{value:e[8],binary:e[8].toString(2).padStart(8,"0")}}),e.length>9){const a=e.slice(9),r=Array.from(a).map(e=>e.toString(16).toUpperCase().padStart(2,"0"));t.push({name:"target_path",offset:9,length:a.length,bytes:P(x(a)),decoded:{hops:r,path_string:r.join("->")}})}return t}(t);case 8:return function(e){if(0===e.length)return[];const t=Array.from(e).map(e=>e.toString(16).toUpperCase().padStart(2,"0"));return[{name:"path_hops",offset:0,length:e.length,bytes:P(x(e)),decoded:{hops:t,path_string:t.join("->")}}]}(t);case 5:return function(e){const t=[];if(e.length<1)return t;if(t.push({name:"channel_hash",offset:0,length:1,bytes:P(x(e.slice(0,1))),decoded:{value:e[0].toString(16).toUpperCase().padStart(2,"0")}}),e.length>13){const a=12,r=e.length-1-a;t.push({name:"ciphertext",offset:1,length:r,bytes:P(x(e.slice(1,1+r))),decoded:{length:r,note:"Encrypted message content"}}),t.push({name:"mac",offset:1+r,length:a,bytes:P(x(e.slice(-a))),decoded:{note:"Message authentication code"}})}return t}(t);default:return function(e){return 0===e.length?[]:[{name:"raw_data",offset:0,length:e.length,bytes:P(x(e)),decoded:{length:e.length}}]}(t)}}function N(e){const t=e.type??e.payload_type??0,a=e.route??e.route_type??0,r=e.raw_packet||"";let s,n=null;if(r){const t=f.fromHex(r);if(t.success&&t.packet){const e=t.packet;try{n=v(e)}catch{n=null}const a=b(r);let o=0;const i={offset:0,length:1,bytes:P(r.slice(0,2)),decoded:{route_type:e.routeType,route_name:e.routeTypeName,payload_type:e.payloadType,payload_name:e.payloadTypeName,version:e.payloadVersion}};o+=1,e.hasTransportCodes()&&(o+=4);const l={offset:o,length:1,bytes:P(x(a.slice(o,o+1))),decoded:{value:e.pathLen}};o+=1;const c=o,d=a.slice(o,o+e.pathLen),p=Array.from(e.path).map(e=>e.toString(16).toUpperCase().padStart(2,"0")),m=9===e.payloadType,u={offset:c,length:e.pathLen,bytes:P(x(d)),decoded:{hops:p,path_string:p.length>0?p.join("->"):"(direct)",...m&&{note:"For TRACE packets, path bytes are SNR×4 values, not node hashes",snr_values:Array.from(e.path).map(e=>{let t=e;return t>127&&(t-=256),t/4})}}};o+=e.pathLen,s={header:i,path_length:l,path:u,payload:{offset:o,length:e.payload.length,bytes:P(e.payloadHex),sections:E(e.payloadType,e.payload)}}}else s=j(e)}else s=j(e);return{timestamp:e.timestamp,packet_hash:e.packet_hash,type:t,type_name:T(t),route:a,route_name:C(a),rssi:e.rssi,snr:e.snr,length:e.length??0,src_hash:e.src_hash,dst_hash:e.dst_hash,transmitted:e.transmitted,drop_reason:e.drop_reason,is_duplicate:e.is_duplicate,lbt_attempts:e.lbt_attempts,lbt_backoff_delays_ms:e.lbt_backoff_delays_ms,lbt_channel_busy:e.lbt_channel_busy,raw_packet:r,structure:s,decoded:n}}function j(e){var t;const a=e.type??e.payload_type??0,r=e.route??e.route_type??0,s=e.original_path??e.forwarded_path??[];return{header:{offset:0,length:1,bytes:"??",decoded:{route_type:r,route_name:C(r),payload_type:a,payload_name:T(a),version:0}},path_length:{offset:1,length:1,bytes:s.length.toString(16).toUpperCase().padStart(2,"0"),decoded:{value:s.length}},path:{offset:2,length:s.length,bytes:s.join(" "),decoded:{hops:s,path_string:s.length>0?s.join("->"):"(direct)"}},payload:{offset:2+s.length,length:(null==(t=e.payload)?void 0:t.length)??0,bytes:e.payload??"",sections:e.payload?E(a,b(e.payload)):[]}}}function D(e,t){const a=function(e,t){var a;return{capture:{start:e.startTime.toISOString(),end:e.endTime.toISOString(),duration_sec:e.durationSec,packet_count:e.packetCount,node_name:(null==t?void 0:t.node_name)??"unknown",local_hash:(null==t?void 0:t.local_hash)??"unknown",pymc_console_version:n,pymc_repeater_version:(null==t?void 0:t.version)??"unknown",radio_config:(null==(a=null==t?void 0:t.config)?void 0:a.radio)?{frequency:t.config.radio.frequency,tx_power:t.config.radio.tx_power,bandwidth:t.config.radio.bandwidth,spreading_factor:t.config.radio.spreading_factor}:null},packets:e.packets.map(N)}}(e,t),r=JSON.stringify(a,null,2),s=new Blob([r],{type:"application/json"}),o=URL.createObjectURL(s),i=document.createElement("a");i.href=o,i.download=e.filename,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(o)}function R(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}const I=e(e=>({entries:[],commandHistory:[],isInitialized:!1,addEntry:t=>{const a="undefined"!=typeof crypto&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}),r={...t,id:a,timestamp:Date.now()};return e(e=>({entries:[...e.entries,r]})),a},updateEntry:(t,a)=>{e(e=>({entries:e.entries.map(e=>e.id===t?{...e,...a}:e)}))},addCommand:t=>{e(e=>({commandHistory:[...e.commandHistory,t]}))},clearEntries:()=>{e({entries:[],commandHistory:[]})},setInitialized:t=>{e({isInitialized:t})}})),A=new Set(["start ota","erase","reboot"]),G=["gps","sensor"],L=[{cmd:"help",desc:"Show available commands"},{cmd:"clear",desc:"Clear terminal screen"},{cmd:"status",desc:"Get repeater status summary"},{cmd:"uptime",desc:"Show system uptime"},{cmd:"packets",desc:"Show packet statistics"},{cmd:"board",desc:"Show board/platform info"},{cmd:"ping",desc:"Ping neighbor (name or 0xXX)",params:"{target} [timeout]",required:!0},{cmd:"convert hex",desc:"Hex → base64 (for config.yaml)",params:"{hex}",required:!0},{cmd:"convert base64",desc:"Base64 → hex",params:"{base64}",required:!0},{cmd:"cap",desc:"Show capture help"},{cmd:"start cap",desc:"Start packet capture (default 120s)",params:"[seconds]"},{cmd:"end cap",desc:"Stop current capture"},{cmd:"list cap",desc:"List capture reports (clickable download)"},{cmd:"export cap",desc:"Download a capture report",params:"{id}"},...[{name:"get adc.multiplier",category:"get",params:[],description:"Get ADC multiplier for battery",serialOnly:!1,hasParam:!1},{name:"get advert.interval",category:"get",params:[],description:"Get local advert interval (minutes)",serialOnly:!1,hasParam:!1},{name:"get af",category:"get",params:[],description:"Get airtime factor",serialOnly:!1,hasParam:!1},{name:"get agc.reset.interval",category:"get",params:[],description:"Get AGC reset interval (seconds)",serialOnly:!1,hasParam:!1},{name:"get allow.read.only",category:"get",params:[],description:"Get read-only access setting",serialOnly:!1,hasParam:!1},{name:"get bridge.baud",category:"get",params:[],description:"Get bridge baud rate",serialOnly:!1,hasParam:!1},{name:"get bridge.channel",category:"get",params:[],description:"Get bridge channel (ESP-NOW)",serialOnly:!1,hasParam:!1},{name:"get bridge.delay",category:"get",params:[],description:"Get bridge delay (ms)",serialOnly:!1,hasParam:!1},{name:"get bridge.enabled",category:"get",params:[],description:"Get bridge enabled status",serialOnly:!1,hasParam:!1},{name:"get bridge.secret",category:"get",params:[],description:"Get bridge encryption secret",serialOnly:!1,hasParam:!1},{name:"get bridge.source",category:"get",params:[],description:"Get bridge packet source",serialOnly:!1,hasParam:!1},{name:"get bridge.type",category:"get",params:[],description:"Get bridge type (rs232/espnow/none)",serialOnly:!1,hasParam:!1},{name:"get direct.txdelay",category:"get",params:[],description:"Get direct TX delay factor",serialOnly:!1,hasParam:!1},{name:"get flood.advert.interval",category:"get",params:[],description:"Get flood advert interval (hours)",serialOnly:!1,hasParam:!1},{name:"get flood.max",category:"get",params:[],description:"Get max flood hops",serialOnly:!1,hasParam:!1},{name:"get freq",category:"get",params:[],description:"Get frequency (MHz)",serialOnly:!1,hasParam:!1},{name:"get guest.password",category:"get",params:[],description:"Get guest password",serialOnly:!1,hasParam:!1},{name:"get int.thresh",category:"get",params:[],description:"Get interference threshold",serialOnly:!1,hasParam:!1},{name:"get lat",category:"get",params:[],description:"Get latitude",serialOnly:!1,hasParam:!1},{name:"get lon",category:"get",params:[],description:"Get longitude",serialOnly:!1,hasParam:!1},{name:"get multi.acks",category:"get",params:[],description:"Get multi-ack setting",serialOnly:!1,hasParam:!1},{name:"get name",category:"get",params:[],description:"Get node name",serialOnly:!1,hasParam:!1},{name:"get prv.key",category:"get",params:[],description:"Get private key (hex)",serialOnly:!1,hasParam:!1},{name:"get public.key",category:"get",params:[],description:"Get public key (hex)",serialOnly:!1,hasParam:!1},{name:"get radio",category:"get",params:[],description:"Get radio params (freq,bw,sf,cr)",serialOnly:!1,hasParam:!1},{name:"get repeat",category:"get",params:[],description:"Get repeat/forward status (on/off)",serialOnly:!1,hasParam:!1},{name:"get role",category:"get",params:[],description:"Get device role",serialOnly:!1,hasParam:!1},{name:"get rxdelay",category:"get",params:[],description:"Get RX delay base",serialOnly:!1,hasParam:!1},{name:"get tx",category:"get",params:[],description:"Get TX power (dBm)",serialOnly:!1,hasParam:!1},{name:"get txdelay",category:"get",params:[],description:"Get TX delay factor",serialOnly:!1,hasParam:!1},{name:"gps",category:"gps",params:[],description:"Show GPS status",serialOnly:!1,hasParam:!1},{name:"gps advert",category:"gps",params:[],description:"Get/set GPS advert location policy",serialOnly:!1,hasParam:!0},{name:"gps off",category:"gps",params:[],description:"Disable GPS",serialOnly:!1,hasParam:!0},{name:"gps on",category:"gps",params:[],description:"Enable GPS",serialOnly:!1,hasParam:!0},{name:"gps setloc",category:"gps",params:[],description:"Set node location from GPS",serialOnly:!1,hasParam:!0},{name:"gps sync",category:"gps",params:[],description:"Sync time from GPS",serialOnly:!1,hasParam:!0},{name:"log",category:"logging",params:[],description:"Dump log file (serial only)",serialOnly:!0,hasParam:!1},{name:"log erase",category:"logging",params:[],description:"Erase log file",serialOnly:!1,hasParam:!0},{name:"log start",category:"logging",params:[],description:"Start packet logging",serialOnly:!1,hasParam:!0},{name:"log stop",category:"logging",params:[],description:"Stop packet logging",serialOnly:!1,hasParam:!0},{name:"neighbor.remove",category:"neighbor",params:[],description:"Remove neighbor by pubkey",serialOnly:!1,hasParam:!0},{name:"neighbors",category:"neighbor",params:[],description:"List neighbors",serialOnly:!1,hasParam:!1},{name:"get",category:"other",params:[],description:"Execute get command",serialOnly:!1,hasParam:!0},{name:"set",category:"other",params:[{name:"value",type:"float"},{name:"value",type:"int"},{name:"value",type:"int"}],description:"Execute set command",serialOnly:!1,hasParam:!0},{name:"tempradio",category:"radio",params:[{name:"value",type:"int"},{name:"value",type:"int"},{name:"value",type:"int"}],description:"Apply temporary radio params (freq bw sf cr timeout_mins)",serialOnly:!1,hasParam:!0},{name:"sensor get",category:"sensor",params:[],description:"Get sensor/custom variable value",serialOnly:!1,hasParam:!0},{name:"sensor list",category:"sensor",params:[{name:"value",type:"int"}],description:"List all sensor/custom variables",serialOnly:!1,hasParam:!0},{name:"sensor set",category:"sensor",params:[],description:"Set sensor/custom variable value",serialOnly:!1,hasParam:!0},{name:"set adc.multiplier",category:"set",params:[{name:"value",type:"float"}],description:"Set ADC multiplier",serialOnly:!1,hasParam:!0},{name:"set advert.interval",category:"set",params:[{name:"value",type:"int"},{name:"value",type:"string"}],description:"Set local advert interval (1-10080 min, 0=off)",serialOnly:!1,hasParam:!0},{name:"set af",category:"set",params:[{name:"value",type:"float"},{name:"value",type:"int"},{name:"value",type:"int"},{name:"value",type:"int"}],description:"Set airtime factor (0-9)",serialOnly:!1,hasParam:!0},{name:"set agc.reset.interval",category:"set",params:[{name:"value",type:"int"},{name:"value",type:"int"},{name:"value",type:"int"}],description:"Set AGC reset interval (seconds, rounded to 4)",serialOnly:!1,hasParam:!0},{name:"set allow.read.only",category:"set",params:[{name:"value",type:"int"}],description:"Set read-only access (on/off)",serialOnly:!1,hasParam:!0},{name:"set bridge.baud",category:"set",params:[{name:"value",type:"int"},{name:"value",type:"int"}],description:"Set bridge baud (9600-115200)",serialOnly:!1,hasParam:!0},{name:"set bridge.channel",category:"set",params:[{name:"value",type:"int"},{name:"value",type:"string"}],description:"Set bridge channel (1-14)",serialOnly:!1,hasParam:!0},{name:"set bridge.delay",category:"set",params:[{name:"value",type:"int"}],description:"Set bridge delay (0-10000 ms)",serialOnly:!1,hasParam:!0},{name:"set bridge.enabled",category:"set",params:[{name:"value",type:"int"}],description:"Enable/disable bridge",serialOnly:!1,hasParam:!0},{name:"set bridge.secret",category:"set",params:[{name:"value",type:"string"},{name:"value",type:"float"}],description:"Set bridge encryption secret",serialOnly:!1,hasParam:!0},{name:"set bridge.source",category:"set",params:[{name:"value",type:"int"}],description:"Set bridge source (rx/tx)",serialOnly:!1,hasParam:!0},{name:"set direct.txdelay",category:"set",params:[{name:"value",type:"float"},{name:"value",type:"int"}],description:"Set direct TX delay factor",serialOnly:!1,hasParam:!0},{name:"set flood.advert.interval",category:"set",params:[{name:"value",type:"int"},{name:"value",type:"int"}],description:"Set flood advert interval (3-48 hours, 0=off)",serialOnly:!1,hasParam:!0},{name:"set flood.max",category:"set",params:[{name:"value",type:"int"},{name:"value",type:"float"}],description:"Set max flood hops (0-64)",serialOnly:!1,hasParam:!0},{name:"set freq",category:"set",params:[{name:"value",type:"float"},{name:"value",type:"int"}],description:"Set frequency MHz (serial only, reboot required)",serialOnly:!0,hasParam:!0},{name:"set guest.password",category:"set",params:[{name:"value",type:"string"}],description:"Set guest password",serialOnly:!1,hasParam:!0},{name:"set int.thresh",category:"set",params:[{name:"value",type:"int"},{name:"value",type:"int"},{name:"value",type:"int"}],description:"Set interference threshold",serialOnly:!1,hasParam:!0},{name:"set lat",category:"set",params:[{name:"value",type:"float"},{name:"value",type:"float"},{name:"value",type:"float"}],description:"Set latitude",serialOnly:!1,hasParam:!0},{name:"set lon",category:"set",params:[{name:"value",type:"float"},{name:"value",type:"float"},{name:"value",type:"float"}],description:"Set longitude",serialOnly:!1,hasParam:!0},{name:"set multi.acks",category:"set",params:[{name:"value",type:"int"},{name:"value",type:"int"}],description:"Set multi-ack (0/1)",serialOnly:!1,hasParam:!0},{name:"set name",category:"set",params:[{name:"value",type:"string"},{name:"value",type:"int"}],description:"Set node name",serialOnly:!1,hasParam:!0},{name:"set prv.key",category:"set",params:[{name:"value",type:"string"}],description:"Set private key (hex, restart required)",serialOnly:!1,hasParam:!0},{name:"set radio",category:"set",params:[{name:"value",type:"int"},{name:"value",type:"int"}],description:"Set radio params (freq bw sf cr)",serialOnly:!1,hasParam:!0},{name:"set repeat",category:"set",params:[{name:"value",type:"int"},{name:"value",type:"int"}],description:"Set repeat/forward (on/off)",serialOnly:!1,hasParam:!0},{name:"set rxdelay",category:"set",params:[{name:"value",type:"float"},{name:"value",type:"float"}],description:"Set RX delay base",serialOnly:!1,hasParam:!0},{name:"set tx",category:"set",params:[{name:"value",type:"int"},{name:"value",type:"float"}],description:"Set TX power (dBm)",serialOnly:!1,hasParam:!0},{name:"set txdelay",category:"set",params:[{name:"value",type:"float"},{name:"value",type:"int"}],description:"Set TX delay factor",serialOnly:!1,hasParam:!0},{name:"stats-core",category:"stats",params:[],description:"Show core statistics (serial only)",serialOnly:!0,hasParam:!1},{name:"stats-packets",category:"stats",params:[],description:"Show packet statistics (serial only)",serialOnly:!0,hasParam:!1},{name:"stats-radio",category:"stats",params:[],description:"Show radio statistics (serial only)",serialOnly:!0,hasParam:!1},{name:"advert",category:"system",params:[],description:"Send self advertisement",serialOnly:!1,hasParam:!1},{name:"board",category:"system",params:[],description:"Show board/manufacturer name",serialOnly:!1,hasParam:!1},{name:"clear stats",category:"system",params:[],description:"Reset statistics counters",serialOnly:!1,hasParam:!0},{name:"clock",category:"system",params:[{name:"value",type:"int"}],description:"Display current time",serialOnly:!1,hasParam:!0},{name:"clock sync",category:"system",params:[],description:"Sync clock from sender timestamp",serialOnly:!1,hasParam:!0},{name:"password",category:"system",params:[{name:"value",type:"string"}],description:"Change admin password",serialOnly:!1,hasParam:!0},{name:"reboot",category:"system",params:[],description:"Reboot the device",serialOnly:!1,hasParam:!1},{name:"start ota",category:"system",params:[{name:"value",type:"int"}],description:"Start OTA firmware update",serialOnly:!1,hasParam:!0},{name:"time",category:"system",params:[{name:"value",type:"int"}],description:"Set time to epoch seconds",serialOnly:!1,hasParam:!0},{name:"ver",category:"system",params:[],description:"Show firmware version and build date",serialOnly:!1,hasParam:!1}].filter(e=>!e.serialOnly&&!A.has(e.name)&&!G.some(t=>e.name.startsWith(t))).map(e=>({cmd:e.name,desc:e.description,params:e.hasParam?"{value}":void 0,required:e.hasParam}))],W={"set mode":["forward","monitor"],"set duty":["on","off"],"set repeat":["on","off"],"set tx":["10","14","17","20","22"],"set sf":["7","8","9","10","11","12"],"set bw":["125","250","500"],"set af":["0.5","1.0","1.5","2.0"],"set txdelay":["0.5","0.7","1.0","1.5"],"set direct.txdelay":["0.3","0.5","0.7"],"set log":["debug","info","warning"],"start cap":["30","60","120","300"]};function U(e){switch(e){case"success":return"text-accent-success";case"error":return"text-accent-danger";case"warning":return"text-amber-400";case"info":return"text-accent-tertiary";case"value":return"text-accent-primary";case"system":return"text-text-muted";default:return"text-text-secondary"}}const F=t.memo(function({entry:e}){const r=$(),n=l(),o=t.useCallback(e=>{const t=r.getReport(e);t?D(t,n):alert("Report no longer available. Captures are stored in session memory only.")},[r,n]);return"command"===e.type?a.jsxs("div",{className:"flex items-center gap-2 py-1",children:[a.jsx("span",{className:"text-text-muted font-medium select-none",children:"$"}),a.jsx("span",{className:"text-text-primary font-semibold",children:e.content})]}):"system"===e.type?a.jsx("div",{className:s("py-0.5",U(e.outputType||"system")),children:e.content}):e.content.includes("██")?a.jsx("pre",{className:s("terminal-ascii font-mono leading-none py-2 whitespace-pre",U(e.outputType||"value")),children:e.content}):a.jsx("div",{className:"ml-4 font-mono text-[13px] py-1",children:e.content.split("\n").map((t,r)=>{const s=function(e,t){if(e.startsWith("REC:::"))return[{text:"●",color:"text-red-500 animate-pulse",isRecording:!0},{text:` ${e.slice(6)}`,color:"text-text-muted"}];const a=e.trimStart();if(a.startsWith("DOWNLOAD:::")){const t=e.slice(0,e.length-a.length),r=a.slice(11).split(":::"),[s,n]=r;return[{text:`${t}⇓ download "${n}"`,color:"text-accent-primary underline cursor-pointer hover:text-accent-secondary",isDownload:!0,downloadId:s,downloadFilename:n}]}if(e.startsWith("HELP_HEADER:::"))return[{text:e.slice(14),color:"text-text-primary font-bold"}];if(e.startsWith("HELP_NOTE:::"))return[{text:e.slice(12),color:"text-text-muted italic"}];const r=e.match(/^([a-z][a-z0-9.]*(?:\s+[a-z][a-z0-9.]*)?):::(.+)$/);if(r){const[,e,t]=r,a=e.split(" "),s=a[0];let n="text-accent-tertiary";"get"===s?n="text-accent-success":"set"===s&&(n="text-amber-400");const o=[{text:` ${s}`,color:`${n} font-semibold`}];a.length>1&&o.push({text:` ${a.slice(1).join(" ")}`,color:"text-accent-primary"});const i=" ".repeat(Math.max(1,22-e.length));return o.push({text:`${i}${t}`,color:"text-text-muted"}),o}if("error"===t||"warning"===t)return[{text:e,color:U(t)}];if("value"===t)return[{text:e,color:U("value")}];const s=e.match(/^([\w\s.]+):\s*(.+)$/);if(s){const[,e,t]=s;return[{text:`${e}: `,color:"text-text-muted"},{text:t,color:"text-accent-primary font-semibold"}]}return e.startsWith("OK")?[{text:e,color:U("success")}]:[{text:e,color:U(t)}]}(t,e.outputType||"default");return a.jsx("div",{className:"leading-relaxed",children:s.map((e,t)=>e.isDownload?a.jsx("span",{className:e.color,onClick:()=>o(e.downloadId),role:"button",tabIndex:0,onKeyDown:t=>"Enter"===t.key&&o(e.downloadId),children:e.text},t):a.jsx("span",{className:e.color,children:e.text},t))},r)})})});function H(){const e=l(),n=c(),o=$(),i=I(e=>e.entries),f=I(e=>e.commandHistory),v=I(e=>e.isInitialized),{addEntry:b,updateEntry:x,addCommand:k,clearEntries:O,setInitialized:P}=I(),[T,C]=t.useState(""),[E,N]=t.useState(-1),[j,A]=t.useState(!1),[G,U]=t.useState([]),[H,M]=t.useState(0),[z,q]=t.useState(0),[B,K]=t.useState(!1),X=t.useRef(null),V=t.useRef(null),J=t.useRef(null),Q=t.useRef(n);t.useEffect(()=>{Q.current=n},[n]),t.useEffect(()=>{v||(async()=>{b({type:"output",content:"██████ ██ ██ ███ ███ ██████\n██ ██ ██ ██ ████ ████ ██ \n██████ ████ ██ ████ ██ ██ \n██ ██ ██ ██ ██ ██ \n██ ██ ██ ██ ██████",outputType:"value"}),await new Promise(e=>setTimeout(e,200));const e=b({type:"system",content:"● Initializing terminal...",outputType:"system"});await new Promise(e=>setTimeout(e,400)),x(e,{content:"✓ Initializing terminal...",outputType:"success"});const t=b({type:"system",content:"● Connecting to repeater...",outputType:"system"});await new Promise(e=>setTimeout(e,600)),x(t,{content:"✓ Connected to repeater",outputType:"success"}),b({type:"system",content:"Ready. Type 'help' for commands.",outputType:"system"}),P(!0)})()},[v,b,x,P]),t.useEffect(()=>{V.current&&(V.current.scrollTop=V.current.scrollHeight)},[i]);const Y=t.useCallback(()=>{var e;const t=window.getSelection();t&&t.toString().length>0||null==(e=X.current)||e.focus()},[]),Z=t.useMemo(()=>(null==e?void 0:e.neighbors)?Object.values(e.neighbors).map(e=>e.node_name||e.name).filter(e=>!!e).sort():[],[null==e?void 0:e.neighbors]),ee=t.useCallback(e=>{const t=e.trim().toLowerCase();if(!t)return A(!1),void U([]);const a=L.filter(e=>e.cmd.toLowerCase().startsWith(t));if(a.length>0)return U(a),M(0),void A(!0);if(t.includes(" ")){const e=t.lastIndexOf(" "),a=t.substring(0,e),r=t.substring(e+1);if("ping"===a&&Z.length>0){const e=Z.filter(e=>e.toLowerCase().startsWith(r)).slice(0,10).map(e=>({cmd:`ping ${e}`,desc:`→ ${e}`}));if(e.length>0)return U(e),M(0),void A(!0)}if("export cap"===a&&o.reports.length>0){const e=o.reports.map((e,t)=>({id:e.id,index:String(t+1),pkts:e.packetCount,duration:e.durationSec})).filter(e=>e.id.toLowerCase().startsWith(r)||e.index.startsWith(r)).slice(0,10).map(e=>({cmd:`export cap ${e.index}`,desc:`${e.pkts} pkts • ${e.duration}s`}));if(e.length>0)return U(e),M(0),void A(!0)}const s=L.find(e=>e.cmd.toLowerCase()===a);if(s&&W[s.cmd]){const e=W[s.cmd].filter(e=>e.toLowerCase().startsWith(r)).map(e=>({cmd:`${s.cmd} ${e}`,desc:`→ ${e}`}));if(e.length>0)return U(e),M(0),void A(!0)}}A(!1),U([])},[Z,o.reports]),te=t.useCallback(e=>{var t;const a=G[e];a&&(a.required&&a.params?(C(a.cmd+" "),ee(a.cmd+" ")):(C(a.cmd),A(!1)),null==(t=X.current)||t.focus())},[G,ee]),ae=t.useCallback(async t=>{var a,r,s,i,l,c,f,v,w;const _=t.trim();if(!_)return;const S=_.toLowerCase();if(k(_),b({type:"command",content:_}),"clear"===S)return void O();if("help"===S){const e=L.map(e=>`${e.cmd}:::${e.desc}`).join("\n");return void b({type:"output",content:`HELP_HEADER:::Available commands\n${e}\nHELP_NOTE:::Some MeshCore commands not available via HTTP.`,outputType:"default"})}const P=b({type:"output",content:"processing...",outputType:"system"});try{const t=await d();let k="",O="info";const E=e=>{const t=Math.floor(e/86400),a=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return t>0?`${t}d ${a}h ${r}m`:a>0?`${a}h ${r}m`:`${r}m`};if("status"===S){k=`Mode: ${(null==(r=null==(a=t.config)?void 0:a.repeater)?void 0:r.mode)||"unknown"} | Neighbors: ${Object.keys(t.neighbors||{}).length} | Uptime: ${E(t.uptime_seconds||0)}`}else if("uptime"===S)k=E(t.uptime_seconds||0),O="value";else if("packets"===S)k=`rx: ${t.rx_count??0}\ntx: ${t.tx_count??0}\nfwd: ${t.forwarded_count??0}\ndrop: ${t.dropped_count??0}`;else if("neighbors"===S){const e=t.neighbors||{},a=Object.entries(e);if(0===a.length)k="No neighbors discovered yet.",O="warning";else{const e=a.map(([e,t])=>{const a=t.name||t.node_name||"Unknown";return` ${e.slice(0,8)} ${a}`});k=`Neighbors (${a.length}):\n${e.join("\n")}`}}else if("board"===S)k="pyMC_Repeater (Linux/RPi)",O="value";else if(S.startsWith("get ")){const e=S.slice(4).trim(),a=null==(s=t.config)?void 0:s.delays,r=null==(i=t.config)?void 0:i.radio,n=null==(l=t.config)?void 0:l.repeater,o=null==(c=t.config)?void 0:c.duty_cycle;switch(e){case"name":k=(null==(f=t.config)?void 0:f.node_name)||"Unknown";break;case"role":k="repeater";break;case"lat":k=null!=(null==n?void 0:n.latitude)?String(n.latitude):"not set";break;case"lon":k=null!=(null==n?void 0:n.longitude)?String(n.longitude):"not set";break;case"freq":k=(null==r?void 0:r.frequency)?(r.frequency/1e6).toFixed(3):"?";break;case"tx":k=String((null==r?void 0:r.tx_power)??"?");break;case"bw":k=(null==r?void 0:r.bandwidth)?String(r.bandwidth/1e3):"?";break;case"sf":k=String((null==r?void 0:r.spreading_factor)??"?");break;case"cr":k=String((null==r?void 0:r.coding_rate)??"?");break;case"radio":k=r?`freq: ${(r.frequency/1e6).toFixed(3)} MHz\nbw: ${r.bandwidth/1e3} kHz\nsf: ${r.spreading_factor}\ncr: 4/${r.coding_rate}`:"?";break;case"af":case"txdelay":k=String((null==a?void 0:a.tx_delay_factor)??"1.0");break;case"direct.txdelay":k=String((null==a?void 0:a.direct_tx_delay_factor)??"0.5");break;case"mode":k=(null==n?void 0:n.mode)||"forward";break;case"repeat":k="forward"===(null==n?void 0:n.mode)?"on":"off";break;case"flood.max":k=String((null==n?void 0:n.max_flood_hops)??"3");break;case"flood.advert.interval":k=null!=(null==n?void 0:n.send_advert_interval_hours)?`${n.send_advert_interval_hours}h`:"?";break;case"advert.interval":k=null!=(null==n?void 0:n.advert_interval_minutes)?`${n.advert_interval_minutes}m`:"120m";break;case"rxdelay":k=String((null==a?void 0:a.rx_delay_base)??"0.0");break;case"duty":case"duty.enabled":k=(null==o?void 0:o.enforcement_enabled)?"on":"off";break;case"duty.max":k=null!=(null==o?void 0:o.max_airtime_percent)?`${o.max_airtime_percent}%`:"?";break;case"public.key":k=t.public_key||"not available";break;case"prv.key":k="Private key stored in /etc/pymc_repeater/config.yaml\n\nTo view: sudo grep identity_key /etc/pymc_repeater/config.yaml\nTo set: sudo ./convert_firmware_key.sh <64-byte-hex>",O="info";break;case"guest.password":case"allow.read.only":k="Security settings not exposed via stats API.\nCheck /etc/pymc_repeater/config.yaml",O="warning";break;default:k=`Unknown parameter: ${e}\nAvailable: name, role, lat, lon, freq, tx, bw, sf, cr, radio, af, txdelay, direct.txdelay, rxdelay, mode, repeat, flood.max, advert.interval, duty, public.key`,O="error"}"error"!==O&&(O="value")}else if("advert"===S){const e=await p();k=e.success?"OK - Advert sent":`Error: ${e.error||"Failed"}`,O=e.success?"success":"error"}else if(S.startsWith("set mode ")){const e=S.split(" ")[2];if("forward"!==e&&"monitor"!==e)k='Error: Mode must be "forward" or "monitor"',O="error";else{const t=await m(e);k=t.success?`OK - Mode set to ${e}`:"Error: Failed",O=t.success?"success":"error"}}else if(S.startsWith("set duty ")){const e=S.split(" ")[2],t="on"===e||"1"===e,a=await u(t);k=a.success?"OK - Duty cycle "+(t?"enabled":"disabled"):"Error: Failed",O=a.success?"success":"error"}else if(S.startsWith("set tx ")){const e=parseInt(S.split(" ")[2]);if(isNaN(e)||e<2||e>22)k="Error: TX power must be 2-22 dBm (SX1262 chip max)",O="error";else{const t=await y({tx_power:e});k=t.success?`OK - TX power set to ${e}dBm`:`Error: ${t.error||"Failed"}`,O=t.success?"success":"error"}}else if(S.startsWith("set af ")||S.startsWith("set txdelay ")){const e=parseFloat(S.split(" ")[2]);if(isNaN(e)||e<0||e>5)k="Error: TX delay factor must be 0.0-5.0",O="error";else{const t=await y({tx_delay_factor:e});k=t.success?`OK - TX delay set to ${e}`:`Error: ${t.error||"Failed"}`,O=t.success?"success":"error"}}else if(S.startsWith("set direct.txdelay ")){const e=parseFloat(S.split(" ")[2]);if(isNaN(e)||e<0||e>5)k="Error: Direct TX delay must be 0.0-5.0",O="error";else{const t=await y({direct_tx_delay_factor:e});k=t.success?`OK - Direct TX delay set to ${e}`:`Error: ${t.error||"Failed"}`,O=t.success?"success":"error"}}else if(S.startsWith("set log ")){const e=null==(v=S.split(" ")[2])?void 0:v.toUpperCase();if(["DEBUG","INFO","WARNING","ERROR"].includes(e)){const t=await g(e);k=t.success?`OK - Log level set to ${e}`:`Error: ${t.error||"Failed"}`,O=t.success?"success":"error"}else k="Error: Level must be debug, info, warning, or error",O="error"}else if(S.startsWith("set rxdelay ")){const e=parseFloat(S.split(" ")[2]);if(isNaN(e)||e<0)k="Error: RX delay must be >= 0",O="error";else{const t=await y({rx_delay_base:e});k=t.success?`OK - RX delay base set to ${e}s`:`Error: ${t.error||"Failed"}`,O=t.success?"success":"error"}}else if(S.startsWith("set name ")){const e=_.substring(9).trim();if(e){const t=await y({node_name:e});k=t.success?`OK - Node name set to "${e}"`:`Error: ${t.error||"Failed"}`,O=t.success?"success":"error"}else k="Error: Node name cannot be empty",O="error"}else if(S.startsWith("set lat ")){const e=parseFloat(S.split(" ")[2]);if(isNaN(e)||e<-90||e>90)k="Error: Latitude must be -90 to 90",O="error";else{const t=await y({latitude:e});k=t.success?`OK - Latitude set to ${e}°`:`Error: ${t.error||"Failed"}`,O=t.success?"success":"error"}}else if(S.startsWith("set lon ")){const e=parseFloat(S.split(" ")[2]);if(isNaN(e)||e<-180||e>180)k="Error: Longitude must be -180 to 180",O="error";else{const t=await y({longitude:e});k=t.success?`OK - Longitude set to ${e}°`:`Error: ${t.error||"Failed"}`,O=t.success?"success":"error"}}else if(S.startsWith("set flood.max ")){const e=parseInt(S.split(" ")[2]);if(isNaN(e)||e<0||e>64)k="Error: Max flood hops must be 0-64",O="error";else{const t=await y({max_flood_hops:e});k=t.success?`OK - Max flood hops set to ${e}`:`Error: ${t.error||"Failed"}`,O=t.success?"success":"error"}}else if(S.startsWith("set flood.advert.interval ")){const e=parseInt(S.split(" ")[2]);if(isNaN(e)||0!==e&&(e<3||e>48))k="Error: Flood advert interval must be 0 (off) or 3-48 hours",O="error";else{const t=await y({flood_advert_interval_hours:e});k=t.success?0===e?"OK - Flood adverts disabled":`OK - Flood advert interval set to ${e}h`:`Error: ${t.error||"Failed"}`,O=t.success?"success":"error"}}else if(S.startsWith("set advert.interval ")){const e=parseInt(S.split(" ")[2]);if(isNaN(e)||0!==e&&(e<1||e>10080))k="Error: Advert interval must be 0 (off) or 1-10080 minutes",O="error";else{const t=await y({advert_interval_minutes:e});k=t.success?0===e?"OK - Local adverts disabled":`OK - Local advert interval set to ${e}m`:`Error: ${t.error||"Failed"}`,O=t.success?"success":"error"}}else if(S.startsWith("set prv.key ")){const e=_.substring(12).trim();e?/^[0-9a-fA-F]+$/.test(e)?128!==e.length?(k=`Error: Key must be 64 bytes (128 hex chars), got ${e.length} chars`,O="error"):(k=`To set this key, run on the Pi:\n\n sudo ./convert_firmware_key.sh ${e}\n\nThen restart: sudo systemctl restart pymc-repeater`,O="info"):(k="Error: Private key must be a hex string",O="error"):(k="Error: Private key cannot be empty",O="error")}else if(S.startsWith("convert hex ")){const e=_.substring(12).trim();if(e)if(/^[0-9a-fA-F]+$/.test(e))if(e.length%2!=0)k="Error: Hex string must have even length",O="error";else try{const t=new Uint8Array(e.length/2);for(let s=0;s1&&!isNaN(r)&&r>0,n=s?t.slice(0,-1).join(" "):e,o=s?r:30;if(n){let e=1;const t=setInterval(()=>{e=e%3+1,x(P,{content:`Pinging ${n}${".".repeat(e)}`,outputType:"system"})},800);try{const e=await h(n,o);if(clearInterval(t),e.success&&e.data){const t=e.data,a=(null==(w=t.path)?void 0:w.length)?t.path.join(" → "):"direct";k=`Reply from ${t.target_id}\n RTT: ${t.rtt_ms.toFixed(1)}ms\n RSSI: ${t.rssi}dBm\n SNR: ${t.snr_db}dB\n Path: ${a}\n Quality: ${t.quality}`,O="success"}else k=e.error||"Ping failed",O="error"}catch(C){throw clearInterval(t),C}}else k="Usage: ping [timeout]",O="error"}else if("cap"===S||"cap help"===S){const e=o.isCapturing?'\nREC:::Recording in progress... use "end cap" to stop':"",t=o.reports.length;k=`HELP_HEADER:::Packet Capture\n\nstart cap:::Start capture (default: 120s)\nend cap:::Stop capture early\nlist cap:::List saved captures${t>0?` (${t} saved)`:""}\nexport cap:::Download capture by ID\n\nHELP_NOTE:::Captures stored in session memory. JSON includes decoded payloads.${e}`,O="info"}else if("start cap"===S||S.startsWith("start cap ")){const e=S.slice(10).trim(),t=e?parseInt(e):120;if(isNaN(t)||t<1||t>3600)k="Error: Duration must be 1-3600 seconds",O="error";else{if(!o.isCapturing){o.startCapture(n);let e=t;x(P,{content:`REC:::Capturing... ${e}s remaining`,outputType:"system"});const a=setInterval(()=>{e--;const t=$.getState();if(e>=0&&t.isCapturing){const a=Q.current.filter(e=>{if(!t.captureStartTime)return!1;const a=t.captureStartTime.getTime()/1e3;return e.timestamp>=a&&!t.captureStartPacketHashes.has(e.packet_hash)}).length;x(P,{content:`REC:::Capturing... ${e>0?`${e}s remaining`:"finishing..."} (${a} captured)`,outputType:"system"})}},1e3),r=setTimeout(()=>{clearInterval(a);const e=$.getState();if(e.isCapturing){const t=Q.current,a=e.stopCapture(t);b(a?{type:"output",content:`✓ Capture complete!\n Captured: ${a.packetCount} packets\n Duration: ${a.durationSec}s\n Size: ~${R(a.sizeBytes)}\n\nDOWNLOAD:::${a.id}:::${a.filename}`,outputType:"success"}:{type:"output",content:"Capture completed with no packets.",outputType:"warning"})}},1e3*t);return void o._setTimer(r)}k='Error: Capture already in progress. Use "end cap" first.',O="error"}}else if("end cap"===S)if(o.isCapturing){const e=o.stopCapture(n);e?(k=`✓ Capture complete!\n Captured: ${e.packetCount} packets\n Duration: ${e.durationSec}s\n Size: ~${R(e.sizeBytes)}\n\nDOWNLOAD:::${e.id}:::${e.filename}`,O="success"):(k="Capture stopped with no packets.",O="warning")}else k="No capture in progress.",O="warning";else if("list cap"===S){const e=o.reports;if(0===e.length)k="No capture reports available.\nStart a capture with: start cap [seconds]",O="info";else{const t=e.map((e,t)=>` ${t+1}. ${e.packetCount} pkts • ${e.durationSec}s • ~${R(e.sizeBytes)}\n DOWNLOAD:::${e.id}:::${e.filename}`);k=`Capture Reports (${e.length}):\n${t.join("\n")}`,O="info"}}else if("export cap"===S||S.startsWith("export cap ")){const t=S.slice(11).trim();if(t){const a=o.getReport(t);if(a)D(a,e),k=`✓ Downloading ${a.filename}...`,O="success";else{const a=parseInt(t)-1,r=o.reports[a];r?(D(r,e),k=`✓ Downloading ${r.filename}...`,O="success"):(k=`Error: Report "${t}" not found.\nUse "list cap" to see available reports.`,O="error")}}else{const e=o.reports;0===e.length?(k="No capture reports available.\nStart a capture with: start cap [seconds]",O="info"):(k=`Usage: export cap \n\nAvailable reports:\n${e.map((e,t)=>` ${t+1}. ${e.id}`).join("\n")}`,O="info")}}else k=`Unknown command: ${_}\nType 'help' for available commands.`,O="error";x(P,{content:k,outputType:O})}catch(E){x(P,{content:`Error: ${E instanceof Error?E.message:"Command failed"}`,outputType:"error"})}},[b,k,x,O,o,n,e]),re=t.useCallback(e=>{var t,a,r,s,n,o;if(j&&G.length>0){if("ArrowDown"===e.key){e.preventDefault();const s=Math.min(H+1,G.length-1);return M(s),void(null==(r=null==(a=null==(t=J.current)?void 0:t.children[0])?void 0:a.children[s])||r.scrollIntoView({block:"nearest"}))}if("ArrowUp"===e.key){e.preventDefault();const t=Math.max(H-1,0);return M(t),void(null==(o=null==(n=null==(s=J.current)?void 0:s.children[0])?void 0:n.children[t])||o.scrollIntoView({block:"nearest"}))}if("Tab"===e.key)return e.preventDefault(),void te(H);if("Escape"===e.key)return e.preventDefault(),void A(!1)}if("Enter"===e.key){if(e.preventDefault(),j&&G.length>0){const e=G[H].cmd;return C(""),N(-1),A(!1),void ae(e)}const t=T;return C(""),N(-1),A(!1),void ae(t)}if("ArrowUp"!==e.key||j)if("ArrowDown"!==e.key||j);else if(e.preventDefault(),E>0){const e=E-1;N(e),C(f[f.length-1-e]||"")}else 0===E&&(N(-1),C(""));else if(e.preventDefault(),f.length>0&&E{C(e.target.value),q(e.target.selectionStart||e.target.value.length),ee(e.target.value)},[ee]),ne=t.useCallback(e=>{const t=e.target;q(t.selectionStart||0)},[]);return a.jsxs(w,{children:[a.jsx(_,{title:"Terminal",icon:a.jsx(r,{})}),a.jsxs(S,{noPadding:!0,className:"terminal-card overflow-hidden flex flex-col isolate",onClick:Y,children:[a.jsx("div",{ref:V,className:"flex-1 overflow-y-auto font-mono text-sm p-3 sm:p-4 md:p-5",style:{background:"var(--terminal-bg)"},children:i.map(e=>a.jsx(F,{entry:e},e.id))}),a.jsxs("div",{className:"relative",style:{borderTop:"1px solid var(--terminal-border)",background:"var(--terminal-bg-input)"},children:[a.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 px-3 sm:px-4 py-2 sm:py-3",children:[a.jsx("span",{className:"text-text-muted font-mono font-bold select-none",children:"$"}),a.jsxs("div",{className:"flex-1 relative font-mono text-sm",children:[a.jsx("input",{ref:X,type:"text",value:T,onChange:se,onKeyDown:re,onSelect:ne,onFocus:()=>K(!0),onBlur:()=>K(!1),disabled:!v,className:"absolute inset-0 w-full bg-transparent text-transparent outline-none disabled:opacity-50 selection:bg-transparent",style:{caretColor:"transparent"},autoFocus:!0,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1}),a.jsx("div",{className:"relative pointer-events-none select-none","aria-hidden":!0,children:v?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-text-primary",children:T.slice(0,z)}),a.jsx("span",{className:s("inline-block w-[0.6em] h-[1.2em] align-text-bottom",B?"bg-accent-primary":"bg-text-muted/30"),style:{marginBottom:"-0.1em"},children:a.jsx("span",{className:"text-bg-primary",children:T[z]||""})}),a.jsx("span",{className:"text-text-primary",children:T.slice(z+1)})]}):a.jsx("span",{className:"text-text-muted",children:"Connecting..."})})]})]}),a.jsxs("div",{className:"px-3 sm:px-4 py-1 flex justify-between text-[10px] text-text-muted",style:{borderTop:"1px solid var(--terminal-border)",background:"var(--terminal-bg-status)"},children:[a.jsx("span",{className:"hidden sm:inline",children:"↑↓ History"}),a.jsx("span",{className:"sm:hidden",children:"Terminal"}),(null==e?void 0:e.version)&&a.jsxs("span",{children:["pyMC v",e.version]})]})]}),j&&G.length>0&&a.jsxs("div",{ref:J,className:"absolute left-2 right-2 bottom-[72px] rounded-xl shadow-2xl overflow-hidden z-50 backdrop-blur-xl",style:{border:"1px solid var(--terminal-autocomplete-border)",background:"var(--terminal-autocomplete-bg)"},children:[a.jsx("div",{className:"max-h-64 overflow-y-auto",children:G.map((e,t)=>a.jsxs("div",{onClick:()=>te(t),className:s("px-4 py-2.5 cursor-pointer last:border-b-0 transition-colors",t===H?"bg-accent-primary/25":""),style:{borderBottom:"1px solid var(--terminal-border)",...t!==H?{"--tw-bg-opacity":0}:{}},onMouseEnter:e=>{t!==H&&(e.currentTarget.style.background="var(--terminal-autocomplete-hover)")},onMouseLeave:e=>{t!==H&&(e.currentTarget.style.background="transparent")},children:[a.jsx("span",{className:s("font-mono text-sm",t===H?"text-accent-primary":"text-text-primary"),children:e.cmd}),a.jsx("span",{className:"text-xs text-text-muted ml-4",children:e.desc})]},e.cmd))}),a.jsx("div",{className:"px-3 py-1.5 text-[10px] text-text-muted text-right",style:{borderTop:"1px solid var(--terminal-border)",background:"var(--terminal-autocomplete-hover)"},children:"Tab to select"})]})]})]})}export{H as default}; diff --git a/frontend/dist/assets/TimeRangeSelector-DGCfekAv.js b/frontend/dist/assets/TimeRangeSelector-DGCfekAv.js deleted file mode 100644 index 890312d2..00000000 --- a/frontend/dist/assets/TimeRangeSelector-DGCfekAv.js +++ /dev/null @@ -1 +0,0 @@ -import{r as e,j as o}from"./vendor-react-C341c8YC.js";const t=e.memo(function({ranges:e,selectedIndex:t,onSelect:a,isPending:l}){return o.jsx("div",{className:"toggle-group flex-shrink-0 overflow-x-auto "+(l?"opacity-70":""),children:e.map((e,l)=>o.jsx("button",{onClick:()=>a(l),className:"toggle-group-item "+(t===l?"active":""),children:e.label},e.label))})});export{t as T}; diff --git a/frontend/dist/assets/TimeRangeSelector-DUE1rBOu.js b/frontend/dist/assets/TimeRangeSelector-DUE1rBOu.js new file mode 100644 index 00000000..0e393fab --- /dev/null +++ b/frontend/dist/assets/TimeRangeSelector-DUE1rBOu.js @@ -0,0 +1 @@ +import{c as e}from"./index-BGs2yNOg.js";import{a,j as o}from"./vendor-react-DCIF8YoJ.js";const t=e("ear-off",[["path",{d:"M6 18.5a3.5 3.5 0 1 0 7 0c0-1.57.92-2.52 2.04-3.46",key:"1qngmn"}],["path",{d:"M6 8.5c0-.75.13-1.47.36-2.14",key:"b06bma"}],["path",{d:"M8.8 3.15A6.5 6.5 0 0 1 19 8.5c0 1.63-.44 2.81-1.09 3.76",key:"g10hsz"}],["path",{d:"M12.5 6A2.5 2.5 0 0 1 15 8.5M10 13a2 2 0 0 0 1.82-1.18",key:"ygzou7"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]),n=a.memo(function({ranges:e,selectedIndex:a,onSelect:t,isPending:n}){return o.jsx("div",{className:"toggle-group flex-shrink-0 overflow-x-auto "+(n?"opacity-70":""),children:e.map((e,n)=>o.jsx("button",{onClick:()=>t(n),className:"toggle-group-item "+(a===n?"active":""),children:e.label},e.label))})});export{t as E,n as T}; diff --git a/frontend/dist/assets/arrow-right-C9AHsGJs.js b/frontend/dist/assets/arrow-right-C9AHsGJs.js new file mode 100644 index 00000000..5275ffde --- /dev/null +++ b/frontend/dist/assets/arrow-right-C9AHsGJs.js @@ -0,0 +1 @@ +import{c as a}from"./index-BGs2yNOg.js";const r=a("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);export{r as A}; diff --git a/frontend/dist/assets/arrow-up-ce4_7z5E.js b/frontend/dist/assets/arrow-up-ce4_7z5E.js new file mode 100644 index 00000000..57b8b6ec --- /dev/null +++ b/frontend/dist/assets/arrow-up-ce4_7z5E.js @@ -0,0 +1 @@ +import{c as a}from"./index-BGs2yNOg.js";const e=a("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]),r=a("arrow-up",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);export{e as A,r as a}; diff --git a/frontend/dist/assets/car-DXNv2W8D.js b/frontend/dist/assets/car-DXNv2W8D.js new file mode 100644 index 00000000..d73e4d2d --- /dev/null +++ b/frontend/dist/assets/car-DXNv2W8D.js @@ -0,0 +1 @@ +import{c}from"./index-BGs2yNOg.js";const e=c("car",[["path",{d:"M19 17h2c.6 0 1-.4 1-1v-3c0-.9-.7-1.7-1.5-1.9C18.7 10.6 16 10 16 10s-1.3-1.4-2.2-2.3c-.5-.4-1.1-.7-1.8-.7H5c-.6 0-1.1.4-1.4.9l-1.4 2.9A3.7 3.7 0 0 0 2 12v4c0 .6.4 1 1 1h2",key:"5owen"}],["circle",{cx:"7",cy:"17",r:"2",key:"u2ysq9"}],["path",{d:"M9 17h6",key:"r8uit2"}],["circle",{cx:"17",cy:"17",r:"2",key:"axvx0g"}]]);export{e as C}; diff --git a/frontend/dist/assets/check-qb29v-su.js b/frontend/dist/assets/check-qb29v-su.js new file mode 100644 index 00000000..2d97fe20 --- /dev/null +++ b/frontend/dist/assets/check-qb29v-su.js @@ -0,0 +1 @@ +import{c}from"./index-BGs2yNOg.js";const e=c("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);export{e as C}; diff --git a/frontend/dist/assets/chevron-right-7sotkg9l.js b/frontend/dist/assets/chevron-right-7sotkg9l.js new file mode 100644 index 00000000..bea0c22d --- /dev/null +++ b/frontend/dist/assets/chevron-right-7sotkg9l.js @@ -0,0 +1 @@ +import{c as t}from"./index-BGs2yNOg.js";const h=t("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);export{h as C}; diff --git a/frontend/dist/assets/chevron-up-ClXInh9N.js b/frontend/dist/assets/chevron-up-ClXInh9N.js new file mode 100644 index 00000000..19021982 --- /dev/null +++ b/frontend/dist/assets/chevron-up-ClXInh9N.js @@ -0,0 +1 @@ +import{c as a}from"./index-BGs2yNOg.js";const t=a("activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]),e=a("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);export{t as A,e as C}; diff --git a/frontend/dist/assets/circle-check-Bd9Kbu6i.js b/frontend/dist/assets/circle-check-Bd9Kbu6i.js new file mode 100644 index 00000000..53f3443c --- /dev/null +++ b/frontend/dist/assets/circle-check-Bd9Kbu6i.js @@ -0,0 +1 @@ +import{c}from"./index-BGs2yNOg.js";const e=c("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);export{e as C}; diff --git a/frontend/dist/assets/compass-DMvXEtHv.js b/frontend/dist/assets/compass-DMvXEtHv.js new file mode 100644 index 00000000..e6e2a1bb --- /dev/null +++ b/frontend/dist/assets/compass-DMvXEtHv.js @@ -0,0 +1 @@ +import{c as a}from"./index-BGs2yNOg.js";const c=a("compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);export{c as C}; diff --git a/frontend/dist/assets/funnel-DZRnHLZd.js b/frontend/dist/assets/funnel-DZRnHLZd.js new file mode 100644 index 00000000..f0b51191 --- /dev/null +++ b/frontend/dist/assets/funnel-DZRnHLZd.js @@ -0,0 +1 @@ +import{c as a}from"./index-BGs2yNOg.js";const s=a("funnel",[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]]);export{s as F}; diff --git a/frontend/dist/assets/git-branch-Sfdze11O.js b/frontend/dist/assets/git-branch-Sfdze11O.js new file mode 100644 index 00000000..bec4a219 --- /dev/null +++ b/frontend/dist/assets/git-branch-Sfdze11O.js @@ -0,0 +1 @@ +import{c}from"./index-BGs2yNOg.js";const e=c("git-branch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);export{e as G}; diff --git a/frontend/dist/assets/house-CCeK_0TO.js b/frontend/dist/assets/house-CCeK_0TO.js new file mode 100644 index 00000000..ae988b8e --- /dev/null +++ b/frontend/dist/assets/house-CCeK_0TO.js @@ -0,0 +1 @@ +import{c as a}from"./index-BGs2yNOg.js";const e=a("database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]),s=a("house",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]]);export{e as D,s as H}; diff --git a/frontend/dist/assets/index-BGs2yNOg.js b/frontend/dist/assets/index-BGs2yNOg.js new file mode 100644 index 00000000..2c570ac2 --- /dev/null +++ b/frontend/dist/assets/index-BGs2yNOg.js @@ -0,0 +1,2 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Login-BM63wUrV.js","assets/vendor-react-DCIF8YoJ.js","assets/vendor-core-Dl9MTgSr.js","assets/Dashboard-DdOKd_Co.js","assets/useThemeColors-CGx-Jxyf.js","assets/PageLayout-DIXn4UXM.js","assets/PacketList-CFuBvjqk.js","assets/channel-keys-DJWRrSwE.js","assets/SignalIndicator-DWWkJgSd.js","assets/arrow-up-ce4_7z5E.js","assets/DataBox-nCNZLfvU.js","assets/check-qb29v-su.js","assets/arrow-right-C9AHsGJs.js","assets/chevron-right-7sotkg9l.js","assets/loader-circle-CwUrmZrV.js","assets/map-pin-x5eP-WEg.js","assets/zap-CQ3I2hAj.js","assets/triangle-alert-2-1YN-Am.js","assets/route-DRIRJjaN.js","assets/chevron-up-ClXInh9N.js","assets/circle-check-Bd9Kbu6i.js","assets/house-CCeK_0TO.js","assets/trending-up-2SYsZdKi.js","assets/TimeRangeSelector-DUE1rBOu.js","assets/link-scoring-DTgOSmRe.js","assets/NodeInformationCard-DcRtH0Bq.js","assets/Card-CPlTPCY8.js","assets/Grid-DkfcBkoo.js","assets/Packets-DiXDa-F_.js","assets/users-D0iUt2so.js","assets/funnel-DZRnHLZd.js","assets/refresh-cw-ccP9GKH1.js","assets/Contacts-Bc9XGkC1.js","assets/ping-HGVILoRV.js","assets/git-branch-Sfdze11O.js","assets/target-De7OqeGi.js","assets/ConfirmModal-_bkwu5cd.js","assets/CollisionExplorerModal-CyK7TMsS.js","assets/BasemapLayer-g9CXC1Ky.js","assets/network-DpalqfB8.js","assets/maplibre-gl-B1CfjdFi.css","assets/Statistics-BZ42IsKT.js","assets/usePolling-DIhP09j-.js","assets/compass-DMvXEtHv.js","assets/info-HmV1qkUD.js","assets/MeshGraph-Cn5F4qEM.js","assets/DeepAnalysisModal-Dhmx8Gh2.js","assets/System-DA9azmQv.js","assets/Logs-CO8l86BH.js","assets/Terminal-Dv2-3e-b.js","assets/Configuration-BdYZcJJF.js","assets/font-loader-jlbdh9Fw.js"])))=>i.map(i=>d[i]); +var t=Object.defineProperty,e=(e,n,s)=>((e,n,s)=>n in e?t(e,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[n]=s)(e,"symbol"!=typeof n?n+"":n,s);import{a as n,j as s,d as i,L as o,h as r,z as a,Q as l,y as c,x as u,X as d,e as h,b as p,f as m}from"./vendor-react-DCIF8YoJ.js";import{_ as f}from"./deckgl-DTsmDcfs.js";import{n as g}from"./recharts-DVj1EL-m.js";import{L as y,c as v,u as x,R as b,a as w,N as k,B as S}from"./vendor-core-Dl9MTgSr.js";!function(){const t=document.createElement("link").relList;if(!(t&&t.supports&&t.supports("modulepreload"))){for(const t of document.querySelectorAll('link[rel="modulepreload"]'))e(t);new MutationObserver(t=>{for(const n of t)if("childList"===n.type)for(const t of n.addedNodes)"LINK"===t.tagName&&"modulepreload"===t.rel&&e(t)}).observe(document,{childList:!0,subtree:!0})}function e(t){if(t.ep)return;t.ep=!0;const e=function(t){const e={};return t.integrity&&(e.integrity=t.integrity),t.referrerPolicy&&(e.referrerPolicy=t.referrerPolicy),"use-credentials"===t.crossOrigin?e.credentials="include":"anonymous"===t.crossOrigin?e.credentials="omit":e.credentials="same-origin",e}(t);fetch(t.href,e)}}();const T={surfaces:{glass:{tint:"#252525",light:"#ffffff",dark:"#000000",reflexLight:.15,reflexDark:.8,blur:6,blurElevated:8,brightness:1,opacity:8,opacityElevated:12},card:{radius:"1.125rem",padding:"1.25rem",paddingCompact:"0.75rem"},sidebar:{tint:"rgba(113, 156, 223, 0.06)",width:"16rem",drawerWidth:"85vw"},modal:{radius:"1.125rem",backdropBlur:"8px",backdropColor:"rgba(0, 0, 0, 0.6)"}},colors:{bg:{body:"#171717",surface:"#252525",elevated:"#333233",subtle:"#3F3F3F"},border:{subtle:"#4B4B4B",strong:"#616161"},text:{primary:"#E1E1E1",secondary:"#BFBFBF",muted:"#727272",inverse:"#171717"},accent:{primary:"#719CDF",secondary:"#DFBC72",tertiary:"#6FBCBD",success:"#719872",danger:"#E12672"},signal:{excellent:"#00FF00",good:"#8CE619",fair:"#FFD900",poor:"#FF8C26",critical:"#FF3333",unknown:"#616161"},status:{success:"#719872",warning:"#DFBC72",danger:"#E12672",info:"#6FBCBD",muted:"#616161"},chart:{c1:"#719CDF",c2:"#0074BE",c3:"#6FBCBD",c4:"#DFBC72",c5:"#719872",c6:"#E12672",c7:"#E17899",c8:"#999ABD",grid:"rgba(255, 255, 255, 0.06)",axis:"rgba(255, 255, 255, 0.4)",cursor:"rgba(255, 255, 255, 0.2)"},metric:{received:"#719872",forwarded:"#0074BE",transmitted:"#DFBC72",dropped:"#E12672"},map:{nodeFill:"#3B82F6",nodeStroke:"rgba(255,255,255,0.9)",hub:"#8E4EC6",local:"#FFB224",neighbor:"#46A758",mobile:"#F76B15",room:"#D6409F",edge:"#4B4B4B",edgeHover:"#6FBCBD"}},typography:{font:{title:"'Inter', system-ui, sans-serif",display:"'Inter', system-ui, sans-serif",mono:"'JetBrains Mono', 'SF Mono', Monaco, monospace"},size:{xs:"0.64rem",sm:"0.8rem",base:"1rem",md:"1.125rem",lg:"1.25rem",xl:"1.563rem",xxl:"1.953rem",hero:"3.052rem"},weight:{normal:400,medium:500,semibold:600,bold:700},leading:{tight:1.1,snug:1.25,normal:1.5},tracking:{tight:"-0.02em",normal:"0",wide:"0.05em"}},spacing:{space:{gap:"1.5rem",gapMobile:"0.75rem",page:"1.5rem",pageMobile:"1rem",section:"2rem"},radius:{sm:"0.5rem",md:"0.875rem",lg:"1.125rem",xl:"1.5rem",pill:"9999px"}},motion:{fast:"0.1s",normal:"0.15s",slow:"0.4s",easing:"ease-out"}};function C(t){const e=t.replace("#","");if(6!==e.length&&3!==e.length)return t;let n,s,i;return 3===e.length?(n=parseInt(e[0]+e[0],16)/255,s=parseInt(e[1]+e[1],16)/255,i=parseInt(e[2]+e[2],16)/255):(n=parseInt(e.slice(0,2),16)/255,s=parseInt(e.slice(2,4),16)/255,i=parseInt(e.slice(4,6),16)/255),`color(display-p3 ${n.toFixed(3)} ${s.toFixed(3)} ${i.toFixed(3)})`}function M(){return"undefined"!=typeof window&&CSS.supports("color","color(display-p3 1 1 1)")}function P(t){return M()?C(t):t}function E(t,e){const n={...t};for(const s of Object.keys(e)){const i=e[s],o=t[s];void 0!==i&&("object"!=typeof i||null===i||Array.isArray(i)||"object"!=typeof o||null===o||Array.isArray(o)?n[s]=i:n[s]=E(o,i))}return n}function j(t){return{meta:t.meta,display:t.display,surfaces:t.surfaces?E(T.surfaces,t.surfaces):T.surfaces,colors:t.colors?E(T.colors,t.colors):T.colors,typography:t.typography?E(T.typography,t.typography):T.typography,spacing:t.spacing?E(T.spacing,t.spacing):T.spacing,motion:t.motion?E(T.motion,t.motion):T.motion}}function L(t){const e=t.replace("#","");return 6===e.length?`${parseInt(e.slice(0,2),16)}, ${parseInt(e.slice(2,4),16)}, ${parseInt(e.slice(4,6),16)}`:"255, 255, 255"}function A(t){return{id:t.meta.id,colorScheme:{name:t.meta.name,dataTheme:t.meta.dataTheme,previewColor:t.meta.previewColor},background:{src:t.meta.backgroundImage,suggestedBrightness:t.meta.backgroundBrightness},display:{font:t.display.font,color:t.display.color,size:t.display.size,paletteColors:t.display.palette}}}const D="#fafafa",N="#a1a1aa",R="#71717a",F="#3f3f46",I="#27272a",_="#18181b",B="#09090b",V="#ef4444",O="#f97316",z="#f59e0b",$="#eab308",W="#22c55e",U="#10b981",H="#06b6d4",Y="#3b82f6",q="#8b5cf6",G=j({meta:{id:"",name:"",dataTheme:"",previewColor:Y,backgroundImage:"",backgroundBrightness:100,isDark:!0},display:{font:"Inter, sans-serif",color:N,size:1,palette:[[Y,W,$,O,V],[B,_,I,F,D]]},typography:{font:{title:"Inter, sans-serif",display:"Inter, sans-serif",mono:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace'},weight:{normal:400,medium:500,semibold:600,bold:700,badge:700},tracking:{tight:"-0.02em",normal:"0",wide:"0.025em"},badge:{textTransform:"capitalize"}},surfaces:{glass:{tint:_,light:F,dark:B,reflexLight:0,reflexDark:0,blur:0,blurElevated:0,brightness:1,opacity:100,opacityElevated:100,catalystMode:!0},sidebar:{tint:`${I}80`},card:{radius:"0.5rem"},modal:{radius:"0.75rem"}},colors:{bg:{body:B,surface:_,elevated:I,subtle:I},border:{subtle:I,strong:"#52525b"},text:{primary:"#fff",secondary:N,muted:R,inverse:B},accent:{primary:Y,secondary:$,tertiary:H,success:W,danger:V},signal:{excellent:W,good:"#84cc16",fair:$,poor:O,critical:V,unknown:R},status:{success:W,warning:z,danger:V,info:Y,muted:R},chart:{c1:Y,c2:U,c3:z,c4:O,c5:"#f43f5e",c6:q,c7:H,c8:R,grid:`${D}0d`,axis:`${D}33`,cursor:`${Y}33`},metric:{received:Y,forwarded:U,transmitted:O,dropped:V},map:{nodeFill:Y,nodeStroke:`${D}e6`,hub:q,local:z,neighbor:U,mobile:O,room:"#ec4899",edge:F,edgeHover:Y}}}),X=G;A(G);const K=j({meta:{id:"",name:"",dataTheme:"",previewColor:"#B39DF3",backgroundImage:"/assets/sand.jpg",backgroundBrightness:80,isDark:!0},display:{font:"'Rubik Mono One', monospace",color:"#4A4A52",size:.8,palette:[["#B49DFF","#F9D26F","#71F8E5","#39D98A","#FF5C7A"],["#4CFFB5","#FF8A5C","#A78BFA","#60A5FA","#F472B6"]]},typography:{font:{title:"'Rubik Mono One', monospace"}},surfaces:{glass:{tint:"#252525",blur:6,blurElevated:8},sidebar:{tint:"rgba(113, 156, 223, 0.06)"}}}),J=K;A(K);const Z=j({meta:{id:"",name:"",dataTheme:"",previewColor:"#fabd2f",backgroundImage:"/assets/magma.webp",backgroundBrightness:50,isDark:!0},display:{font:"'Jacquard 12', serif",color:"#fe8019",size:1.75,palette:[["#fabd2f","#fb4934","#8ec07c","#b8bb26","#d3869b"],["#fe8019","#83a598","#d65d0e","#928374","#ebdbb2"]]},typography:{font:{title:"'Jacquard 12', serif"},size:{xxl:"2.344rem"}},surfaces:{glass:{tint:"#282828"},sidebar:{tint:"rgba(250, 189, 47, 0.06)"}},colors:{accent:{primary:"#fabd2f",secondary:"#fb4934",tertiary:"#8ec07c",success:"#b8bb26",danger:"#fb4934"},signal:{excellent:"#b8bb26",good:"#8ec07c",fair:"#fabd2f",poor:"#fe8019",critical:"#fb4934",unknown:"#928374"},status:{success:"#b8bb26",warning:"#fabd2f",danger:"#fb4934",info:"#83a598",muted:"#928374"},chart:{c1:"#fabd2f",c2:"#fe8019",c3:"#fb4934",c4:"#d3869b",c5:"#b8bb26",c6:"#8ec07c",c7:"#83a598",c8:"#d65d0e",grid:"rgba(251, 241, 199, 0.06)",axis:"rgba(251, 241, 199, 0.4)",cursor:"rgba(251, 241, 199, 0.2)"},metric:{received:"#b8bb26",forwarded:"#83a598",transmitted:"#fabd2f",dropped:"#fb4934"},map:{nodeFill:"#3B82F6",nodeStroke:"rgba(255,255,255,0.9)",hub:"#b16286",local:"#fabd2f",neighbor:"#fabd2f",mobile:"#fe8019",room:"#d3869b",edge:"#665c54",edgeHover:"#8ec07c"}}}),Q=Z;A(Z);const tt=j({meta:{id:"",name:"",dataTheme:"",previewColor:"#83a598",backgroundImage:"/assets/water.webp",backgroundBrightness:40,isDark:!0},display:{font:"'Cantora One', sans-serif",color:"#83a598",size:1.25,palette:[["#83a598","#a89984","#8ec07c","#d79921","#b16286"],["#fe8019","#cc241d","#7c6f64","#bdae93","#ebdbb2"]]},typography:{font:{title:"'Cantora One', sans-serif"},size:{xxl:"2.148rem"},weight:{semibold:500}},surfaces:{glass:{tint:"#1e1e1e"},sidebar:{tint:"rgba(131, 165, 152, 0.06)"}},colors:{accent:{primary:"#83a598",secondary:"#a89984",tertiary:"#8ec07c",success:"#8ec07c",danger:"#cc241d"},signal:{excellent:"#8ec07c",good:"#b8bb26",fair:"#d79921",poor:"#fe8019",critical:"#cc241d",unknown:"#7c6f64"},status:{success:"#8ec07c",warning:"#d79921",danger:"#cc241d",info:"#83a598",muted:"#7c6f64"},chart:{c1:"#83a598",c2:"#8ec07c",c3:"#d79921",c4:"#b16286",c5:"#fe8019",c6:"#cc241d",c7:"#a89984",c8:"#7c6f64",grid:"rgba(213, 196, 161, 0.06)",axis:"rgba(213, 196, 161, 0.4)",cursor:"rgba(213, 196, 161, 0.2)"},metric:{received:"#8ec07c",forwarded:"#83a598",transmitted:"#d79921",dropped:"#cc241d"},map:{nodeFill:"#3B82F6",nodeStroke:"rgba(255,255,255,0.9)",hub:"#b16286",local:"#d79921",neighbor:"#d79921",mobile:"#fe8019",room:"#b16286",edge:"#504945",edgeHover:"#83a598"}}}),et=tt;A(tt);const nt=j({meta:{id:"",name:"",dataTheme:"",previewColor:"#33859d",backgroundImage:"/assets/stars.jpg",backgroundBrightness:100,isDark:!0},display:{font:"'IBM Plex Mono', monospace",color:"#c23127",size:1.25,palette:[["#33859d","#edb54b","#26a98b","#c23127","#888ca6"],["#195465","#d26939","#99d1ce","#4e5165","#0c1014"]]},typography:{font:{title:"'IBM Plex Mono', monospace"}},surfaces:{glass:{tint:"#0a0e14",blur:1,blurElevated:2},sidebar:{tint:"rgba(51, 133, 157, 0.06)"}},colors:{accent:{primary:"#33859d",secondary:"#edb54b",tertiary:"#26a98b",success:"#26a98b",danger:"#c33027"},signal:{excellent:"#26a98b",good:"#7ec07c",fair:"#edb54b",poor:"#d26939",critical:"#c33027",unknown:"#195465"},status:{success:"#26a98b",warning:"#edb54b",danger:"#c33027",info:"#599caa",muted:"#195465"},chart:{c1:"#33859d",c2:"#edb54b",c3:"#26a98b",c4:"#599caa",c5:"#d26939",c6:"#c33027",c7:"#888ba5",c8:"#195465",grid:"rgba(153, 209, 206, 0.06)",axis:"rgba(153, 209, 206, 0.4)",cursor:"rgba(153, 209, 206, 0.2)"},metric:{received:"#26a98b",forwarded:"#33859d",transmitted:"#edb54b",dropped:"#c33027"},map:{nodeFill:"#3B82F6",nodeStroke:"rgba(255,255,255,0.9)",hub:"#888ba5",local:"#edb54b",neighbor:"#edb54b",mobile:"#d26939",room:"#888ba5",edge:"#245361",edgeHover:"#26a98b"}}}),st=nt;A(nt);const it="#2D2D2D",ot="#4A4A4A",rt="#7A7A7A",at=j({meta:{id:"",name:"",dataTheme:"",previewColor:"#9ed072",backgroundImage:"",backgroundColor:"#F5F5F5",backgroundBrightness:100,isDark:!1},display:{font:"'JetBrains Mono', monospace",color:"#2D2D2D",size:1,palette:[["#9ed072","#fc5d7c","#76cce0","#e7c664","#b39df3"],["#f39660","#7f8490","#e2e2e3","#55575e","#2c2e34"]]},typography:{font:{title:"'JetBrains Mono', 'SF Mono', Monaco, monospace",display:"'Instrument Sans', system-ui, sans-serif",mono:"'JetBrains Mono', 'SF Mono', Monaco, monospace",cardTitle:"'JetBrains Mono', 'SF Mono', Monaco, monospace"},size:{xxl:"1.875rem",cardTitle:"1rem"},weight:{normal:400,medium:500,semibold:600,bold:600,cardTitle:600}},surfaces:{glass:{tint:"#FFFFFF",light:"rgba(255, 255, 255, 1)",dark:"rgba(0, 0, 0, 0.1)",reflexLight:0,reflexDark:0,blur:0,blurElevated:0,brightness:1,opacity:0,opacityElevated:0,ribbonMode:!0,ribbonBorderWidth:2,ribbonBorderColor:rt},sidebar:{tint:"rgba(0, 0, 0, 0.02)"}},colors:{bg:{body:"#F5F5F5",surface:"#FFFFFF",elevated:"#FFFFFF",subtle:"#EBEBEB"},border:{subtle:"#E0E0E0",strong:"#BFBFBF"},text:{primary:it,secondary:ot,muted:rt,inverse:"#FFFFFF"},accent:{primary:"#9ed072",secondary:"#e7c664",tertiary:"#76cce0",success:"#9ed072",danger:"#fc5d7c"},signal:{excellent:"#9ed072",good:"#c5d93d",fair:"#e7c664",poor:"#f39660",critical:"#fc5d7c",unknown:"#7f8490"},status:{success:"#9ed072",warning:"#e7c664",danger:"#fc5d7c",info:"#76cce0",muted:"#7f8490"},chart:{c1:"#2E8B57",c2:"#E14D6B",c3:"#D4A832",c4:"#4A9EA0",c5:"#8B6BAE",c6:"#D97A4A",c7:rt,c8:ot,grid:"rgba(45, 45, 45, 0.08)",axis:"rgba(45, 45, 45, 0.5)",cursor:"rgba(45, 45, 45, 0.15)"},metric:{received:"#9ed072",forwarded:"#76cce0",transmitted:"#e7c664",dropped:"#fc5d7c"},map:{nodeFill:"#3B82F6",nodeStroke:"rgba(255,255,255,0.9)",hub:"#b39df3",local:"#e7c664",neighbor:"#e7c664",mobile:"#f39660",room:"#fc5d7c",edge:rt,edgeHover:"#76cce0"},icon:{pageTitle:it,cardTitle:it,widget:ot,action:ot,nav:rt,navActive:it},sidebar:{bg:"rgba(0, 0, 0, 0.02)",navHoverBg:"rgba(0, 0, 0, 0.04)",navActiveBg:"rgba(0, 0, 0, 0.06)",navActiveText:it}}}),lt=at;A(at);const ct=j({meta:{id:"",name:"",dataTheme:"",previewColor:"#7E9CD8",backgroundImage:"/assets/folds.webp",backgroundBrightness:50,isDark:!0},display:{font:"'Inter', sans-serif",color:"#7E9CD8",size:1.25,palette:[["#7E9CD8","#E46876","#7AA89F","#DCA561","#957FB8"],["#7FB4CA","#D27E99","#98BB6C","#727169","#1F1F28"]]},typography:{font:{title:"'Inter', sans-serif"}},surfaces:{glass:{tint:"#1F1F28"},sidebar:{tint:"rgba(126, 156, 216, 0.06)"}},colors:{accent:{primary:"#7E9CD8",secondary:"#E6C384",tertiary:"#7FB4CA",success:"#98BB6C",danger:"#E46876"},signal:{excellent:"#98BB6C",good:"#B8CC5C",fair:"#E6C384",poor:"#FFA066",critical:"#E46876",unknown:"#54546D"},status:{success:"#98BB6C",warning:"#E6C384",danger:"#E46876",info:"#7FB4CA",muted:"#727169"},chart:{c1:"#7E9CD8",c2:"#E6C384",c3:"#98BB6C",c4:"#957FB8",c5:"#7FB4CA",c6:"#E46876",c7:"#FFA066",c8:"#D27E99",grid:"rgba(220, 215, 186, 0.06)",axis:"rgba(220, 215, 186, 0.4)",cursor:"rgba(220, 215, 186, 0.2)"},metric:{received:"#98BB6C",forwarded:"#7E9CD8",transmitted:"#E6C384",dropped:"#E46876"},map:{nodeFill:"#3B82F6",nodeStroke:"rgba(255,255,255,0.9)",hub:"#957FB8",local:"#E6C384",neighbor:"#E6C384",mobile:"#FFA066",room:"#D27E99",edge:"#54546D",edgeHover:"#7AA89F"}}}),ut=ct;A(ct);const dt={"KDE Breeze":X,Magma:Q,Folds:ut,Ribbon:lt,BLKSAND:J,Waves:et,Stars:st};function ht(t,e){const n=t.toLowerCase();return{...e,meta:{...e.meta,id:n,name:t,dataTheme:n}}}const pt=Object.fromEntries(Object.entries(dt).map(([t,e])=>[t,ht(t,e)])),mt=Object.fromEntries(Object.entries(pt).map(([t,e])=>[t,A(e)])),ft=Object.values(pt);function gt(t){return ft.find(e=>e.meta.id===t)}new Map(Object.entries(pt));const yt=Object.values(mt);new Map(Object.entries(mt));const vt=Object.entries(mt).map(([t,e])=>function(t,e){return{id:t.id,name:t.colorScheme.name,displayName:e,colorScheme:t.id,backgroundImage:t.background.src,paletteColors:t.display.paletteColors,displayFont:t.display.font,displayColor:t.display.color,displaySize:t.display.size}}(e,t)),xt=yt.map(function(t){return{id:t.id,name:t.colorScheme.name,dataTheme:t.colorScheme.dataTheme,previewColor:t.colorScheme.previewColor}}),bt=yt.map(function(t){return{id:t.id,src:t.background.src,suggestedScheme:t.id,suggestedBrightness:t.background.suggestedBrightness}}),wt=pt["KDE Breeze"];mt["KDE Breeze"];const kt=wt.meta.id,St=wt.meta.backgroundImage,Tt=wt.meta.backgroundBrightness,Ct=xt,Mt=bt,Pt=vt,Et={colorScheme:kt,backgroundImage:St,brightness:Tt},jt="pymc-color-scheme",Lt="pymc-background-image",At="pymc-bg-brightness",Dt="pymc-background";function Nt(t){(new Image).src=t}const Rt={50:.97,100:.92,200:.84,300:.73,400:.62,500:.5,600:.4,700:.32,800:.24,900:.16},Ft=[50,100,200,300,400,500,600,700,800,900],It=["red","orange","yellow","green","aqua","blue","purple"];function _t(t,e,n){const s=t=>Math.round(Math.max(0,Math.min(255,t))).toString(16).padStart(2,"0");return`#${s(t)}${s(e)}${s(n)}`}function Bt(t){const e=t/255;return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Vt(t){const e=t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055;return Math.round(255*e)}function Ot(t,e,n){const s=n*(Math.PI/180),i=e*Math.cos(s),o=e*Math.sin(s),r=t+.3963377774*i+.2158037573*o,a=t-.1055613458*i-.0638541728*o,l=t-.0894841775*i-1.291485548*o,c=r*r*r,u=a*a*a,d=l*l*l,h=-1.2684380046*c+2.6097574011*u-.3413193965*d,p=-.0041960863*c-.7034186147*u+1.707614701*d;return[Vt(4.0767416621*c-3.3077115913*u+.2309699292*d),Vt(h),Vt(p)]}function zt(t){const[e,n,s]=function(t){const e=t.replace("#","");return[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16)]}(t),[,i,o]=function(t,e,n){const s=Bt(t),i=Bt(e),o=Bt(n),r=.4122214708*s+.5363325363*i+.0514459929*o,a=.2119034982*s+.6806995451*i+.1073969566*o,l=.0883024619*s+.2817188376*i+.6299787005*o,c=Math.cbrt(r),u=Math.cbrt(a),d=Math.cbrt(l),h=.2104542553*c+.793617785*u-.0040720468*d,p=1.9779984951*c-2.428592205*u+.4505937099*d,m=.0259040371*c+.7827717662*u-.808675766*d,f=Math.sqrt(p*p+m*m);let g=Math.atan2(m,p)*(180/Math.PI);return g<0&&(g+=360),[h,f,g]}(e,n,s),r={};for(const a of Ft){const t=Rt[a],e=i*(1-.3*Math.abs(t-.5)),[n,s,l]=Ot(t,e,o);r[a]=_t(n,s,l)}return r}function $t(t){return"undefined"==typeof window?"":getComputedStyle(document.documentElement).getPropertyValue(t).trim()}function Wt(t,e){"undefined"!=typeof document&&document.documentElement.style.setProperty(t,e)}const Ut="u-off",Ht="u-label",Yt="width",qt="height",Gt="top",Xt="bottom",Kt="left",Jt="right",Zt="#000",Qt=Zt+"0",te="mousemove",ee="mousedown",ne="mouseup",se="mouseenter",ie="mouseleave",oe="dblclick",re="change",ae="dppxchange",le="--",ce="undefined"!=typeof window,ue=ce?document:null,de=ce?window:null,he=ce?navigator:null;let pe,me;function fe(t,e){if(null!=e){let n=t.classList;!n.contains(e)&&n.add(e)}}function ge(t,e){let n=t.classList;n.contains(e)&&n.remove(e)}function ye(t,e,n){t.style[e]=n+"px"}function ve(t,e,n,s){let i=ue.createElement(t);return null!=e&&fe(i,e),null!=n&&n.insertBefore(i,s),i}function xe(t,e){return ve("div",t,e)}const be=new WeakMap;function we(t,e,n,s,i){let o="translate("+e+"px,"+n+"px)";o!=be.get(t)&&(t.style.transform=o,be.set(t,o),e<0||n<0||e>s||n>i?fe(t,Ut):ge(t,Ut))}const ke=new WeakMap;function Se(t,e,n){let s=e+n;s!=ke.get(t)&&(ke.set(t,s),t.style.background=e,t.style.borderColor=n)}const Te=new WeakMap;function Ce(t,e,n,s){let i=e+""+n;i!=Te.get(t)&&(Te.set(t,i),t.style.height=n+"px",t.style.width=e+"px",t.style.marginLeft=s?-e/2+"px":0,t.style.marginTop=s?-n/2+"px":0)}const Me={passive:!0},Pe={...Me,capture:!0};function Ee(t,e,n,s){e.addEventListener(t,n,s?Pe:Me)}function je(t,e,n,s){e.removeEventListener(t,n,Me)}function Le(t,e,n,s){let i;n=n||0;let o=(s=s||e.length-1)<=2147483647;for(;s-n>1;)i=o?n+s>>1:Xe((n+s)/2),e[i]{let i=-1,o=-1;for(let r=n;r<=s;r++)if(t(e[r])){i=r;break}for(let r=s;r>=n;r--)if(t(e[r])){o=r;break}return[i,o]}}ce&&function t(){let e=devicePixelRatio;pe!=e&&(pe=e,me&&je(re,me,t),me=matchMedia(`(min-resolution: ${pe-.001}dppx) and (max-resolution: ${pe+.001}dppx)`),Ee(re,me,t),de.dispatchEvent(new CustomEvent(ae)))}();const De=t=>null!=t,Ne=t=>null!=t&&t>0,Re=Ae(De),Fe=Ae(Ne);function Ie(t,e,n,s){let i=en(t),o=en(e);t==e&&(-1==i?(t*=n,e/=n):(t/=n,e*=n));let r=10==n?nn:sn,a=1==o?Je:Xe,l=(1==i?Xe:Je)(r(Ge(t))),c=a(r(Ge(e))),u=tn(n,l),d=tn(n,c);return 10==n&&(l<0&&(u=wn(u,-l)),c<0&&(d=wn(d,-c))),s||2==n?(t=u*i,e=d*o):(t=bn(t,u),e=xn(e,d)),[t,e]}function _e(t,e,n,s){let i=Ie(t,e,n,s);return 0==t&&(i[0]=0),0==e&&(i[1]=0),i}const Be={mode:3,pad:.1},Ve={pad:0,soft:null,mode:0},Oe={min:Ve,max:Ve};function ze(t,e,n,s){return An(n)?We(t,e,n):(Ve.pad=n,Ve.soft=s?0:null,Ve.mode=s?3:0,We(t,e,Oe))}function $e(t,e){return null==t?e:t}function We(t,e,n){let s=n.min,i=n.max,o=$e(s.pad,0),r=$e(i.pad,0),a=$e(s.hard,-rn),l=$e(i.hard,rn),c=$e(s.soft,rn),u=$e(i.soft,-rn),d=$e(s.mode,0),h=$e(i.mode,0),p=e-t,m=nn(p),f=Qe(Ge(t),Ge(e)),g=nn(f),y=Ge(g-m);(p<1e-24||y>10)&&(p=0,0!=t&&0!=e||(p=1e-24,2==d&&c!=rn&&(o=0),2==h&&u!=-rn&&(r=0)));let v=p||f||1e3,x=nn(v),b=tn(10,Xe(x)),w=wn(bn(t-v*(0==p?0==t?.1:1:o),b/10),24),k=t>=c&&(1==d||3==d&&w<=c||2==d&&w>=c)?c:rn,S=Qe(a,w=k?k:Ze(k,w)),T=wn(xn(e+v*(0==p?0==e?.1:1:r),b/10),24),C=e<=u&&(1==h||3==h&&T>=u||2==h&&T<=u)?u:-rn,M=Ze(l,T>C&&e<=C?C:Qe(C,T));return S==M&&0==S&&(M=100),[S,M]}const Ue=new Intl.NumberFormat(ce?he.language:"en-US"),He=t=>Ue.format(t),Ye=Math,qe=Ye.PI,Ge=Ye.abs,Xe=Ye.floor,Ke=Ye.round,Je=Ye.ceil,Ze=Ye.min,Qe=Ye.max,tn=Ye.pow,en=Ye.sign,nn=Ye.log10,sn=Ye.log2,on=(t,e=1)=>Ye.asinh(t/e),rn=1/0;function an(t){return 1+(0|nn((t^t>>31)-(t>>31)))}function ln(t,e,n){return Ze(Qe(t,e),n)}function cn(t){return"function"==typeof t}function un(t){return cn(t)?t:()=>t}const dn=t=>t,hn=(t,e)=>e,pn=t=>null,mn=t=>!0,fn=(t,e)=>t==e,gn=/\.\d*?(?=9{6,}|0{6,})/gm,yn=t=>{if(jn(t)||kn.has(t))return t;const e=`${t}`,n=e.match(gn);if(null==n)return t;let s=n[0].length-1;if(-1!=e.indexOf("e-")){let[t,n]=e.split("e");return+`${yn(t)}e${n}`}return wn(t,s)};function vn(t,e){return yn(wn(yn(t/e))*e)}function xn(t,e){return yn(Je(yn(t/e))*e)}function bn(t,e){return yn(Xe(yn(t/e))*e)}function wn(t,e=0){if(jn(t))return t;let n=10**e,s=t*n*(1+Number.EPSILON);return Ke(s)/n}const kn=new Map;function Sn(t){return((""+t).split(".")[1]||"").length}function Tn(t,e,n,s){let i=[],o=s.map(Sn);for(let r=e;r=0?0:e)+(r>=o[a]?0:o[a]),u=10==t?l:wn(l,c);i.push(u),kn.set(u,c)}}return i}const Cn={},Mn=[],Pn=[null,null],En=Array.isArray,jn=Number.isInteger;function Ln(t){return"string"==typeof t}function An(t){let e=!1;if(null!=t){let n=t.constructor;e=null==n||n==Object}return e}function Dn(t){return null!=t&&"object"==typeof t}const Nn=Object.getPrototypeOf(Uint8Array),Rn="__proto__";function Fn(t,e=An){let n;if(En(t)){let s=t.find(t=>null!=t);if(En(s)||e(s)){n=Array(t.length);for(let s=0;so){for(s=r-1;s>=0&&null==t[s];)t[s--]=null;for(s=r+1;sPromise.resolve().then(t):queueMicrotask,Vn=["January","February","March","April","May","June","July","August","September","October","November","December"],On=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function zn(t){return t.slice(0,3)}const $n=On.map(zn),Wn=Vn.map(zn),Un={MMMM:Vn,MMM:Wn,WWWW:On,WWW:$n};function Hn(t){return(t<10?"0":"")+t}const Yn={YYYY:t=>t.getFullYear(),YY:t=>(t.getFullYear()+"").slice(2),MMMM:(t,e)=>e.MMMM[t.getMonth()],MMM:(t,e)=>e.MMM[t.getMonth()],MM:t=>Hn(t.getMonth()+1),M:t=>t.getMonth()+1,DD:t=>Hn(t.getDate()),D:t=>t.getDate(),WWWW:(t,e)=>e.WWWW[t.getDay()],WWW:(t,e)=>e.WWW[t.getDay()],HH:t=>Hn(t.getHours()),H:t=>t.getHours(),h:t=>{let e=t.getHours();return 0==e?12:e>12?e-12:e},AA:t=>t.getHours()>=12?"PM":"AM",aa:t=>t.getHours()>=12?"pm":"am",a:t=>t.getHours()>=12?"p":"a",mm:t=>Hn(t.getMinutes()),m:t=>t.getMinutes(),ss:t=>Hn(t.getSeconds()),s:t=>t.getSeconds(),fff:t=>{return((e=t.getMilliseconds())<10?"00":e<100?"0":"")+e;var e}};function qn(t,e){e=e||Un;let n,s=[],i=/\{([a-z]+)\}|[^{]+/gi;for(;n=i.exec(t);)s.push("{"==n[0][0]?Yn[n[1]]:n[0]);return t=>{let n="";for(let i=0;it%1==0,Kn=[1,2,2.5,5],Jn=Tn(10,-32,0,Kn),Zn=Tn(10,0,32,Kn),Qn=Zn.filter(Xn),ts=Jn.concat(Zn),es="{YYYY}",ns="\n"+es,ss="{M}/{D}",is="\n"+ss,os=is+"/{YY}",rs="{aa}",as="{h}:{mm}"+rs,ls="\n"+as,cs=":{ss}",us=null;function ds(t){let e=1e3*t,n=60*e,s=60*n,i=24*s,o=30*i,r=365*i;return[(1==t?Tn(10,0,3,Kn).filter(Xn):Tn(10,-3,0,Kn)).concat([e,5*e,10*e,15*e,30*e,n,5*n,10*n,15*n,30*n,s,2*s,3*s,4*s,6*s,8*s,12*s,i,2*i,3*i,4*i,5*i,6*i,7*i,8*i,9*i,10*i,15*i,o,2*o,3*o,4*o,6*o,r,2*r,5*r,10*r,25*r,50*r,100*r]),[[r,es,us,us,us,us,us,us,1],[28*i,"{MMM}",ns,us,us,us,us,us,1],[i,ss,ns,us,us,us,us,us,1],[s,"{h}"+rs,os,us,is,us,us,us,1],[n,as,os,us,is,us,us,us,1],[e,cs,os+" "+as,us,is+" "+as,us,ls,us,1],[t,cs+".{fff}",os+" "+as,us,is+" "+as,us,ls,us,1]],function(e){return(a,l,c,u,d,h)=>{let p=[],m=d>=r,f=d>=o&&d=i?i:d,r=x+(Xe(c)-Xe(y))+xn(y-x,o);p.push(r);let m=e(r),f=m.getHours()+m.getMinutes()/n+m.getSeconds()/s,g=d/s,v=h/a.axes[l]._space;for(;r=wn(r+d,1==t?0:3),!(r>u);)if(g>1){let t=Xe(wn(f+g,6))%24,n=e(r).getHours()-t;n>1&&(n=-1),r-=n*s,f=(f+g)%24,wn((r-p[p.length-1])/d,3)*v>=.7&&p.push(r)}else p.push(r)}return p}}]}const[hs,ps,ms]=ds(1),[fs,gs,ys]=ds(.001);function vs(t,e){return t.map(t=>t.map((n,s)=>0==s||8==s||null==n?n:e(1==s||0==t[8]?n:t[1]+n)))}function xs(t,e){return(n,s,i,o,r)=>{let a,l,c,u,d,h,p=e.find(t=>r>=t[0])||e[e.length-1];return s.map(e=>{let n=t(e),s=n.getFullYear(),i=n.getMonth(),o=n.getDate(),r=n.getHours(),m=n.getMinutes(),f=n.getSeconds(),g=s!=a&&p[2]||i!=l&&p[3]||o!=c&&p[4]||r!=u&&p[5]||m!=d&&p[6]||f!=h&&p[7]||p[1];return a=s,l=i,c=o,u=r,d=m,h=f,g(n)})}}function bs(t,e,n){return new Date(t,e,n)}function ws(t,e){return e(t)}function ks(t,e){return(n,s,i,o)=>null==o?le:e(t(s))}Tn(2,-53,53,[1]);const Ss={show:!0,live:!0,isolate:!1,mount:()=>{},markers:{show:!0,width:2,stroke:function(t,e){let n=t.series[e];return n.width?n.stroke(t,e):n.points.width?n.points.stroke(t,e):null},fill:function(t,e){return t.series[e].fill(t,e)},dash:"solid"},idx:null,idxs:null,values:[]},Ts=[0,0];function Cs(t,e,n,s=!0){return t=>{0==t.button&&(!s||t.target==e)&&n(t)}}function Ms(t,e,n,s=!0){return t=>{(!s||t.target==e)&&n(t)}}const Ps={show:!0,x:!0,y:!0,lock:!1,move:function(t,e,n){return Ts[0]=e,Ts[1]=n,Ts},points:{one:!1,show:function(t,e){let n=t.cursor.points,s=xe(),i=n.size(t,e);ye(s,Yt,i),ye(s,qt,i);let o=i/-2;ye(s,"marginLeft",o),ye(s,"marginTop",o);let r=n.width(t,e,i);return r&&ye(s,"borderWidth",r),s},size:function(t,e){return t.series[e].points.size},width:0,stroke:function(t,e){let n=t.series[e].points;return n._stroke||n._fill},fill:function(t,e){let n=t.series[e].points;return n._fill||n._stroke}},bind:{mousedown:Cs,mouseup:Cs,click:Cs,dblclick:Cs,mousemove:Ms,mouseleave:Ms,mouseenter:Ms},drag:{setScale:!0,x:!0,y:!1,dist:0,uni:null,click:(t,e)=>{e.stopPropagation(),e.stopImmediatePropagation()},_x:!1,_y:!1},focus:{dist:(t,e,n,s,i)=>s-i,prox:-1,bias:0},hover:{skip:[void 0],prox:null,bias:0},left:-10,top:-10,idx:null,dataIdx:null,idxs:null,event:null},Es={show:!0,stroke:"rgba(0,0,0,0.07)",width:2},js=In({},Es,{filter:hn}),Ls=In({},js,{size:10}),As=In({},Es,{show:!1}),Ds='12px system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',Ns="bold "+Ds,Rs={show:!0,scale:"x",stroke:Zt,space:50,gap:5,alignTo:1,size:50,labelGap:0,labelSize:30,labelFont:Ns,side:2,grid:js,ticks:Ls,border:As,font:Ds,lineGap:1.5,rotate:0},Fs={show:!0,scale:"x",auto:!1,sorted:1,min:rn,max:-rn,idxs:[]};function Is(t,e,n,s,i){return e.map(t=>null==t?"":He(t))}function _s(t,e,n,s,i,o,r){let a=[],l=kn.get(i)||0;for(let c=n=r?n:wn(xn(n,i),l);c<=s;c=wn(c+i,l))a.push(Object.is(c,-0)?0:c);return a}function Bs(t,e,n,s,i,o,r){const a=[],l=t.scales[t.axes[e].scale].log,c=Xe((10==l?nn:sn)(n));i=tn(l,c),10==l&&(i=ts[Le(i,ts)]);let u=n,d=i*l;10==l&&(d=ts[Le(d,ts)]);do{a.push(u),u+=i,10!=l||kn.has(u)||(u=wn(u,kn.get(i))),u>=d&&(d=(i=u)*l,10==l&&(d=ts[Le(d,ts)]))}while(u<=s);return a}function Vs(t,e,n,s,i,o,r){let a=t.scales[t.axes[e].scale].asinh,l=s>a?Bs(t,e,Qe(a,n),s,i):[a],c=s>=0&&n<=0?[0]:[];return(n<-a?Bs(t,e,Qe(a,-s),-n,i):[a]).reverse().map(t=>-t).concat(c,l)}const Os=/./,zs=/[12357]/,$s=/[125]/,Ws=/1/,Us=(t,e,n,s)=>t.map((t,i)=>4==e&&0==t||i%s==0&&n.test(t.toExponential()[t<0?1:0])?t:null);function Hs(t,e,n,s,i){let o=t.axes[n],r=o.scale,a=t.scales[r],l=t.valToPos,c=o._space,u=l(10,r),d=l(9,r)-u>=c?Os:l(7,r)-u>=c?zs:l(5,r)-u>=c?$s:Ws;if(d==Ws){let t=Ge(l(1,r)-u);if(ti,Js={show:!0,auto:!0,sorted:0,gaps:Ks,alpha:1,facets:[In({},Xs,{scale:"x"}),In({},Xs,{scale:"y"})]},Zs={scale:"y",auto:!0,sorted:0,show:!0,spanGaps:!1,gaps:Ks,alpha:1,points:{show:function(t,e){let{scale:n,idxs:s}=t.series[0],i=t._data[0],o=t.valToPos(i[s[0]],n,!0),r=t.valToPos(i[s[1]],n,!0),a=Ge(r-o)/(t.series[e].points.space*pe);return s[1]-s[0]<=a},filter:null},values:null,min:rn,max:-rn,idxs:[],path:null,clip:null};function Qs(t,e,n,s,i){return n/10}const ti={time:!0,auto:!0,distr:1,log:10,asinh:1,min:null,max:null,dir:1,ori:0},ei=In({},ti,{time:!1,ori:1}),ni={};function si(t,e){let n=ni[t];return n||(n={key:t,plots:[],sub(t){n.plots.push(t)},unsub(t){n.plots=n.plots.filter(e=>e!=t)},pub(t,e,s,i,o,r,a){for(let l=0;l{let f=t.pxRound;const g=a.dir*(0==a.ori?1:-1),y=0==a.ori?mi:fi;let v,x;1==g?(v=n,x=s):(v=s,x=n);let b=f(c(e[v],a,p,d)),w=f(u(r[v],l,m,h)),k=f(c(e[x],a,p,d)),S=f(u(1==o?l.max:l.min,l,m,h)),T=new Path2D(i);return y(T,k,S),y(T,b,S),y(T,b,w),T})}function li(t,e,n,s,i,o){let r=null;if(t.length>0){r=new Path2D;const a=0==e?gi:yi;let l=n;for(let e=0;en[0]){let t=n[0]-l;t>0&&a(r,l,s,t,s+o),l=n[1]}}let c=n+i-l,u=10;c>0&&a(r,l,s-u/2,c,s+o+u)}return r}function ci(t,e,n,s,i,o,r){let a=[],l=t.length;for(let c=1==i?n:s;c>=n&&c<=s;c+=i)if(null===e[c]){let u=c,d=c;if(1==i)for(;++c<=s&&null===e[c];)d=c;else for(;--c>=n&&null===e[c];)d=c;let h=o(t[u]),p=d==u?h:o(t[d]),m=u-i;h=r<=0&&m>=0&&m=0&&f>=0&&f=h&&a.push([h,p])}return a}function ui(t){return 0==t?dn:1==t?Ke:e=>vn(e,t)}function di(t){let e=0==t?hi:pi,n=0==t?(t,e,n,s,i,o)=>{t.arcTo(e,n,s,i,o)}:(t,e,n,s,i,o)=>{t.arcTo(n,e,i,s,o)},s=0==t?(t,e,n,s,i)=>{t.rect(e,n,s,i)}:(t,e,n,s,i)=>{t.rect(n,e,i,s)};return(t,i,o,r,a,l=0,c=0)=>{0==l&&0==c?s(t,i,o,r,a):(l=Ze(l,r/2,a/2),c=Ze(c,r/2,a/2),e(t,i+l,o),n(t,i+r,o,i+r,o+a,l),n(t,i+r,o+a,i,o+a,c),n(t,i,o+a,i,o,c),n(t,i,o,i+r,o,l),t.closePath())}}const hi=(t,e,n)=>{t.moveTo(e,n)},pi=(t,e,n)=>{t.moveTo(n,e)},mi=(t,e,n)=>{t.lineTo(e,n)},fi=(t,e,n)=>{t.lineTo(n,e)},gi=di(0),yi=di(1),vi=(t,e,n,s,i,o)=>{t.arc(e,n,s,i,o)},xi=(t,e,n,s,i,o)=>{t.arc(n,e,s,i,o)},bi=(t,e,n,s,i,o,r)=>{t.bezierCurveTo(e,n,s,i,o,r)},wi=(t,e,n,s,i,o,r)=>{t.bezierCurveTo(n,e,i,s,r,o)};function ki(t){return(t,e,n,s,i)=>ii(t,e,(e,o,r,a,l,c,u,d,h,p,m)=>{let f,g,{pxRound:y,points:v}=e;0==a.ori?(f=hi,g=vi):(f=pi,g=xi);const x=wn(v.width*pe,3);let b=(v.size-v.width)/2*pe,w=wn(2*b,3),k=new Path2D,S=new Path2D,{left:T,top:C,width:M,height:P}=t.bbox;gi(S,T-w,C-w,M+2*w,P+2*w);const E=t=>{if(null!=r[t]){let e=y(c(o[t],a,p,d)),n=y(u(r[t],l,m,h));f(k,e+b,n),g(k,e,n,b,0,2*qe)}};if(i)i.forEach(E);else for(let t=n;t<=s;t++)E(t);return{stroke:x>0?k:null,fill:k,clip:S,flags:3}})}function Si(t){return(e,n,s,i,o,r)=>{s!=i&&(o!=s&&r!=s&&t(e,n,s),o!=i&&r!=i&&t(e,n,i),t(e,n,r))}}const Ti=Si(mi),Ci=Si(fi);function Mi(t){const e=$e(null==t?void 0:t.alignGaps,0);return(t,n,s,i)=>ii(t,n,(o,r,a,l,c,u,d,h,p,m,f)=>{[s,i]=Re(a,s,i);let g,y,v=o.pxRound,x=t=>v(u(t,l,m,h)),b=t=>v(d(t,c,f,p));0==l.ori?(g=mi,y=Ti):(g=fi,y=Ci);const w=l.dir*(0==l.ori?1:-1),k={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:1},S=k.stroke;let T=!1;if(i-s>=4*m){let e,n,o,c=e=>t.posToVal(e,l.key,!0),u=null,d=null,h=x(r[1==w?s:i]),p=x(r[s]),m=x(r[i]),f=c(1==w?p+1:m-1);for(let t=1==w?s:i;t>=s&&t<=i;t+=w){let s=r[t],i=(1==w?sf)?h:x(s),o=a[t];i==h?null!=o?(n=o,null==u?(g(S,i,b(n)),e=u=d=n):nd&&(d=n)):null===o&&(T=!0):(null!=u&&y(S,h,b(u),b(d),b(e),b(n)),null!=o?(n=o,g(S,i,b(n)),u=d=e=n):(u=d=null,null===o&&(T=!0)),h=i,f=c(h+w))}null!=u&&u!=d&&o!=h&&y(S,h,b(u),b(d),b(e),b(n))}else for(let t=1==w?s:i;t>=s&&t<=i;t+=w){let e=a[t];null===e?T=!0:null!=e&&g(S,x(r[t]),b(e))}let[C,M]=oi(t,n);if(null!=o.fill||0!=C){let e=k.fill=new Path2D(S),a=b(o.fillTo(t,n,o.min,o.max,C)),l=x(r[s]),c=x(r[i]);-1==w&&([c,l]=[l,c]),g(e,c,a),g(e,l,a)}if(!o.spanGaps){let c=[];T&&c.push(...ci(r,a,s,i,w,x,e)),k.gaps=c=o.gaps(t,n,s,i,c),k.clip=li(c,l.ori,h,p,m,f)}return 0!=M&&(k.band=2==M?[ai(t,n,s,i,S,-1),ai(t,n,s,i,S,1)]:ai(t,n,s,i,S,M)),k})}function Pi(t,e,n,s,i,o,r=rn){if(t.length>1){let a=null;for(let l=0,c=1/0;l0!=s[t]>0?n[t]=0:(n[t]=3*(l[t-1]+l[t])/((2*l[t]+l[t-1])/s[t-1]+(l[t]+2*l[t-1])/s[t]),isFinite(n[t])||(n[t]=0));n[r-1]=s[r-2];for(let c=0;c{Ui.pxRatio=pe}));const Ai=Mi(),Di=ki();function Ni(t,e,n,s){return(s?[t[0],t[1]].concat(t.slice(2)):[t[0]].concat(t.slice(1))).map((t,s)=>Ri(t,s,e,n))}function Ri(t,e,n,s){return In({},0==e?n:s,t)}function Fi(t,e,n){return null==e?Pn:[e,n]}const Ii=Fi;function _i(t,e,n){return null==e?Pn:ze(e,n,.1,!0)}function Bi(t,e,n,s){return null==e?Pn:Ie(e,n,t.scales[s].log,!1)}const Vi=Bi;function Oi(t,e,n,s){return null==e?Pn:_e(e,n,t.scales[s].log,!1)}const zi=Oi;function $i(t){let e,n;return[t=t.replace(/(\d+)px/,(t,s)=>(e=Ke((n=+s)*pe))+"px"),e,n]}function Wi(t){t.show&&[t.font,t.labelFont].forEach(t=>{let e=wn(t[2]*pe,1);t[0]=t[0].replace(/[0-9.]+px/,e+"px"),t[1]=e})}function Ui(t,e,n){const s={mode:$e(t.mode,1)},i=s.mode;function o(t,e,n,s){let i=e.valToPct(t);return s+n*(-1==e.dir?1-i:i)}function r(t,e,n,s){let i=e.valToPct(t);return s+n*(-1==e.dir?i:1-i)}function a(t,e,n,s){return 0==e.ori?o(t,e,n,s):r(t,e,n,s)}s.valToPosH=o,s.valToPosV=r;let l=!1;s.status=0;const c=s.root=xe("uplot");null!=t.id&&(c.id=t.id),fe(c,t.class),t.title&&(xe("u-title",c).textContent=t.title);const u=ve("canvas"),d=s.ctx=u.getContext("2d"),h=xe("u-wrap",c);Ee("click",h,t=>{t.target===m&&(Jn!=Yn||Zn!=Gn)&&cs.click(s,t)},!0);const p=s.under=xe("u-under",h);h.appendChild(u);const m=s.over=xe("u-over",h),f=+$e((t=Fn(t)).pxAlign,1),g=ui(f);(t.plugins||[]).forEach(e=>{e.opts&&(t=e.opts(s,t)||t)});const y=t.ms||.001,v=s.series=1==i?Ni(t.series||[],Fs,Zs,!1):(x=t.series||[null],b=Js,x.map((t,e)=>0==e?{}:In({},b,t)));var x,b;const w=s.axes=Ni(t.axes||[],Rs,Gs,!0),k=s.scales={},S=s.bands=t.bands||[];S.forEach(t=>{t.fill=un(t.fill||null),t.dir=$e(t.dir,-1)});const T=2==i?v[1].facets[0].scale:v[0].scale,C={axes:function(){for(let t=0;tOe[t]):y,x=2==p.distr?Oe[y[1]]-Oe[y[0]]:u,b=e.ticks,S=e.border,T=b.show?b.size:0,C=Ke(T*pe),M=Ke((2==e.alignTo?e._size-T-e.gap:e.gap)*pe),P=e._rotate*-qe/180,E=g(e._pos*pe),j=E+(C+M)*c;i=0==r?j:0,n=1==r?j:0,en(e.font[0],l,1==e.align?Kt:2==e.align?Jt:P>0?Kt:P<0?Jt:0==r?"center":3==o?Jt:Kt,P||1==r?"middle":2==o?Gt:Xt);let L=e.font[1]*e.lineGap,A=y.map(t=>g(a(t,p,m,f))),D=e._values;for(let t=0;t0){let t=v.some(t=>t._focus)&&Ve!=Lt.alpha;t&&(d.globalAlpha=Ve=Lt.alpha),v.forEach((t,n)=>{if(n>0&&t.show&&(gn(n,!1),gn(n,!0),null==t._paths)){let o=Ve;Ve!=t.alpha&&(d.globalAlpha=Ve=t.alpha);let r=2==i?[0,e[n][0].length-1]:function(t){let e=ln(Wt-1,0,$t-1),n=ln(Zt+1,0,$t-1);for(;null==t[e]&&e>0;)e--;for(;null==t[n]&&n<$t-1;)n++;return[e,n]}(e[n]);t._paths=t.paths(s,n,r[0],r[1]),Ve!=o&&(d.globalAlpha=Ve=o)}}),v.forEach((t,e)=>{if(e>0&&t.show){let n=Ve;Ve!=t.alpha&&(d.globalAlpha=Ve=t.alpha),null!=t._paths&&yn(e,!1);{let n=null!=t._paths?t._paths.gaps:null,i=t.points.show(s,e,Wt,Zt,n),o=t.points.filter(s,e,i,n);(i||o)&&(t.points._paths=t.points.paths(s,e,Wt,Zt,o),yn(e,!0))}Ve!=n&&(d.globalAlpha=Ve=n),wi("drawSeries",e)}}),t&&(d.globalAlpha=Ve=1)}}},M=(t.drawOrder||["axes","series"]).map(t=>C[t]);function P(t){const e=3==t.distr?e=>nn(e>0?e:t.clamp(s,e,t.min,t.max,t.key)):4==t.distr?e=>on(e,t.asinh):100==t.distr?e=>t.fwd(e):t=>t;return n=>{let s=e(n),{_min:i,_max:o}=t;return(s-i)/(o-i)}}function E(e){let n=k[e];if(null==n){let s=(t.scales||Cn)[e]||Cn;if(null!=s.from){E(s.from);let t=In({},k[s.from],s,{key:e});t.valToPct=P(t),k[e]=t}else{n=k[e]=In({},e==T?ti:ei,s),n.key=e;let t=n.time,o=n.range,r=En(o);if((e!=T||2==i&&!t)&&(!r||null!=o[0]&&null!=o[1]||(o={min:null==o[0]?Be:{mode:1,hard:o[0],soft:o[0]},max:null==o[1]?Be:{mode:1,hard:o[1],soft:o[1]}},r=!1),!r&&An(o))){let t=o;o=(e,n,s)=>null==n?Pn:ze(n,s,t)}n.range=un(o||(t?Ii:e==T?3==n.distr?Vi:4==n.distr?zi:Fi:3==n.distr?Bi:4==n.distr?Oi:_i)),n.auto=un(!r&&n.auto),n.clamp=un(n.clamp||Qs),n._min=n._max=null,n.valToPct=P(n)}}}E("x"),E("y"),1==i&&v.forEach(t=>{E(t.scale)}),w.forEach(t=>{E(t.scale)});for(let Ut in t.scales)E(Ut);const j=k[T],L=j.distr;let A,D;0==j.ori?(fe(c,"u-hz"),A=o,D=r):(fe(c,"u-vt"),A=r,D=o);const N={};for(let Ut in k){let t=k[Ut];null==t.min&&null==t.max||(N[Ut]={min:t.min,max:t.max},t.min=t.max=null)}const R=t.tzDate||(t=>new Date(Ke(t/y))),F=t.fmtDate||qn,I=1==y?ms(R):ys(R),_=xs(R,vs(1==y?ps:gs,F)),B=ks(R,ws("{YYYY}-{MM}-{DD} {h}:{mm}{aa}",F)),V=[],O=s.legend=In({},Ss,t.legend),z=s.cursor=In({},Ps,{drag:{y:2==i}},t.cursor),$=O.show,W=z.show,U=O.markers;let H,Y,q;O.idxs=V,U.width=un(U.width),U.dash=un(U.dash),U.stroke=un(U.stroke),U.fill=un(U.fill);let G,X=[],K=[],J=!1,Z={};if(O.live){const t=v[1]?v[1].values:null;J=null!=t,G=J?t(s,1,0):{_:0};for(let e in G)Z[e]=le}if($)if(H=ve("table","u-legend",c),q=ve("tbody",null,H),O.mount(s,H),J){Y=ve("thead",null,H,q);let t=ve("tr",null,Y);for(var Q in ve("th",null,t),G)ve("th",Ht,t).textContent=Q}else fe(H,"u-inline"),O.live&&fe(H,"u-live");const tt={show:!0},et={show:!1},nt=new Map;function st(t,e,n,i=!0){const o=nt.get(e)||{},r=z.bind[t](s,e,n,i);r&&(Ee(t,e,o[t]=r),nt.set(e,o))}function it(t,e,n){const s=nt.get(e)||{};for(let i in s)null!=t&&i!=t||(je(i,e,s[i]),delete s[i]);null==t&&nt.delete(e)}let ot=0,rt=0,at=0,lt=0,ct=0,ut=0,dt=ct,ht=ut,pt=at,mt=lt,ft=0,gt=0,yt=0,vt=0;s.bbox={};let xt=!1,bt=!1,wt=!1,kt=!1,St=!1,Tt=!1;function Ct(t,e,n){(n||t!=s.width||e!=s.height)&&Mt(t,e),Vn(!1),wt=!0,bt=!0,os()}function Mt(t,e){s.width=ot=at=t,s.height=rt=lt=e,ct=ut=0,function(){let t=!1,e=!1,n=!1,s=!1;w.forEach((i,o)=>{if(i.show&&i._show){let{side:o,_size:r}=i,a=o%2,l=r+(null!=i.label?i.labelSize:0);l>0&&(a?(at-=l,3==o?(ct+=l,s=!0):n=!0):(lt-=l,0==o?(ut+=l,t=!0):e=!0))}}),Bt[0]=t,Bt[1]=n,Bt[2]=e,Bt[3]=s,at-=zt[1]+zt[3],ct+=zt[3],lt-=zt[2]+zt[0],ut+=zt[0]}(),function(){let t=ct+at,e=ut+lt,n=ct,s=ut;function i(i,o){switch(i){case 1:return t+=o,t-o;case 2:return e+=o,e-o;case 3:return n-=o,n+o;case 0:return s-=o,s+o}}w.forEach((t,e)=>{if(t.show&&t._show){let e=t.side;t._pos=i(e,t._size),null!=t.label&&(t._lpos=i(e,t.labelSize))}})}();let n=s.bbox;ft=n.left=vn(ct*pe,.5),gt=n.top=vn(ut*pe,.5),yt=n.width=vn(at*pe,.5),vt=n.height=vn(lt*pe,.5)}const Pt=3;if(s.setSize=function({width:t,height:e}){Ct(t,e)},null==z.dataIdx){let t=z.hover,n=t.skip=new Set(t.skip??[]);n.add(void 0);let s=t.prox=un(t.prox),i=t.bias??(t.bias=0);z.dataIdx=(t,o,r,a)=>{if(0==o)return r;let l=r,c=s(t,o,r,a)??rn,u=c>=0&&c0;)n.has(m[t])||(e=t);if(0==i||1==i)for(t=r;null==s&&t++c&&(l=null);return l}}const Et=t=>{z.event=t};z.idxs=V,z._lock=!1;let jt=z.points;jt.show=un(jt.show),jt.size=un(jt.size),jt.stroke=un(jt.stroke),jt.width=un(jt.width),jt.fill=un(jt.fill);const Lt=s.focus=In({},t.focus||{alpha:.3},z.focus),At=Lt.prox>=0,Dt=At&&jt.one;let Nt=[],Rt=[],Ft=[];function It(t,e){let n=jt.show(s,e);if(n instanceof HTMLElement)return fe(n,"u-cursor-pt"),fe(n,t.class),we(n,-10,-10,at,lt),m.insertBefore(n,Nt[e]),n}function _t(t,e){if(1==i||e>0){let e=1==i&&k[t.scale].time,n=t.value;t.value=e?Ln(n)?ks(R,ws(n,F)):n||B:n||qs,t.label=t.label||(e?"Time":"Value")}if(Dt||e>0){t.width=null==t.width?1:t.width,t.paths=t.paths||Ai||pn,t.fillTo=un(t.fillTo||ri),t.pxAlign=+$e(t.pxAlign,f),t.pxRound=ui(t.pxAlign),t.stroke=un(t.stroke||null),t.fill=un(t.fill||null),t._stroke=t._fill=t._paths=t._focus=null;let e=wn(1*(3+2*(Qe(1,t.width)||1)),3),n=t.points=In({},{size:e,width:Qe(1,.2*e),stroke:t.stroke,space:2*e,paths:Di,_stroke:null,_fill:null},t.points);n.show=un(n.show),n.filter=un(n.filter),n.fill=un(n.fill),n.stroke=un(n.stroke),n.paths=un(n.paths),n.pxAlign=t.pxAlign}if($){let n=function(t,e){if(0==e&&(J||!O.live||2==i))return Pn;let n=[],o=ve("tr","u-series",q,q.childNodes[e]);fe(o,t.class),t.show||fe(o,Ut);let r=ve("th",null,o);if(U.show){let t=xe("u-marker",r);if(e>0){let n=U.width(s,e);n&&(t.style.border=n+"px "+U.dash(s,e)+" "+U.stroke(s,e)),t.style.background=U.fill(s,e)}}let a=xe(Ht,r);for(var l in t.label instanceof HTMLElement?a.appendChild(t.label):a.textContent=t.label,e>0&&(U.show||(a.style.color=t.width>0?U.stroke(s,e):U.fill(s,e)),st("click",r,e=>{if(z._lock)return;Et(e);let n=v.indexOf(t);if((e.ctrlKey||e.metaKey)!=O.isolate){let t=v.some((t,e)=>e>0&&e!=n&&t.show);v.forEach((e,s)=>{s>0&&Es(s,t?s==n?tt:et:tt,!0,Si.setSeries)})}else Es(n,{show:!t.show},!0,Si.setSeries)},!1),At&&st(se,r,e=>{z._lock||(Et(e),Es(v.indexOf(t),Ds,!0,Si.setSeries))},!1)),G){let t=ve("td","u-value",o);t.textContent="--",n.push(t)}return[o,n]}(t,e);X.splice(e,0,n[0]),K.splice(e,0,n[1]),O.values.push(null)}if(W){V.splice(e,0,null);let n=null;Dt?0==e&&(n=It(t,e)):e>0&&(n=It(t,e)),Nt.splice(e,0,n),Rt.splice(e,0,0),Ft.splice(e,0,0)}wi("addSeries",e)}s.addSeries=function(t,e){e=null==e?v.length:e,t=1==i?Ri(t,e,Fs,Zs):Ri(t,e,{},Js),v.splice(e,0,t),_t(v[e],e)},s.delSeries=function(t){if(v.splice(t,1),$){O.values.splice(t,1),K.splice(t,1);let e=X.splice(t,1)[0];it(null,e.firstChild),e.remove()}W&&(V.splice(t,1),Nt.splice(t,1)[0].remove(),Rt.splice(t,1),Ft.splice(t,1)),wi("delSeries",t)};const Bt=[!1,!1,!1,!1];function Vt(t,e,n,s){let[i,o,r,a]=n,l=e%2,c=0;return 0==l&&(a||o)&&(c=0==e&&!i||2==e&&!r?Ke(Rs.size/3):0),1==l&&(i||r)&&(c=1==e&&!o||3==e&&!a?Ke(Gs.size/2):0),c}const Ot=s.padding=(t.padding||[Vt,Vt,Vt,Vt]).map(t=>un($e(t,Vt))),zt=s._padding=Ot.map((t,e)=>t(s,e,Bt,0));let $t,Wt=null,Zt=null;const re=1==i?v[0].idxs:null;let ce,he,me,be,ke,Te,Me,Pe,Ae,Ve,Oe=null,We=!1;function Ue(t,n){if(e=null==t?[]:t,s.data=s._data=e,2==i){$t=0;for(let t=1;t=0,Tt=!0,os()}}function He(){let t,n;We=!0,1==i&&($t>0?(Wt=re[0]=0,Zt=re[1]=$t-1,t=e[0][Wt],n=e[0][Zt],2==L?(t=Wt,n=Zt):t==n&&(3==L?[t,n]=Ie(t,t,j.log,!1):4==L?[t,n]=_e(t,t,j.log,!1):j.time?n=t+Ke(86400/y):[t,n]=ze(t,n,.1,!0))):(Wt=re[0]=t=null,Zt=re[1]=n=null)),Ms(T,t,n)}function Xe(t,e,n,s,i,o){t??(t=Qt),n??(n=Mn),s??(s="butt"),i??(i=Qt),o??(o="round"),t!=ce&&(d.strokeStyle=ce=t),i!=he&&(d.fillStyle=he=i),e!=me&&(d.lineWidth=me=e),o!=ke&&(d.lineJoin=ke=o),s!=Te&&(d.lineCap=Te=s),n!=be&&d.setLineDash(be=n)}function en(t,e,n,s){e!=he&&(d.fillStyle=he=e),t!=Me&&(d.font=Me=t),n!=Pe&&(d.textAlign=Pe=n),s!=Ae&&(d.textBaseline=Ae=s)}function sn(t,e,n,i,o=0){if(i.length>0&&t.auto(s,We)&&(null==e||null==e.min)){let e=$e(Wt,0),s=$e(Zt,i.length-1),r=null==n.min?function(t,e,n,s=0,i=!1){let o=i?Fe:Re,r=i?Ne:De;[e,n]=o(t,e,n);let a=t[e],l=t[e];if(e>-1)if(1==s)a=t[e],l=t[n];else if(-1==s)a=t[n],l=t[e];else for(let c=e;c<=n;c++){let e=t[c];r(e)&&(el&&(l=e))}return[a??rn,l??-rn]}(i,e,s,o,3==t.distr):[n.min,n.max];t.min=Ze(t.min,n.min=r[0]),t.max=Qe(t.max,n.max=r[1])}}s.setData=Ue;const dn={min:null,max:null};function gn(t,e){let n=e?v[t].points:v[t];n._stroke=n.stroke(s,t),n._fill=n.fill(s,t)}function yn(t,n){let i=n?v[t].points:v[t],{stroke:o,fill:r,clip:a,flags:l,_stroke:c=i._stroke,_fill:u=i._fill,_width:h=i.width}=i._paths;h=wn(h*pe,3);let p=null,m=h%2/2;n&&null==u&&(u=h>0?"#fff":c);let f=1==i.pxAlign&&m>0;if(f&&d.translate(m,m),!n){let t=ft-h/2,e=gt-h/2,n=yt+h,s=vt+h;p=new Path2D,p.rect(t,e,n,s)}n?bn(c,h,i.dash,i.cap,u,o,r,l,a):function(t,n,i,o,r,a,l,c,u,d,h){let p=!1;0!=u&&S.forEach((m,f)=>{if(m.series[0]==t){let t,g=v[m.series[1]],y=e[m.series[1]],x=(g._paths||Cn).band;En(x)&&(x=1==m.dir?x[0]:x[1]);let b=null;g.show&&x&&function(t,e,n){for(e=$e(e,0),n=$e(n,t.length-1);e<=n;){if(null!=t[e])return!0;e++}return!1}(y,Wt,Zt)?(b=m.fill(s,f)||a,t=g._paths.clip):x=null,bn(n,i,o,r,b,l,c,u,d,h,t,x),p=!0}}),p||bn(n,i,o,r,a,l,c,u,d,h)}(t,c,h,i.dash,i.cap,u,o,r,l,p,a),f&&d.translate(-m,-m)}const xn=3;function bn(t,e,n,s,i,o,r,a,l,c,u,h){Xe(t,e,n,s,i),(l||c||h)&&(d.save(),l&&d.clip(l),c&&d.clip(c)),h?(a&xn)==xn?(d.clip(h),u&&d.clip(u),jn(i,r),Tn(t,o,e)):2&a?(jn(i,r),d.clip(h),Tn(t,o,e)):1&a&&(d.save(),d.clip(h),u&&d.clip(u),jn(i,r),d.restore(),Tn(t,o,e)):(jn(i,r),Tn(t,o,e)),(l||c||h)&&d.restore()}function Tn(t,e,n){n>0&&(e instanceof Map?e.forEach((t,e)=>{d.strokeStyle=ce=e,d.stroke(t)}):null!=e&&t&&d.stroke(e))}function jn(t,e){e instanceof Map?e.forEach((t,e)=>{d.fillStyle=he=e,d.fill(t)}):null!=e&&t&&d.fill(e)}function Nn(t,e,n,s,i,o,r,a,l,c){let u=r%2/2;1==f&&d.translate(u,u),Xe(a,r,l,c,a),d.beginPath();let h,p,m,g,y=i+(0==s||3==s?-o:o);0==n?(p=i,g=y):(h=i,m=y);for(let f=0;f{if(!n.show)return;let o=k[n.scale];if(null==o.min)return void(n._show&&(e=!1,n._show=!1,Vn(!1)));n._show||(e=!1,n._show=!0,Vn(!1));let r=n.side,a=r%2,{min:l,max:c}=o,[u,d]=function(t,e,n,i){let o,r=w[t];if(i<=0)o=[0,0];else{let a=r._space=r.space(s,t,e,n,i);o=function(t,e,n,s,i){let o=Qe(an(t),an(e)),r=e-t,a=Le(i/s*r,n);do{let t=n[a],e=s*t/r;if(e>=i&&o+(t<5?kn.get(t):0)<=17)return[t,e]}while(++aOe[t]):p,f=2==o.distr?Oe[p[1]]-Oe[p[0]]:u,g=n._values=n.values(s,n.filter(s,m,i,d,f),i,d,f);n._rotate=2==r?n.rotate(s,g,i,d):0;let y=n._size;n._size=Je(n.size(s,g,i,t)),null!=y&&n._size!=y&&(e=!1)}),e}function _n(t){let e=!0;return Ot.forEach((n,i)=>{let o=n(s,i,Bt,t);o!=zt[i]&&(e=!1),zt[i]=o}),e}function Vn(t){v.forEach((e,n)=>{n>0&&(e._paths=null,t&&(1==i?(e.min=null,e.max=null):e.facets.forEach(t=>{t.min=null,t.max=null})))})}let On,zn,$n,Wn,Un,Hn,Yn,Gn,Xn,Kn,Jn,Zn,es=!1,ns=!1,ss=[];function is(){ns=!1;for(let t=0;t0){v.forEach((n,o)=>{if(1==i){let i=n.scale,r=N[i];if(null==r)return;let a=t[i];if(0==o){let t=a.range(s,a.min,a.max,i);a.min=t[0],a.max=t[1],Wt=Le(a.min,e[0]),Zt=Le(a.max,e[0]),Zt-Wt>1&&(e[0][Wt]a.max&&Zt--),n.min=Oe[Wt],n.max=Oe[Zt]}else n.show&&n.auto&&sn(a,r,n,e[o],n.sorted);n.idxs[0]=Wt,n.idxs[1]=Zt}else if(o>0&&n.show&&n.auto){let[s,i]=n.facets,r=s.scale,a=i.scale,[l,c]=e[o],u=t[r],d=t[a];null!=u&&sn(u,N[r],s,l,s.sorted),null!=d&&sn(d,N[a],i,c,i.sorted),n.min=i.min,n.max=i.max}});for(let e in t){let n=t[e],i=N[e];if(null==n.from&&(null==i||null==i.min)){let t=n.range(s,n.min==rn?null:n.min,n.max==-rn?null:n.max,e);n.min=t[0],n.max=t[1]}}}for(let e in t){let n=t[e];if(null!=n.from){let i=t[n.from];if(null==i.min)n.min=n.max=null;else{let t=n.range(s,i.min,i.max,e);n.min=t[0],n.max=t[1]}}}let n={},o=!1;for(let e in t){let s=t[e],i=k[e];if(i.min!=s.min||i.max!=s.max){i.min=s.min,i.max=s.max;let t=i.distr;i._min=3==t?nn(i.min):4==t?on(i.min,i.asinh):100==t?i.fwd(i.min):i.min,i._max=3==t?nn(i.max):4==t?on(i.max,i.asinh):100==t?i.fwd(i.max):i.max,n[e]=o=!0}}if(o){v.forEach((t,e)=>{2==i?e>0&&n.y&&(t._paths=null):n[t.scale]&&(t._paths=null)});for(let t in n)wt=!0,wi("setScale",t);W&&z.left>=0&&(kt=Tt=!0)}for(let e in N)N[e]=null}(),xt=!1),wt&&(function(){let t=!1,e=0;for(;!t;){e++;let n=Rn(e),i=_n(e);t=e==Pt||n&&i,t||(Mt(s.width,s.height),bt=!0)}}(),wt=!1),bt){if(ye(p,Kt,ct),ye(p,Gt,ut),ye(p,Yt,at),ye(p,qt,lt),ye(m,Kt,ct),ye(m,Gt,ut),ye(m,Yt,at),ye(m,qt,lt),ye(h,Yt,ot),ye(h,qt,rt),u.width=Ke(ot*pe),u.height=Ke(rt*pe),w.forEach(({_el:t,_show:e,_size:n,_pos:s,side:i})=>{if(null!=t)if(e){let e=i%2==1;ye(t,e?"left":"top",s-(3===i||0===i?n:0)),ye(t,e?"width":"height",n),ye(t,e?"top":"left",e?ut:ct),ye(t,e?"height":"width",e?lt:at),ge(t,Ut)}else fe(t,Ut)}),ce=he=me=ke=Te=Me=Pe=Ae=be=null,Ve=1,ii(!0),ct!=dt||ut!=ht||at!=pt||lt!=mt){Vn(!1);let t=at/pt,e=lt/mt;if(W&&!kt&&z.left>=0){z.left*=t,z.top*=e,$n&&we($n,Ke(z.left),0,at,lt),Wn&&we(Wn,0,Ke(z.top),at,lt);for(let n=0;n=0&&bs.width>0){bs.left*=t,bs.width*=t,bs.top*=e,bs.height*=e;for(let t in li)ye(Ts,t,bs[t])}dt=ct,ht=ut,pt=at,mt=lt}wi("setSize"),bt=!1}ot>0&&rt>0&&(d.clearRect(0,0,u.width,u.height),wi("drawClear"),M.forEach(t=>t()),wi("draw")),bs.show&&St&&(Cs(bs),St=!1),W&&kt&&(Ks(null,!0,!1),kt=!1),O.show&&O.live&&Tt&&(Us(),Tt=!1),l||(l=!0,s.status=1,wi("ready")),We=!1,es=!1}function as(t,n){let i=k[t];if(null==i.from){if(0==$t){let e=i.range(s,n.min,n.max,t);n.min=e[0],n.max=e[1]}if(n.min>n.max){let t=n.min;n.min=n.max,n.max=t}if($t>1&&null!=n.min&&null!=n.max&&n.max-n.min<1e-16)return;t==T&&2==i.distr&&$t>0&&(n.min=Le(n.min,e[0]),n.max=Le(n.max,e[0]),n.min==n.max&&n.max++),N[t]=n,xt=!0,os()}}s.batch=function(t,e=!1){es=!0,ns=e,t(s),rs(),e&&ss.length>0&&queueMicrotask(is)},s.redraw=(t,e)=>{wt=e||!1,!1!==t?Ms(T,j.min,j.max):os()},s.setScale=as;let ls=!1;const cs=z.drag;let us=cs.x,ds=cs.y;W&&(z.x&&(On=xe("u-cursor-x",m)),z.y&&(zn=xe("u-cursor-y",m)),0==j.ori?($n=On,Wn=zn):($n=zn,Wn=On),Jn=z.left,Zn=z.top);const bs=s.select=In({show:!0,over:!0,left:0,width:0,top:0,height:0},t.select),Ts=bs.show?xe("u-select",bs.over?m:p):null;function Cs(t,e){if(bs.show){for(let e in t)bs[e]=t[e],e in li&&ye(Ts,e,t[e]);!1!==e&&wi("setSelect")}}function Ms(t,e,n){as(t,{min:e,max:n})}function Es(t,e,n,o){null!=e.focus&&function(t){if(t!=As){let e=null==t,n=1!=Lt.alpha;v.forEach((s,o)=>{if(1==i||o>0){let i=e||0==o||o==t;s._focus=e?null:i,n&&function(t,e){v[t].alpha=e,W&&null!=Nt[t]&&(Nt[t].style.opacity=e),$&&X[t]&&(X[t].style.opacity=e)}(o,i?1:Lt.alpha)}}),As=t,n&&os()}}(t),null!=e.show&&v.forEach((n,s)=>{s>0&&(t==s||null==t)&&(n.show=e.show,function(t){if(v[t].show)$&&ge(X[t],Ut);else if($&&fe(X[t],Ut),W){let e=Dt?Nt[0]:Nt[t];null!=e&&we(e,-10,-10,at,lt)}}(s),2==i?(Ms(n.facets[0].scale,null,null),Ms(n.facets[1].scale,null,null)):Ms(n.scale,null,null),os())}),!1!==n&&wi("setSeries",t,e),o&&Mi("setSeries",s,t,e)}let js,Ls,As;s.setSelect=Cs,s.setSeries=Es,s.addBand=function(t,e){t.fill=un(t.fill||null),t.dir=$e(t.dir,-1),e=null==e?S.length:e,S.splice(e,0,t)},s.setBand=function(t,e){In(S[t],e)},s.delBand=function(t){null==t?S.length=0:S.splice(t,1)};const Ds={focus:!0};function Ns(t,e,n){let s=k[e];n&&(t=t/pe-(1==s.ori?ut:ct));let i=at;1==s.ori&&(i=lt,t=i-t),-1==s.dir&&(t=i-t);let o=s._min,r=o+(s._max-o)*(t/i),a=s.distr;return 3==a?tn(10,r):4==a?((t,e=1)=>Ye.sinh(t)*e)(r,s.asinh):100==a?s.bwd(r):r}function Os(t,e){ye(Ts,Kt,bs.left=t),ye(Ts,Yt,bs.width=e)}function zs(t,e){ye(Ts,Gt,bs.top=t),ye(Ts,qt,bs.height=e)}$&&At&&st(ie,H,t=>{z._lock||(Et(t),null!=As&&Es(null,Ds,!0,Si.setSeries))}),s.valToIdx=t=>Le(t,e[0]),s.posToIdx=function(t,n){return Le(Ns(t,T,n),e[0],Wt,Zt)},s.posToVal=Ns,s.valToPos=(t,e,n)=>0==k[e].ori?o(t,k[e],n?yt:at,n?ft:0):r(t,k[e],n?vt:lt,n?gt:0),s.setCursor=(t,e,n)=>{Jn=t.left,Zn=t.top,Ks(null,e,n)};let $s=0==j.ori?Os:zs,Ws=1==j.ori?Os:zs;function Us(t,e){if(null!=t&&(t.idxs?t.idxs.forEach((t,e)=>{V[e]=t}):void 0!==t.idx&&V.fill(t.idx),O.idx=V[0]),$&&O.live){for(let t=0;t0||1==i&&!J)&&Xs(t,V[t]);!function(){if($&&O.live)for(let t=2==i?1:0;tZt;js=rn,Ls=null;let l=0==j.ori?at:lt,c=1==j.ori?at:lt;if(Jn<0||0==$t||a){r=z.idx=null;for(let t=0;t0&&t.show){let n=null==b?-10:b==r?o:A(1==i?e[0][b]:e[g][0][b],j,l,0),y=null==w?-10:D(w,1==i?k[t.scale]:k[t.facets[1].scale],c,0);if(At&&null!=w){let e=1==j.ori?Jn:Zn,n=Ge(Lt.dist(s,g,b,y,e));if(n=0?1:-1;o==(w>=0?1:-1)&&(1==o?1==s?w>=i:w<=i:1==s?w<=i:w>=i)&&(js=n,Ls=g)}else js=n,Ls=g}}if(Tt||Dt){let t,e;0==j.ori?(t=n,e=y):(t=y,e=n);let i,o,r,l,c,v,x=!0,b=jt.bbox;if(null!=b){x=!1;let t=b(s,g);r=t.left,l=t.top,i=t.width,o=t.height}else r=t,l=e,i=o=jt.size(s,g);if(v=jt.fill(s,g),c=jt.stroke(s,g),Dt)g==Ls&&js<=Lt.prox&&(a=r,u=l,d=i,h=o,p=x,m=v,f=c);else{let t=Nt[g];null!=t&&(Rt[g]=r,Ft[g]=l,Ce(t,i,o,x),Se(t,v,c),we(t,Je(r),Je(l),at,lt))}}}}if(Dt){let t=Lt.prox;if(Tt||(null==As?js<=t:js>t||Ls!=As)){let t=Nt[0];null!=t&&(Rt[0]=a,Ft[0]=u,Ce(t,d,h,p),Se(t,m,f),we(t,Je(a),Je(u),at,lt))}}}if(bs.show&&ls)if(null!=t){let[e,n]=Si.scales,[s,i]=Si.match,[o,r]=t.cursor.sync.scales,a=t.cursor.drag;if(us=a._x,ds=a._y,us||ds){let a,u,d,h,p,{left:m,top:f,width:g,height:y}=t.select,v=t.scales[o].ori,x=t.posToVal,b=null!=e&&s(e,o),w=null!=n&&i(n,r);b&&us?(0==v?(a=m,u=g):(a=f,u=y),d=k[e],h=A(x(a,o),d,l,0),p=A(x(a+u,o),d,l,0),$s(Ze(h,p),Ge(p-h))):$s(0,l),w&&ds?(1==v?(a=m,u=g):(a=f,u=y),d=k[n],h=D(x(a,r),d,c,0),p=D(x(a+u,r),d,c,0),Ws(Ze(h,p),Ge(p-h))):Ws(0,c)}else ci()}else{let t=Ge(Xn-Un),e=Ge(Kn-Hn);if(1==j.ori){let n=t;t=e,e=n}us=cs.x&&t>=cs.dist,ds=cs.y&&e>=cs.dist;let n,s,i=cs.uni;null!=i?us&&ds&&(us=t>=i,ds=e>=i,us||ds||(e>t?ds=!0:us=!0)):cs.x&&cs.y&&(us||ds)&&(us=ds=!0),us&&(0==j.ori?(n=Yn,s=Jn):(n=Gn,s=Zn),$s(Ze(n,s),Ge(s-n)),ds||Ws(0,c)),ds&&(1==j.ori?(n=Yn,s=Jn):(n=Gn,s=Zn),Ws(Ze(n,s),Ge(s-n)),us||$s(0,l)),us||ds||($s(0,0),Ws(0,0))}if(cs._x=us,cs._y=ds,null==t){if(o){if(null!=Ti){let[t,e]=Si.scales;Si.values[0]=null!=t?Ns(0==j.ori?Jn:Zn,t):null,Si.values[1]=null!=e?Ns(1==j.ori?Jn:Zn,e):null}Mi(te,s,Jn,Zn,at,lt,r)}if(At){let t=o&&Si.setSeries,e=Lt.prox;null==As?js<=e&&Es(Ls,Ds,!0,t):js>e?Es(null,Ds,!0,t):Ls!=As&&Es(Ls,Ds,!0,t)}}Tt&&(O.idx=r,Us()),!1!==n&&wi("setCursor")}s.setLegend=Us;let ni=null;function ii(t=!1){t?ni=null:(ni=m.getBoundingClientRect(),wi("syncRect",ni))}function oi(t,e,n,s,i,o,r){z._lock||ls&&null!=t&&0==t.movementX&&0==t.movementY||(ai(t,e,n,s,i,o,0,!1,null!=t),null!=t?Ks(null,!0,!0):Ks(e,!0,!1))}function ai(t,e,n,i,o,r,l,c,u){if(null==ni&&ii(!1),Et(t),null!=t)n=t.clientX-ni.left,i=t.clientY-ni.top;else{if(n<0||i<0)return Jn=-10,void(Zn=-10);let[t,s]=Si.scales,l=e.cursor.sync,[c,u]=l.values,[d,h]=l.scales,[p,m]=Si.match,f=e.axes[0].side%2==1,g=0==j.ori?at:lt,y=1==j.ori?at:lt,v=f?r:o,x=f?o:r,b=f?i:n,w=f?n:i;if(n=null!=d?p(t,d)?a(c,k[t],g,0):-10:g*(b/v),i=null!=h?m(s,h)?a(u,k[s],y,0):-10:y*(w/x),1==j.ori){let t=n;n=i,i=t}}!u||null!=e&&e.cursor.event.type!=te||((n<=1||n>=at-1)&&(n=vn(n,at)),(i<=1||i>=lt-1)&&(i=vn(i,lt))),c?(Un=n,Hn=i,[Yn,Gn]=z.move(s,n,i)):(Jn=n,Zn=i)}Object.defineProperty(s,"rect",{get:()=>(null==ni&&ii(!1),ni)});const li={width:0,height:0,left:0,top:0};function ci(){Cs(li,!1)}let di,hi,pi,mi;function fi(t,e,n,i,o,r,a){ls=!0,us=ds=cs._x=cs._y=!1,ai(t,e,n,i,o,r,0,!0,!1),null!=t&&(st(ne,ue,gi,!1),Mi(ee,s,Yn,Gn,at,lt,null));let{left:l,top:c,width:u,height:d}=bs;di=l,hi=c,pi=u,mi=d}function gi(t,e,n,i,o,r,a){ls=cs._x=cs._y=!1,ai(t,e,n,i,o,r,0,!1,!0);let{left:l,top:c,width:u,height:d}=bs,h=u>0||d>0,p=di!=l||hi!=c||pi!=u||mi!=d;if(h&&p&&Cs(bs),cs.setScale&&h&&p){let t=l,e=u,n=c,s=d;if(1==j.ori&&(t=c,e=d,n=l,s=u),us&&Ms(T,Ns(t,T),Ns(t+e,T)),ds)for(let i in k){let t=k[i];i!=T&&null==t.from&&t.min!=rn&&Ms(i,Ns(n+s,i),Ns(n,i))}ci()}else z.lock&&(z._lock=!z._lock,Ks(e,!0,null!=t));null!=t&&(it(ne,ue),Mi(ne,s,Jn,Zn,at,lt,null))}function yi(t,e,n,i,o,r,a){z._lock||(Et(t),He(),ci(),null!=t&&Mi(oe,s,Jn,Zn,at,lt,null))}function vi(){w.forEach(Wi),Ct(s.width,s.height,!0)}Ee(ae,de,vi);const xi={};xi.mousedown=fi,xi.mousemove=oi,xi.mouseup=gi,xi.dblclick=yi,xi.setSeries=(t,e,n,i)=>{-1!=(n=(0,Si.match[2])(s,e,n))&&Es(n,i,!0,!1)},W&&(st(ee,m,fi),st(te,m,oi),st(se,m,t=>{Et(t),ii(!1)}),st(ie,m,function(t,e,n,s,i,o,r){if(z._lock)return;Et(t);let a=ls;if(ls){let t,e,n=!0,s=!0,i=10;0==j.ori?(t=us,e=ds):(t=ds,e=us),t&&e&&(n=Jn<=i||Jn>=at-i,s=Zn<=i||Zn>=lt-i),t&&n&&(Jn=Jn{t.call(null,s,e,n)})}(t.plugins||[]).forEach(t=>{for(let e in t.hooks)bi[e]=(bi[e]||[]).concat(t.hooks[e])});const ki=(t,e,n)=>n,Si=In({key:null,setSeries:!1,filters:{pub:mn,sub:mn},scales:[T,v[1]?v[1].scale:null],match:[fn,fn,ki],values:[null,null]},z.sync);2==Si.match.length&&Si.match.push(ki),z.sync=Si;const Ti=Si.key,Ci=si(Ti);function Mi(t,e,n,s,i,o,r){Si.filters.pub(t,e,n,s,i,o,r)&&Ci.pub(t,e,n,s,i,o,r)}function Pi(){wi("init",t,e),Ue(e||t.data,!1),N[T]?as(T,N[T]):He(),St=bs.show&&(bs.width>0||bs.height>0),kt=Tt=!0,Ct(t.width,t.height)}return Ci.sub(s),s.pub=function(t,e,n,s,i,o,r){Si.filters.sub(t,e,n,s,i,o,r)&&xi[t](null,e,n,s,i,o,r)},s.destroy=function(){Ci.unsub(s),ji.delete(s),nt.clear(),je(ae,de,vi),c.remove(),null==H||H.remove(),wi("destroy")},v.forEach(_t),w.forEach(function(t,e){if(t._show=t.show,t.show){let n=t.side%2,i=k[t.scale];null==i&&(t.scale=n?v[1].scale:T,i=k[t.scale]);let o=i.time;t.size=un(t.size),t.space=un(t.space),t.rotate=un(t.rotate),En(t.incrs)&&t.incrs.forEach(t=>{!kn.has(t)&&kn.set(t,Sn(t))}),t.incrs=un(t.incrs||(2==i.distr?Qn:o?1==y?hs:fs:ts)),t.splits=un(t.splits||(o&&1==i.distr?I:3==i.distr?Bs:4==i.distr?Vs:_s)),t.stroke=un(t.stroke),t.grid.stroke=un(t.grid.stroke),t.ticks.stroke=un(t.ticks.stroke),t.border.stroke=un(t.border.stroke);let r=t.values;t.values=En(r)&&!En(r[0])?un(r):o?En(r)?xs(R,vs(r,F)):Ln(r)?function(t,e){let n=qn(e);return(e,s,i,o,r)=>s.map(e=>n(t(e)))}(R,r):r||_:r||Is,t.filter=un(t.filter||(i.distr>=3&&10==i.log?Hs:3==i.distr&&2==i.log?Ys:hn)),t.font=$i(t.font),t.labelFont=$i(t.labelFont),t._size=t.size(s,null,e,0),t._space=t._rotate=t._incrs=t._found=t._splits=t._values=null,t._size>0&&(Bt[e]=!0,t._el=xe("u-axis",h))}}),n?n instanceof HTMLElement?(n.appendChild(c),Pi()):n(s,Pi):Pi(),s}Ui.assign=In,Ui.fmtNum=He,Ui.rangeNum=ze,Ui.rangeLog=Ie,Ui.rangeAsinh=_e,Ui.orient=ii,Ui.pxRatio=pe,Ui.join=function(t,e){if(function(t){let e=t[0][0],n=e.length;for(let s=1;s=s&&null==t[i];)i--;if(i<=s)return!0;const o=Qe(1,Xe((i-s+1)/e));for(let r=t[s],a=s+o;a<=i;a+=o){const e=t[a];if(null!=e){if(e<=r)return!1;r=e}}return!0}(e[0])||(e=function(t){let e=t[0],n=e.length,s=Array(n);for(let o=0;oe[t]-e[n]);let i=[];for(let o=0;ot-e)],i=s[0].length,o=new Map;for(let r=0;rii(t,o,(l,c,u,d,h,p,m,f,g,y,v)=>{[r,a]=Re(u,r,a);let x=l.pxRound,{left:b,width:w}=t.bbox,k=t=>x(p(t,d,y,f)),S=t=>x(m(t,h,v,g)),T=0==d.ori?mi:fi;const C={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:1},M=C.stroke,P=d.dir*(0==d.ori?1:-1);let E=S(u[1==P?r:a]),j=k(c[1==P?r:a]),L=j,A=j;i&&-1==e&&(A=b,T(M,A,E)),T(M,j,E);for(let t=1==P?r:a;t>=r&&t<=a;t+=P){let n=u[t];if(null==n)continue;let s=k(c[t]),i=S(n);1==e?T(M,s,E):T(M,L,i),T(M,s,i),E=i,L=s}let D=L;i&&1==e&&(D=b+w,T(M,D,E));let[N,R]=oi(t,o);if(null!=l.fill||0!=N){let e=C.fill=new Path2D(M),n=S(l.fillTo(t,o,l.min,l.max,N));T(e,D,n),T(e,A,n)}if(!l.spanGaps){let i=[];i.push(...ci(c,u,r,a,P,k,s));let h=l.width*pe/2,p=n||1==e?h:-h,m=n||-1==e?-h:h;i.forEach(t=>{t[0]+=p,t[1]+=m}),C.gaps=i=l.gaps(t,o,r,a,i),C.clip=li(i,d.ori,f,g,y,v)}return 0!=R&&(C.band=2==R?[ai(t,o,r,a,M,-1),ai(t,o,r,a,M,1)]:ai(t,o,r,a,M,R)),C})},t.bars=function(t){const e=$e((t=t||Cn).size,[.6,rn,1]),n=t.align||0,s=t.gap||0;let i=t.radius;i=null==i?[0,0]:"number"==typeof i?[i,0]:i;const o=un(i),r=1-e[0],a=$e(e[1],rn),l=$e(e[2],1),c=$e(t.disp,Cn),u=$e(t.each,t=>{}),{fill:d,stroke:h}=c;return(t,e,i,p)=>ii(t,e,(m,f,g,y,v,x,b,w,k,S,T)=>{let C,M,P=m.pxRound,E=n,j=s*pe,L=a*pe,A=l*pe;0==y.ori?[C,M]=o(t,e):[M,C]=o(t,e);const D=y.dir*(0==y.ori?1:-1);let N,R,F,I=0==y.ori?gi:yi,_=0==y.ori?u:(t,e,n,s,i,o,r)=>{u(t,e,n,i,s,r,o)},B=$e(t.bands,Mn).find(t=>t.series[0]==e),V=null!=B?B.dir:0,O=m.fillTo(t,e,m.min,m.max,V),z=P(b(O,v,T,k)),$=S,W=P(m.width*pe),U=!1,H=null,Y=null,q=null,G=null;null==d||0!=W&&null==h||(U=!0,H=d.values(t,e,i,p),Y=new Map,new Set(H).forEach(t=>{null!=t&&Y.set(t,new Path2D)}),W>0&&(q=h.values(t,e,i,p),G=new Map,new Set(q).forEach(t=>{null!=t&&G.set(t,new Path2D)})));let{x0:X,size:K}=c;if(null!=X&&null!=K){E=1,f=X.values(t,e,i,p),2==X.unit&&(f=f.map(e=>t.posToVal(w+e*S,y.key,!0)));let n=K.values(t,e,i,p);R=2==K.unit?n[0]*S:x(n[0],y,S,w)-x(0,y,S,w),$=Pi(f,g,x,y,S,w,$),F=$-R+j}else $=Pi(f,g,x,y,S,w,$),F=$*r+j,R=$-F;F<1&&(F=0),W>=R/2&&(W=0),F<5&&(P=dn);let J=F>0;R=P(ln($-F-(J?W:0),A,L)),N=(0==E?R/2:E==D?0:R)-E*D*((0==E?j/2:0)+(J?W/2:0));const Z={stroke:null,fill:null,clip:null,band:null,gaps:null,flags:0},Q=U?null:new Path2D;let tt=null;if(null!=B)tt=t.data[B.series[1]];else{let{y0:n,y1:s}=c;null!=n&&null!=s&&(g=s.values(t,e,i,p),tt=n.values(t,e,i,p))}let et=C*R,nt=M*R;for(let n=1==D?i:p;n>=i&&n<=p;n+=D){let s=g[n];if(null==s)continue;if(null!=tt){let t=tt[n]??0;if(s-t==0)continue;z=b(t,v,T,k)}let i=x(2!=y.distr||null!=c?f[n]:n,y,S,w),o=b($e(s,O),v,T,k),r=P(i-N),a=P(Qe(o,z)),l=P(Ze(o,z)),u=a-l;if(null!=s){let i=s<0?nt:et,o=s<0?et:nt;U?(W>0&&null!=q[n]&&I(G.get(q[n]),r,l+Xe(W/2),R,Qe(0,u-W),i,o),null!=H[n]&&I(Y.get(H[n]),r,l+Xe(W/2),R,Qe(0,u-W),i,o)):I(Q,r,l+Xe(W/2),R,Qe(0,u-W),i,o),_(t,e,n,r-W/2,l,R+W,u)}}return W>0?Z.stroke=U?G:Q:U||(Z._fill=0==m.width?m._fill:m._stroke??m._fill,Z.width=0),Z.fill=U?Y:Q,Z})},t.spline=function(t){return function(t,e){const n=$e(null==e?void 0:e.alignGaps,0);return(e,s,i,o)=>ii(e,s,(r,a,l,c,u,d,h,p,m,f,g)=>{[i,o]=Re(l,i,o);let y,v,x,b=r.pxRound,w=t=>b(d(t,c,f,p)),k=t=>b(h(t,u,g,m));0==c.ori?(y=hi,x=mi,v=bi):(y=pi,x=fi,v=wi);const S=c.dir*(0==c.ori?1:-1);let T=w(a[1==S?i:o]),C=T,M=[],P=[];for(let t=1==S?i:o;t>=i&&t<=o;t+=S)if(null!=l[t]){let e=w(a[t]);M.push(C=e),P.push(k(l[t]))}const E={stroke:t(M,P,y,x,v,b),fill:null,clip:null,band:null,gaps:null,flags:1},j=E.stroke;let[L,A]=oi(e,s);if(null!=r.fill||0!=L){let t=E.fill=new Path2D(j),n=k(r.fillTo(e,s,r.min,r.max,L));x(t,C,n),x(t,T,n)}if(!r.spanGaps){let t=[];t.push(...ci(a,l,i,o,S,w,n)),E.gaps=t=r.gaps(e,s,i,o,t),E.clip=li(t,c.ori,p,m,f,g)}return 0!=A&&(E.band=2==A?[ai(e,s,i,o,j,-1),ai(e,s,i,o,j,1)]:ai(e,s,i,o,j,A)),E})}(Ei,t)}}const Hi=new Map;function Yi(t){var e;if(!t.startsWith("var("))return t;const n=Hi.get(t);if(n)return n;const s=t.match(/var\(([^,)]+)(?:,\s*([^)]+))?\)/);if(!s)return t;const i=s[1].trim(),o=(null==(e=s[2])?void 0:e.trim())||"#888888",r=getComputedStyle(document.documentElement).getPropertyValue(i).trim()||o;return Hi.set(t,r),r}const qi=n.memo(function({timestamps:t,series:e,onHover:i,highlightedKey:o=null,cursorColor:r="rgba(255,255,255,0.5)"}){const a=n.useRef(null),l=n.useRef(null),c=n.useRef(e),u=n.useRef(o),d=n.useRef(i),h=n.useRef(t.length);n.useLayoutEffect(()=>{c.current=e,u.current=o,d.current=i});const p=n.useMemo(()=>{const e=new Array(t.length).fill(1);return[t,e]},[t]),m=n.useMemo(()=>({hooks:{draw:t=>{!function(t,e,n){if(0===e.length)return;const s=t.ctx,i=t.bbox,o=i.left,r=i.top,a=i.width,l=i.height;if(a<=0||l<=0)return;const c=t.data[0],u=c.length;if(0===u)return;const d=c[0],h=c[u-1]-d||1,p=t=>{const e=c[t];return o+(e-d)/h*a},m=t=>r+l*(1-t);for(let f=0;f=0;e--){const t=p(e),n=m(o[e]);if(e===u-1)s.lineTo(t,n);else{const i=p(e+1);s.lineTo(i,n),s.lineTo(t,n)}}s.closePath(),s.fill(),s.restore()}}(t,c.current,u.current),function(t){const e=t.ctx,{left:n,top:s,width:i,height:o}=t.bbox,r=window.devicePixelRatio||1,a=function(){const t=getComputedStyle(document.documentElement);return{fontFamily:t.getPropertyValue("--font-data").trim()||'"JetBrains Mono", ui-monospace, monospace',textPrimary:t.getPropertyValue("--text-primary").trim()||"#FFFFFF"}}();e.save(),e.strokeStyle=a.textPrimary,e.globalAlpha=.15,e.lineWidth=1*r,e.setLineDash([4*r,4*r]);for(const c of[.2,.4,.6,.8]){const t=Math.round(s+o*(1-c))+.5;e.beginPath(),e.moveTo(Math.round(n),t),e.lineTo(Math.round(n+i),t),e.stroke()}e.restore(),e.save(),e.font=`bold ${10*r}px ${a.fontFamily}`,e.fillStyle=a.textPrimary,e.textBaseline="middle",e.textAlign="left";const l=8*r;for(const c of[0,20,40,60,80,100]){const t=s+o*(1-c/100),n=Math.max(s+l,Math.min(s+o-l,t));e.fillText(`${c}%`,0,n)}e.restore()}(t)}}}),[]),f=n.useMemo(()=>({width:400,height:200,padding:[8,0,0,32],cursor:{show:!0,x:!0,y:!1,drag:{x:!1,y:!1},points:{show:!1}},scales:{x:{time:!0},y:{range:[0,1]}},axes:[{show:!1},{show:!1}],series:[{},{show:!1}],hooks:{setCursor:[t=>{var e,n;const s=t.cursor.idx;if(null!=s&&s>=0){const n=t.data[0][s];null==(e=d.current)||e.call(d,s,n)}else null==(n=d.current)||n.call(d,null,null)}]},plugins:[m]}),[m]);n.useEffect(()=>{const e=a.current;if(!e||0===t.length)return;const n=h.current,s=t.length,i=Math.abs(s-n);if(!(!l.current||i>100||n>0&&i/n>.1)&&l.current)return l.current.setData(p),void(h.current=s);l.current&&l.current.destroy();const o=e.getBoundingClientRect(),r=Math.floor(o.width)||400,c=Math.floor(o.height)||200,u=new Ui({...f,width:r,height:c},p,e);return l.current=u,h.current=s,()=>{u.destroy(),l.current=null}},[f,p,t.length]),n.useEffect(()=>{const t=a.current;if(!t)return;const e=new ResizeObserver(t=>{const e=t[0];if(!e||!l.current)return;const{width:n,height:s}=e.contentRect;n>0&&s>0&&l.current.setSize({width:Math.floor(n),height:Math.floor(s)})});return e.observe(t),()=>{e.disconnect()}},[]),n.useEffect(()=>{l.current&&l.current.redraw()},[o,e]);const g=n.useCallback(()=>{null==i||i(null,null)},[i]);return 0===t.length?s.jsx("div",{className:"h-full flex items-center justify-center text-text-muted",children:"No data available"}):s.jsx("div",{ref:a,className:"w-full h-full rounded-2xl overflow-hidden",onMouseLeave:g})}),Gi=n.createContext(null);function Xi(t){const e=gt(t);e&&function(t){if("undefined"==typeof document)return;const e=function(t){var e;const n={},s=t.surfaces.glass;n["--glass-tint"]=s.tint,n["--glass-light"]=s.light,n["--glass-dark"]=s.dark,n["--glass-reflex-light"]=String(s.reflexLight),n["--glass-reflex-dark"]=String(s.reflexDark),n["--glass-blur"]=`${s.blur}px`,n["--glass-blur-elevated"]=`${s.blurElevated}px`,n["--glass-brightness"]=String(s.brightness),n["--glass-bg-opacity"]=`${s.opacity}%`,n["--glass-bg-opacity-elevated"]=`${s.opacityElevated}%`,n["--glass-stroke-only"]=s.strokeOnly?"1":"0",n["--glass-stroke-width"]=s.strokeWidth?`${s.strokeWidth}px`:"0px",n["--glass-stroke-color"]=s.strokeColor||"transparent",n["--glass-ribbon-mode"]=s.ribbonMode?"1":"0",n["--glass-ribbon-border-width"]=s.ribbonBorderWidth?`${s.ribbonBorderWidth}px`:"0px",n["--glass-ribbon-border-color"]=s.ribbonBorderColor||"transparent",n["--sidebar-tint"]=t.surfaces.sidebar.tint,n["--tooltip-bg"]=t.colors.bg.surface,n["--hover-tint"]=`rgba(${L(t.colors.accent.primary)}, 0.08)`,n["--shadow-tint"]=`rgba(${L(t.colors.accent.primary)}, 0.35)`,n["--bg-body"]=t.colors.bg.body,n["--bg-surface"]=t.colors.bg.surface,n["--bg-elevated"]=t.colors.bg.elevated,n["--bg-subtle"]=t.colors.bg.subtle,n["--border-subtle"]=t.colors.border.subtle,n["--border-strong"]=t.colors.border.strong,n["--text-primary"]=t.colors.text.primary,n["--text-secondary"]=t.colors.text.secondary,n["--text-muted"]=t.colors.text.muted,n["--text-invert"]=t.colors.text.inverse,n["--accent-primary"]=t.colors.accent.primary,n["--accent-secondary"]=t.colors.accent.secondary,n["--accent-tertiary"]=t.colors.accent.tertiary,n["--accent-success"]=t.colors.accent.success,n["--accent-danger"]=t.colors.accent.danger,n["--signal-excellent"]=t.colors.signal.excellent,n["--signal-good"]=t.colors.signal.good,n["--signal-fair"]=t.colors.signal.fair,n["--signal-poor"]=t.colors.signal.poor,n["--signal-critical"]=t.colors.signal.critical,n["--signal-unknown"]=t.colors.signal.unknown,n["--sparkline-excellent"]=t.colors.signal.excellent,n["--sparkline-good"]=t.colors.signal.good,n["--sparkline-fair"]=t.colors.signal.fair,n["--sparkline-poor"]=t.colors.signal.poor,n["--sparkline-critical"]=t.colors.signal.critical,n["--status-success"]=t.colors.status.success,n["--status-warning"]=t.colors.status.warning,n["--status-danger"]=t.colors.status.danger,n["--status-info"]=t.colors.status.info,n["--status-muted"]=t.colors.status.muted;const i=t.colors.chart;n["--pkt-advert"]=t.colors.accent.secondary,n["--pkt-flood"]=t.colors.accent.tertiary,n["--pkt-txt-msg"]=t.colors.accent.success,n["--pkt-ack"]=i.c8,n["--pkt-trace"]=i.c3,n["--pkt-req"]=i.c2,n["--pkt-response"]=i.c5,n["--pkt-grp-txt"]=t.colors.map.room,n["--pkt-grp-data"]=t.colors.accent.danger,n["--pkt-path"]=i.c3,n["--pkt-anon"]=t.colors.accent.secondary,n["--pkt-unknown"]=t.colors.status.muted,n["--route-flood"]=t.colors.accent.primary,n["--route-direct"]=t.colors.accent.secondary,n["--route-transport"]=i.c8,n["--chart-1"]=i.c1,n["--chart-2"]=i.c2,n["--chart-3"]=i.c3,n["--chart-4"]=i.c4,n["--chart-5"]=i.c5,n["--chart-6"]=i.c6,n["--chart-7"]=i.c7,n["--chart-8"]=i.c8,n["--chart-grid"]=i.grid,n["--chart-axis-tick"]=i.axis,n["--chart-cursor"]=i.cursor,n["--metric-received"]=t.colors.metric.received,n["--metric-forwarded"]=t.colors.metric.forwarded,n["--metric-transmitted"]=t.colors.metric.transmitted,n["--metric-dropped"]=t.colors.metric.dropped,n["--metric-neutral"]=t.colors.text.secondary,n["--log-debug"]=t.colors.status.muted,n["--log-info"]=t.colors.status.info,n["--log-warning"]=t.colors.status.warning,n["--log-error"]=t.colors.accent.danger,n["--log-critical"]=t.colors.accent.danger;const o=t.colors.map;n["--map-node-fill"]="#3B82F6",n["--map-node-stroke"]="rgba(255,255,255,0.9)",n["--map-hub-color"]="#8E4EC6",n["--map-hub-stroke"]="rgba(255,255,255,0.9)",n["--map-gateway-color"]="#5B5BD6",n["--map-gateway-stroke"]="rgba(255,255,255,0.85)",n["--map-local-color"]="#FFB224",n["--map-neighbor-color"]="#FFB224",n["--map-neighbor-stroke"]="rgba(0,0,0,0.4)",n["--map-mobile-color"]="#F76B15",n["--map-room-color"]="#D6409F",n["--map-ghost-color"]="#00A2C7",n["--map-edge-rest"]=o.edge,n["--map-edge-rest-bright"]=t.colors.border.strong,n["--map-edge-rest-dim"]=t.colors.bg.subtle,n["--map-edge-hover-direct"]=o.edgeHover,n["--map-edge-hover-loop"]="#8E4EC6",n["--map-edge-hover-standard"]=t.colors.text.muted,n["--map-edge-hover-neighbor"]="#FFB224",n["--link-strong"]=t.colors.accent.success,n["--link-medium"]=t.colors.accent.secondary,n["--link-weak"]=t.colors.accent.danger,n["--hop-0"]=t.colors.accent.tertiary,n["--hop-1"]=t.colors.accent.success,n["--hop-2"]=i.c3,n["--hop-3"]=t.colors.accent.secondary,n["--hop-distant"]=t.colors.text.muted,n["--hop-hub"]=o.local;const r=t.colors.icon;n["--icon-page-title"]=(null==r?void 0:r.pageTitle)??t.colors.accent.primary,n["--icon-card-title"]=(null==r?void 0:r.cardTitle)??t.colors.accent.primary,n["--icon-widget"]=(null==r?void 0:r.widget)??t.colors.text.secondary,n["--icon-action"]=(null==r?void 0:r.action)??t.colors.text.secondary,n["--icon-nav"]=(null==r?void 0:r.nav)??t.colors.text.muted,n["--icon-nav-active"]=(null==r?void 0:r.navActive)??t.colors.accent.primary,n["--toggle-on"]=t.colors.accent.success,n["--toggle-off"]=t.colors.bg.elevated;const a=t.colors.sidebar;n["--sidebar-bg"]=(null==a?void 0:a.bg)??"transparent",n["--sidebar-nav-hover-bg"]=(null==a?void 0:a.navHoverBg)??"rgba(255, 255, 255, 0.05)",n["--sidebar-nav-active-bg"]=(null==a?void 0:a.navActiveBg)??`color-mix(in srgb, ${t.colors.accent.primary} 15%, transparent)`,n["--sidebar-nav-active-text"]=(null==a?void 0:a.navActiveText)??t.colors.accent.primary;const l=t.meta.isDark;n["--data-box-bg"]=l?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.03)",n["--data-box-border"]=l?"rgba(255, 255, 255, 0.06)":"rgba(0, 0, 0, 0.08)",n["--subtle-fill"]=l?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.03)",n["--subtle-fill-hover"]=l?"rgba(255, 255, 255, 0.06)":"rgba(0, 0, 0, 0.05)",n["--subtle-fill-strong"]=l?"rgba(255, 255, 255, 0.08)":"rgba(0, 0, 0, 0.06)",n["--color-pill-bg"]=l?"rgba(0, 0, 0, 0.3)":"rgba(255, 255, 255, 0.3)",n["--terminal-bg"]=l?"rgba(0, 0, 0, 0.4)":"rgba(0, 0, 0, 0.03)",n["--terminal-bg-input"]=l?"rgba(0, 0, 0, 0.5)":"rgba(0, 0, 0, 0.05)",n["--terminal-bg-status"]=l?"rgba(0, 0, 0, 0.3)":"rgba(0, 0, 0, 0.02)",n["--terminal-border"]=l?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.08)",n["--terminal-autocomplete-bg"]=l?"rgba(0, 0, 0, 0.8)":"rgba(255, 255, 255, 0.95)",n["--terminal-autocomplete-border"]=l?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.15)",n["--terminal-autocomplete-hover"]=l?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.05)",n["--livedot-idle"]=l?"#666677":"#999999",n["--ctrl-panel-top"]=l?"rgba(30, 30, 30, 0.95)":"rgba(240, 240, 240, 0.95)",n["--ctrl-panel-mid"]=l?"rgba(25, 25, 25, 0.95)":"rgba(235, 235, 235, 0.95)",n["--ctrl-panel-bottom"]=l?"rgba(20, 20, 20, 0.95)":"rgba(230, 230, 230, 0.95)",n["--ctrl-panel-border"]=l?"rgba(60, 60, 60, 1)":"rgba(200, 200, 200, 1)",n["--chart-grid-line"]=l?"rgba(255, 255, 255, 0.06)":"rgba(0, 0, 0, 0.08)",n["--map-control-active-amber"]=l?"rgba(251, 191, 36, 0.15)":"rgba(217, 119, 6, 0.12)",n["--map-control-active-sky"]=l?"rgba(56, 189, 248, 0.15)":"rgba(14, 165, 233, 0.12)",n["--map-control-active-teal"]=l?"rgba(45, 212, 191, 0.15)":"rgba(20, 184, 166, 0.12)",n["--sidebar-action-active-green"]=l?"rgba(10, 26, 10, 1)":"rgba(220, 252, 231, 1)",n["--sidebar-action-active-teal"]=l?"rgba(10, 36, 32, 1)":"rgba(204, 251, 241, 1)",n["--sidebar-action-active-amber"]=l?"rgba(26, 20, 8, 1)":"rgba(254, 243, 199, 1)",n["--thumbnail-brightness"]=l?"1.5":"1.8",n["--font-title"]=t.typography.font.title,n["--font-display"]=t.typography.font.display,n["--font-data"]=t.typography.font.mono,n["--font-card-title"]=t.typography.font.cardTitle??t.typography.font.display,n["--font-badge"]=t.typography.font.badge??t.typography.font.display,n["--font-normal"]=String(t.typography.weight.normal),n["--font-medium"]=String(t.typography.weight.medium),n["--font-semibold"]=String(t.typography.weight.semibold),n["--font-bold"]=String(t.typography.weight.bold),n["--font-card-title-weight"]=String(t.typography.weight.cardTitle??t.typography.weight.semibold),n["--font-badge-weight"]=String(t.typography.weight.badge??t.typography.weight.medium),n["--badge-text-transform"]=(null==(e=t.typography.badge)?void 0:e.textTransform)??"none";const c=t.typography.size;c.xxl&&(n["--text-2xl"]=c.xxl),c.xl&&(n["--text-xl"]=c.xl),c.lg&&(n["--text-lg"]=c.lg),c.md&&(n["--text-md"]=c.md),c.base&&(n["--text-base"]=c.base),c.sm&&(n["--text-sm"]=c.sm),c.xs&&(n["--text-xs"]=c.xs),c.hero&&(n["--text-5xl"]=c.hero),c.cardTitle&&(n["--text-card-title"]=c.cardTitle);const u=t.typography.tracking;return u&&(n["--tracking-tight"]=u.tight,n["--tracking-normal"]=u.normal,n["--tracking-wide"]=u.wide),n["--theme-transition"]=`${t.motion.slow} ${t.motion.easing}`,function(t){if(!M())return t;const e={},n=/^#[0-9A-Fa-f]{3,6}$/;for(const[s,i]of Object.entries(t))e[s]=n.test(i)?C(i):i;return e}(n)}(t),n=document.documentElement;for(const[s,i]of Object.entries(e))n.style.setProperty(s,i);t.surfaces.glass.strokeOnly?n.classList.add("stroke-only"):n.classList.remove("stroke-only"),t.surfaces.glass.ribbonMode?n.classList.add("ribbon-mode"):n.classList.remove("ribbon-mode"),t.surfaces.glass.catalystMode?n.classList.add("catalyst-mode"):n.classList.remove("catalyst-mode")}(e),document.documentElement.dataset.colorScheme=t}function Ki({children:t}){const[e,i]=n.useState(()=>function(){if("undefined"==typeof window)return Et;try{let n=localStorage.getItem(jt),s=localStorage.getItem(Lt);const i=localStorage.getItem(At);if(!n&&!s){const t=localStorage.getItem(Dt);if(t){const e=Pt.find(e=>e.id===t);e&&(n=e.colorScheme,s=e.backgroundImage,localStorage.setItem(jt,n),localStorage.setItem(Lt,s),localStorage.removeItem(Dt))}}const o=n&&"string"==typeof(e=n)&&Ct.some(t=>t.id===e)?n:Et.colorScheme;let r=Et.backgroundImage;""===s?r="":s&&"string"==typeof(t=s)&&Mt.some(e=>e.src===t)&&(r=s);let a=Et.brightness;if(i){const t=parseInt(i,10);!isNaN(t)&&t>=0&&t<=100&&(a=t)}return{colorScheme:o,backgroundImage:r,brightness:a}}catch{return Et}var t,e}()),o=n.useRef(!1),r=n.useRef(null),[a,l]=n.useState(null);n.useEffect(()=>{r.current&&(clearTimeout(r.current),r.current=null),o.current&&(l("#808080"),r.current=setTimeout(()=>{l(null),r.current=null},1800)),o.current=!0,Xi(e.colorScheme),Hi.clear(),requestAnimationFrame(()=>{!function(){if("undefined"==typeof window)return;for(const e of It){const t=$t(`--palette-${e}-bright`),n=$t(`--palette-${e}`),s=t||n;if(!s)continue;const i=zt(s);for(const o of Ft)Wt(`--palette-${e}-${o}`,i[o])}const t=$t("--palette-bg-4");if(t){const e=zt(t);for(const t of Ft)Wt(`--palette-neutral-${t}`,e[t])}}()})},[e.colorScheme]),n.useEffect(()=>{!function(t){if("undefined"!=typeof window)try{localStorage.setItem(jt,t.colorScheme),localStorage.setItem(Lt,t.backgroundImage),localStorage.setItem(At,String(t.brightness))}catch{}}(e)},[e]),n.useEffect(()=>{Mt.forEach(t=>{(new Image).src=t.src})},[]);const c=n.useCallback(t=>{i(e=>({...e,colorScheme:t}))},[]),u=n.useCallback(t=>{const e=Mt.find(e=>e.src===t);i(n=>({...n,backgroundImage:t,brightness:(null==e?void 0:e.suggestedBrightness)??n.brightness}))},[]),d=n.useCallback(t=>{const e=Math.max(0,Math.min(100,Math.round(t)));i(t=>({...t,brightness:e}))},[]),h=n.useCallback(t=>{const e=Pt.find(e=>e.id===t);if(e){const t=!e.backgroundImage,n=t?null:Mt.find(t=>t.src===e.backgroundImage);i(s=>({...s,colorScheme:e.colorScheme,backgroundImage:e.backgroundImage,brightness:t?100:(null==n?void 0:n.suggestedBrightness)??s.brightness}))}},[]),p=n.useMemo(()=>({theme:e,setColorScheme:c,setBackgroundImage:u,setBrightness:d,setThemePreset:h}),[e,c,u,d,h]);return s.jsxs(Gi.Provider,{value:p,children:[t,a&&s.jsx("div",{className:"fixed inset-0 pointer-events-none z-[9999]",style:{backgroundColor:a,animation:"theme-crossfade 1.8s ease-out forwards"}},e.colorScheme),s.jsx("style",{children:"\n @keyframes theme-crossfade {\n from { opacity: 0.35; }\n to { opacity: 0; }\n }\n "})]})}function Ji(){const t=n.useContext(Gi);if(!t)throw new Error("useTheme must be used within a ThemeProvider. Wrap your app with in App.tsx.");return t}const Zi=n.forwardRef(function(t,e){const{href:n,...o}=t;return n.startsWith("http://")||n.startsWith("https://")||n.startsWith("//")?s.jsx(i,{children:s.jsx("a",{...o,href:n,ref:e})}):s.jsx(i,{children:s.jsx(y,{...o,to:n,ref:e})})}),Qi={0:"REQ",1:"RESPONSE",2:"TXT_MSG",3:"ACK",4:"ADVERT",5:"GRP_TXT",6:"GRP_DATA",7:"ANON_REQ",8:"PATH",9:"TRACE",10:"MULTIPART",15:"RAW_CUSTOM"},to={0:"T_FLOOD",1:"FLOOD",2:"DIRECT",3:"T_DIRECT"},eo={REQ:0,RESPONSE:1,TXT_MSG:2,ACK:3,ADVERT:4,GRP_TXT:5,GRP_DATA:6,ANON_REQ:7,PATH:8,TRACE:9,MULTIPART:10,RAW_CUSTOM:15};function no(t){return 1===t||0===t}function so(t){return null==t?"UNKNOWN":Qi[t]||`TYPE_${t}`}function io(t){return null==t?"UNKNOWN":to[t]||`ROUTE_${t}`}function oo(t,e){return(Math.max(t,e)+.05)/(Math.min(t,e)+.05)}function ro(t){const e=function(t){const e=t.replace("#",""),n=parseInt(e.slice(0,2),16)/255,s=parseInt(e.slice(2,4),16)/255,i=parseInt(e.slice(4,6),16)/255,o=t=>t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4);return.2126*o(n)+.7152*o(s)+.0722*o(i)}(t);return oo(e,1)>oo(e,0)?"light":"dark"}function ao(t){return 1===t||!0===t}const lo=g("inline-flex items-center gap-1","rounded-md px-1.5 py-0.5","text-xs"),co={fontFamily:"var(--font-badge)",fontWeight:"var(--font-badge-weight)",textTransform:"var(--badge-text-transform, none)"},uo={red:"var(--sys-red)",orange:"var(--sys-orange)",amber:"var(--sys-amber)",yellow:"var(--sys-yellow)",lime:"var(--sys-green)",green:"var(--sys-green)",emerald:"var(--sys-green)",teal:"var(--sys-teal)",cyan:"var(--sys-cyan)",sky:"var(--sys-cyan)",blue:"var(--sys-blue)",indigo:"var(--sys-indigo)",violet:"var(--sys-indigo)",purple:"var(--sys-purple)",fuchsia:"var(--sys-pink)",pink:"var(--sys-pink)",rose:"var(--sys-red)",brown:"var(--sys-brown)",zinc:"var(--text-muted)"};function ho(t){if(!t.startsWith("var("))return t;if("undefined"!=typeof window){const e=t.match(/var\((--[^,)]+)/);if(e){const t=getComputedStyle(document.documentElement).getPropertyValue(e[1]).trim();if(t&&t.startsWith("#"))return t}}return"#666666"}function po({color:t="zinc",customColor:e,filled:i=!1,compact:o=!1,className:r,title:a,children:l}){const c=n.useMemo(()=>{const n=e??uo[t];if(i){if(e){const t=ro(ho(e));return{backgroundColor:e,color:"light"===t?"rgba(255,255,255,0.95)":"rgba(0,0,0,0.85)"}}return{backgroundColor:n,color:["amber","yellow","lime"].includes(t)?"rgba(0,0,0,0.85)":"rgba(255,255,255,0.95)"}}return{backgroundColor:`color-mix(in srgb, ${n} 15%, transparent)`,color:n}},[t,e,i]);return s.jsx("span",{className:g(lo,o&&"!px-1 !py-0 !text-[10px]",r),style:{...co,...c},title:a,children:l})}const mo=n.forwardRef(function({color:t="zinc",customColor:e,filled:i=!1,compact:r=!1,className:a,children:l,...c},u){const d=n.useMemo(()=>{const n=e??uo[t];if(i){if(e){const t=ro(ho(e));return{backgroundColor:e,color:"light"===t?"rgba(255,255,255,0.95)":"rgba(0,0,0,0.85)"}}return{backgroundColor:n,color:["amber","yellow","lime"].includes(t)?"rgba(0,0,0,0.85)":"rgba(255,255,255,0.95)"}}return{backgroundColor:`color-mix(in srgb, ${n} 15%, transparent)`,color:n}},[t,e,i]),h=g(lo,r&&"!px-1 !py-0 !text-[10px]","cursor-pointer transition-opacity hover:opacity-80",a);return"href"in c&&void 0!==c.href?s.jsx(Zi,{...c,ref:u,className:h,style:{...co,...d},children:l}):s.jsx(o,{...c,ref:u,className:h,style:{...co,...d},children:l})}),fo=g("relative inline-flex items-center justify-center gap-2","text-sm font-medium whitespace-nowrap","rounded-lg px-3 py-1.5","focus:outline-none focus-visible:ring-2 focus-visible:ring-accent-primary/50 focus-visible:ring-offset-1 focus-visible:ring-offset-bg-body","disabled:opacity-50 disabled:cursor-not-allowed","transition-all duration-150","[&>[data-slot=icon]]:w-4 [&>[data-slot=icon]]:h-4 [&>[data-slot=icon]]:shrink-0"),go={primary:g("bg-accent-primary text-white","hover:bg-accent-primary/90","active:bg-accent-primary/80","border border-accent-primary/20"),success:g("bg-accent-success text-white","hover:bg-accent-success/90","active:bg-accent-success/80","border border-accent-success/20"),danger:g("bg-accent-danger text-white","hover:bg-accent-danger/90","active:bg-accent-danger/80","border border-accent-danger/20"),warning:g("bg-accent-secondary text-bg-body","hover:bg-accent-secondary/90","active:bg-accent-secondary/80","border border-accent-secondary/20"),muted:g("bg-bg-elevated text-text-primary","hover:bg-bg-subtle","active:bg-bg-elevated","border border-border-subtle")},yo={primary:g("bg-transparent text-accent-primary","border border-accent-primary/30","hover:bg-accent-primary/10 hover:border-accent-primary/50","active:bg-accent-primary/20"),success:g("bg-transparent text-accent-success","border border-accent-success/30","hover:bg-accent-success/10 hover:border-accent-success/50","active:bg-accent-success/20"),danger:g("bg-transparent text-accent-danger","border border-accent-danger/30","hover:bg-accent-danger/10 hover:border-accent-danger/50","active:bg-accent-danger/20"),warning:g("bg-transparent text-accent-secondary","border border-accent-secondary/30","hover:bg-accent-secondary/10 hover:border-accent-secondary/50","active:bg-accent-secondary/20"),muted:g("bg-transparent text-text-muted","border border-border-subtle","hover:bg-bg-subtle hover:text-text-primary hover:border-border-strong","active:bg-bg-elevated")},vo={primary:g("bg-transparent text-accent-primary border-transparent","hover:bg-accent-primary/10","active:bg-accent-primary/20"),success:g("bg-transparent text-accent-success border-transparent","hover:bg-accent-success/10","active:bg-accent-success/20"),danger:g("bg-transparent text-accent-danger border-transparent","hover:bg-accent-danger/10","active:bg-accent-danger/20"),warning:g("bg-transparent text-accent-secondary border-transparent","hover:bg-accent-secondary/10","active:bg-accent-secondary/20"),muted:g("bg-transparent text-text-muted border-transparent","hover:bg-bg-subtle hover:text-text-primary","active:bg-bg-elevated")},xo=n.forwardRef(function({color:t="muted",outline:e=!1,plain:n=!1,className:i,children:r,...a},l){const c=g(fo,n?vo[t]:e?yo[t]:go[t],i);return"href"in a&&void 0!==a.href?s.jsx(Zi,{...a,ref:l,className:c,children:r}):s.jsx(o,{...a,ref:l,className:c,children:r})}),bo=t=>{const e=(t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,e,n)=>n?n.toUpperCase():e.toLowerCase()))(t);return e.charAt(0).toUpperCase()+e.slice(1)},wo=(...t)=>t.filter((t,e,n)=>Boolean(t)&&""!==t.trim()&&n.indexOf(t)===e).join(" ").trim(),ko=t=>{for(const e in t)if(e.startsWith("aria-")||"role"===e||"title"===e)return!0};var So={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const To=n.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:s=2,absoluteStrokeWidth:i,className:o="",children:r,iconNode:a,...l},c)=>n.createElement("svg",{ref:c,...So,width:e,height:e,stroke:t,strokeWidth:i?24*Number(s)/Number(e):s,className:wo("lucide",o),...!r&&!ko(l)&&{"aria-hidden":"true"},...l},[...a.map(([t,e])=>n.createElement(t,e)),...Array.isArray(r)?r:[r]])),Co=(t,e)=>{const s=n.forwardRef(({className:s,...i},o)=>{return n.createElement(To,{ref:o,iconNode:e,className:wo(`lucide-${r=bo(t),r.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${t}`,s),...i});var r});return s.displayName=bo(t),s},Mo=Co("chart-column",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]),Po=Co("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),Eo=Co("clock",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),jo=Co("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]),Lo=Co("gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]),Ao=Co("ghost",[["path",{d:"M9 10h.01",key:"qbtxuw"}],["path",{d:"M15 10h.01",key:"1qmjsl"}],["path",{d:"M12 2a8 8 0 0 0-8 8v12l3-3 2.5 2.5L12 19l2.5 2.5L17 19l3 3V10a8 8 0 0 0-8-8z",key:"uwwb07"}]]),Do=Co("layout-dashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]),No=Co("layout-list",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}],["path",{d:"M14 4h7",key:"3xa0d5"}],["path",{d:"M14 9h7",key:"1icrd9"}],["path",{d:"M14 15h7",key:"1mj8o2"}],["path",{d:"M14 20h7",key:"11slyb"}]]),Ro=Co("log-out",[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]]),Fo=Co("map-pin-plus",[["path",{d:"M19.914 11.105A7.298 7.298 0 0 0 20 10a8 8 0 0 0-16 0c0 4.993 5.539 10.193 7.399 11.799a1 1 0 0 0 1.202 0 32 32 0 0 0 .824-.738",key:"fcdtly"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M16 18h6",key:"987eiv"}],["path",{d:"M19 15v6",key:"10aioa"}]]),Io=Co("menu",[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]]),_o=Co("pause",[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]]),Bo=Co("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]),Vo=Co("radio",[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]),Oo=Co("send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]),zo=Co("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),$o=Co("sliders-vertical",[["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M12 21v-9",key:"17s77i"}],["path",{d:"M12 8V3",key:"13r4qs"}],["path",{d:"M17 16h4",key:"h1uq16"}],["path",{d:"M19 12V3",key:"o1uvq1"}],["path",{d:"M19 21v-5",key:"qua636"}],["path",{d:"M3 14h4",key:"bcjad9"}],["path",{d:"M5 10V3",key:"cb8scm"}],["path",{d:"M5 21v-7",key:"1w1uti"}]]),Wo=Co("square-terminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]),Uo=Co("waypoints",[["circle",{cx:"12",cy:"4.5",r:"2.5",key:"r5ysbb"}],["path",{d:"m10.2 6.3-3.9 3.9",key:"1nzqf6"}],["circle",{cx:"4.5",cy:"12",r:"2.5",key:"jydg6v"}],["path",{d:"M7 12h10",key:"b7w52i"}],["circle",{cx:"19.5",cy:"12",r:"2.5",key:"1piiel"}],["path",{d:"m13.8 17.7 3.9-3.9",key:"1wyg1y"}],["circle",{cx:"12",cy:"19.5",r:"2.5",key:"13o1pw"}]]),Ho=Co("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Yo=n.createContext({});function qo(t){const e=n.useRef(null);return null===e.current&&(e.current=t()),e.current}const Go="undefined"!=typeof window,Xo=Go?n.useLayoutEffect:n.useEffect,Ko=n.createContext(null);function Jo(t,e){-1===t.indexOf(e)&&t.push(e)}function Zo(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const Qo=(t,e,n)=>n>e?e:n/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function nr(t){return"object"==typeof t&&null!==t}const sr=t=>/^0[^.\s]+$/u.test(t);function ir(t){let e;return()=>(void 0===e&&(e=t()),e)}const or=t=>t,rr=(t,e)=>n=>e(t(n)),ar=(...t)=>t.reduce(rr),lr=(t,e,n)=>{const s=e-t;return 0===s?1:(n-t)/s};class cr{constructor(){this.subscriptions=[]}add(t){return Jo(this.subscriptions,t),()=>Zo(this.subscriptions,t)}notify(t,e,n){const s=this.subscriptions.length;if(s)if(1===s)this.subscriptions[0](t,e,n);else for(let i=0;i1e3*t,dr=t=>t/1e3;function hr(t,e){return e?t*(1e3/e):0}const pr=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function mr(t,e,n,s){if(t===e&&n===s)return or;return i=>0===i||1===i?i:pr(function(t,e,n,s,i){let o,r,a=0;do{r=e+(n-e)/2,o=pr(r,s,i)-t,o>0?n=r:e=r}while(Math.abs(o)>1e-7&&++a<12);return r}(i,0,1,t,n),e,s)}const fr=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,gr=t=>e=>1-t(1-e),yr=mr(.33,1.53,.69,.99),vr=gr(yr),xr=fr(vr),br=t=>(t*=2)<1?.5*vr(t):.5*(2-Math.pow(2,-10*(t-1))),wr=t=>1-Math.sin(Math.acos(t)),kr=gr(wr),Sr=fr(wr),Tr=mr(.42,0,1,1),Cr=mr(0,0,.58,1),Mr=mr(.42,0,.58,1),Pr=t=>Array.isArray(t)&&"number"!=typeof t[0],Er=t=>Array.isArray(t)&&"number"==typeof t[0],jr={linear:or,easeIn:Tr,easeInOut:Mr,easeOut:Cr,circIn:wr,circInOut:Sr,circOut:kr,backIn:vr,backInOut:xr,backOut:yr,anticipate:br},Lr=t=>{if(Er(t)){t.length;const[e,n,s,i]=t;return mr(e,n,s,i)}return"string"==typeof t?jr[t]:t},Ar=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function Dr(t,e){let n=!1,s=!0;const i={delta:0,timestamp:0,isProcessing:!1},o=()=>n=!0,r=Ar.reduce((t,e)=>(t[e]=function(t){let e=new Set,n=new Set,s=!1,i=!1;const o=new WeakSet;let r={delta:0,timestamp:0,isProcessing:!1};function a(e){o.has(e)&&(l.schedule(e),t()),e(r)}const l={schedule:(t,i=!1,r=!1)=>{const a=r&&s?e:n;return i&&o.add(t),a.has(t)||a.add(t),t},cancel:t=>{n.delete(t),o.delete(t)},process:t=>{r=t,s?i=!0:(s=!0,[e,n]=[n,e],e.forEach(a),e.clear(),s=!1,i&&(i=!1,l.process(t)))}};return l}(o),t),{}),{setup:a,read:l,resolveKeyframes:c,preUpdate:u,update:d,preRender:h,render:p,postRender:m}=r,f=()=>{const o=tr.useManualTiming?i.timestamp:performance.now();n=!1,tr.useManualTiming||(i.delta=s?1e3/60:Math.max(Math.min(o-i.timestamp,40),1)),i.timestamp=o,i.isProcessing=!0,a.process(i),l.process(i),c.process(i),u.process(i),d.process(i),h.process(i),p.process(i),m.process(i),i.isProcessing=!1,n&&e&&(s=!1,t(f))};return{schedule:Ar.reduce((e,o)=>{const a=r[o];return e[o]=(e,o=!1,r=!1)=>(n||(n=!0,s=!0,i.isProcessing||t(f)),a.schedule(e,o,r)),e},{}),cancel:t=>{for(let e=0;e(void 0===_r&&Vr.set(Fr.isProcessing||tr.useManualTiming?Fr.timestamp:performance.now()),_r),set:t=>{_r=t,queueMicrotask(Br)}},Or=t=>e=>"string"==typeof e&&e.startsWith(t),zr=Or("--"),$r=Or("var(--"),Wr=t=>!!$r(t)&&Ur.test(t.split("/*")[0].trim()),Ur=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function Hr(t){return"string"==typeof t&&t.split("/*")[0].includes("var(--")}const Yr={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},qr={...Yr,transform:t=>Qo(0,1,t)},Gr={...Yr,default:1},Xr=t=>Math.round(1e5*t)/1e5,Kr=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu,Jr=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Zr=(t,e)=>n=>Boolean("string"==typeof n&&Jr.test(n)&&n.startsWith(t)||e&&!function(t){return null==t}(n)&&Object.prototype.hasOwnProperty.call(n,e)),Qr=(t,e,n)=>s=>{if("string"!=typeof s)return s;const[i,o,r,a]=s.match(Kr);return{[t]:parseFloat(i),[e]:parseFloat(o),[n]:parseFloat(r),alpha:void 0!==a?parseFloat(a):1}},ta={...Yr,transform:t=>Math.round((t=>Qo(0,255,t))(t))},ea={test:Zr("rgb","red"),parse:Qr("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:s=1})=>"rgba("+ta.transform(t)+", "+ta.transform(e)+", "+ta.transform(n)+", "+Xr(qr.transform(s))+")"},na={test:Zr("#"),parse:function(t){let e="",n="",s="",i="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),s=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),s=t.substring(3,4),i=t.substring(4,5),e+=e,n+=n,s+=s,i+=i),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(s,16),alpha:i?parseInt(i,16)/255:1}},transform:ea.transform},sa=t=>({test:e=>"string"==typeof e&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),ia=sa("deg"),oa=sa("%"),ra=sa("px"),aa=sa("vh"),la=sa("vw"),ca=(()=>({...oa,parse:t=>oa.parse(t)/100,transform:t=>oa.transform(100*t)}))(),ua={test:Zr("hsl","hue"),parse:Qr("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:s=1})=>"hsla("+Math.round(t)+", "+oa.transform(Xr(e))+", "+oa.transform(Xr(n))+", "+Xr(qr.transform(s))+")"},da={test:t=>ea.test(t)||na.test(t)||ua.test(t),parse:t=>ea.test(t)?ea.parse(t):ua.test(t)?ua.parse(t):na.parse(t),transform:t=>"string"==typeof t?t:t.hasOwnProperty("red")?ea.transform(t):ua.transform(t),getAnimatableNone:t=>{const e=da.parse(t);return e.alpha=0,da.transform(e)}},ha=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,pa="number",ma="color",fa=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function ga(t){const e=t.toString(),n=[],s={color:[],number:[],var:[]},i=[];let o=0;const r=e.replace(fa,t=>(da.test(t)?(s.color.push(o),i.push(ma),n.push(da.parse(t))):t.startsWith("var(")?(s.var.push(o),i.push("var"),n.push(t)):(s.number.push(o),i.push(pa),n.push(parseFloat(t))),++o,"${}")).split("${}");return{values:n,split:r,indexes:s,types:i}}function ya(t){return ga(t).values}function va(t){const{split:e,types:n}=ga(t),s=e.length;return t=>{let i="";for(let o=0;o"number"==typeof t?0:da.test(t)?da.getAnimatableNone(t):t,ba={test:function(t){var e,n;return isNaN(t)&&"string"==typeof t&&((null==(e=t.match(Kr))?void 0:e.length)||0)+((null==(n=t.match(ha))?void 0:n.length)||0)>0},parse:ya,createTransformer:va,getAnimatableNone:function(t){const e=ya(t);return va(t)(e.map(xa))}};function wa(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function ka(t,e){return n=>n>0?e:t}const Sa=(t,e,n)=>t+(e-t)*n,Ta=(t,e,n)=>{const s=t*t,i=n*(e*e-s)+s;return i<0?0:Math.sqrt(i)},Ca=[na,ea,ua];function Ma(t){const e=(n=t,Ca.find(t=>t.test(n)));var n;if(!Boolean(e))return!1;let s=e.parse(t);return e===ua&&(s=function({hue:t,saturation:e,lightness:n,alpha:s}){t/=360,n/=100;let i=0,o=0,r=0;if(e/=100){const s=n<.5?n*(1+e):n+e-n*e,a=2*n-s;i=wa(a,s,t+1/3),o=wa(a,s,t),r=wa(a,s,t-1/3)}else i=o=r=n;return{red:Math.round(255*i),green:Math.round(255*o),blue:Math.round(255*r),alpha:s}}(s)),s}const Pa=(t,e)=>{const n=Ma(t),s=Ma(e);if(!n||!s)return ka(t,e);const i={...n};return t=>(i.red=Ta(n.red,s.red,t),i.green=Ta(n.green,s.green,t),i.blue=Ta(n.blue,s.blue,t),i.alpha=Sa(n.alpha,s.alpha,t),ea.transform(i))},Ea=new Set(["none","hidden"]);function ja(t,e){return n=>Sa(t,e,n)}function La(t){return"number"==typeof t?ja:"string"==typeof t?Wr(t)?ka:da.test(t)?Pa:Na:Array.isArray(t)?Aa:"object"==typeof t?da.test(t)?Pa:Da:ka}function Aa(t,e){const n=[...t],s=n.length,i=t.map((t,n)=>La(t)(t,e[n]));return t=>{for(let e=0;e{for(const e in s)n[e]=s[e](t);return n}}const Na=(t,e)=>{const n=ba.createTransformer(e),s=ga(t),i=ga(e);return s.indexes.var.length===i.indexes.var.length&&s.indexes.color.length===i.indexes.color.length&&s.indexes.number.length>=i.indexes.number.length?Ea.has(t)&&!i.values.length||Ea.has(e)&&!s.values.length?function(t,e){return Ea.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}(t,e):ar(Aa(function(t,e){const n=[],s={color:0,var:0,number:0};for(let i=0;i{const e=({timestamp:e})=>t(e);return{start:(t=!0)=>Nr.update(e,t),stop:()=>Rr(e),now:()=>Fr.isProcessing?Fr.timestamp:Vr.now()}},Ia=(t,e,n=10)=>{let s="";const i=Math.max(Math.round(e/n),2);for(let o=0;o=_a?1/0:e}function Va(t,e=100,n){const s=n({...t,keyframes:[0,e]}),i=Math.min(Ba(s),_a);return{type:"keyframes",ease:t=>s.next(i*t).value/e,duration:dr(i)}}function Oa(t,e,n){const s=Math.max(e-5,0);return hr(n-t(s),e-s)}const za=.01,$a=2,Wa=.005,Ua=.5;const Ha=12;function Ya(t,e){return t*Math.sqrt(1-e*e)}const qa=["duration","bounce"],Ga=["stiffness","damping","mass"];function Xa(t,e){return e.some(e=>void 0!==t[e])}function Ka(t=.3,e=.3){const n="object"!=typeof t?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:s,restDelta:i}=n;const o=n.keyframes[0],r=n.keyframes[n.keyframes.length-1],a={done:!1,value:o},{stiffness:l,damping:c,mass:u,duration:d,velocity:h,isResolvedFromDuration:p}=function(t){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!Xa(t,Ga)&&Xa(t,qa))if(t.visualDuration){const n=t.visualDuration,s=2*Math.PI/(1.2*n),i=s*s,o=2*Qo(.05,1,1-(t.bounce||0))*Math.sqrt(i);e={...e,mass:1,stiffness:i,damping:o}}else{const n=function({duration:t=800,bounce:e=.3,velocity:n=0,mass:s=1}){let i,o,r=1-e;r=Qo(.05,1,r),t=Qo(.01,10,dr(t)),r<1?(i=e=>{const s=e*r,i=s*t;return.001-(s-n)/Ya(e,r)*Math.exp(-i)},o=e=>{const s=e*r*t,o=s*n+n,a=Math.pow(r,2)*Math.pow(e,2)*t,l=Math.exp(-s),c=Ya(Math.pow(e,2),r);return(.001-i(e)>0?-1:1)*((o-a)*l)/c}):(i=e=>Math.exp(-e*t)*((e-n)*t+1)-.001,o=e=>Math.exp(-e*t)*(t*t*(n-e)));const a=function(t,e,n){let s=n;for(let i=1;i{const n=Math.exp(-f*y*e);return r-n*((m+f*y*g)/t*Math.sin(t*e)+g*Math.cos(t*e))}}else if(1===f)x=t=>r-Math.exp(-y*t)*(g+(m+y*g)*t);else{const t=y*Math.sqrt(f*f-1);x=e=>{const n=Math.exp(-f*y*e),s=Math.min(t*e,300);return r-n*((m+f*y*g)*Math.sinh(s)+t*g*Math.cosh(s))/t}}const b={calculatedDuration:p&&d||null,next:t=>{const e=x(t);if(p)a.done=t>=d;else{let n=0===t?m:0;f<1&&(n=0===t?ur(m):Oa(x,t,e));const o=Math.abs(n)<=s,l=Math.abs(r-e)<=i;a.done=o&&l}return a.value=a.done?r:e,a},toString:()=>{const t=Math.min(Ba(b),_a),e=Ia(e=>b.next(t*e).value,t,30);return t+"ms "+e},toTransition:()=>{}};return b}function Ja({keyframes:t,velocity:e=0,power:n=.8,timeConstant:s=325,bounceDamping:i=10,bounceStiffness:o=500,modifyTarget:r,min:a,max:l,restDelta:c=.5,restSpeed:u}){const d=t[0],h={done:!1,value:d},p=t=>void 0===a?l:void 0===l||Math.abs(a-t)-m*Math.exp(-t/s),v=t=>g+y(t),x=t=>{const e=y(t),n=v(t);h.done=Math.abs(e)<=c,h.value=h.done?g:n};let b,w;const k=t=>{var e;e=h.value,(void 0!==a&&el)&&(b=t,w=Ka({keyframes:[h.value,p(h.value)],velocity:Oa(v,t,h.value),damping:i,stiffness:o,restDelta:c,restSpeed:u}))};return k(0),{calculatedDuration:null,next:t=>{let e=!1;return w||void 0!==b||(e=!0,x(t),k(t)),void 0!==b&&t>=b?w.next(t-b):(!e&&x(t),h)}}}function Za(t,e){const n=t[t.length-1];for(let s=1;s<=e;s++){const i=lr(0,e,s);t.push(Sa(n,1,i))}}function Qa(t){const e=[0];return Za(e,t.length-1),e}function tl({duration:t=300,keyframes:e,times:n,ease:s="easeInOut"}){const i=Pr(s)?s.map(Lr):Lr(s),o={done:!1,value:e[0]},r=function(t,e){return t.map(t=>t*e)}(n&&n.length===e.length?n:Qa(e),t),a=function(t,e,{clamp:n=!0,ease:s,mixer:i}={}){const o=t.length;if(e.length,1===o)return()=>e[0];if(2===o&&e[0]===e[1])return()=>e[1];const r=t[0]===t[1];t[0]>t[o-1]&&(t=[...t].reverse(),e=[...e].reverse());const a=function(t,e,n){const s=[],i=n||tr.mix||Ra,o=t.length-1;for(let r=0;r{if(r&&n1)for(;sc(Qo(t[0],t[o-1],e)):c}(r,e,{ease:Array.isArray(i)?i:(l=e,c=i,l.map(()=>c||Mr).splice(0,l.length-1))});var l,c;return{calculatedDuration:t,next:e=>(o.value=a(e),o.done=e>=t,o)}}Ka.applyToOptions=t=>{const e=Va(t,100,Ka);return t.ease=e.ease,t.duration=ur(e.duration),t.type="keyframes",t};const el=t=>null!==t;function nl(t,{repeat:e,repeatType:n="loop"},s,i=1){const o=t.filter(el),r=i<0||e&&"loop"!==n&&e%2==1?0:o.length-1;return r&&void 0!==s?s:o[r]}const sl={decay:Ja,inertia:Ja,tween:tl,keyframes:tl,spring:Ka};function il(t){"string"==typeof t.type&&(t.type=sl[t.type])}class ol{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,e){return this.finished.then(t,e)}}const rl=t=>t/100;class al extends ol{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{var t,e;const{motionValue:n}=this.options;n&&n.updatedAt!==Vr.now()&&this.tick(Vr.now()),this.isStopped=!0,"idle"!==this.state&&(this.teardown(),null==(e=(t=this.options).onStop)||e.call(t))},this.options=t,this.initAnimation(),this.play(),!1===t.autoplay&&this.pause()}initAnimation(){const{options:t}=this;il(t);const{type:e=tl,repeat:n=0,repeatDelay:s=0,repeatType:i,velocity:o=0}=t;let{keyframes:r}=t;const a=e||tl;a!==tl&&"number"!=typeof r[0]&&(this.mixKeyframes=ar(rl,Ra(r[0],r[1])),r=[0,100]);const l=a({...t,keyframes:r});"mirror"===i&&(this.mirroredGenerator=a({...t,keyframes:[...r].reverse(),velocity:-o})),null===l.calculatedDuration&&(l.calculatedDuration=Ba(l));const{calculatedDuration:c}=l;this.calculatedDuration=c,this.resolvedDuration=c+s,this.totalDuration=this.resolvedDuration*(n+1)-s,this.generator=l}updateTime(t){const e=Math.round(t-this.startTime)*this.playbackSpeed;null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=e}tick(t,e=!1){const{generator:n,totalDuration:s,mixKeyframes:i,mirroredGenerator:o,resolvedDuration:r,calculatedDuration:a}=this;if(null===this.startTime)return n.next(0);const{delay:l=0,keyframes:c,repeat:u,repeatType:d,repeatDelay:h,type:p,onUpdate:m,finalKeyframe:f}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-s/this.speed,this.startTime)),e?this.currentTime=t:this.updateTime(t);const g=this.currentTime-l*(this.playbackSpeed>=0?1:-1),y=this.playbackSpeed>=0?g<0:g>s;this.currentTime=Math.max(g,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=s);let v=this.currentTime,x=n;if(u){const t=Math.min(this.currentTime,s)/r;let e=Math.floor(t),n=t%1;!n&&t>=1&&(n=1),1===n&&e--,e=Math.min(e,u+1),Boolean(e%2)&&("reverse"===d?(n=1-n,h&&(n-=h/r)):"mirror"===d&&(x=o)),v=Qo(0,1,n)*r}const b=y?{done:!1,value:c[0]}:x.next(v);i&&(b.value=i(b.value));let{done:w}=b;y||null===a||(w=this.playbackSpeed>=0?this.currentTime>=s:this.currentTime<=0);const k=null===this.holdTime&&("finished"===this.state||"running"===this.state&&w);return k&&p!==Ja&&(b.value=nl(c,this.options,f,this.speed)),m&&m(b.value),k&&this.finish(),b}then(t,e){return this.finished.then(t,e)}get duration(){return dr(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+dr(t)}get time(){return dr(this.currentTime)}set time(t){var e;t=ur(t),this.currentTime=t,null===this.startTime||null!==this.holdTime||0===this.playbackSpeed?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),null==(e=this.driver)||e.start(!1)}get speed(){return this.playbackSpeed}set speed(t){this.updateTime(Vr.now());const e=this.playbackSpeed!==t;this.playbackSpeed=t,e&&(this.time=dr(this.currentTime))}play(){var t,e;if(this.isStopped)return;const{driver:n=Fa,startTime:s}=this.options;this.driver||(this.driver=n(t=>this.tick(t))),null==(e=(t=this.options).onPlay)||e.call(t);const i=this.driver.now();"finished"===this.state?(this.updateFinished(),this.startTime=i):null!==this.holdTime?this.startTime=i-this.holdTime:this.startTime||(this.startTime=s??i),"finished"===this.state&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(Vr.now()),this.holdTime=this.currentTime}complete(){"running"!==this.state&&this.play(),this.state="finished",this.holdTime=null}finish(){var t,e;this.notifyFinished(),this.teardown(),this.state="finished",null==(e=(t=this.options).onComplete)||e.call(t)}cancel(){var t,e;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),null==(e=(t=this.options).onCancel)||e.call(t)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){var e;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),null==(e=this.driver)||e.stop(),t.observe(this)}}const ll=t=>180*t/Math.PI,cl=t=>{const e=ll(Math.atan2(t[1],t[0]));return dl(e)},ul={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:cl,rotateZ:cl,skewX:t=>ll(Math.atan(t[1])),skewY:t=>ll(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},dl=t=>((t%=360)<0&&(t+=360),t),hl=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),pl=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),ml={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:hl,scaleY:pl,scale:t=>(hl(t)+pl(t))/2,rotateX:t=>dl(ll(Math.atan2(t[6],t[5]))),rotateY:t=>dl(ll(Math.atan2(-t[2],t[0]))),rotateZ:cl,rotate:cl,skewX:t=>ll(Math.atan(t[4])),skewY:t=>ll(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function fl(t){return t.includes("scale")?1:0}function gl(t,e){if(!t||"none"===t)return fl(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let s,i;if(n)s=ml,i=n;else{const e=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);s=ul,i=e}if(!i)return fl(e);const o=s[e],r=i[1].split(",").map(yl);return"function"==typeof o?o(r):r[o]}function yl(t){return parseFloat(t.trim())}const vl=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],xl=(()=>new Set(vl))(),bl=t=>t===Yr||t===ra,wl=new Set(["x","y","z"]),kl=vl.filter(t=>!wl.has(t)),Sl={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>gl(e,"x"),y:(t,{transform:e})=>gl(e,"y")};Sl.translateX=Sl.x,Sl.translateY=Sl.y;const Tl=new Set;let Cl=!1,Ml=!1,Pl=!1;function El(){if(Ml){const t=Array.from(Tl).filter(t=>t.needsMeasurement),e=new Set(t.map(t=>t.element)),n=new Map;e.forEach(t=>{const e=function(t){const e=[];return kl.forEach(n=>{const s=t.getValue(n);void 0!==s&&(e.push([n,s.get()]),s.set(n.startsWith("scale")?1:0))}),e}(t);e.length&&(n.set(t,e),t.render())}),t.forEach(t=>t.measureInitialState()),e.forEach(t=>{t.render();const e=n.get(t);e&&e.forEach(([e,n])=>{var s;null==(s=t.getValue(e))||s.set(n)})}),t.forEach(t=>t.measureEndState()),t.forEach(t=>{void 0!==t.suspendedScrollY&&window.scrollTo(0,t.suspendedScrollY)})}Ml=!1,Cl=!1,Tl.forEach(t=>t.complete(Pl)),Tl.clear()}function jl(){Tl.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Ml=!0)})}class Ll{constructor(t,e,n,s,i,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=e,this.name=n,this.motionValue=s,this.element=i,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(Tl.add(this),Cl||(Cl=!0,Nr.read(jl),Nr.resolveKeyframes(El))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:e,element:n,motionValue:s}=this;if(null===t[0]){const i=null==s?void 0:s.get(),o=t[t.length-1];if(void 0!==i)t[0]=i;else if(n&&e){const s=n.readValue(e,o);null!=s&&(t[0]=s)}void 0===t[0]&&(t[0]=o),s&&void 0===i&&s.set(t[0])}!function(t){for(let e=1;evoid 0!==window.ScrollTimeline),Dl={};function Nl(t,e){const n=ir(t);return()=>Dl[e]??n()}const Rl=Nl(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0},"linearEasing"),Fl=([t,e,n,s])=>`cubic-bezier(${t}, ${e}, ${n}, ${s})`,Il={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Fl([0,.65,.55,1]),circOut:Fl([.55,0,1,.45]),backIn:Fl([.31,.01,.66,-.59]),backOut:Fl([.33,1.53,.69,.99])};function _l(t,e){return t?"function"==typeof t?Rl()?Ia(t,e):"ease-out":Er(t)?Fl(t):Array.isArray(t)?t.map(t=>_l(t,e)||Il.easeOut):Il[t]:void 0}function Bl(t,e,n,{delay:s=0,duration:i=300,repeat:o=0,repeatType:r="loop",ease:a="easeOut",times:l}={},c=void 0){const u={[e]:n};l&&(u.offset=l);const d=_l(a,i);Array.isArray(d)&&(u.easing=d);const h={delay:s,duration:i,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:o+1,direction:"reverse"===r?"alternate":"normal"};return c&&(h.pseudoElement=c),t.animate(u,h)}function Vl(t){return"function"==typeof t&&"applyToOptions"in t}class Ol extends ol{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:e,name:n,keyframes:s,pseudoElement:i,allowFlatten:o=!1,finalKeyframe:r,onComplete:a}=t;this.isPseudoElement=Boolean(i),this.allowFlatten=o,this.options=t,t.type;const l=function({type:t,...e}){return Vl(t)&&Rl()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}(t);this.animation=Bl(e,n,s,l,i),!1===l.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){const t=nl(s,this.options,r,this.speed);this.updateMotionValue?this.updateMotionValue(t):function(t,e,n){(t=>t.startsWith("--"))(e)?t.style.setProperty(e,n):t.style[e]=n}(e,n,t),this.animation.cancel()}null==a||a(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),"finished"===this.state&&this.updateFinished())}pause(){this.animation.pause()}complete(){var t,e;null==(e=(t=this.animation).finish)||e.call(t)}cancel(){try{this.animation.cancel()}catch(t){}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;"idle"!==t&&"finished"!==t&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var t,e;this.isPseudoElement||null==(e=(t=this.animation).commitStyles)||e.call(t)}get duration(){var t,e;const n=(null==(e=null==(t=this.animation.effect)?void 0:t.getComputedTiming)?void 0:e.call(t).duration)||0;return dr(Number(n))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+dr(t)}get time(){return dr(Number(this.animation.currentTime)||0)}set time(t){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=ur(t)}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return null!==this.finishedTime?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,observe:e}){var n;return this.allowFlatten&&(null==(n=this.animation.effect)||n.updateTiming({easing:"linear"})),this.animation.onfinish=null,t&&Al()?(this.animation.timeline=t,or):e(this)}}const zl={anticipate:br,backInOut:xr,circInOut:Sr};class $l extends Ol{constructor(t){var e;"string"==typeof(e=t).ease&&e.ease in zl&&(e.ease=zl[e.ease]),il(t),super(t),void 0!==t.startTime&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:e,onUpdate:n,onComplete:s,element:i,...o}=this.options;if(!e)return;if(void 0!==t)return void e.set(t);const r=new al({...o,autoplay:!1}),a=Math.max(10,Vr.now()-this.startTime),l=Qo(0,10,a-10);e.setWithVelocity(r.sample(Math.max(0,a-l)).value,r.sample(a).value,l),r.stop()}}const Wl=(t,e)=>!("zIndex"===e||"number"!=typeof t&&!Array.isArray(t)&&("string"!=typeof t||!ba.test(t)&&"0"!==t||t.startsWith("url(")));function Ul(t){t.duration=0,t.type="keyframes"}const Hl=new Set(["opacity","clipPath","filter","transform"]),Yl=ir(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));class ql extends ol{constructor({autoplay:t=!0,delay:e=0,type:n="keyframes",repeat:s=0,repeatDelay:i=0,repeatType:o="loop",keyframes:r,name:a,motionValue:l,element:c,...u}){var d;super(),this.stop=()=>{var t,e;this._animation&&(this._animation.stop(),null==(t=this.stopTimeline)||t.call(this)),null==(e=this.keyframeResolver)||e.cancel()},this.createdAt=Vr.now();const h={autoplay:t,delay:e,type:n,repeat:s,repeatDelay:i,repeatType:o,name:a,motionValue:l,element:c,...u},p=(null==c?void 0:c.KeyframeResolver)||Ll;this.keyframeResolver=new p(r,(t,e,n)=>this.onKeyframesResolved(t,e,h,!n),a,l,c),null==(d=this.keyframeResolver)||d.scheduleResolve()}onKeyframesResolved(t,e,n,s){var i,o;this.keyframeResolver=void 0;const{name:r,type:a,velocity:l,delay:c,isHandoff:u,onUpdate:d}=n;this.resolvedAt=Vr.now(),function(t,e,n,s){const i=t[0];if(null===i)return!1;if("display"===e||"visibility"===e)return!0;const o=t[t.length-1],r=Wl(i,e),a=Wl(o,e);return!(!r||!a)&&(function(t){const e=t[0];if(1===t.length)return!0;for(let n=0;n40?this.resolvedAt:this.createdAt:void 0,finalKeyframe:e,...n,keyframes:t},p=!u&&function(t){var e;const{motionValue:n,name:s,repeatDelay:i,repeatType:o,damping:r,type:a}=t;if(!((null==(e=null==n?void 0:n.owner)?void 0:e.current)instanceof HTMLElement))return!1;const{onUpdate:l,transformTemplate:c}=n.owner.getProps();return Yl()&&s&&Hl.has(s)&&("transform"!==s||!c)&&!l&&!i&&"mirror"!==o&&0!==r&&"inertia"!==a}(h),m=null==(o=null==(i=h.motionValue)?void 0:i.owner)?void 0:o.current,f=p?new $l({...h,element:m}):new al(h);f.finished.then(()=>{this.notifyFinished()}).catch(or),this.pendingTimeline&&(this.stopTimeline=f.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=f}get finished(){return this._animation?this.animation.finished:this._finished}then(t,e){return this.finished.finally(t).then(()=>{})}get animation(){var t;return this._animation||(null==(t=this.keyframeResolver)||t.resume(),Pl=!0,jl(),El(),Pl=!1),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var t;this._animation&&this.animation.cancel(),null==(t=this.keyframeResolver)||t.cancel()}}function Gl(t,e,n,s=0,i=1){const o=Array.from(t).sort((t,e)=>t.sortNodePosition(e)).indexOf(e),r=t.size,a=(r-1)*s;return"function"==typeof n?n(o,r):1===i?o*s:a-o*s}const Xl=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Kl(t,e,n=1){const[s,i]=function(t){const e=Xl.exec(t);if(!e)return[,];const[,n,s,i]=e;return[`--${n??s}`,i]}(t);if(!s)return;const o=window.getComputedStyle(e).getPropertyValue(s);if(o){const t=o.trim();return er(t)?parseFloat(t):t}return Wr(i)?Kl(i,e,n+1):i}const Jl={type:"spring",stiffness:500,damping:25,restSpeed:10},Zl={type:"keyframes",duration:.8},Ql={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},tc=t=>null!==t;function ec(t,e){return(null==t?void 0:t[e])??(null==t?void 0:t.default)??t}const nc=(t,e,n,s={},i,o)=>r=>{const a=ec(s,t)||{},l=a.delay||s.delay||0;let{elapsed:c=0}=s;c-=ur(l);const u={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-c,onUpdate:t=>{e.set(t),a.onUpdate&&a.onUpdate(t)},onComplete:()=>{r(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:o?void 0:i};(function({when:t,delay:e,delayChildren:n,staggerChildren:s,staggerDirection:i,repeat:o,repeatType:r,repeatDelay:a,from:l,elapsed:c,...u}){return!!Object.keys(u).length})(a)||Object.assign(u,((t,{keyframes:e})=>e.length>2?Zl:xl.has(t)?t.startsWith("scale")?{type:"spring",stiffness:550,damping:0===e[1]?2*Math.sqrt(550):30,restSpeed:10}:Jl:Ql)(t,u)),u.duration&&(u.duration=ur(u.duration)),u.repeatDelay&&(u.repeatDelay=ur(u.repeatDelay)),void 0!==u.from&&(u.keyframes[0]=u.from);let d=!1;if((!1===u.type||0===u.duration&&!u.repeatDelay)&&(Ul(u),0===u.delay&&(d=!0)),(tr.instantAnimations||tr.skipAnimations)&&(d=!0,Ul(u),u.delay=0),u.allowFlatten=!a.type&&!a.ease,d&&!o&&void 0!==e.get()){const t=function(t,{repeat:e,repeatType:n="loop"}){const s=t.filter(tc);return s[e&&"loop"!==n&&e%2==1?0:s.length-1]}(u.keyframes,a);if(void 0!==t)return void Nr.update(()=>{u.onUpdate(t),u.onComplete()})}return a.isSync?new al(u):new ql(u)};function sc(t){const e=[{},{}];return null==t||t.values.forEach((t,n)=>{e[0][n]=t.get(),e[1][n]=t.getVelocity()}),e}function ic(t,e,n,s){if("function"==typeof e){const[i,o]=sc(s);e=e(void 0!==n?n:t.custom,i,o)}if("string"==typeof e&&(e=t.variants&&t.variants[e]),"function"==typeof e){const[i,o]=sc(s);e=e(void 0!==n?n:t.custom,i,o)}return e}function oc(t,e,n){const s=t.getProps();return ic(s,e,void 0!==n?n:s.custom,t)}const rc=new Set(["width","height","top","left","right","bottom",...vl]);class ac{constructor(t,e={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=t=>{var e;const n=Vr.now();if(this.updatedAt!==n&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(t),this.current!==this.prev&&(null==(e=this.events.change)||e.notify(this.current),this.dependents))for(const s of this.dependents)s.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=e.owner}setCurrent(t){var e;this.current=t,this.updatedAt=Vr.now(),null===this.canTrackVelocity&&void 0!==t&&(this.canTrackVelocity=(e=this.current,!isNaN(parseFloat(e))))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,e){this.events[t]||(this.events[t]=new cr);const n=this.events[t].add(e);return"change"===t?()=>{n(),Nr.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,e){this.passiveEffect=t,this.stopPassiveEffect=e}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,e,n){this.set(e),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-n}jump(t,e=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,e&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var t;null==(t=this.events.change)||t.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=Vr.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return hr(parseFloat(this.current)-parseFloat(this.prevFrameValue),e)}start(t){return this.stop(),new Promise(e=>{this.hasAnimated=!0,this.animation=t(e),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var t,e;null==(t=this.dependents)||t.clear(),null==(e=this.events.destroy)||e.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function lc(t,e){return new ac(t,e)}const cc=t=>Array.isArray(t);function uc(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,lc(n))}function dc(t){return cc(t)?t[t.length-1]||0:t}function hc(t,e){const n=oc(t,e);let{transitionEnd:s={},transition:i={},...o}=n||{};o={...o,...s};for(const r in o)uc(t,r,dc(o[r]))}const pc=t=>Boolean(t&&t.getVelocity);function mc(t,e){const n=t.getValue("willChange");if(s=n,Boolean(pc(s)&&s.add))return n.add(e);if(!n&&tr.WillChange){const n=new tr.WillChange("auto");t.addValue("willChange",n),n.add(e)}var s}function fc(t){return t.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const gc="data-"+fc("framerAppearId");function yc(t){return t.props[gc]}function vc({protectedKeys:t,needsAnimating:e},n){const s=t.hasOwnProperty(n)&&!0!==e[n];return e[n]=!1,s}function xc(t,e,{delay:n=0,transitionOverride:s,type:i}={}){let{transition:o=t.getDefaultTransition(),transitionEnd:r,...a}=e;s&&(o=s);const l=[],c=i&&t.animationState&&t.animationState.getState()[i];for(const u in a){const e=t.getValue(u,t.latestValues[u]??null),s=a[u];if(void 0===s||c&&vc(c,u))continue;const i={delay:n,...ec(o||{},u)},r=e.get();if(void 0!==r&&!e.isAnimating&&!Array.isArray(s)&&s===r&&!i.velocity)continue;let d=!1;if(window.MotionHandoffAnimation){const e=yc(t);if(e){const t=window.MotionHandoffAnimation(e,u,Nr);null!==t&&(i.startTime=t,d=!0)}}mc(t,u),e.start(nc(u,e,s,t.shouldReduceMotion&&rc.has(u)?{type:!1}:i,t,d));const h=e.animation;h&&l.push(h)}return r&&Promise.all(l).then(()=>{Nr.update(()=>{r&&hc(t,r)})}),l}function bc(t,e,n={}){var s;const i=oc(t,e,"exit"===n.type?null==(s=t.presenceContext)?void 0:s.custom:void 0);let{transition:o=t.getDefaultTransition()||{}}=i||{};n.transitionOverride&&(o=n.transitionOverride);const r=i?()=>Promise.all(xc(t,i,n)):()=>Promise.resolve(),a=t.variantChildren&&t.variantChildren.size?(s=0)=>{const{delayChildren:i=0,staggerChildren:r,staggerDirection:a}=o;return function(t,e,n=0,s=0,i=0,o=1,r){const a=[];for(const l of t.variantChildren)l.notify("AnimationStart",e),a.push(bc(l,e,{...r,delay:n+("function"==typeof s?0:s)+Gl(t.variantChildren,l,s,i,o)}).then(()=>l.notify("AnimationComplete",e)));return Promise.all(a)}(t,e,s,i,r,a,n)}:()=>Promise.resolve(),{when:l}=o;if(l){const[t,e]="beforeChildren"===l?[r,a]:[a,r];return t().then(()=>e())}return Promise.all([r(),a(n.delay)])}function wc(t,e,n={}){let s;if(t.notify("AnimationStart",e),Array.isArray(e)){const i=e.map(e=>bc(t,e,n));s=Promise.all(i)}else if("string"==typeof e)s=bc(t,e,n);else{const i="function"==typeof e?oc(t,e,n.custom):e;s=Promise.all(xc(t,i,n))}return s.then(()=>{t.notify("AnimationComplete",e)})}const kc=t=>e=>e.test(t),Sc=[Yr,ra,oa,ia,la,aa,{test:t=>"auto"===t,parse:t=>t}],Tc=t=>Sc.find(kc(t));function Cc(t){return"number"==typeof t?0===t:null===t||"none"===t||"0"===t||sr(t)}const Mc=new Set(["brightness","contrast","saturate","opacity"]);function Pc(t){const[e,n]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[s]=n.match(Kr)||[];if(!s)return t;const i=n.replace(s,"");let o=Mc.has(e)?1:0;return s!==n&&(o*=100),e+"("+o+i+")"}const Ec=/\b([a-z-]*)\(.*?\)/gu,jc={...ba,getAnimatableNone:t=>{const e=t.match(Ec);return e?e.map(Pc).join(" "):t}},Lc={...Yr,transform:Math.round},Ac={borderWidth:ra,borderTopWidth:ra,borderRightWidth:ra,borderBottomWidth:ra,borderLeftWidth:ra,borderRadius:ra,borderTopLeftRadius:ra,borderTopRightRadius:ra,borderBottomRightRadius:ra,borderBottomLeftRadius:ra,width:ra,maxWidth:ra,height:ra,maxHeight:ra,top:ra,right:ra,bottom:ra,left:ra,inset:ra,insetBlock:ra,insetBlockStart:ra,insetBlockEnd:ra,insetInline:ra,insetInlineStart:ra,insetInlineEnd:ra,padding:ra,paddingTop:ra,paddingRight:ra,paddingBottom:ra,paddingLeft:ra,paddingBlock:ra,paddingBlockStart:ra,paddingBlockEnd:ra,paddingInline:ra,paddingInlineStart:ra,paddingInlineEnd:ra,margin:ra,marginTop:ra,marginRight:ra,marginBottom:ra,marginLeft:ra,marginBlock:ra,marginBlockStart:ra,marginBlockEnd:ra,marginInline:ra,marginInlineStart:ra,marginInlineEnd:ra,fontSize:ra,backgroundPositionX:ra,backgroundPositionY:ra,rotate:ia,rotateX:ia,rotateY:ia,rotateZ:ia,scale:Gr,scaleX:Gr,scaleY:Gr,scaleZ:Gr,skew:ia,skewX:ia,skewY:ia,distance:ra,translateX:ra,translateY:ra,translateZ:ra,x:ra,y:ra,z:ra,perspective:ra,transformPerspective:ra,opacity:qr,originX:ca,originY:ca,originZ:ra,zIndex:Lc,fillOpacity:qr,strokeOpacity:qr,numOctaves:Lc},Dc={...Ac,color:da,backgroundColor:da,outlineColor:da,fill:da,stroke:da,borderColor:da,borderTopColor:da,borderRightColor:da,borderBottomColor:da,borderLeftColor:da,filter:jc,WebkitFilter:jc},Nc=t=>Dc[t];function Rc(t,e){let n=Nc(t);return n!==jc&&(n=ba),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const Fc=new Set(["auto","none","0"]);class Ic extends Ll{constructor(t,e,n,s,i){super(t,e,n,s,i,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:e,name:n}=this;if(!e||!e.current)return;super.readKeyframes();for(let a=0;a{e.getValue(t).set(n)}),this.resolveNoneKeyframes()}}function _c(t,e,n){if(null==t)return[];if(t instanceof EventTarget)return[t];if("string"==typeof t){let e=document;const s=(null==n?void 0:n[t])??e.querySelectorAll(t);return s?Array.from(s):[]}return Array.from(t).filter(t=>null!=t)}const Bc=(t,e)=>e&&"number"==typeof t?e.transform(t):t;function Vc(t){return nr(t)&&"offsetHeight"in t}const{schedule:Oc}=Dr(queueMicrotask,!1),zc={x:!1,y:!1};function $c(){return zc.x||zc.y}function Wc(t,e){const n=_c(t),s=new AbortController;return[n,{passive:!0,...e,signal:s.signal},()=>s.abort()]}function Uc(t){return!("touch"===t.pointerType||$c())}const Hc=(t,e)=>!!e&&(t===e||Hc(t,e.parentElement)),Yc=t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary,qc=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Gc(t){return qc.has(t.tagName)||!0===t.isContentEditable}const Xc=new WeakSet;function Kc(t){return e=>{"Enter"===e.key&&t(e)}}function Jc(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}function Zc(t){return Yc(t)&&!$c()}function Qc(t){return nr(t)&&"ownerSVGElement"in t}function tu(t){return Qc(t)&&"svg"===t.tagName}const eu=[...Sc,da,ba],nu=()=>({x:{min:0,max:0},y:{min:0,max:0}}),su={current:null},iu={current:!1},ou="undefined"!=typeof window;function ru(){if(iu.current=!0,ou)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>su.current=t.matches;t.addEventListener("change",e),e()}else su.current=!1}const au=new WeakMap;function lu(t){return null!==t&&"object"==typeof t&&"function"==typeof t.start}function cu(t){return"string"==typeof t||Array.isArray(t)}const uu=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],du=["initial",...uu];function hu(t){return lu(t.animate)||du.some(e=>cu(t[e]))}function pu(t){return Boolean(hu(t)||t.variants)}const mu=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let fu={};function gu(t){fu=t}class yu{scrapeMotionValuesFromProps(t,e,n){return{}}constructor({parent:t,props:e,presenceContext:n,reducedMotionConfig:s,blockInitialAnimation:i,visualState:o},r={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Ll,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const t=Vr.now();this.renderScheduledAtthis.bindToMotionValue(e,t)),"never"===this.reducedMotionConfig?this.shouldReduceMotion=!1:"always"===this.reducedMotionConfig?this.shouldReduceMotion=!0:(iu.current||ru(),this.shouldReduceMotion=su.current),null==(e=this.parent)||e.addChild(this),this.update(this.props,this.presenceContext)}unmount(){var t;this.projection&&this.projection.unmount(),Rr(this.notifyUpdate),Rr(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),null==(t=this.parent)||t.removeChild(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,e){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const n=xl.has(t);n&&this.onBindTransform&&this.onBindTransform();const s=e.on("change",e=>{this.latestValues[t]=e,this.props.onUpdate&&Nr.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let i;"undefined"!=typeof window&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,t,e)),this.valueSubscriptions.set(t,()=>{s(),i&&i(),e.owner&&e.stop()})}sortNodePosition(t){return this.current&&this.sortInstanceNodePosition&&this.type===t.type?this.sortInstanceNodePosition(this.current,t.current):0}updateFeatures(){let t="animation";for(t in fu){const e=fu[t];if(!e)continue;const{isEnabled:n,Feature:s}=e;if(!this.features[t]&&s&&n(this.props)&&(this.features[t]=new s(this)),this.features[t]){const e=this.features[t];e.isMounted?e.update():(e.mount(),e.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):{x:{min:0,max:0},y:{min:0,max:0}}}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,e){this.latestValues[t]=e}update(t,e){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=e;for(let n=0;ne.variantChildren.delete(t)}addValue(t,e){const n=this.values.get(t);e!==n&&(n&&this.removeValue(t),this.bindToMotionValue(t,e),this.values.set(t,e),this.latestValues[t]=e.get())}removeValue(t){this.values.delete(t);const e=this.valueSubscriptions.get(t);e&&(e(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,e){if(this.props.values&&this.props.values[t])return this.props.values[t];let n=this.values.get(t);return void 0===n&&void 0!==e&&(n=lc(null===e?void 0:e,{owner:this}),this.addValue(t,n)),n}readValue(t,e){let n=void 0===this.latestValues[t]&&this.current?this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options):this.latestValues[t];var s;return null!=n&&("string"==typeof n&&(er(n)||sr(n))?n=parseFloat(n):(s=n,!eu.find(kc(s))&&ba.test(e)&&(n=Rc(t,e))),this.setBaseTarget(t,pc(n)?n.get():n)),pc(n)?n.get():n}setBaseTarget(t,e){this.baseTarget[t]=e}getBaseTarget(t){var e;const{initial:n}=this.props;let s;if("string"==typeof n||"object"==typeof n){const i=ic(this.props,n,null==(e=this.presenceContext)?void 0:e.custom);i&&(s=i[t])}if(n&&void 0!==s)return s;const i=this.getBaseTargetFromProps(this.props,t);return void 0===i||pc(i)?void 0!==this.initialValues[t]&&void 0===s?void 0:this.baseTarget[t]:i}on(t,e){return this.events[t]||(this.events[t]=new cr),this.events[t].add(e)}notify(t,...e){this.events[t]&&this.events[t].notify(...e)}scheduleRenderMicrotask(){Oc.render(this.render)}}class vu extends yu{constructor(){super(...arguments),this.KeyframeResolver=Ic}sortInstanceNodePosition(t,e){return 2&t.compareDocumentPosition(e)?1:-1}getBaseTargetFromProps(t,e){const n=t.style;return n?n[e]:void 0}removeValueFromRenderState(t,{vars:e,style:n}){delete e[t],delete n[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;pc(t)&&(this.childSubscription=t.on("change",t=>{this.current&&(this.current.textContent=`${t}`)}))}}class xu{constructor(t){this.isMounted=!1,this.node=t}update(){}}function bu({top:t,left:e,right:n,bottom:s}){return{x:{min:e,max:n},y:{min:t,max:s}}}function wu(t){return void 0===t||1===t}function ku({scale:t,scaleX:e,scaleY:n}){return!wu(t)||!wu(e)||!wu(n)}function Su(t){return ku(t)||Tu(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function Tu(t){return Cu(t.x)||Cu(t.y)}function Cu(t){return t&&"0%"!==t}function Mu(t,e,n){return n+e*(t-n)}function Pu(t,e,n,s,i){return void 0!==i&&(t=Mu(t,i,s)),Mu(t,n,s)+e}function Eu(t,e=0,n=1,s,i){t.min=Pu(t.min,e,n,s,i),t.max=Pu(t.max,e,n,s,i)}function ju(t,{x:e,y:n}){Eu(t.x,e.translate,e.scale,e.originPoint),Eu(t.y,n.translate,n.scale,n.originPoint)}const Lu=.999999999999,Au=1.0000000000001;function Du(t,e){t.min=t.min+e,t.max=t.max+e}function Nu(t,e,n,s,i=.5){Eu(t,e,n,Sa(t.min,t.max,i),s)}function Ru(t,e){Nu(t.x,e.x,e.scaleX,e.scale,e.originX),Nu(t.y,e.y,e.scaleY,e.scale,e.originY)}function Fu(t,e){return bu(function(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),s=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:s.y,right:s.x}}(t.getBoundingClientRect(),e))}const Iu={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},_u=vl.length;function Bu(t,e,n){const{style:s,vars:i,transformOrigin:o}=t;let r=!1,a=!1;for(const l in e){const t=e[l];if(xl.has(l))r=!0;else if(zr(l))i[l]=t;else{const e=Bc(t,Ac[l]);l.startsWith("origin")?(a=!0,o[l]=e):s[l]=e}}if(e.transform||(r||n?s.transform=function(t,e,n){let s="",i=!0;for(let o=0;o<_u;o++){const r=vl[o],a=t[r];if(void 0===a)continue;let l=!0;if("number"==typeof a)l=a===(r.startsWith("scale")?1:0);else{const t=parseFloat(a);l=r.startsWith("scale")?1===t:0===t}if(!l||n){const t=Bc(a,Ac[r]);l||(i=!1,s+=`${Iu[r]||r}(${t}) `),n&&(e[r]=t)}}return s=s.trim(),n?s=n(e,i?"":s):i&&(s="none"),s}(e,t.transform,n):s.transform&&(s.transform="none")),a){const{originX:t="50%",originY:e="50%",originZ:n=0}=o;s.transformOrigin=`${t} ${e} ${n}`}}function Vu(t,{style:e,vars:n},s,i){const o=t.style;let r;for(r in e)o[r]=e[r];for(r in null==i||i.applyProjectionStyles(o,s),n)o.setProperty(r,n[r])}function Ou(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const zu={correct:(t,e)=>{if(!e.target)return t;if("string"==typeof t){if(!ra.test(t))return t;t=parseFloat(t)}return`${Ou(t,e.target.x)}% ${Ou(t,e.target.y)}%`}},$u={correct:(t,{treeScale:e,projectionDelta:n})=>{const s=t,i=ba.parse(t);if(i.length>5)return s;const o=ba.createTransformer(t),r="number"!=typeof i[0]?1:0,a=n.x.scale*e.x,l=n.y.scale*e.y;i[0+r]/=a,i[1+r]/=l;const c=Sa(a,l,.5);return"number"==typeof i[2+r]&&(i[2+r]/=c),"number"==typeof i[3+r]&&(i[3+r]/=c),o(i)}},Wu={borderRadius:{...zu,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:zu,borderTopRightRadius:zu,borderBottomLeftRadius:zu,borderBottomRightRadius:zu,boxShadow:$u};function Uu(t){for(const e in t)Wu[e]=t[e],zr(e)&&(Wu[e].isCSSVariable=!0)}function Hu(t,{layout:e,layoutId:n}){return xl.has(t)||t.startsWith("origin")||(e||void 0!==n)&&(!!Wu[t]||"opacity"===t)}function Yu(t,e,n){var s;const i=t.style,o=null==e?void 0:e.style,r={};if(!i)return r;for(const a in i)(pc(i[a])||o&&pc(o[a])||Hu(a,t)||void 0!==(null==(s=null==n?void 0:n.getValue(a))?void 0:s.liveStyle))&&(r[a]=i[a]);return r}class qu extends vu{constructor(){super(...arguments),this.type="html",this.renderInstance=Vu}readValueFromInstance(t,e){var n,s;if(xl.has(e))return(null==(n=this.projection)?void 0:n.isProjecting)?fl(e):((t,e)=>{const{transform:n="none"}=getComputedStyle(t);return gl(n,e)})(t,e);{const n=(s=t,window.getComputedStyle(s)),i=(zr(e)?n.getPropertyValue(e):n[e])||0;return"string"==typeof i?i.trim():i}}measureInstanceViewportBox(t,{transformPagePoint:e}){return Fu(t,e)}build(t,e,n){Bu(t,e,n.transformTemplate)}scrapeMotionValuesFromProps(t,e,n){return Yu(t,e,n)}}const Gu={offset:"stroke-dashoffset",array:"stroke-dasharray"},Xu={offset:"strokeDashoffset",array:"strokeDasharray"},Ku=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function Ju(t,{attrX:e,attrY:n,attrScale:s,pathLength:i,pathSpacing:o=1,pathOffset:r=0,...a},l,c,u){if(Bu(t,a,c),l)return void(t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox));t.attrs=t.style,t.style={};const{attrs:d,style:h}=t;d.transform&&(h.transform=d.transform,delete d.transform),(h.transform||d.transformOrigin)&&(h.transformOrigin=d.transformOrigin??"50% 50%",delete d.transformOrigin),h.transform&&(h.transformBox=(null==u?void 0:u.transformBox)??"fill-box",delete d.transformBox);for(const p of Ku)void 0!==d[p]&&(h[p]=d[p],delete d[p]);void 0!==e&&(d.x=e),void 0!==n&&(d.y=n),void 0!==s&&(d.scale=s),void 0!==i&&function(t,e,n=1,s=0,i=!0){t.pathLength=1;const o=i?Gu:Xu;t[o.offset]=""+-s,t[o.array]=`${e} ${n}`}(d,i,o,r,!1)}const Zu=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),Qu=t=>"string"==typeof t&&"svg"===t.toLowerCase();function td(t,e,n){const s=Yu(t,e,n);for(const i in t)(pc(t[i])||pc(e[i]))&&(s[-1!==vl.indexOf(i)?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i]=t[i]);return s}class ed extends vu{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=nu}getBaseTargetFromProps(t,e){return t[e]}readValueFromInstance(t,e){if(xl.has(e)){const t=Nc(e);return t&&t.default||0}return e=Zu.has(e)?e:fc(e),t.getAttribute(e)}scrapeMotionValuesFromProps(t,e,n){return td(t,e,n)}build(t,e,n){Ju(t,e,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(t,e,n,s){!function(t,e,n,s){Vu(t,e,void 0,s);for(const i in e.attrs)t.setAttribute(Zu.has(i)?i:fc(i),e.attrs[i])}(t,e,0,s)}mount(t){this.isSVGTag=Qu(t.tagName),super.mount(t)}}const nd=du.length;function sd(t){if(!t)return;if(!t.isControllingVariants){const e=t.parent&&sd(t.parent)||{};return void 0!==t.props.initial&&(e.initial=t.props.initial),e}const e={};for(let n=0;nPromise.all(e.map(({animation:e,options:n})=>wc(t,e,n)))}(t),n=ud(),s=!0;const i=e=>(n,s)=>{var i;const o=oc(t,s,"exit"===e?null==(i=t.presenceContext)?void 0:i.custom:void 0);if(o){const{transition:t,transitionEnd:e,...s}=o;n={...n,...s,...e}}return n};function o(o){const{props:r}=t,a=sd(t.parent)||{},l=[],c=new Set;let u={},d=1/0;for(let e=0;ed&&f,b=!1;const w=Array.isArray(m)?m:[m];let k=w.reduce(i(h),{});!1===g&&(k={});const{prevResolvedValues:S={}}=p,T={...S,...k},C=e=>{x=!0,c.has(e)&&(b=!0,c.delete(e)),p.needsAnimating[e]=!0;const n=t.getValue(e);n&&(n.liveStyle=!1)};for(const t in T){const e=k[t],n=S[t];if(u.hasOwnProperty(t))continue;let s=!1;s=cc(e)&&cc(n)?!id(e,n):e!==n,s?null!=e?C(t):c.add(t):void 0!==e&&c.has(t)?C(t):p.protectedKeys[t]=!0}p.prevProp=m,p.prevResolvedValues=k,p.isActive&&(u={...u,...k}),s&&t.blockInitialAnimation&&(x=!1);const M=y&&v;x&&(!M||b)&&l.push(...w.map(e=>{const n={type:h};if("string"==typeof e&&s&&!M&&t.manuallyAnimateOnMount&&t.parent){const{parent:s}=t,i=oc(s,e);if(s.enteringChildren&&i){const{delayChildren:e}=i.transition||{};n.delay=Gl(s.enteringChildren,t,e)}}return{animation:e,options:n}}))}if(c.size){const e={};if("boolean"!=typeof r.initial){const n=oc(t,Array.isArray(r.initial)?r.initial[0]:r.initial);n&&n.transition&&(e.transition=n.transition)}c.forEach(n=>{const s=t.getBaseTarget(n),i=t.getValue(n);i&&(i.liveStyle=!0),e[n]=s??null}),l.push({animation:e})}let h=Boolean(l.length);return!s||!1!==r.initial&&r.initial!==r.animate||t.manuallyAnimateOnMount||(h=!1),s=!1,h?e(l):Promise.resolve()}return{animateChanges:o,setActive:function(e,s){var i;if(n[e].isActive===s)return Promise.resolve();null==(i=t.variantChildren)||i.forEach(t=>{var n;return null==(n=t.animationState)?void 0:n.setActive(e,s)}),n[e].isActive=s;const r=o(e);for(const t in n)n[t].protectedKeys={};return r},setAnimateFunction:function(n){e=n(t)},getState:()=>n,reset:()=>{n=ud()}}}function ld(t,e){return"string"==typeof e?e!==t:!!Array.isArray(e)&&!id(e,t)}function cd(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function ud(){return{animate:cd(!0),whileInView:cd(),whileHover:cd(),whileTap:cd(),whileDrag:cd(),whileFocus:cd(),exit:cd()}}function dd(t,e){t.min=e.min,t.max=e.max}function hd(t,e){dd(t.x,e.x),dd(t.y,e.y)}function pd(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function md(t){return t.max-t.min}function fd(t,e,n,s=.5){t.origin=s,t.originPoint=Sa(e.min,e.max,t.origin),t.scale=md(n)/md(e),t.translate=Sa(n.min,n.max,t.origin)-t.originPoint,(t.scale>=.9999&&t.scale<=1.0001||isNaN(t.scale))&&(t.scale=1),(t.translate>=-.01&&t.translate<=.01||isNaN(t.translate))&&(t.translate=0)}function gd(t,e,n,s){fd(t.x,e.x,n.x,s?s.originX:void 0),fd(t.y,e.y,n.y,s?s.originY:void 0)}function yd(t,e,n){t.min=n.min+e.min,t.max=t.min+md(e)}function vd(t,e,n){t.min=e.min-n.min,t.max=t.min+md(e)}function xd(t,e,n){vd(t.x,e.x,n.x),vd(t.y,e.y,n.y)}function bd(t,e,n,s,i){return t=Mu(t-=e,1/n,s),void 0!==i&&(t=Mu(t,1/i,s)),t}function wd(t,e,[n,s,i],o,r){!function(t,e=0,n=1,s=.5,i,o=t,r=t){if(oa.test(e)&&(e=parseFloat(e),e=Sa(r.min,r.max,e/100)-r.min),"number"!=typeof e)return;let a=Sa(o.min,o.max,s);t===o&&(a-=e),t.min=bd(t.min,e,n,a,i),t.max=bd(t.max,e,n,a,i)}(t,e[n],e[s],e[i],e.scale,o,r)}const kd=["x","scaleX","originX"],Sd=["y","scaleY","originY"];function Td(t,e,n,s){wd(t.x,e,kd,n?n.x:void 0,s?s.x:void 0),wd(t.y,e,Sd,n?n.y:void 0,s?s.y:void 0)}function Cd(t){return 0===t.translate&&1===t.scale}function Md(t){return Cd(t.x)&&Cd(t.y)}function Pd(t,e){return t.min===e.min&&t.max===e.max}function Ed(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function jd(t,e){return Ed(t.x,e.x)&&Ed(t.y,e.y)}function Ld(t){return md(t.x)/md(t.y)}function Ad(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}function Dd(t){return[t("x"),t("y")]}const Nd=["TopLeft","TopRight","BottomLeft","BottomRight"],Rd=Nd.length,Fd=t=>"string"==typeof t?parseFloat(t):t,Id=t=>"number"==typeof t||ra.test(t);function _d(t,e){return void 0!==t[e]?t[e]:t.borderRadius}const Bd=Od(0,.5,kr),Vd=Od(.5,.95,or);function Od(t,e,n){return s=>se?1:n(lr(t,e,s))}function zd(t,e,n){const s=pc(t)?t:lc(t);return s.start(nc("",s,e,n)),s.animation}function $d(t,e,n,s={passive:!0}){return t.addEventListener(e,n,s),()=>t.removeEventListener(e,n)}const Wd=(t,e)=>t.depth-e.depth;class Ud{constructor(){this.children=[],this.isDirty=!1}add(t){Jo(this.children,t),this.isDirty=!0}remove(t){Zo(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(Wd),this.isDirty=!1,this.children.forEach(t)}}function Hd(t,e){const n=Vr.now(),s=({timestamp:i})=>{const o=i-n;o>=e&&(Rr(s),t(o-e))};return Nr.setup(s,!0),()=>Rr(s)}function Yd(t){return pc(t)?t.get():t}class qd{constructor(){this.members=[]}add(t){Jo(this.members,t),t.scheduleRender()}remove(t){if(Zo(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const t=this.members[this.members.length-1];t&&this.promote(t)}}relegate(t){const e=this.members.findIndex(e=>t===e);if(0===e)return!1;let n;for(let s=e;s>=0;s--){const t=this.members[s];if(!1!==t.isPresent){n=t;break}}return!!n&&(this.promote(n),!0)}promote(t,e){const n=this.lead;if(t!==n&&(this.prevLead=n,this.lead=t,t.show(),n)){n.instance&&n.scheduleRender(),t.scheduleRender();const s=n.options.layoutDependency,i=t.options.layoutDependency;void 0!==s&&void 0!==i&&s===i||(t.resumeFrom=n,e&&(t.resumeFrom.preserveOpacity=!0),n.snapshot&&(t.snapshot=n.snapshot,t.snapshot.latestValues=n.animationValues||n.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0));const{crossfade:o}=t.options;!1===o&&n.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:e,resumingFrom:n}=t;e.onExitComplete&&e.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}const Gd={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Xd=["","X","Y","Z"];let Kd=0;function Jd(t,e,n,s){const{latestValues:i}=e;i[t]&&(n[t]=i[t],e.setStaticValue(t,0),s&&(s[t]=0))}function Zd(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=yc(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:e,layoutId:s}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",Nr,!(e||s))}const{parent:s}=t;s&&!s.hasCheckedOptimisedAppear&&Zd(s)}function Qd({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:s,resetTransform:i}){return class{constructor(t={},n=(null==e?void 0:e())){this.id=Kd++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(nh),this.nodes.forEach(ch),this.nodes.forEach(uh),this.nodes.forEach(sh)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=t,this.root=n?n.root||n:this,this.path=n?[...n.path,n]:[],this.parent=n,this.depth=n?n.depth+1:0;for(let e=0;ethis.root.updateBlockedByResize=!1;Nr.read(()=>{s=window.innerWidth}),t(e,()=>{const t=window.innerWidth;t!==s&&(s=t,this.root.updateBlockedByResize=!0,n&&n(),n=Hd(i,250),Gd.hasAnimatedSinceResize&&(Gd.hasAnimatedSinceResize=!1,this.nodes.forEach(lh)))})}n&&this.root.registerSharedNode(n,this),!1!==this.options.animate&&i&&(n||s)&&this.addEventListener("didUpdate",({delta:t,hasLayoutChanged:e,hasRelativeLayoutChanged:n,layout:s})=>{if(this.isTreeAnimationBlocked())return this.target=void 0,void(this.relativeTarget=void 0);const o=this.options.transition||i.getDefaultTransition()||gh,{onLayoutAnimationStart:r,onLayoutAnimationComplete:a}=i.getProps(),l=!this.targetLayout||!jd(this.targetLayout,s),c=!e&&n;if(this.options.layoutRoot||this.resumeFrom||c||e&&(l||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const e={...ec(o,"layout"),onPlay:r,onComplete:a};(i.shouldReduceMotion||this.options.layoutRoot)&&(e.delay=0,e.type=!1),this.startAnimation(e),this.setAnimationOrigin(t,c)}else e||lh(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=s})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const t=this.getStack();t&&t.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Rr(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(dh),this.animationId++)}getTransformTemplate(){const{visualElement:t}=this.options;return t&&t.getProps().transformTemplate}willUpdate(t=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked())return void(this.options.onExitComplete&&this.options.onExitComplete());if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Zd(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let i=0;i{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure(),!this.snapshot||md(this.snapshot.measuredBox.x)||md(this.snapshot.measuredBox.y)||(this.snapshot=void 0))}updateLayout(){if(!this.instance)return;if(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead()||this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let n=0;nLu&&(e.x=1),e.yLu&&(e.y=1)}(this.layoutCorrected,this.treeScale,this.path,n),!e.layout||e.target||1===this.treeScale.x&&1===this.treeScale.y||(e.target=e.layout.layoutBox,e.targetWithTransforms={x:{min:0,max:0},y:{min:0,max:0}});const{target:l}=e;l?(this.projectionDelta&&this.prevProjectionDelta?(pd(this.prevProjectionDelta.x,this.projectionDelta.x),pd(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),gd(this.projectionDelta,this.layoutCorrected,l,this.latestValues),this.treeScale.x===r&&this.treeScale.y===a&&Ad(this.projectionDelta.x,this.prevProjectionDelta.x)&&Ad(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",l))):this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender())}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(t=!0){var e;if(null==(e=this.options.visualElement)||e.scheduleRender(),t){const t=this.getStack();t&&t.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}},this.projectionDelta={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}},this.projectionDeltaWithTransform={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}}}setAnimationOrigin(t,e=!1){const n=this.snapshot,s=n?n.latestValues:{},i={...this.latestValues},o={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!e;const r={x:{min:0,max:0},y:{min:0,max:0}},a=(n?n.source:void 0)!==(this.layout?this.layout.source:void 0),l=this.getStack(),c=!l||l.members.length<=1,u=Boolean(a&&!c&&!0===this.options.crossfade&&!this.path.some(fh));let d;this.animationProgress=0,this.mixTargetDelta=e=>{const n=e/1e3;var l,h,p,m,f,g;ph(o.x,t.x,n),ph(o.y,t.y,n),this.setTargetDelta(o),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(xd(r,this.layout.layoutBox,this.relativeParent.layout.layoutBox),p=this.relativeTarget,m=this.relativeTargetOrigin,f=r,g=n,mh(p.x,m.x,f.x,g),mh(p.y,m.y,f.y,g),d&&(l=this.relativeTarget,h=d,Pd(l.x,h.x)&&Pd(l.y,h.y))&&(this.isProjectionDirty=!1),d||(d={x:{min:0,max:0},y:{min:0,max:0}}),hd(d,this.relativeTarget)),a&&(this.animationValues=i,function(t,e,n,s,i,o){i?(t.opacity=Sa(0,n.opacity??1,Bd(s)),t.opacityExit=Sa(e.opacity??1,0,Vd(s))):o&&(t.opacity=Sa(e.opacity??1,n.opacity??1,s));for(let r=0;r{Gd.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=lc(0)),this.currentAnimation=zd(this.motionValue,[0,1e3],{...t,velocity:0,isSync:!0,onUpdate:e=>{this.mixTargetDelta(e),t.onUpdate&&t.onUpdate(e)},onStop:()=>{},onComplete:()=>{t.onComplete&&t.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const t=this.getStack();t&&t.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const t=this.getLead();let{targetWithTransforms:e,target:n,layout:s,latestValues:i}=t;if(e&&n&&s){if(this!==t&&this.layout&&s&&bh(this.options.animationType,this.layout.layoutBox,s.layoutBox)){n=this.target||{x:{min:0,max:0},y:{min:0,max:0}};const e=md(this.layout.layoutBox.x);n.x.min=t.target.x.min,n.x.max=n.x.min+e;const s=md(this.layout.layoutBox.y);n.y.min=t.target.y.min,n.y.max=n.y.min+s}hd(e,n),Ru(e,i),gd(this.projectionDeltaWithTransform,this.layoutCorrected,e,i)}}registerSharedNode(t,e){this.sharedNodes.has(t)||this.sharedNodes.set(t,new qd),this.sharedNodes.get(t).add(e);const n=e.options.initialPromotionConfig;e.promote({transition:n?n.transition:void 0,preserveFollowOpacity:n&&n.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(e):void 0})}isLead(){const t=this.getStack();return!t||t.lead===this}getLead(){var t;const{layoutId:e}=this.options;return e&&(null==(t=this.getStack())?void 0:t.lead)||this}getPrevLead(){var t;const{layoutId:e}=this.options;return e?null==(t=this.getStack())?void 0:t.prevLead:void 0}getStack(){const{layoutId:t}=this.options;if(t)return this.root.sharedNodes.get(t)}promote({needsReset:t,transition:e,preserveFollowOpacity:n}={}){const s=this.getStack();s&&s.promote(this,n),t&&(this.projectionDelta=void 0,this.needsReset=!0),e&&this.setOptions({transition:e})}relegate(){const t=this.getStack();return!!t&&t.relegate(this)}resetSkewAndRotation(){const{visualElement:t}=this.options;if(!t)return;let e=!1;const{latestValues:n}=t;if((n.z||n.rotate||n.rotateX||n.rotateY||n.rotateZ||n.skewX||n.skewY)&&(e=!0),!e)return;const s={};n.z&&Jd("z",t,s,this.animationValues);for(let i=0;i{var e;return null==(e=t.currentAnimation)?void 0:e.stop()}),this.root.nodes.forEach(oh),this.root.sharedNodes.clear()}}}function th(t){t.updateLayout()}function eh(t){var e;const n=(null==(e=t.resumeFrom)?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&n&&t.hasListeners("didUpdate")){const{layoutBox:e,measuredBox:s}=t.layout,{animationType:i}=t.options,o=n.source!==t.layout.source;"size"===i?Dd(t=>{const s=o?n.measuredBox[t]:n.layoutBox[t],i=md(s);s.min=e[t].min,s.max=s.min+i}):bh(i,n.layoutBox,e)&&Dd(s=>{const i=o?n.measuredBox[s]:n.layoutBox[s],r=md(e[s]);i.max=i.min+r,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[s].max=t.relativeTarget[s].min+r)});const r={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};gd(r,e,n.layoutBox);const a={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};o?gd(a,t.applyTransform(s,!0),n.measuredBox):gd(a,e,n.layoutBox);const l=!Md(r);let c=!1;if(!t.resumeFrom){const s=t.getClosestProjectingParent();if(s&&!s.resumeFrom){const{snapshot:i,layout:o}=s;if(i&&o){const r={x:{min:0,max:0},y:{min:0,max:0}};xd(r,n.layoutBox,i.layoutBox);const a={x:{min:0,max:0},y:{min:0,max:0}};xd(a,e,o.layoutBox),jd(r,a)||(c=!0),s.options.layoutRoot&&(t.relativeTarget=a,t.relativeTargetOrigin=r,t.relativeParent=s)}}}t.notifyListeners("didUpdate",{layout:e,snapshot:n,delta:a,layoutDelta:r,hasLayoutChanged:l,hasRelativeLayoutChanged:c})}else if(t.isLead()){const{onExitComplete:e}=t.options;e&&e()}t.options.transition=void 0}function nh(t){t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=Boolean(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function sh(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function ih(t){t.clearSnapshot()}function oh(t){t.clearMeasurements()}function rh(t){t.isLayoutDirty=!1}function ah(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function lh(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function ch(t){t.resolveTargetDelta()}function uh(t){t.calcProjection()}function dh(t){t.resetSkewAndRotation()}function hh(t){t.removeLeadSnapshot()}function ph(t,e,n){t.translate=Sa(e.translate,0,n),t.scale=Sa(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function mh(t,e,n,s){t.min=Sa(e.min,n.min,s),t.max=Sa(e.max,n.max,s)}function fh(t){return t.animationValues&&void 0!==t.animationValues.opacityExit}const gh={duration:.45,ease:[.4,0,.1,1]},yh=t=>"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),vh=yh("applewebkit/")&&!yh("chrome/")?Math.round:or;function xh(t){t.min=vh(t.min),t.max=vh(t.max)}function bh(t,e,n){return"position"===t||"preserve-aspect"===t&&(s=Ld(e),i=Ld(n),!(Math.abs(s-i)<=.2));var s,i}function wh(t){var e;return t!==t.root&&(null==(e=t.scroll)?void 0:e.wasRoot)}const kh=Qd({attachResizeListener:(t,e)=>$d(t,"resize",e),measureScroll:()=>{var t,e;return{x:document.documentElement.scrollLeft||(null==(t=document.body)?void 0:t.scrollLeft)||0,y:document.documentElement.scrollTop||(null==(e=document.body)?void 0:e.scrollTop)||0}},checkIsScrollRoot:()=>!0}),Sh=t=>!t.isLayoutDirty&&t.willUpdate(!1);function Th(){const t=new Set,e=new WeakMap,n=()=>t.forEach(Sh);return{add:s=>{t.add(s),e.set(s,s.addEventListener("willUpdate",n))},remove:s=>{t.delete(s);const i=e.get(s);i&&(i(),e.delete(s)),n()},dirty:n}}const Ch={current:void 0},Mh=Qd({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!Ch.current){const t=new kh({});t.mount(window),t.setOptions({layoutScroll:!0}),Ch.current=t}return Ch.current},resetTransform:(t,e)=>{t.style.transform=void 0!==e?e:"none"},checkIsScrollRoot:t=>Boolean("fixed"===window.getComputedStyle(t).position)}),Ph=n.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});function Eh(t,e){if("function"==typeof t)return t(e);null!=t&&(t.current=e)}class jh extends n.Component{getSnapshotBeforeUpdate(t){const e=this.props.childRef.current;if(e&&t.isPresent&&!this.props.isPresent){const t=e.offsetParent,n=Vc(t)&&t.offsetWidth||0,s=Vc(t)&&t.offsetHeight||0,i=this.props.sizeRef.current;i.height=e.offsetHeight||0,i.width=e.offsetWidth||0,i.top=e.offsetTop,i.left=e.offsetLeft,i.right=n-i.width-i.left,i.bottom=s-i.height-i.top}return null}componentDidUpdate(){}render(){return this.props.children}}function Lh({children:t,isPresent:e,anchorX:i,anchorY:o,root:r}){var a;const l=n.useId(),c=n.useRef(null),u=n.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0}),{nonce:d}=n.useContext(Ph),h=(null==(a=t.props)?void 0:a.ref)??(null==t?void 0:t.ref),p=function(...t){return n.useCallback(function(...t){return e=>{let n=!1;const s=t.map(t=>{const s=Eh(t,e);return n||"function"!=typeof s||(n=!0),s});if(n)return()=>{for(let e=0;e{const{width:t,height:n,top:s,left:a,right:h,bottom:p}=u.current;if(e||!c.current||!t||!n)return;const m="left"===i?`left: ${a}`:`right: ${h}`,f="bottom"===o?`bottom: ${p}`:`top: ${s}`;c.current.dataset.motionPopId=l;const g=document.createElement("style");d&&(g.nonce=d);const y=r??document.head;return y.appendChild(g),g.sheet&&g.sheet.insertRule(`\n [data-motion-pop-id="${l}"] {\n position: absolute !important;\n width: ${t}px !important;\n height: ${n}px !important;\n ${m}px !important;\n ${f}px !important;\n }\n `),()=>{y.contains(g)&&y.removeChild(g)}},[e]),s.jsx(jh,{isPresent:e,childRef:c,sizeRef:u,children:n.cloneElement(t,{ref:p})})}const Ah=({children:t,initial:e,isPresent:i,onExitComplete:o,custom:r,presenceAffectsLayout:a,mode:l,anchorX:c,anchorY:u,root:d})=>{const h=qo(Dh),p=n.useId();let m=!0,f=n.useMemo(()=>(m=!1,{id:p,initial:e,isPresent:i,custom:r,onExitComplete:t=>{h.set(t,!0);for(const e of h.values())if(!e)return;o&&o()},register:t=>(h.set(t,!1),()=>h.delete(t))}),[i,h,o]);return a&&m&&(f={...f}),n.useMemo(()=>{h.forEach((t,e)=>h.set(e,!1))},[i]),n.useEffect(()=>{!i&&!h.size&&o&&o()},[i]),"popLayout"===l&&(t=s.jsx(Lh,{isPresent:i,anchorX:c,anchorY:u,root:d,children:t})),s.jsx(Ko.Provider,{value:f,children:t})};function Dh(){return new Map}function Nh(t=!0){const e=n.useContext(Ko);if(null===e)return[!0,null];const{isPresent:s,onExitComplete:i,register:o}=e,r=n.useId();n.useEffect(()=>{if(t)return o(r)},[t]);const a=n.useCallback(()=>t&&i&&i(r),[r,i,t]);return!s&&i?[!1,a]:[!0]}function Rh(){return null===(t=n.useContext(Ko))||t.isPresent;var t}const Fh=t=>t.key||"";function Ih(t){const e=[];return n.Children.forEach(t,t=>{n.isValidElement(t)&&e.push(t)}),e}const _h=({children:t,custom:e,initial:i=!0,onExitComplete:o,presenceAffectsLayout:r=!0,mode:a="sync",propagate:l=!1,anchorX:c="left",anchorY:u="top",root:d})=>{const[h,p]=Nh(l),m=n.useMemo(()=>Ih(t),[t]),f=l&&!h?[]:m.map(Fh),g=n.useRef(!0),y=n.useRef(m),v=qo(()=>new Map),x=n.useRef(new Set),[b,w]=n.useState(m),[k,S]=n.useState(m);Xo(()=>{g.current=!1,y.current=m;for(let t=0;t{const n=Fh(t),b=!(l&&!h)&&(m===k||f.includes(n));return s.jsx(Ah,{isPresent:b,initial:!(g.current&&!i)&&void 0,custom:e,presenceAffectsLayout:r,mode:a,root:d,onExitComplete:b?void 0:()=>{if(x.current.has(n))return;if(x.current.add(n),!v.has(n))return;v.set(n,!0);let t=!0;v.forEach(e=>{e||(t=!1)}),t&&(null==C||C(),S(y.current),l&&(null==p||p()),o&&o())},anchorX:c,anchorY:u,children:t},n)})})},Bh=n.createContext(null);const Vh=t=>!0===t,Oh=({children:t,id:e,inherit:i=!0})=>{const o=n.useContext(Yo),r=n.useContext(Bh),[a,l]=function(){const t=function(){const t=n.useRef(!1);return Xo(()=>(t.current=!0,()=>{t.current=!1}),[]),t}(),[e,s]=n.useState(0),i=n.useCallback(()=>{t.current&&s(e+1)},[e]);return[n.useCallback(()=>Nr.postRender(i),[i]),e]}(),c=n.useRef(null),u=o.id||r;null===c.current&&((t=>Vh(!0===t)||"id"===t)(i)&&u&&(e=e?u+"-"+e:u),c.current={id:e,group:Vh(i)&&o.group||Th()});const d=n.useMemo(()=>({...c.current,forceRender:a}),[l]);return s.jsx(Yo.Provider,{value:d,children:t})},zh=n.createContext({strict:!1}),$h={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let Wh=!1;function Uh(){return function(){if(Wh)return;const t={};for(const e in $h)t[e]={isEnabled:t=>$h[e].some(e=>!!t[e])};gu(t),Wh=!0}(),fu}const Hh=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function Yh(t){return t.startsWith("while")||t.startsWith("drag")&&"draggable"!==t||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||Hh.has(t)}let qh=t=>!Yh(t);function Gh(t){"function"==typeof t&&(qh=e=>e.startsWith("on")?!Yh(e):t(e))}try{Gh(require("@emotion/is-prop-valid").default)}catch{}const Xh=n.createContext({});function Kh(t){return Array.isArray(t)?t.join(" "):t}function Jh(t,e,n){for(const s in e)pc(e[s])||Hu(s,n)||(t[s]=e[s])}function Zh(t,e){const s={},i=function(t,e){const s={};return Jh(s,t.style||{},t),Object.assign(s,function({transformTemplate:t},e){return n.useMemo(()=>{const n={style:{},transform:{},transformOrigin:{},vars:{}};return Bu(n,e,t),Object.assign({},n.vars,n.style)},[e])}(t,e)),s}(t,e);return t.drag&&!1!==t.dragListener&&(s.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=!0===t.drag?"none":"pan-"+("x"===t.drag?"y":"x")),void 0===t.tabIndex&&(t.onTap||t.onTapStart||t.whileTap)&&(s.tabIndex=0),s.style=i,s}function Qh(t,e,s,i){const o=n.useMemo(()=>{const n={style:{},transform:{},transformOrigin:{},vars:{},attrs:{}};return Ju(n,e,Qu(i),t.transformTemplate,t.style),{...n.attrs,style:{...n.style}}},[e]);if(t.style){const e={};Jh(e,t.style,t),o.style={...e,...o.style}}return o}const tp=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function ep(t){return"string"==typeof t&&!t.includes("-")&&!!(tp.indexOf(t)>-1||/[A-Z]/u.test(t))}function np(t,e,s,{latestValues:i},o,r=!1,a){const l=(a??ep(t)?Qh:Zh)(e,i,o,t),c=function(t,e,n){const s={};for(const i in t)"values"===i&&"object"==typeof t.values||(qh(i)||!0===n&&Yh(i)||!e&&!Yh(i)||t.draggable&&i.startsWith("onDrag"))&&(s[i]=t[i]);return s}(e,"string"==typeof t,r),u=t!==n.Fragment?{...c,...l,ref:s}:{},{children:d}=e,h=n.useMemo(()=>pc(d)?d.get():d,[d]);return n.createElement(t,{...u,children:h})}function sp(t,e,n,s){const i={},o=s(t,{});for(const h in o)i[h]=Yd(o[h]);let{initial:r,animate:a}=t;const l=hu(t),c=pu(t);e&&c&&!l&&!1!==t.inherit&&(void 0===r&&(r=e.initial),void 0===a&&(a=e.animate));let u=!!n&&!1===n.initial;u=u||!1===r;const d=u?a:r;if(d&&"boolean"!=typeof d&&!lu(d)){const e=Array.isArray(d)?d:[d];for(let n=0;n(e,s)=>{const i=n.useContext(Xh),o=n.useContext(Ko),r=()=>function({scrapeMotionValuesFromProps:t,createRenderState:e},n,s,i){return{latestValues:sp(n,s,i,t),renderState:e()}}(t,e,i,o);return s?r():qo(r)},op=ip({scrapeMotionValuesFromProps:Yu,createRenderState:()=>({style:{},transform:{},transformOrigin:{},vars:{}})}),rp=ip({scrapeMotionValuesFromProps:td,createRenderState:()=>({style:{},transform:{},transformOrigin:{},vars:{},attrs:{}})}),ap=Symbol.for("motionComponentSymbol");function lp(t,e,s){const i=n.useRef(s);n.useInsertionEffect(()=>{i.current=s});const o=n.useRef(null);return n.useCallback(n=>{var s;n&&(null==(s=t.onMount)||s.call(t,n)),e&&(n?e.mount(n):e.unmount());const r=i.current;if("function"==typeof r)if(n){const t=r(n);"function"==typeof t&&(o.current=t)}else o.current?(o.current(),o.current=null):r(n);else r&&(r.current=n)},[e])}const cp=n.createContext({});function up(t){return t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,"current")}function dp(t,e,s,i,o,r){var a,l;const{visualElement:c}=n.useContext(Xh),u=n.useContext(zh),d=n.useContext(Ko),h=n.useContext(Ph).reducedMotion,p=n.useRef(null),m=n.useRef(!1);i=i||u.renderer,!p.current&&i&&(p.current=i(t,{visualState:e,parent:c,props:s,presenceContext:d,blockInitialAnimation:!!d&&!1===d.initial,reducedMotionConfig:h,isSVG:r}),m.current&&p.current&&(p.current.manuallyAnimateOnMount=!0));const f=p.current,g=n.useContext(cp);!f||f.projection||!o||"html"!==f.type&&"svg"!==f.type||function(t,e,n,s){const{layoutId:i,layout:o,drag:r,dragConstraints:a,layoutScroll:l,layoutRoot:c,layoutCrossfade:u}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:hp(t.parent)),t.projection.setOptions({layoutId:i,layout:o,alwaysMeasureLayout:Boolean(r)||a&&up(a),visualElement:t,animationType:"string"==typeof o?o:"both",initialPromotionConfig:s,crossfade:u,layoutScroll:l,layoutRoot:c})}(p.current,s,o,g);const y=n.useRef(!1);n.useInsertionEffect(()=>{f&&y.current&&f.update(s,d)});const v=s[gc],x=n.useRef(Boolean(v)&&!(null==(a=window.MotionHandoffIsComplete)?void 0:a.call(window,v))&&(null==(l=window.MotionHasOptimisedAnimation)?void 0:l.call(window,v)));return Xo(()=>{m.current=!0,f&&(y.current=!0,window.MotionIsMounted=!0,f.updateFeatures(),f.scheduleRenderMicrotask(),x.current&&f.animationState&&f.animationState.animateChanges())}),n.useEffect(()=>{f&&(!x.current&&f.animationState&&f.animationState.animateChanges(),x.current&&(queueMicrotask(()=>{var t;null==(t=window.MotionHandoffMarkAsComplete)||t.call(window,v)}),x.current=!1),f.enteringChildren=void 0)}),f}function hp(t){if(t)return!1!==t.options.allowProjection?t.projection:hp(t.parent)}function pp(t,{forwardMotionProps:e=!1,type:i}={},o,r){o&&function(t){const e=Uh();for(const n in t)e[n]={...e[n],...t[n]};gu(e)}(o);const a=i?"svg"===i:ep(t),l=a?rp:op;function c(i,o){let c;const u={...n.useContext(Ph),...i,layoutId:mp(i)},{isStatic:d}=u,h=function(t){const{initial:e,animate:s}=function(t,e){if(hu(t)){const{initial:e,animate:n}=t;return{initial:!1===e||cu(e)?e:void 0,animate:cu(n)?n:void 0}}return!1!==t.inherit?e:{}}(t,n.useContext(Xh));return n.useMemo(()=>({initial:e,animate:s}),[Kh(e),Kh(s)])}(i),p=l(i,d);if(!d&&Go){n.useContext(zh).strict;const e=function(t){const e=Uh(),{drag:n,layout:s}=e;if(!n&&!s)return{};const i={...n,...s};return{MeasureLayout:(null==n?void 0:n.isEnabled(t))||(null==s?void 0:s.isEnabled(t))?i.MeasureLayout:void 0,ProjectionNode:i.ProjectionNode}}(u);c=e.MeasureLayout,h.visualElement=dp(t,p,u,r,e.ProjectionNode,a)}return s.jsxs(Xh.Provider,{value:h,children:[c&&h.visualElement?s.jsx(c,{visualElement:h.visualElement,...u}):null,np(t,i,lp(p,h.visualElement,o),p,d,e,a)]})}c.displayName=`motion.${"string"==typeof t?t:`create(${t.displayName??t.name??""})`}`;const u=n.forwardRef(c);return u[ap]=t,u}function mp({layoutId:t}){const e=n.useContext(Yo).id;return e&&void 0!==t?e+"-"+t:t}function fp(t,e){if("undefined"==typeof Proxy)return pp;const n=new Map,s=(n,s)=>pp(n,s,t,e);return new Proxy((t,e)=>s(t,e),{get:(i,o)=>"create"===o?s:(n.has(o)||n.set(o,pp(o,void 0,t,e)),n.get(o))})}const gp=(t,e)=>e.isSVG??ep(t)?new ed(e):new qu(e,{allowProjection:t!==n.Fragment});let yp=0;const vp={animation:{Feature:class extends xu{constructor(t){super(t),t.animationState||(t.animationState=ad(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();lu(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:e}=this.node.prevProps||{};t!==e&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),null==(t=this.unmountControls)||t.call(this)}}},exit:{Feature:class extends xu{constructor(){super(...arguments),this.id=yp++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:e}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===n)return;const s=this.node.animationState.setActive("exit",!t);e&&!t&&s.then(()=>{e(this.id)})}mount(){const{register:t,onExitComplete:e}=this.node.presenceContext||{};e&&e(this.id),t&&(this.unmount=t(this.id))}unmount(){}}}};function xp(t){return{point:{x:t.pageX,y:t.pageY}}}function bp(t,e,n,s){return $d(t,e,(t=>e=>Yc(e)&&t(e,xp(e)))(n),s)}const wp=({current:t})=>t?t.ownerDocument.defaultView:null,kp=(t,e)=>Math.abs(t-e),Sp=new Set(["auto","scroll"]);class Tp{constructor(t,e,{transformPagePoint:n,contextWindow:s=window,dragSnapToOrigin:i=!1,distanceThreshold:o=3,element:r}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=t=>{this.handleScroll(t.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!this.lastMoveEvent||!this.lastMoveEventInfo)return;const t=Pp(this.lastMoveEventInfo,this.history),e=null!==this.startEvent,n=function(t,e){const n=kp(t.x,e.x),s=kp(t.y,e.y);return Math.sqrt(n**2+s**2)}(t.offset,{x:0,y:0})>=this.distanceThreshold;if(!e&&!n)return;const{point:s}=t,{timestamp:i}=Fr;this.history.push({...s,timestamp:i});const{onStart:o,onMove:r}=this.handlers;e||(o&&o(this.lastMoveEvent,t),this.startEvent=this.lastMoveEvent),r&&r(this.lastMoveEvent,t)},this.handlePointerMove=(t,e)=>{this.lastMoveEvent=t,this.lastMoveEventInfo=Cp(e,this.transformPagePoint),Nr.update(this.updatePoint,!0)},this.handlePointerUp=(t,e)=>{this.end();const{onEnd:n,onSessionEnd:s,resumeAnimation:i}=this.handlers;if(!this.dragSnapToOrigin&&this.startEvent||i&&i(),!this.lastMoveEvent||!this.lastMoveEventInfo)return;const o=Pp("pointercancel"===t.type?this.lastMoveEventInfo:Cp(e,this.transformPagePoint),this.history);this.startEvent&&n&&n(t,o),s&&s(t,o)},!Yc(t))return;this.dragSnapToOrigin=i,this.handlers=e,this.transformPagePoint=n,this.distanceThreshold=o,this.contextWindow=s||window;const a=Cp(xp(t),this.transformPagePoint),{point:l}=a,{timestamp:c}=Fr;this.history=[{...l,timestamp:c}];const{onSessionStart:u}=e;u&&u(t,Pp(a,this.history)),this.removeListeners=ar(bp(this.contextWindow,"pointermove",this.handlePointerMove),bp(this.contextWindow,"pointerup",this.handlePointerUp),bp(this.contextWindow,"pointercancel",this.handlePointerUp)),r&&this.startScrollTracking(r)}startScrollTracking(t){let e=t.parentElement;for(;e;){const t=getComputedStyle(e);(Sp.has(t.overflowX)||Sp.has(t.overflowY))&&this.scrollPositions.set(e,{x:e.scrollLeft,y:e.scrollTop}),e=e.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0,passive:!0}),window.addEventListener("scroll",this.onWindowScroll,{passive:!0}),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(t){const e=this.scrollPositions.get(t);if(!e)return;const n=t===window,s=n?{x:window.scrollX,y:window.scrollY}:{x:t.scrollLeft,y:t.scrollTop},i=s.x-e.x,o=s.y-e.y;0===i&&0===o||(n?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=i,this.lastMoveEventInfo.point.y+=o):this.history.length>0&&(this.history[0].x-=i,this.history[0].y-=o),this.scrollPositions.set(t,s),Nr.update(this.updatePoint,!0))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),Rr(this.updatePoint)}}function Cp(t,e){return e?{point:e(t.point)}:t}function Mp(t,e){return{x:t.x-e.x,y:t.y-e.y}}function Pp({point:t},e){return{point:t,delta:Mp(t,jp(e)),offset:Mp(t,Ep(e)),velocity:Lp(e,.1)}}function Ep(t){return t[0]}function jp(t){return t[t.length-1]}function Lp(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,s=null;const i=jp(t);for(;n>=0&&(s=t[n],!(i.timestamp-s.timestamp>ur(e)));)n--;if(!s)return{x:0,y:0};const o=dr(i.timestamp-s.timestamp);if(0===o)return{x:0,y:0};const r={x:(i.x-s.x)/o,y:(i.y-s.y)/o};return r.x===1/0&&(r.x=0),r.y===1/0&&(r.y=0),r}function Ap(t,e,n){return{min:void 0!==e?t.min+e:void 0,max:void 0!==n?t.max+n-(t.max-t.min):void 0}}function Dp(t,e){let n=e.min-t.min,s=e.max-t.max;return e.max-e.min{e?(this.stopAnimation(),this.snapToCursor(xp(t).point)):this.pauseAnimation()},onStart:(t,e)=>{this.stopAnimation();const{drag:n,dragPropagation:s,onDragStart:i}=this.getProps();if(n&&!s&&(this.openDragLock&&this.openDragLock(),this.openDragLock="x"===(o=n)||"y"===o?zc[o]?null:(zc[o]=!0,()=>{zc[o]=!1}):zc.x||zc.y?null:(zc.x=zc.y=!0,()=>{zc.x=zc.y=!1}),!this.openDragLock))return;var o;this.latestPointerEvent=t,this.latestPanInfo=e,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Dd(t=>{let e=this.getAxisMotionValue(t).get()||0;if(oa.test(e)){const{projection:n}=this.visualElement;if(n&&n.layout){const s=n.layout.layoutBox[t];s&&(e=md(s)*(parseFloat(e)/100))}}this.originPoint[t]=e}),i&&Nr.postRender(()=>i(t,e)),mc(this.visualElement,"transform");const{animationState:r}=this.visualElement;r&&r.setActive("whileDrag",!0)},onMove:(t,e)=>{this.latestPointerEvent=t,this.latestPanInfo=e;const{dragPropagation:n,dragDirectionLock:s,onDirectionLock:i,onDrag:o}=this.getProps();if(!n&&!this.openDragLock)return;const{offset:r}=e;if(s&&null===this.currentDirection)return this.currentDirection=function(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}(r),void(null!==this.currentDirection&&i&&i(this.currentDirection));this.updateAxis("x",e.point,r),this.updateAxis("y",e.point,r),this.visualElement.render(),o&&o(t,e)},onSessionEnd:(t,e)=>{this.latestPointerEvent=t,this.latestPanInfo=e,this.stop(t,e),this.latestPointerEvent=null,this.latestPanInfo=null},resumeAnimation:()=>Dd(t=>{var e;return"paused"===this.getAnimationState(t)&&(null==(e=this.getAxisMotionValue(t).animation)?void 0:e.play())})},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:i,distanceThreshold:n,contextWindow:wp(this.visualElement),element:this.visualElement.current})}stop(t,e){const n=t||this.latestPointerEvent,s=e||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!s||!n)return;const{velocity:o}=s;this.startAnimation(o);const{onDragEnd:r}=this.getProps();r&&Nr.postRender(()=>r(n,s))}cancel(){this.isDragging=!1;const{projection:t,animationState:e}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),e&&e.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(t,e,n){const{drag:s}=this.getProps();if(!n||!Bp(t,s,this.currentDirection))return;const i=this.getAxisMotionValue(t);let o=this.originPoint[t]+n[t];this.constraints&&this.constraints[t]&&(o=function(t,{min:e,max:n},s){return void 0!==e&&tn&&(t=s?Sa(n,t,s.max):Math.min(t,n)),t}(o,this.constraints[t],this.elastic[t])),i.set(o)}resolveConstraints(){var t;const{dragConstraints:e,dragElastic:n}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):null==(t=this.visualElement.projection)?void 0:t.layout,i=this.constraints;e&&up(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):this.constraints=!(!e||!s)&&function(t,{top:e,left:n,bottom:s,right:i}){return{x:Ap(t.x,n,i),y:Ap(t.y,e,s)}}(s.layoutBox,e),this.elastic=function(t=Np){return!1===t?t=0:!0===t&&(t=Np),{x:Rp(t,"left","right"),y:Rp(t,"top","bottom")}}(n),i!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&Dd(t=>{!1!==this.constraints&&this.getAxisMotionValue(t)&&(this.constraints[t]=function(t,e){const n={};return void 0!==e.min&&(n.min=e.min-t.min),void 0!==e.max&&(n.max=e.max-t.min),n}(s.layoutBox[t],this.constraints[t]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:e}=this.getProps();if(!t||!up(t))return!1;const n=t.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const i=function(t,e,n){const s=Fu(t,n),{scroll:i}=e;return i&&(Du(s.x,i.offset.x),Du(s.y,i.offset.y)),s}(n,s.root,this.visualElement.getTransformPagePoint());let o=function(t,e){return{x:Dp(t.x,e.x),y:Dp(t.y,e.y)}}(s.layout.layoutBox,i);if(e){const t=e(function({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}(o));this.hasMutatedConstraints=!!t,t&&(o=bu(t))}return o}startAnimation(t){const{drag:e,dragMomentum:n,dragElastic:s,dragTransition:i,dragSnapToOrigin:o,onDragTransitionEnd:r}=this.getProps(),a=this.constraints||{},l=Dd(r=>{if(!Bp(r,e,this.currentDirection))return;let l=a&&a[r]||{};o&&(l={min:0,max:0});const c=s?200:1e6,u=s?40:1e7,d={type:"inertia",velocity:n?t[r]:0,bounceStiffness:c,bounceDamping:u,timeConstant:750,restDelta:1,restSpeed:10,...i,...l};return this.startAxisValueAnimation(r,d)});return Promise.all(l).then(r)}startAxisValueAnimation(t,e){const n=this.getAxisMotionValue(t);return mc(this.visualElement,t),n.start(nc(t,n,0,e,this.visualElement,!1))}stopAnimation(){Dd(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){Dd(t=>{var e;return null==(e=this.getAxisMotionValue(t).animation)?void 0:e.pause()})}getAnimationState(t){var e;return null==(e=this.getAxisMotionValue(t).animation)?void 0:e.state}getAxisMotionValue(t){const e=`_drag${t.toUpperCase()}`,n=this.visualElement.getProps();return n[e]||this.visualElement.getValue(t,(n.initial?n.initial[t]:void 0)||0)}snapToCursor(t){Dd(e=>{const{drag:n}=this.getProps();if(!Bp(e,n,this.currentDirection))return;const{projection:s}=this.visualElement,i=this.getAxisMotionValue(e);if(s&&s.layout){const{min:n,max:o}=s.layout.layoutBox[e],r=i.get()||0;i.set(t[e]-Sa(n,o,.5)+r)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:e}=this.getProps(),{projection:n}=this.visualElement;if(!up(e)||!n||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};Dd(t=>{const e=this.getAxisMotionValue(t);if(e&&!1!==this.constraints){const n=e.get();s[t]=function(t,e){let n=.5;const s=md(t),i=md(e);return i>s?n=lr(e.min,e.max-s,t.min):s>i&&(n=lr(t.min,t.max-i,e.min)),Qo(0,1,n)}({min:n,max:n},this.constraints[t])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),Dd(e=>{if(!Bp(e,t,null))return;const n=this.getAxisMotionValue(e),{min:i,max:o}=this.constraints[e];n.set(Sa(i,o,s[e]))})}addListeners(){if(!this.visualElement.current)return;Ip.set(this.visualElement,this);const t=this.visualElement.current,e=bp(t,"pointerdown",e=>{const{drag:n,dragListener:s=!0}=this.getProps(),i=e.target,o=i!==t&&Gc(i);n&&s&&!o&&this.start(e)}),n=()=>{const{dragConstraints:t}=this.getProps();up(t)&&t.current&&(this.constraints=this.resolveRefConstraints())},{projection:s}=this.visualElement,i=s.addEventListener("measure",n);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),Nr.read(n);const o=$d(window,"resize",()=>this.scalePositionWithinConstraints()),r=s.addEventListener("didUpdate",({delta:t,hasLayoutChanged:e})=>{this.isDragging&&e&&(Dd(e=>{const n=this.getAxisMotionValue(e);n&&(this.originPoint[e]+=t[e].translate,n.set(n.get()+t[e].translate))}),this.visualElement.render())});return()=>{o(),e(),i(),r&&r()}}getProps(){const t=this.visualElement.getProps(),{drag:e=!1,dragDirectionLock:n=!1,dragPropagation:s=!1,dragConstraints:i=!1,dragElastic:o=Np,dragMomentum:r=!0}=t;return{...t,drag:e,dragDirectionLock:n,dragPropagation:s,dragConstraints:i,dragElastic:o,dragMomentum:r}}}function Bp(t,e,n){return!(!0!==e&&e!==t||null!==n&&n!==t)}const Vp=t=>(e,n)=>{t&&Nr.postRender(()=>t(e,n))};let Op=!1;class zp extends n.Component{componentDidMount(){const{visualElement:t,layoutGroup:e,switchLayoutGroup:n,layoutId:s}=this.props,{projection:i}=t;i&&(e.group&&e.group.add(i),n&&n.register&&s&&n.register(i),Op&&i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Gd.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:e,visualElement:n,drag:s,isPresent:i}=this.props,{projection:o}=n;return o?(o.isPresent=i,t.layoutDependency!==e&&o.setOptions({...o.options,layoutDependency:e}),Op=!0,s||t.layoutDependency!==e||void 0===e||t.isPresent!==i?o.willUpdate():this.safeToRemove(),t.isPresent!==i&&(i?o.promote():o.relegate()||Nr.postRender(()=>{const t=o.getStack();t&&t.members.length||this.safeToRemove()})),null):null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),Oc.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:e,switchLayoutGroup:n}=this.props,{projection:s}=t;Op=!0,s&&(s.scheduleCheckAfterUnmount(),e&&e.group&&e.group.remove(s),n&&n.deregister&&n.deregister(s))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function $p(t){const[e,i]=Nh(),o=n.useContext(Yo);return s.jsx(zp,{...t,layoutGroup:o,switchLayoutGroup:n.useContext(cp),isPresent:e,safeToRemove:i})}const Wp={pan:{Feature:class extends xu{constructor(){super(...arguments),this.removePointerDownListener=or}onPointerDown(t){this.session=new Tp(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:wp(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:e,onPan:n,onPanEnd:s}=this.node.getProps();return{onSessionStart:Vp(t),onStart:Vp(e),onMove:n,onEnd:(t,e)=>{delete this.session,s&&Nr.postRender(()=>s(t,e))}}}mount(){this.removePointerDownListener=bp(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}},drag:{Feature:class extends xu{constructor(t){super(t),this.removeGroupControls=or,this.removeListeners=or,this.controls=new _p(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||or}update(){const{dragControls:t}=this.node.getProps(),{dragControls:e}=this.node.prevProps||{};t!==e&&(this.removeGroupControls(),t&&(this.removeGroupControls=t.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}},ProjectionNode:Mh,MeasureLayout:$p}};function Up(t,e,n){const{props:s}=t;t.animationState&&s.whileHover&&t.animationState.setActive("whileHover","Start"===n);const i=s["onHover"+n];i&&Nr.postRender(()=>i(e,xp(e)))}function Hp(t,e,n){const{props:s}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&s.whileTap&&t.animationState.setActive("whileTap","Start"===n);const i=s["onTap"+("End"===n?"":n)];i&&Nr.postRender(()=>i(e,xp(e)))}const Yp=new WeakMap,qp=new WeakMap,Gp=t=>{const e=Yp.get(t.target);e&&e(t)},Xp=t=>{t.forEach(Gp)};const Kp={some:0,all:1},Jp=fp({...vp,inView:{Feature:class extends xu{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:e,margin:n,amount:s="some",once:i}=t,o={root:e?e.current:void 0,rootMargin:n,threshold:"number"==typeof s?s:Kp[s]};return function(t,e,n){const s=function({root:t,...e}){const n=t||document;qp.has(n)||qp.set(n,{});const s=qp.get(n),i=JSON.stringify(e);return s[i]||(s[i]=new IntersectionObserver(Xp,{root:t,...e})),s[i]}(e);return Yp.set(t,n),s.observe(t),()=>{Yp.delete(t),s.unobserve(t)}}(this.node.current,o,t=>{const{isIntersecting:e}=t;if(this.isInView===e)return;if(this.isInView=e,i&&!e&&this.hasEnteredView)return;e&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",e);const{onViewportEnter:n,onViewportLeave:s}=this.node.getProps(),o=e?n:s;o&&o(t)})}mount(){this.startObserver()}update(){if("undefined"==typeof IntersectionObserver)return;const{props:t,prevProps:e}=this.node;["amount","margin","root"].some(function({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}(t,e))&&this.startObserver()}unmount(){}}},tap:{Feature:class extends xu{mount(){const{current:t}=this.node;t&&(this.unmount=function(t,e,n={}){const[s,i,o]=Wc(t,n),r=t=>{const s=t.currentTarget;if(!Zc(t))return;Xc.add(s);const o=e(s,t),r=(t,e)=>{window.removeEventListener("pointerup",a),window.removeEventListener("pointercancel",l),Xc.has(s)&&Xc.delete(s),Zc(t)&&"function"==typeof o&&o(t,{success:e})},a=t=>{r(t,s===window||s===document||n.useGlobalTarget||Hc(s,t.target))},l=t=>{r(t,!1)};window.addEventListener("pointerup",a,i),window.addEventListener("pointercancel",l,i)};return s.forEach(t=>{(n.useGlobalTarget?window:t).addEventListener("pointerdown",r,i),Vc(t)&&(t.addEventListener("focus",t=>((t,e)=>{const n=t.currentTarget;if(!n)return;const s=Kc(()=>{if(Xc.has(n))return;Jc(n,"down");const t=Kc(()=>{Jc(n,"up")});n.addEventListener("keyup",t,e),n.addEventListener("blur",()=>Jc(n,"cancel"),e)});n.addEventListener("keydown",s,e),n.addEventListener("blur",()=>n.removeEventListener("keydown",s),e)})(t,i)),Gc(t)||t.hasAttribute("tabindex")||(t.tabIndex=0))}),o}(t,(t,e)=>(Hp(this.node,e,"Start"),(t,{success:e})=>Hp(this.node,t,e?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}},focus:{Feature:class extends xu{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch(e){t=!0}t&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=ar($d(this.node.current,"focus",()=>this.onFocus()),$d(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}},hover:{Feature:class extends xu{mount(){const{current:t}=this.node;t&&(this.unmount=function(t,e,n={}){const[s,i,o]=Wc(t,n),r=t=>{if(!Uc(t))return;const{target:n}=t,s=e(n,t);if("function"!=typeof s||!n)return;const o=t=>{Uc(t)&&(s(t),n.removeEventListener("pointerleave",o))};n.addEventListener("pointerleave",o,i)};return s.forEach(t=>{t.addEventListener("pointerenter",r,i)}),o}(t,(t,e)=>(Up(this.node,e,"Start"),t=>Up(this.node,t,"End"))))}unmount(){}}},...Wp,layout:{ProjectionNode:Mh,MeasureLayout:$p}},gp),Zp={duration:.15,ease:[.4,0,.2,1]},Qp={type:"tween",duration:.25,ease:[.4,0,.2,1]},tm={type:"tween",duration:.3,ease:[.4,0,.2,1]},em=n.createContext(!1);function nm(){return n.useContext(em)}const sm={xs:"sm:max-w-xs",sm:"sm:max-w-sm",md:"sm:max-w-md",lg:"sm:max-w-lg",xl:"sm:max-w-xl","2xl":"sm:max-w-2xl","3xl":"sm:max-w-3xl","4xl":"sm:max-w-4xl","5xl":"sm:max-w-5xl",full:"sm:max-w-[calc(100vw-2rem)]"};function im({open:t,onClose:e,size:i="md",className:o,children:l,bottomSheet:c=!0,motionPlus:u=!1}){const[d,h]=n.useState(!1),p=n.useRef(null);n.useEffect(()=>(p.current&&(clearTimeout(p.current),p.current=null),t?p.current=setTimeout(()=>{h(!0)},350):queueMicrotask(()=>h(!1)),()=>{p.current&&(clearTimeout(p.current),p.current=null)}),[t]);const m=n.useCallback((t,n)=>{(n.offset.y>100||n.velocity.y>500)&&e()},[e]),f=u?tm:Qp,y=u?.98:.99,v=c?8:4;return s.jsx(_h,{mode:"wait",children:t&&s.jsxs(r,{static:!0,open:t,onClose:e,className:"relative z-[10010]",children:[s.jsx(Jp.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:Zp,className:"fixed inset-0 bg-black/50 backdrop-blur-sm","aria-hidden":"true"}),s.jsx("div",{className:"fixed inset-0 overflow-y-auto",children:s.jsx("div",{className:g("flex min-h-full justify-center",c?"items-end sm:items-center sm:p-4":"items-center p-4"),children:s.jsx(Jp.div,{drag:!!c&&"y",dragConstraints:{top:0,bottom:0},dragElastic:{top:0,bottom:.4},onDragEnd:m,initial:{opacity:0,scale:y,y:v},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.99,y:c?40:4},transition:f,style:{willChange:"transform, opacity"},className:g(c&&"w-full sm:w-auto"),children:s.jsx(a,{className:g("w-full bg-bg-surface shadow-2xl flex flex-col","ring-1 ring-inset ring-white/10",sm[i],c?"rounded-t-2xl rounded-b-none sm:rounded-2xl pb-safe":"rounded-2xl",o),children:s.jsx(em.Provider,{value:d,children:l})})})})})]})})}function om({className:t,...e}){return s.jsx(l,{...e,className:g("text-base font-semibold text-text-primary sm:text-lg",t)})}function rm({icon:t,title:e,onClose:n,className:i}){return s.jsxs("div",{className:g("flex items-center justify-between p-4 border-b border-border-subtle",i),children:[s.jsxs("div",{className:"flex items-center gap-3",children:[t&&s.jsx("div",{className:"p-2 rounded-lg bg-bg-subtle text-icon-card-title",children:t}),s.jsx(om,{children:e})]}),n&&s.jsx("button",{onClick:n,className:"p-2 rounded-lg text-text-muted hover:text-text-primary hover:bg-bg-subtle transition-colors","aria-label":"Close",children:s.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})}function am({className:t,...e}){return s.jsx("div",{...e,className:g("p-4",t)})}function lm({className:t,...e}){return s.jsx("div",{...e,className:g("flex flex-col-reverse gap-3 p-4 pt-0","sm:flex-row sm:justify-end","*:w-full sm:*:w-auto",t)})}const cm={snappy:{type:"spring",stiffness:500,damping:30},smooth:{type:"spring",stiffness:300,damping:30},gentle:{type:"spring",stiffness:200,damping:25}},um={easeIn:[.4,0,1,1],cubicInOut:[.65,0,.35,1]},dm={normal:.05};function hm({className:t,...e}){return s.jsx("nav",{...e,className:g(t,"flex h-full min-h-0 flex-col")})}function pm({className:t,...e}){return s.jsx("div",{...e,className:g(t,"flex flex-col border-b border-border-subtle p-4","[&>[data-slot=section]+[data-slot=section]]:mt-2.5")})}function mm({className:t,...e}){return s.jsx("div",{...e,className:g(t,"flex flex-1 flex-col overflow-y-auto p-3","[&>[data-slot=section]+[data-slot=section]]:mt-6")})}function fm({className:t,...e}){return s.jsx("div",{...e,className:g(t,"mt-auto flex flex-col border-t border-border-subtle","[&>[data-slot=section]+[data-slot=section]]:mt-2.5")})}function gm({className:t,...e}){const i=n.useId();return s.jsx(Oh,{id:i,children:s.jsx("div",{...e,"data-slot":"section",className:g(t,"flex flex-col gap-0.5")})})}const ym=n.forwardRef(function(t,e){const{current:n,className:i,children:r,...a}=t,l=g("flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left","min-h-[44px]","text-sm font-medium","[&>svg]:w-5 [&>svg]:h-5 [&>svg]:flex-shrink-0",n?"bg-accent-primary/15 text-accent-primary [&>svg]:text-accent-primary":"text-text-muted hover:text-text-primary hover:bg-subtle-fill [&>svg]:text-text-muted hover:[&>svg]:text-text-primary","transition-all duration-150");return s.jsxs("span",{className:g(i,"relative"),children:[n&&s.jsx(Jp.span,{layoutId:"sidebar-current-indicator",className:"absolute inset-y-2 -left-3 w-0.5 rounded-full bg-accent-primary"}),"string"==typeof a.href?s.jsx(y,{to:a.href,onClick:a.onClick,onMouseEnter:a.onMouseEnter,onMouseLeave:a.onMouseLeave,className:l,"data-current":n?"true":void 0,ref:e,children:r}):s.jsx(o,{...a,className:g("cursor-default",l),"data-current":n?"true":void 0,ref:e,children:r})]})});function vm({className:t,...e}){return s.jsx("span",{...e,className:g(t,"truncate")})}function xm({className:t,variant:e="default",...n}){return s.jsx("span",{...n,className:g("ml-auto flex items-center gap-1 px-1.5 py-0.5 rounded-full","text-xs font-medium",{default:"bg-bg-subtle text-text-muted",accent:"bg-accent-primary/20 text-accent-primary",success:"bg-accent-success/20 text-accent-success",warning:"bg-accent-secondary/20 text-accent-secondary",danger:"bg-accent-danger/20 text-accent-danger"}[e],t)})}const bm=n.createContext(null),wm={type:"spring",visualDuration:.35,bounce:.15};function km({open:t,onClose:e,children:n}){return s.jsx(_h,{children:t&&s.jsxs(r,{static:!0,open:t,onClose:e,className:"lg:hidden relative z-[10002]",children:[s.jsx(Jp.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.25,ease:"easeOut"},className:"fixed inset-0 bg-black/60 backdrop-blur-sm","aria-hidden":"true"}),s.jsx(Jp.div,{initial:{x:"-100%"},animate:{x:0},exit:{x:"-100%"},transition:wm,className:"fixed inset-y-0 left-0 w-72 max-w-[85vw] z-[10003]",children:s.jsx(a,{className:"h-full",children:s.jsxs("div",{className:"flex h-full flex-col sidebar-panel",children:[s.jsx("div",{className:"absolute top-4 right-4 z-10",children:s.jsx(c,{className:"p-2 rounded-lg text-text-muted hover:text-text-primary hover:bg-subtle-fill transition-colors","aria-label":"Close navigation",children:s.jsx(Ho,{className:"w-5 h-5"})})}),n]})})})]})})}function Sm({sidebar:t,navbar:e,children:i,className:o}){const[r,a]=n.useState(!1),l=()=>a(!0),c=()=>a(!1),u={isOpen:r,open:l,close:c,toggle:()=>a(t=>!t)};return s.jsx(bm.Provider,{value:u,children:s.jsxs("div",{className:"flex h-screen overflow-hidden bg-bg-body",children:[s.jsx("aside",{className:"hidden lg:flex flex-col w-64 flex-shrink-0 h-full relative sidebar-panel",children:t}),s.jsx(km,{open:r,onClose:c,children:t}),s.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[s.jsx("header",{className:"lg:hidden sticky top-0 z-[10001] h-14 mobile-header",children:s.jsxs("div",{className:"flex items-center h-full px-4",children:[s.jsx("button",{onClick:l,className:"w-10 h-10 flex items-center justify-center rounded-lg hover:bg-subtle-fill active:bg-subtle-fill transition-colors mr-2","aria-label":"Open navigation",children:s.jsx(Io,{className:"w-5 h-5 text-text-primary"})}),s.jsx("div",{className:"flex-1 min-w-0",children:e})]})}),s.jsx("main",{className:g("flex-1 overflow-y-auto main-content",o),children:i})]})]})})}function Tm({className:t,...e}){return s.jsx("nav",{...e,className:g(t,"flex flex-1 items-center gap-3")})}function Cm({className:t,...e}){return s.jsx("div",{...e,className:g(t,"flex items-center gap-3")})}function Mm({className:t,...e}){return s.jsx("div",{"aria-hidden":"true",...e,className:g(t,"flex-1")})}function Pm({defaultOpen:t=!1,className:e,children:n}){return s.jsx(d,{defaultOpen:t,children:s.jsx("div",{className:g("flex flex-col",e),children:n})})}n.forwardRef(function({children:t,elevated:e,compact:n,noPadding:i,className:o,...r},a){return s.jsx("div",{ref:a,className:g("rounded-lg","bg-bg-surface","ring-1 ring-inset ring-border-subtle","h-full flex flex-col",e&&"bg-bg-elevated",!i&&(n?"p-3 sm:p-4":"p-4 sm:p-5"),o),...r,children:t})}),n.forwardRef(function({children:t,className:e,...n},i){return s.jsx("div",{ref:i,className:g("flex items-center justify-between gap-4","pb-4 mb-4","border-b border-border-subtle",e),...n,children:t})}),n.forwardRef(function({children:t,icon:e,className:n,...i},o){return s.jsxs("h3",{ref:o,className:g("flex items-center gap-2","text-base font-semibold text-text-primary",n),...i,children:[e&&s.jsx("span",{className:"text-icon-card-title w-5 h-5 flex-shrink-0",children:e}),t]})}),n.forwardRef(function({children:t,className:e,...n},i){return s.jsx("p",{ref:i,className:g("text-sm text-text-muted",e),...n,children:t})}),n.forwardRef(function({children:t,className:e,...n},i){return s.jsx("div",{ref:i,className:g("flex-1 min-h-0",e),...n,children:t})}),n.forwardRef(function({children:t,className:e,...n},i){return s.jsx("div",{ref:i,className:g("flex items-center justify-end gap-3","pt-4 mt-4","border-t border-border-subtle",e),...n,children:t})}),n.forwardRef(function({children:t,border:e,className:n,...i},o){return s.jsx("div",{ref:o,className:g(e&&"pt-4 mt-4 border-t border-border-subtle",n),...i,children:t})});const Em=n.forwardRef(function({className:t,icon:e,children:n,...i},o){return s.jsx(u,{ref:o,className:g("flex w-full items-center justify-between gap-3","px-3 py-2 rounded-lg","text-sm font-medium text-text-muted","hover:bg-bg-surface hover:text-text-primary","transition-colors duration-150","focus:outline-none focus-visible:ring-2 focus-visible:ring-accent-primary/50",t),...i,children:({open:t})=>s.jsxs(s.Fragment,{children:[n,s.jsx("span",{className:g("transition-transform duration-200",t?"rotate-180":"rotate-0"),children:e||s.jsx(Po,{className:"w-4 h-4"})})]})})});function jm({direction:t="down",className:e,children:n}){const i={hidden:{height:0,opacity:0,y:"up"===t?8:-8},visible:{height:"auto",opacity:1,y:0}};return s.jsx(h,{static:!0,children:({open:o})=>s.jsx(_h,{initial:!1,children:o&&s.jsx(Jp.div,{initial:"hidden",animate:"visible",exit:"hidden",variants:i,transition:{height:{duration:.2,ease:[.4,0,.2,1]},opacity:{duration:.15},y:{duration:.15}},className:g("overflow-hidden",e),children:s.jsx("div",{className:g("up"===t?"pb-2":"pt-2"),children:n})})})})}function Lm({label:t,icon:e,defaultOpen:n=!0,direction:i="down",className:o,dataId:r,children:a}){const l=r?{[`data-${r}-disclosure`]:!0}:{};return s.jsx(Pm,{defaultOpen:n,className:o,children:"up"===i?s.jsxs(s.Fragment,{children:[s.jsx(jm,{direction:"up",children:a}),s.jsx(Em,{...l,children:s.jsxs("span",{className:"flex items-center gap-3",children:[e,s.jsx("span",{className:"text-xs uppercase tracking-wide",children:t})]})})]}):s.jsxs(s.Fragment,{children:[s.jsx(Em,{...l,children:s.jsxs("span",{className:"flex items-center gap-3",children:[e,s.jsx("span",{className:"text-xs uppercase tracking-wide",children:t})]})}),s.jsx(jm,{direction:"down",children:a})]})})}const Am="0.9.196",Dm="'JetBrains Mono', monospace",Nm=n.memo(function({height:t=16,responsive:e=!1,className:n=""}){const i="var(--accent-primary)",o="var(--text-primary)";if(e){const t=145,e=24;return s.jsxs("svg",{className:n,viewBox:`0 0 ${t} ${e}`,preserveAspectRatio:"xMidYMid meet",role:"img","aria-label":"pyMC:Console",style:{display:"block",width:"80%",height:"auto"},children:[s.jsx("style",{children:`\n .logo-text {\n font-family: ${Dm};\n }\n .logo-accent {\n fill: var(--accent-primary, #719CDF);\n }\n .logo-main {\n fill: var(--text-primary, #FFFFFF);\n }\n `}),s.jsxs("text",{x:"0",y:"18",className:"logo-text",fontSize:"20",fontWeight:"400",letterSpacing:"-0.02em",children:[s.jsx("tspan",{className:"logo-accent",children:"py"}),s.jsx("tspan",{className:"logo-main",children:"MC"}),s.jsx("tspan",{className:"logo-accent",children:":"}),s.jsx("tspan",{className:"logo-main",children:"Console"})]})]})}const r="string"==typeof t?parseFloat(t):t,a={fontFamily:Dm,fontSize:.8*r+"px",fontWeight:400,lineHeight:1,letterSpacing:"-0.02em",whiteSpace:"nowrap"};return s.jsxs("span",{className:n,style:a,role:"img","aria-label":"pyMC:Console",children:[s.jsx("span",{style:{color:i},children:"py"}),s.jsx("span",{style:{color:o},children:"MC"}),s.jsx("span",{style:{color:i},children:":"}),s.jsx("span",{style:{color:o},children:"Console"})]})}),Rm="pymc_jwt_token",Fm="pymc_client_id",Im="pymc_remember_me",_m=new Set;function Bm(t){return _m.add(t),()=>_m.delete(t)}function Vm(t){for(const n of _m)try{n(t)}catch(e){}}function Om(){let t=localStorage.getItem(Fm);return t||(t=`${Date.now()}-${Math.random().toString(36).substring(2,15)}`,localStorage.setItem(Fm,t)),t}function zm(){return"true"===localStorage.getItem(Im)}function $m(t){t?localStorage.setItem(Im,"true"):localStorage.removeItem(Im)}function Wm(){return zm()?localStorage:sessionStorage}function Um(){return Wm().getItem(Rm)||localStorage.getItem(Rm)||sessionStorage.getItem(Rm)}function Hm(t){Wm().setItem(Rm,t),zm()?sessionStorage.removeItem(Rm):localStorage.removeItem(Rm),Vm(t)}function Ym(){localStorage.removeItem(Rm),sessionStorage.removeItem(Rm),Vm(null)}function qm(){return!(!Um()||Xm()&&(Ym(),1))}function Gm(t){try{const e=t.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),n=decodeURIComponent(atob(e).split("").map(t=>"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2)).join(""));return JSON.parse(n)}catch{return null}}function Xm(){const t=Um();if(!t)return!0;const e=Gm(t);return!e||!e.exp||Date.now()>=1e3*e.exp-6e4}function Km(){const t=Um();if(!t)return 0;const e=Gm(t);return e&&e.exp?Math.max(0,Math.floor((1e3*e.exp-Date.now())/1e3)):0}function Jm(){const t=Um();if(!t)return!1;const e=Gm(t);if(!e||!e.exp)return!1;const n=1e3*e.exp-Date.now();return n>0&&n<3e5}function Zm(){const t=Um();if(!t)return null;const e=Gm(t);return e&&e.sub?e.sub:null}async function Qm(t,e,n=!1){$m(n);try{const n=await fetch("/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:t,password:e,client_id:Om()})}),s=n.headers.get("content-type");if(!s||!s.includes("application/json"))return{success:!1,error:`Server error: ${n.status}`};const i=await n.json();return i.success&&i.token?(Hm(i.token),{success:!0}):{success:!1,error:i.error||"Login failed"}}catch(s){return{success:!1,error:"Connection error. Please try again."}}}async function tf(){const t=Um();if(!t)return!1;const e=Gm(t);(null==e?void 0:e.exp)&&Math.floor((1e3*e.exp-Date.now())/1e3);try{const e=await fetch("/auth/refresh",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify({client_id:Om()})});if(!e.ok){let t="";try{const n=await e.json();t=n.error||JSON.stringify(n)}catch{t=e.statusText}return!1}const n=await e.json();if(n.success&&n.token){Hm(n.token);const t=Gm(n.token);return(null==t?void 0:t.exp)&&Math.floor((1e3*t.exp-Date.now())/1e3),!0}return!1}catch(n){return!1}}let ef=null;async function nf(){const t=Um();if(!t)return!1;const e=Gm(t);return(null==e?void 0:e.exp)&&Math.floor((1e3*e.exp-Date.now())/1e3),!Jm()||ef||(ef=tf().finally(()=>{ef=null}),ef)}function sf(){Ym()}let of=!1;function rf(){if(of)return;if("undefined"==typeof document)return;const t=async()=>{if("visible"!==document.visibilityState)return;if(!Um())return;if(Xm())return Ym(),void("undefined"==typeof window||window.location.pathname.includes("/login")||(window.location.href="/login"));const t=Km();t>0&&t<300&&await tf()};document.addEventListener("visibilitychange",t),of=!0,"visible"===document.visibilityState&&t()}const af=Object.freeze(Object.defineProperty({__proto__:null,clearToken:Ym,getClientId:Om,getRememberMe:zm,getToken:Um,getTokenTimeRemaining:Km,getUsername:Zm,isAuthenticated:qm,isTokenExpired:Xm,login:Qm,logout:sf,onTokenChange:Bm,parseJWT:Gm,refreshToken:tf,refreshTokenIfNeeded:nf,setRememberMe:$m,setToken:Hm,shouldRefreshToken:Jm,startVisibilityBasedRefresh:rf},Symbol.toStringTag,{value:"Module"})),lf=new Map;let cf=!1;async function uf(t,e,n=!1){const s=function(t,e){return(null==e?void 0:e.method)&&"GET"!==e.method?"":t}(t,e);if(s){const t=lf.get(s);if(t)return t}const i=`${t}`;!n&&Jm()&&await tf();const o=Um();if(!o&&!t.includes("/auth/"))throw window.location.href="/login",new Error("Not authenticated");const r=o?{Authorization:`Bearer ${o}`}:{};if(null==e?void 0:e.headers){const t=e.headers;t instanceof Headers?t.forEach((t,e)=>{r[e]=t}):Array.isArray(t)?t.forEach(([t,e])=>{r[t]=e}):Object.assign(r,t)}(null==e?void 0:e.body)&&(r["Content-Type"]="application/json");const a=(async()=>{const s=await fetch(i,{...e,headers:r});if(401===s.status){if(!n&&!cf&&await tf())return uf(t,e,!0);throw cf||(cf=!0,Ym(),window.location.replace("/login")),new Error("Session expired. Please log in again.")}if(!s.ok)throw new Error(`API error: ${s.status} ${s.statusText} (${t})`);return s.json()})();return s&&(lf.set(s,a),a.finally(()=>{lf.delete(s)})),a}const df={spreadingFactor:7,bandwidthHz:125e3,codingRate:5,preambleLength:8,crcEnabled:!0,explicitHeader:!0};function hf(t){if(t.raw_packet){const e=t.raw_packet;if(/^[0-9a-fA-F]+$/.test(e)&&e.length%2==0)return e.length/2;if(/^[A-Za-z0-9+/=]+$/.test(e)){const t=(e.match(/=+$/)||[""])[0].length;return Math.floor(3*e.length/4)-t}return e.length}if(t.length&&t.length>0)return t.length;if(t.payload_length&&t.payload_length>0)return t.payload_length;if(t.payload){const e=t.payload;return/^[0-9a-fA-F]+$/.test(e)&&e.length%2==0?e.length/2:e.length}return 32}function pf(t,e={}){return void 0!==t.airtime_ms&&t.airtime_ms>0?t.airtime_ms:function(t,e={}){const n=e.spreadingFactor??df.spreadingFactor,s=e.bandwidthHz??df.bandwidthHz,i=e.codingRate??df.codingRate,o=e.preambleLength??df.preambleLength??8,r=e.crcEnabled??df.crcEnabled?1:0,a=e.explicitHeader??df.explicitHeader?0:1,l=n>=11&&s<=125e3?1:0,c=s/1e3,u=Math.pow(2,n)/c,d=(o+4.25)*u,h=Math.max(8*t-4*n+28+16*r-20*a,0),p=4*(n-2*l);return d+(8+Math.ceil(h/p)*i)*u}(hf(t),e)}function mf(t){return t&&"chat node"===t.toLowerCase()?"Companion":t}async function ff(){return function(t){if(t.neighbors)for(const e of Object.values(t.neighbors))e.contact_type=mf(e.contact_type);return t}(await uf("/api/stats"))}async function gf(){return uf("/api/logs")}async function yf(t=24){return uf(`/api/noise_floor_history?hours=${t}`)}const vf=new Map;function xf(t=!1){if(t)vf.clear();else for(const[e]of vf)parseInt(e.split("-")[0],10)<=60&&vf.delete(e)}function bf(t,e,n,s){const i=60*t/e,o=Math.floor(Date.now()/1e3),r=Math.floor(o/i)*i,a=r-60*t,l=n.filter(t=>t.timestamp>=a&&t.timestamp<=r),c=s?function(t){var e;const n=null==(e=null==t?void 0:t.config)?void 0:e.radio;return{spreadingFactor:(null==n?void 0:n.spreading_factor)??df.spreadingFactor,bandwidthHz:(null==n?void 0:n.bandwidth)??df.bandwidthHz,codingRate:(null==n?void 0:n.coding_rate)??df.codingRate,preambleLength:(null==n?void 0:n.preamble_length)??df.preambleLength,crcEnabled:!0,explicitHeader:!0}}(s):df,u=function(t,e,n,s,i){const o=new Array(e),r=new Array(e),a=new Array(e),l=new Array(e),c=new Array(e),u=new Array(e),d=new Array(e);for(let p=0;p=e)continue;const f=pf(h,i),g=h.packet_origin;if("tx_local"===g?(a[m].count++,a[m].airtime_ms+=f):"tx_forward"===g||h.transmitted?(l[m].count++,l[m].airtime_ms+=f):h.drop_reason&&(c[m].count++,c[m].airtime_ms+=f),"tx_local"!==g){o[m].count++,o[m].airtime_ms+=f,u[m].snr+=h.snr||0,u[m].rssi+=h.rssi||0,u[m].count++;const t=h.packet_hash;t&&!d[m].has(t)&&(d[m].add(t),r[m].count++,r[m].airtime_ms+=f)}}for(let p=0;p0&&(o[p].avg_snr=u[p].snr/u[p].count,o[p].avg_rssi=u[p].rssi/u[p].count);return{received:o,unique_received:r,transmitted:a,forwarded:l,dropped:c}}(l,e,a,i,c);return{time_range_minutes:t,bucket_count:e,bucket_duration_seconds:i,start_time:a,end_time:r,...u}}async function wf(){return uf("/api/hardware_stats")}async function kf(){return uf("/api/hardware_processes")}async function Sf(t){return uf("/api/update_radio_config",{method:"POST",body:JSON.stringify(t)})}async function Tf(){return uf("/api/send_advert",{method:"POST",body:"{}"})}async function Cf(t){return uf("/api/set_mode",{method:"POST",body:JSON.stringify({mode:t})})}async function Mf(t){return uf("/api/set_duty_cycle",{method:"POST",body:JSON.stringify({enabled:t})})}async function Pf(t){try{return await uf("/api/log_level",{method:"POST",body:JSON.stringify({level:t})})}catch(e){return{success:!1,error:e instanceof Error?e.message:"Unknown error"}}}const Ef="pymc-packet-cache",jf="pymc-packet-cache-meta",Lf=36e5,Af=2592e5,Df=6048e5,Nf=12096e5,Rf=5e3,Ff=5e5,If=new class{constructor(){e(this,"packets",new Map),e(this,"sortedPackets",[]),e(this,"sortedDirty",!0),e(this,"meta",{oldestTimestamp:0,newestTimestamp:0,lastUpdated:0,packetCount:0,backgroundLoadComplete:!1,topologyLoadComplete:!1,dataTier:"24h",threeDayLoadComplete:!1,sevenDayLoadComplete:!1,fourteenDayLoadComplete:!1}),e(this,"isLoading",!1),e(this,"isBackgroundLoading",!1),e(this,"isTopologyLoading",!1),e(this,"listeners",new Set),e(this,"loadProgress",null),e(this,"statusMessage",""),this.loadFromStorage()}subscribe(t){return this.listeners.add(t),t(this.getState()),()=>this.listeners.delete(t)}getState(){return{isLoading:this.isLoading,isBackgroundLoading:this.isBackgroundLoading,isTopologyLoading:this.isTopologyLoading,backgroundLoadComplete:this.meta.backgroundLoadComplete,topologyLoadComplete:this.meta.topologyLoadComplete,packetCount:this.packets.size,statusMessage:this.statusMessage,loadProgress:this.loadProgress,dataTier:this.meta.dataTier,threeDayLoadComplete:this.meta.threeDayLoadComplete,sevenDayLoadComplete:this.meta.sevenDayLoadComplete,fourteenDayLoadComplete:this.meta.fourteenDayLoadComplete}}getDataTier(){return this.meta.dataTier}getPackets(){return this.sortedDirty&&(this.sortedPackets=Array.from(this.packets.values()).sort((t,e)=>(t.timestamp??0)-(e.timestamp??0)),this.sortedDirty=!1),this.sortedPackets}isStale(){return 0===this.packets.size||Date.now()-this.meta.lastUpdated>Lf}isHeavyLoadInProgress(){return this.isBackgroundLoading||this.isTopologyLoading}async initialLoad(t){if(this.isStale()&&this.packets.size>0&&this.clear(),this.meta.backgroundLoadComplete&&this.packets.size>0)return this.getPackets();this.isLoading=!0;const e=Date.now(),n=Math.floor((e-864e5)/1e3),s=3e4;this.loadProgress={loaded:0,target:s,percent:0},this.statusMessage="Loading 24h history...",this.notifyListeners();try{let e;this.packets.size>0&&(this.packets.clear(),this.sortedPackets=[],this.sortedDirty=!0,this.meta.oldestTimestamp=0,this.meta.newestTimestamp=0);let i=0,o=0,r=0;const a=Math.ceil(100);for(let l=0;l0))break;{const s=this.packets.size;this.mergePackets(u.data);const r=this.packets.size-s;i+=r;const a=Math.min(...u.data.map(t=>t.timestamp??1/0));if(a!==1/0&&(void 0===e||a=2)break}else o=0;if(u.data.length=Ff)break}l=5){this.statusMessage="Connection issues, loaded partial data",this.notifyListeners();break}await this.delay(2e3)}}this.enforceMemoryCap(),this.meta.backgroundLoadComplete=!0,this.meta.dataTier="24h",this.loadProgress={loaded:this.packets.size,target:this.packets.size,percent:100},this.notifyListeners(),this.saveToStorage()}catch(i){this.statusMessage="Load failed"}finally{this.isLoading=!1,this.statusMessage="",this.loadProgress=null,this.notifyListeners()}return this.getPackets()}async quickLoad(){return this.initialLoad()}async backgroundLoad(){await this.initialLoad()}async loadThreeDays(t){this.meta.threeDayLoadComplete||this.isBackgroundLoading||await this.loadExtendedData("3d",Af,t)}async loadSevenDays(t){this.meta.sevenDayLoadComplete||this.isBackgroundLoading||(this.meta.threeDayLoadComplete||await this.loadThreeDays(t),await this.loadExtendedData("7d",Df,t))}async loadFourteenDays(t){this.meta.fourteenDayLoadComplete||this.isBackgroundLoading||(this.meta.sevenDayLoadComplete||await this.loadSevenDays(t),await this.loadExtendedData("14d",Nf,t))}async loadExtendedData(t,e,n){this.isBackgroundLoading=!0;const s=Date.now(),i=Math.floor((s-e)/1e3),o=3e4*("3d"===t?2:"7d"===t?4:7);this.loadProgress={loaded:0,target:o,percent:0},this.statusMessage=`Loading ${t} history...`,this.notifyListeners();try{let e=this.meta.oldestTimestamp||void 0,s=0,r=0,a=0;const l=Math.ceil(100);for(let u=0;u0))break;{const t=this.packets.size;this.mergePackets(d.data);const o=this.packets.size-t;s+=o;const a=Math.min(...d.data.map(t=>t.timestamp??1/0));if(a!==1/0&&(void 0===e||a=2)break}else r=0;if(d.data.length=Ff)break}u=5)break;await this.delay(2e3)}}this.enforceMemoryCap();const c=Date.now()-1e3*this.meta.oldestTimestamp;"3d"===t?(this.meta.threeDayLoadComplete=c>=Af,this.meta.threeDayLoadComplete&&(this.meta.dataTier="3d")):"7d"===t?(this.meta.sevenDayLoadComplete=c>=Df,this.meta.sevenDayLoadComplete&&(this.meta.dataTier="7d")):(this.meta.fourteenDayLoadComplete=c>=Nf,this.meta.fourteenDayLoadComplete&&(this.meta.dataTier="14d")),this.loadProgress={loaded:s,target:s,percent:100},this.notifyListeners(),this.saveToStorage()}catch(r){this.statusMessage=`${t} load failed`}finally{this.isBackgroundLoading=!1,this.statusMessage="",this.loadProgress=null,this.notifyListeners()}}isDataTierAvailable(t){switch(t){case"24h":return this.meta.backgroundLoadComplete;case"3d":return this.meta.threeDayLoadComplete;case"7d":return this.meta.sevenDayLoadComplete;case"14d":return this.meta.fourteenDayLoadComplete;default:return!1}}async topologyLoad(){if(!this.meta.topologyLoadComplete&&!this.isTopologyLoading)return this.doTopologyLoad()}async forceTopologyLoad(){if(!this.isTopologyLoading)return this.meta.topologyLoadComplete=!1,this.doTopologyLoad()}async forceDeepLoad(){return this.forceTopologyLoad()}async doTopologyLoad(){this.isTopologyLoading=!0;const t=Date.now(),e=Math.floor((t-Nf)/1e3),n=42e4;this.statusMessage="Loading topology data...",this.loadProgress={loaded:this.packets.size,target:n,percent:0},this.notifyListeners();try{let t=this.meta.oldestTimestamp||void 0,s=0,i=0;const o=Math.ceil(100);for(let r=0;r0))break;{const n=this.packets.size;this.mergePackets(l.data);const i=this.packets.size-n,o=Math.min(...l.data.map(t=>t.timestamp??1/0));if(o!==1/0&&(void 0===t||o=2)break}else s=0;if(this.packets.size>=Ff)break}r=5)break;await this.delay(2e3)}}this.enforceMemoryCap(),this.statusMessage=`Processing ${this.packets.size.toLocaleString()} packets...`,this.loadProgress={loaded:this.packets.size,target:this.packets.size,percent:100},this.notifyListeners(),this.meta.topologyLoadComplete=!0,this.meta.threeDayLoadComplete=!0,this.meta.sevenDayLoadComplete=!0,this.meta.fourteenDayLoadComplete=!0,this.meta.dataTier="14d",this.saveToStorage()}catch(s){this.statusMessage="Load failed"}finally{this.isTopologyLoading=!1,this.statusMessage="",this.loadProgress=null,this.notifyListeners()}}async poll(){try{const t=await this.fetchRecentPackets(100);if(t.success&&t.data){const e=this.packets.size;this.mergePackets(t.data),this.packets.size>e&&(this.saveToStorage(),this.notifyListeners())}}catch(t){}return this.getPackets()}clear(){this.packets.clear(),this.sortedPackets=[],this.sortedDirty=!0,this.meta={oldestTimestamp:0,newestTimestamp:0,lastUpdated:0,packetCount:0,backgroundLoadComplete:!1,topologyLoadComplete:!1,dataTier:"24h",threeDayLoadComplete:!1,sevenDayLoadComplete:!1,fourteenDayLoadComplete:!1},this.clearStorage(),this.notifyListeners()}mergePacketsDirectly(t){const e=this.packets.size;this.mergePackets(t);const n=this.packets.size-e;return n>0&&(this.enforceMemoryCap(),this.saveToStorage(),this.notifyListeners()),n}mergePackets(t){let e=!1;for(const n of t){const t=n.packet_hash;if(!t)continue;const s=n.timestamp??0,i=`${t}:${s}`;this.packets.has(i)||(this.packets.set(i,n),e=!0),(0===this.meta.oldestTimestamp||sthis.meta.newestTimestamp&&(this.meta.newestTimestamp=s)}e&&(this.sortedDirty=!0),this.meta.lastUpdated=Date.now(),this.meta.packetCount=this.packets.size}notifyListeners(){const t=this.getState();for(const e of this.listeners)e(t)}delay(t){return new Promise(e=>setTimeout(e,t))}async fetchChunkWithRetry(t,e,n,s,i){for(let r=0;r<3;r++)try{return await this.fetchFilteredPackets(t,e,!1,i)}catch(o){const t=2===r,e=1e3*Math.pow(2,r);o instanceof Error&&o.name,t||(this.statusMessage=`Retry in ${Math.round(e/1e3)}s...`,this.notifyListeners(),await this.delay(e))}return null}enforceMemoryCap(){if(this.packets.size<=Ff)return;const t=this.getPackets(),e=t.length-Ff;for(let n=0;ne&&(this.meta.oldestTimestamp=t[e].timestamp??0)}loadFromStorage(){if("undefined"!=typeof window)try{const t=localStorage.getItem(jf);t&&(this.meta=JSON.parse(t));const e=localStorage.getItem(Ef);if(e){const t=JSON.parse(e);for(const e of t)e.packet_hash&&this.packets.set(e.packet_hash,e)}if(this.meta.lastUpdated>0&&Date.now()-this.meta.lastUpdated>Lf)return void this.clear();this.meta.backgroundLoadComplete=!1,this.meta.threeDayLoadComplete=!1,this.meta.sevenDayLoadComplete=!1,this.meta.fourteenDayLoadComplete=!1,this.meta.dataTier="24h";const n=37500;this.meta.topologyLoadComplete&&this.packets.size3e3?t.slice(-3e3):t;localStorage.setItem(Ef,JSON.stringify(e))}catch(t){if(t instanceof DOMException&&"QuotaExceededError"===t.name)try{localStorage.removeItem(Ef),localStorage.setItem(jf,JSON.stringify(this.meta))}catch{}}}clearStorage(){if("undefined"!=typeof window)try{localStorage.removeItem(Ef),localStorage.removeItem(jf)}catch(t){}}async fetchRecentPackets(t=1e3,e=!1){const n=`/api/recent_packets?limit=${t}`,{getToken:s}=await f(async()=>{const{getToken:t}=await Promise.resolve().then(()=>af);return{getToken:t}},void 0),i=s(),o={};i&&(o.Authorization=`Bearer ${i}`);const r=await fetch(n,{headers:o});if(401===r.status&&!e){const{refreshToken:e}=await f(async()=>{const{refreshToken:t}=await Promise.resolve().then(()=>af);return{refreshToken:t}},void 0);if(await e())return this.fetchRecentPackets(t,!0)}if(!r.ok)throw new Error(`API error: ${r.status}`);return r.json()}async fetchFilteredPackets(t,e=5e3,n=!1,s){const i=new URLSearchParams;i.set("limit",String(e)),void 0!==t&&i.set("end_timestamp",String(t-.001)),void 0!==s&&i.set("start_timestamp",String(s));const o=`/api/filtered_packets?${i}`,{getToken:r}=await f(async()=>{const{getToken:t}=await Promise.resolve().then(()=>af);return{getToken:t}},void 0),a=r(),l={};a&&(l.Authorization=`Bearer ${a}`);const c=new AbortController,u=setTimeout(()=>c.abort(),3e4);try{const s=await fetch(o,{headers:l,signal:c.signal});if(401===s.status&&!n){const{refreshToken:n}=await f(async()=>{const{refreshToken:t}=await Promise.resolve().then(()=>af);return{refreshToken:t}},void 0);if(await n())return this.fetchFilteredPackets(t,e,!0)}if(!s.ok)throw new Error(`API error: ${s.status}`);return s.json()}finally{clearTimeout(u)}}};function _f(t){return{paths:t.paths,byEndpoints:new Map(t.byEndpointsEntries),canonicalPaths:new Map(t.canonicalPathsEntries),totalObservations:t.totalObservations,uniquePathCount:t.uniquePathCount}}function Bf(){return{paths:[],byEndpoints:new Map,canonicalPaths:new Map,totalObservations:0,uniquePathCount:0}}const Vf=new class{constructor(){e(this,"worker",null),e(this,"listeners",new Set),e(this,"currentTopology",{edges:[],validatedEdges:[],weakEdges:[],certainEdges:[],uncertainEdges:[],edgeMap:new Map,maxPacketCount:0,maxCertainCount:0,neighborAffinity:new Map,fullAffinity:new Map,localPrefix:null,centrality:new Map,hubNodes:[],gatewayNodes:[],loops:[],loopEdgeKeys:new Set,txDelayRecommendations:new Map,pathRegistry:Bf(),edgeBetweenness:new Map,backboneEdges:[],nodeMobility:new Map,mobileNodes:[],pathHealth:[],lastHopNeighbors:[],disambiguationStats:{totalPrefixes:0,unambiguousPrefixes:0,collisionPrefixes:0,collisionRate:0,avgConfidence:0,lowConfidencePrefixes:[],highCollisionPrefixes:[],totalResolutions:0},discoveredNodes:[],viterbiStats:{totalPaths:0,pathsWithGhosts:0,avgPathCost:0,avgPathConfidence:0,observationOverrideCount:0,tracePacketsProcessed:0,pathPacketsProcessed:0,distantEdgesDiscovered:0,duplicateGroupsFound:0,duplicatePathsUnique:0,echolocationEdgesInferred:0},nodeMetrics:new Map,communityCount:0,backboneNodes:[]}),e(this,"isComputing",!1),e(this,"pendingRequest",null),e(this,"debounceTimer",null),e(this,"debounceMs",100),this.initWorker()}initWorker(){if("undefined"!=typeof window)try{this.worker=new Worker(new URL("/assets/topology.worker-B6JO1dmH.js",import.meta.url),{type:"module"}),this.worker.onmessage=t=>{this.handleWorkerMessage(t.data)},this.worker.onerror=t=>{}}catch(t){}}handleWorkerMessage(t){if(this.isComputing=!1,"error"!==t.type){var e;this.currentTopology={edges:(e=t.payload).edges??[],validatedEdges:e.validatedEdges??[],weakEdges:e.weakEdges??[],certainEdges:e.certainEdges??[],uncertainEdges:e.uncertainEdges??[],maxPacketCount:e.maxPacketCount??0,maxCertainCount:e.maxCertainCount??0,localPrefix:e.localPrefix??null,hubNodes:e.hubNodes??[],gatewayNodes:e.gatewayNodes??[],edgeMap:new Map(e.edgeMapEntries??[]),neighborAffinity:new Map(e.neighborAffinityEntries??[]),fullAffinity:new Map(e.fullAffinityEntries??[]),centrality:new Map(e.centralityEntries??[]),loops:e.loops??[],loopEdgeKeys:new Set(e.loopEdgeKeyEntries??[]),txDelayRecommendations:new Map(e.txDelayRecommendationEntries??[]),pathRegistry:e.pathRegistry?_f(e.pathRegistry):Bf(),edgeBetweenness:new Map(e.edgeBetweennessEntries??[]),backboneEdges:e.backboneEdges??[],nodeMobility:new Map(e.nodeMobilityEntries??[]),mobileNodes:e.mobileNodes??[],pathHealth:e.pathHealth??[],lastHopNeighbors:e.lastHopNeighbors??[],disambiguationStats:e.disambiguationStats??{totalPrefixes:0,unambiguousPrefixes:0,collisionPrefixes:0,collisionRate:0,avgConfidence:0,lowConfidencePrefixes:[],highCollisionPrefixes:[],totalResolutions:0},discoveredNodes:e.discoveredNodes??[],viterbiStats:e.viterbiStats??{totalPaths:0,pathsWithGhosts:0,avgPathCost:0,avgPathConfidence:0,observationOverrideCount:0,tracePacketsProcessed:0,pathPacketsProcessed:0,distantEdgesDiscovered:0,duplicateGroupsFound:0,duplicatePathsUnique:0,echolocationEdgesInferred:0},nodeMetrics:new Map(e.nodeMetricsEntries??[]),communityCount:e.communityCount??0,backboneNodes:e.backboneNodes??[]};for(const e of this.listeners)try{e(this.currentTopology,t.computeTimeMs)}catch(n){}if(this.pendingRequest){const t=this.pendingRequest;this.pendingRequest=null,this.computeInternal(t)}}}computeInternal(t){if(!this.worker)return;this.isComputing=!0;const e={type:"compute",payload:t};this.worker.postMessage(e)}compute(t,e,n,s,i,o,r,a){const l={packets:t,neighbors:e,localHash:n,localLat:s,localLon:i,airtimeMs:o,zeroHopNeighbors:r,terrainGrid:a,enableTerrainAware:void 0!==a};this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(()=>{this.debounceTimer=null,this.isComputing?this.pendingRequest=l:this.computeInternal(l)},this.debounceMs)}subscribe(t){return this.listeners.add(t),this.currentTopology.edges.length>0&&t(this.currentTopology,0),()=>{this.listeners.delete(t)}}getTopology(){return this.currentTopology}isWorking(){return this.isComputing}terminate(){this.debounceTimer&&clearTimeout(this.debounceTimer),this.worker&&(this.worker.terminate(),this.worker=null),this.listeners.clear()}},Of=new class{constructor(){e(this,"worker",null),e(this,"listeners",new Set),e(this,"sparklines",new Map),e(this,"isComputing",!1),e(this,"lastComputeTimeMs",0),e(this,"pendingRequest",null),e(this,"debounceTimer",null),e(this,"debounceMs",150),this.initWorker()}initWorker(){if("undefined"!=typeof window)try{this.worker=new Worker(new URL("/assets/sparkline.worker-CmKhBAy5.js",import.meta.url),{type:"module"}),this.worker.onmessage=t=>{this.handleWorkerMessage(t.data)},this.worker.onerror=t=>{this.isComputing=!1,this.notifyListeners()}}catch(t){}}handleWorkerMessage(t){if(this.isComputing=!1,"error"!==t.type){if(this.sparklines=new Map(t.payload.sparklineEntries),this.lastComputeTimeMs=t.computeTimeMs,this.notifyListeners(),this.pendingRequest){const t=this.pendingRequest;this.pendingRequest=null,this.computeInternal(t.packets,t.nodeHashes)}}else this.notifyListeners()}computeInternal(t,e){if(!this.worker)return;if(0===e.length)return this.isComputing=!1,void this.notifyListeners();this.isComputing=!0,this.notifyListeners();const n={type:"compute",payload:{packets:t,nodeHashes:e}};this.worker.postMessage(n)}notifyListeners(){for(const e of this.listeners)try{e(this.sparklines,this.isComputing)}catch(t){}}compute(t,e){this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(()=>{this.debounceTimer=null,this.isComputing?this.pendingRequest={packets:t,nodeHashes:e}:this.computeInternal(t,e)},this.debounceMs)}getSparkline(t){return this.sparklines.get(t)??[]}getAllSparklines(){return this.sparklines}hasSparkline(t){return this.sparklines.has(t)}isWorking(){return this.isComputing}getLastComputeTime(){return this.lastComputeTimeMs}subscribe(t){return this.listeners.add(t),t(this.sparklines,this.isComputing),()=>{this.listeners.delete(t)}}clear(){this.sparklines.clear(),this.notifyListeners()}terminate(){this.debounceTimer&&clearTimeout(this.debounceTimer),this.worker&&(this.worker.terminate(),this.worker=null),this.listeners.clear()}},zf=new class{constructor(){e(this,"worker",null),e(this,"isInitialized",!1),e(this,"statsListeners",new Set),e(this,"packetsListeners",new Set),e(this,"errorListeners",new Set),e(this,"readyResolve",null),e(this,"readyPromise",null),e(this,"unsubscribeTokenChange",null)}async init(t){if(!this.isInitialized&&"undefined"!=typeof window){this.readyPromise=new Promise(t=>{this.readyResolve=t});try{this.worker=new Worker(new URL("/assets/polling.worker-DFp1Qyu0.js",import.meta.url),{type:"module"}),this.worker.onmessage=this.handleMessage.bind(this),this.worker.onerror=t=>{};const e={type:"init",config:{apiBaseUrl:t.apiBaseUrl,authToken:t.authToken,statsIntervalMs:t.statsIntervalMs??3e3,packetsIntervalMs:t.packetsIntervalMs??3e3}};this.worker.postMessage(e),this.isInitialized=!0,this.unsubscribeTokenChange=Bm(t=>{this.setAuthToken(t)}),await this.readyPromise}catch(e){throw e}}}handleMessage(t){var e;const n=t.data;switch(n.type){case"ready":null==(e=this.readyResolve)||e.call(this);break;case"stats":for(const t of this.statsListeners)try{t(n.data,n.timestamp)}catch(s){}break;case"packets":for(const t of this.packetsListeners)try{t(n.newPackets,n.totalCount,n.newestTimestamp)}catch(s){}break;case"packetsReset":for(const t of this.packetsListeners)try{t([],0,n.newestTimestamp)}catch(s){}break;case"error":for(const t of this.errorListeners)try{t(n.source,n.error)}catch(s){}}}onStats(t){return this.statsListeners.add(t),()=>this.statsListeners.delete(t)}onPackets(t){return this.packetsListeners.add(t),()=>this.packetsListeners.delete(t)}onError(t){return this.errorListeners.add(t),()=>this.errorListeners.delete(t)}setAuthToken(t){if(!this.worker)return;const e={type:"setAuth",token:t};this.worker.postMessage(e)}setLiveMode(t){if(!this.worker)return;const e={type:"setLiveMode",enabled:t};this.worker.postMessage(e)}forceRefresh(){this.worker&&this.worker.postMessage({type:"forceRefresh"})}clearCache(){this.worker&&this.worker.postMessage({type:"clearCache"})}setTimeWindow(t){if(!this.worker)return;const e={type:"setTimeWindow",hours:t};this.worker.postMessage(e)}terminate(){if(this.unsubscribeTokenChange&&(this.unsubscribeTokenChange(),this.unsubscribeTokenChange=null),this.worker){const t={type:"stop"};this.worker.postMessage(t),this.worker.terminate(),this.worker=null}this.isInitialized=!1,this.statsListeners.clear(),this.packetsListeners.clear(),this.errorListeners.clear()}isReady(){return this.isInitialized}},$f=new class{constructor(){e(this,"ws",null),e(this,"connectionState","disconnected"),e(this,"reconnectAttempts",0),e(this,"pingIntervalId",null),e(this,"lastPongTime",Date.now()),e(this,"reconnectTimeoutId",null),e(this,"packetListeners",new Set),e(this,"statsListeners",new Set),e(this,"systemStatsListeners",new Set),e(this,"packetStatsListeners",new Set),e(this,"connectionListeners",new Set),e(this,"unsubscribeTokenChange",null),e(this,"wsSupported",!0)}buildWsUrl(){const t=Um(),e=Om(),n=new URLSearchParams;t&&n.set("token",t),e&&n.set("client_id",e);const s=n.toString()?`?${n.toString()}`:"";return`${"https:"===window.location.protocol?"wss:":"ws:"}//${window.location.host}/ws/packets${s}`}connect(){var t,e;if((null==(t=this.ws)?void 0:t.readyState)!==WebSocket.OPEN&&(null==(e=this.ws)?void 0:e.readyState)!==WebSocket.CONNECTING&&this.wsSupported){this.setConnectionState("connecting");try{const t=this.buildWsUrl();this.ws=new WebSocket(t),this.ws.onopen=this.handleOpen.bind(this),this.ws.onmessage=this.handleMessage.bind(this),this.ws.onerror=this.handleError.bind(this),this.ws.onclose=this.handleClose.bind(this),this.unsubscribeTokenChange||(this.unsubscribeTokenChange=Bm(t=>{t&&"connected"===this.connectionState&&(this.disconnect(),this.connect())}))}catch(n){this.wsSupported=!1,this.setConnectionState("disconnected")}}}disconnect(){this.clearPingInterval(),this.clearReconnectTimeout(),this.ws&&(this.ws.onopen=null,this.ws.onmessage=null,this.ws.onerror=null,this.ws.onclose=null,this.ws.readyState!==WebSocket.OPEN&&this.ws.readyState!==WebSocket.CONNECTING||this.ws.close(1e3,"Client disconnect"),this.ws=null),this.setConnectionState("disconnected"),this.reconnectAttempts=0}isConnected(){var t;return(null==(t=this.ws)?void 0:t.readyState)===WebSocket.OPEN}getConnectionState(){return this.connectionState}isSupported(){return this.wsSupported}send(t){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)return!1;try{return this.ws.send(JSON.stringify(t)),!0}catch(e){return!1}}onPacket(t){return this.packetListeners.add(t),()=>this.packetListeners.delete(t)}onStats(t){return this.statsListeners.add(t),()=>this.statsListeners.delete(t)}onSystemStats(t){return this.systemStatsListeners.add(t),()=>this.systemStatsListeners.delete(t)}onPacketStats(t){return this.packetStatsListeners.add(t),()=>this.packetStatsListeners.delete(t)}onConnectionChange(t){return this.connectionListeners.add(t),t(this.connectionState,this.reconnectAttempts),()=>this.connectionListeners.delete(t)}handleOpen(){this.setConnectionState("connected"),this.reconnectAttempts=0,this.lastPongTime=Date.now();const t=Um();t&&this.ws&&this.ws.send(JSON.stringify({type:"auth",token:t})),this.startPingInterval()}handleMessage(t){try{const e=JSON.parse(t.data);switch(e.type){case"packet":this.notifyPacketListeners(e.data);break;case"stats":{const t=e.data;t&&"noise_floor_dbm"in t&&this.notifyStatsListeners(t),(null==t?void 0:t.packet_stats)&&this.notifyPacketStatsListeners(t.packet_stats),(null==t?void 0:t.system_stats)&&this.notifySystemStatsListeners(t.system_stats);break}case"packet_stats":{const t=e.data;this.notifyPacketStatsListeners(t);break}case"system_stats":this.notifySystemStatsListeners(e.data);break;case"ping":this.lastPongTime=Date.now(),this.send({type:"pong"});break;case"pong":this.lastPongTime=Date.now()}}catch(e){}}handleError(t){}handleClose(t){this.clearPingInterval(),1e3!==t.code?(1006===t.code&&this.reconnectAttempts,this.scheduleReconnect()):this.setConnectionState("disconnected")}setConnectionState(t){if(this.connectionState!==t){this.connectionState=t;for(const n of this.connectionListeners)try{n(t,this.reconnectAttempts)}catch(e){}}}notifyPacketListeners(t){for(const n of this.packetListeners)try{n(t)}catch(e){}}notifyStatsListeners(t){for(const n of this.statsListeners)try{n(t)}catch(e){}}notifySystemStatsListeners(t){for(const n of this.systemStatsListeners)try{n(t)}catch(e){}}notifyPacketStatsListeners(t){for(const n of this.packetStatsListeners)try{n(t)}catch(e){}}startPingInterval(){this.clearPingInterval(),this.pingIntervalId=setInterval(()=>{var t;(null==(t=this.ws)?void 0:t.readyState)===WebSocket.OPEN&&(this.send({type:"ping"}),Date.now()-this.lastPongTime>6e4&&(this.disconnect(),this.connect()))},3e4)}clearPingInterval(){this.pingIntervalId&&(clearInterval(this.pingIntervalId),this.pingIntervalId=null)}scheduleReconnect(){if(this.reconnectAttempts>=20)return this.wsSupported=!1,void this.setConnectionState("disconnected");this.setConnectionState("reconnecting");const t=Math.min(1e3*Math.pow(2,Math.min(this.reconnectAttempts,5)),3e4);this.reconnectAttempts++,this.reconnectTimeoutId=setTimeout(()=>{this.reconnectTimeoutId=null,this.connect()},t)}clearReconnectTimeout(){this.reconnectTimeoutId&&(clearTimeout(this.reconnectTimeoutId),this.reconnectTimeoutId=null)}terminate(){this.disconnect(),this.unsubscribeTokenChange&&(this.unsubscribeTokenChange(),this.unsubscribeTokenChange=null),this.packetListeners.clear(),this.statsListeners.clear(),this.systemStatsListeners.clear(),this.packetStatsListeners.clear(),this.connectionListeners.clear()}},Wf=3e4,Uf=new class{constructor(){e(this,"staged",new Map),e(this,"recentlyConfirmed",new Map),e(this,"listeners",new Set),e(this,"pruneIntervalId",null),this.startPruneInterval()}stage(t){const e=t.packet_hash;if(!e)return;if(this.staged.has(e))return;const n=this.recentlyConfirmed.get(e);n&&Date.now()-n=100&&this.removeOldest(),this.staged.set(e,{packet:t,stagedAt:Date.now()}),this.notifyListeners())}confirm(t){this.staged.delete(t)&&this.notifyListeners()}confirmBatch(t){let e=!1;const n=Date.now();for(const s of t)this.recentlyConfirmed.set(s,n),this.staged.delete(s)&&(e=!0);if(this.recentlyConfirmed.size>200){const t=n-Wf;for(const[e,n]of this.recentlyConfirmed)n(e.packet.timestamp??0)-(t.packet.timestamp??0))}isPending(t){return!!t&&this.staged.has(t)}getPendingCount(){return this.staged.size}subscribe(t){return this.listeners.add(t),()=>this.listeners.delete(t)}clear(){this.staged.size>0&&(this.staged.clear(),this.notifyListeners())}terminate(){this.stopPruneInterval(),this.staged.clear(),this.listeners.clear()}notifyListeners(){const t=this.getPendingPackets();for(const n of this.listeners)try{n(t)}catch(e){}}pruneExpired(){const t=Date.now();let e=!1;for(const[n,s]of this.staged)t-s.stagedAt>Wf&&(this.staged.delete(n),e=!0);e&&this.notifyListeners()}removeOldest(){let t=null,e=1/0;for(const[n,s]of this.staged)s.stagedAtthis.pruneExpired(),1e4))}stopPruneInterval(){this.pruneIntervalId&&(clearInterval(this.pruneIntervalId),this.pruneIntervalId=null)}},Hf=v(t=>({connectionState:"disconnected",isSupported:!0,reconnectAttempt:0,lastConnected:null,initialize:()=>{$f.onConnectionChange((e,n)=>{t(t=>({connectionState:e,reconnectAttempt:n??0,isSupported:$f.isSupported(),lastConnected:"connected"===e?Date.now():t.lastConnected}))}),$f.connect()}})),Yf=.05,qf=1e3,Gf="terrarium";function Xf(t,e,n){try{return t.queryTerrainElevation({lng:e,lat:n})??0}catch{return 0}}const Kf=v((t,e)=>({terrainGrid:null,isLoading:!1,error:null,lastLoadedAt:null,cachedBounds:null,terrainDisambiguationEnabled:!0,loadTerrain:async(n,s)=>{const i=e();if(!(i.isLoading||(o=i.cachedBounds,r=n,o&&o.minLat<=r.minLat&&o.maxLat>=r.maxLat&&o.minLng<=r.minLng&&o.maxLng>=r.maxLng))){var o,r;t({isLoading:!0,error:null});try{s.getTerrain()||(s.getSource(Gf)||(s.addSource(Gf,{type:"raster-dem",tiles:["https://s3.amazonaws.com/elevation-tiles-prod/terrarium/{z}/{x}/{y}.png"],encoding:"terrarium",tileSize:256}),await new Promise((t,e)=>{const n=setTimeout(()=>e(new Error("Terrain source load timeout")),1e4),i=e=>{e.sourceId===Gf&&e.isSourceLoaded&&(clearTimeout(n),s.off("sourcedata",i),t())};s.on("sourcedata",i)})),s.setTerrain({source:Gf}),await new Promise(t=>setTimeout(t,500)));const e=await async function(t,e){const{minLat:n,maxLat:s,minLng:i,maxLng:o}=e;let r=Math.ceil((o-i)/.001),a=Math.ceil((s-n)/.001);r>qf&&(r=qf),a>qf&&(a=qf);const l=(o-i)/r,c=(s-n)/a,u=Math.max(l,c),d=new Float32Array(r*a);let h=0;for(let p=0;psetTimeout(t,0))}}return{origin:[n,i],cellSize:u,width:r,height:a,elevations:d}}(s,n);t({terrainGrid:e,isLoading:!1,lastLoadedAt:Date.now(),cachedBounds:n})}catch(a){const e=a instanceof Error?a.message:"Unknown error loading terrain";t({isLoading:!1,error:e})}}},preloadFromNodes:async(t,n)=>{const s=function(t){const e=t.filter(t=>void 0!==t.latitude&&void 0!==t.longitude&&(0!==t.latitude||0!==t.longitude));if(0===e.length)return null;let n=1/0,s=-1/0,i=1/0,o=-1/0;for(const r of e)n=Math.min(n,r.latitude),s=Math.max(s,r.latitude),i=Math.min(i,r.longitude),o=Math.max(o,r.longitude);return{minLat:n-Yf,maxLat:s+Yf,minLng:i-Yf,maxLng:o+Yf}}(t);s&&await e().loadTerrain(s,n)},clearTerrain:()=>{t({terrainGrid:null,cachedBounds:null,lastLoadedAt:null,error:null})},setTerrainDisambiguationEnabled:e=>{t({terrainDisambiguationEnabled:e})},getTerrainGridForDisambiguation:()=>{const t=e();return t.terrainDisambiguationEnabled?t.terrainGrid:null}})),Jf="pymc-stealth-location";function Zf(t){if("undefined"!=typeof window)try{localStorage.setItem(Jf,JSON.stringify(t))}catch{}}function Qf(t){return!isNaN(t)&&t>=-90&&t<=90}function tg(t){return!isNaN(t)&&t>=-180&&t<=180}const eg=function(){if("undefined"==typeof window)return{};try{const t=localStorage.getItem(Jf);if(!t)return{};const e=JSON.parse(t);if("number"==typeof e.latitude&&"number"==typeof e.longitude&&"boolean"==typeof e.enabled&&Qf(e.latitude)&&tg(e.longitude))return e}catch{}return{}}(),ng=v((t,e)=>({latitude:eg.latitude??null,longitude:eg.longitude??null,enabled:eg.enabled??!1,setLocation:(n,s)=>{Qf(n)&&tg(s)&&(t({latitude:n,longitude:s}),Zf({latitude:n,longitude:s,enabled:e().enabled}))},enable:()=>{const{latitude:n,longitude:s}=e();null!==n&&null!==s&&(t({enabled:!0}),Zf({latitude:n,longitude:s,enabled:!0}))},disable:()=>{t({enabled:!1});const{latitude:n,longitude:s}=e();null!==n&&null!==s&&Zf({latitude:n,longitude:s,enabled:!1})},clear:()=>{t({latitude:null,longitude:null,enabled:!1}),function(){if("undefined"!=typeof window)try{localStorage.removeItem(Jf)}catch{}}()},getEffectiveLocation:()=>{const{latitude:t,longitude:n,enabled:s}=e();return s&&null!==t&&null!==n?{latitude:t,longitude:n}:null},isActive:()=>{const{latitude:t,longitude:n,enabled:s}=e();return s&&null!==t&&null!==n}}));function sg(t){return t.startsWith("0x")||t.startsWith("0X")?t.slice(2,4).toUpperCase():t.slice(0,2).toUpperCase()}function ig(t,e){let n=t.forwarded_path??t.original_path;if("string"==typeof n)try{n=JSON.parse(n)}catch{return null}if(!n||!Array.isArray(n)||0===n.length)return null;const s=n.map(t=>String(t).toUpperCase()),i=e?sg(e):null,o=s[s.length-1],r=null!==i&&o===i,a=r?s.slice(0,-1):[...s];return{effective:a,original:s,hadLocal:r,effectiveLength:a.length}}function og(t,e){const n=t.toUpperCase();return e.startsWith("0x")||e.startsWith("0X")?e.slice(2).toUpperCase().startsWith(n):e.toUpperCase().startsWith(n)}const rg=[{label:"20m",minutes:20,buckets:80},{label:"1h",minutes:60,buckets:80},{label:"3h",minutes:180,buckets:80},{label:"12h",minutes:720,buckets:80},{label:"24h",minutes:1440,buckets:80},{label:"3d",minutes:4320,buckets:80},{label:"7d",minutes:10080,buckets:80},{label:"14d",minutes:20160,buckets:80}],ag=[{label:"1h",hours:1},{label:"3h",hours:3},{label:"12h",hours:12},{label:"24h",hours:24},{label:"3d",hours:72},{label:"7d",hours:168},{label:"14d",hours:336}];function lg(t,e=12){return Math.max(e,Math.round(t/15))}const cg={hero:lg(1200),statsCard:lg(380)};function ug(t){switch(t){case 1:return 3600;case 3:case 12:return 5400;case 24:return 8640;case 72:case 168:case 336:return 720;default:{const e=3600*t,n=Math.round(e/10);return Math.min(Math.max(360,n),720)}}}const dg="'JetBrains Mono', 'SF Mono', Monaco, monospace",hg={stats:3e3,packets:3e3,charts:3e4,logs:2e3,system:3e3},pg={DEBUG:"text-sys-brown",INFO:"text-sys-cyan",WARNING:"text-sys-amber",ERROR:"text-sys-red",CRITICAL:"text-sys-pink"};function mg(t){return pg[t]??"text-text-muted border-border-subtle"}const fg="pymc-resource-history",gg="pymc-resource-last-fetch",yg="pymc-hidden-contacts",vg="pymc-quick-neighbors",xg="pymc-local-hash",bg="pymc-global-time-range";let wg=null,kg=null;function Sg(t,e){const n=e-1e3*t;return n<=6048e5?"active":n<=12096e5?"stale":"expired"}function Tg(t){return 4===(t.type??t.payload_type)&&!0!==t.transmitted&&function(t){const e=function(t){if(Array.isArray(t))return t;if("string"==typeof t&&t.startsWith("["))try{const e=JSON.parse(t);return Array.isArray(e)?e:[]}catch{return[]}return[]}(t.original_path),n=t.route??t.route_type;return 2===(s=n)||3===s?0===e.length:no(n)?e.length<=1:0===e.length;var s}(t)}function Cg(t,e,n,s){if(!t)return null;let i=t;if(t.length<=4){const s=t.replace(/^0x/i,"").toUpperCase();if(s===e)return null;const o=n.get(s);if(!o)return null;i=o}return s.has(i)?sg(i)===e?null:i:null}function Mg(t,e){t.count++,void 0!==e.rssi&&null!==e.rssi&&(t.rssiSum+=e.rssi,t.rssiCount++),void 0!==e.snr&&null!==e.snr&&(t.snrSum+=e.snr,t.snrCount++);const n=e.timestamp??0;n>t.lastSeen&&(t.lastSeen=n)}function Pg(t){return{hash:t,count:0,rssiSum:0,rssiCount:0,snrSum:0,snrCount:0,lastSeen:0}}function Eg(t,e){const n=Sg(t.lastSeen,e);return"expired"===n?null:{hash:t.hash,prefix:sg(t.hash),count:t.count,avgRssi:t.rssiCount>0?t.rssiSum/t.rssiCount:null,avgSnr:t.snrCount>0?t.snrSum/t.snrCount:null,lastSeen:t.lastSeen,status:n}}function jg(){if("undefined"==typeof window)return[];try{const t=localStorage.getItem(vg);if(t)return JSON.parse(t)}catch{}return[]}function Lg(t){"undefined"!=typeof window&&(kg&&clearTimeout(kg),kg=setTimeout(()=>{try{localStorage.setItem(vg,JSON.stringify(t))}catch{}kg=null},1e3))}function Ag(){if("undefined"!=typeof window)try{const t=localStorage.getItem(xg);if(t)return t}catch{}}function Dg(t){if("undefined"!=typeof window)try{localStorage.setItem(xg,t)}catch{}}function Ng(){if("undefined"==typeof window)return[];try{const t=localStorage.getItem(fg);if(t)return JSON.parse(t)}catch{}return[]}function Rg(){if("undefined"==typeof window)return new Set;try{const t=localStorage.getItem(yg);if(t)return new Set(JSON.parse(t))}catch{}return new Set}function Fg(){if("undefined"==typeof window)return 0;try{const t=localStorage.getItem(gg);if(t)return parseInt(t,10)||0}catch{}return 0}function Ig(){if("undefined"==typeof window)return 4;try{const t=localStorage.getItem(bg);if(t){const e=parseInt(t,10);if(!isNaN(e)&&e>=0&&e<=7)return e}}catch{}return 4}const _g=v((t,e)=>({stats:null,statsLoading:!1,statsError:null,packets:[],packetsLoading:!1,packetsError:null,lastPacketTimestamp:0,logs:[],logsLoading:!1,liveMode:!0,flashReceived:0,flashAdvert:0,pendingAdvertLocalHash:null,pendingAdvertTimestamp:null,resourceHistory:Ng(),lastResourceFetch:Fg(),hiddenContacts:Rg(),quickNeighbors:jg(),cachedLocalHash:Ag(),initialized:!1,packetCacheState:If.getState(),mutationsInFlight:new Set,globalTimeRangeIndex:Ig(),initializeApp:async()=>{const{initialized:n}=e();if(!n){t({initialized:!0,statsLoading:!0,packetsLoading:!0}),If.subscribe(e=>{t({packetCacheState:e})});try{const{hiddenContacts:n}=e(),s=await ff(),i=s.neighbors??{},o=Date.now(),r=[];for(const[t,e]of Object.entries(i)){if(n.has(t))continue;if(!e.zero_hop)continue;const s=Sg(e.last_seen??0,o);"expired"!==s&&r.push({hash:t,prefix:sg(t),count:e.advert_count??0,avgRssi:e.rssi??null,avgSnr:e.snr??null,lastSeen:e.last_seen??0,status:s})}r.sort((t,e)=>e.count!==t.count?e.count-t.count:e.lastSeen-t.lastSeen);const a=s.local_hash;t({stats:s,statsLoading:!1,quickNeighbors:r,cachedLocalHash:a}),Lg(r),a&&Dg(a);const l=()=>{const n=If.getPackets();if(n.length>0){const s=n.reduce((t,e)=>{const n=e.timestamp??0;return n>t?n:t},0);t({packets:[...n],lastPacketTimestamp:s}),e().triggerTopologyCompute(),e().triggerSparklineCompute()}},c=await If.initialLoad(l);if(c.length>0){const n=c.reduce((t,e)=>{const n=e.timestamp??0;return n>t?n:t},0);t({packets:[...c],packetsLoading:!1,lastPacketTimestamp:n}),e().triggerTopologyCompute(),e().triggerSparklineCompute()}else t({packetsLoading:!1})}catch(s){t({statsError:s instanceof Error?s.message:"Failed to initialize",statsLoading:!1,packetsLoading:!1})}Hf.getState().initialize(),$f.onPacket(n=>{const{lastPacketTimestamp:s,mutationsInFlight:i}=e();if(i.size>0)return;Uf.stage(n);const o=n.timestamp??0;o>s&&t({flashReceived:e().flashReceived+1,lastPacketTimestamp:o})}),$f.onStats(n=>{const{mutationsInFlight:s,hiddenContacts:i}=e();if(s.size>0)return;const o=n.neighbors??{},r=Date.now(),a=[];for(const[t,e]of Object.entries(o)){if(i.has(t))continue;if(!e.zero_hop)continue;const n=Sg(e.last_seen??0,r);"expired"!==n&&a.push({hash:t,prefix:sg(t),count:e.advert_count??0,avgRssi:e.rssi??null,avgSnr:e.snr??null,lastSeen:e.last_seen??0,status:n})}a.sort((t,e)=>e.count!==t.count?e.count-t.count:e.lastSeen-t.lastSeen);const l=n.local_hash;t({stats:n,statsLoading:!1,statsError:null,quickNeighbors:a,cachedLocalHash:l}),Lg(a),l&&Dg(l)}),$f.onPacketStats(n=>{const{stats:s,mutationsInFlight:i}=e();if(!s||i.size>0)return;const o={...s,rx_count:n.rx_count??s.rx_count,tx_count:n.tx_count??s.tx_count,forwarded_count:n.forwarded_count??s.forwarded_count,dropped_count:n.dropped_count??s.dropped_count};t({stats:o})});try{await zf.init({apiBaseUrl:"",authToken:Um()??void 0,statsIntervalMs:hg.stats,packetsIntervalMs:hg.packets}),zf.onStats((n,s)=>{const{mutationsInFlight:i,hiddenContacts:o}=e();if(i.size>0)return;const r=n.neighbors??{},a=Date.now(),l=[];for(const[t,e]of Object.entries(r)){if(o.has(t))continue;if(!e.zero_hop)continue;const n=Sg(e.last_seen??0,a);"expired"!==n&&l.push({hash:t,prefix:sg(t),count:e.advert_count??0,avgRssi:e.rssi??null,avgSnr:e.snr??null,lastSeen:e.last_seen??0,status:n})}l.sort((t,e)=>e.count!==t.count?e.count-t.count:e.lastSeen-t.lastSeen);const c=n.local_hash;t({stats:n,statsLoading:!1,statsError:null,quickNeighbors:l,cachedLocalHash:c}),Lg(l),c&&Dg(c)}),zf.onPackets((n,s,i)=>{if(0===n.length)return;const{lastPacketTimestamp:o}=e(),r=n.map(t=>t.packet_hash).filter(t=>!!t);Uf.confirmBatch(r),If.mergePacketsDirectly(n);const a=i>o;a&&xf();const l=If.getPackets();t({packets:l,packetsLoading:!1,packetsError:null,lastPacketTimestamp:i}),a&&e().triggerTopologyCompute()}),zf.onError((e,n)=>{t("stats"===e?{statsError:n}:{packetsError:n})}),"undefined"!=typeof document&&document.addEventListener("visibilitychange",()=>{document.hidden||zf.forceRefresh()})}catch(s){!function(t){setInterval(()=>{t().fetchStats()},hg.stats),setInterval(()=>{t().liveMode&&!If.isHeavyLoadInProgress()&&t().fetchPackets()},hg.packets)}(e)}}},prefetchForRoute:t=>{switch(t){case"/logs":gf().catch(()=>{});break;case"/system":wf().catch(()=>{});break;case"/statistics":(async function(t=24){return uf(`/api/packet_type_graph_data?hours=${t}`)})(3).catch(()=>{}),yf(3).catch(()=>{});break;case"/settings":(async function(){return uf("/api/radio_presets")})().catch(()=>{})}},fetchStats:async n=>{const{stats:s,mutationsInFlight:i,hiddenContacts:o}=e();if(!(i.size>0)||(null==n?void 0:n.force)){s||t({statsLoading:!0}),t({statsError:null});try{const e=await ff(),n=e.neighbors??{},s=Date.now(),i=[];for(const[t,a]of Object.entries(n)){if(o.has(t))continue;if(!a.zero_hop)continue;const e=Sg(a.last_seen??0,s);"expired"!==e&&i.push({hash:t,prefix:sg(t),count:a.advert_count??0,avgRssi:a.rssi??null,avgSnr:a.snr??null,lastSeen:a.last_seen??0,status:e})}i.sort((t,e)=>e.count!==t.count?e.count-t.count:e.lastSeen-t.lastSeen);const r=e.local_hash;t({stats:e,statsLoading:!1,quickNeighbors:i,cachedLocalHash:r}),Lg(i),r&&Dg(r)}catch(r){t({statsError:r instanceof Error?r.message:"Failed to fetch stats",statsLoading:!1})}}},fetchPackets:async n=>{const{packets:s,lastPacketTimestamp:i}=e();0===s.length&&t({packetsLoading:!0}),t({packetsError:null});try{const n=await If.poll(),o=n.length>0?n.reduce((t,e)=>Math.max(t,e.timestamp??0),0):0,r=o>i&&i>0,a=n.length!==s.length||r;r&&(t({flashReceived:e().flashReceived+1}),xf()),t(a?{packets:n,packetsLoading:!1,lastPacketTimestamp:o||i}:{packetsLoading:!1}),r&&e().triggerTopologyCompute()}catch(o){t({packetsError:o instanceof Error?o.message:"Failed to fetch packets",packetsLoading:!1})}},fetchLogs:async()=>{const{logs:n}=e();0===n.length&&t({logsLoading:!0});try{const e=await gf();t({logs:e.logs,logsLoading:!1})}catch{t({logsLoading:!1})}},setLiveMode:e=>{t({liveMode:e}),zf.isReady()&&zf.setLiveMode(e)},setMode:async n=>{const s="setMode",{mutationsInFlight:i}=e(),o=new Set(i);o.add(s),t({mutationsInFlight:o});try{if(!(await Cf(n)).success)throw new Error("Backend returned unsuccessful response");await e().fetchStats({force:!0})}catch(r){const{mutationsInFlight:n}=e(),i=new Set(n);throw i.delete(s),t({mutationsInFlight:i}),r}},clearModeMutation:()=>{const{mutationsInFlight:n}=e(),s=new Set(n);s.delete("setMode"),t({mutationsInFlight:s})},setDutyCycle:async n=>{const s="setDutyCycle",{mutationsInFlight:i}=e(),o=new Set(i);o.add(s),t({mutationsInFlight:o});try{if(!(await Mf(n)).success)throw new Error("Backend returned unsuccessful response");await e().fetchStats({force:!0})}finally{const{mutationsInFlight:n}=e(),i=new Set(n);i.delete(s),t({mutationsInFlight:i})}},setDutyCycleConfig:async n=>{var s;const i="setDutyCycleConfig",{mutationsInFlight:o}=e(),r=new Set(o);r.add(i),t({mutationsInFlight:r});try{const t=await async function(t){return uf("/api/update_duty_cycle_config",{method:"POST",body:JSON.stringify(t)})}(n);if(!t.success&&!(null==(s=t.data)?void 0:s.persisted))throw new Error("Backend returned unsuccessful response");await e().fetchStats({force:!0})}catch(a){const{mutationsInFlight:n}=e(),s=new Set(n);throw s.delete(i),t({mutationsInFlight:s}),a}},clearDutyCycleMutation:()=>{const{mutationsInFlight:n}=e(),s=new Set(n);s.delete("setDutyCycleConfig"),t({mutationsInFlight:s})},startMutation:n=>{const{mutationsInFlight:s}=e(),i=new Set(s);i.add(n),t({mutationsInFlight:i})},clearMutation:n=>{const{mutationsInFlight:s}=e(),i=new Set(s);i.delete(n),t({mutationsInFlight:i})},sendAdvert:async()=>{try{const n=await Tf();return n.success?(t({flashAdvert:e().flashAdvert+1}),{success:!0}):{success:!1,error:n.error||"Failed to send advert"}}catch(n){return{success:!1,error:n instanceof Error?n.message:"Unknown error"}}},triggerFlashReceived:()=>{t({flashReceived:e().flashReceived+1})},triggerFlashAdvert:()=>{t({flashAdvert:e().flashAdvert+1})},addResourceDataPoint:(n,s,i)=>{const o=Date.now(),{lastResourceFetch:r,resourceHistory:a}=e();if(o-r<1e3)return;const l=[...a,{timestamp:o,time:new Date(o).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}),cpu:n,memory:s}],c=l.length>i?l.slice(-i):l;var u,d;t({resourceHistory:c,lastResourceFetch:o}),u=c,d=o,"undefined"!=typeof window&&(wg&&clearTimeout(wg),wg=setTimeout(()=>{try{localStorage.setItem(fg,JSON.stringify(u)),localStorage.setItem(gg,d.toString())}catch{}wg=null},1e3))},hideContact:n=>{const{hiddenContacts:s}=e(),i=new Set(s);i.add(n),t({hiddenContacts:i}),function(t){if("undefined"!=typeof window)try{localStorage.setItem(yg,JSON.stringify([...t]))}catch{}}(i)},clearPacketCache:()=>{If.clear(),t({packets:[],lastPacketTimestamp:0}),If.quickLoad().then(n=>{if(n.length>0){const s=n.reduce((t,e)=>Math.max(t,e.timestamp??0),0);t({packets:n,lastPacketTimestamp:s}),e().triggerTopologyCompute()}})},triggerTopologyCompute:()=>{var t,n,s,i;const{packets:o,stats:r,hiddenContacts:a}=e();if(0===o.length||!r)return;const l=r.neighbors??{},c=Object.fromEntries(Object.entries(l).filter(([t])=>!a.has(t))),u=r.local_hash;let d=null==(n=null==(t=r.config)?void 0:t.repeater)?void 0:n.latitude,h=null==(i=null==(s=r.config)?void 0:s.repeater)?void 0:i.longitude;if(!d||!h||0===d&&0===h){const t=ng.getState().getEffectiveLocation();t&&(d=t.latitude,h=t.longitude)}const p=[];for(const[e,f]of Object.entries(c))f.zero_hop&&p.push({hash:e,advertCount:f.advert_count??1,avgRssi:f.rssi??null,avgSnr:f.snr??null,lastSeen:f.last_seen??0,latitude:f.latitude,longitude:f.longitude});const m=Kf.getState().getTerrainGridForDisambiguation();Vf.compute(o,c,u,d,h,void 0,p,m??void 0)},triggerDeepAnalysis:async()=>{await If.forceDeepLoad();const n=If.getPackets();if(n.length>0){const s=n.reduce((t,e)=>Math.max(t,e.timestamp??0),0);t({packets:n,lastPacketTimestamp:s}),e().triggerTopologyCompute(),e().triggerSparklineCompute()}},updateQuickNeighbors:()=>{const{packets:n,stats:s,hiddenContacts:i}=e();if(0===n.length||!s)return;const o=s.neighbors??{},r=function(t,e,n){if(!n||0===t.length||0===Object.keys(e).length)return[];const s=Date.now(),i=sg(n),o=new Set(Object.keys(e)),r=function(t){var e,n;const s=new Map;for(const i of Object.keys(t)){const o=sg(i),r=s.get(o);if(r){const a=null==(e=t[r])?void 0:e.zero_hop;(null==(n=t[i])?void 0:n.zero_hop)&&!a&&s.set(o,i)}else s.set(o,i)}return s}(e),a=new Map;for(const c of t){if(!Tg(c))continue;const t=Cg(c.src_hash,i,r,o);if(!t)continue;let e=a.get(t);e||(e=Pg(t),a.set(t,e)),Mg(e,c)}for(const[c,u]of Object.entries(e))sg(c)!==i&&u.zero_hop&&!a.has(c)&&a.set(c,{hash:c,count:u.advert_count??0,rssiSum:u.rssi??0,rssiCount:void 0!==u.rssi?1:0,snrSum:u.snr??0,snrCount:void 0!==u.snr?1:0,lastSeen:u.last_seen??0});const l=[];for(const c of a.values()){const t=Eg(c,s);t&&l.push(t)}return l.sort((t,e)=>e.count!==t.count?e.count-t.count:e.lastSeen-t.lastSeen),l}(n,Object.fromEntries(Object.entries(o).filter(([t])=>!i.has(t))),s.local_hash),a=e().quickNeighbors;(r.length!==a.length||r.some((t,e)=>{var n,s;return t.hash!==(null==(n=a[e])?void 0:n.hash)||t.count!==(null==(s=a[e])?void 0:s.count)}))&&(t({quickNeighbors:r}),Lg(r))},triggerSparklineCompute:()=>{const{packets:t,stats:n,hiddenContacts:s}=e();if(0===t.length||!n)return;const i=n.neighbors??{},o=Object.keys(i).filter(t=>!s.has(t));0!==o.length&&Of.compute(t,o)},requestSevenDayData:async()=>{await If.loadSevenDays(()=>{const n=If.getPackets();if(n.length>0){const s=n.reduce((t,e)=>Math.max(t,e.timestamp??0),0);t({packets:[...n],lastPacketTimestamp:s}),e().triggerTopologyCompute(),e().triggerSparklineCompute()}});const n=If.getPackets();if(n.length>0){const s=n.reduce((t,e)=>Math.max(t,e.timestamp??0),0);t({packets:[...n],lastPacketTimestamp:s}),e().triggerTopologyCompute(),e().triggerSparklineCompute()}},requestThreeDayData:async()=>{await If.loadThreeDays(()=>{const n=If.getPackets();if(n.length>0){const s=n.reduce((t,e)=>Math.max(t,e.timestamp??0),0);t({packets:[...n],lastPacketTimestamp:s}),e().triggerTopologyCompute(),e().triggerSparklineCompute()}});const n=If.getPackets();if(n.length>0){const s=n.reduce((t,e)=>Math.max(t,e.timestamp??0),0);t({packets:[...n],lastPacketTimestamp:s}),e().triggerTopologyCompute(),e().triggerSparklineCompute()}},requestFourteenDayData:async()=>{await If.loadFourteenDays(()=>{const n=If.getPackets();if(n.length>0){const s=n.reduce((t,e)=>Math.max(t,e.timestamp??0),0);t({packets:[...n],lastPacketTimestamp:s}),e().triggerTopologyCompute(),e().triggerSparklineCompute()}});const n=If.getPackets();if(n.length>0){const s=n.reduce((t,e)=>Math.max(t,e.timestamp??0),0);t({packets:[...n],lastPacketTimestamp:s}),e().triggerTopologyCompute(),e().triggerSparklineCompute()}},setGlobalTimeRange:n=>{t({globalTimeRangeIndex:n}),function(t){if("undefined"!=typeof window)try{localStorage.setItem(bg,t.toString())}catch{}}(n);const s={0:1,1:1,2:3,3:12,4:24,5:72,6:168,7:336}[n]??24;zf.setTimeWindow(s);const{packetCacheState:i,requestThreeDayData:o,requestSevenDayData:r,requestFourteenDayData:a,triggerTopologyCompute:l,triggerSparklineCompute:c}=e();let u=!1;5!==n||i.threeDayLoadComplete||i.isBackgroundLoading||(o(),u=!0),6!==n||i.sevenDayLoadComplete||i.isBackgroundLoading||(r(),u=!0),7!==n||i.fourteenDayLoadComplete||i.isBackgroundLoading||(a(),u=!0),!u&&n>=5&&(l(),c())}})),Bg=_g,Vg=()=>_g(t=>t.stats),Og=()=>_g(t=>t.statsError),zg=()=>_g(t=>t.packets),$g=()=>_g(t=>t.packetsLoading),Wg=()=>_g(t=>t.logs),Ug=()=>_g(t=>t.logsLoading),Hg=()=>_g(t=>t.liveMode),Yg=()=>_g(t=>t.fetchLogs),qg=()=>_g(t=>t.setLiveMode),Gg=()=>_g(t=>t.resourceHistory),Xg=()=>_g(t=>t.addResourceDataPoint),Kg=()=>_g(t=>t.hiddenContacts),Jg=()=>_g(t=>t.hideContact),Zg=()=>_g(t=>t.packetCacheState),Qg=()=>_g(t=>t.triggerDeepAnalysis),ty=()=>_g(t=>t.quickNeighbors),ey=()=>_g(t=>t.cachedLocalHash),ny=()=>_g(t=>t.lastPacketTimestamp),sy=()=>_g(t=>t.globalTimeRangeIndex),iy=()=>_g(t=>t.setGlobalTimeRange),oy=()=>_g(t=>null!==t.stats&&t.packetCacheState.backgroundLoadComplete);function ry(){const t=_g(t=>{var e,n,s;return null==(s=null==(n=null==(e=t.stats)?void 0:e.config)?void 0:n.repeater)?void 0:s.latitude}),e=_g(t=>{var e,n,s;return null==(s=null==(n=null==(e=t.stats)?void 0:e.config)?void 0:n.repeater)?void 0:s.longitude}),n=_g(t=>{var e,n,s;return(null==(n=null==(e=t.stats)?void 0:e.config)?void 0:n.node_name)||(null==(s=t.stats)?void 0:s.node_name)||"Local Node"}),s=ng(t=>t.latitude),i=ng(t=>t.longitude),o=ng(t=>t.enabled);return t&&e&&(0!==t||0!==e)?{latitude:t,longitude:e,name:n,isStealth:!1}:o&&null!==s&&null!==i?{latitude:s,longitude:i,name:n,isStealth:!0}:null}const ay={rx:{p3:"color(display-p3 0.2 1 0.4)",fallback:"#00FF66"},tx:{p3:"color(display-p3 1 0.9 0.2)",fallback:"#FFDD00"}};function ly({showLabel:t=!1,className:e}){var i;const o=_g(t=>t.flashReceived),r=_g(t=>t.flashAdvert),a=Hf(t=>"connected"===t.connectionState),[l,c]=n.useState("idle"),u=n.useRef(0),d=n.useRef(0);n.useEffect(()=>{if(o<=0)return;const t=Date.now();if(t-u.current<50)return;u.current=t,c("rx");const e=setTimeout(()=>c("idle"),100);return()=>clearTimeout(e)},[o]),n.useEffect(()=>{if(r<=0)return;const t=Date.now();if(t-d.current<50)return;d.current=t,c("tx");const e=setTimeout(()=>c("idle"),100);return()=>clearTimeout(e)},[r]);const h="rx"===l?ay.rx:"tx"===l?ay.tx:null;return s.jsxs("span",{className:g("inline-flex items-center gap-2",e),title:a?"Real-time (WebSocket)":"Database polling",children:[s.jsx("span",{className:"inline-flex rounded-full w-1.5 h-1.5",style:h?{backgroundColor:h.fallback,...(null==(i=CSS.supports)?void 0:i.call(CSS,"color","color(display-p3 1 1 1)"))&&{backgroundColor:h.p3}}:{backgroundColor:"var(--livedot-idle)"}}),t&&s.jsx("span",{className:"type-data-xs text-text-muted uppercase tracking-wide",children:a?"Live":"DB"})]})}function cy({borderRadius:t}){return s.jsx(Jp.div,{initial:{opacity:0},animate:{opacity:.8,backgroundPosition:["200% 0%","-200% 0%"]},exit:{opacity:0},transition:{opacity:{duration:.2},backgroundPosition:{duration:2,ease:"easeInOut",repeat:1/0}},style:{position:"absolute",inset:0,zIndex:1,pointerEvents:"none",borderRadius:t,padding:2,background:"linear-gradient(\n 90deg,\n transparent 0%,\n transparent 25%,\n var(--accent-primary) 50%,\n transparent 75%,\n transparent 100%\n )",backgroundSize:"200% 100%",mask:"\n linear-gradient(#fff 0 0) content-box,\n linear-gradient(#fff 0 0)\n ",maskComposite:"exclude",WebkitMaskComposite:"xor"}})}function uy({children:t,isLoading:e=!0,className:n,borderRadius:i=12}){return s.jsxs("div",{className:g("relative overflow-hidden",n),style:{borderRadius:i},children:[s.jsx(_h,{children:e&&s.jsx(cy,{borderRadius:i})}),s.jsx("div",{className:"relative z-10",children:t})]})}function dy({className:t}){return s.jsx("div",{className:g("relative w-10 h-1 rounded-sm overflow-hidden","bg-bg-elevated",t),children:s.jsx(Jp.div,{animate:{backgroundPosition:["200% 0%","-200% 0%"]},transition:{duration:1.5,ease:"easeInOut",repeat:1/0},className:"absolute inset-0",style:{background:"linear-gradient(\n 90deg,\n transparent 0%,\n var(--accent-primary) 50%,\n transparent 100%\n )",backgroundSize:"200% 100%"}})})}const hy=v(t=>({sparklines:new Map,isComputing:!1,lastUpdated:0,nodeCount:0,setSparklines:e=>t({sparklines:e,lastUpdated:Date.now(),nodeCount:e.size,isComputing:!1}),setComputing:e=>t({isComputing:e})}));"undefined"!=typeof window&&setTimeout(()=>{Of.subscribe((t,e)=>{const n=hy.getState();e&&!n.isComputing?n.setComputing(!0):!e&&t.size>0?n.setSparklines(t):!e&&n.isComputing&&n.setComputing(!1)})},0);const py=()=>hy(t=>t.isComputing),my=[],fy=new Map;function gy(t){return hy(e=>{const n=e.sparklines.get(t);if(!n||0===n.length)return my;const s=fy.get(t);return s===n?s:(fy.set(t,n),n)})}const yy=v(t=>({topology:{edges:[],validatedEdges:[],weakEdges:[],certainEdges:[],uncertainEdges:[],edgeMap:new Map,maxPacketCount:0,maxCertainCount:0,neighborAffinity:new Map,fullAffinity:new Map,localPrefix:null,centrality:new Map,hubNodes:[],gatewayNodes:[],loops:[],loopEdgeKeys:new Set,txDelayRecommendations:new Map,pathRegistry:Bf(),edgeBetweenness:new Map,backboneEdges:[],nodeMobility:new Map,mobileNodes:[],pathHealth:[],lastHopNeighbors:[],disambiguationStats:{totalPrefixes:0,unambiguousPrefixes:0,collisionPrefixes:0,collisionRate:0,avgConfidence:0,lowConfidencePrefixes:[],highCollisionPrefixes:[],totalResolutions:0},discoveredNodes:[],viterbiStats:{totalPaths:0,pathsWithGhosts:0,avgPathCost:0,avgPathConfidence:0,observationOverrideCount:0,tracePacketsProcessed:0,pathPacketsProcessed:0,distantEdgesDiscovered:0,duplicateGroupsFound:0,duplicatePathsUnique:0,echolocationEdgesInferred:0},nodeMetrics:new Map,communityCount:0,backboneNodes:[]},isComputing:!1,lastComputeTimeMs:0,lastUpdated:0,setTopology:(e,n)=>t({topology:e,lastComputeTimeMs:n,lastUpdated:Date.now(),isComputing:!1}),setComputing:e=>t({isComputing:e})}));"undefined"!=typeof window&&Vf.subscribe((t,e)=>{yy.getState().setTopology(t,e)});const vy=()=>yy(t=>t.topology),xy=()=>yy(t=>t.topology.hubNodes),by=()=>yy(t=>t.topology.centrality),wy=()=>yy(t=>t.topology.fullAffinity);let ky=null,Sy=null,Ty=null,Cy=null;const My=()=>yy(t=>(t.topology.hubNodes!==Sy&&(Sy=t.topology.hubNodes,ky=new Set(t.topology.hubNodes)),ky)),Py=()=>yy(t=>t.topology.pathHealth),Ey=()=>yy(t=>t.topology.disambiguationStats),jy=()=>yy(t=>t.topology.disambiguationStats.highCollisionPrefixes),Ly=()=>yy(t=>t.topology.disambiguationStats.totalPrefixes>0),Ay=()=>yy(t=>t.topology.discoveredNodes),Dy=()=>yy(t=>t.topology.viterbiStats),Ny=()=>yy(t=>(t.topology.discoveredNodes!==Cy&&(Cy=t.topology.discoveredNodes,Ty=t.topology.discoveredNodes.filter(t=>t.isLikelyReal)),Ty)),Ry=()=>yy(t=>t.topology.nodeMetrics);let Fy=null,Iy=null;const _y=()=>yy(t=>{if(t.topology.nodeMetrics!==Iy){Iy=t.topology.nodeMetrics,Fy={local:0,hub:0,gateway:0,backbone:0,neighbor:0,mobile:0,ghost:0,standard:0};for(const e of t.topology.nodeMetrics.values())Fy[e.nodeClass]++}return Fy});function By(t){if(t<60)return`${Math.floor(t)}s`;const e=Math.floor(t/86400),n=Math.floor(t%86400/3600),s=Math.floor(t%3600/60),i=[];return e>0&&i.push(`${e}d`),n>0&&i.push(`${n}h`),(s>0||0===i.length)&&i.push(`${s}m`),i.join(" ")}function Vy(t){const e=Date.now()/1e3-t;return e<60?"just now":e<3600?`${Math.floor(e/60)}m ago`:e<86400?`${Math.floor(e/3600)}h ago`:`${Math.floor(e/86400)}d ago`}function Oy(t){return new Date(1e3*t).toLocaleString()}function zy(t){const e=new Date(1e3*t);return`${e.toLocaleString("en-US",{month:"short"})} ${e.getDate()}, ${e.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}`}function $y(t){return new Date(1e3*t).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}function Wy(t){return`${(t/1e6).toFixed(3)} MHz`}function Uy(t){return`${(t/1e3).toFixed(1)} kHz`}function Hy(t){const e=t>1e12?t:1e3*t,n=Date.now(),s=Math.abs(n-e),i=Math.floor(s/1e3),o=Math.floor(i/60),r=Math.floor(o/60),a=Math.floor(r/24);return a>0?`${a} day${1!==a?"s":""}`:r>0?`${r} hour${1!==r?"s":""}`:o>0?`${o} minute${1!==o?"s":""}`:`${i} second${1!==i?"s":""}`}function Yy(t){t<0&&(t=0);const e=Math.floor(t/1e3),n=Math.floor(e/60),s=Math.floor(n/60);if(s>0){const t=n%60;return t>0?`${s}h ${t}m`:`${s}h`}if(n>0){const t=e%60;return t>0?`${n}m ${t}s`:`${n}m`}if(e>0){const n=t%1e3;return n>0?`${e}.${Math.floor(n/100)}s`:`${e}s`}return`${t}ms`}const qy=[{name:"Dashboard",to:"/",icon:Do},{name:"Contacts",to:"/contacts",icon:Fo},{name:"Packets",to:"/packets",icon:No},{name:"Statistics",to:"/statistics",icon:Mo},{name:"MeshGraph",to:"/meshgraph",icon:Uo},{name:"System",to:"/system",icon:Lo},{name:"Logs",to:"/logs",icon:jo},{name:"Terminal",to:"/terminal",icon:Wo},{name:"Configuration",to:"/configuration",icon:zo}],Gy="pymc-controls-expanded",Xy=()=>{if("undefined"==typeof window)return!0;const t=localStorage.getItem(Gy);return null===t||"true"===t};function Ky(){var t,e,i,o,r,a;const{pathname:l}=x(),{stats:c,setMode:u,setDutyCycle:d,sendAdvert:h}=Bg(),p=Zm(),m=_g(t=>t.prefetchForRoute),f=Zg(),y=_g(t=>t.packetCacheState.dataTier),v=py(),b=yy(t=>t.isComputing),w=Ny();let k=null;try{k=function(){const t=n.useContext(bm);if(!t)throw new Error("useSidebar must be used within a SidebarLayout");return t}()}catch{}const[S,T]=n.useState(!1),[C,M]=n.useState("idle"),[P,E]=n.useState(null),j=n.useRef(null),L=n.useCallback(t=>{t!==l&&(j.current&&clearTimeout(j.current),j.current=setTimeout(()=>{m(t)},100))},[l,m]),A=n.useCallback(()=>{j.current&&(clearTimeout(j.current),j.current=null)},[]);n.useEffect(()=>{const t=new MutationObserver(()=>{const t=document.querySelector("[data-controls-disclosure]");if(t){const e="true"===t.getAttribute("aria-expanded");localStorage.setItem(Gy,String(e))}}),e=document.querySelector("[data-controls-disclosure]");return e&&t.observe(e,{attributes:!0,attributeFilter:["aria-expanded"]}),()=>t.disconnect()},[]);const D=null==c?void 0:c.noise_floor_dbm,N=(null==(e=null==(t=null==c?void 0:c.config)?void 0:t.repeater)?void 0:e.mode)??"forward",R=(null==(o=null==(i=null==c?void 0:c.config)?void 0:i.duty_cycle)?void 0:o.enforcement_enabled)??!1,F=(null==(a=null==(r=null==c?void 0:c.config)?void 0:r.duty_cycle)?void 0:a.max_airtime_percent)??10,I=f.isLoading||f.isBackgroundLoading||f.isTopologyLoading,_=I||v||b,B=f.loadProgress,V=()=>{null==k||k.close()};return s.jsxs(hm,{children:[s.jsxs(pm,{className:"px-5 py-6",children:[s.jsx("h1",{className:"sr-only",children:"pyMC Console"}),s.jsx(Nm,{responsive:!0,className:"block"}),s.jsxs("p",{className:"type-data-xs text-text-muted mt-1.5",children:["v",Am]})]}),s.jsxs(mm,{className:"py-4",children:[s.jsx(gm,{children:qy.map(t=>{const e=l===t.to;return s.jsxs(ym,{href:t.to,current:e,onClick:V,onMouseEnter:()=>L(t.to),onMouseLeave:A,children:[s.jsx(t.icon,{}),s.jsx(vm,{children:t.name}),"/contacts"===t.to&&w.length>0&&s.jsxs(xm,{variant:"accent",children:[s.jsx(Ao,{className:"w-3 h-3"}),s.jsx("span",{children:w.length})]}),"/meshgraph"===t.to&&s.jsx(xm,{variant:"default",children:"Beta"})]},t.name)})}),_&&s.jsx("div",{className:"px-0 py-3",children:s.jsx(uy,{isLoading:I,borderRadius:12,children:s.jsxs("div",{className:"bg-glass-surface/50 rounded-xl p-2",children:[s.jsxs("div",{className:"flex items-center gap-2 px-1 py-0.5",children:[s.jsxs("div",{className:"relative flex h-2 w-2",children:[s.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-accent-primary opacity-75"}),s.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-accent-primary"})]}),s.jsx("span",{className:"type-data-xs text-text-muted flex-1 truncate",children:f.isLoading&&B?"Loading 24h history...":f.isBackgroundLoading&&B?f.statusMessage||`Loading ${y} history...`:f.isTopologyLoading?"Loading topology data...":v?"Computing sparklines":b?"Building topology":"Analyzing database"}),null!==(null==B?void 0:B.percent)&&void 0!==(null==B?void 0:B.percent)&&I&&s.jsxs("span",{className:"type-data-xs text-text-muted tabular-nums",children:[B.percent,"%"]})]}),s.jsx("div",{className:"mt-1.5 h-1 bg-subtle-fill rounded-full overflow-hidden",children:null!==(null==B?void 0:B.percent)&&void 0!==(null==B?void 0:B.percent)&&I?s.jsx("div",{className:"h-full bg-accent-primary/60 rounded-full transition-all duration-300 ease-out",style:{width:`${B.percent}%`}}):s.jsx("div",{className:"h-full bg-accent-primary/40 rounded-full w-full"})}),!I&&s.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5 px-1",children:[s.jsx("span",{className:"type-micro text-text-muted",children:"Data:"}),s.jsx("span",{className:"type-data-xs text-accent-primary",children:(t=>{switch(t){case"24h":return"24 hours";case"3d":return"3 days";case"7d":return"7 days";case"14d":return"14 days";default:return t}})(y)})]})]})})}),s.jsx("div",{className:"flex-1"}),s.jsx(Lm,{label:"Controls",icon:s.jsx($o,{className:"w-5 h-5 text-accent-primary"}),defaultOpen:Xy(),direction:"up",dataId:"controls",children:s.jsxs("div",{className:"flex flex-col gap-2 px-1",children:[s.jsx(xo,{color:"success"===C?"success":"error"===C?"danger":"primary",onClick:async()=>{T(!0),M("idle"),E(null);const t=await h();T(!1),t.success?(M("success"),setTimeout(()=>M("idle"),1500)):(M("error"),E(t.error||"Failed to send"),setTimeout(()=>{M("idle"),E(null)},3e3))},disabled:S,className:"w-full justify-center",children:S?s.jsxs(s.Fragment,{children:[s.jsxs("svg",{"data-slot":"icon",className:"animate-spin",viewBox:"0 0 24 24",fill:"none",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"Sending..."]}):"success"===C?s.jsxs(s.Fragment,{children:[s.jsx("svg",{"data-slot":"icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:s.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Sent!"]}):"error"===C?s.jsxs(s.Fragment,{children:[s.jsxs("svg",{"data-slot":"icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[s.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),s.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),"Failed"]}):s.jsxs(s.Fragment,{children:[s.jsx(Oo,{"data-slot":"icon"}),"Send Advert"]})}),P&&s.jsx("p",{className:"text-accent-danger text-xs text-center",children:P}),s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("span",{className:"text-xs text-text-muted",children:"Repeat"}),s.jsx("span",{className:g("text-xs font-medium","forward"===N?"text-accent-success":"text-accent-secondary"),children:"forward"===N?"ON":"OFF"})]}),s.jsx(xo,{color:"forward"===N?"success":"warning",onClick:()=>{u("forward"===N?"monitor":"forward")},className:"w-full justify-center",children:"forward"===N?s.jsxs(s.Fragment,{children:[s.jsx(Bo,{"data-slot":"icon"}),"Repeating"]}):s.jsxs(s.Fragment,{children:[s.jsx(_o,{"data-slot":"icon"}),"Monitor Only"]})}),s.jsxs("div",{className:"flex items-center justify-between gap-2 mt-1",children:[s.jsx("span",{className:"text-xs text-text-muted",children:"Duty Cycle"}),s.jsx("span",{className:g("text-xs font-medium tabular-nums",R?"text-accent-secondary":"text-text-muted"),children:R?`${F}%`:"OFF"})]}),s.jsxs(xo,{color:R?"warning":"muted",onClick:()=>{d(!R)},className:"w-full justify-center",children:[s.jsx(Lo,{"data-slot":"icon"}),R?`Limited to ${F}%`:"Disabled"]})]})})]}),s.jsxs(fm,{children:[void 0!==(null==c?void 0:c.uptime_seconds)&&s.jsxs("div",{className:"px-6 py-3 flex items-center gap-3",children:[s.jsx(Eo,{className:"w-5 h-5 text-text-muted flex-shrink-0"}),s.jsxs("span",{className:"type-data-xs text-text-secondary tabular-nums",children:[By(c.uptime_seconds)," uptime"]})]}),s.jsx("div",{className:"px-3 pb-3",children:s.jsx("div",{className:"bg-subtle-fill rounded-xl p-3",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Vo,{className:"w-4 h-4 text-accent-primary"}),s.jsx("span",{className:"type-data-xs text-text-muted",children:"Noise Floor"})]}),s.jsx("span",{className:"type-data text-text-primary tabular-nums",children:null!=D?`${D.toFixed(0)} dBm`:"—"})]})})}),s.jsxs("div",{className:"px-6 py-3 flex items-center gap-3 border-t border-border-subtle",children:[s.jsx(ly,{showLabel:!0}),(null==c?void 0:c.version)&&s.jsxs("span",{className:"type-data-xs text-text-muted truncate max-w-[140px]",title:`v${c.version}`,children:["v",c.version]})]}),s.jsx("div",{className:"px-3 pb-3",children:s.jsxs("button",{onClick:()=>{sf(),window.location.href="/login"},className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl text-text-muted hover:text-accent-danger hover:bg-accent-danger/10 transition-all duration-150",children:[s.jsx(Ro,{className:"w-4 h-4"}),s.jsx("span",{className:"type-body-sm",children:"Sign Out"}),p&&s.jsxs("span",{className:"ml-auto type-data-xs text-text-muted",children:["(",p,")"]})]})})]})]})}function Jy(){const t=Zg(),e=t.isLoading||t.isBackgroundLoading||t.isTopologyLoading;return s.jsxs(Tm,{children:[s.jsxs(Cm,{children:[s.jsx("h1",{className:"sr-only",children:"pyMC Console"}),s.jsx(Nm,{height:26,className:"block"}),e&&s.jsx(dy,{className:"ml-2"})]}),s.jsx(Mm,{}),s.jsxs(Cm,{children:[s.jsxs("p",{className:"type-data-xs text-text-muted",children:["v",Am]}),s.jsx(ly,{})]})]})}const Zy=n.memo(function(){const{theme:t}=Ji(),{backgroundImage:e,brightness:n,colorScheme:i}=t,o=gt(i),r=(null==o?void 0:o.meta.backgroundImage)||null==o?void 0:o.meta.backgroundColor,a=(100-n)/100;return s.jsxs(s.Fragment,{children:[e?s.jsx("div",{className:"fixed inset-0 -z-20",style:{contain:"paint"},"aria-hidden":"true",children:s.jsx("div",{className:"absolute inset-0 bg-cover bg-center bg-no-repeat transition-opacity duration-300 ease-out",style:{backgroundImage:`url(${e})`}})}):r?s.jsx("div",{className:"fixed inset-0 -z-20 transition-colors duration-300 ease-out",style:{backgroundColor:r,contain:"paint"},"aria-hidden":"true"}):null,s.jsx("div",{className:"fixed inset-0 -z-10 bg-black pointer-events-none transition-opacity duration-200 ease-out",style:{opacity:a,contain:"paint"},"aria-hidden":"true"})]})}),Qy=20,tv=12,ev=n.createContext(null);function nv({children:t}){const[e,i]=n.useState({content:null,mouseX:0,mouseY:0,visible:!1}),o=n.useRef(null),[r,a]=n.useState({x:0,y:0}),l=n.useCallback((t,e,n)=>{i({content:t,mouseX:e,mouseY:n,visible:!0})},[]),c=n.useCallback(()=>{i(t=>({...t,visible:!1}))},[]),u=n.useCallback((t,e)=>{i(n=>n.visible?{...n,mouseX:t,mouseY:e}:n)},[]);n.useEffect(()=>{if(!e.visible||!o.current)return;const t=o.current.getBoundingClientRect(),{mouseX:n,mouseY:s}=e,i=window.innerWidth,r=window.innerHeight;let l,c;l=n+Qy+t.width+tv>i?n-Qy-t.width:n+Qy,l=Math.max(tv,Math.min(l,i-t.width-tv)),c=s-Qy-t.height{c.current&&(clearTimeout(c.current),c.current=null)},h=n.useCallback(e=>{d(),c.current=setTimeout(()=>{u.current=!0,o(t,e.clientX,e.clientY)},i)},[o,t,i]),p=n.useCallback(t=>{u.current&&a(t.clientX,t.clientY)},[a]),m=n.useCallback(()=>{d(),u.current=!1,r()},[r]),f=n.useCallback(()=>{if(d(),!l.current)return;const e=l.current.getBoundingClientRect();c.current=setTimeout(()=>{u.current=!0,o(t,e.left+e.width/2,e.top)},i)},[o,t,i]),g=n.useCallback(()=>{d(),u.current=!1,r()},[r]);return n.useEffect(()=>()=>{d(),u.current&&(u.current=!1,r())},[r]),n.useEffect(()=>{const t=()=>{u.current&&(d(),u.current=!1,r())};return document.addEventListener("click",t,!0),()=>document.removeEventListener("click",t,!0)},[r]),s.jsx("span",{ref:l,onMouseEnter:h,onMouseMove:p,onMouseLeave:m,onFocus:f,onBlur:g,className:"contents",children:e})}function iv({className:t=""}){return s.jsx("div",{className:`bg-white/5 animate-pulse rounded-lg ${t}`,"aria-hidden":"true"})}function ov(){return s.jsxs("div",{className:"section-gap","aria-label":"Loading dashboard",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(iv,{className:"h-8 w-48"}),s.jsx(iv,{className:"h-8 w-32"})]}),s.jsx(iv,{className:"h-72"}),s.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-8 gap-3",children:Array.from({length:8}).map((t,e)=>s.jsx(iv,{className:"h-24"},e))}),s.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:Array.from({length:4}).map((t,e)=>s.jsx(iv,{className:"h-44"},e))}),s.jsx(iv,{className:"h-96"})]})}function rv(){return s.jsxs("div",{className:"section-gap","aria-label":"Loading list",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(iv,{className:"h-8 w-40"}),s.jsx(iv,{className:"h-8 w-24"})]}),s.jsx(iv,{className:"h-20"}),s.jsxs("div",{className:"glass-card overflow-hidden",children:[s.jsx(iv,{className:"h-10 rounded-none"}),s.jsx("div",{className:"divide-y divide-border-subtle/30",children:Array.from({length:10}).map((t,e)=>s.jsx("div",{className:"px-4 py-3",children:s.jsx(iv,{className:"h-6"})},e))})]})]})}function av(){return s.jsxs("div",{className:"section-gap","aria-label":"Loading map",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(iv,{className:"h-8 w-32"}),s.jsx(iv,{className:"h-6 w-48"})]}),s.jsx(iv,{className:"h-[500px]"}),s.jsx(iv,{className:"h-64"})]})}function lv(){return s.jsxs("div",{className:"section-gap","aria-label":"Loading charts",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(iv,{className:"h-8 w-36"}),s.jsx(iv,{className:"h-8 w-40"})]}),s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[s.jsx(iv,{className:"h-80"}),s.jsx(iv,{className:"h-80"})]}),s.jsx(iv,{className:"h-64"})]})}function cv(){return s.jsxs("div",{className:"section-gap","aria-label":"Loading settings",children:[s.jsx(iv,{className:"h-8 w-32"}),s.jsxs("div",{className:"space-y-6",children:[s.jsx(iv,{className:"h-48"}),s.jsx(iv,{className:"h-64"}),s.jsx(iv,{className:"h-32"})]})]})}function uv(){return s.jsxs("div",{className:"section-gap","aria-label":"Loading system info",children:[s.jsx(iv,{className:"h-8 w-28"}),s.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:Array.from({length:4}).map((t,e)=>s.jsx(iv,{className:"h-28"},e))}),s.jsx(iv,{className:"h-64"}),s.jsx(iv,{className:"h-48"})]})}const dv={hidden:{opacity:0,scale:.9},visible:{opacity:1,scale:1,transition:{type:"spring",stiffness:400,damping:15}},exit:{opacity:0,scale:.9,transition:{duration:.15}}},hv={initial:{opacity:0,y:8},animate:{opacity:1,y:0,transition:{duration:.3,ease:um.cubicInOut}},exit:{opacity:0,y:-8,transition:{duration:.15,ease:um.easeIn}}};function pv({children:t,layoutKey:e}){return function(){!iu.current&&ru();const[t]=n.useState(su.current);return t}()?s.jsx(s.Fragment,{children:t}):s.jsx(Jp.div,{initial:"initial",animate:"animate",exit:"exit",variants:hv,children:t},e)}const mv=n.lazy(()=>f(()=>import("./Login-BM63wUrV.js"),__vite__mapDeps([0,1,2]))),fv=n.lazy(()=>f(()=>import("./Dashboard-DdOKd_Co.js"),__vite__mapDeps([3,1,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,2,23,24,25,26,27]))),gv=n.lazy(()=>f(()=>import("./Packets-DiXDa-F_.js"),__vite__mapDeps([28,1,11,6,7,8,9,10,12,13,14,15,16,17,18,19,20,21,4,29,5,30,31,26,2]))),yv=n.lazy(()=>f(()=>import("./Contacts-Bc9XGkC1.js").then(t=>t.C),__vite__mapDeps([32,1,33,5,34,17,22,19,35,16,10,11,30,36,29,15,20,8,37,38,2,39,14,40]))),vv=n.lazy(()=>f(()=>import("./Statistics-BZ42IsKT.js"),__vite__mapDeps([41,1,42,4,18,43,23,5,10,11,37,38,2,17,15,26,44,34,27,39,40]))),xv=n.lazy(()=>f(()=>import("./MeshGraph-Cn5F4qEM.js"),__vite__mapDeps([45,1,46,11,34,21,14,35,30,16,39,12,2]))),bv=n.lazy(()=>f(()=>import("./System-DA9azmQv.js"),__vite__mapDeps([47,1,4,5,31,27,26,19,9,39,17,2]))),wv=n.lazy(()=>f(()=>import("./Logs-CO8l86BH.js"),__vite__mapDeps([48,1,42,5,26,2]))),kv=n.lazy(()=>f(()=>import("./Terminal-Dv2-3e-b.js"),__vite__mapDeps([49,1,33,2,7,5]))),Sv=n.lazy(()=>f(()=>import("./Configuration-BdYZcJJF.js"),__vite__mapDeps([50,1,36,17,51,25,5,10,11,26,14,44,27,20,31,13,2])));function Tv({children:t}){const e=x();return qm()?s.jsx(s.Fragment,{children:t}):s.jsx(k,{to:"/login",state:{from:e},replace:!0})}class Cv extends n.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}render(){var t;return this.state.hasError?s.jsxs("div",{className:"glass-card p-8 text-center",children:[s.jsx("p",{className:"type-subheading text-accent-red mb-2",children:"Page failed to render"}),s.jsx("p",{className:"type-body text-white/50 mb-4",children:(null==(t=this.state.error)?void 0:t.message)||"Unknown error"}),s.jsx("button",{onClick:()=>this.setState({hasError:!1}),className:"px-4 py-2 bg-accent-primary/20 text-accent-primary rounded-lg hover:bg-accent-primary/30 transition-colors",children:"Try Again"})]}):this.props.children}}function Mv(){const t=_g(t=>t.initializeApp),e=qm();return n.useEffect(()=>{if(!e)return;t();const n=setInterval(()=>{nf()},3e4);return nf(),rf(),()=>clearInterval(n)},[t,e]),s.jsxs(nv,{children:[s.jsx(Zy,{}),s.jsxs(b,{children:[s.jsx(w,{path:"/login",element:s.jsx(n.Suspense,{fallback:s.jsx("div",{className:"min-h-screen bg-bg-body"}),children:s.jsx(mv,{})})}),s.jsx(w,{path:"/*",element:s.jsx(Tv,{children:s.jsx(Sm,{sidebar:s.jsx(Ky,{}),navbar:s.jsx(Jy,{}),children:s.jsx("div",{className:"px-4 sm:px-6 lg:px-8 pt-5 pb-4 sm:pb-6 lg:pb-8 max-w-7xl mx-auto",children:s.jsx(Cv,{children:s.jsxs(b,{children:[s.jsx(w,{path:"/",element:s.jsx(n.Suspense,{fallback:s.jsx(ov,{}),children:s.jsx(pv,{children:s.jsx(fv,{})})})}),s.jsx(w,{path:"/packets",element:s.jsx(n.Suspense,{fallback:s.jsx(rv,{}),children:s.jsx(pv,{children:s.jsx(gv,{})})})}),s.jsx(w,{path:"/contacts",element:s.jsx(n.Suspense,{fallback:s.jsx(av,{}),children:s.jsx(pv,{children:s.jsx(yv,{})})})}),s.jsx(w,{path:"/statistics",element:s.jsx(n.Suspense,{fallback:s.jsx(lv,{}),children:s.jsx(pv,{children:s.jsx(vv,{})})})}),s.jsx(w,{path:"/meshgraph",element:s.jsx(n.Suspense,{fallback:s.jsx(lv,{}),children:s.jsx(pv,{children:s.jsx(xv,{})})})}),s.jsx(w,{path:"/system",element:s.jsx(n.Suspense,{fallback:s.jsx(uv,{}),children:s.jsx(pv,{children:s.jsx(bv,{})})})}),s.jsx(w,{path:"/logs",element:s.jsx(n.Suspense,{fallback:s.jsx(rv,{}),children:s.jsx(pv,{children:s.jsx(wv,{})})})}),s.jsx(w,{path:"/terminal",element:s.jsx(n.Suspense,{fallback:s.jsx(rv,{}),children:s.jsx(pv,{children:s.jsx(kv,{})})})}),s.jsx(w,{path:"/configuration",element:s.jsx(n.Suspense,{fallback:s.jsx(cv,{}),children:s.jsx(pv,{children:s.jsx(Sv,{})})})})]})})})})})})]})]})}const Pv=console.warn;console.warn=(...t)=>{const e=t[0];if("string"==typeof e){if(e.includes("width")&&e.includes("height")&&e.includes("chart should be greater than 0"))return;if(e.includes("Unable to load glyph range"))return}Pv.apply(console,t)},m.createRoot(document.getElementById("root")).render(s.jsx(n.StrictMode,{children:s.jsx(Ki,{children:s.jsx(S,{children:s.jsx(Mv,{})})})}));export{Va as $,_h as A,po as B,Po as C,rg as D,to as E,dg as F,xo as G,Pr as H,nu as I,Gh as J,qo as K,ly as L,Ph as M,lc as N,wc as O,Nm as P,hc as Q,Vo as R,cg as S,sv as T,_c as U,yu as V,Sa as W,Ho as X,Zo as Y,pc as Z,Qa as _,dm as a,Mo as a$,Za as a0,Vl as a1,ur as a2,lr as a3,Qc as a4,tu as a5,ed as a6,qu as a7,au as a8,zd as a9,Py as aA,Dy as aB,Ao as aC,Hy as aD,gy as aE,py as aF,jy as aG,Bg as aH,Jg as aI,xy as aJ,by as aK,ry as aL,Vy as aM,P as aN,M as aO,gt as aP,Ui as aQ,hf as aR,pf as aS,qi as aT,Ji as aU,Ey as aV,Ly as aW,Ny as aX,Uo as aY,ag as aZ,ug as a_,xc as aa,Ka as ab,Xo as ac,ao as ad,$y as ae,so as af,io as ag,og as ah,nm as ai,Oh as aj,Oy as ak,Eo as al,Oo as am,My as an,wy as ao,Ay as ap,im as aq,am as ar,mo as as,Uu as at,Rh as au,Cr as av,Hd as aw,Yy as ax,zy as ay,eo as az,cm as b,Qg as b0,vy as b1,Ry as b2,_y as b3,_o as b4,Bo as b5,Gg as b6,Xg as b7,wf as b8,kf as b9,ig as bA,no as bB,ey as bC,Kf as bD,uy as bE,dv as bF,hg as ba,By as bb,Wg as bc,Ug as bd,Yg as be,jo as bf,mg as bg,Am as bh,ff as bi,Tf as bj,Cf as bk,Mf as bl,Sf as bm,Pf as bn,Wo as bo,uf as bp,Pt as bq,Nt as br,ng as bs,zo as bt,$o as bu,Wy as bv,Uy as bw,rm as bx,lm as by,If as bz,Co as c,$g as d,Hg as e,Vg as f,zm as g,ty as h,qm as i,Kg as j,sy as k,Qm as l,Jp as m,yf as n,ny as o,sg as p,Og as q,oy as r,$m as s,iy as t,zg as u,Zg as v,Uf as w,bf as x,qg as y,Qi as z}; diff --git a/frontend/dist/assets/index-BJEgt3tp.js b/frontend/dist/assets/index-BJEgt3tp.js deleted file mode 100644 index 383c6d0e..00000000 --- a/frontend/dist/assets/index-BJEgt3tp.js +++ /dev/null @@ -1,2 +0,0 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Login-CkRuF4n8.js","assets/vendor-react-C341c8YC.js","assets/vendor-core-WoOfkQwm.js","assets/Dashboard-DiETwG01.js","assets/useThemeColors-AeHMyThq.js","assets/PageLayout-CnF5SScd.js","assets/PacketList-BPeOqxkB.js","assets/channel-keys-DJWRrSwE.js","assets/SignalIndicator-BLrEkFNb.js","assets/DataBox-CRX76VsB.js","assets/TimeRangeSelector-DGCfekAv.js","assets/link-scoring-Cw0dJsWv.js","assets/NodeInformationCard-CEW2bogB.js","assets/Card-2pQSGkKC.js","assets/Grid-BOO-7ObJ.js","assets/Packets-BHJJxf8a.js","assets/Contacts-CyyU4xmf.js","assets/ping-DvLgBqTv.js","assets/CollisionExplorerModal-DTnzK_xA.js","assets/BasemapLayer-S9Ush6Hh.js","assets/ConfirmModal-CYXFGX_W.js","assets/maplibre-gl-B1CfjdFi.css","assets/Statistics-sXHAGtEF.js","assets/usePolling-CtRLadGa.js","assets/MeshGraph-DfCwG9Nt.js","assets/DeepAnalysisModal-D4eqwCNZ.js","assets/System-BPwbPFCW.js","assets/Logs-Cb5GXQFD.js","assets/Terminal-jVZnyeIH.js","assets/Configuration-BOsliPZn.js","assets/font-loader-jlbdh9Fw.js"])))=>i.map(i=>d[i]); -var e=Object.defineProperty,t=(t,s,n)=>((t,s,n)=>s in t?e(t,s,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[s]=n)(t,"symbol"!=typeof s?s+"":s,n);import{r as s,j as n,c as a,L as r,d as o,A as i,h as l,m as c,z as u,Q as d,e as h,M as m,y as f,X as g,x as p,C as b,f as y,g as x,i as w,u as v,k,l as S,n as C,o as j,W as T,G as M,F as L,S as N,p as _,q as E,t as P,v as D,w as I,B as F,D as A,E as R,H as z,b as B,I as O,J as $,K as W,N as H,O as U,T as q}from"./vendor-react-C341c8YC.js";import{_ as G}from"./deckgl-DTsmDcfs.js";import{n as J}from"./recharts-6XUQYgRA.js";import"./vendor-core-WoOfkQwm.js";!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))t(e);new MutationObserver(e=>{for(const s of e)if("childList"===s.type)for(const e of s.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&t(e)}).observe(document,{childList:!0,subtree:!0})}function t(e){if(e.ep)return;e.ep=!0;const t=function(e){const t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),"use-credentials"===e.crossOrigin?t.credentials="include":"anonymous"===e.crossOrigin?t.credentials="omit":t.credentials="same-origin",t}(e);fetch(e.href,t)}}();const Y={surfaces:{glass:{tint:"#252525",light:"#ffffff",dark:"#000000",reflexLight:.15,reflexDark:.8,blur:6,blurElevated:8,brightness:1,opacity:8,opacityElevated:12},card:{radius:"1.125rem",padding:"1.25rem",paddingCompact:"0.75rem"},sidebar:{tint:"rgba(113, 156, 223, 0.06)",width:"16rem",drawerWidth:"85vw"},modal:{radius:"1.125rem",backdropBlur:"8px",backdropColor:"rgba(0, 0, 0, 0.6)"}},colors:{bg:{body:"#171717",surface:"#252525",elevated:"#333233",subtle:"#3F3F3F"},border:{subtle:"#4B4B4B",strong:"#616161"},text:{primary:"#E1E1E1",secondary:"#BFBFBF",muted:"#727272",inverse:"#171717"},accent:{primary:"#719CDF",secondary:"#DFBC72",tertiary:"#6FBCBD",success:"#719872",danger:"#E12672"},signal:{excellent:"#00FF00",good:"#8CE619",fair:"#FFD900",poor:"#FF8C26",critical:"#FF3333",unknown:"#616161"},status:{success:"#719872",warning:"#DFBC72",danger:"#E12672",info:"#6FBCBD",muted:"#616161"},chart:{c1:"#719CDF",c2:"#0074BE",c3:"#6FBCBD",c4:"#DFBC72",c5:"#719872",c6:"#E12672",c7:"#E17899",c8:"#999ABD",grid:"rgba(255, 255, 255, 0.06)",axis:"rgba(255, 255, 255, 0.4)",cursor:"rgba(255, 255, 255, 0.2)"},metric:{received:"#719872",forwarded:"#0074BE",transmitted:"#DFBC72",dropped:"#E12672"},map:{nodeFill:"#3B82F6",nodeStroke:"rgba(255,255,255,0.9)",hub:"#8E4EC6",local:"#FFB224",neighbor:"#46A758",mobile:"#F76B15",room:"#D6409F",edge:"#4B4B4B",edgeHover:"#6FBCBD"}},typography:{font:{title:"'Inter', system-ui, sans-serif",display:"'Inter', system-ui, sans-serif",mono:"'JetBrains Mono', 'SF Mono', Monaco, monospace"},size:{xs:"0.64rem",sm:"0.8rem",base:"1rem",md:"1.125rem",lg:"1.25rem",xl:"1.563rem",xxl:"1.953rem",hero:"3.052rem"},weight:{normal:400,medium:500,semibold:600,bold:700},leading:{tight:1.1,snug:1.25,normal:1.5},tracking:{tight:"-0.02em",normal:"0",wide:"0.05em"}},spacing:{space:{gap:"1.5rem",gapMobile:"0.75rem",page:"1.5rem",pageMobile:"1rem",section:"2rem"},radius:{sm:"0.5rem",md:"0.875rem",lg:"1.125rem",xl:"1.5rem",pill:"9999px"}},motion:{fast:"0.1s",normal:"0.15s",slow:"0.4s",easing:"ease-out"}};function V(e){const t=e.replace("#","");if(6!==t.length&&3!==t.length)return e;let s,n,a;return 3===t.length?(s=parseInt(t[0]+t[0],16)/255,n=parseInt(t[1]+t[1],16)/255,a=parseInt(t[2]+t[2],16)/255):(s=parseInt(t.slice(0,2),16)/255,n=parseInt(t.slice(2,4),16)/255,a=parseInt(t.slice(4,6),16)/255),`color(display-p3 ${s.toFixed(3)} ${n.toFixed(3)} ${a.toFixed(3)})`}function K(){return"undefined"!=typeof window&&CSS.supports("color","color(display-p3 1 1 1)")}function X(e){return K()?V(e):e}function Q(e,t){const s={...e};for(const n of Object.keys(t)){const a=t[n],r=e[n];void 0!==a&&("object"!=typeof a||null===a||Array.isArray(a)||"object"!=typeof r||null===r||Array.isArray(r)?s[n]=a:s[n]=Q(r,a))}return s}function Z(e){return{meta:e.meta,display:e.display,surfaces:e.surfaces?Q(Y.surfaces,e.surfaces):Y.surfaces,colors:e.colors?Q(Y.colors,e.colors):Y.colors,typography:e.typography?Q(Y.typography,e.typography):Y.typography,spacing:e.spacing?Q(Y.spacing,e.spacing):Y.spacing,motion:e.motion?Q(Y.motion,e.motion):Y.motion}}function ee(e){const t=e.replace("#","");return 6===t.length?`${parseInt(t.slice(0,2),16)}, ${parseInt(t.slice(2,4),16)}, ${parseInt(t.slice(4,6),16)}`:"255, 255, 255"}function te(e){return{id:e.meta.id,colorScheme:{name:e.meta.name,dataTheme:e.meta.dataTheme,previewColor:e.meta.previewColor},background:{src:e.meta.backgroundImage,suggestedBrightness:e.meta.backgroundBrightness},display:{font:e.display.font,color:e.display.color,size:e.display.size,paletteColors:e.display.palette}}}const se="#fafafa",ne="#a1a1aa",ae="#71717a",re="#3f3f46",oe="#27272a",ie="#18181b",le="#09090b",ce="#ef4444",ue="#f97316",de="#f59e0b",he="#eab308",me="#22c55e",fe="#10b981",ge="#06b6d4",pe="#3b82f6",be="#8b5cf6",ye=Z({meta:{id:"",name:"",dataTheme:"",previewColor:pe,backgroundImage:"",backgroundBrightness:100,isDark:!0},display:{font:"Inter, sans-serif",color:ne,size:1,palette:[[pe,me,he,ue,ce],[le,ie,oe,re,se]]},typography:{font:{title:"Inter, sans-serif",display:"Inter, sans-serif",mono:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace'},weight:{normal:400,medium:500,semibold:600,bold:700,badge:700},tracking:{tight:"-0.02em",normal:"0",wide:"0.025em"},badge:{textTransform:"capitalize"}},surfaces:{glass:{tint:ie,light:re,dark:le,reflexLight:0,reflexDark:0,blur:0,blurElevated:0,brightness:1,opacity:100,opacityElevated:100,catalystMode:!0},sidebar:{tint:`${oe}80`},card:{radius:"0.5rem"},modal:{radius:"0.75rem"}},colors:{bg:{body:le,surface:ie,elevated:oe,subtle:oe},border:{subtle:oe,strong:"#52525b"},text:{primary:"#fff",secondary:ne,muted:ae,inverse:le},accent:{primary:pe,secondary:he,tertiary:ge,success:me,danger:ce},signal:{excellent:me,good:"#84cc16",fair:he,poor:ue,critical:ce,unknown:ae},status:{success:me,warning:de,danger:ce,info:pe,muted:ae},chart:{c1:pe,c2:fe,c3:de,c4:ue,c5:"#f43f5e",c6:be,c7:ge,c8:ae,grid:`${se}0d`,axis:`${se}33`,cursor:`${pe}33`},metric:{received:pe,forwarded:fe,transmitted:ue,dropped:ce},map:{nodeFill:pe,nodeStroke:`${se}e6`,hub:be,local:de,neighbor:fe,mobile:ue,room:"#ec4899",edge:re,edgeHover:pe}}}),xe=ye;te(ye);const we=Z({meta:{id:"",name:"",dataTheme:"",previewColor:"#B39DF3",backgroundImage:"/assets/sand.jpg",backgroundBrightness:80,isDark:!0},display:{font:"'Rubik Mono One', monospace",color:"#4A4A52",size:.8,palette:[["#B49DFF","#F9D26F","#71F8E5","#39D98A","#FF5C7A"],["#4CFFB5","#FF8A5C","#A78BFA","#60A5FA","#F472B6"]]},typography:{font:{title:"'Rubik Mono One', monospace"}},surfaces:{glass:{tint:"#252525",blur:6,blurElevated:8},sidebar:{tint:"rgba(113, 156, 223, 0.06)"}}}),ve=we;te(we);const ke=Z({meta:{id:"",name:"",dataTheme:"",previewColor:"#fabd2f",backgroundImage:"/assets/magma.webp",backgroundBrightness:50,isDark:!0},display:{font:"'Jacquard 12', serif",color:"#fe8019",size:1.75,palette:[["#fabd2f","#fb4934","#8ec07c","#b8bb26","#d3869b"],["#fe8019","#83a598","#d65d0e","#928374","#ebdbb2"]]},typography:{font:{title:"'Jacquard 12', serif"},size:{xxl:"2.344rem"}},surfaces:{glass:{tint:"#282828"},sidebar:{tint:"rgba(250, 189, 47, 0.06)"}},colors:{accent:{primary:"#fabd2f",secondary:"#fb4934",tertiary:"#8ec07c",success:"#b8bb26",danger:"#fb4934"},signal:{excellent:"#b8bb26",good:"#8ec07c",fair:"#fabd2f",poor:"#fe8019",critical:"#fb4934",unknown:"#928374"},status:{success:"#b8bb26",warning:"#fabd2f",danger:"#fb4934",info:"#83a598",muted:"#928374"},chart:{c1:"#fabd2f",c2:"#fe8019",c3:"#fb4934",c4:"#d3869b",c5:"#b8bb26",c6:"#8ec07c",c7:"#83a598",c8:"#d65d0e",grid:"rgba(251, 241, 199, 0.06)",axis:"rgba(251, 241, 199, 0.4)",cursor:"rgba(251, 241, 199, 0.2)"},metric:{received:"#b8bb26",forwarded:"#83a598",transmitted:"#fabd2f",dropped:"#fb4934"},map:{nodeFill:"#3B82F6",nodeStroke:"rgba(255,255,255,0.9)",hub:"#b16286",local:"#fabd2f",neighbor:"#fabd2f",mobile:"#fe8019",room:"#d3869b",edge:"#665c54",edgeHover:"#8ec07c"}}}),Se=ke;te(ke);const Ce=Z({meta:{id:"",name:"",dataTheme:"",previewColor:"#83a598",backgroundImage:"/assets/water.webp",backgroundBrightness:40,isDark:!0},display:{font:"'Cantora One', sans-serif",color:"#83a598",size:1.25,palette:[["#83a598","#a89984","#8ec07c","#d79921","#b16286"],["#fe8019","#cc241d","#7c6f64","#bdae93","#ebdbb2"]]},typography:{font:{title:"'Cantora One', sans-serif"},size:{xxl:"2.148rem"},weight:{semibold:500}},surfaces:{glass:{tint:"#1e1e1e"},sidebar:{tint:"rgba(131, 165, 152, 0.06)"}},colors:{accent:{primary:"#83a598",secondary:"#a89984",tertiary:"#8ec07c",success:"#8ec07c",danger:"#cc241d"},signal:{excellent:"#8ec07c",good:"#b8bb26",fair:"#d79921",poor:"#fe8019",critical:"#cc241d",unknown:"#7c6f64"},status:{success:"#8ec07c",warning:"#d79921",danger:"#cc241d",info:"#83a598",muted:"#7c6f64"},chart:{c1:"#83a598",c2:"#8ec07c",c3:"#d79921",c4:"#b16286",c5:"#fe8019",c6:"#cc241d",c7:"#a89984",c8:"#7c6f64",grid:"rgba(213, 196, 161, 0.06)",axis:"rgba(213, 196, 161, 0.4)",cursor:"rgba(213, 196, 161, 0.2)"},metric:{received:"#8ec07c",forwarded:"#83a598",transmitted:"#d79921",dropped:"#cc241d"},map:{nodeFill:"#3B82F6",nodeStroke:"rgba(255,255,255,0.9)",hub:"#b16286",local:"#d79921",neighbor:"#d79921",mobile:"#fe8019",room:"#b16286",edge:"#504945",edgeHover:"#83a598"}}}),je=Ce;te(Ce);const Te=Z({meta:{id:"",name:"",dataTheme:"",previewColor:"#33859d",backgroundImage:"/assets/stars.jpg",backgroundBrightness:100,isDark:!0},display:{font:"'IBM Plex Mono', monospace",color:"#c23127",size:1.25,palette:[["#33859d","#edb54b","#26a98b","#c23127","#888ca6"],["#195465","#d26939","#99d1ce","#4e5165","#0c1014"]]},typography:{font:{title:"'IBM Plex Mono', monospace"}},surfaces:{glass:{tint:"#0a0e14",blur:1,blurElevated:2},sidebar:{tint:"rgba(51, 133, 157, 0.06)"}},colors:{accent:{primary:"#33859d",secondary:"#edb54b",tertiary:"#26a98b",success:"#26a98b",danger:"#c33027"},signal:{excellent:"#26a98b",good:"#7ec07c",fair:"#edb54b",poor:"#d26939",critical:"#c33027",unknown:"#195465"},status:{success:"#26a98b",warning:"#edb54b",danger:"#c33027",info:"#599caa",muted:"#195465"},chart:{c1:"#33859d",c2:"#edb54b",c3:"#26a98b",c4:"#599caa",c5:"#d26939",c6:"#c33027",c7:"#888ba5",c8:"#195465",grid:"rgba(153, 209, 206, 0.06)",axis:"rgba(153, 209, 206, 0.4)",cursor:"rgba(153, 209, 206, 0.2)"},metric:{received:"#26a98b",forwarded:"#33859d",transmitted:"#edb54b",dropped:"#c33027"},map:{nodeFill:"#3B82F6",nodeStroke:"rgba(255,255,255,0.9)",hub:"#888ba5",local:"#edb54b",neighbor:"#edb54b",mobile:"#d26939",room:"#888ba5",edge:"#245361",edgeHover:"#26a98b"}}}),Me=Te;te(Te);const Le="#2D2D2D",Ne="#4A4A4A",_e="#7A7A7A",Ee=Z({meta:{id:"",name:"",dataTheme:"",previewColor:"#9ed072",backgroundImage:"",backgroundColor:"#F5F5F5",backgroundBrightness:100,isDark:!1},display:{font:"'JetBrains Mono', monospace",color:"#2D2D2D",size:1,palette:[["#9ed072","#fc5d7c","#76cce0","#e7c664","#b39df3"],["#f39660","#7f8490","#e2e2e3","#55575e","#2c2e34"]]},typography:{font:{title:"'JetBrains Mono', 'SF Mono', Monaco, monospace",display:"'Instrument Sans', system-ui, sans-serif",mono:"'JetBrains Mono', 'SF Mono', Monaco, monospace",cardTitle:"'JetBrains Mono', 'SF Mono', Monaco, monospace"},size:{xxl:"1.875rem",cardTitle:"1rem"},weight:{normal:400,medium:500,semibold:600,bold:600,cardTitle:600}},surfaces:{glass:{tint:"#FFFFFF",light:"rgba(255, 255, 255, 1)",dark:"rgba(0, 0, 0, 0.1)",reflexLight:0,reflexDark:0,blur:0,blurElevated:0,brightness:1,opacity:0,opacityElevated:0,ribbonMode:!0,ribbonBorderWidth:2,ribbonBorderColor:_e},sidebar:{tint:"rgba(0, 0, 0, 0.02)"}},colors:{bg:{body:"#F5F5F5",surface:"#FFFFFF",elevated:"#FFFFFF",subtle:"#EBEBEB"},border:{subtle:"#E0E0E0",strong:"#BFBFBF"},text:{primary:Le,secondary:Ne,muted:_e,inverse:"#FFFFFF"},accent:{primary:"#9ed072",secondary:"#e7c664",tertiary:"#76cce0",success:"#9ed072",danger:"#fc5d7c"},signal:{excellent:"#9ed072",good:"#c5d93d",fair:"#e7c664",poor:"#f39660",critical:"#fc5d7c",unknown:"#7f8490"},status:{success:"#9ed072",warning:"#e7c664",danger:"#fc5d7c",info:"#76cce0",muted:"#7f8490"},chart:{c1:"#2E8B57",c2:"#E14D6B",c3:"#D4A832",c4:"#4A9EA0",c5:"#8B6BAE",c6:"#D97A4A",c7:_e,c8:Ne,grid:"rgba(45, 45, 45, 0.08)",axis:"rgba(45, 45, 45, 0.5)",cursor:"rgba(45, 45, 45, 0.15)"},metric:{received:"#9ed072",forwarded:"#76cce0",transmitted:"#e7c664",dropped:"#fc5d7c"},map:{nodeFill:"#3B82F6",nodeStroke:"rgba(255,255,255,0.9)",hub:"#b39df3",local:"#e7c664",neighbor:"#e7c664",mobile:"#f39660",room:"#fc5d7c",edge:_e,edgeHover:"#76cce0"},icon:{pageTitle:Le,cardTitle:Le,widget:Ne,action:Ne,nav:_e,navActive:Le},sidebar:{bg:"rgba(0, 0, 0, 0.02)",navHoverBg:"rgba(0, 0, 0, 0.04)",navActiveBg:"rgba(0, 0, 0, 0.06)",navActiveText:Le}}}),Pe=Ee;te(Ee);const De=Z({meta:{id:"",name:"",dataTheme:"",previewColor:"#7E9CD8",backgroundImage:"/assets/folds.webp",backgroundBrightness:50,isDark:!0},display:{font:"'Inter', sans-serif",color:"#7E9CD8",size:1.25,palette:[["#7E9CD8","#E46876","#7AA89F","#DCA561","#957FB8"],["#7FB4CA","#D27E99","#98BB6C","#727169","#1F1F28"]]},typography:{font:{title:"'Inter', sans-serif"}},surfaces:{glass:{tint:"#1F1F28"},sidebar:{tint:"rgba(126, 156, 216, 0.06)"}},colors:{accent:{primary:"#7E9CD8",secondary:"#E6C384",tertiary:"#7FB4CA",success:"#98BB6C",danger:"#E46876"},signal:{excellent:"#98BB6C",good:"#B8CC5C",fair:"#E6C384",poor:"#FFA066",critical:"#E46876",unknown:"#54546D"},status:{success:"#98BB6C",warning:"#E6C384",danger:"#E46876",info:"#7FB4CA",muted:"#727169"},chart:{c1:"#7E9CD8",c2:"#E6C384",c3:"#98BB6C",c4:"#957FB8",c5:"#7FB4CA",c6:"#E46876",c7:"#FFA066",c8:"#D27E99",grid:"rgba(220, 215, 186, 0.06)",axis:"rgba(220, 215, 186, 0.4)",cursor:"rgba(220, 215, 186, 0.2)"},metric:{received:"#98BB6C",forwarded:"#7E9CD8",transmitted:"#E6C384",dropped:"#E46876"},map:{nodeFill:"#3B82F6",nodeStroke:"rgba(255,255,255,0.9)",hub:"#957FB8",local:"#E6C384",neighbor:"#E6C384",mobile:"#FFA066",room:"#D27E99",edge:"#54546D",edgeHover:"#7AA89F"}}}),Ie=De;te(De);const Fe={"KDE Breeze":xe,Magma:Se,Folds:Ie,Ribbon:Pe,BLKSAND:ve,Waves:je,Stars:Me};function Ae(e,t){const s=e.toLowerCase();return{...t,meta:{...t.meta,id:s,name:e,dataTheme:s}}}const Re=Object.fromEntries(Object.entries(Fe).map(([e,t])=>[e,Ae(e,t)])),ze=Object.fromEntries(Object.entries(Re).map(([e,t])=>[e,te(t)])),Be=Object.values(Re);function Oe(e){return Be.find(t=>t.meta.id===e)}new Map(Object.entries(Re));const $e=Object.values(ze);new Map(Object.entries(ze));const We=Object.entries(ze).map(([e,t])=>function(e,t){return{id:e.id,name:e.colorScheme.name,displayName:t,colorScheme:e.id,backgroundImage:e.background.src,paletteColors:e.display.paletteColors,displayFont:e.display.font,displayColor:e.display.color,displaySize:e.display.size}}(t,e)),He=$e.map(function(e){return{id:e.id,name:e.colorScheme.name,dataTheme:e.colorScheme.dataTheme,previewColor:e.colorScheme.previewColor}}),Ue=$e.map(function(e){return{id:e.id,src:e.background.src,suggestedScheme:e.id,suggestedBrightness:e.background.suggestedBrightness}}),qe=Re["KDE Breeze"];ze["KDE Breeze"];const Ge=qe.meta.id,Je=qe.meta.backgroundImage,Ye=qe.meta.backgroundBrightness,Ve=He,Ke=Ue,Xe=We,Qe={colorScheme:Ge,backgroundImage:Je,brightness:Ye},Ze="pymc-color-scheme",et="pymc-background-image",tt="pymc-bg-brightness",st="pymc-background";function nt(e){(new Image).src=e}const at={50:.97,100:.92,200:.84,300:.73,400:.62,500:.5,600:.4,700:.32,800:.24,900:.16},rt=[50,100,200,300,400,500,600,700,800,900],ot=["red","orange","yellow","green","aqua","blue","purple"];function it(e,t,s){const n=e=>Math.round(Math.max(0,Math.min(255,e))).toString(16).padStart(2,"0");return`#${n(e)}${n(t)}${n(s)}`}function lt(e){const t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function ct(e){const t=e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055;return Math.round(255*t)}function ut(e,t,s){const n=s*(Math.PI/180),a=t*Math.cos(n),r=t*Math.sin(n),o=e+.3963377774*a+.2158037573*r,i=e-.1055613458*a-.0638541728*r,l=e-.0894841775*a-1.291485548*r,c=o*o*o,u=i*i*i,d=l*l*l,h=-1.2684380046*c+2.6097574011*u-.3413193965*d,m=-.0041960863*c-.7034186147*u+1.707614701*d;return[ct(4.0767416621*c-3.3077115913*u+.2309699292*d),ct(h),ct(m)]}function dt(e){const[t,s,n]=function(e){const t=e.replace("#","");return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}(e),[,a,r]=function(e,t,s){const n=lt(e),a=lt(t),r=lt(s),o=.4122214708*n+.5363325363*a+.0514459929*r,i=.2119034982*n+.6806995451*a+.1073969566*r,l=.0883024619*n+.2817188376*a+.6299787005*r,c=Math.cbrt(o),u=Math.cbrt(i),d=Math.cbrt(l),h=.2104542553*c+.793617785*u-.0040720468*d,m=1.9779984951*c-2.428592205*u+.4505937099*d,f=.0259040371*c+.7827717662*u-.808675766*d,g=Math.sqrt(m*m+f*f);let p=Math.atan2(f,m)*(180/Math.PI);return p<0&&(p+=360),[h,g,p]}(t,s,n),o={};for(const i of rt){const e=at[i],t=a*(1-.3*Math.abs(e-.5)),[s,n,l]=ut(e,t,r);o[i]=it(s,n,l)}return o}function ht(e){return"undefined"==typeof window?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()}function mt(e,t){"undefined"!=typeof document&&document.documentElement.style.setProperty(e,t)}const ft="u-off",gt="u-label",pt="width",bt="height",yt="top",xt="bottom",wt="left",vt="right",kt="#000",St=kt+"0",Ct="mousemove",jt="mousedown",Tt="mouseup",Mt="mouseenter",Lt="mouseleave",Nt="dblclick",_t="change",Et="dppxchange",Pt="--",Dt="undefined"!=typeof window,It=Dt?document:null,Ft=Dt?window:null,At=Dt?navigator:null;let Rt,zt;function Bt(e,t){if(null!=t){let s=e.classList;!s.contains(t)&&s.add(t)}}function Ot(e,t){let s=e.classList;s.contains(t)&&s.remove(t)}function $t(e,t,s){e.style[t]=s+"px"}function Wt(e,t,s,n){let a=It.createElement(e);return null!=t&&Bt(a,t),null!=s&&s.insertBefore(a,n),a}function Ht(e,t){return Wt("div",e,t)}const Ut=new WeakMap;function qt(e,t,s,n,a){let r="translate("+t+"px,"+s+"px)";r!=Ut.get(e)&&(e.style.transform=r,Ut.set(e,r),t<0||s<0||t>n||s>a?Bt(e,ft):Ot(e,ft))}const Gt=new WeakMap;function Jt(e,t,s){let n=t+s;n!=Gt.get(e)&&(Gt.set(e,n),e.style.background=t,e.style.borderColor=s)}const Yt=new WeakMap;function Vt(e,t,s,n){let a=t+""+s;a!=Yt.get(e)&&(Yt.set(e,a),e.style.height=s+"px",e.style.width=t+"px",e.style.marginLeft=n?-t/2+"px":0,e.style.marginTop=n?-s/2+"px":0)}const Kt={passive:!0},Xt={...Kt,capture:!0};function Qt(e,t,s,n){t.addEventListener(e,s,n?Xt:Kt)}function Zt(e,t,s,n){t.removeEventListener(e,s,Kt)}function es(e,t,s,n){let a;s=s||0;let r=(n=n||t.length-1)<=2147483647;for(;n-s>1;)a=r?s+n>>1:xs((s+n)/2),t[a]{let a=-1,r=-1;for(let o=s;o<=n;o++)if(e(t[o])){a=o;break}for(let o=n;o>=s;o--)if(e(t[o])){r=o;break}return[a,r]}}Dt&&function e(){let t=devicePixelRatio;Rt!=t&&(Rt=t,zt&&Zt(_t,zt,e),zt=matchMedia(`(min-resolution: ${Rt-.001}dppx) and (max-resolution: ${Rt+.001}dppx)`),Qt(_t,zt,e),Ft.dispatchEvent(new CustomEvent(Et)))}();const ss=e=>null!=e,ns=e=>null!=e&&e>0,as=ts(ss),rs=ts(ns);function os(e,t,s,n){let a=js(e),r=js(t);e==t&&(-1==a?(e*=s,t/=s):(e/=s,t*=s));let o=10==s?Ts:Ms,i=1==r?vs:xs,l=(1==a?xs:vs)(o(ys(e))),c=i(o(ys(t))),u=Cs(s,l),d=Cs(s,c);return 10==s&&(l<0&&(u=Us(u,-l)),c<0&&(d=Us(d,-c))),n||2==s?(e=u*a,t=d*r):(e=Hs(e,u),t=Ws(t,d)),[e,t]}function is(e,t,s,n){let a=os(e,t,s,n);return 0==e&&(a[0]=0),0==t&&(a[1]=0),a}const ls={mode:3,pad:.1},cs={pad:0,soft:null,mode:0},us={min:cs,max:cs};function ds(e,t,s,n){return en(s)?ms(e,t,s):(cs.pad=s,cs.soft=n?0:null,cs.mode=n?3:0,ms(e,t,us))}function hs(e,t){return null==e?t:e}function ms(e,t,s){let n=s.min,a=s.max,r=hs(n.pad,0),o=hs(a.pad,0),i=hs(n.hard,-Ns),l=hs(a.hard,Ns),c=hs(n.soft,Ns),u=hs(a.soft,-Ns),d=hs(n.mode,0),h=hs(a.mode,0),m=t-e,f=Ts(m),g=Ss(ys(e),ys(t)),p=Ts(g),b=ys(p-f);(m<1e-24||b>10)&&(m=0,0!=e&&0!=t||(m=1e-24,2==d&&c!=Ns&&(r=0),2==h&&u!=-Ns&&(o=0)));let y=m||g||1e3,x=Ts(y),w=Cs(10,xs(x)),v=Us(Hs(e-y*(0==m?0==e?.1:1:r),w/10),24),k=e>=c&&(1==d||3==d&&v<=c||2==d&&v>=c)?c:Ns,S=Ss(i,v=k?k:ks(k,v)),C=Us(Ws(t+y*(0==m?0==t?.1:1:o),w/10),24),j=t<=u&&(1==h||3==h&&C>=u||2==h&&C<=u)?u:-Ns,T=ks(l,C>j&&t<=j?j:Ss(j,C));return S==T&&0==S&&(T=100),[S,T]}const fs=new Intl.NumberFormat(Dt?At.language:"en-US"),gs=e=>fs.format(e),ps=Math,bs=ps.PI,ys=ps.abs,xs=ps.floor,ws=ps.round,vs=ps.ceil,ks=ps.min,Ss=ps.max,Cs=ps.pow,js=ps.sign,Ts=ps.log10,Ms=ps.log2,Ls=(e,t=1)=>ps.asinh(e/t),Ns=1/0;function _s(e){return 1+(0|Ts((e^e>>31)-(e>>31)))}function Es(e,t,s){return ks(Ss(e,t),s)}function Ps(e){return"function"==typeof e}function Ds(e){return Ps(e)?e:()=>e}const Is=e=>e,Fs=(e,t)=>t,As=e=>null,Rs=e=>!0,zs=(e,t)=>e==t,Bs=/\.\d*?(?=9{6,}|0{6,})/gm,Os=e=>{if(Qs(e)||qs.has(e))return e;const t=`${e}`,s=t.match(Bs);if(null==s)return e;let n=s[0].length-1;if(-1!=t.indexOf("e-")){let[e,s]=t.split("e");return+`${Os(e)}e${s}`}return Us(e,n)};function $s(e,t){return Os(Us(Os(e/t))*t)}function Ws(e,t){return Os(vs(Os(e/t))*t)}function Hs(e,t){return Os(xs(Os(e/t))*t)}function Us(e,t=0){if(Qs(e))return e;let s=10**t,n=e*s*(1+Number.EPSILON);return ws(n)/s}const qs=new Map;function Gs(e){return((""+e).split(".")[1]||"").length}function Js(e,t,s,n){let a=[],r=n.map(Gs);for(let o=t;o=0?0:t)+(o>=r[i]?0:r[i]),u=10==e?l:Us(l,c);a.push(u),qs.set(u,c)}}return a}const Ys={},Vs=[],Ks=[null,null],Xs=Array.isArray,Qs=Number.isInteger;function Zs(e){return"string"==typeof e}function en(e){let t=!1;if(null!=e){let s=e.constructor;t=null==s||s==Object}return t}function tn(e){return null!=e&&"object"==typeof e}const sn=Object.getPrototypeOf(Uint8Array),nn="__proto__";function an(e,t=en){let s;if(Xs(e)){let n=e.find(e=>null!=e);if(Xs(n)||t(n)){s=Array(e.length);for(let n=0;nr){for(n=o-1;n>=0&&null==e[n];)e[n--]=null;for(n=o+1;nPromise.resolve().then(e):queueMicrotask,cn=["January","February","March","April","May","June","July","August","September","October","November","December"],un=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function dn(e){return e.slice(0,3)}const hn=un.map(dn),mn=cn.map(dn),fn={MMMM:cn,MMM:mn,WWWW:un,WWW:hn};function gn(e){return(e<10?"0":"")+e}const pn={YYYY:e=>e.getFullYear(),YY:e=>(e.getFullYear()+"").slice(2),MMMM:(e,t)=>t.MMMM[e.getMonth()],MMM:(e,t)=>t.MMM[e.getMonth()],MM:e=>gn(e.getMonth()+1),M:e=>e.getMonth()+1,DD:e=>gn(e.getDate()),D:e=>e.getDate(),WWWW:(e,t)=>t.WWWW[e.getDay()],WWW:(e,t)=>t.WWW[e.getDay()],HH:e=>gn(e.getHours()),H:e=>e.getHours(),h:e=>{let t=e.getHours();return 0==t?12:t>12?t-12:t},AA:e=>e.getHours()>=12?"PM":"AM",aa:e=>e.getHours()>=12?"pm":"am",a:e=>e.getHours()>=12?"p":"a",mm:e=>gn(e.getMinutes()),m:e=>e.getMinutes(),ss:e=>gn(e.getSeconds()),s:e=>e.getSeconds(),fff:e=>{return((t=e.getMilliseconds())<10?"00":t<100?"0":"")+t;var t}};function bn(e,t){t=t||fn;let s,n=[],a=/\{([a-z]+)\}|[^{]+/gi;for(;s=a.exec(e);)n.push("{"==s[0][0]?pn[s[1]]:s[0]);return e=>{let s="";for(let a=0;ae%1==0,wn=[1,2,2.5,5],vn=Js(10,-32,0,wn),kn=Js(10,0,32,wn),Sn=kn.filter(xn),Cn=vn.concat(kn),jn="{YYYY}",Tn="\n"+jn,Mn="{M}/{D}",Ln="\n"+Mn,Nn=Ln+"/{YY}",_n="{aa}",En="{h}:{mm}"+_n,Pn="\n"+En,Dn=":{ss}",In=null;function Fn(e){let t=1e3*e,s=60*t,n=60*s,a=24*n,r=30*a,o=365*a;return[(1==e?Js(10,0,3,wn).filter(xn):Js(10,-3,0,wn)).concat([t,5*t,10*t,15*t,30*t,s,5*s,10*s,15*s,30*s,n,2*n,3*n,4*n,6*n,8*n,12*n,a,2*a,3*a,4*a,5*a,6*a,7*a,8*a,9*a,10*a,15*a,r,2*r,3*r,4*r,6*r,o,2*o,5*o,10*o,25*o,50*o,100*o]),[[o,jn,In,In,In,In,In,In,1],[28*a,"{MMM}",Tn,In,In,In,In,In,1],[a,Mn,Tn,In,In,In,In,In,1],[n,"{h}"+_n,Nn,In,Ln,In,In,In,1],[s,En,Nn,In,Ln,In,In,In,1],[t,Dn,Nn+" "+En,In,Ln+" "+En,In,Pn,In,1],[e,Dn+".{fff}",Nn+" "+En,In,Ln+" "+En,In,Pn,In,1]],function(t){return(i,l,c,u,d,h)=>{let m=[],f=d>=o,g=d>=r&&d=a?a:d,o=x+(xs(c)-xs(b))+Ws(b-x,r);m.push(o);let f=t(o),g=f.getHours()+f.getMinutes()/s+f.getSeconds()/n,p=d/n,y=h/i.axes[l]._space;for(;o=Us(o+d,1==e?0:3),!(o>u);)if(p>1){let e=xs(Us(g+p,6))%24,s=t(o).getHours()-e;s>1&&(s=-1),o-=s*n,g=(g+p)%24,Us((o-m[m.length-1])/d,3)*y>=.7&&m.push(o)}else m.push(o)}return m}}]}const[An,Rn,zn]=Fn(1),[Bn,On,$n]=Fn(.001);function Wn(e,t){return e.map(e=>e.map((s,n)=>0==n||8==n||null==s?s:t(1==n||0==e[8]?s:e[1]+s)))}function Hn(e,t){return(s,n,a,r,o)=>{let i,l,c,u,d,h,m=t.find(e=>o>=e[0])||t[t.length-1];return n.map(t=>{let s=e(t),n=s.getFullYear(),a=s.getMonth(),r=s.getDate(),o=s.getHours(),f=s.getMinutes(),g=s.getSeconds(),p=n!=i&&m[2]||a!=l&&m[3]||r!=c&&m[4]||o!=u&&m[5]||f!=d&&m[6]||g!=h&&m[7]||m[1];return i=n,l=a,c=r,u=o,d=f,h=g,p(s)})}}function Un(e,t,s){return new Date(e,t,s)}function qn(e,t){return t(e)}function Gn(e,t){return(s,n,a,r)=>null==r?Pt:t(e(n))}Js(2,-53,53,[1]);const Jn={show:!0,live:!0,isolate:!1,mount:()=>{},markers:{show:!0,width:2,stroke:function(e,t){let s=e.series[t];return s.width?s.stroke(e,t):s.points.width?s.points.stroke(e,t):null},fill:function(e,t){return e.series[t].fill(e,t)},dash:"solid"},idx:null,idxs:null,values:[]},Yn=[0,0];function Vn(e,t,s,n=!0){return e=>{0==e.button&&(!n||e.target==t)&&s(e)}}function Kn(e,t,s,n=!0){return e=>{(!n||e.target==t)&&s(e)}}const Xn={show:!0,x:!0,y:!0,lock:!1,move:function(e,t,s){return Yn[0]=t,Yn[1]=s,Yn},points:{one:!1,show:function(e,t){let s=e.cursor.points,n=Ht(),a=s.size(e,t);$t(n,pt,a),$t(n,bt,a);let r=a/-2;$t(n,"marginLeft",r),$t(n,"marginTop",r);let o=s.width(e,t,a);return o&&$t(n,"borderWidth",o),n},size:function(e,t){return e.series[t].points.size},width:0,stroke:function(e,t){let s=e.series[t].points;return s._stroke||s._fill},fill:function(e,t){let s=e.series[t].points;return s._fill||s._stroke}},bind:{mousedown:Vn,mouseup:Vn,click:Vn,dblclick:Vn,mousemove:Kn,mouseleave:Kn,mouseenter:Kn},drag:{setScale:!0,x:!0,y:!1,dist:0,uni:null,click:(e,t)=>{t.stopPropagation(),t.stopImmediatePropagation()},_x:!1,_y:!1},focus:{dist:(e,t,s,n,a)=>n-a,prox:-1,bias:0},hover:{skip:[void 0],prox:null,bias:0},left:-10,top:-10,idx:null,dataIdx:null,idxs:null,event:null},Qn={show:!0,stroke:"rgba(0,0,0,0.07)",width:2},Zn=rn({},Qn,{filter:Fs}),ea=rn({},Zn,{size:10}),ta=rn({},Qn,{show:!1}),sa='12px system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',na="bold "+sa,aa={show:!0,scale:"x",stroke:kt,space:50,gap:5,alignTo:1,size:50,labelGap:0,labelSize:30,labelFont:na,side:2,grid:Zn,ticks:ea,border:ta,font:sa,lineGap:1.5,rotate:0},ra={show:!0,scale:"x",auto:!1,sorted:1,min:Ns,max:-Ns,idxs:[]};function oa(e,t,s,n,a){return t.map(e=>null==e?"":gs(e))}function ia(e,t,s,n,a,r,o){let i=[],l=qs.get(a)||0;for(let c=s=o?s:Us(Ws(s,a),l);c<=n;c=Us(c+a,l))i.push(Object.is(c,-0)?0:c);return i}function la(e,t,s,n,a,r,o){const i=[],l=e.scales[e.axes[t].scale].log,c=xs((10==l?Ts:Ms)(s));a=Cs(l,c),10==l&&(a=Cn[es(a,Cn)]);let u=s,d=a*l;10==l&&(d=Cn[es(d,Cn)]);do{i.push(u),u+=a,10!=l||qs.has(u)||(u=Us(u,qs.get(a))),u>=d&&(d=(a=u)*l,10==l&&(d=Cn[es(d,Cn)]))}while(u<=n);return i}function ca(e,t,s,n,a,r,o){let i=e.scales[e.axes[t].scale].asinh,l=n>i?la(e,t,Ss(i,s),n,a):[i],c=n>=0&&s<=0?[0]:[];return(s<-i?la(e,t,Ss(i,-n),-s,a):[i]).reverse().map(e=>-e).concat(c,l)}const ua=/./,da=/[12357]/,ha=/[125]/,ma=/1/,fa=(e,t,s,n)=>e.map((e,a)=>4==t&&0==e||a%n==0&&s.test(e.toExponential()[e<0?1:0])?e:null);function ga(e,t,s,n,a){let r=e.axes[s],o=r.scale,i=e.scales[o],l=e.valToPos,c=r._space,u=l(10,o),d=l(9,o)-u>=c?ua:l(7,o)-u>=c?da:l(5,o)-u>=c?ha:ma;if(d==ma){let e=ys(l(1,o)-u);if(ea,va={show:!0,auto:!0,sorted:0,gaps:wa,alpha:1,facets:[rn({},xa,{scale:"x"}),rn({},xa,{scale:"y"})]},ka={scale:"y",auto:!0,sorted:0,show:!0,spanGaps:!1,gaps:wa,alpha:1,points:{show:function(e,t){let{scale:s,idxs:n}=e.series[0],a=e._data[0],r=e.valToPos(a[n[0]],s,!0),o=e.valToPos(a[n[1]],s,!0),i=ys(o-r)/(e.series[t].points.space*Rt);return n[1]-n[0]<=i},filter:null},values:null,min:Ns,max:-Ns,idxs:[],path:null,clip:null};function Sa(e,t,s,n,a){return s/10}const Ca={time:!0,auto:!0,distr:1,log:10,asinh:1,min:null,max:null,dir:1,ori:0},ja=rn({},Ca,{time:!1,ori:1}),Ta={};function Ma(e,t){let s=Ta[e];return s||(s={key:e,plots:[],sub(e){s.plots.push(e)},unsub(e){s.plots=s.plots.filter(t=>t!=e)},pub(e,t,n,a,r,o,i){for(let l=0;l{let g=e.pxRound;const p=i.dir*(0==i.ori?1:-1),b=0==i.ori?za:Ba;let y,x;1==p?(y=s,x=n):(y=n,x=s);let w=g(c(t[y],i,m,d)),v=g(u(o[y],l,f,h)),k=g(c(t[x],i,m,d)),S=g(u(1==r?l.max:l.min,l,f,h)),C=new Path2D(a);return b(C,k,S),b(C,w,S),b(C,w,v),C})}function Pa(e,t,s,n,a,r){let o=null;if(e.length>0){o=new Path2D;const i=0==t?Oa:$a;let l=s;for(let t=0;ts[0]){let e=s[0]-l;e>0&&i(o,l,n,e,n+r),l=s[1]}}let c=s+a-l,u=10;c>0&&i(o,l,n-u/2,c,n+r+u)}return o}function Da(e,t,s,n,a,r,o){let i=[],l=e.length;for(let c=1==a?s:n;c>=s&&c<=n;c+=a)if(null===t[c]){let u=c,d=c;if(1==a)for(;++c<=n&&null===t[c];)d=c;else for(;--c>=s&&null===t[c];)d=c;let h=r(e[u]),m=d==u?h:r(e[d]),f=u-a;h=o<=0&&f>=0&&f=0&&g>=0&&g=h&&i.push([h,m])}return i}function Ia(e){return 0==e?Is:1==e?ws:t=>$s(t,e)}function Fa(e){let t=0==e?Aa:Ra,s=0==e?(e,t,s,n,a,r)=>{e.arcTo(t,s,n,a,r)}:(e,t,s,n,a,r)=>{e.arcTo(s,t,a,n,r)},n=0==e?(e,t,s,n,a)=>{e.rect(t,s,n,a)}:(e,t,s,n,a)=>{e.rect(s,t,a,n)};return(e,a,r,o,i,l=0,c=0)=>{0==l&&0==c?n(e,a,r,o,i):(l=ks(l,o/2,i/2),c=ks(c,o/2,i/2),t(e,a+l,r),s(e,a+o,r,a+o,r+i,l),s(e,a+o,r+i,a,r+i,c),s(e,a,r+i,a,r,c),s(e,a,r,a+o,r,l),e.closePath())}}const Aa=(e,t,s)=>{e.moveTo(t,s)},Ra=(e,t,s)=>{e.moveTo(s,t)},za=(e,t,s)=>{e.lineTo(t,s)},Ba=(e,t,s)=>{e.lineTo(s,t)},Oa=Fa(0),$a=Fa(1),Wa=(e,t,s,n,a,r)=>{e.arc(t,s,n,a,r)},Ha=(e,t,s,n,a,r)=>{e.arc(s,t,n,a,r)},Ua=(e,t,s,n,a,r,o)=>{e.bezierCurveTo(t,s,n,a,r,o)},qa=(e,t,s,n,a,r,o)=>{e.bezierCurveTo(s,t,a,n,o,r)};function Ga(e){return(e,t,s,n,a)=>La(e,t,(t,r,o,i,l,c,u,d,h,m,f)=>{let g,p,{pxRound:b,points:y}=t;0==i.ori?(g=Aa,p=Wa):(g=Ra,p=Ha);const x=Us(y.width*Rt,3);let w=(y.size-y.width)/2*Rt,v=Us(2*w,3),k=new Path2D,S=new Path2D,{left:C,top:j,width:T,height:M}=e.bbox;Oa(S,C-v,j-v,T+2*v,M+2*v);const L=e=>{if(null!=o[e]){let t=b(c(r[e],i,m,d)),s=b(u(o[e],l,f,h));g(k,t+w,s),p(k,t,s,w,0,2*bs)}};if(a)a.forEach(L);else for(let e=s;e<=n;e++)L(e);return{stroke:x>0?k:null,fill:k,clip:S,flags:3}})}function Ja(e){return(t,s,n,a,r,o)=>{n!=a&&(r!=n&&o!=n&&e(t,s,n),r!=a&&o!=a&&e(t,s,a),e(t,s,o))}}const Ya=Ja(za),Va=Ja(Ba);function Ka(e){const t=hs(null==e?void 0:e.alignGaps,0);return(e,s,n,a)=>La(e,s,(r,o,i,l,c,u,d,h,m,f,g)=>{[n,a]=as(i,n,a);let p,b,y=r.pxRound,x=e=>y(u(e,l,f,h)),w=e=>y(d(e,c,g,m));0==l.ori?(p=za,b=Ya):(p=Ba,b=Va);const v=l.dir*(0==l.ori?1:-1),k={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:1},S=k.stroke;let C=!1;if(a-n>=4*f){let t,s,r,c=t=>e.posToVal(t,l.key,!0),u=null,d=null,h=x(o[1==v?n:a]),m=x(o[n]),f=x(o[a]),g=c(1==v?m+1:f-1);for(let e=1==v?n:a;e>=n&&e<=a;e+=v){let n=o[e],a=(1==v?ng)?h:x(n),r=i[e];a==h?null!=r?(s=r,null==u?(p(S,a,w(s)),t=u=d=s):sd&&(d=s)):null===r&&(C=!0):(null!=u&&b(S,h,w(u),w(d),w(t),w(s)),null!=r?(s=r,p(S,a,w(s)),u=d=t=s):(u=d=null,null===r&&(C=!0)),h=a,g=c(h+v))}null!=u&&u!=d&&r!=h&&b(S,h,w(u),w(d),w(t),w(s))}else for(let e=1==v?n:a;e>=n&&e<=a;e+=v){let t=i[e];null===t?C=!0:null!=t&&p(S,x(o[e]),w(t))}let[j,T]=Na(e,s);if(null!=r.fill||0!=j){let t=k.fill=new Path2D(S),i=w(r.fillTo(e,s,r.min,r.max,j)),l=x(o[n]),c=x(o[a]);-1==v&&([c,l]=[l,c]),p(t,c,i),p(t,l,i)}if(!r.spanGaps){let c=[];C&&c.push(...Da(o,i,n,a,v,x,t)),k.gaps=c=r.gaps(e,s,n,a,c),k.clip=Pa(c,l.ori,h,m,f,g)}return 0!=T&&(k.band=2==T?[Ea(e,s,n,a,S,-1),Ea(e,s,n,a,S,1)]:Ea(e,s,n,a,S,T)),k})}function Xa(e,t,s,n,a,r,o=Ns){if(e.length>1){let i=null;for(let l=0,c=1/0;l0!=n[e]>0?s[e]=0:(s[e]=3*(l[e-1]+l[e])/((2*l[e]+l[e-1])/n[e-1]+(l[e]+2*l[e-1])/n[e]),isFinite(s[e])||(s[e]=0));s[o-1]=n[o-2];for(let c=0;c{fr.pxRatio=Rt}));const tr=Ka(),sr=Ga();function nr(e,t,s,n){return(n?[e[0],e[1]].concat(e.slice(2)):[e[0]].concat(e.slice(1))).map((e,n)=>ar(e,n,t,s))}function ar(e,t,s,n){return rn({},0==t?s:n,e)}function rr(e,t,s){return null==t?Ks:[t,s]}const or=rr;function ir(e,t,s){return null==t?Ks:ds(t,s,.1,!0)}function lr(e,t,s,n){return null==t?Ks:os(t,s,e.scales[n].log,!1)}const cr=lr;function ur(e,t,s,n){return null==t?Ks:is(t,s,e.scales[n].log,!1)}const dr=ur;function hr(e){let t,s;return[e=e.replace(/(\d+)px/,(e,n)=>(t=ws((s=+n)*Rt))+"px"),t,s]}function mr(e){e.show&&[e.font,e.labelFont].forEach(e=>{let t=Us(e[2]*Rt,1);e[0]=e[0].replace(/[0-9.]+px/,t+"px"),e[1]=t})}function fr(e,t,s){const n={mode:hs(e.mode,1)},a=n.mode;function r(e,t,s,n){let a=t.valToPct(e);return n+s*(-1==t.dir?1-a:a)}function o(e,t,s,n){let a=t.valToPct(e);return n+s*(-1==t.dir?a:1-a)}function i(e,t,s,n){return 0==t.ori?r(e,t,s,n):o(e,t,s,n)}n.valToPosH=r,n.valToPosV=o;let l=!1;n.status=0;const c=n.root=Ht("uplot");null!=e.id&&(c.id=e.id),Bt(c,e.class),e.title&&(Ht("u-title",c).textContent=e.title);const u=Wt("canvas"),d=n.ctx=u.getContext("2d"),h=Ht("u-wrap",c);Qt("click",h,e=>{e.target===f&&(xs!=us||js!=ms)&&sn.click(n,e)},!0);const m=n.under=Ht("u-under",h);h.appendChild(u);const f=n.over=Ht("u-over",h),g=+hs((e=an(e)).pxAlign,1),p=Ia(g);(e.plugins||[]).forEach(t=>{t.opts&&(e=t.opts(n,e)||e)});const b=e.ms||.001,y=n.series=1==a?nr(e.series||[],ra,ka,!1):(x=e.series||[null],w=va,x.map((e,t)=>0==t?{}:rn({},w,e)));var x,w;const v=n.axes=nr(e.axes||[],aa,ya,!0),k=n.scales={},S=n.bands=e.bands||[];S.forEach(e=>{e.fill=Ds(e.fill||null),e.dir=hs(e.dir,-1)});const C=2==a?y[1].facets[0].scale:y[0].scale,j={axes:function(){for(let e=0;est[e]):b,x=2==m.distr?st[b[1]]-st[b[0]]:u,w=t.ticks,S=t.border,C=w.show?w.size:0,j=ws(C*Rt),T=ws((2==t.alignTo?t._size-C-t.gap:t.gap)*Rt),M=t._rotate*-bs/180,L=p(t._pos*Rt),N=L+(j+T)*c;a=0==o?N:0,s=1==o?N:0,it(t.font[0],l,1==t.align?wt:2==t.align?vt:M>0?wt:M<0?vt:0==o?"center":3==r?vt:wt,M||1==o?"middle":2==r?yt:xt);let _=t.font[1]*t.lineGap,E=b.map(e=>p(i(e,m,f,g))),P=t._values;for(let e=0;e0){let e=y.some(e=>e._focus)&&tt!=_e.alpha;e&&(d.globalAlpha=tt=_e.alpha),y.forEach((e,s)=>{if(s>0&&e.show&&(ut(s,!1),ut(s,!0),null==e._paths)){let r=tt;tt!=e.alpha&&(d.globalAlpha=tt=e.alpha);let o=2==a?[0,t[s][0].length-1]:function(e){let t=Es(He-1,0,We-1),s=Es(Ue+1,0,We-1);for(;null==e[t]&&t>0;)t--;for(;null==e[s]&&s{if(t>0&&e.show){let s=tt;tt!=e.alpha&&(d.globalAlpha=tt=e.alpha),null!=e._paths&&dt(t,!1);{let s=null!=e._paths?e._paths.gaps:null,a=e.points.show(n,t,He,Ue,s),r=e.points.filter(n,t,a,s);(a||r)&&(e.points._paths=e.points.paths(n,t,He,Ue,r),dt(t,!0))}tt!=s&&(d.globalAlpha=tt=s),na("drawSeries",t)}}),e&&(d.globalAlpha=tt=1)}}},T=(e.drawOrder||["axes","series"]).map(e=>j[e]);function M(e){const t=3==e.distr?t=>Ts(t>0?t:e.clamp(n,t,e.min,e.max,e.key)):4==e.distr?t=>Ls(t,e.asinh):100==e.distr?t=>e.fwd(t):e=>e;return s=>{let n=t(s),{_min:a,_max:r}=e;return(n-a)/(r-a)}}function L(t){let s=k[t];if(null==s){let n=(e.scales||Ys)[t]||Ys;if(null!=n.from){L(n.from);let e=rn({},k[n.from],n,{key:t});e.valToPct=M(e),k[t]=e}else{s=k[t]=rn({},t==C?Ca:ja,n),s.key=t;let e=s.time,r=s.range,o=Xs(r);if((t!=C||2==a&&!e)&&(!o||null!=r[0]&&null!=r[1]||(r={min:null==r[0]?ls:{mode:1,hard:r[0],soft:r[0]},max:null==r[1]?ls:{mode:1,hard:r[1],soft:r[1]}},o=!1),!o&&en(r))){let e=r;r=(t,s,n)=>null==s?Ks:ds(s,n,e)}s.range=Ds(r||(e?or:t==C?3==s.distr?cr:4==s.distr?dr:rr:3==s.distr?lr:4==s.distr?ur:ir)),s.auto=Ds(!o&&s.auto),s.clamp=Ds(s.clamp||Sa),s._min=s._max=null,s.valToPct=M(s)}}}L("x"),L("y"),1==a&&y.forEach(e=>{L(e.scale)}),v.forEach(e=>{L(e.scale)});for(let ft in e.scales)L(ft);const N=k[C],_=N.distr;let E,P;0==N.ori?(Bt(c,"u-hz"),E=r,P=o):(Bt(c,"u-vt"),E=o,P=r);const D={};for(let ft in k){let e=k[ft];null==e.min&&null==e.max||(D[ft]={min:e.min,max:e.max},e.min=e.max=null)}const I=e.tzDate||(e=>new Date(ws(e/b))),F=e.fmtDate||bn,A=1==b?zn(I):$n(I),R=Hn(I,Wn(1==b?Rn:On,F)),z=Gn(I,qn("{YYYY}-{MM}-{DD} {h}:{mm}{aa}",F)),B=[],O=n.legend=rn({},Jn,e.legend),$=n.cursor=rn({},Xn,{drag:{y:2==a}},e.cursor),W=O.show,H=$.show,U=O.markers;let q,G,J;O.idxs=B,U.width=Ds(U.width),U.dash=Ds(U.dash),U.stroke=Ds(U.stroke),U.fill=Ds(U.fill);let Y,V=[],K=[],X=!1,Q={};if(O.live){const e=y[1]?y[1].values:null;X=null!=e,Y=X?e(n,1,0):{_:0};for(let t in Y)Q[t]=Pt}if(W)if(q=Wt("table","u-legend",c),J=Wt("tbody",null,q),O.mount(n,q),X){G=Wt("thead",null,q,J);let e=Wt("tr",null,G);for(var Z in Wt("th",null,e),Y)Wt("th",gt,e).textContent=Z}else Bt(q,"u-inline"),O.live&&Bt(q,"u-live");const ee={show:!0},te={show:!1},se=new Map;function ne(e,t,s,a=!0){const r=se.get(t)||{},o=$.bind[e](n,t,s,a);o&&(Qt(e,t,r[e]=o),se.set(t,r))}function ae(e,t,s){const n=se.get(t)||{};for(let a in n)null!=e&&a!=e||(Zt(a,t,n[a]),delete n[a]);null==e&&se.delete(t)}let re=0,oe=0,ie=0,le=0,ce=0,ue=0,de=ce,he=ue,me=ie,fe=le,ge=0,pe=0,be=0,ye=0;n.bbox={};let xe=!1,we=!1,ve=!1,ke=!1,Se=!1,Ce=!1;function je(e,t,s){(s||e!=n.width||t!=n.height)&&Te(e,t),Ut(!1),ve=!0,we=!0,Ws()}function Te(e,t){n.width=re=ie=e,n.height=oe=le=t,ce=ue=0,function(){let e=!1,t=!1,s=!1,n=!1;v.forEach((a,r)=>{if(a.show&&a._show){let{side:r,_size:o}=a,i=r%2,l=o+(null!=a.label?a.labelSize:0);l>0&&(i?(ie-=l,3==r?(ce+=l,n=!0):s=!0):(le-=l,0==r?(ue+=l,e=!0):t=!0))}}),ze[0]=e,ze[1]=s,ze[2]=t,ze[3]=n,ie-=$e[1]+$e[3],ce+=$e[3],le-=$e[2]+$e[0],ue+=$e[0]}(),function(){let e=ce+ie,t=ue+le,s=ce,n=ue;function a(a,r){switch(a){case 1:return e+=r,e-r;case 2:return t+=r,t-r;case 3:return s-=r,s+r;case 0:return n-=r,n+r}}v.forEach((e,t)=>{if(e.show&&e._show){let t=e.side;e._pos=a(t,e._size),null!=e.label&&(e._lpos=a(t,e.labelSize))}})}();let s=n.bbox;ge=s.left=$s(ce*Rt,.5),pe=s.top=$s(ue*Rt,.5),be=s.width=$s(ie*Rt,.5),ye=s.height=$s(le*Rt,.5)}const Me=3;if(n.setSize=function({width:e,height:t}){je(e,t)},null==$.dataIdx){let e=$.hover,s=e.skip=new Set(e.skip??[]);s.add(void 0);let n=e.prox=Ds(e.prox),a=e.bias??(e.bias=0);$.dataIdx=(e,r,o,i)=>{if(0==r)return o;let l=o,c=n(e,r,o,i)??Ns,u=c>=0&&c0;)s.has(f[e])||(t=e);if(0==a||1==a)for(e=o;null==n&&e++c&&(l=null);return l}}const Le=e=>{$.event=e};$.idxs=B,$._lock=!1;let Ne=$.points;Ne.show=Ds(Ne.show),Ne.size=Ds(Ne.size),Ne.stroke=Ds(Ne.stroke),Ne.width=Ds(Ne.width),Ne.fill=Ds(Ne.fill);const _e=n.focus=rn({},e.focus||{alpha:.3},$.focus),Ee=_e.prox>=0,Pe=Ee&&Ne.one;let De=[],Ie=[],Fe=[];function Ae(e,t){let s=Ne.show(n,t);if(s instanceof HTMLElement)return Bt(s,"u-cursor-pt"),Bt(s,e.class),qt(s,-10,-10,ie,le),f.insertBefore(s,De[t]),s}function Re(e,t){if(1==a||t>0){let t=1==a&&k[e.scale].time,s=e.value;e.value=t?Zs(s)?Gn(I,qn(s,F)):s||z:s||ba,e.label=e.label||(t?"Time":"Value")}if(Pe||t>0){e.width=null==e.width?1:e.width,e.paths=e.paths||tr||As,e.fillTo=Ds(e.fillTo||_a),e.pxAlign=+hs(e.pxAlign,g),e.pxRound=Ia(e.pxAlign),e.stroke=Ds(e.stroke||null),e.fill=Ds(e.fill||null),e._stroke=e._fill=e._paths=e._focus=null;let t=Us(1*(3+2*(Ss(1,e.width)||1)),3),s=e.points=rn({},{size:t,width:Ss(1,.2*t),stroke:e.stroke,space:2*t,paths:sr,_stroke:null,_fill:null},e.points);s.show=Ds(s.show),s.filter=Ds(s.filter),s.fill=Ds(s.fill),s.stroke=Ds(s.stroke),s.paths=Ds(s.paths),s.pxAlign=e.pxAlign}if(W){let s=function(e,t){if(0==t&&(X||!O.live||2==a))return Ks;let s=[],r=Wt("tr","u-series",J,J.childNodes[t]);Bt(r,e.class),e.show||Bt(r,ft);let o=Wt("th",null,r);if(U.show){let e=Ht("u-marker",o);if(t>0){let s=U.width(n,t);s&&(e.style.border=s+"px "+U.dash(n,t)+" "+U.stroke(n,t)),e.style.background=U.fill(n,t)}}let i=Ht(gt,o);for(var l in e.label instanceof HTMLElement?i.appendChild(e.label):i.textContent=e.label,t>0&&(U.show||(i.style.color=e.width>0?U.stroke(n,t):U.fill(n,t)),ne("click",o,t=>{if($._lock)return;Le(t);let s=y.indexOf(e);if((t.ctrlKey||t.metaKey)!=O.isolate){let e=y.some((e,t)=>t>0&&t!=s&&e.show);y.forEach((t,n)=>{n>0&&mn(n,e?n==s?ee:te:ee,!0,da.setSeries)})}else mn(s,{show:!e.show},!0,da.setSeries)},!1),Ee&&ne(Mt,o,t=>{$._lock||(Le(t),mn(y.indexOf(e),yn,!0,da.setSeries))},!1)),Y){let e=Wt("td","u-value",r);e.textContent="--",s.push(e)}return[r,s]}(e,t);V.splice(t,0,s[0]),K.splice(t,0,s[1]),O.values.push(null)}if(H){B.splice(t,0,null);let s=null;Pe?0==t&&(s=Ae(e,t)):t>0&&(s=Ae(e,t)),De.splice(t,0,s),Ie.splice(t,0,0),Fe.splice(t,0,0)}na("addSeries",t)}n.addSeries=function(e,t){t=null==t?y.length:t,e=1==a?ar(e,t,ra,ka):ar(e,t,{},va),y.splice(t,0,e),Re(y[t],t)},n.delSeries=function(e){if(y.splice(e,1),W){O.values.splice(e,1),K.splice(e,1);let t=V.splice(e,1)[0];ae(null,t.firstChild),t.remove()}H&&(B.splice(e,1),De.splice(e,1)[0].remove(),Ie.splice(e,1),Fe.splice(e,1)),na("delSeries",e)};const ze=[!1,!1,!1,!1];function Be(e,t,s,n){let[a,r,o,i]=s,l=t%2,c=0;return 0==l&&(i||r)&&(c=0==t&&!a||2==t&&!o?ws(aa.size/3):0),1==l&&(a||o)&&(c=1==t&&!r||3==t&&!i?ws(ya.size/2):0),c}const Oe=n.padding=(e.padding||[Be,Be,Be,Be]).map(e=>Ds(hs(e,Be))),$e=n._padding=Oe.map((e,t)=>e(n,t,ze,0));let We,He=null,Ue=null;const qe=1==a?y[0].idxs:null;let Ge,Je,Ye,Ve,Ke,Xe,Qe,Ze,et,tt,st=null,nt=!1;function at(e,s){if(t=null==e?[]:e,n.data=n._data=t,2==a){We=0;for(let e=1;e=0,Ce=!0,Ws()}}function rt(){let e,s;nt=!0,1==a&&(We>0?(He=qe[0]=0,Ue=qe[1]=We-1,e=t[0][He],s=t[0][Ue],2==_?(e=He,s=Ue):e==s&&(3==_?[e,s]=os(e,e,N.log,!1):4==_?[e,s]=is(e,e,N.log,!1):N.time?s=e+ws(86400/b):[e,s]=ds(e,s,.1,!0))):(He=qe[0]=e=null,Ue=qe[1]=s=null)),hn(C,e,s)}function ot(e,t,s,n,a,r){e??(e=St),s??(s=Vs),n??(n="butt"),a??(a=St),r??(r="round"),e!=Ge&&(d.strokeStyle=Ge=e),a!=Je&&(d.fillStyle=Je=a),t!=Ye&&(d.lineWidth=Ye=t),r!=Ke&&(d.lineJoin=Ke=r),n!=Xe&&(d.lineCap=Xe=n),s!=Ve&&d.setLineDash(Ve=s)}function it(e,t,s,n){t!=Je&&(d.fillStyle=Je=t),e!=Qe&&(d.font=Qe=e),s!=Ze&&(d.textAlign=Ze=s),n!=et&&(d.textBaseline=et=n)}function lt(e,t,s,a,r=0){if(a.length>0&&e.auto(n,nt)&&(null==t||null==t.min)){let t=hs(He,0),n=hs(Ue,a.length-1),o=null==s.min?function(e,t,s,n=0,a=!1){let r=a?rs:as,o=a?ns:ss;[t,s]=r(e,t,s);let i=e[t],l=e[t];if(t>-1)if(1==n)i=e[t],l=e[s];else if(-1==n)i=e[s],l=e[t];else for(let c=t;c<=s;c++){let t=e[c];o(t)&&(tl&&(l=t))}return[i??Ns,l??-Ns]}(a,t,n,r,3==e.distr):[s.min,s.max];e.min=ks(e.min,s.min=o[0]),e.max=Ss(e.max,s.max=o[1])}}n.setData=at;const ct={min:null,max:null};function ut(e,t){let s=t?y[e].points:y[e];s._stroke=s.stroke(n,e),s._fill=s.fill(n,e)}function dt(e,s){let a=s?y[e].points:y[e],{stroke:r,fill:o,clip:i,flags:l,_stroke:c=a._stroke,_fill:u=a._fill,_width:h=a.width}=a._paths;h=Us(h*Rt,3);let m=null,f=h%2/2;s&&null==u&&(u=h>0?"#fff":c);let g=1==a.pxAlign&&f>0;if(g&&d.translate(f,f),!s){let e=ge-h/2,t=pe-h/2,s=be+h,n=ye+h;m=new Path2D,m.rect(e,t,s,n)}s?mt(c,h,a.dash,a.cap,u,r,o,l,i):function(e,s,a,r,o,i,l,c,u,d,h){let m=!1;0!=u&&S.forEach((f,g)=>{if(f.series[0]==e){let e,p=y[f.series[1]],b=t[f.series[1]],x=(p._paths||Ys).band;Xs(x)&&(x=1==f.dir?x[0]:x[1]);let w=null;p.show&&x&&function(e,t,s){for(t=hs(t,0),s=hs(s,e.length-1);t<=s;){if(null!=e[t])return!0;t++}return!1}(b,He,Ue)?(w=f.fill(n,g)||i,e=p._paths.clip):x=null,mt(s,a,r,o,w,l,c,u,d,h,e,x),m=!0}}),m||mt(s,a,r,o,i,l,c,u,d,h)}(e,c,h,a.dash,a.cap,u,r,o,l,m,i),g&&d.translate(-f,-f)}const ht=3;function mt(e,t,s,n,a,r,o,i,l,c,u,h){ot(e,t,s,n,a),(l||c||h)&&(d.save(),l&&d.clip(l),c&&d.clip(c)),h?(i&ht)==ht?(d.clip(h),u&&d.clip(u),_t(a,o),kt(e,r,t)):2&i?(_t(a,o),d.clip(h),kt(e,r,t)):1&i&&(d.save(),d.clip(h),u&&d.clip(u),_t(a,o),d.restore(),kt(e,r,t)):(_t(a,o),kt(e,r,t)),(l||c||h)&&d.restore()}function kt(e,t,s){s>0&&(t instanceof Map?t.forEach((e,t)=>{d.strokeStyle=Ge=t,d.stroke(e)}):null!=t&&e&&d.stroke(t))}function _t(e,t){t instanceof Map?t.forEach((e,t)=>{d.fillStyle=Je=t,d.fill(e)}):null!=t&&e&&d.fill(t)}function Dt(e,t,s,n,a,r,o,i,l,c){let u=o%2/2;1==g&&d.translate(u,u),ot(i,o,l,c,i),d.beginPath();let h,m,f,p,b=a+(0==n||3==n?-r:r);0==s?(m=a,p=b):(h=a,f=b);for(let g=0;g{if(!s.show)return;let r=k[s.scale];if(null==r.min)return void(s._show&&(t=!1,s._show=!1,Ut(!1)));s._show||(t=!1,s._show=!0,Ut(!1));let o=s.side,i=o%2,{min:l,max:c}=r,[u,d]=function(e,t,s,a){let r,o=v[e];if(a<=0)r=[0,0];else{let i=o._space=o.space(n,e,t,s,a);r=function(e,t,s,n,a){let r=Ss(_s(e),_s(t)),o=t-e,i=es(a/n*o,s);do{let e=s[i],t=n*e/o;if(t>=a&&r+(e<5?qs.get(e):0)<=17)return[e,t]}while(++ist[e]):m,g=2==r.distr?st[m[1]]-st[m[0]]:u,p=s._values=s.values(n,s.filter(n,f,a,d,g),a,d,g);s._rotate=2==o?s.rotate(n,p,a,d):0;let b=s._size;s._size=vs(s.size(n,p,a,e)),null!=b&&s._size!=b&&(t=!1)}),t}function zt(e){let t=!0;return Oe.forEach((s,a)=>{let r=s(n,a,ze,e);r!=$e[a]&&(t=!1),$e[a]=r}),t}function Ut(e){y.forEach((t,s)=>{s>0&&(t._paths=null,e&&(1==a?(t.min=null,t.max=null):t.facets.forEach(e=>{e.min=null,e.max=null})))})}let Gt,Yt,Kt,Xt,ts,cs,us,ms,fs,gs,xs,js,Ms=!1,Is=!1,Bs=[];function Os(){Is=!1;for(let e=0;e0){y.forEach((s,r)=>{if(1==a){let a=s.scale,o=D[a];if(null==o)return;let i=e[a];if(0==r){let e=i.range(n,i.min,i.max,a);i.min=e[0],i.max=e[1],He=es(i.min,t[0]),Ue=es(i.max,t[0]),Ue-He>1&&(t[0][He]i.max&&Ue--),s.min=st[He],s.max=st[Ue]}else s.show&&s.auto&<(i,o,s,t[r],s.sorted);s.idxs[0]=He,s.idxs[1]=Ue}else if(r>0&&s.show&&s.auto){let[n,a]=s.facets,o=n.scale,i=a.scale,[l,c]=t[r],u=e[o],d=e[i];null!=u&<(u,D[o],n,l,n.sorted),null!=d&<(d,D[i],a,c,a.sorted),s.min=a.min,s.max=a.max}});for(let t in e){let s=e[t],a=D[t];if(null==s.from&&(null==a||null==a.min)){let e=s.range(n,s.min==Ns?null:s.min,s.max==-Ns?null:s.max,t);s.min=e[0],s.max=e[1]}}}for(let t in e){let s=e[t];if(null!=s.from){let a=e[s.from];if(null==a.min)s.min=s.max=null;else{let e=s.range(n,a.min,a.max,t);s.min=e[0],s.max=e[1]}}}let s={},r=!1;for(let t in e){let n=e[t],a=k[t];if(a.min!=n.min||a.max!=n.max){a.min=n.min,a.max=n.max;let e=a.distr;a._min=3==e?Ts(a.min):4==e?Ls(a.min,a.asinh):100==e?a.fwd(a.min):a.min,a._max=3==e?Ts(a.max):4==e?Ls(a.max,a.asinh):100==e?a.fwd(a.max):a.max,s[t]=r=!0}}if(r){y.forEach((e,t)=>{2==a?t>0&&s.y&&(e._paths=null):s[e.scale]&&(e._paths=null)});for(let e in s)ve=!0,na("setScale",e);H&&$.left>=0&&(ke=Ce=!0)}for(let t in D)D[t]=null}(),xe=!1),ve&&(function(){let e=!1,t=0;for(;!e;){t++;let s=At(t),a=zt(t);e=t==Me||s&&a,e||(Te(n.width,n.height),we=!0)}}(),ve=!1),we){if($t(m,wt,ce),$t(m,yt,ue),$t(m,pt,ie),$t(m,bt,le),$t(f,wt,ce),$t(f,yt,ue),$t(f,pt,ie),$t(f,bt,le),$t(h,pt,re),$t(h,bt,oe),u.width=ws(re*Rt),u.height=ws(oe*Rt),v.forEach(({_el:e,_show:t,_size:s,_pos:n,side:a})=>{if(null!=e)if(t){let t=a%2==1;$t(e,t?"left":"top",n-(3===a||0===a?s:0)),$t(e,t?"width":"height",s),$t(e,t?"top":"left",t?ue:ce),$t(e,t?"height":"width",t?le:ie),Ot(e,ft)}else Bt(e,ft)}),Ge=Je=Ye=Ke=Xe=Qe=Ze=et=Ve=null,tt=1,_n(!0),ce!=de||ue!=he||ie!=me||le!=fe){Ut(!1);let e=ie/me,t=le/fe;if(H&&!ke&&$.left>=0){$.left*=e,$.top*=t,Kt&&qt(Kt,ws($.left),0,ie,le),Xt&&qt(Xt,0,ws($.top),ie,le);for(let s=0;s=0&&cn.width>0){cn.left*=e,cn.width*=e,cn.top*=t,cn.height*=t;for(let e in Dn)$t(un,e,cn[e])}de=ce,he=ue,me=ie,fe=le}na("setSize"),we=!1}re>0&&oe>0&&(d.clearRect(0,0,u.width,u.height),na("drawClear"),T.forEach(e=>e()),na("draw")),cn.show&&Se&&(dn(cn),Se=!1),H&&ke&&(Ln(null,!0,!1),ke=!1),O.show&&O.live&&Ce&&(Tn(),Ce=!1),l||(l=!0,n.status=1,na("ready")),nt=!1,Ms=!1}function Js(e,s){let a=k[e];if(null==a.from){if(0==We){let t=a.range(n,s.min,s.max,e);s.min=t[0],s.max=t[1]}if(s.min>s.max){let e=s.min;s.min=s.max,s.max=e}if(We>1&&null!=s.min&&null!=s.max&&s.max-s.min<1e-16)return;e==C&&2==a.distr&&We>0&&(s.min=es(s.min,t[0]),s.max=es(s.max,t[0]),s.min==s.max&&s.max++),D[e]=s,xe=!0,Ws()}}n.batch=function(e,t=!1){Ms=!0,Is=t,e(n),Hs(),t&&Bs.length>0&&queueMicrotask(Os)},n.redraw=(e,t)=>{ve=t||!1,!1!==e?hn(C,N.min,N.max):Ws()},n.setScale=Js;let Qs=!1;const sn=$.drag;let nn=sn.x,on=sn.y;H&&($.x&&(Gt=Ht("u-cursor-x",f)),$.y&&(Yt=Ht("u-cursor-y",f)),0==N.ori?(Kt=Gt,Xt=Yt):(Kt=Yt,Xt=Gt),xs=$.left,js=$.top);const cn=n.select=rn({show:!0,over:!0,left:0,width:0,top:0,height:0},e.select),un=cn.show?Ht("u-select",cn.over?f:m):null;function dn(e,t){if(cn.show){for(let t in e)cn[t]=e[t],t in Dn&&$t(un,t,e[t]);!1!==t&&na("setSelect")}}function hn(e,t,s){Js(e,{min:t,max:s})}function mn(e,t,s,r){null!=t.focus&&function(e){if(e!=pn){let t=null==e,s=1!=_e.alpha;y.forEach((n,r)=>{if(1==a||r>0){let a=t||0==r||r==e;n._focus=t?null:a,s&&function(e,t){y[e].alpha=t,H&&null!=De[e]&&(De[e].style.opacity=t),W&&V[e]&&(V[e].style.opacity=t)}(r,a?1:_e.alpha)}}),pn=e,s&&Ws()}}(e),null!=t.show&&y.forEach((s,n)=>{n>0&&(e==n||null==e)&&(s.show=t.show,function(e){if(y[e].show)W&&Ot(V[e],ft);else if(W&&Bt(V[e],ft),H){let t=Pe?De[0]:De[e];null!=t&&qt(t,-10,-10,ie,le)}}(n),2==a?(hn(s.facets[0].scale,null,null),hn(s.facets[1].scale,null,null)):hn(s.scale,null,null),Ws())}),!1!==s&&na("setSeries",e,t),r&&fa("setSeries",n,e,t)}let fn,gn,pn;n.setSelect=dn,n.setSeries=mn,n.addBand=function(e,t){e.fill=Ds(e.fill||null),e.dir=hs(e.dir,-1),t=null==t?S.length:t,S.splice(t,0,e)},n.setBand=function(e,t){rn(S[e],t)},n.delBand=function(e){null==e?S.length=0:S.splice(e,1)};const yn={focus:!0};function xn(e,t,s){let n=k[t];s&&(e=e/Rt-(1==n.ori?ue:ce));let a=ie;1==n.ori&&(a=le,e=a-e),-1==n.dir&&(e=a-e);let r=n._min,o=r+(n._max-r)*(e/a),i=n.distr;return 3==i?Cs(10,o):4==i?((e,t=1)=>ps.sinh(e)*t)(o,n.asinh):100==i?n.bwd(o):o}function wn(e,t){$t(un,wt,cn.left=e),$t(un,pt,cn.width=t)}function vn(e,t){$t(un,yt,cn.top=e),$t(un,bt,cn.height=t)}W&&Ee&&ne(Lt,q,e=>{$._lock||(Le(e),null!=pn&&mn(null,yn,!0,da.setSeries))}),n.valToIdx=e=>es(e,t[0]),n.posToIdx=function(e,s){return es(xn(e,C,s),t[0],He,Ue)},n.posToVal=xn,n.valToPos=(e,t,s)=>0==k[t].ori?r(e,k[t],s?be:ie,s?ge:0):o(e,k[t],s?ye:le,s?pe:0),n.setCursor=(e,t,s)=>{xs=e.left,js=e.top,Ln(null,t,s)};let kn=0==N.ori?wn:vn,jn=1==N.ori?wn:vn;function Tn(e,t){if(null!=e&&(e.idxs?e.idxs.forEach((e,t)=>{B[t]=e}):void 0!==e.idx&&B.fill(e.idx),O.idx=B[0]),W&&O.live){for(let e=0;e0||1==a&&!X)&&Mn(e,B[e]);!function(){if(W&&O.live)for(let e=2==a?1:0;eUe;fn=Ns,gn=null;let l=0==N.ori?ie:le,c=1==N.ori?ie:le;if(xs<0||0==We||i){o=$.idx=null;for(let e=0;e0&&e.show){let s=null==w?-10:w==o?r:E(1==a?t[0][w]:t[p][0][w],N,l,0),b=null==v?-10:P(v,1==a?k[e.scale]:k[e.facets[1].scale],c,0);if(Ee&&null!=v){let t=1==N.ori?xs:js,s=ys(_e.dist(n,p,w,b,t));if(s=0?1:-1;r==(v>=0?1:-1)&&(1==r?1==n?v>=a:v<=a:1==n?v<=a:v>=a)&&(fn=s,gn=p)}else fn=s,gn=p}}if(Ce||Pe){let e,t;0==N.ori?(e=s,t=b):(e=b,t=s);let a,r,o,l,c,y,x=!0,w=Ne.bbox;if(null!=w){x=!1;let e=w(n,p);o=e.left,l=e.top,a=e.width,r=e.height}else o=e,l=t,a=r=Ne.size(n,p);if(y=Ne.fill(n,p),c=Ne.stroke(n,p),Pe)p==gn&&fn<=_e.prox&&(i=o,u=l,d=a,h=r,m=x,f=y,g=c);else{let e=De[p];null!=e&&(Ie[p]=o,Fe[p]=l,Vt(e,a,r,x),Jt(e,y,c),qt(e,vs(o),vs(l),ie,le))}}}}if(Pe){let e=_e.prox;if(Ce||(null==pn?fn<=e:fn>e||gn!=pn)){let e=De[0];null!=e&&(Ie[0]=i,Fe[0]=u,Vt(e,d,h,m),Jt(e,f,g),qt(e,vs(i),vs(u),ie,le))}}}if(cn.show&&Qs)if(null!=e){let[t,s]=da.scales,[n,a]=da.match,[r,o]=e.cursor.sync.scales,i=e.cursor.drag;if(nn=i._x,on=i._y,nn||on){let i,u,d,h,m,{left:f,top:g,width:p,height:b}=e.select,y=e.scales[r].ori,x=e.posToVal,w=null!=t&&n(t,r),v=null!=s&&a(s,o);w&&nn?(0==y?(i=f,u=p):(i=g,u=b),d=k[t],h=E(x(i,r),d,l,0),m=E(x(i+u,r),d,l,0),kn(ks(h,m),ys(m-h))):kn(0,l),v&&on?(1==y?(i=f,u=p):(i=g,u=b),d=k[s],h=P(x(i,o),d,c,0),m=P(x(i+u,o),d,c,0),jn(ks(h,m),ys(m-h))):jn(0,c)}else In()}else{let e=ys(fs-ts),t=ys(gs-cs);if(1==N.ori){let s=e;e=t,t=s}nn=sn.x&&e>=sn.dist,on=sn.y&&t>=sn.dist;let s,n,a=sn.uni;null!=a?nn&&on&&(nn=e>=a,on=t>=a,nn||on||(t>e?on=!0:nn=!0)):sn.x&&sn.y&&(nn||on)&&(nn=on=!0),nn&&(0==N.ori?(s=us,n=xs):(s=ms,n=js),kn(ks(s,n),ys(n-s)),on||jn(0,c)),on&&(1==N.ori?(s=us,n=xs):(s=ms,n=js),jn(ks(s,n),ys(n-s)),nn||kn(0,l)),nn||on||(kn(0,0),jn(0,0))}if(sn._x=nn,sn._y=on,null==e){if(r){if(null!=ha){let[e,t]=da.scales;da.values[0]=null!=e?xn(0==N.ori?xs:js,e):null,da.values[1]=null!=t?xn(1==N.ori?xs:js,t):null}fa(Ct,n,xs,js,ie,le,o)}if(Ee){let e=r&&da.setSeries,t=_e.prox;null==pn?fn<=t&&mn(gn,yn,!0,e):fn>t?mn(null,yn,!0,e):gn!=pn&&mn(gn,yn,!0,e)}}Ce&&(O.idx=o,Tn()),!1!==s&&na("setCursor")}n.setLegend=Tn;let Nn=null;function _n(e=!1){e?Nn=null:(Nn=f.getBoundingClientRect(),na("syncRect",Nn))}function En(e,t,s,n,a,r,o){$._lock||Qs&&null!=e&&0==e.movementX&&0==e.movementY||(Pn(e,t,s,n,a,r,0,!1,null!=e),null!=e?Ln(null,!0,!0):Ln(t,!0,!1))}function Pn(e,t,s,a,r,o,l,c,u){if(null==Nn&&_n(!1),Le(e),null!=e)s=e.clientX-Nn.left,a=e.clientY-Nn.top;else{if(s<0||a<0)return xs=-10,void(js=-10);let[e,n]=da.scales,l=t.cursor.sync,[c,u]=l.values,[d,h]=l.scales,[m,f]=da.match,g=t.axes[0].side%2==1,p=0==N.ori?ie:le,b=1==N.ori?ie:le,y=g?o:r,x=g?r:o,w=g?a:s,v=g?s:a;if(s=null!=d?m(e,d)?i(c,k[e],p,0):-10:p*(w/y),a=null!=h?f(n,h)?i(u,k[n],b,0):-10:b*(v/x),1==N.ori){let e=s;s=a,a=e}}!u||null!=t&&t.cursor.event.type!=Ct||((s<=1||s>=ie-1)&&(s=$s(s,ie)),(a<=1||a>=le-1)&&(a=$s(a,le))),c?(ts=s,cs=a,[us,ms]=$.move(n,s,a)):(xs=s,js=a)}Object.defineProperty(n,"rect",{get:()=>(null==Nn&&_n(!1),Nn)});const Dn={width:0,height:0,left:0,top:0};function In(){dn(Dn,!1)}let Fn,Un,Yn,Vn;function Kn(e,t,s,a,r,o,i){Qs=!0,nn=on=sn._x=sn._y=!1,Pn(e,t,s,a,r,o,0,!0,!1),null!=e&&(ne(Tt,It,Qn,!1),fa(jt,n,us,ms,ie,le,null));let{left:l,top:c,width:u,height:d}=cn;Fn=l,Un=c,Yn=u,Vn=d}function Qn(e,t,s,a,r,o,i){Qs=sn._x=sn._y=!1,Pn(e,t,s,a,r,o,0,!1,!0);let{left:l,top:c,width:u,height:d}=cn,h=u>0||d>0,m=Fn!=l||Un!=c||Yn!=u||Vn!=d;if(h&&m&&dn(cn),sn.setScale&&h&&m){let e=l,t=u,s=c,n=d;if(1==N.ori&&(e=c,t=d,s=l,n=u),nn&&hn(C,xn(e,C),xn(e+t,C)),on)for(let a in k){let e=k[a];a!=C&&null==e.from&&e.min!=Ns&&hn(a,xn(s+n,a),xn(s,a))}In()}else $.lock&&($._lock=!$._lock,Ln(t,!0,null!=e));null!=e&&(ae(Tt,It),fa(Tt,n,xs,js,ie,le,null))}function Zn(e,t,s,a,r,o,i){$._lock||(Le(e),rt(),In(),null!=e&&fa(Nt,n,xs,js,ie,le,null))}function ea(){v.forEach(mr),je(n.width,n.height,!0)}Qt(Et,Ft,ea);const ta={};ta.mousedown=Kn,ta.mousemove=En,ta.mouseup=Qn,ta.dblclick=Zn,ta.setSeries=(e,t,s,a)=>{-1!=(s=(0,da.match[2])(n,t,s))&&mn(s,a,!0,!1)},H&&(ne(jt,f,Kn),ne(Ct,f,En),ne(Mt,f,e=>{Le(e),_n(!1)}),ne(Lt,f,function(e,t,s,n,a,r,o){if($._lock)return;Le(e);let i=Qs;if(Qs){let e,t,s=!0,n=!0,a=10;0==N.ori?(e=nn,t=on):(e=on,t=nn),e&&t&&(s=xs<=a||xs>=ie-a,n=js<=a||js>=le-a),e&&s&&(xs=xs{e.call(null,n,t,s)})}(e.plugins||[]).forEach(e=>{for(let t in e.hooks)sa[t]=(sa[t]||[]).concat(e.hooks[t])});const ua=(e,t,s)=>s,da=rn({key:null,setSeries:!1,filters:{pub:Rs,sub:Rs},scales:[C,y[1]?y[1].scale:null],match:[zs,zs,ua],values:[null,null]},$.sync);2==da.match.length&&da.match.push(ua),$.sync=da;const ha=da.key,ma=Ma(ha);function fa(e,t,s,n,a,r,o){da.filters.pub(e,t,s,n,a,r,o)&&ma.pub(e,t,s,n,a,r,o)}function xa(){na("init",e,t),at(t||e.data,!1),D[C]?Js(C,D[C]):rt(),Se=cn.show&&(cn.width>0||cn.height>0),ke=Ce=!0,je(e.width,e.height)}return ma.sub(n),n.pub=function(e,t,s,n,a,r,o){da.filters.sub(e,t,s,n,a,r,o)&&ta[e](null,t,s,n,a,r,o)},n.destroy=function(){ma.unsub(n),Za.delete(n),se.clear(),Zt(Et,Ft,ea),c.remove(),null==q||q.remove(),na("destroy")},y.forEach(Re),v.forEach(function(e,t){if(e._show=e.show,e.show){let s=e.side%2,a=k[e.scale];null==a&&(e.scale=s?y[1].scale:C,a=k[e.scale]);let r=a.time;e.size=Ds(e.size),e.space=Ds(e.space),e.rotate=Ds(e.rotate),Xs(e.incrs)&&e.incrs.forEach(e=>{!qs.has(e)&&qs.set(e,Gs(e))}),e.incrs=Ds(e.incrs||(2==a.distr?Sn:r?1==b?An:Bn:Cn)),e.splits=Ds(e.splits||(r&&1==a.distr?A:3==a.distr?la:4==a.distr?ca:ia)),e.stroke=Ds(e.stroke),e.grid.stroke=Ds(e.grid.stroke),e.ticks.stroke=Ds(e.ticks.stroke),e.border.stroke=Ds(e.border.stroke);let o=e.values;e.values=Xs(o)&&!Xs(o[0])?Ds(o):r?Xs(o)?Hn(I,Wn(o,F)):Zs(o)?function(e,t){let s=bn(t);return(t,n,a,r,o)=>n.map(t=>s(e(t)))}(I,o):o||R:o||oa,e.filter=Ds(e.filter||(a.distr>=3&&10==a.log?ga:3==a.distr&&2==a.log?pa:Fs)),e.font=hr(e.font),e.labelFont=hr(e.labelFont),e._size=e.size(n,null,t,0),e._space=e._rotate=e._incrs=e._found=e._splits=e._values=null,e._size>0&&(ze[t]=!0,e._el=Ht("u-axis",h))}}),s?s instanceof HTMLElement?(s.appendChild(c),xa()):s(n,xa):xa(),n}fr.assign=rn,fr.fmtNum=gs,fr.rangeNum=ds,fr.rangeLog=os,fr.rangeAsinh=is,fr.orient=La,fr.pxRatio=Rt,fr.join=function(e,t){if(function(e){let t=e[0][0],s=t.length;for(let n=1;n=n&&null==e[a];)a--;if(a<=n)return!0;const r=Ss(1,xs((a-n+1)/t));for(let o=e[n],i=n+r;i<=a;i+=r){const t=e[i];if(null!=t){if(t<=o)return!1;o=t}}return!0}(t[0])||(t=function(e){let t=e[0],s=t.length,n=Array(s);for(let r=0;rt[e]-t[s]);let a=[];for(let r=0;re-t)],a=n[0].length,r=new Map;for(let o=0;oLa(e,r,(l,c,u,d,h,m,f,g,p,b,y)=>{[o,i]=as(u,o,i);let x=l.pxRound,{left:w,width:v}=e.bbox,k=e=>x(m(e,d,b,g)),S=e=>x(f(e,h,y,p)),C=0==d.ori?za:Ba;const j={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:1},T=j.stroke,M=d.dir*(0==d.ori?1:-1);let L=S(u[1==M?o:i]),N=k(c[1==M?o:i]),_=N,E=N;a&&-1==t&&(E=w,C(T,E,L)),C(T,N,L);for(let e=1==M?o:i;e>=o&&e<=i;e+=M){let s=u[e];if(null==s)continue;let n=k(c[e]),a=S(s);1==t?C(T,n,L):C(T,_,a),C(T,n,a),L=a,_=n}let P=_;a&&1==t&&(P=w+v,C(T,P,L));let[D,I]=Na(e,r);if(null!=l.fill||0!=D){let t=j.fill=new Path2D(T),s=S(l.fillTo(e,r,l.min,l.max,D));C(t,P,s),C(t,E,s)}if(!l.spanGaps){let a=[];a.push(...Da(c,u,o,i,M,k,n));let h=l.width*Rt/2,m=s||1==t?h:-h,f=s||-1==t?-h:h;a.forEach(e=>{e[0]+=m,e[1]+=f}),j.gaps=a=l.gaps(e,r,o,i,a),j.clip=Pa(a,d.ori,g,p,b,y)}return 0!=I&&(j.band=2==I?[Ea(e,r,o,i,T,-1),Ea(e,r,o,i,T,1)]:Ea(e,r,o,i,T,I)),j})},e.bars=function(e){const t=hs((e=e||Ys).size,[.6,Ns,1]),s=e.align||0,n=e.gap||0;let a=e.radius;a=null==a?[0,0]:"number"==typeof a?[a,0]:a;const r=Ds(a),o=1-t[0],i=hs(t[1],Ns),l=hs(t[2],1),c=hs(e.disp,Ys),u=hs(e.each,e=>{}),{fill:d,stroke:h}=c;return(e,t,a,m)=>La(e,t,(f,g,p,b,y,x,w,v,k,S,C)=>{let j,T,M=f.pxRound,L=s,N=n*Rt,_=i*Rt,E=l*Rt;0==b.ori?[j,T]=r(e,t):[T,j]=r(e,t);const P=b.dir*(0==b.ori?1:-1);let D,I,F,A=0==b.ori?Oa:$a,R=0==b.ori?u:(e,t,s,n,a,r,o)=>{u(e,t,s,a,n,o,r)},z=hs(e.bands,Vs).find(e=>e.series[0]==t),B=null!=z?z.dir:0,O=f.fillTo(e,t,f.min,f.max,B),$=M(w(O,y,C,k)),W=S,H=M(f.width*Rt),U=!1,q=null,G=null,J=null,Y=null;null==d||0!=H&&null==h||(U=!0,q=d.values(e,t,a,m),G=new Map,new Set(q).forEach(e=>{null!=e&&G.set(e,new Path2D)}),H>0&&(J=h.values(e,t,a,m),Y=new Map,new Set(J).forEach(e=>{null!=e&&Y.set(e,new Path2D)})));let{x0:V,size:K}=c;if(null!=V&&null!=K){L=1,g=V.values(e,t,a,m),2==V.unit&&(g=g.map(t=>e.posToVal(v+t*S,b.key,!0)));let s=K.values(e,t,a,m);I=2==K.unit?s[0]*S:x(s[0],b,S,v)-x(0,b,S,v),W=Xa(g,p,x,b,S,v,W),F=W-I+N}else W=Xa(g,p,x,b,S,v,W),F=W*o+N,I=W-F;F<1&&(F=0),H>=I/2&&(H=0),F<5&&(M=Is);let X=F>0;I=M(Es(W-F-(X?H:0),E,_)),D=(0==L?I/2:L==P?0:I)-L*P*((0==L?N/2:0)+(X?H/2:0));const Q={stroke:null,fill:null,clip:null,band:null,gaps:null,flags:0},Z=U?null:new Path2D;let ee=null;if(null!=z)ee=e.data[z.series[1]];else{let{y0:s,y1:n}=c;null!=s&&null!=n&&(p=n.values(e,t,a,m),ee=s.values(e,t,a,m))}let te=j*I,se=T*I;for(let s=1==P?a:m;s>=a&&s<=m;s+=P){let n=p[s];if(null==n)continue;if(null!=ee){let e=ee[s]??0;if(n-e==0)continue;$=w(e,y,C,k)}let a=x(2!=b.distr||null!=c?g[s]:s,b,S,v),r=w(hs(n,O),y,C,k),o=M(a-D),i=M(Ss(r,$)),l=M(ks(r,$)),u=i-l;if(null!=n){let a=n<0?se:te,r=n<0?te:se;U?(H>0&&null!=J[s]&&A(Y.get(J[s]),o,l+xs(H/2),I,Ss(0,u-H),a,r),null!=q[s]&&A(G.get(q[s]),o,l+xs(H/2),I,Ss(0,u-H),a,r)):A(Z,o,l+xs(H/2),I,Ss(0,u-H),a,r),R(e,t,s,o-H/2,l,I+H,u)}}return H>0?Q.stroke=U?Y:Z:U||(Q._fill=0==f.width?f._fill:f._stroke??f._fill,Q.width=0),Q.fill=U?G:Z,Q})},e.spline=function(e){return function(e,t){const s=hs(null==t?void 0:t.alignGaps,0);return(t,n,a,r)=>La(t,n,(o,i,l,c,u,d,h,m,f,g,p)=>{[a,r]=as(l,a,r);let b,y,x,w=o.pxRound,v=e=>w(d(e,c,g,m)),k=e=>w(h(e,u,p,f));0==c.ori?(b=Aa,x=za,y=Ua):(b=Ra,x=Ba,y=qa);const S=c.dir*(0==c.ori?1:-1);let C=v(i[1==S?a:r]),j=C,T=[],M=[];for(let e=1==S?a:r;e>=a&&e<=r;e+=S)if(null!=l[e]){let t=v(i[e]);T.push(j=t),M.push(k(l[e]))}const L={stroke:e(T,M,b,x,y,w),fill:null,clip:null,band:null,gaps:null,flags:1},N=L.stroke;let[_,E]=Na(t,n);if(null!=o.fill||0!=_){let e=L.fill=new Path2D(N),s=k(o.fillTo(t,n,o.min,o.max,_));x(e,j,s),x(e,C,s)}if(!o.spanGaps){let e=[];e.push(...Da(i,l,a,r,S,v,s)),L.gaps=e=o.gaps(t,n,a,r,e),L.clip=Pa(e,c.ori,m,f,g,p)}return 0!=E&&(L.band=2==E?[Ea(t,n,a,r,N,-1),Ea(t,n,a,r,N,1)]:Ea(t,n,a,r,N,E)),L})}(Qa,e)}}const gr=new Map;function pr(e){var t;if(!e.startsWith("var("))return e;const s=gr.get(e);if(s)return s;const n=e.match(/var\(([^,)]+)(?:,\s*([^)]+))?\)/);if(!n)return e;const a=n[1].trim(),r=(null==(t=n[2])?void 0:t.trim())||"#888888",o=getComputedStyle(document.documentElement).getPropertyValue(a).trim()||r;return gr.set(e,o),o}const br=s.memo(function({timestamps:e,series:t,onHover:a,highlightedKey:r=null,cursorColor:o="rgba(255,255,255,0.5)"}){const i=s.useRef(null),l=s.useRef(null),c=s.useRef(t),u=s.useRef(r),d=s.useRef(a),h=s.useRef(e.length);s.useLayoutEffect(()=>{c.current=t,u.current=r,d.current=a});const m=s.useMemo(()=>{const t=new Array(e.length).fill(1);return[e,t]},[e]),f=s.useMemo(()=>({hooks:{draw:e=>{!function(e,t,s){if(0===t.length)return;const n=e.ctx,a=e.bbox,r=a.left,o=a.top,i=a.width,l=a.height;if(i<=0||l<=0)return;const c=e.data[0],u=c.length;if(0===u)return;const d=c[0],h=c[u-1]-d||1,m=e=>{const t=c[e];return r+(t-d)/h*i},f=e=>o+l*(1-e);for(let g=0;g=0;t--){const e=m(t),s=f(r[t]);if(t===u-1)n.lineTo(e,s);else{const a=m(t+1);n.lineTo(a,s),n.lineTo(e,s)}}n.closePath(),n.fill(),n.restore()}}(e,c.current,u.current),function(e){const t=e.ctx,{left:s,top:n,width:a,height:r}=e.bbox,o=window.devicePixelRatio||1,i=function(){const e=getComputedStyle(document.documentElement);return{fontFamily:e.getPropertyValue("--font-data").trim()||'"JetBrains Mono", ui-monospace, monospace',textPrimary:e.getPropertyValue("--text-primary").trim()||"#FFFFFF"}}();t.save(),t.strokeStyle=i.textPrimary,t.globalAlpha=.15,t.lineWidth=1*o,t.setLineDash([4*o,4*o]);for(const c of[.2,.4,.6,.8]){const e=Math.round(n+r*(1-c))+.5;t.beginPath(),t.moveTo(Math.round(s),e),t.lineTo(Math.round(s+a),e),t.stroke()}t.restore(),t.save(),t.font=`bold ${10*o}px ${i.fontFamily}`,t.fillStyle=i.textPrimary,t.textBaseline="middle",t.textAlign="left";const l=8*o;for(const c of[0,20,40,60,80,100]){const e=n+r*(1-c/100),s=Math.max(n+l,Math.min(n+r-l,e));t.fillText(`${c}%`,0,s)}t.restore()}(e)}}}),[]),g=s.useMemo(()=>({width:400,height:200,padding:[8,0,0,32],cursor:{show:!0,x:!0,y:!1,drag:{x:!1,y:!1},points:{show:!1}},scales:{x:{time:!0},y:{range:[0,1]}},axes:[{show:!1},{show:!1}],series:[{},{show:!1}],hooks:{setCursor:[e=>{var t,s;const n=e.cursor.idx;if(null!=n&&n>=0){const s=e.data[0][n];null==(t=d.current)||t.call(d,n,s)}else null==(s=d.current)||s.call(d,null,null)}]},plugins:[f]}),[f]);s.useEffect(()=>{const t=i.current;if(!t||0===e.length)return;const s=h.current,n=e.length,a=Math.abs(n-s);if(!(!l.current||a>100||s>0&&a/s>.1)&&l.current)return l.current.setData(m),void(h.current=n);l.current&&l.current.destroy();const r=t.getBoundingClientRect(),o=Math.floor(r.width)||400,c=Math.floor(r.height)||200,u=new fr({...g,width:o,height:c},m,t);return l.current=u,h.current=n,()=>{u.destroy(),l.current=null}},[g,m,e.length]),s.useEffect(()=>{const e=i.current;if(!e)return;const t=new ResizeObserver(e=>{const t=e[0];if(!t||!l.current)return;const{width:s,height:n}=t.contentRect;s>0&&n>0&&l.current.setSize({width:Math.floor(s),height:Math.floor(n)})});return t.observe(e),()=>{t.disconnect()}},[]),s.useEffect(()=>{l.current&&l.current.redraw()},[r,t]);const p=s.useCallback(()=>{null==a||a(null,null)},[a]);return 0===e.length?n.jsx("div",{className:"h-full flex items-center justify-center text-text-muted",children:"No data available"}):n.jsx("div",{ref:i,className:"w-full h-full rounded-2xl overflow-hidden",onMouseLeave:p})}),yr=s.createContext(null);function xr(e){const t=Oe(e);t&&function(e){if("undefined"==typeof document)return;const t=function(e){var t;const s={},n=e.surfaces.glass;s["--glass-tint"]=n.tint,s["--glass-light"]=n.light,s["--glass-dark"]=n.dark,s["--glass-reflex-light"]=String(n.reflexLight),s["--glass-reflex-dark"]=String(n.reflexDark),s["--glass-blur"]=`${n.blur}px`,s["--glass-blur-elevated"]=`${n.blurElevated}px`,s["--glass-brightness"]=String(n.brightness),s["--glass-bg-opacity"]=`${n.opacity}%`,s["--glass-bg-opacity-elevated"]=`${n.opacityElevated}%`,s["--glass-stroke-only"]=n.strokeOnly?"1":"0",s["--glass-stroke-width"]=n.strokeWidth?`${n.strokeWidth}px`:"0px",s["--glass-stroke-color"]=n.strokeColor||"transparent",s["--glass-ribbon-mode"]=n.ribbonMode?"1":"0",s["--glass-ribbon-border-width"]=n.ribbonBorderWidth?`${n.ribbonBorderWidth}px`:"0px",s["--glass-ribbon-border-color"]=n.ribbonBorderColor||"transparent",s["--sidebar-tint"]=e.surfaces.sidebar.tint,s["--tooltip-bg"]=e.colors.bg.surface,s["--hover-tint"]=`rgba(${ee(e.colors.accent.primary)}, 0.08)`,s["--shadow-tint"]=`rgba(${ee(e.colors.accent.primary)}, 0.35)`,s["--bg-body"]=e.colors.bg.body,s["--bg-surface"]=e.colors.bg.surface,s["--bg-elevated"]=e.colors.bg.elevated,s["--bg-subtle"]=e.colors.bg.subtle,s["--border-subtle"]=e.colors.border.subtle,s["--border-strong"]=e.colors.border.strong,s["--text-primary"]=e.colors.text.primary,s["--text-secondary"]=e.colors.text.secondary,s["--text-muted"]=e.colors.text.muted,s["--text-invert"]=e.colors.text.inverse,s["--accent-primary"]=e.colors.accent.primary,s["--accent-secondary"]=e.colors.accent.secondary,s["--accent-tertiary"]=e.colors.accent.tertiary,s["--accent-success"]=e.colors.accent.success,s["--accent-danger"]=e.colors.accent.danger,s["--signal-excellent"]=e.colors.signal.excellent,s["--signal-good"]=e.colors.signal.good,s["--signal-fair"]=e.colors.signal.fair,s["--signal-poor"]=e.colors.signal.poor,s["--signal-critical"]=e.colors.signal.critical,s["--signal-unknown"]=e.colors.signal.unknown,s["--sparkline-excellent"]=e.colors.signal.excellent,s["--sparkline-good"]=e.colors.signal.good,s["--sparkline-fair"]=e.colors.signal.fair,s["--sparkline-poor"]=e.colors.signal.poor,s["--sparkline-critical"]=e.colors.signal.critical,s["--status-success"]=e.colors.status.success,s["--status-warning"]=e.colors.status.warning,s["--status-danger"]=e.colors.status.danger,s["--status-info"]=e.colors.status.info,s["--status-muted"]=e.colors.status.muted;const a=e.colors.chart;s["--pkt-advert"]=e.colors.accent.secondary,s["--pkt-flood"]=e.colors.accent.tertiary,s["--pkt-txt-msg"]=e.colors.accent.success,s["--pkt-ack"]=a.c8,s["--pkt-trace"]=a.c3,s["--pkt-req"]=a.c2,s["--pkt-response"]=a.c5,s["--pkt-grp-txt"]=e.colors.map.room,s["--pkt-grp-data"]=e.colors.accent.danger,s["--pkt-path"]=a.c3,s["--pkt-anon"]=e.colors.accent.secondary,s["--pkt-unknown"]=e.colors.status.muted,s["--route-flood"]=e.colors.accent.primary,s["--route-direct"]=e.colors.accent.secondary,s["--route-transport"]=a.c8,s["--chart-1"]=a.c1,s["--chart-2"]=a.c2,s["--chart-3"]=a.c3,s["--chart-4"]=a.c4,s["--chart-5"]=a.c5,s["--chart-6"]=a.c6,s["--chart-7"]=a.c7,s["--chart-8"]=a.c8,s["--chart-grid"]=a.grid,s["--chart-axis-tick"]=a.axis,s["--chart-cursor"]=a.cursor,s["--metric-received"]=e.colors.metric.received,s["--metric-forwarded"]=e.colors.metric.forwarded,s["--metric-transmitted"]=e.colors.metric.transmitted,s["--metric-dropped"]=e.colors.metric.dropped,s["--metric-neutral"]=e.colors.text.secondary,s["--log-debug"]=e.colors.status.muted,s["--log-info"]=e.colors.status.info,s["--log-warning"]=e.colors.status.warning,s["--log-error"]=e.colors.accent.danger,s["--log-critical"]=e.colors.accent.danger;const r=e.colors.map;s["--map-node-fill"]="#3B82F6",s["--map-node-stroke"]="rgba(255,255,255,0.9)",s["--map-hub-color"]="#8E4EC6",s["--map-hub-stroke"]="rgba(255,255,255,0.9)",s["--map-gateway-color"]="#5B5BD6",s["--map-gateway-stroke"]="rgba(255,255,255,0.85)",s["--map-local-color"]="#FFB224",s["--map-neighbor-color"]="#FFB224",s["--map-neighbor-stroke"]="rgba(0,0,0,0.4)",s["--map-mobile-color"]="#F76B15",s["--map-room-color"]="#D6409F",s["--map-ghost-color"]="#00A2C7",s["--map-edge-rest"]=r.edge,s["--map-edge-rest-bright"]=e.colors.border.strong,s["--map-edge-rest-dim"]=e.colors.bg.subtle,s["--map-edge-hover-direct"]=r.edgeHover,s["--map-edge-hover-loop"]="#8E4EC6",s["--map-edge-hover-standard"]=e.colors.text.muted,s["--map-edge-hover-neighbor"]="#FFB224",s["--link-strong"]=e.colors.accent.success,s["--link-medium"]=e.colors.accent.secondary,s["--link-weak"]=e.colors.accent.danger,s["--hop-0"]=e.colors.accent.tertiary,s["--hop-1"]=e.colors.accent.success,s["--hop-2"]=a.c3,s["--hop-3"]=e.colors.accent.secondary,s["--hop-distant"]=e.colors.text.muted,s["--hop-hub"]=r.local;const o=e.colors.icon;s["--icon-page-title"]=(null==o?void 0:o.pageTitle)??e.colors.accent.primary,s["--icon-card-title"]=(null==o?void 0:o.cardTitle)??e.colors.accent.primary,s["--icon-widget"]=(null==o?void 0:o.widget)??e.colors.text.secondary,s["--icon-action"]=(null==o?void 0:o.action)??e.colors.text.secondary,s["--icon-nav"]=(null==o?void 0:o.nav)??e.colors.text.muted,s["--icon-nav-active"]=(null==o?void 0:o.navActive)??e.colors.accent.primary,s["--toggle-on"]=e.colors.accent.success,s["--toggle-off"]=e.colors.bg.elevated;const i=e.colors.sidebar;s["--sidebar-bg"]=(null==i?void 0:i.bg)??"transparent",s["--sidebar-nav-hover-bg"]=(null==i?void 0:i.navHoverBg)??"rgba(255, 255, 255, 0.05)",s["--sidebar-nav-active-bg"]=(null==i?void 0:i.navActiveBg)??`color-mix(in srgb, ${e.colors.accent.primary} 15%, transparent)`,s["--sidebar-nav-active-text"]=(null==i?void 0:i.navActiveText)??e.colors.accent.primary;const l=e.meta.isDark;s["--data-box-bg"]=l?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.03)",s["--data-box-border"]=l?"rgba(255, 255, 255, 0.06)":"rgba(0, 0, 0, 0.08)",s["--subtle-fill"]=l?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.03)",s["--subtle-fill-hover"]=l?"rgba(255, 255, 255, 0.06)":"rgba(0, 0, 0, 0.05)",s["--subtle-fill-strong"]=l?"rgba(255, 255, 255, 0.08)":"rgba(0, 0, 0, 0.06)",s["--color-pill-bg"]=l?"rgba(0, 0, 0, 0.3)":"rgba(255, 255, 255, 0.3)",s["--terminal-bg"]=l?"rgba(0, 0, 0, 0.4)":"rgba(0, 0, 0, 0.03)",s["--terminal-bg-input"]=l?"rgba(0, 0, 0, 0.5)":"rgba(0, 0, 0, 0.05)",s["--terminal-bg-status"]=l?"rgba(0, 0, 0, 0.3)":"rgba(0, 0, 0, 0.02)",s["--terminal-border"]=l?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.08)",s["--terminal-autocomplete-bg"]=l?"rgba(0, 0, 0, 0.8)":"rgba(255, 255, 255, 0.95)",s["--terminal-autocomplete-border"]=l?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.15)",s["--terminal-autocomplete-hover"]=l?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.05)",s["--livedot-idle"]=l?"#666677":"#999999",s["--ctrl-panel-top"]=l?"rgba(30, 30, 30, 0.95)":"rgba(240, 240, 240, 0.95)",s["--ctrl-panel-mid"]=l?"rgba(25, 25, 25, 0.95)":"rgba(235, 235, 235, 0.95)",s["--ctrl-panel-bottom"]=l?"rgba(20, 20, 20, 0.95)":"rgba(230, 230, 230, 0.95)",s["--ctrl-panel-border"]=l?"rgba(60, 60, 60, 1)":"rgba(200, 200, 200, 1)",s["--chart-grid-line"]=l?"rgba(255, 255, 255, 0.06)":"rgba(0, 0, 0, 0.08)",s["--map-control-active-amber"]=l?"rgba(251, 191, 36, 0.15)":"rgba(217, 119, 6, 0.12)",s["--map-control-active-sky"]=l?"rgba(56, 189, 248, 0.15)":"rgba(14, 165, 233, 0.12)",s["--map-control-active-teal"]=l?"rgba(45, 212, 191, 0.15)":"rgba(20, 184, 166, 0.12)",s["--sidebar-action-active-green"]=l?"rgba(10, 26, 10, 1)":"rgba(220, 252, 231, 1)",s["--sidebar-action-active-teal"]=l?"rgba(10, 36, 32, 1)":"rgba(204, 251, 241, 1)",s["--sidebar-action-active-amber"]=l?"rgba(26, 20, 8, 1)":"rgba(254, 243, 199, 1)",s["--thumbnail-brightness"]=l?"1.5":"1.8",s["--font-title"]=e.typography.font.title,s["--font-display"]=e.typography.font.display,s["--font-data"]=e.typography.font.mono,s["--font-card-title"]=e.typography.font.cardTitle??e.typography.font.display,s["--font-badge"]=e.typography.font.badge??e.typography.font.display,s["--font-normal"]=String(e.typography.weight.normal),s["--font-medium"]=String(e.typography.weight.medium),s["--font-semibold"]=String(e.typography.weight.semibold),s["--font-bold"]=String(e.typography.weight.bold),s["--font-card-title-weight"]=String(e.typography.weight.cardTitle??e.typography.weight.semibold),s["--font-badge-weight"]=String(e.typography.weight.badge??e.typography.weight.medium),s["--badge-text-transform"]=(null==(t=e.typography.badge)?void 0:t.textTransform)??"none";const c=e.typography.size;c.xxl&&(s["--text-2xl"]=c.xxl),c.xl&&(s["--text-xl"]=c.xl),c.lg&&(s["--text-lg"]=c.lg),c.md&&(s["--text-md"]=c.md),c.base&&(s["--text-base"]=c.base),c.sm&&(s["--text-sm"]=c.sm),c.xs&&(s["--text-xs"]=c.xs),c.hero&&(s["--text-5xl"]=c.hero),c.cardTitle&&(s["--text-card-title"]=c.cardTitle);const u=e.typography.tracking;return u&&(s["--tracking-tight"]=u.tight,s["--tracking-normal"]=u.normal,s["--tracking-wide"]=u.wide),s["--theme-transition"]=`${e.motion.slow} ${e.motion.easing}`,function(e){if(!K())return e;const t={},s=/^#[0-9A-Fa-f]{3,6}$/;for(const[n,a]of Object.entries(e))t[n]=s.test(a)?V(a):a;return t}(s)}(e),s=document.documentElement;for(const[n,a]of Object.entries(t))s.style.setProperty(n,a);e.surfaces.glass.strokeOnly?s.classList.add("stroke-only"):s.classList.remove("stroke-only"),e.surfaces.glass.ribbonMode?s.classList.add("ribbon-mode"):s.classList.remove("ribbon-mode"),e.surfaces.glass.catalystMode?s.classList.add("catalyst-mode"):s.classList.remove("catalyst-mode")}(t),document.documentElement.dataset.colorScheme=e}function wr({children:e}){const[t,a]=s.useState(()=>function(){if("undefined"==typeof window)return Qe;try{let s=localStorage.getItem(Ze),n=localStorage.getItem(et);const a=localStorage.getItem(tt);if(!s&&!n){const e=localStorage.getItem(st);if(e){const t=Xe.find(t=>t.id===e);t&&(s=t.colorScheme,n=t.backgroundImage,localStorage.setItem(Ze,s),localStorage.setItem(et,n),localStorage.removeItem(st))}}const r=s&&"string"==typeof(t=s)&&Ve.some(e=>e.id===t)?s:Qe.colorScheme;let o=Qe.backgroundImage;""===n?o="":n&&"string"==typeof(e=n)&&Ke.some(t=>t.src===e)&&(o=n);let i=Qe.brightness;if(a){const e=parseInt(a,10);!isNaN(e)&&e>=0&&e<=100&&(i=e)}return{colorScheme:r,backgroundImage:o,brightness:i}}catch{return Qe}var e,t}()),r=s.useRef(!1),o=s.useRef(null),[i,l]=s.useState(null);s.useEffect(()=>{o.current&&(clearTimeout(o.current),o.current=null),r.current&&(l("#808080"),o.current=setTimeout(()=>{l(null),o.current=null},1800)),r.current=!0,xr(t.colorScheme),gr.clear(),requestAnimationFrame(()=>{!function(){if("undefined"==typeof window)return;for(const t of ot){const e=ht(`--palette-${t}-bright`),s=ht(`--palette-${t}`),n=e||s;if(!n)continue;const a=dt(n);for(const r of rt)mt(`--palette-${t}-${r}`,a[r])}const e=ht("--palette-bg-4");if(e){const t=dt(e);for(const e of rt)mt(`--palette-neutral-${e}`,t[e])}}()})},[t.colorScheme]),s.useEffect(()=>{!function(e){if("undefined"!=typeof window)try{localStorage.setItem(Ze,e.colorScheme),localStorage.setItem(et,e.backgroundImage),localStorage.setItem(tt,String(e.brightness))}catch{}}(t)},[t]),s.useEffect(()=>{Ke.forEach(e=>{(new Image).src=e.src})},[]);const c=s.useCallback(e=>{a(t=>({...t,colorScheme:e}))},[]),u=s.useCallback(e=>{const t=Ke.find(t=>t.src===e);a(s=>({...s,backgroundImage:e,brightness:(null==t?void 0:t.suggestedBrightness)??s.brightness}))},[]),d=s.useCallback(e=>{const t=Math.max(0,Math.min(100,Math.round(e)));a(e=>({...e,brightness:t}))},[]),h=s.useCallback(e=>{const t=Xe.find(t=>t.id===e);if(t){const e=!t.backgroundImage,s=e?null:Ke.find(e=>e.src===t.backgroundImage);a(n=>({...n,colorScheme:t.colorScheme,backgroundImage:t.backgroundImage,brightness:e?100:(null==s?void 0:s.suggestedBrightness)??n.brightness}))}},[]),m=s.useMemo(()=>({theme:t,setColorScheme:c,setBackgroundImage:u,setBrightness:d,setThemePreset:h}),[t,c,u,d,h]);return n.jsxs(yr.Provider,{value:m,children:[e,i&&n.jsx("div",{className:"fixed inset-0 pointer-events-none z-[9999]",style:{backgroundColor:i,animation:"theme-crossfade 1.8s ease-out forwards"}},t.colorScheme),n.jsx("style",{children:"\n @keyframes theme-crossfade {\n from { opacity: 0.35; }\n to { opacity: 0; }\n }\n "})]})}function vr(){const e=s.useContext(yr);if(!e)throw new Error("useTheme must be used within a ThemeProvider. Wrap your app with in App.tsx.");return e}const kr=s.forwardRef(function(e,t){const{href:s,...o}=e;return s.startsWith("http://")||s.startsWith("https://")||s.startsWith("//")?n.jsx(a,{children:n.jsx("a",{...o,href:s,ref:t})}):n.jsx(a,{children:n.jsx(r,{...o,to:s,ref:t})})}),Sr={0:"REQ",1:"RESPONSE",2:"TXT_MSG",3:"ACK",4:"ADVERT",5:"GRP_TXT",6:"GRP_DATA",7:"ANON_REQ",8:"PATH",9:"TRACE",10:"MULTIPART",15:"RAW_CUSTOM"},Cr={0:"T_FLOOD",1:"FLOOD",2:"DIRECT",3:"T_DIRECT"},jr={REQ:0,RESPONSE:1,TXT_MSG:2,ACK:3,ADVERT:4,GRP_TXT:5,GRP_DATA:6,ANON_REQ:7,PATH:8,TRACE:9,MULTIPART:10,RAW_CUSTOM:15};function Tr(e){return 1===e||0===e}function Mr(e){return null==e?"UNKNOWN":Sr[e]||`TYPE_${e}`}function Lr(e){return null==e?"UNKNOWN":Cr[e]||`ROUTE_${e}`}function Nr(e,t){return(Math.max(e,t)+.05)/(Math.min(e,t)+.05)}function _r(e){const t=function(e){const t=e.replace("#",""),s=parseInt(t.slice(0,2),16)/255,n=parseInt(t.slice(2,4),16)/255,a=parseInt(t.slice(4,6),16)/255,r=e=>e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4);return.2126*r(s)+.7152*r(n)+.0722*r(a)}(e);return Nr(t,1)>Nr(t,0)?"light":"dark"}function Er(e){return 1===e||!0===e}const Pr=J("inline-flex items-center gap-1","rounded-md px-1.5 py-0.5","text-xs"),Dr={fontFamily:"var(--font-badge)",fontWeight:"var(--font-badge-weight)",textTransform:"var(--badge-text-transform, none)"},Ir={red:"var(--sys-red)",orange:"var(--sys-orange)",amber:"var(--sys-amber)",yellow:"var(--sys-yellow)",lime:"var(--sys-green)",green:"var(--sys-green)",emerald:"var(--sys-green)",teal:"var(--sys-teal)",cyan:"var(--sys-cyan)",sky:"var(--sys-cyan)",blue:"var(--sys-blue)",indigo:"var(--sys-indigo)",violet:"var(--sys-indigo)",purple:"var(--sys-purple)",fuchsia:"var(--sys-pink)",pink:"var(--sys-pink)",rose:"var(--sys-red)",brown:"var(--sys-brown)",zinc:"var(--text-muted)"};function Fr(e){if(!e.startsWith("var("))return e;if("undefined"!=typeof window){const t=e.match(/var\((--[^,)]+)/);if(t){const e=getComputedStyle(document.documentElement).getPropertyValue(t[1]).trim();if(e&&e.startsWith("#"))return e}}return"#666666"}function Ar({color:e="zinc",customColor:t,filled:a=!1,compact:r=!1,className:o,title:i,children:l}){const c=s.useMemo(()=>{const s=t??Ir[e];if(a){if(t){const e=_r(Fr(t));return{backgroundColor:t,color:"light"===e?"rgba(255,255,255,0.95)":"rgba(0,0,0,0.85)"}}return{backgroundColor:s,color:["amber","yellow","lime"].includes(e)?"rgba(0,0,0,0.85)":"rgba(255,255,255,0.95)"}}return{backgroundColor:`color-mix(in srgb, ${s} 15%, transparent)`,color:s}},[e,t,a]);return n.jsx("span",{className:J(Pr,r&&"!px-1 !py-0 !text-[10px]",o),style:{...Dr,...c},title:i,children:l})}const Rr=s.forwardRef(function({color:e="zinc",customColor:t,filled:a=!1,compact:r=!1,className:i,children:l,...c},u){const d=s.useMemo(()=>{const s=t??Ir[e];if(a){if(t){const e=_r(Fr(t));return{backgroundColor:t,color:"light"===e?"rgba(255,255,255,0.95)":"rgba(0,0,0,0.85)"}}return{backgroundColor:s,color:["amber","yellow","lime"].includes(e)?"rgba(0,0,0,0.85)":"rgba(255,255,255,0.95)"}}return{backgroundColor:`color-mix(in srgb, ${s} 15%, transparent)`,color:s}},[e,t,a]),h=J(Pr,r&&"!px-1 !py-0 !text-[10px]","cursor-pointer transition-opacity hover:opacity-80",i);return"href"in c&&void 0!==c.href?n.jsx(kr,{...c,ref:u,className:h,style:{...Dr,...d},children:l}):n.jsx(o,{...c,ref:u,className:h,style:{...Dr,...d},children:l})}),zr=J("relative inline-flex items-center justify-center gap-2","text-sm font-medium whitespace-nowrap","rounded-lg px-3 py-1.5","focus:outline-none focus-visible:ring-2 focus-visible:ring-accent-primary/50 focus-visible:ring-offset-1 focus-visible:ring-offset-bg-body","disabled:opacity-50 disabled:cursor-not-allowed","transition-all duration-150","[&>[data-slot=icon]]:w-4 [&>[data-slot=icon]]:h-4 [&>[data-slot=icon]]:shrink-0"),Br={primary:J("bg-accent-primary text-white","hover:bg-accent-primary/90","active:bg-accent-primary/80","border border-accent-primary/20"),success:J("bg-accent-success text-white","hover:bg-accent-success/90","active:bg-accent-success/80","border border-accent-success/20"),danger:J("bg-accent-danger text-white","hover:bg-accent-danger/90","active:bg-accent-danger/80","border border-accent-danger/20"),warning:J("bg-accent-secondary text-bg-body","hover:bg-accent-secondary/90","active:bg-accent-secondary/80","border border-accent-secondary/20"),muted:J("bg-bg-elevated text-text-primary","hover:bg-bg-subtle","active:bg-bg-elevated","border border-border-subtle")},Or={primary:J("bg-transparent text-accent-primary","border border-accent-primary/30","hover:bg-accent-primary/10 hover:border-accent-primary/50","active:bg-accent-primary/20"),success:J("bg-transparent text-accent-success","border border-accent-success/30","hover:bg-accent-success/10 hover:border-accent-success/50","active:bg-accent-success/20"),danger:J("bg-transparent text-accent-danger","border border-accent-danger/30","hover:bg-accent-danger/10 hover:border-accent-danger/50","active:bg-accent-danger/20"),warning:J("bg-transparent text-accent-secondary","border border-accent-secondary/30","hover:bg-accent-secondary/10 hover:border-accent-secondary/50","active:bg-accent-secondary/20"),muted:J("bg-transparent text-text-muted","border border-border-subtle","hover:bg-bg-subtle hover:text-text-primary hover:border-border-strong","active:bg-bg-elevated")},$r={primary:J("bg-transparent text-accent-primary border-transparent","hover:bg-accent-primary/10","active:bg-accent-primary/20"),success:J("bg-transparent text-accent-success border-transparent","hover:bg-accent-success/10","active:bg-accent-success/20"),danger:J("bg-transparent text-accent-danger border-transparent","hover:bg-accent-danger/10","active:bg-accent-danger/20"),warning:J("bg-transparent text-accent-secondary border-transparent","hover:bg-accent-secondary/10","active:bg-accent-secondary/20"),muted:J("bg-transparent text-text-muted border-transparent","hover:bg-bg-subtle hover:text-text-primary","active:bg-bg-elevated")},Wr=s.forwardRef(function({color:e="muted",outline:t=!1,plain:s=!1,className:a,children:r,...i},l){const c=J(zr,s?$r[e]:t?Or[e]:Br[e],a);return"href"in i&&void 0!==i.href?n.jsx(kr,{...i,ref:l,className:c,children:r}):n.jsx(o,{...i,ref:l,className:c,children:r})}),Hr={duration:.15,ease:[.4,0,.2,1]},Ur={type:"tween",duration:.25,ease:[.4,0,.2,1]},qr={type:"tween",duration:.3,ease:[.4,0,.2,1]},Gr=s.createContext(!1);function Jr(){return s.useContext(Gr)}const Yr={xs:"sm:max-w-xs",sm:"sm:max-w-sm",md:"sm:max-w-md",lg:"sm:max-w-lg",xl:"sm:max-w-xl","2xl":"sm:max-w-2xl","3xl":"sm:max-w-3xl","4xl":"sm:max-w-4xl","5xl":"sm:max-w-5xl",full:"sm:max-w-[calc(100vw-2rem)]"};function Vr({open:e,onClose:t,size:a="md",className:r,children:o,bottomSheet:d=!0,motionPlus:h=!1}){const[m,f]=s.useState(!1),g=s.useRef(null);s.useEffect(()=>(g.current&&(clearTimeout(g.current),g.current=null),e?g.current=setTimeout(()=>{f(!0)},350):queueMicrotask(()=>f(!1)),()=>{g.current&&(clearTimeout(g.current),g.current=null)}),[e]);const p=s.useCallback((e,s)=>{(s.offset.y>100||s.velocity.y>500)&&t()},[t]),b=h?qr:Ur,y=h?.98:.99,x=d?8:4;return n.jsx(i,{mode:"wait",children:e&&n.jsxs(l,{static:!0,open:e,onClose:t,className:"relative z-[10010]",children:[n.jsx(c.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:Hr,className:"fixed inset-0 bg-black/50 backdrop-blur-sm","aria-hidden":"true"}),n.jsx("div",{className:"fixed inset-0 overflow-y-auto",children:n.jsx("div",{className:J("flex min-h-full justify-center",d?"items-end sm:items-center sm:p-4":"items-center p-4"),children:n.jsx(c.div,{drag:!!d&&"y",dragConstraints:{top:0,bottom:0},dragElastic:{top:0,bottom:.4},onDragEnd:p,initial:{opacity:0,scale:y,y:x},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.99,y:d?40:4},transition:b,style:{willChange:"transform, opacity"},className:J(d&&"w-full sm:w-auto"),children:n.jsx(u,{className:J("w-full bg-bg-surface shadow-2xl flex flex-col","ring-1 ring-inset ring-white/10",Yr[a],d?"rounded-t-2xl rounded-b-none sm:rounded-2xl pb-safe":"rounded-2xl",r),children:n.jsx(Gr.Provider,{value:m,children:o})})})})})]})})}function Kr({className:e,...t}){return n.jsx(d,{...t,className:J("text-base font-semibold text-text-primary sm:text-lg",e)})}function Xr({icon:e,title:t,onClose:s,className:a}){return n.jsxs("div",{className:J("flex items-center justify-between p-4 border-b border-border-subtle",a),children:[n.jsxs("div",{className:"flex items-center gap-3",children:[e&&n.jsx("div",{className:"p-2 rounded-lg bg-bg-subtle text-icon-card-title",children:e}),n.jsx(Kr,{children:t})]}),s&&n.jsx("button",{onClick:s,className:"p-2 rounded-lg text-text-muted hover:text-text-primary hover:bg-bg-subtle transition-colors","aria-label":"Close",children:n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})}function Qr({className:e,...t}){return n.jsx("div",{...t,className:J("p-4",e)})}function Zr({className:e,...t}){return n.jsx("div",{...t,className:J("flex flex-col-reverse gap-3 p-4 pt-0","sm:flex-row sm:justify-end","*:w-full sm:*:w-auto",e)})}const eo={snappy:{type:"spring",stiffness:500,damping:30},smooth:{type:"spring",stiffness:300,damping:30},gentle:{type:"spring",stiffness:200,damping:25}},to={easeIn:[.4,0,1,1],cubicInOut:[.65,0,.35,1]},so={normal:.05};function no({className:e,...t}){return n.jsx("nav",{...t,className:J(e,"flex h-full min-h-0 flex-col")})}function ao({className:e,...t}){return n.jsx("div",{...t,className:J(e,"flex flex-col border-b border-border-subtle p-4","[&>[data-slot=section]+[data-slot=section]]:mt-2.5")})}function ro({className:e,...t}){return n.jsx("div",{...t,className:J(e,"flex flex-1 flex-col overflow-y-auto p-3","[&>[data-slot=section]+[data-slot=section]]:mt-6")})}function oo({className:e,...t}){return n.jsx("div",{...t,className:J(e,"mt-auto flex flex-col border-t border-border-subtle","[&>[data-slot=section]+[data-slot=section]]:mt-2.5")})}function io({className:e,...t}){const a=s.useId();return n.jsx(h,{id:a,children:n.jsx("div",{...t,"data-slot":"section",className:J(e,"flex flex-col gap-0.5")})})}const lo=s.forwardRef(function(e,t){const{current:s,className:a,children:i,...l}=e,u=J("flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left","min-h-[44px]","text-sm font-medium","[&>svg]:w-5 [&>svg]:h-5 [&>svg]:flex-shrink-0",s?"bg-accent-primary/15 text-accent-primary [&>svg]:text-accent-primary":"text-text-muted hover:text-text-primary hover:bg-subtle-fill [&>svg]:text-text-muted hover:[&>svg]:text-text-primary","transition-all duration-150");return n.jsxs("span",{className:J(a,"relative"),children:[s&&n.jsx(c.span,{layoutId:"sidebar-current-indicator",className:"absolute inset-y-2 -left-3 w-0.5 rounded-full bg-accent-primary"}),"string"==typeof l.href?n.jsx(r,{to:l.href,onClick:l.onClick,onMouseEnter:l.onMouseEnter,onMouseLeave:l.onMouseLeave,className:u,"data-current":s?"true":void 0,ref:t,children:i}):n.jsx(o,{...l,className:J("cursor-default",u),"data-current":s?"true":void 0,ref:t,children:i})]})});function co({className:e,...t}){return n.jsx("span",{...t,className:J(e,"truncate")})}function uo({className:e,variant:t="default",...s}){return n.jsx("span",{...s,className:J("ml-auto flex items-center gap-1 px-1.5 py-0.5 rounded-full","text-xs font-medium",{default:"bg-bg-subtle text-text-muted",accent:"bg-accent-primary/20 text-accent-primary",success:"bg-accent-success/20 text-accent-success",warning:"bg-accent-secondary/20 text-accent-secondary",danger:"bg-accent-danger/20 text-accent-danger"}[t],e)})}const ho=s.createContext(null),mo={type:"spring",visualDuration:.35,bounce:.15};function fo({open:e,onClose:t,children:s}){return n.jsx(i,{children:e&&n.jsxs(l,{static:!0,open:e,onClose:t,className:"lg:hidden relative z-[10002]",children:[n.jsx(c.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.25,ease:"easeOut"},className:"fixed inset-0 bg-black/60 backdrop-blur-sm","aria-hidden":"true"}),n.jsx(c.div,{initial:{x:"-100%"},animate:{x:0},exit:{x:"-100%"},transition:mo,className:"fixed inset-y-0 left-0 w-72 max-w-[85vw] z-[10003]",children:n.jsx(u,{className:"h-full",children:n.jsxs("div",{className:"flex h-full flex-col sidebar-panel",children:[n.jsx("div",{className:"absolute top-4 right-4 z-10",children:n.jsx(f,{className:"p-2 rounded-lg text-text-muted hover:text-text-primary hover:bg-subtle-fill transition-colors","aria-label":"Close navigation",children:n.jsx(g,{className:"w-5 h-5"})})}),s]})})})]})})}function go({sidebar:e,navbar:t,children:a,className:r}){const[o,i]=s.useState(!1),l=()=>i(!0),c=()=>i(!1),u={isOpen:o,open:l,close:c,toggle:()=>i(e=>!e)};return n.jsx(ho.Provider,{value:u,children:n.jsxs("div",{className:"flex h-screen overflow-hidden bg-bg-body",children:[n.jsx("aside",{className:"hidden lg:flex flex-col w-64 flex-shrink-0 h-full relative sidebar-panel",children:e}),n.jsx(fo,{open:o,onClose:c,children:e}),n.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[n.jsx("header",{className:"lg:hidden sticky top-0 z-[10001] h-14 mobile-header",children:n.jsxs("div",{className:"flex items-center h-full px-4",children:[n.jsx("button",{onClick:l,className:"w-10 h-10 flex items-center justify-center rounded-lg hover:bg-subtle-fill active:bg-subtle-fill transition-colors mr-2","aria-label":"Open navigation",children:n.jsx(m,{className:"w-5 h-5 text-text-primary"})}),n.jsx("div",{className:"flex-1 min-w-0",children:t})]})}),n.jsx("main",{className:J("flex-1 overflow-y-auto main-content",r),children:a})]})]})})}function po({className:e,...t}){return n.jsx("nav",{...t,className:J(e,"flex flex-1 items-center gap-3")})}function bo({className:e,...t}){return n.jsx("div",{...t,className:J(e,"flex items-center gap-3")})}function yo({className:e,...t}){return n.jsx("div",{"aria-hidden":"true",...t,className:J(e,"flex-1")})}function xo({defaultOpen:e=!1,className:t,children:s}){return n.jsx(y,{defaultOpen:e,children:n.jsx("div",{className:J("flex flex-col",t),children:s})})}s.forwardRef(function({children:e,elevated:t,compact:s,noPadding:a,className:r,...o},i){return n.jsx("div",{ref:i,className:J("rounded-lg","bg-bg-surface","ring-1 ring-inset ring-border-subtle","h-full flex flex-col",t&&"bg-bg-elevated",!a&&(s?"p-3 sm:p-4":"p-4 sm:p-5"),r),...o,children:e})}),s.forwardRef(function({children:e,className:t,...s},a){return n.jsx("div",{ref:a,className:J("flex items-center justify-between gap-4","pb-4 mb-4","border-b border-border-subtle",t),...s,children:e})}),s.forwardRef(function({children:e,icon:t,className:s,...a},r){return n.jsxs("h3",{ref:r,className:J("flex items-center gap-2","text-base font-semibold text-text-primary",s),...a,children:[t&&n.jsx("span",{className:"text-icon-card-title w-5 h-5 flex-shrink-0",children:t}),e]})}),s.forwardRef(function({children:e,className:t,...s},a){return n.jsx("p",{ref:a,className:J("text-sm text-text-muted",t),...s,children:e})}),s.forwardRef(function({children:e,className:t,...s},a){return n.jsx("div",{ref:a,className:J("flex-1 min-h-0",t),...s,children:e})}),s.forwardRef(function({children:e,className:t,...s},a){return n.jsx("div",{ref:a,className:J("flex items-center justify-end gap-3","pt-4 mt-4","border-t border-border-subtle",t),...s,children:e})}),s.forwardRef(function({children:e,border:t,className:s,...a},r){return n.jsx("div",{ref:r,className:J(t&&"pt-4 mt-4 border-t border-border-subtle",s),...a,children:e})});const wo=s.forwardRef(function({className:e,icon:t,children:s,...a},r){return n.jsx(p,{ref:r,className:J("flex w-full items-center justify-between gap-3","px-3 py-2 rounded-lg","text-sm font-medium text-text-muted","hover:bg-bg-surface hover:text-text-primary","transition-colors duration-150","focus:outline-none focus-visible:ring-2 focus-visible:ring-accent-primary/50",e),...a,children:({open:e})=>n.jsxs(n.Fragment,{children:[s,n.jsx("span",{className:J("transition-transform duration-200",e?"rotate-180":"rotate-0"),children:t||n.jsx(b,{className:"w-4 h-4"})})]})})});function vo({direction:e="down",className:t,children:s}){const a={hidden:{height:0,opacity:0,y:"up"===e?8:-8},visible:{height:"auto",opacity:1,y:0}};return n.jsx(x,{static:!0,children:({open:r})=>n.jsx(i,{initial:!1,children:r&&n.jsx(c.div,{initial:"hidden",animate:"visible",exit:"hidden",variants:a,transition:{height:{duration:.2,ease:[.4,0,.2,1]},opacity:{duration:.15},y:{duration:.15}},className:J("overflow-hidden",t),children:n.jsx("div",{className:J("up"===e?"pb-2":"pt-2"),children:s})})})})}function ko({label:e,icon:t,defaultOpen:s=!0,direction:a="down",className:r,dataId:o,children:i}){const l=o?{[`data-${o}-disclosure`]:!0}:{};return n.jsx(xo,{defaultOpen:s,className:r,children:"up"===a?n.jsxs(n.Fragment,{children:[n.jsx(vo,{direction:"up",children:i}),n.jsx(wo,{...l,children:n.jsxs("span",{className:"flex items-center gap-3",children:[t,n.jsx("span",{className:"text-xs uppercase tracking-wide",children:e})]})})]}):n.jsxs(n.Fragment,{children:[n.jsx(wo,{...l,children:n.jsxs("span",{className:"flex items-center gap-3",children:[t,n.jsx("span",{className:"text-xs uppercase tracking-wide",children:e})]})}),n.jsx(vo,{direction:"down",children:i})]})})}const So="0.9.195",Co="'JetBrains Mono', monospace",jo=s.memo(function({height:e=16,responsive:t=!1,className:s=""}){const a="var(--accent-primary)",r="var(--text-primary)";if(t){const e=145,t=24;return n.jsxs("svg",{className:s,viewBox:`0 0 ${e} ${t}`,preserveAspectRatio:"xMidYMid meet",role:"img","aria-label":"pyMC:Console",style:{display:"block",width:"80%",height:"auto"},children:[n.jsx("style",{children:`\n .logo-text {\n font-family: ${Co};\n }\n .logo-accent {\n fill: var(--accent-primary, #719CDF);\n }\n .logo-main {\n fill: var(--text-primary, #FFFFFF);\n }\n `}),n.jsxs("text",{x:"0",y:"18",className:"logo-text",fontSize:"20",fontWeight:"400",letterSpacing:"-0.02em",children:[n.jsx("tspan",{className:"logo-accent",children:"py"}),n.jsx("tspan",{className:"logo-main",children:"MC"}),n.jsx("tspan",{className:"logo-accent",children:":"}),n.jsx("tspan",{className:"logo-main",children:"Console"})]})]})}const o="string"==typeof e?parseFloat(e):e,i={fontFamily:Co,fontSize:.8*o+"px",fontWeight:400,lineHeight:1,letterSpacing:"-0.02em",whiteSpace:"nowrap"};return n.jsxs("span",{className:s,style:i,role:"img","aria-label":"pyMC:Console",children:[n.jsx("span",{style:{color:a},children:"py"}),n.jsx("span",{style:{color:r},children:"MC"}),n.jsx("span",{style:{color:a},children:":"}),n.jsx("span",{style:{color:r},children:"Console"})]})}),To="pymc_jwt_token",Mo="pymc_client_id",Lo="pymc_remember_me",No=new Set;function _o(e){return No.add(e),()=>No.delete(e)}function Eo(e){for(const s of No)try{s(e)}catch(t){}}function Po(){let e=localStorage.getItem(Mo);return e||(e=`${Date.now()}-${Math.random().toString(36).substring(2,15)}`,localStorage.setItem(Mo,e)),e}function Do(){return"true"===localStorage.getItem(Lo)}function Io(e){e?localStorage.setItem(Lo,"true"):localStorage.removeItem(Lo)}function Fo(){return Do()?localStorage:sessionStorage}function Ao(){return Fo().getItem(To)||localStorage.getItem(To)||sessionStorage.getItem(To)}function Ro(e){Fo().setItem(To,e),Do()?sessionStorage.removeItem(To):localStorage.removeItem(To),Eo(e)}function zo(){localStorage.removeItem(To),sessionStorage.removeItem(To),Eo(null)}function Bo(){return!(!Ao()||$o()&&(zo(),1))}function Oo(e){try{const t=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),s=decodeURIComponent(atob(t).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join(""));return JSON.parse(s)}catch{return null}}function $o(){const e=Ao();if(!e)return!0;const t=Oo(e);return!t||!t.exp||Date.now()>=1e3*t.exp-6e4}function Wo(){const e=Ao();if(!e)return 0;const t=Oo(e);return t&&t.exp?Math.max(0,Math.floor((1e3*t.exp-Date.now())/1e3)):0}function Ho(){const e=Ao();if(!e)return!1;const t=Oo(e);if(!t||!t.exp)return!1;const s=1e3*t.exp-Date.now();return s>0&&s<3e5}function Uo(){const e=Ao();if(!e)return null;const t=Oo(e);return t&&t.sub?t.sub:null}async function qo(e,t,s=!1){Io(s);try{const s=await fetch("/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,password:t,client_id:Po()})}),n=s.headers.get("content-type");if(!n||!n.includes("application/json"))return{success:!1,error:`Server error: ${s.status}`};const a=await s.json();return a.success&&a.token?(Ro(a.token),{success:!0}):{success:!1,error:a.error||"Login failed"}}catch(n){return{success:!1,error:"Connection error. Please try again."}}}async function Go(){const e=Ao();if(!e)return!1;const t=Oo(e);(null==t?void 0:t.exp)&&Math.floor((1e3*t.exp-Date.now())/1e3);try{const t=await fetch("/auth/refresh",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`},body:JSON.stringify({client_id:Po()})});if(!t.ok){let e="";try{const s=await t.json();e=s.error||JSON.stringify(s)}catch{e=t.statusText}return!1}const s=await t.json();if(s.success&&s.token){Ro(s.token);const e=Oo(s.token);return(null==e?void 0:e.exp)&&Math.floor((1e3*e.exp-Date.now())/1e3),!0}return!1}catch(s){return!1}}let Jo=null;async function Yo(){const e=Ao();if(!e)return!1;const t=Oo(e);return(null==t?void 0:t.exp)&&Math.floor((1e3*t.exp-Date.now())/1e3),!Ho()||Jo||(Jo=Go().finally(()=>{Jo=null}),Jo)}function Vo(){zo()}let Ko=!1;function Xo(){if(Ko)return;if("undefined"==typeof document)return;const e=async()=>{if("visible"!==document.visibilityState)return;if(!Ao())return;if($o())return zo(),void("undefined"==typeof window||window.location.pathname.includes("/login")||(window.location.href="/login"));const e=Wo();e>0&&e<300&&await Go()};document.addEventListener("visibilitychange",e),Ko=!0,"visible"===document.visibilityState&&e()}const Qo=Object.freeze(Object.defineProperty({__proto__:null,clearToken:zo,getClientId:Po,getRememberMe:Do,getToken:Ao,getTokenTimeRemaining:Wo,getUsername:Uo,isAuthenticated:Bo,isTokenExpired:$o,login:qo,logout:Vo,onTokenChange:_o,parseJWT:Oo,refreshToken:Go,refreshTokenIfNeeded:Yo,setRememberMe:Io,setToken:Ro,shouldRefreshToken:Ho,startVisibilityBasedRefresh:Xo},Symbol.toStringTag,{value:"Module"})),Zo=new Map;let ei=!1;async function ti(e,t,s=!1){const n=function(e,t){return(null==t?void 0:t.method)&&"GET"!==t.method?"":e}(e,t);if(n){const e=Zo.get(n);if(e)return e}const a=`${e}`;!s&&Ho()&&await Go();const r=Ao();if(!r&&!e.includes("/auth/"))throw window.location.href="/login",new Error("Not authenticated");const o=r?{Authorization:`Bearer ${r}`}:{};if(null==t?void 0:t.headers){const e=t.headers;e instanceof Headers?e.forEach((e,t)=>{o[t]=e}):Array.isArray(e)?e.forEach(([e,t])=>{o[e]=t}):Object.assign(o,e)}(null==t?void 0:t.body)&&(o["Content-Type"]="application/json");const i=(async()=>{const n=await fetch(a,{...t,headers:o});if(401===n.status){if(!s&&!ei&&await Go())return ti(e,t,!0);throw ei||(ei=!0,zo(),window.location.replace("/login")),new Error("Session expired. Please log in again.")}if(!n.ok)throw new Error(`API error: ${n.status} ${n.statusText} (${e})`);return n.json()})();return n&&(Zo.set(n,i),i.finally(()=>{Zo.delete(n)})),i}const si={spreadingFactor:7,bandwidthHz:125e3,codingRate:5,preambleLength:8,crcEnabled:!0,explicitHeader:!0};function ni(e){if(e.raw_packet){const t=e.raw_packet;if(/^[0-9a-fA-F]+$/.test(t)&&t.length%2==0)return t.length/2;if(/^[A-Za-z0-9+/=]+$/.test(t)){const e=(t.match(/=+$/)||[""])[0].length;return Math.floor(3*t.length/4)-e}return t.length}if(e.length&&e.length>0)return e.length;if(e.payload_length&&e.payload_length>0)return e.payload_length;if(e.payload){const t=e.payload;return/^[0-9a-fA-F]+$/.test(t)&&t.length%2==0?t.length/2:t.length}return 32}function ai(e,t={}){return void 0!==e.airtime_ms&&e.airtime_ms>0?e.airtime_ms:function(e,t={}){const s=t.spreadingFactor??si.spreadingFactor,n=t.bandwidthHz??si.bandwidthHz,a=t.codingRate??si.codingRate,r=t.preambleLength??si.preambleLength??8,o=t.crcEnabled??si.crcEnabled?1:0,i=t.explicitHeader??si.explicitHeader?0:1,l=s>=11&&n<=125e3?1:0,c=n/1e3,u=Math.pow(2,s)/c,d=(r+4.25)*u,h=Math.max(8*e-4*s+28+16*o-20*i,0),m=4*(s-2*l);return d+(8+Math.ceil(h/m)*a)*u}(ni(e),t)}function ri(e){return e&&"chat node"===e.toLowerCase()?"Companion":e}async function oi(){return function(e){if(e.neighbors)for(const t of Object.values(e.neighbors))t.contact_type=ri(t.contact_type);return e}(await ti("/api/stats"))}async function ii(){return ti("/api/logs")}async function li(e=24){return ti(`/api/noise_floor_history?hours=${e}`)}const ci=new Map;function ui(e=!1){if(e)ci.clear();else for(const[t]of ci)parseInt(t.split("-")[0],10)<=60&&ci.delete(t)}function di(e,t,s,n){const a=60*e/t,r=Math.floor(Date.now()/1e3),o=Math.floor(r/a)*a,i=o-60*e,l=s.filter(e=>e.timestamp>=i&&e.timestamp<=o),c=n?function(e){var t;const s=null==(t=null==e?void 0:e.config)?void 0:t.radio;return{spreadingFactor:(null==s?void 0:s.spreading_factor)??si.spreadingFactor,bandwidthHz:(null==s?void 0:s.bandwidth)??si.bandwidthHz,codingRate:(null==s?void 0:s.coding_rate)??si.codingRate,preambleLength:(null==s?void 0:s.preamble_length)??si.preambleLength,crcEnabled:!0,explicitHeader:!0}}(n):si,u=function(e,t,s,n,a){const r=new Array(t),o=new Array(t),i=new Array(t),l=new Array(t),c=new Array(t),u=new Array(t),d=new Array(t);for(let m=0;m=t)continue;const g=ai(h,a),p=h.packet_origin;if("tx_local"===p?(i[f].count++,i[f].airtime_ms+=g):"tx_forward"===p||h.transmitted?(l[f].count++,l[f].airtime_ms+=g):h.drop_reason&&(c[f].count++,c[f].airtime_ms+=g),"tx_local"!==p){r[f].count++,r[f].airtime_ms+=g,u[f].snr+=h.snr||0,u[f].rssi+=h.rssi||0,u[f].count++;const e=h.packet_hash;e&&!d[f].has(e)&&(d[f].add(e),o[f].count++,o[f].airtime_ms+=g)}}for(let m=0;m0&&(r[m].avg_snr=u[m].snr/u[m].count,r[m].avg_rssi=u[m].rssi/u[m].count);return{received:r,unique_received:o,transmitted:i,forwarded:l,dropped:c}}(l,t,i,a,c);return{time_range_minutes:e,bucket_count:t,bucket_duration_seconds:a,start_time:i,end_time:o,...u}}async function hi(){return ti("/api/hardware_stats")}async function mi(){return ti("/api/hardware_processes")}async function fi(e){return ti("/api/update_radio_config",{method:"POST",body:JSON.stringify(e)})}async function gi(){return ti("/api/send_advert",{method:"POST",body:"{}"})}async function pi(e){return ti("/api/set_mode",{method:"POST",body:JSON.stringify({mode:e})})}async function bi(e){return ti("/api/set_duty_cycle",{method:"POST",body:JSON.stringify({enabled:e})})}async function yi(e){try{return await ti("/api/log_level",{method:"POST",body:JSON.stringify({level:e})})}catch(t){return{success:!1,error:t instanceof Error?t.message:"Unknown error"}}}const xi="pymc-packet-cache",wi="pymc-packet-cache-meta",vi=36e5,ki=2592e5,Si=6048e5,Ci=12096e5,ji=5e3,Ti=5e5,Mi=new class{constructor(){t(this,"packets",new Map),t(this,"sortedPackets",[]),t(this,"sortedDirty",!0),t(this,"meta",{oldestTimestamp:0,newestTimestamp:0,lastUpdated:0,packetCount:0,backgroundLoadComplete:!1,topologyLoadComplete:!1,dataTier:"24h",threeDayLoadComplete:!1,sevenDayLoadComplete:!1,fourteenDayLoadComplete:!1}),t(this,"isLoading",!1),t(this,"isBackgroundLoading",!1),t(this,"isTopologyLoading",!1),t(this,"listeners",new Set),t(this,"loadProgress",null),t(this,"statusMessage",""),this.loadFromStorage()}subscribe(e){return this.listeners.add(e),e(this.getState()),()=>this.listeners.delete(e)}getState(){return{isLoading:this.isLoading,isBackgroundLoading:this.isBackgroundLoading,isTopologyLoading:this.isTopologyLoading,backgroundLoadComplete:this.meta.backgroundLoadComplete,topologyLoadComplete:this.meta.topologyLoadComplete,packetCount:this.packets.size,statusMessage:this.statusMessage,loadProgress:this.loadProgress,dataTier:this.meta.dataTier,threeDayLoadComplete:this.meta.threeDayLoadComplete,sevenDayLoadComplete:this.meta.sevenDayLoadComplete,fourteenDayLoadComplete:this.meta.fourteenDayLoadComplete}}getDataTier(){return this.meta.dataTier}getPackets(){return this.sortedDirty&&(this.sortedPackets=Array.from(this.packets.values()).sort((e,t)=>(e.timestamp??0)-(t.timestamp??0)),this.sortedDirty=!1),this.sortedPackets}isStale(){return 0===this.packets.size||Date.now()-this.meta.lastUpdated>vi}isHeavyLoadInProgress(){return this.isBackgroundLoading||this.isTopologyLoading}async initialLoad(e){if(this.isStale()&&this.packets.size>0&&this.clear(),this.meta.backgroundLoadComplete&&this.packets.size>0)return this.getPackets();this.isLoading=!0;const t=Date.now(),s=Math.floor((t-864e5)/1e3),n=3e4;this.loadProgress={loaded:0,target:n,percent:0},this.statusMessage="Loading 24h history...",this.notifyListeners();try{let t;this.packets.size>0&&(this.packets.clear(),this.sortedPackets=[],this.sortedDirty=!0,this.meta.oldestTimestamp=0,this.meta.newestTimestamp=0);let a=0,r=0,o=0;const i=Math.ceil(100);for(let l=0;l0))break;{const n=this.packets.size;this.mergePackets(u.data);const o=this.packets.size-n;a+=o;const i=Math.min(...u.data.map(e=>e.timestamp??1/0));if(i!==1/0&&(void 0===t||i=2)break}else r=0;if(u.data.length=Ti)break}l=5){this.statusMessage="Connection issues, loaded partial data",this.notifyListeners();break}await this.delay(2e3)}}this.enforceMemoryCap(),this.meta.backgroundLoadComplete=!0,this.meta.dataTier="24h",this.loadProgress={loaded:this.packets.size,target:this.packets.size,percent:100},this.notifyListeners(),this.saveToStorage()}catch(a){this.statusMessage="Load failed"}finally{this.isLoading=!1,this.statusMessage="",this.loadProgress=null,this.notifyListeners()}return this.getPackets()}async quickLoad(){return this.initialLoad()}async backgroundLoad(){await this.initialLoad()}async loadThreeDays(e){this.meta.threeDayLoadComplete||this.isBackgroundLoading||await this.loadExtendedData("3d",ki,e)}async loadSevenDays(e){this.meta.sevenDayLoadComplete||this.isBackgroundLoading||(this.meta.threeDayLoadComplete||await this.loadThreeDays(e),await this.loadExtendedData("7d",Si,e))}async loadFourteenDays(e){this.meta.fourteenDayLoadComplete||this.isBackgroundLoading||(this.meta.sevenDayLoadComplete||await this.loadSevenDays(e),await this.loadExtendedData("14d",Ci,e))}async loadExtendedData(e,t,s){this.isBackgroundLoading=!0;const n=Date.now(),a=Math.floor((n-t)/1e3),r=3e4*("3d"===e?2:"7d"===e?4:7);this.loadProgress={loaded:0,target:r,percent:0},this.statusMessage=`Loading ${e} history...`,this.notifyListeners();try{let t=this.meta.oldestTimestamp||void 0,n=0,o=0,i=0;const l=Math.ceil(100);for(let u=0;u0))break;{const e=this.packets.size;this.mergePackets(d.data);const r=this.packets.size-e;n+=r;const i=Math.min(...d.data.map(e=>e.timestamp??1/0));if(i!==1/0&&(void 0===t||i=2)break}else o=0;if(d.data.length=Ti)break}u=5)break;await this.delay(2e3)}}this.enforceMemoryCap();const c=Date.now()-1e3*this.meta.oldestTimestamp;"3d"===e?(this.meta.threeDayLoadComplete=c>=ki,this.meta.threeDayLoadComplete&&(this.meta.dataTier="3d")):"7d"===e?(this.meta.sevenDayLoadComplete=c>=Si,this.meta.sevenDayLoadComplete&&(this.meta.dataTier="7d")):(this.meta.fourteenDayLoadComplete=c>=Ci,this.meta.fourteenDayLoadComplete&&(this.meta.dataTier="14d")),this.loadProgress={loaded:n,target:n,percent:100},this.notifyListeners(),this.saveToStorage()}catch(o){this.statusMessage=`${e} load failed`}finally{this.isBackgroundLoading=!1,this.statusMessage="",this.loadProgress=null,this.notifyListeners()}}isDataTierAvailable(e){switch(e){case"24h":return this.meta.backgroundLoadComplete;case"3d":return this.meta.threeDayLoadComplete;case"7d":return this.meta.sevenDayLoadComplete;case"14d":return this.meta.fourteenDayLoadComplete;default:return!1}}async topologyLoad(){if(!this.meta.topologyLoadComplete&&!this.isTopologyLoading)return this.doTopologyLoad()}async forceTopologyLoad(){if(!this.isTopologyLoading)return this.meta.topologyLoadComplete=!1,this.doTopologyLoad()}async forceDeepLoad(){return this.forceTopologyLoad()}async doTopologyLoad(){this.isTopologyLoading=!0;const e=Date.now(),t=Math.floor((e-Ci)/1e3),s=42e4;this.statusMessage="Loading topology data...",this.loadProgress={loaded:this.packets.size,target:s,percent:0},this.notifyListeners();try{let e=this.meta.oldestTimestamp||void 0,n=0,a=0;const r=Math.ceil(100);for(let o=0;o0))break;{const s=this.packets.size;this.mergePackets(l.data);const a=this.packets.size-s,r=Math.min(...l.data.map(e=>e.timestamp??1/0));if(r!==1/0&&(void 0===e||r=2)break}else n=0;if(this.packets.size>=Ti)break}o=5)break;await this.delay(2e3)}}this.enforceMemoryCap(),this.statusMessage=`Processing ${this.packets.size.toLocaleString()} packets...`,this.loadProgress={loaded:this.packets.size,target:this.packets.size,percent:100},this.notifyListeners(),this.meta.topologyLoadComplete=!0,this.meta.threeDayLoadComplete=!0,this.meta.sevenDayLoadComplete=!0,this.meta.fourteenDayLoadComplete=!0,this.meta.dataTier="14d",this.saveToStorage()}catch(n){this.statusMessage="Load failed"}finally{this.isTopologyLoading=!1,this.statusMessage="",this.loadProgress=null,this.notifyListeners()}}async poll(){try{const e=await this.fetchRecentPackets(100);if(e.success&&e.data){const t=this.packets.size;this.mergePackets(e.data),this.packets.size>t&&(this.saveToStorage(),this.notifyListeners())}}catch(e){}return this.getPackets()}clear(){this.packets.clear(),this.sortedPackets=[],this.sortedDirty=!0,this.meta={oldestTimestamp:0,newestTimestamp:0,lastUpdated:0,packetCount:0,backgroundLoadComplete:!1,topologyLoadComplete:!1,dataTier:"24h",threeDayLoadComplete:!1,sevenDayLoadComplete:!1,fourteenDayLoadComplete:!1},this.clearStorage(),this.notifyListeners()}mergePacketsDirectly(e){const t=this.packets.size;this.mergePackets(e);const s=this.packets.size-t;return s>0&&(this.enforceMemoryCap(),this.saveToStorage(),this.notifyListeners()),s}mergePackets(e){let t=!1;for(const s of e){const e=s.packet_hash;if(!e)continue;const n=s.timestamp??0,a=`${e}:${n}`;this.packets.has(a)||(this.packets.set(a,s),t=!0),(0===this.meta.oldestTimestamp||nthis.meta.newestTimestamp&&(this.meta.newestTimestamp=n)}t&&(this.sortedDirty=!0),this.meta.lastUpdated=Date.now(),this.meta.packetCount=this.packets.size}notifyListeners(){const e=this.getState();for(const t of this.listeners)t(e)}delay(e){return new Promise(t=>setTimeout(t,e))}async fetchChunkWithRetry(e,t,s,n,a){for(let o=0;o<3;o++)try{return await this.fetchFilteredPackets(e,t,!1,a)}catch(r){const e=2===o,t=1e3*Math.pow(2,o);r instanceof Error&&r.name,e||(this.statusMessage=`Retry in ${Math.round(t/1e3)}s...`,this.notifyListeners(),await this.delay(t))}return null}enforceMemoryCap(){if(this.packets.size<=Ti)return;const e=this.getPackets(),t=e.length-Ti;for(let s=0;st&&(this.meta.oldestTimestamp=e[t].timestamp??0)}loadFromStorage(){if("undefined"!=typeof window)try{const e=localStorage.getItem(wi);e&&(this.meta=JSON.parse(e));const t=localStorage.getItem(xi);if(t){const e=JSON.parse(t);for(const t of e)t.packet_hash&&this.packets.set(t.packet_hash,t)}if(this.meta.lastUpdated>0&&Date.now()-this.meta.lastUpdated>vi)return void this.clear();this.meta.backgroundLoadComplete=!1,this.meta.threeDayLoadComplete=!1,this.meta.sevenDayLoadComplete=!1,this.meta.fourteenDayLoadComplete=!1,this.meta.dataTier="24h";const s=37500;this.meta.topologyLoadComplete&&this.packets.size3e3?e.slice(-3e3):e;localStorage.setItem(xi,JSON.stringify(t))}catch(e){if(e instanceof DOMException&&"QuotaExceededError"===e.name)try{localStorage.removeItem(xi),localStorage.setItem(wi,JSON.stringify(this.meta))}catch{}}}clearStorage(){if("undefined"!=typeof window)try{localStorage.removeItem(xi),localStorage.removeItem(wi)}catch(e){}}async fetchRecentPackets(e=1e3,t=!1){const s=`/api/recent_packets?limit=${e}`,{getToken:n}=await G(async()=>{const{getToken:e}=await Promise.resolve().then(()=>Qo);return{getToken:e}},void 0),a=n(),r={};a&&(r.Authorization=`Bearer ${a}`);const o=await fetch(s,{headers:r});if(401===o.status&&!t){const{refreshToken:t}=await G(async()=>{const{refreshToken:e}=await Promise.resolve().then(()=>Qo);return{refreshToken:e}},void 0);if(await t())return this.fetchRecentPackets(e,!0)}if(!o.ok)throw new Error(`API error: ${o.status}`);return o.json()}async fetchFilteredPackets(e,t=5e3,s=!1,n){const a=new URLSearchParams;a.set("limit",String(t)),void 0!==e&&a.set("end_timestamp",String(e-.001)),void 0!==n&&a.set("start_timestamp",String(n));const r=`/api/filtered_packets?${a}`,{getToken:o}=await G(async()=>{const{getToken:e}=await Promise.resolve().then(()=>Qo);return{getToken:e}},void 0),i=o(),l={};i&&(l.Authorization=`Bearer ${i}`);const c=new AbortController,u=setTimeout(()=>c.abort(),3e4);try{const n=await fetch(r,{headers:l,signal:c.signal});if(401===n.status&&!s){const{refreshToken:s}=await G(async()=>{const{refreshToken:e}=await Promise.resolve().then(()=>Qo);return{refreshToken:e}},void 0);if(await s())return this.fetchFilteredPackets(e,t,!0)}if(!n.ok)throw new Error(`API error: ${n.status}`);return n.json()}finally{clearTimeout(u)}}};function Li(e){return{paths:e.paths,byEndpoints:new Map(e.byEndpointsEntries),canonicalPaths:new Map(e.canonicalPathsEntries),totalObservations:e.totalObservations,uniquePathCount:e.uniquePathCount}}function Ni(){return{paths:[],byEndpoints:new Map,canonicalPaths:new Map,totalObservations:0,uniquePathCount:0}}const _i=new class{constructor(){t(this,"worker",null),t(this,"listeners",new Set),t(this,"currentTopology",{edges:[],validatedEdges:[],weakEdges:[],certainEdges:[],uncertainEdges:[],edgeMap:new Map,maxPacketCount:0,maxCertainCount:0,neighborAffinity:new Map,fullAffinity:new Map,localPrefix:null,centrality:new Map,hubNodes:[],gatewayNodes:[],loops:[],loopEdgeKeys:new Set,txDelayRecommendations:new Map,pathRegistry:Ni(),edgeBetweenness:new Map,backboneEdges:[],nodeMobility:new Map,mobileNodes:[],pathHealth:[],lastHopNeighbors:[],disambiguationStats:{totalPrefixes:0,unambiguousPrefixes:0,collisionPrefixes:0,collisionRate:0,avgConfidence:0,lowConfidencePrefixes:[],highCollisionPrefixes:[],totalResolutions:0},discoveredNodes:[],viterbiStats:{totalPaths:0,pathsWithGhosts:0,avgPathCost:0,avgPathConfidence:0,observationOverrideCount:0,tracePacketsProcessed:0,pathPacketsProcessed:0,distantEdgesDiscovered:0,duplicateGroupsFound:0,duplicatePathsUnique:0,echolocationEdgesInferred:0},nodeMetrics:new Map,communityCount:0,backboneNodes:[]}),t(this,"isComputing",!1),t(this,"pendingRequest",null),t(this,"debounceTimer",null),t(this,"debounceMs",100),this.initWorker()}initWorker(){if("undefined"!=typeof window)try{this.worker=new Worker(new URL("/assets/topology.worker-B6JO1dmH.js",import.meta.url),{type:"module"}),this.worker.onmessage=e=>{this.handleWorkerMessage(e.data)},this.worker.onerror=e=>{}}catch(e){}}handleWorkerMessage(e){if(this.isComputing=!1,"error"!==e.type){var t;this.currentTopology={edges:(t=e.payload).edges??[],validatedEdges:t.validatedEdges??[],weakEdges:t.weakEdges??[],certainEdges:t.certainEdges??[],uncertainEdges:t.uncertainEdges??[],maxPacketCount:t.maxPacketCount??0,maxCertainCount:t.maxCertainCount??0,localPrefix:t.localPrefix??null,hubNodes:t.hubNodes??[],gatewayNodes:t.gatewayNodes??[],edgeMap:new Map(t.edgeMapEntries??[]),neighborAffinity:new Map(t.neighborAffinityEntries??[]),fullAffinity:new Map(t.fullAffinityEntries??[]),centrality:new Map(t.centralityEntries??[]),loops:t.loops??[],loopEdgeKeys:new Set(t.loopEdgeKeyEntries??[]),txDelayRecommendations:new Map(t.txDelayRecommendationEntries??[]),pathRegistry:t.pathRegistry?Li(t.pathRegistry):Ni(),edgeBetweenness:new Map(t.edgeBetweennessEntries??[]),backboneEdges:t.backboneEdges??[],nodeMobility:new Map(t.nodeMobilityEntries??[]),mobileNodes:t.mobileNodes??[],pathHealth:t.pathHealth??[],lastHopNeighbors:t.lastHopNeighbors??[],disambiguationStats:t.disambiguationStats??{totalPrefixes:0,unambiguousPrefixes:0,collisionPrefixes:0,collisionRate:0,avgConfidence:0,lowConfidencePrefixes:[],highCollisionPrefixes:[],totalResolutions:0},discoveredNodes:t.discoveredNodes??[],viterbiStats:t.viterbiStats??{totalPaths:0,pathsWithGhosts:0,avgPathCost:0,avgPathConfidence:0,observationOverrideCount:0,tracePacketsProcessed:0,pathPacketsProcessed:0,distantEdgesDiscovered:0,duplicateGroupsFound:0,duplicatePathsUnique:0,echolocationEdgesInferred:0},nodeMetrics:new Map(t.nodeMetricsEntries??[]),communityCount:t.communityCount??0,backboneNodes:t.backboneNodes??[]};for(const t of this.listeners)try{t(this.currentTopology,e.computeTimeMs)}catch(s){}if(this.pendingRequest){const e=this.pendingRequest;this.pendingRequest=null,this.computeInternal(e)}}}computeInternal(e){if(!this.worker)return;this.isComputing=!0;const t={type:"compute",payload:e};this.worker.postMessage(t)}compute(e,t,s,n,a,r,o,i){const l={packets:e,neighbors:t,localHash:s,localLat:n,localLon:a,airtimeMs:r,zeroHopNeighbors:o,terrainGrid:i,enableTerrainAware:void 0!==i};this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(()=>{this.debounceTimer=null,this.isComputing?this.pendingRequest=l:this.computeInternal(l)},this.debounceMs)}subscribe(e){return this.listeners.add(e),this.currentTopology.edges.length>0&&e(this.currentTopology,0),()=>{this.listeners.delete(e)}}getTopology(){return this.currentTopology}isWorking(){return this.isComputing}terminate(){this.debounceTimer&&clearTimeout(this.debounceTimer),this.worker&&(this.worker.terminate(),this.worker=null),this.listeners.clear()}},Ei=new class{constructor(){t(this,"worker",null),t(this,"listeners",new Set),t(this,"sparklines",new Map),t(this,"isComputing",!1),t(this,"lastComputeTimeMs",0),t(this,"pendingRequest",null),t(this,"debounceTimer",null),t(this,"debounceMs",150),this.initWorker()}initWorker(){if("undefined"!=typeof window)try{this.worker=new Worker(new URL("/assets/sparkline.worker-CmKhBAy5.js",import.meta.url),{type:"module"}),this.worker.onmessage=e=>{this.handleWorkerMessage(e.data)},this.worker.onerror=e=>{this.isComputing=!1,this.notifyListeners()}}catch(e){}}handleWorkerMessage(e){if(this.isComputing=!1,"error"!==e.type){if(this.sparklines=new Map(e.payload.sparklineEntries),this.lastComputeTimeMs=e.computeTimeMs,this.notifyListeners(),this.pendingRequest){const e=this.pendingRequest;this.pendingRequest=null,this.computeInternal(e.packets,e.nodeHashes)}}else this.notifyListeners()}computeInternal(e,t){if(!this.worker)return;if(0===t.length)return this.isComputing=!1,void this.notifyListeners();this.isComputing=!0,this.notifyListeners();const s={type:"compute",payload:{packets:e,nodeHashes:t}};this.worker.postMessage(s)}notifyListeners(){for(const t of this.listeners)try{t(this.sparklines,this.isComputing)}catch(e){}}compute(e,t){this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(()=>{this.debounceTimer=null,this.isComputing?this.pendingRequest={packets:e,nodeHashes:t}:this.computeInternal(e,t)},this.debounceMs)}getSparkline(e){return this.sparklines.get(e)??[]}getAllSparklines(){return this.sparklines}hasSparkline(e){return this.sparklines.has(e)}isWorking(){return this.isComputing}getLastComputeTime(){return this.lastComputeTimeMs}subscribe(e){return this.listeners.add(e),e(this.sparklines,this.isComputing),()=>{this.listeners.delete(e)}}clear(){this.sparklines.clear(),this.notifyListeners()}terminate(){this.debounceTimer&&clearTimeout(this.debounceTimer),this.worker&&(this.worker.terminate(),this.worker=null),this.listeners.clear()}},Pi=new class{constructor(){t(this,"worker",null),t(this,"isInitialized",!1),t(this,"statsListeners",new Set),t(this,"packetsListeners",new Set),t(this,"errorListeners",new Set),t(this,"readyResolve",null),t(this,"readyPromise",null),t(this,"unsubscribeTokenChange",null)}async init(e){if(!this.isInitialized&&"undefined"!=typeof window){this.readyPromise=new Promise(e=>{this.readyResolve=e});try{this.worker=new Worker(new URL("/assets/polling.worker-DFp1Qyu0.js",import.meta.url),{type:"module"}),this.worker.onmessage=this.handleMessage.bind(this),this.worker.onerror=e=>{};const t={type:"init",config:{apiBaseUrl:e.apiBaseUrl,authToken:e.authToken,statsIntervalMs:e.statsIntervalMs??3e3,packetsIntervalMs:e.packetsIntervalMs??3e3}};this.worker.postMessage(t),this.isInitialized=!0,this.unsubscribeTokenChange=_o(e=>{this.setAuthToken(e)}),await this.readyPromise}catch(t){throw t}}}handleMessage(e){var t;const s=e.data;switch(s.type){case"ready":null==(t=this.readyResolve)||t.call(this);break;case"stats":for(const e of this.statsListeners)try{e(s.data,s.timestamp)}catch(n){}break;case"packets":for(const e of this.packetsListeners)try{e(s.newPackets,s.totalCount,s.newestTimestamp)}catch(n){}break;case"packetsReset":for(const e of this.packetsListeners)try{e([],0,s.newestTimestamp)}catch(n){}break;case"error":for(const e of this.errorListeners)try{e(s.source,s.error)}catch(n){}}}onStats(e){return this.statsListeners.add(e),()=>this.statsListeners.delete(e)}onPackets(e){return this.packetsListeners.add(e),()=>this.packetsListeners.delete(e)}onError(e){return this.errorListeners.add(e),()=>this.errorListeners.delete(e)}setAuthToken(e){if(!this.worker)return;const t={type:"setAuth",token:e};this.worker.postMessage(t)}setLiveMode(e){if(!this.worker)return;const t={type:"setLiveMode",enabled:e};this.worker.postMessage(t)}forceRefresh(){this.worker&&this.worker.postMessage({type:"forceRefresh"})}clearCache(){this.worker&&this.worker.postMessage({type:"clearCache"})}setTimeWindow(e){if(!this.worker)return;const t={type:"setTimeWindow",hours:e};this.worker.postMessage(t)}terminate(){if(this.unsubscribeTokenChange&&(this.unsubscribeTokenChange(),this.unsubscribeTokenChange=null),this.worker){const e={type:"stop"};this.worker.postMessage(e),this.worker.terminate(),this.worker=null}this.isInitialized=!1,this.statsListeners.clear(),this.packetsListeners.clear(),this.errorListeners.clear()}isReady(){return this.isInitialized}},Di=new class{constructor(){t(this,"ws",null),t(this,"connectionState","disconnected"),t(this,"reconnectAttempts",0),t(this,"pingIntervalId",null),t(this,"lastPongTime",Date.now()),t(this,"reconnectTimeoutId",null),t(this,"packetListeners",new Set),t(this,"statsListeners",new Set),t(this,"systemStatsListeners",new Set),t(this,"packetStatsListeners",new Set),t(this,"connectionListeners",new Set),t(this,"unsubscribeTokenChange",null),t(this,"wsSupported",!0)}buildWsUrl(){const e=Ao(),t=Po(),s=new URLSearchParams;e&&s.set("token",e),t&&s.set("client_id",t);const n=s.toString()?`?${s.toString()}`:"";return`${"https:"===window.location.protocol?"wss:":"ws:"}//${window.location.host}/ws/packets${n}`}connect(){var e,t;if((null==(e=this.ws)?void 0:e.readyState)!==WebSocket.OPEN&&(null==(t=this.ws)?void 0:t.readyState)!==WebSocket.CONNECTING&&this.wsSupported){this.setConnectionState("connecting");try{const e=this.buildWsUrl();this.ws=new WebSocket(e),this.ws.onopen=this.handleOpen.bind(this),this.ws.onmessage=this.handleMessage.bind(this),this.ws.onerror=this.handleError.bind(this),this.ws.onclose=this.handleClose.bind(this),this.unsubscribeTokenChange||(this.unsubscribeTokenChange=_o(e=>{e&&"connected"===this.connectionState&&(this.disconnect(),this.connect())}))}catch(s){this.wsSupported=!1,this.setConnectionState("disconnected")}}}disconnect(){this.clearPingInterval(),this.clearReconnectTimeout(),this.ws&&(this.ws.onopen=null,this.ws.onmessage=null,this.ws.onerror=null,this.ws.onclose=null,this.ws.readyState!==WebSocket.OPEN&&this.ws.readyState!==WebSocket.CONNECTING||this.ws.close(1e3,"Client disconnect"),this.ws=null),this.setConnectionState("disconnected"),this.reconnectAttempts=0}isConnected(){var e;return(null==(e=this.ws)?void 0:e.readyState)===WebSocket.OPEN}getConnectionState(){return this.connectionState}isSupported(){return this.wsSupported}send(e){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)return!1;try{return this.ws.send(JSON.stringify(e)),!0}catch(t){return!1}}onPacket(e){return this.packetListeners.add(e),()=>this.packetListeners.delete(e)}onStats(e){return this.statsListeners.add(e),()=>this.statsListeners.delete(e)}onSystemStats(e){return this.systemStatsListeners.add(e),()=>this.systemStatsListeners.delete(e)}onPacketStats(e){return this.packetStatsListeners.add(e),()=>this.packetStatsListeners.delete(e)}onConnectionChange(e){return this.connectionListeners.add(e),e(this.connectionState,this.reconnectAttempts),()=>this.connectionListeners.delete(e)}handleOpen(){this.setConnectionState("connected"),this.reconnectAttempts=0,this.lastPongTime=Date.now();const e=Ao();e&&this.ws&&this.ws.send(JSON.stringify({type:"auth",token:e})),this.startPingInterval()}handleMessage(e){try{const t=JSON.parse(e.data);switch(t.type){case"packet":this.notifyPacketListeners(t.data);break;case"stats":{const e=t.data;e&&"noise_floor_dbm"in e&&this.notifyStatsListeners(e),(null==e?void 0:e.packet_stats)&&this.notifyPacketStatsListeners(e.packet_stats),(null==e?void 0:e.system_stats)&&this.notifySystemStatsListeners(e.system_stats);break}case"packet_stats":{const e=t.data;this.notifyPacketStatsListeners(e);break}case"system_stats":this.notifySystemStatsListeners(t.data);break;case"ping":this.lastPongTime=Date.now(),this.send({type:"pong"});break;case"pong":this.lastPongTime=Date.now()}}catch(t){}}handleError(e){}handleClose(e){this.clearPingInterval(),1e3!==e.code?(1006===e.code&&this.reconnectAttempts,this.scheduleReconnect()):this.setConnectionState("disconnected")}setConnectionState(e){if(this.connectionState!==e){this.connectionState=e;for(const s of this.connectionListeners)try{s(e,this.reconnectAttempts)}catch(t){}}}notifyPacketListeners(e){for(const s of this.packetListeners)try{s(e)}catch(t){}}notifyStatsListeners(e){for(const s of this.statsListeners)try{s(e)}catch(t){}}notifySystemStatsListeners(e){for(const s of this.systemStatsListeners)try{s(e)}catch(t){}}notifyPacketStatsListeners(e){for(const s of this.packetStatsListeners)try{s(e)}catch(t){}}startPingInterval(){this.clearPingInterval(),this.pingIntervalId=setInterval(()=>{var e;(null==(e=this.ws)?void 0:e.readyState)===WebSocket.OPEN&&(this.send({type:"ping"}),Date.now()-this.lastPongTime>6e4&&(this.disconnect(),this.connect()))},3e4)}clearPingInterval(){this.pingIntervalId&&(clearInterval(this.pingIntervalId),this.pingIntervalId=null)}scheduleReconnect(){if(this.reconnectAttempts>=20)return this.wsSupported=!1,void this.setConnectionState("disconnected");this.setConnectionState("reconnecting");const e=Math.min(1e3*Math.pow(2,Math.min(this.reconnectAttempts,5)),3e4);this.reconnectAttempts++,this.reconnectTimeoutId=setTimeout(()=>{this.reconnectTimeoutId=null,this.connect()},e)}clearReconnectTimeout(){this.reconnectTimeoutId&&(clearTimeout(this.reconnectTimeoutId),this.reconnectTimeoutId=null)}terminate(){this.disconnect(),this.unsubscribeTokenChange&&(this.unsubscribeTokenChange(),this.unsubscribeTokenChange=null),this.packetListeners.clear(),this.statsListeners.clear(),this.systemStatsListeners.clear(),this.packetStatsListeners.clear(),this.connectionListeners.clear()}},Ii=3e4,Fi=new class{constructor(){t(this,"staged",new Map),t(this,"recentlyConfirmed",new Map),t(this,"listeners",new Set),t(this,"pruneIntervalId",null),this.startPruneInterval()}stage(e){const t=e.packet_hash;if(!t)return;if(this.staged.has(t))return;const s=this.recentlyConfirmed.get(t);s&&Date.now()-s=100&&this.removeOldest(),this.staged.set(t,{packet:e,stagedAt:Date.now()}),this.notifyListeners())}confirm(e){this.staged.delete(e)&&this.notifyListeners()}confirmBatch(e){let t=!1;const s=Date.now();for(const n of e)this.recentlyConfirmed.set(n,s),this.staged.delete(n)&&(t=!0);if(this.recentlyConfirmed.size>200){const e=s-Ii;for(const[t,s]of this.recentlyConfirmed)s(t.packet.timestamp??0)-(e.packet.timestamp??0))}isPending(e){return!!e&&this.staged.has(e)}getPendingCount(){return this.staged.size}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}clear(){this.staged.size>0&&(this.staged.clear(),this.notifyListeners())}terminate(){this.stopPruneInterval(),this.staged.clear(),this.listeners.clear()}notifyListeners(){const e=this.getPendingPackets();for(const s of this.listeners)try{s(e)}catch(t){}}pruneExpired(){const e=Date.now();let t=!1;for(const[s,n]of this.staged)e-n.stagedAt>Ii&&(this.staged.delete(s),t=!0);t&&this.notifyListeners()}removeOldest(){let e=null,t=1/0;for(const[s,n]of this.staged)n.stagedAtthis.pruneExpired(),1e4))}stopPruneInterval(){this.pruneIntervalId&&(clearInterval(this.pruneIntervalId),this.pruneIntervalId=null)}},Ai=w(e=>({connectionState:"disconnected",isSupported:!0,reconnectAttempt:0,lastConnected:null,initialize:()=>{Di.onConnectionChange((t,s)=>{e(e=>({connectionState:t,reconnectAttempt:s??0,isSupported:Di.isSupported(),lastConnected:"connected"===t?Date.now():e.lastConnected}))}),Di.connect()}})),Ri=.05,zi=1e3,Bi="terrarium";function Oi(e,t,s){try{return e.queryTerrainElevation({lng:t,lat:s})??0}catch{return 0}}const $i=w((e,t)=>({terrainGrid:null,isLoading:!1,error:null,lastLoadedAt:null,cachedBounds:null,terrainDisambiguationEnabled:!0,loadTerrain:async(s,n)=>{const a=t();if(!(a.isLoading||(r=a.cachedBounds,o=s,r&&r.minLat<=o.minLat&&r.maxLat>=o.maxLat&&r.minLng<=o.minLng&&r.maxLng>=o.maxLng))){var r,o;e({isLoading:!0,error:null});try{n.getTerrain()||(n.getSource(Bi)||(n.addSource(Bi,{type:"raster-dem",tiles:["https://s3.amazonaws.com/elevation-tiles-prod/terrarium/{z}/{x}/{y}.png"],encoding:"terrarium",tileSize:256}),await new Promise((e,t)=>{const s=setTimeout(()=>t(new Error("Terrain source load timeout")),1e4),a=t=>{t.sourceId===Bi&&t.isSourceLoaded&&(clearTimeout(s),n.off("sourcedata",a),e())};n.on("sourcedata",a)})),n.setTerrain({source:Bi}),await new Promise(e=>setTimeout(e,500)));const t=await async function(e,t){const{minLat:s,maxLat:n,minLng:a,maxLng:r}=t;let o=Math.ceil((r-a)/.001),i=Math.ceil((n-s)/.001);o>zi&&(o=zi),i>zi&&(i=zi);const l=(r-a)/o,c=(n-s)/i,u=Math.max(l,c),d=new Float32Array(o*i);let h=0;for(let m=0;msetTimeout(e,0))}}return{origin:[s,a],cellSize:u,width:o,height:i,elevations:d}}(n,s);e({terrainGrid:t,isLoading:!1,lastLoadedAt:Date.now(),cachedBounds:s})}catch(i){const t=i instanceof Error?i.message:"Unknown error loading terrain";e({isLoading:!1,error:t})}}},preloadFromNodes:async(e,s)=>{const n=function(e){const t=e.filter(e=>void 0!==e.latitude&&void 0!==e.longitude&&(0!==e.latitude||0!==e.longitude));if(0===t.length)return null;let s=1/0,n=-1/0,a=1/0,r=-1/0;for(const o of t)s=Math.min(s,o.latitude),n=Math.max(n,o.latitude),a=Math.min(a,o.longitude),r=Math.max(r,o.longitude);return{minLat:s-Ri,maxLat:n+Ri,minLng:a-Ri,maxLng:r+Ri}}(e);n&&await t().loadTerrain(n,s)},clearTerrain:()=>{e({terrainGrid:null,cachedBounds:null,lastLoadedAt:null,error:null})},setTerrainDisambiguationEnabled:t=>{e({terrainDisambiguationEnabled:t})},getTerrainGridForDisambiguation:()=>{const e=t();return e.terrainDisambiguationEnabled?e.terrainGrid:null}})),Wi="pymc-stealth-location";function Hi(e){if("undefined"!=typeof window)try{localStorage.setItem(Wi,JSON.stringify(e))}catch{}}function Ui(e){return!isNaN(e)&&e>=-90&&e<=90}function qi(e){return!isNaN(e)&&e>=-180&&e<=180}const Gi=function(){if("undefined"==typeof window)return{};try{const e=localStorage.getItem(Wi);if(!e)return{};const t=JSON.parse(e);if("number"==typeof t.latitude&&"number"==typeof t.longitude&&"boolean"==typeof t.enabled&&Ui(t.latitude)&&qi(t.longitude))return t}catch{}return{}}(),Ji=w((e,t)=>({latitude:Gi.latitude??null,longitude:Gi.longitude??null,enabled:Gi.enabled??!1,setLocation:(s,n)=>{Ui(s)&&qi(n)&&(e({latitude:s,longitude:n}),Hi({latitude:s,longitude:n,enabled:t().enabled}))},enable:()=>{const{latitude:s,longitude:n}=t();null!==s&&null!==n&&(e({enabled:!0}),Hi({latitude:s,longitude:n,enabled:!0}))},disable:()=>{e({enabled:!1});const{latitude:s,longitude:n}=t();null!==s&&null!==n&&Hi({latitude:s,longitude:n,enabled:!1})},clear:()=>{e({latitude:null,longitude:null,enabled:!1}),function(){if("undefined"!=typeof window)try{localStorage.removeItem(Wi)}catch{}}()},getEffectiveLocation:()=>{const{latitude:e,longitude:s,enabled:n}=t();return n&&null!==e&&null!==s?{latitude:e,longitude:s}:null},isActive:()=>{const{latitude:e,longitude:s,enabled:n}=t();return n&&null!==e&&null!==s}}));function Yi(e){return e.startsWith("0x")||e.startsWith("0X")?e.slice(2,4).toUpperCase():e.slice(0,2).toUpperCase()}function Vi(e,t){let s=e.forwarded_path??e.original_path;if("string"==typeof s)try{s=JSON.parse(s)}catch{return null}if(!s||!Array.isArray(s)||0===s.length)return null;const n=s.map(e=>String(e).toUpperCase()),a=t?Yi(t):null,r=n[n.length-1],o=null!==a&&r===a,i=o?n.slice(0,-1):[...n];return{effective:i,original:n,hadLocal:o,effectiveLength:i.length}}function Ki(e,t){const s=e.toUpperCase();return t.startsWith("0x")||t.startsWith("0X")?t.slice(2).toUpperCase().startsWith(s):t.toUpperCase().startsWith(s)}const Xi=[{label:"20m",minutes:20,buckets:80},{label:"1h",minutes:60,buckets:80},{label:"3h",minutes:180,buckets:80},{label:"12h",minutes:720,buckets:80},{label:"24h",minutes:1440,buckets:80},{label:"3d",minutes:4320,buckets:80},{label:"7d",minutes:10080,buckets:80},{label:"14d",minutes:20160,buckets:80}],Qi=[{label:"1h",hours:1},{label:"3h",hours:3},{label:"12h",hours:12},{label:"24h",hours:24},{label:"3d",hours:72},{label:"7d",hours:168},{label:"14d",hours:336}];function Zi(e,t=12){return Math.max(t,Math.round(e/15))}const el={hero:Zi(1200),statsCard:Zi(380)};function tl(e){switch(e){case 1:return 3600;case 3:case 12:return 5400;case 24:return 8640;case 72:case 168:case 336:return 720;default:{const t=3600*e,s=Math.round(t/10);return Math.min(Math.max(360,s),720)}}}const sl="'JetBrains Mono', 'SF Mono', Monaco, monospace",nl={stats:3e3,packets:3e3,charts:3e4,logs:2e3,system:3e3},al={DEBUG:"text-sys-brown",INFO:"text-sys-cyan",WARNING:"text-sys-amber",ERROR:"text-sys-red",CRITICAL:"text-sys-pink"};function rl(e){return al[e]??"text-text-muted border-border-subtle"}const ol="pymc-resource-history",il="pymc-resource-last-fetch",ll="pymc-hidden-contacts",cl="pymc-quick-neighbors",ul="pymc-local-hash",dl="pymc-global-time-range";let hl=null,ml=null;function fl(e,t){const s=t-1e3*e;return s<=6048e5?"active":s<=12096e5?"stale":"expired"}function gl(e){return 4===(e.type??e.payload_type)&&!0!==e.transmitted&&function(e){const t=function(e){if(Array.isArray(e))return e;if("string"==typeof e&&e.startsWith("["))try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}return[]}(e.original_path),s=e.route??e.route_type;return 2===(n=s)||3===n?0===t.length:Tr(s)?t.length<=1:0===t.length;var n}(e)}function pl(e,t,s,n){if(!e)return null;let a=e;if(e.length<=4){const n=e.replace(/^0x/i,"").toUpperCase();if(n===t)return null;const r=s.get(n);if(!r)return null;a=r}return n.has(a)?Yi(a)===t?null:a:null}function bl(e,t){e.count++,void 0!==t.rssi&&null!==t.rssi&&(e.rssiSum+=t.rssi,e.rssiCount++),void 0!==t.snr&&null!==t.snr&&(e.snrSum+=t.snr,e.snrCount++);const s=t.timestamp??0;s>e.lastSeen&&(e.lastSeen=s)}function yl(e){return{hash:e,count:0,rssiSum:0,rssiCount:0,snrSum:0,snrCount:0,lastSeen:0}}function xl(e,t){const s=fl(e.lastSeen,t);return"expired"===s?null:{hash:e.hash,prefix:Yi(e.hash),count:e.count,avgRssi:e.rssiCount>0?e.rssiSum/e.rssiCount:null,avgSnr:e.snrCount>0?e.snrSum/e.snrCount:null,lastSeen:e.lastSeen,status:s}}function wl(){if("undefined"==typeof window)return[];try{const e=localStorage.getItem(cl);if(e)return JSON.parse(e)}catch{}return[]}function vl(e){"undefined"!=typeof window&&(ml&&clearTimeout(ml),ml=setTimeout(()=>{try{localStorage.setItem(cl,JSON.stringify(e))}catch{}ml=null},1e3))}function kl(){if("undefined"!=typeof window)try{const e=localStorage.getItem(ul);if(e)return e}catch{}}function Sl(e){if("undefined"!=typeof window)try{localStorage.setItem(ul,e)}catch{}}function Cl(){if("undefined"==typeof window)return[];try{const e=localStorage.getItem(ol);if(e)return JSON.parse(e)}catch{}return[]}function jl(){if("undefined"==typeof window)return new Set;try{const e=localStorage.getItem(ll);if(e)return new Set(JSON.parse(e))}catch{}return new Set}function Tl(){if("undefined"==typeof window)return 0;try{const e=localStorage.getItem(il);if(e)return parseInt(e,10)||0}catch{}return 0}function Ml(){if("undefined"==typeof window)return 4;try{const e=localStorage.getItem(dl);if(e){const t=parseInt(e,10);if(!isNaN(t)&&t>=0&&t<=7)return t}}catch{}return 4}const Ll=w((e,t)=>({stats:null,statsLoading:!1,statsError:null,packets:[],packetsLoading:!1,packetsError:null,lastPacketTimestamp:0,logs:[],logsLoading:!1,liveMode:!0,flashReceived:0,flashAdvert:0,pendingAdvertLocalHash:null,pendingAdvertTimestamp:null,resourceHistory:Cl(),lastResourceFetch:Tl(),hiddenContacts:jl(),quickNeighbors:wl(),cachedLocalHash:kl(),initialized:!1,packetCacheState:Mi.getState(),mutationsInFlight:new Set,globalTimeRangeIndex:Ml(),initializeApp:async()=>{const{initialized:s}=t();if(!s){e({initialized:!0,statsLoading:!0,packetsLoading:!0}),Mi.subscribe(t=>{e({packetCacheState:t})});try{const{hiddenContacts:s}=t(),n=await oi(),a=n.neighbors??{},r=Date.now(),o=[];for(const[e,t]of Object.entries(a)){if(s.has(e))continue;if(!t.zero_hop)continue;const n=fl(t.last_seen??0,r);"expired"!==n&&o.push({hash:e,prefix:Yi(e),count:t.advert_count??0,avgRssi:t.rssi??null,avgSnr:t.snr??null,lastSeen:t.last_seen??0,status:n})}o.sort((e,t)=>t.count!==e.count?t.count-e.count:t.lastSeen-e.lastSeen);const i=n.local_hash;e({stats:n,statsLoading:!1,quickNeighbors:o,cachedLocalHash:i}),vl(o),i&&Sl(i);const l=()=>{const s=Mi.getPackets();if(s.length>0){const n=s.reduce((e,t)=>{const s=t.timestamp??0;return s>e?s:e},0);e({packets:[...s],lastPacketTimestamp:n}),t().triggerTopologyCompute(),t().triggerSparklineCompute()}},c=await Mi.initialLoad(l);if(c.length>0){const s=c.reduce((e,t)=>{const s=t.timestamp??0;return s>e?s:e},0);e({packets:[...c],packetsLoading:!1,lastPacketTimestamp:s}),t().triggerTopologyCompute(),t().triggerSparklineCompute()}else e({packetsLoading:!1})}catch(n){e({statsError:n instanceof Error?n.message:"Failed to initialize",statsLoading:!1,packetsLoading:!1})}Ai.getState().initialize(),Di.onPacket(s=>{const{lastPacketTimestamp:n,mutationsInFlight:a}=t();if(a.size>0)return;Fi.stage(s);const r=s.timestamp??0;r>n&&e({flashReceived:t().flashReceived+1,lastPacketTimestamp:r})}),Di.onStats(s=>{const{mutationsInFlight:n,hiddenContacts:a}=t();if(n.size>0)return;const r=s.neighbors??{},o=Date.now(),i=[];for(const[e,t]of Object.entries(r)){if(a.has(e))continue;if(!t.zero_hop)continue;const s=fl(t.last_seen??0,o);"expired"!==s&&i.push({hash:e,prefix:Yi(e),count:t.advert_count??0,avgRssi:t.rssi??null,avgSnr:t.snr??null,lastSeen:t.last_seen??0,status:s})}i.sort((e,t)=>t.count!==e.count?t.count-e.count:t.lastSeen-e.lastSeen);const l=s.local_hash;e({stats:s,statsLoading:!1,statsError:null,quickNeighbors:i,cachedLocalHash:l}),vl(i),l&&Sl(l)}),Di.onPacketStats(s=>{const{stats:n,mutationsInFlight:a}=t();if(!n||a.size>0)return;const r={...n,rx_count:s.rx_count??n.rx_count,tx_count:s.tx_count??n.tx_count,forwarded_count:s.forwarded_count??n.forwarded_count,dropped_count:s.dropped_count??n.dropped_count};e({stats:r})});try{await Pi.init({apiBaseUrl:"",authToken:Ao()??void 0,statsIntervalMs:nl.stats,packetsIntervalMs:nl.packets}),Pi.onStats((s,n)=>{const{mutationsInFlight:a,hiddenContacts:r}=t();if(a.size>0)return;const o=s.neighbors??{},i=Date.now(),l=[];for(const[e,t]of Object.entries(o)){if(r.has(e))continue;if(!t.zero_hop)continue;const s=fl(t.last_seen??0,i);"expired"!==s&&l.push({hash:e,prefix:Yi(e),count:t.advert_count??0,avgRssi:t.rssi??null,avgSnr:t.snr??null,lastSeen:t.last_seen??0,status:s})}l.sort((e,t)=>t.count!==e.count?t.count-e.count:t.lastSeen-e.lastSeen);const c=s.local_hash;e({stats:s,statsLoading:!1,statsError:null,quickNeighbors:l,cachedLocalHash:c}),vl(l),c&&Sl(c)}),Pi.onPackets((s,n,a)=>{if(0===s.length)return;const{lastPacketTimestamp:r}=t(),o=s.map(e=>e.packet_hash).filter(e=>!!e);Fi.confirmBatch(o),Mi.mergePacketsDirectly(s);const i=a>r;i&&ui();const l=Mi.getPackets();e({packets:l,packetsLoading:!1,packetsError:null,lastPacketTimestamp:a}),i&&t().triggerTopologyCompute()}),Pi.onError((t,s)=>{e("stats"===t?{statsError:s}:{packetsError:s})}),"undefined"!=typeof document&&document.addEventListener("visibilitychange",()=>{document.hidden||Pi.forceRefresh()})}catch(n){!function(e){setInterval(()=>{e().fetchStats()},nl.stats),setInterval(()=>{e().liveMode&&!Mi.isHeavyLoadInProgress()&&e().fetchPackets()},nl.packets)}(t)}}},prefetchForRoute:e=>{switch(e){case"/logs":ii().catch(()=>{});break;case"/system":hi().catch(()=>{});break;case"/statistics":(async function(e=24){return ti(`/api/packet_type_graph_data?hours=${e}`)})(3).catch(()=>{}),li(3).catch(()=>{});break;case"/settings":(async function(){return ti("/api/radio_presets")})().catch(()=>{})}},fetchStats:async s=>{const{stats:n,mutationsInFlight:a,hiddenContacts:r}=t();if(!(a.size>0)||(null==s?void 0:s.force)){n||e({statsLoading:!0}),e({statsError:null});try{const t=await oi(),s=t.neighbors??{},n=Date.now(),a=[];for(const[e,i]of Object.entries(s)){if(r.has(e))continue;if(!i.zero_hop)continue;const t=fl(i.last_seen??0,n);"expired"!==t&&a.push({hash:e,prefix:Yi(e),count:i.advert_count??0,avgRssi:i.rssi??null,avgSnr:i.snr??null,lastSeen:i.last_seen??0,status:t})}a.sort((e,t)=>t.count!==e.count?t.count-e.count:t.lastSeen-e.lastSeen);const o=t.local_hash;e({stats:t,statsLoading:!1,quickNeighbors:a,cachedLocalHash:o}),vl(a),o&&Sl(o)}catch(o){e({statsError:o instanceof Error?o.message:"Failed to fetch stats",statsLoading:!1})}}},fetchPackets:async s=>{const{packets:n,lastPacketTimestamp:a}=t();0===n.length&&e({packetsLoading:!0}),e({packetsError:null});try{const s=await Mi.poll(),r=s.length>0?s.reduce((e,t)=>Math.max(e,t.timestamp??0),0):0,o=r>a&&a>0,i=s.length!==n.length||o;o&&(e({flashReceived:t().flashReceived+1}),ui()),e(i?{packets:s,packetsLoading:!1,lastPacketTimestamp:r||a}:{packetsLoading:!1}),o&&t().triggerTopologyCompute()}catch(r){e({packetsError:r instanceof Error?r.message:"Failed to fetch packets",packetsLoading:!1})}},fetchLogs:async()=>{const{logs:s}=t();0===s.length&&e({logsLoading:!0});try{const t=await ii();e({logs:t.logs,logsLoading:!1})}catch{e({logsLoading:!1})}},setLiveMode:t=>{e({liveMode:t}),Pi.isReady()&&Pi.setLiveMode(t)},setMode:async s=>{const n="setMode",{mutationsInFlight:a}=t(),r=new Set(a);r.add(n),e({mutationsInFlight:r});try{if(!(await pi(s)).success)throw new Error("Backend returned unsuccessful response");await t().fetchStats({force:!0})}catch(o){const{mutationsInFlight:s}=t(),a=new Set(s);throw a.delete(n),e({mutationsInFlight:a}),o}},clearModeMutation:()=>{const{mutationsInFlight:s}=t(),n=new Set(s);n.delete("setMode"),e({mutationsInFlight:n})},setDutyCycle:async s=>{const n="setDutyCycle",{mutationsInFlight:a}=t(),r=new Set(a);r.add(n),e({mutationsInFlight:r});try{if(!(await bi(s)).success)throw new Error("Backend returned unsuccessful response");await t().fetchStats({force:!0})}finally{const{mutationsInFlight:s}=t(),a=new Set(s);a.delete(n),e({mutationsInFlight:a})}},setDutyCycleConfig:async s=>{var n;const a="setDutyCycleConfig",{mutationsInFlight:r}=t(),o=new Set(r);o.add(a),e({mutationsInFlight:o});try{const e=await async function(e){return ti("/api/update_duty_cycle_config",{method:"POST",body:JSON.stringify(e)})}(s);if(!e.success&&!(null==(n=e.data)?void 0:n.persisted))throw new Error("Backend returned unsuccessful response");await t().fetchStats({force:!0})}catch(i){const{mutationsInFlight:s}=t(),n=new Set(s);throw n.delete(a),e({mutationsInFlight:n}),i}},clearDutyCycleMutation:()=>{const{mutationsInFlight:s}=t(),n=new Set(s);n.delete("setDutyCycleConfig"),e({mutationsInFlight:n})},startMutation:s=>{const{mutationsInFlight:n}=t(),a=new Set(n);a.add(s),e({mutationsInFlight:a})},clearMutation:s=>{const{mutationsInFlight:n}=t(),a=new Set(n);a.delete(s),e({mutationsInFlight:a})},sendAdvert:async()=>{try{const s=await gi();return s.success?(e({flashAdvert:t().flashAdvert+1}),{success:!0}):{success:!1,error:s.error||"Failed to send advert"}}catch(s){return{success:!1,error:s instanceof Error?s.message:"Unknown error"}}},triggerFlashReceived:()=>{e({flashReceived:t().flashReceived+1})},triggerFlashAdvert:()=>{e({flashAdvert:t().flashAdvert+1})},addResourceDataPoint:(s,n,a)=>{const r=Date.now(),{lastResourceFetch:o,resourceHistory:i}=t();if(r-o<1e3)return;const l=[...i,{timestamp:r,time:new Date(r).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}),cpu:s,memory:n}],c=l.length>a?l.slice(-a):l;var u,d;e({resourceHistory:c,lastResourceFetch:r}),u=c,d=r,"undefined"!=typeof window&&(hl&&clearTimeout(hl),hl=setTimeout(()=>{try{localStorage.setItem(ol,JSON.stringify(u)),localStorage.setItem(il,d.toString())}catch{}hl=null},1e3))},hideContact:s=>{const{hiddenContacts:n}=t(),a=new Set(n);a.add(s),e({hiddenContacts:a}),function(e){if("undefined"!=typeof window)try{localStorage.setItem(ll,JSON.stringify([...e]))}catch{}}(a)},clearPacketCache:()=>{Mi.clear(),e({packets:[],lastPacketTimestamp:0}),Mi.quickLoad().then(s=>{if(s.length>0){const n=s.reduce((e,t)=>Math.max(e,t.timestamp??0),0);e({packets:s,lastPacketTimestamp:n}),t().triggerTopologyCompute()}})},triggerTopologyCompute:()=>{var e,s,n,a;const{packets:r,stats:o,hiddenContacts:i}=t();if(0===r.length||!o)return;const l=o.neighbors??{},c=Object.fromEntries(Object.entries(l).filter(([e])=>!i.has(e))),u=o.local_hash;let d=null==(s=null==(e=o.config)?void 0:e.repeater)?void 0:s.latitude,h=null==(a=null==(n=o.config)?void 0:n.repeater)?void 0:a.longitude;if(!d||!h||0===d&&0===h){const e=Ji.getState().getEffectiveLocation();e&&(d=e.latitude,h=e.longitude)}const m=[];for(const[t,g]of Object.entries(c))g.zero_hop&&m.push({hash:t,advertCount:g.advert_count??1,avgRssi:g.rssi??null,avgSnr:g.snr??null,lastSeen:g.last_seen??0,latitude:g.latitude,longitude:g.longitude});const f=$i.getState().getTerrainGridForDisambiguation();_i.compute(r,c,u,d,h,void 0,m,f??void 0)},triggerDeepAnalysis:async()=>{await Mi.forceDeepLoad();const s=Mi.getPackets();if(s.length>0){const n=s.reduce((e,t)=>Math.max(e,t.timestamp??0),0);e({packets:s,lastPacketTimestamp:n}),t().triggerTopologyCompute(),t().triggerSparklineCompute()}},updateQuickNeighbors:()=>{const{packets:s,stats:n,hiddenContacts:a}=t();if(0===s.length||!n)return;const r=n.neighbors??{},o=function(e,t,s){if(!s||0===e.length||0===Object.keys(t).length)return[];const n=Date.now(),a=Yi(s),r=new Set(Object.keys(t)),o=function(e){var t,s;const n=new Map;for(const a of Object.keys(e)){const r=Yi(a),o=n.get(r);if(o){const i=null==(t=e[o])?void 0:t.zero_hop;(null==(s=e[a])?void 0:s.zero_hop)&&!i&&n.set(r,a)}else n.set(r,a)}return n}(t),i=new Map;for(const c of e){if(!gl(c))continue;const e=pl(c.src_hash,a,o,r);if(!e)continue;let t=i.get(e);t||(t=yl(e),i.set(e,t)),bl(t,c)}for(const[c,u]of Object.entries(t))Yi(c)!==a&&u.zero_hop&&!i.has(c)&&i.set(c,{hash:c,count:u.advert_count??0,rssiSum:u.rssi??0,rssiCount:void 0!==u.rssi?1:0,snrSum:u.snr??0,snrCount:void 0!==u.snr?1:0,lastSeen:u.last_seen??0});const l=[];for(const c of i.values()){const e=xl(c,n);e&&l.push(e)}return l.sort((e,t)=>t.count!==e.count?t.count-e.count:t.lastSeen-e.lastSeen),l}(s,Object.fromEntries(Object.entries(r).filter(([e])=>!a.has(e))),n.local_hash),i=t().quickNeighbors;(o.length!==i.length||o.some((e,t)=>{var s,n;return e.hash!==(null==(s=i[t])?void 0:s.hash)||e.count!==(null==(n=i[t])?void 0:n.count)}))&&(e({quickNeighbors:o}),vl(o))},triggerSparklineCompute:()=>{const{packets:e,stats:s,hiddenContacts:n}=t();if(0===e.length||!s)return;const a=s.neighbors??{},r=Object.keys(a).filter(e=>!n.has(e));0!==r.length&&Ei.compute(e,r)},requestSevenDayData:async()=>{await Mi.loadSevenDays(()=>{const s=Mi.getPackets();if(s.length>0){const n=s.reduce((e,t)=>Math.max(e,t.timestamp??0),0);e({packets:[...s],lastPacketTimestamp:n}),t().triggerTopologyCompute(),t().triggerSparklineCompute()}});const s=Mi.getPackets();if(s.length>0){const n=s.reduce((e,t)=>Math.max(e,t.timestamp??0),0);e({packets:[...s],lastPacketTimestamp:n}),t().triggerTopologyCompute(),t().triggerSparklineCompute()}},requestThreeDayData:async()=>{await Mi.loadThreeDays(()=>{const s=Mi.getPackets();if(s.length>0){const n=s.reduce((e,t)=>Math.max(e,t.timestamp??0),0);e({packets:[...s],lastPacketTimestamp:n}),t().triggerTopologyCompute(),t().triggerSparklineCompute()}});const s=Mi.getPackets();if(s.length>0){const n=s.reduce((e,t)=>Math.max(e,t.timestamp??0),0);e({packets:[...s],lastPacketTimestamp:n}),t().triggerTopologyCompute(),t().triggerSparklineCompute()}},requestFourteenDayData:async()=>{await Mi.loadFourteenDays(()=>{const s=Mi.getPackets();if(s.length>0){const n=s.reduce((e,t)=>Math.max(e,t.timestamp??0),0);e({packets:[...s],lastPacketTimestamp:n}),t().triggerTopologyCompute(),t().triggerSparklineCompute()}});const s=Mi.getPackets();if(s.length>0){const n=s.reduce((e,t)=>Math.max(e,t.timestamp??0),0);e({packets:[...s],lastPacketTimestamp:n}),t().triggerTopologyCompute(),t().triggerSparklineCompute()}},setGlobalTimeRange:s=>{e({globalTimeRangeIndex:s}),function(e){if("undefined"!=typeof window)try{localStorage.setItem(dl,e.toString())}catch{}}(s);const n={0:1,1:1,2:3,3:12,4:24,5:72,6:168,7:336}[s]??24;Pi.setTimeWindow(n);const{packetCacheState:a,requestThreeDayData:r,requestSevenDayData:o,requestFourteenDayData:i,triggerTopologyCompute:l,triggerSparklineCompute:c}=t();let u=!1;5!==s||a.threeDayLoadComplete||a.isBackgroundLoading||(r(),u=!0),6!==s||a.sevenDayLoadComplete||a.isBackgroundLoading||(o(),u=!0),7!==s||a.fourteenDayLoadComplete||a.isBackgroundLoading||(i(),u=!0),!u&&s>=5&&(l(),c())}})),Nl=Ll,_l=()=>Ll(e=>e.stats),El=()=>Ll(e=>e.statsError),Pl=()=>Ll(e=>e.packets),Dl=()=>Ll(e=>e.packetsLoading),Il=()=>Ll(e=>e.logs),Fl=()=>Ll(e=>e.logsLoading),Al=()=>Ll(e=>e.liveMode),Rl=()=>Ll(e=>e.fetchLogs),zl=()=>Ll(e=>e.setLiveMode),Bl=()=>Ll(e=>e.resourceHistory),Ol=()=>Ll(e=>e.addResourceDataPoint),$l=()=>Ll(e=>e.hiddenContacts),Wl=()=>Ll(e=>e.hideContact),Hl=()=>Ll(e=>e.packetCacheState),Ul=()=>Ll(e=>e.triggerDeepAnalysis),ql=()=>Ll(e=>e.quickNeighbors),Gl=()=>Ll(e=>e.cachedLocalHash),Jl=()=>Ll(e=>e.lastPacketTimestamp),Yl=()=>Ll(e=>e.globalTimeRangeIndex),Vl=()=>Ll(e=>e.setGlobalTimeRange),Kl=()=>Ll(e=>null!==e.stats&&e.packetCacheState.backgroundLoadComplete);function Xl(){const e=Ll(e=>{var t,s,n;return null==(n=null==(s=null==(t=e.stats)?void 0:t.config)?void 0:s.repeater)?void 0:n.latitude}),t=Ll(e=>{var t,s,n;return null==(n=null==(s=null==(t=e.stats)?void 0:t.config)?void 0:s.repeater)?void 0:n.longitude}),s=Ll(e=>{var t,s,n;return(null==(s=null==(t=e.stats)?void 0:t.config)?void 0:s.node_name)||(null==(n=e.stats)?void 0:n.node_name)||"Local Node"}),n=Ji(e=>e.latitude),a=Ji(e=>e.longitude),r=Ji(e=>e.enabled);return e&&t&&(0!==e||0!==t)?{latitude:e,longitude:t,name:s,isStealth:!1}:r&&null!==n&&null!==a?{latitude:n,longitude:a,name:s,isStealth:!0}:null}const Ql={rx:{p3:"color(display-p3 0.2 1 0.4)",fallback:"#00FF66"},tx:{p3:"color(display-p3 1 0.9 0.2)",fallback:"#FFDD00"}};function Zl({showLabel:e=!1,className:t}){var a;const r=Ll(e=>e.flashReceived),o=Ll(e=>e.flashAdvert),i=Ai(e=>"connected"===e.connectionState),[l,c]=s.useState("idle"),u=s.useRef(0),d=s.useRef(0);s.useEffect(()=>{if(r<=0)return;const e=Date.now();if(e-u.current<50)return;u.current=e,c("rx");const t=setTimeout(()=>c("idle"),100);return()=>clearTimeout(t)},[r]),s.useEffect(()=>{if(o<=0)return;const e=Date.now();if(e-d.current<50)return;d.current=e,c("tx");const t=setTimeout(()=>c("idle"),100);return()=>clearTimeout(t)},[o]);const h="rx"===l?Ql.rx:"tx"===l?Ql.tx:null;return n.jsxs("span",{className:J("inline-flex items-center gap-2",t),title:i?"Real-time (WebSocket)":"Database polling",children:[n.jsx("span",{className:"inline-flex rounded-full w-1.5 h-1.5",style:h?{backgroundColor:h.fallback,...(null==(a=CSS.supports)?void 0:a.call(CSS,"color","color(display-p3 1 1 1)"))&&{backgroundColor:h.p3}}:{backgroundColor:"var(--livedot-idle)"}}),e&&n.jsx("span",{className:"type-data-xs text-text-muted uppercase tracking-wide",children:i?"Live":"DB"})]})}function ec({borderRadius:e}){return n.jsx(c.div,{initial:{opacity:0},animate:{opacity:.8,backgroundPosition:["200% 0%","-200% 0%"]},exit:{opacity:0},transition:{opacity:{duration:.2},backgroundPosition:{duration:2,ease:"easeInOut",repeat:1/0}},style:{position:"absolute",inset:0,zIndex:1,pointerEvents:"none",borderRadius:e,padding:2,background:"linear-gradient(\n 90deg,\n transparent 0%,\n transparent 25%,\n var(--accent-primary) 50%,\n transparent 75%,\n transparent 100%\n )",backgroundSize:"200% 100%",mask:"\n linear-gradient(#fff 0 0) content-box,\n linear-gradient(#fff 0 0)\n ",maskComposite:"exclude",WebkitMaskComposite:"xor"}})}function tc({children:e,isLoading:t=!0,className:s,borderRadius:a=12}){return n.jsxs("div",{className:J("relative overflow-hidden",s),style:{borderRadius:a},children:[n.jsx(i,{children:t&&n.jsx(ec,{borderRadius:a})}),n.jsx("div",{className:"relative z-10",children:e})]})}function sc({className:e}){return n.jsx("div",{className:J("relative w-10 h-1 rounded-sm overflow-hidden","bg-bg-elevated",e),children:n.jsx(c.div,{animate:{backgroundPosition:["200% 0%","-200% 0%"]},transition:{duration:1.5,ease:"easeInOut",repeat:1/0},className:"absolute inset-0",style:{background:"linear-gradient(\n 90deg,\n transparent 0%,\n var(--accent-primary) 50%,\n transparent 100%\n )",backgroundSize:"200% 100%"}})})}const nc=w(e=>({sparklines:new Map,isComputing:!1,lastUpdated:0,nodeCount:0,setSparklines:t=>e({sparklines:t,lastUpdated:Date.now(),nodeCount:t.size,isComputing:!1}),setComputing:t=>e({isComputing:t})}));"undefined"!=typeof window&&setTimeout(()=>{Ei.subscribe((e,t)=>{const s=nc.getState();t&&!s.isComputing?s.setComputing(!0):!t&&e.size>0?s.setSparklines(e):!t&&s.isComputing&&s.setComputing(!1)})},0);const ac=()=>nc(e=>e.isComputing),rc=[],oc=new Map;function ic(e){return nc(t=>{const s=t.sparklines.get(e);if(!s||0===s.length)return rc;const n=oc.get(e);return n===s?n:(oc.set(e,s),s)})}const lc=w(e=>({topology:{edges:[],validatedEdges:[],weakEdges:[],certainEdges:[],uncertainEdges:[],edgeMap:new Map,maxPacketCount:0,maxCertainCount:0,neighborAffinity:new Map,fullAffinity:new Map,localPrefix:null,centrality:new Map,hubNodes:[],gatewayNodes:[],loops:[],loopEdgeKeys:new Set,txDelayRecommendations:new Map,pathRegistry:Ni(),edgeBetweenness:new Map,backboneEdges:[],nodeMobility:new Map,mobileNodes:[],pathHealth:[],lastHopNeighbors:[],disambiguationStats:{totalPrefixes:0,unambiguousPrefixes:0,collisionPrefixes:0,collisionRate:0,avgConfidence:0,lowConfidencePrefixes:[],highCollisionPrefixes:[],totalResolutions:0},discoveredNodes:[],viterbiStats:{totalPaths:0,pathsWithGhosts:0,avgPathCost:0,avgPathConfidence:0,observationOverrideCount:0,tracePacketsProcessed:0,pathPacketsProcessed:0,distantEdgesDiscovered:0,duplicateGroupsFound:0,duplicatePathsUnique:0,echolocationEdgesInferred:0},nodeMetrics:new Map,communityCount:0,backboneNodes:[]},isComputing:!1,lastComputeTimeMs:0,lastUpdated:0,setTopology:(t,s)=>e({topology:t,lastComputeTimeMs:s,lastUpdated:Date.now(),isComputing:!1}),setComputing:t=>e({isComputing:t})}));"undefined"!=typeof window&&_i.subscribe((e,t)=>{lc.getState().setTopology(e,t)});const cc=()=>lc(e=>e.topology),uc=()=>lc(e=>e.topology.hubNodes),dc=()=>lc(e=>e.topology.centrality),hc=()=>lc(e=>e.topology.fullAffinity);let mc=null,fc=null,gc=null,pc=null;const bc=()=>lc(e=>(e.topology.hubNodes!==fc&&(fc=e.topology.hubNodes,mc=new Set(e.topology.hubNodes)),mc)),yc=()=>lc(e=>e.topology.pathHealth),xc=()=>lc(e=>e.topology.disambiguationStats),wc=()=>lc(e=>e.topology.disambiguationStats.highCollisionPrefixes),vc=()=>lc(e=>e.topology.disambiguationStats.totalPrefixes>0),kc=()=>lc(e=>e.topology.discoveredNodes),Sc=()=>lc(e=>e.topology.viterbiStats),Cc=()=>lc(e=>(e.topology.discoveredNodes!==pc&&(pc=e.topology.discoveredNodes,gc=e.topology.discoveredNodes.filter(e=>e.isLikelyReal)),gc)),jc=()=>lc(e=>e.topology.nodeMetrics);let Tc=null,Mc=null;const Lc=()=>lc(e=>{if(e.topology.nodeMetrics!==Mc){Mc=e.topology.nodeMetrics,Tc={local:0,hub:0,gateway:0,backbone:0,neighbor:0,mobile:0,ghost:0,standard:0};for(const t of e.topology.nodeMetrics.values())Tc[t.nodeClass]++}return Tc});function Nc(e){if(e<60)return`${Math.floor(e)}s`;const t=Math.floor(e/86400),s=Math.floor(e%86400/3600),n=Math.floor(e%3600/60),a=[];return t>0&&a.push(`${t}d`),s>0&&a.push(`${s}h`),(n>0||0===a.length)&&a.push(`${n}m`),a.join(" ")}function _c(e){const t=Date.now()/1e3-e;return t<60?"just now":t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function Ec(e){return new Date(1e3*e).toLocaleString()}function Pc(e){const t=new Date(1e3*e);return`${t.toLocaleString("en-US",{month:"short"})} ${t.getDate()}, ${t.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}`}function Dc(e){return new Date(1e3*e).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}function Ic(e){return`${(e/1e6).toFixed(3)} MHz`}function Fc(e){return`${(e/1e3).toFixed(1)} kHz`}function Ac(e){const t=e>1e12?e:1e3*e,s=Date.now(),n=Math.abs(s-t),a=Math.floor(n/1e3),r=Math.floor(a/60),o=Math.floor(r/60),i=Math.floor(o/24);return i>0?`${i} day${1!==i?"s":""}`:o>0?`${o} hour${1!==o?"s":""}`:r>0?`${r} minute${1!==r?"s":""}`:`${a} second${1!==a?"s":""}`}function Rc(e){e<0&&(e=0);const t=Math.floor(e/1e3),s=Math.floor(t/60),n=Math.floor(s/60);if(n>0){const e=s%60;return e>0?`${n}h ${e}m`:`${n}h`}if(s>0){const e=t%60;return e>0?`${s}m ${e}s`:`${s}m`}if(t>0){const s=e%1e3;return s>0?`${t}.${Math.floor(s/100)}s`:`${t}s`}return`${e}ms`}const zc=[{name:"Dashboard",to:"/",icon:k},{name:"Contacts",to:"/contacts",icon:S},{name:"Packets",to:"/packets",icon:C},{name:"Statistics",to:"/statistics",icon:j},{name:"MeshGraph",to:"/meshgraph",icon:T},{name:"System",to:"/system",icon:M},{name:"Logs",to:"/logs",icon:L},{name:"Terminal",to:"/terminal",icon:N},{name:"Configuration",to:"/configuration",icon:_}],Bc="pymc-controls-expanded",Oc=()=>{if("undefined"==typeof window)return!0;const e=localStorage.getItem(Bc);return null===e||"true"===e};function $c(){var e,t,a,r,o,i;const{pathname:l}=v(),{stats:c,setMode:u,setDutyCycle:d,sendAdvert:h}=Nl(),m=Uo(),f=Ll(e=>e.prefetchForRoute),g=Hl(),p=Ll(e=>e.packetCacheState.dataTier),b=ac(),y=lc(e=>e.isComputing),x=Cc();let w=null;try{w=function(){const e=s.useContext(ho);if(!e)throw new Error("useSidebar must be used within a SidebarLayout");return e}()}catch{}const[k,S]=s.useState(!1),[C,j]=s.useState("idle"),[T,L]=s.useState(null),N=s.useRef(null),_=s.useCallback(e=>{e!==l&&(N.current&&clearTimeout(N.current),N.current=setTimeout(()=>{f(e)},100))},[l,f]),B=s.useCallback(()=>{N.current&&(clearTimeout(N.current),N.current=null)},[]);s.useEffect(()=>{const e=new MutationObserver(()=>{const e=document.querySelector("[data-controls-disclosure]");if(e){const t="true"===e.getAttribute("aria-expanded");localStorage.setItem(Bc,String(t))}}),t=document.querySelector("[data-controls-disclosure]");return t&&e.observe(t,{attributes:!0,attributeFilter:["aria-expanded"]}),()=>e.disconnect()},[]);const O=null==c?void 0:c.noise_floor_dbm,$=(null==(t=null==(e=null==c?void 0:c.config)?void 0:e.repeater)?void 0:t.mode)??"forward",W=(null==(r=null==(a=null==c?void 0:c.config)?void 0:a.duty_cycle)?void 0:r.enforcement_enabled)??!1,H=(null==(i=null==(o=null==c?void 0:c.config)?void 0:o.duty_cycle)?void 0:i.max_airtime_percent)??10,U=g.isLoading||g.isBackgroundLoading||g.isTopologyLoading,q=U||b||y,G=g.loadProgress,Y=()=>{null==w||w.close()};return n.jsxs(no,{children:[n.jsxs(ao,{className:"px-5 py-6",children:[n.jsx("h1",{className:"sr-only",children:"pyMC Console"}),n.jsx(jo,{responsive:!0,className:"block"}),n.jsxs("p",{className:"type-data-xs text-text-muted mt-1.5",children:["v",So]})]}),n.jsxs(ro,{className:"py-4",children:[n.jsx(io,{children:zc.map(e=>{const t=l===e.to;return n.jsxs(lo,{href:e.to,current:t,onClick:Y,onMouseEnter:()=>_(e.to),onMouseLeave:B,children:[n.jsx(e.icon,{}),n.jsx(co,{children:e.name}),"/contacts"===e.to&&x.length>0&&n.jsxs(uo,{variant:"accent",children:[n.jsx(E,{className:"w-3 h-3"}),n.jsx("span",{children:x.length})]}),"/meshgraph"===e.to&&n.jsx(uo,{variant:"default",children:"Beta"})]},e.name)})}),q&&n.jsx("div",{className:"px-0 py-3",children:n.jsx(tc,{isLoading:U,borderRadius:12,children:n.jsxs("div",{className:"bg-glass-surface/50 rounded-xl p-2",children:[n.jsxs("div",{className:"flex items-center gap-2 px-1 py-0.5",children:[n.jsxs("div",{className:"relative flex h-2 w-2",children:[n.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-accent-primary opacity-75"}),n.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-accent-primary"})]}),n.jsx("span",{className:"type-data-xs text-text-muted flex-1 truncate",children:g.isLoading&&G?"Loading 24h history...":g.isBackgroundLoading&&G?g.statusMessage||`Loading ${p} history...`:g.isTopologyLoading?"Loading topology data...":b?"Computing sparklines":y?"Building topology":"Analyzing database"}),null!==(null==G?void 0:G.percent)&&void 0!==(null==G?void 0:G.percent)&&U&&n.jsxs("span",{className:"type-data-xs text-text-muted tabular-nums",children:[G.percent,"%"]})]}),n.jsx("div",{className:"mt-1.5 h-1 bg-subtle-fill rounded-full overflow-hidden",children:null!==(null==G?void 0:G.percent)&&void 0!==(null==G?void 0:G.percent)&&U?n.jsx("div",{className:"h-full bg-accent-primary/60 rounded-full transition-all duration-300 ease-out",style:{width:`${G.percent}%`}}):n.jsx("div",{className:"h-full bg-accent-primary/40 rounded-full w-full"})}),!U&&n.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5 px-1",children:[n.jsx("span",{className:"type-micro text-text-muted",children:"Data:"}),n.jsx("span",{className:"type-data-xs text-accent-primary",children:(e=>{switch(e){case"24h":return"24 hours";case"3d":return"3 days";case"7d":return"7 days";case"14d":return"14 days";default:return e}})(p)})]})]})})}),n.jsx("div",{className:"flex-1"}),n.jsx(ko,{label:"Controls",icon:n.jsx(F,{className:"w-5 h-5 text-accent-primary"}),defaultOpen:Oc(),direction:"up",dataId:"controls",children:n.jsxs("div",{className:"flex flex-col gap-2 px-1",children:[n.jsx(Wr,{color:"success"===C?"success":"error"===C?"danger":"primary",onClick:async()=>{S(!0),j("idle"),L(null);const e=await h();S(!1),e.success?(j("success"),setTimeout(()=>j("idle"),1500)):(j("error"),L(e.error||"Failed to send"),setTimeout(()=>{j("idle"),L(null)},3e3))},disabled:k,className:"w-full justify-center",children:k?n.jsxs(n.Fragment,{children:[n.jsxs("svg",{"data-slot":"icon",className:"animate-spin",viewBox:"0 0 24 24",fill:"none",children:[n.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3"}),n.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"Sending..."]}):"success"===C?n.jsxs(n.Fragment,{children:[n.jsx("svg",{"data-slot":"icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Sent!"]}):"error"===C?n.jsxs(n.Fragment,{children:[n.jsxs("svg",{"data-slot":"icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),"Failed"]}):n.jsxs(n.Fragment,{children:[n.jsx(P,{"data-slot":"icon"}),"Send Advert"]})}),T&&n.jsx("p",{className:"text-accent-danger text-xs text-center",children:T}),n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsx("span",{className:"text-xs text-text-muted",children:"Repeat"}),n.jsx("span",{className:J("text-xs font-medium","forward"===$?"text-accent-success":"text-accent-secondary"),children:"forward"===$?"ON":"OFF"})]}),n.jsx(Wr,{color:"forward"===$?"success":"warning",onClick:()=>{u("forward"===$?"monitor":"forward")},className:"w-full justify-center",children:"forward"===$?n.jsxs(n.Fragment,{children:[n.jsx(D,{"data-slot":"icon"}),"Repeating"]}):n.jsxs(n.Fragment,{children:[n.jsx(I,{"data-slot":"icon"}),"Monitor Only"]})}),n.jsxs("div",{className:"flex items-center justify-between gap-2 mt-1",children:[n.jsx("span",{className:"text-xs text-text-muted",children:"Duty Cycle"}),n.jsx("span",{className:J("text-xs font-medium tabular-nums",W?"text-accent-secondary":"text-text-muted"),children:W?`${H}%`:"OFF"})]}),n.jsxs(Wr,{color:W?"warning":"muted",onClick:()=>{d(!W)},className:"w-full justify-center",children:[n.jsx(M,{"data-slot":"icon"}),W?`Limited to ${H}%`:"Disabled"]})]})})]}),n.jsxs(oo,{children:[void 0!==(null==c?void 0:c.uptime_seconds)&&n.jsxs("div",{className:"px-6 py-3 flex items-center gap-3",children:[n.jsx(A,{className:"w-5 h-5 text-text-muted flex-shrink-0"}),n.jsxs("span",{className:"type-data-xs text-text-secondary tabular-nums",children:[Nc(c.uptime_seconds)," uptime"]})]}),n.jsx("div",{className:"px-3 pb-3",children:n.jsx("div",{className:"bg-subtle-fill rounded-xl p-3",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(R,{className:"w-4 h-4 text-accent-primary"}),n.jsx("span",{className:"type-data-xs text-text-muted",children:"Noise Floor"})]}),n.jsx("span",{className:"type-data text-text-primary tabular-nums",children:null!=O?`${O.toFixed(0)} dBm`:"—"})]})})}),n.jsxs("div",{className:"px-6 py-3 flex items-center gap-3 border-t border-border-subtle",children:[n.jsx(Zl,{showLabel:!0}),(null==c?void 0:c.version)&&n.jsxs("span",{className:"type-data-xs text-text-muted truncate max-w-[140px]",title:`v${c.version}`,children:["v",c.version]})]}),n.jsx("div",{className:"px-3 pb-3",children:n.jsxs("button",{onClick:()=>{Vo(),window.location.href="/login"},className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl text-text-muted hover:text-accent-danger hover:bg-accent-danger/10 transition-all duration-150",children:[n.jsx(z,{className:"w-4 h-4"}),n.jsx("span",{className:"type-body-sm",children:"Sign Out"}),m&&n.jsxs("span",{className:"ml-auto type-data-xs text-text-muted",children:["(",m,")"]})]})})]})]})}function Wc(){const e=Hl(),t=e.isLoading||e.isBackgroundLoading||e.isTopologyLoading;return n.jsxs(po,{children:[n.jsxs(bo,{children:[n.jsx("h1",{className:"sr-only",children:"pyMC Console"}),n.jsx(jo,{height:26,className:"block"}),t&&n.jsx(sc,{className:"ml-2"})]}),n.jsx(yo,{}),n.jsxs(bo,{children:[n.jsxs("p",{className:"type-data-xs text-text-muted",children:["v",So]}),n.jsx(Zl,{})]})]})}const Hc=s.memo(function(){const{theme:e}=vr(),{backgroundImage:t,brightness:s,colorScheme:a}=e,r=Oe(a),o=(null==r?void 0:r.meta.backgroundImage)||null==r?void 0:r.meta.backgroundColor,i=(100-s)/100;return n.jsxs(n.Fragment,{children:[t?n.jsx("div",{className:"fixed inset-0 -z-20",style:{contain:"paint"},"aria-hidden":"true",children:n.jsx("div",{className:"absolute inset-0 bg-cover bg-center bg-no-repeat transition-opacity duration-300 ease-out",style:{backgroundImage:`url(${t})`}})}):o?n.jsx("div",{className:"fixed inset-0 -z-20 transition-colors duration-300 ease-out",style:{backgroundColor:o,contain:"paint"},"aria-hidden":"true"}):null,n.jsx("div",{className:"fixed inset-0 -z-10 bg-black pointer-events-none transition-opacity duration-200 ease-out",style:{opacity:i,contain:"paint"},"aria-hidden":"true"})]})}),Uc=20,qc=12,Gc=s.createContext(null);function Jc({children:e}){const[t,a]=s.useState({content:null,mouseX:0,mouseY:0,visible:!1}),r=s.useRef(null),[o,i]=s.useState({x:0,y:0}),l=s.useCallback((e,t,s)=>{a({content:e,mouseX:t,mouseY:s,visible:!0})},[]),c=s.useCallback(()=>{a(e=>({...e,visible:!1}))},[]),u=s.useCallback((e,t)=>{a(s=>s.visible?{...s,mouseX:e,mouseY:t}:s)},[]);s.useEffect(()=>{if(!t.visible||!r.current)return;const e=r.current.getBoundingClientRect(),{mouseX:s,mouseY:n}=t,a=window.innerWidth,o=window.innerHeight;let l,c;l=s+Uc+e.width+qc>a?s-Uc-e.width:s+Uc,l=Math.max(qc,Math.min(l,a-e.width-qc)),c=n-Uc-e.height{c.current&&(clearTimeout(c.current),c.current=null)},h=s.useCallback(t=>{d(),c.current=setTimeout(()=>{u.current=!0,r(e,t.clientX,t.clientY)},a)},[r,e,a]),m=s.useCallback(e=>{u.current&&i(e.clientX,e.clientY)},[i]),f=s.useCallback(()=>{d(),u.current=!1,o()},[o]),g=s.useCallback(()=>{if(d(),!l.current)return;const t=l.current.getBoundingClientRect();c.current=setTimeout(()=>{u.current=!0,r(e,t.left+t.width/2,t.top)},a)},[r,e,a]),p=s.useCallback(()=>{d(),u.current=!1,o()},[o]);return s.useEffect(()=>()=>{d(),u.current&&(u.current=!1,o())},[o]),s.useEffect(()=>{const e=()=>{u.current&&(d(),u.current=!1,o())};return document.addEventListener("click",e,!0),()=>document.removeEventListener("click",e,!0)},[o]),n.jsx("span",{ref:l,onMouseEnter:h,onMouseMove:m,onMouseLeave:f,onFocus:g,onBlur:p,className:"contents",children:t})}function Vc({className:e=""}){return n.jsx("div",{className:`bg-white/5 animate-pulse rounded-lg ${e}`,"aria-hidden":"true"})}function Kc(){return n.jsxs("div",{className:"section-gap","aria-label":"Loading dashboard",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx(Vc,{className:"h-8 w-48"}),n.jsx(Vc,{className:"h-8 w-32"})]}),n.jsx(Vc,{className:"h-72"}),n.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-8 gap-3",children:Array.from({length:8}).map((e,t)=>n.jsx(Vc,{className:"h-24"},t))}),n.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:Array.from({length:4}).map((e,t)=>n.jsx(Vc,{className:"h-44"},t))}),n.jsx(Vc,{className:"h-96"})]})}function Xc(){return n.jsxs("div",{className:"section-gap","aria-label":"Loading list",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx(Vc,{className:"h-8 w-40"}),n.jsx(Vc,{className:"h-8 w-24"})]}),n.jsx(Vc,{className:"h-20"}),n.jsxs("div",{className:"glass-card overflow-hidden",children:[n.jsx(Vc,{className:"h-10 rounded-none"}),n.jsx("div",{className:"divide-y divide-border-subtle/30",children:Array.from({length:10}).map((e,t)=>n.jsx("div",{className:"px-4 py-3",children:n.jsx(Vc,{className:"h-6"})},t))})]})]})}function Qc(){return n.jsxs("div",{className:"section-gap","aria-label":"Loading map",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx(Vc,{className:"h-8 w-32"}),n.jsx(Vc,{className:"h-6 w-48"})]}),n.jsx(Vc,{className:"h-[500px]"}),n.jsx(Vc,{className:"h-64"})]})}function Zc(){return n.jsxs("div",{className:"section-gap","aria-label":"Loading charts",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx(Vc,{className:"h-8 w-36"}),n.jsx(Vc,{className:"h-8 w-40"})]}),n.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[n.jsx(Vc,{className:"h-80"}),n.jsx(Vc,{className:"h-80"})]}),n.jsx(Vc,{className:"h-64"})]})}function eu(){return n.jsxs("div",{className:"section-gap","aria-label":"Loading settings",children:[n.jsx(Vc,{className:"h-8 w-32"}),n.jsxs("div",{className:"space-y-6",children:[n.jsx(Vc,{className:"h-48"}),n.jsx(Vc,{className:"h-64"}),n.jsx(Vc,{className:"h-32"})]})]})}function tu(){return n.jsxs("div",{className:"section-gap","aria-label":"Loading system info",children:[n.jsx(Vc,{className:"h-8 w-28"}),n.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:Array.from({length:4}).map((e,t)=>n.jsx(Vc,{className:"h-28"},t))}),n.jsx(Vc,{className:"h-64"}),n.jsx(Vc,{className:"h-48"})]})}const su={hidden:{opacity:0,scale:.9},visible:{opacity:1,scale:1,transition:{type:"spring",stiffness:400,damping:15}},exit:{opacity:0,scale:.9,transition:{duration:.15}}},nu={initial:{opacity:0,y:8},animate:{opacity:1,y:0,transition:{duration:.3,ease:to.cubicInOut}},exit:{opacity:0,y:-8,transition:{duration:.15,ease:to.easeIn}}};function au({children:e,layoutKey:t}){return O()?n.jsx(n.Fragment,{children:e}):n.jsx(c.div,{initial:"initial",animate:"animate",exit:"exit",variants:nu,children:e},t)}const ru=s.lazy(()=>G(()=>import("./Login-CkRuF4n8.js"),__vite__mapDeps([0,1,2]))),ou=s.lazy(()=>G(()=>import("./Dashboard-DiETwG01.js"),__vite__mapDeps([3,1,2,4,5,6,7,8,9,10,11,12,13,14]))),iu=s.lazy(()=>G(()=>import("./Packets-BHJJxf8a.js"),__vite__mapDeps([15,1,2,6,7,8,9,4,5,13]))),lu=s.lazy(()=>G(()=>import("./Contacts-CyyU4xmf.js").then(e=>e.C),__vite__mapDeps([16,1,2,17,5,9,8,18,19,20,21]))),cu=s.lazy(()=>G(()=>import("./Statistics-sXHAGtEF.js"),__vite__mapDeps([22,1,2,23,4,10,5,9,18,19,13,14,21]))),uu=s.lazy(()=>G(()=>import("./MeshGraph-DfCwG9Nt.js"),__vite__mapDeps([24,1,2,25]))),du=s.lazy(()=>G(()=>import("./System-BPwbPFCW.js"),__vite__mapDeps([26,1,2,4,5,14,13]))),hu=s.lazy(()=>G(()=>import("./Logs-Cb5GXQFD.js"),__vite__mapDeps([27,1,2,23,5,13]))),mu=s.lazy(()=>G(()=>import("./Terminal-jVZnyeIH.js"),__vite__mapDeps([28,1,2,17,7,5]))),fu=s.lazy(()=>G(()=>import("./Configuration-BOsliPZn.js"),__vite__mapDeps([29,1,2,20,30,12,5,9,13,14])));function gu({children:e}){const t=v();return Bo()?n.jsx(n.Fragment,{children:e}):n.jsx(H,{to:"/login",state:{from:t},replace:!0})}class pu extends s.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}render(){var e;return this.state.hasError?n.jsxs("div",{className:"glass-card p-8 text-center",children:[n.jsx("p",{className:"type-subheading text-accent-red mb-2",children:"Page failed to render"}),n.jsx("p",{className:"type-body text-white/50 mb-4",children:(null==(e=this.state.error)?void 0:e.message)||"Unknown error"}),n.jsx("button",{onClick:()=>this.setState({hasError:!1}),className:"px-4 py-2 bg-accent-primary/20 text-accent-primary rounded-lg hover:bg-accent-primary/30 transition-colors",children:"Try Again"})]}):this.props.children}}function bu(){const e=Ll(e=>e.initializeApp),t=Bo();return s.useEffect(()=>{if(!t)return;e();const s=setInterval(()=>{Yo()},3e4);return Yo(),Xo(),()=>clearInterval(s)},[e,t]),n.jsxs(Jc,{children:[n.jsx(Hc,{}),n.jsxs($,{children:[n.jsx(W,{path:"/login",element:n.jsx(s.Suspense,{fallback:n.jsx("div",{className:"min-h-screen bg-bg-body"}),children:n.jsx(ru,{})})}),n.jsx(W,{path:"/*",element:n.jsx(gu,{children:n.jsx(go,{sidebar:n.jsx($c,{}),navbar:n.jsx(Wc,{}),children:n.jsx("div",{className:"px-4 sm:px-6 lg:px-8 pt-5 pb-4 sm:pb-6 lg:pb-8 max-w-7xl mx-auto",children:n.jsx(pu,{children:n.jsxs($,{children:[n.jsx(W,{path:"/",element:n.jsx(s.Suspense,{fallback:n.jsx(Kc,{}),children:n.jsx(au,{children:n.jsx(ou,{})})})}),n.jsx(W,{path:"/packets",element:n.jsx(s.Suspense,{fallback:n.jsx(Xc,{}),children:n.jsx(au,{children:n.jsx(iu,{})})})}),n.jsx(W,{path:"/contacts",element:n.jsx(s.Suspense,{fallback:n.jsx(Qc,{}),children:n.jsx(au,{children:n.jsx(lu,{})})})}),n.jsx(W,{path:"/statistics",element:n.jsx(s.Suspense,{fallback:n.jsx(Zc,{}),children:n.jsx(au,{children:n.jsx(cu,{})})})}),n.jsx(W,{path:"/meshgraph",element:n.jsx(s.Suspense,{fallback:n.jsx(Zc,{}),children:n.jsx(au,{children:n.jsx(uu,{})})})}),n.jsx(W,{path:"/system",element:n.jsx(s.Suspense,{fallback:n.jsx(tu,{}),children:n.jsx(au,{children:n.jsx(du,{})})})}),n.jsx(W,{path:"/logs",element:n.jsx(s.Suspense,{fallback:n.jsx(Xc,{}),children:n.jsx(au,{children:n.jsx(hu,{})})})}),n.jsx(W,{path:"/terminal",element:n.jsx(s.Suspense,{fallback:n.jsx(Xc,{}),children:n.jsx(au,{children:n.jsx(mu,{})})})}),n.jsx(W,{path:"/configuration",element:n.jsx(s.Suspense,{fallback:n.jsx(eu,{}),children:n.jsx(au,{children:n.jsx(fu,{})})})})]})})})})})})]})]})}const yu=console.warn;console.warn=(...e)=>{const t=e[0];if("string"==typeof t){if(t.includes("width")&&t.includes("height")&&t.includes("chart should be greater than 0"))return;if(t.includes("Unable to load glyph range"))return}yu.apply(console,e)},U.createRoot(document.getElementById("root")).render(n.jsx(s.StrictMode,{children:n.jsx(wr,{children:n.jsx(q,{children:n.jsx(bu,{})})})}));export{ac as $,Dc as A,Ar as B,Mr as C,Xi as D,Lr as E,sl as F,Ki as G,Jr as H,Ec as I,bc as J,hc as K,Zl as L,kc as M,Vr as N,Qr as O,jo as P,Rr as Q,Cr as R,el as S,Yc as T,Rc as U,Pc as V,jr as W,yc as X,Sc as Y,Ac as Z,ic as _,so as a,wc as a0,Nl as a1,Wl as a2,uc as a3,dc as a4,Xl as a5,_c as a6,X as a7,K as a8,Oe as a9,gi as aA,pi as aB,bi as aC,fi as aD,yi as aE,ti as aF,Xe as aG,nt as aH,Ji as aI,Ic as aJ,Fc as aK,Xr as aL,Zr as aM,Mi as aN,Vi as aO,Tr as aP,Gl as aQ,$i as aR,tc as aS,su as aT,fr as aa,ni as ab,ai as ac,br as ad,vr as ae,xc as af,vc as ag,Cc as ah,Qi as ai,tl as aj,Ul as ak,cc as al,jc as am,Lc as an,Bl as ao,Ol as ap,hi as aq,mi as ar,nl as as,Nc as at,Il as au,Fl as av,Rl as aw,rl as ax,So as ay,oi as az,eo as b,Dl as c,Al as d,_l as e,ql as f,Do as g,$l as h,Bo as i,Yl as j,li as k,qo as l,Jl as m,Yi as n,El as o,Kl as p,Vl as q,Hl as r,Io as s,di as t,Pl as u,zl as v,Fi as w,Sr as x,Wr as y,Er as z}; diff --git a/frontend/dist/assets/info-HmV1qkUD.js b/frontend/dist/assets/info-HmV1qkUD.js new file mode 100644 index 00000000..a5115689 --- /dev/null +++ b/frontend/dist/assets/info-HmV1qkUD.js @@ -0,0 +1 @@ +import{c as e}from"./index-BGs2yNOg.js";const c=e("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);export{c as I}; diff --git a/frontend/dist/assets/link-scoring-Cw0dJsWv.js b/frontend/dist/assets/link-scoring-Cw0dJsWv.js deleted file mode 100644 index d3e317f4..00000000 --- a/frontend/dist/assets/link-scoring-Cw0dJsWv.js +++ /dev/null @@ -1 +0,0 @@ -import{n as t,aP as e}from"./index-BJEgt3tp.js";function n(t){if(Array.isArray(t))return t;if("string"==typeof t&&t.startsWith("["))try{const e=JSON.parse(t);return Array.isArray(e)?e:[]}catch{return[]}return[]}function o(o,r,s){const a=new Map;for(const e of r){const n=t(e);a.has(n)||a.set(n,e)}const c=new Map,i=new Map;for(const t of o){const o=t.route??t.route_type;if(!e(o))continue;const r=n(t.original_path);if(0===r.length)continue;const f=r.map(t=>t.toUpperCase());if(!t.transmitted&&f.length>=2){const t=f[f.length-2];if(t){const e=a.get(t);e&&i.set(e,(i.get(e)??0)+1)}}if(f.includes(s))for(const t of f){if(t===s)continue;const e=a.get(t);e&&c.set(e,(c.get(e)??0)+1)}}let f=0,u=0;for(const t of r)f=Math.max(f,c.get(t)??0),u=Math.max(u,i.get(t)??0);const h=new Map;let g=0,l=0,p=0;for(const t of r){const e=c.get(t)??0,n=i.get(t)??0,o=f>0?Math.round(e/f*100):0,r=u>0?Math.round(n/u*100):0,s=o+r;h.set(t,{hash:t,listenerCount:e,loudCount:n,listenerScore:o,loudScore:r,blendedScore:s}),g=Math.max(g,o),l=Math.max(l,r),p=Math.max(p,s)}return{scores:h,maxListenerScore:g,maxLoudScore:l,maxBlendedScore:p}}const r={YELLOW:"#FFB224",GREEN:"#46A758",RED:"#E5484D",GRAY:"#505050"};export{r as L,o as c}; diff --git a/frontend/dist/assets/link-scoring-DTgOSmRe.js b/frontend/dist/assets/link-scoring-DTgOSmRe.js new file mode 100644 index 00000000..cce9713a --- /dev/null +++ b/frontend/dist/assets/link-scoring-DTgOSmRe.js @@ -0,0 +1 @@ +import{p as t,bB as e}from"./index-BGs2yNOg.js";function o(t){if(Array.isArray(t))return t;if("string"==typeof t&&t.startsWith("["))try{const e=JSON.parse(t);return Array.isArray(e)?e:[]}catch{return[]}return[]}function n(n,r,s){const a=new Map;for(const e of r){const o=t(e);a.has(o)||a.set(o,e)}const c=new Map,i=new Map;for(const t of n){const n=t.route??t.route_type;if(!e(n))continue;const r=o(t.original_path);if(0===r.length)continue;const f=r.map(t=>t.toUpperCase());if(!t.transmitted&&f.length>=2){const t=f[f.length-2];if(t){const e=a.get(t);e&&i.set(e,(i.get(e)??0)+1)}}if(f.includes(s))for(const t of f){if(t===s)continue;const e=a.get(t);e&&c.set(e,(c.get(e)??0)+1)}}let f=0,u=0;for(const t of r)f=Math.max(f,c.get(t)??0),u=Math.max(u,i.get(t)??0);const h=new Map;let p=0,g=0,l=0;for(const t of r){const e=c.get(t)??0,o=i.get(t)??0,n=f>0?Math.round(e/f*100):0,r=u>0?Math.round(o/u*100):0,s=n+r;h.set(t,{hash:t,listenerCount:e,loudCount:o,listenerScore:n,loudScore:r,blendedScore:s}),p=Math.max(p,n),g=Math.max(g,r),l=Math.max(l,s)}return{scores:h,maxListenerScore:p,maxLoudScore:g,maxBlendedScore:l}}const r={YELLOW:"#FFB224",GREEN:"#46A758",RED:"#E5484D",GRAY:"#505050"};export{r as L,n as c}; diff --git a/frontend/dist/assets/loader-circle-CwUrmZrV.js b/frontend/dist/assets/loader-circle-CwUrmZrV.js new file mode 100644 index 00000000..394eab61 --- /dev/null +++ b/frontend/dist/assets/loader-circle-CwUrmZrV.js @@ -0,0 +1 @@ +import{c as a}from"./index-BGs2yNOg.js";const e=a("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);export{e as L}; diff --git a/frontend/dist/assets/map-pin-x5eP-WEg.js b/frontend/dist/assets/map-pin-x5eP-WEg.js new file mode 100644 index 00000000..270d9a24 --- /dev/null +++ b/frontend/dist/assets/map-pin-x5eP-WEg.js @@ -0,0 +1 @@ +import{c}from"./index-BGs2yNOg.js";const r=c("map-pin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);export{r as M}; diff --git a/frontend/dist/assets/network-DpalqfB8.js b/frontend/dist/assets/network-DpalqfB8.js new file mode 100644 index 00000000..1783338d --- /dev/null +++ b/frontend/dist/assets/network-DpalqfB8.js @@ -0,0 +1 @@ +import{c as e}from"./index-BGs2yNOg.js";const t=e("network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);export{t as N}; diff --git a/frontend/dist/assets/ping-DvLgBqTv.js b/frontend/dist/assets/ping-HGVILoRV.js similarity index 94% rename from frontend/dist/assets/ping-DvLgBqTv.js rename to frontend/dist/assets/ping-HGVILoRV.js index 90190331..4c241bbc 100644 --- a/frontend/dist/assets/ping-DvLgBqTv.js +++ b/frontend/dist/assets/ping-HGVILoRV.js @@ -1 +1 @@ -import{aF as t}from"./index-BJEgt3tp.js";async function e(e,r=10){return t("/api/ping_neighbor",{method:"POST",body:JSON.stringify({target_id:e,timeout:r})})}const r=["Chat Node","Repeater","Room Server","Hybrid Node","Unknown"];async function s(s,o=10){if(o<1||o>60)return{success:!1,error:"Timeout must be 1-60 seconds"};let n;const a=s.match(/^(0x)?([0-9a-fA-F]{1,2})$/);if(a)n=`0x${a[2].padStart(2,"0")}`;else{const e=await async function(e){const s=e.toLowerCase();for(const o of r)try{const e=await t(`/api/adverts_by_contact_type?contact_type=${encodeURIComponent(o)}&hours=168`),r=e.success&&e.data?e.data:e,n=(Array.isArray(r)?r:[]).find(t=>t.node_name&&t.node_name.toLowerCase()===s);if(n&&n.pubkey)return`0x${n.pubkey.substring(0,2)}`}catch{continue}return null}(s);if(!e)return{success:!1,error:`Node '${s}' not found`};n=e}const c=await e(n,o);if(!c.success||!c.data)return{success:!1,error:c.error||"Ping failed"};const i=(u=c.data).rtt_ms>500||u.rssi<-120?"Poor":u.rtt_ms>250||u.rssi<-100?"Fair":u.rtt_ms>100||u.rssi<-80?"Good":"Excellent";var u;return{success:!0,data:{...c.data,quality:i}}}export{s as a,e as p}; +import{bp as t}from"./index-BGs2yNOg.js";async function e(e,r=10){return t("/api/ping_neighbor",{method:"POST",body:JSON.stringify({target_id:e,timeout:r})})}const r=["Chat Node","Repeater","Room Server","Hybrid Node","Unknown"];async function s(s,o=10){if(o<1||o>60)return{success:!1,error:"Timeout must be 1-60 seconds"};let n;const a=s.match(/^(0x)?([0-9a-fA-F]{1,2})$/);if(a)n=`0x${a[2].padStart(2,"0")}`;else{const e=await async function(e){const s=e.toLowerCase();for(const o of r)try{const e=await t(`/api/adverts_by_contact_type?contact_type=${encodeURIComponent(o)}&hours=168`),r=e.success&&e.data?e.data:e,n=(Array.isArray(r)?r:[]).find(t=>t.node_name&&t.node_name.toLowerCase()===s);if(n&&n.pubkey)return`0x${n.pubkey.substring(0,2)}`}catch{continue}return null}(s);if(!e)return{success:!1,error:`Node '${s}' not found`};n=e}const c=await e(n,o);if(!c.success||!c.data)return{success:!1,error:c.error||"Ping failed"};const i=(u=c.data).rtt_ms>500||u.rssi<-120?"Poor":u.rtt_ms>250||u.rssi<-100?"Fair":u.rtt_ms>100||u.rssi<-80?"Good":"Excellent";var u;return{success:!0,data:{...c.data,quality:i}}}export{s as a,e as p}; diff --git a/frontend/dist/assets/recharts-6XUQYgRA.js b/frontend/dist/assets/recharts-6XUQYgRA.js deleted file mode 100644 index 5fa8f859..00000000 --- a/frontend/dist/assets/recharts-6XUQYgRA.js +++ /dev/null @@ -1 +0,0 @@ -var e=Object.defineProperty,t=(t,n,r)=>((t,n,r)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[n]=r)(t,"symbol"!=typeof n?n+"":n,r);import{r as n,a as r,b as i,R as a,s as o,P as c}from"./vendor-react-C341c8YC.js";import{g as l}from"./deckgl-DTsmDcfs.js";function u(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var i=e.length;for(t=0;t{var{children:r,width:i,height:a,viewBox:o,className:c,style:l,title:u,desc:f}=e,d=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{var{children:r,className:i}=e,a=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0))throw new Error(`invalid digits: ${e}`);if(t>15)return z;const n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;tD)if(Math.abs(s*c-l*u)>D&&i){let d=n-a,h=r-o,p=c*c+l*l,y=d*d+h*h,v=Math.sqrt(p),g=Math.sqrt(f),m=i*Math.tan((T-Math.acos((p+f-y)/(2*v*g)))/2),b=m/g,w=m/v;Math.abs(b-1)>D&&this._append`L${e+b*u},${t+b*s}`,this._append`A${i},${i},0,0,${+(s*d>u*h)},${this._x1=e+w*c},${this._y1=t+w*l}`}else this._append`L${this._x1=e},${this._y1=t}`}arc(e,t,n,r,i,a){if(e=+e,t=+t,a=!!a,(n=+n)<0)throw new Error(`negative radius: ${n}`);let o=n*Math.cos(r),c=n*Math.sin(r),l=e+o,u=t+c,s=1^a,f=a?r-i:i-r;null===this._x1?this._append`M${l},${u}`:(Math.abs(this._x1-l)>D||Math.abs(this._y1-u)>D)&&this._append`L${l},${u}`,n&&(f<0&&(f=f%I+I),f>N?this._append`A${n},${n},0,1,${s},${e-o},${t-c}A${n},${n},0,1,${s},${this._x1=l},${this._y1=u}`:f>D&&this._append`A${n},${n},0,${+(f>=T)},${s},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}}function R(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(null==n)t=null;else{const e=Math.floor(n);if(!(e>=0))throw new RangeError(`invalid digits: ${n}`);t=e}return e},()=>new L(t)}function B(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function K(e){this._context=e}function F(e){return new K(e)}function U(e){return e[0]}function W(e){return e[1]}function $(e,t){var n=E(!0),r=null,i=F,a=null,o=R(c);function c(c){var l,u,s,f=(c=B(c)).length,d=!1;for(null==r&&(a=i(s=o())),l=0;l<=f;++l)!(l=f;--d)c.point(g[d],m[d]);c.lineEnd(),c.areaEnd()}v&&(g[s]=+e(h,s,u),m[s]=+t(h,s,u),c.point(r?+r(h,s,u):g[s],n?+n(h,s,u):m[s]))}if(p)return c=null,p+""||null}function s(){return $().defined(i).curve(o).context(a)}return e="function"==typeof e?e:void 0===e?U:E(+e),t="function"==typeof t?t:E(void 0===t?0:+t),n="function"==typeof n?n:void 0===n?W:E(+n),u.x=function(t){return arguments.length?(e="function"==typeof t?t:E(+t),r=null,u):e},u.x0=function(t){return arguments.length?(e="function"==typeof t?t:E(+t),u):e},u.x1=function(e){return arguments.length?(r=null==e?null:"function"==typeof e?e:E(+e),u):r},u.y=function(e){return arguments.length?(t="function"==typeof e?e:E(+e),n=null,u):t},u.y0=function(e){return arguments.length?(t="function"==typeof e?e:E(+e),u):t},u.y1=function(e){return arguments.length?(n=null==e?null:"function"==typeof e?e:E(+e),u):n},u.lineX0=u.lineY0=function(){return s().x(e).y(t)},u.lineY1=function(){return s().x(e).y(n)},u.lineX1=function(){return s().x(r).y(t)},u.defined=function(e){return arguments.length?(i="function"==typeof e?e:E(!!e),u):i},u.curve=function(e){return arguments.length?(o=e,null!=a&&(c=o(a)),u):o},u.context=function(e){return arguments.length?(null==e?a=c=null:c=o(a=e),u):a},u}K.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t)}}};class V{constructor(e,t){this._context=e,this._x=t}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line}point(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,t,e,t):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+t)/2,e,this._y0,e,t)}this._x0=e,this._y0=t}}const q={draw(e,t){const n=k(t/M);e.moveTo(n,0),e.arc(0,0,n,0,C)}},Y={draw(e,t){const n=k(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},X=k(1/3),G=2*X,Z={draw(e,t){const n=k(t/G),r=n*X;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},Q={draw(e,t){const n=k(t),r=-n/2;e.rect(r,r,n,n)}},J=S(M/10)/S(7*M/10),ee=S(C/10)*J,te=-j(C/10)*J,ne={draw(e,t){const n=k(.8908130915292852*t),r=ee*n,i=te*n;e.moveTo(0,-n),e.lineTo(r,i);for(let a=1;a<5;++a){const t=C*a/5,o=j(t),c=S(t);e.lineTo(c*n,-o*n),e.lineTo(o*r-c*i,c*r+o*i)}e.closePath()}},re=k(3),ie={draw(e,t){const n=-k(t/(3*re));e.moveTo(0,2*n),e.lineTo(-re*n,-n),e.lineTo(re*n,-n),e.closePath()}},ae=-.5,oe=k(3)/2,ce=1/k(12),le=3*(ce/2+1),ue={draw(e,t){const n=k(t/le),r=n/2,i=n*ce,a=r,o=n*ce+n,c=-a,l=o;e.moveTo(r,i),e.lineTo(a,o),e.lineTo(c,l),e.lineTo(ae*r-oe*i,oe*r+ae*i),e.lineTo(ae*a-oe*o,oe*a+ae*o),e.lineTo(ae*c-oe*l,oe*c+ae*l),e.lineTo(ae*r+oe*i,ae*i-oe*r),e.lineTo(ae*a+oe*o,ae*o-oe*a),e.lineTo(ae*c+oe*l,ae*l-oe*c),e.closePath()}};function se(){}function fe(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function de(e){this._context=e}function he(e){this._context=e}function pe(e){this._context=e}function ye(e){this._context=e}function ve(e){return e<0?-1:1}function ge(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),c=(a*i+o*r)/(r+i);return(ve(a)+ve(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(c))||0}function me(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function be(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,c=(a-r)/3;e._context.bezierCurveTo(r+c,i+c*t,a-c,o-c*n,a,o)}function we(e){this._context=e}function xe(e){this._context=new Oe(e)}function Oe(e){this._context=e}function _e(e){this._context=e}function Pe(e){var t,n,r=e.length-1,i=new Array(r),a=new Array(r),o=new Array(r);for(i[0]=0,a[0]=2,o[0]=e[0]+2*e[1],t=1;t=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[r-1]=(e[r]+i[r-1])/2,t=0;t1)for(var n,r,i,a=1,o=e[t[0]],c=o.length;a=0;)n[t]=t;return n}function Se(e,t){return e[t]}function ke(e){const t=[];return t.key=e,t}de.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:fe(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:fe(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}},he.prototype={areaStart:se,areaEnd:se,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:fe(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}},pe.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:fe(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}},ye.prototype={areaStart:se,areaEnd:se,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}},we.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:be(this,this._t0,me(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(t=+t,(e=+e)!==this._x1||t!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,be(this,me(this,n=ge(this,e,t)),n);break;default:be(this,this._t0,n=ge(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}},(xe.prototype=Object.create(we.prototype)).point=function(e,t){we.prototype.point.call(this,t,e)},Oe.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}},_e.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),2===n)this._context.lineTo(e[1],t[1]);else for(var r=Pe(e),i=Pe(t),a=0,o=1;o=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}}this._x=e,this._y=t}};var Me,Ce={},Te={};function Ie(){return Me||(Me=1,e=Te,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e.isUnsafeProperty=function(e){return"__proto__"===e}),Te;var e}var De,Ne={};function ze(){return De||(De=1,e=Ne,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e.isDeepKey=function(e){switch(typeof e){case"number":case"symbol":return!1;case"string":return e.includes(".")||e.includes("[")||e.includes("]")}}),Ne;var e}var Le,Re={};function Be(){return Le||(Le=1,e=Re,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e.toKey=function(e){var t;return"string"==typeof e||"symbol"==typeof e?e:Object.is(null==(t=null==e?void 0:e.valueOf)?void 0:t.call(e),-0)?"-0":String(e)}),Re;var e}var Ke,Fe,Ue,We,$e,He={},Ve={};function qe(){return Ke||(Ke=1,e=Ve,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e.toString=function e(t){if(null==t)return"";if("string"==typeof t)return t;if(Array.isArray(t))return t.map(e).join(",");const n=String(t);return"0"===n&&Object.is(Number(t),-0)?"-0":n}),Ve;var e}function Ye(){return Fe||(Fe=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=qe(),n=Be();e.toPath=function(e){if(Array.isArray(e))return e.map(n.toKey);if("symbol"==typeof e)return[e];const r=[],i=(e=t.toString(e)).length;if(0===i)return r;let a=0,o="",c="",l=!1;for(46===e.charCodeAt(0)&&(r.push(""),a++);a0===e?0:e>0?1:-1,Je=e=>"number"==typeof e&&e!=+e,et=e=>"string"==typeof e&&e.indexOf("%")===e.length-1,tt=e=>("number"==typeof e||e instanceof Number)&&!Je(e),nt=e=>tt(e)||"string"==typeof e,rt=0,it=e=>{var t=++rt;return"".concat(e||"").concat(t)},at=function(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!tt(e)&&"string"!=typeof e)return r;if(et(e)){if(null==t)return r;var a=e.indexOf("%");n=t*parseFloat(e.slice(0,a))/100}else n=+e;return Je(n)&&(n=r),i&&null!=t&&n>t&&(n=t),n},ot=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;re&&("function"==typeof t?t(e):Ze(e,t))===n)}var ut=e=>null==e,st=e=>ut(e)?e:"".concat(e.charAt(0).toUpperCase()).concat(e.slice(1));function ft(e){return null!=e}function dt(){}var ht=["type","size","sizeType"];function pt(){return pt=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{type:t="circle",size:r=64,sizeType:i="area"}=e,a=vt(vt({},function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{var e=(e=>{var t="symbol".concat(st(e));return mt[t]||q})(o),t=function(e,t){let n=null,r=R(i);function i(){let i;if(n||(n=i=r()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),i)return n=null,i+""||null}return e="function"==typeof e?e:E(e||q),t="function"==typeof t?t:E(void 0===t?64:+t),i.type=function(t){return arguments.length?(e="function"==typeof t?t:E(t),i):e},i.size=function(e){return arguments.length?(t="function"==typeof e?e:E(+e),i):t},i.context=function(e){return arguments.length?(n=null==e?null:e,i):n},i}().type(e).size(((e,t,n)=>{if("area"===t)return e;switch(n){case"cross":return 5*e*e/9;case"diamond":return.5*e*e/Math.sqrt(3);case"square":return e*e;case"star":var r=18*bt;return 1.25*e*e*(Math.tan(r)-Math.tan(2*r)*Math.tan(r)**2);case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}})(r,i,o)),n=t();if(null!==n)return n})()})):null};wt.registerSymbol=(e,t)=>{mt["symbol".concat(st(e))]=t};var xt=e=>"radius"in e&&"startAngle"in e&&"endAngle"in e,Ot=(e,t)=>{if(!e||"function"==typeof e||"boolean"==typeof e)return null;var r=e;if(n.isValidElement(e)&&(r=e.props),"object"!=typeof r&&"function"!=typeof r)return null;var i={};return Object.keys(r).forEach(e=>{d(e)&&(i[e]=t=>r[e](r,t))}),i};function _t(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Pt(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function At(e,t){var n=function(e){for(var t=1;t(void 0===e[t]&&void 0!==r[t]&&(e[t]=r[t]),e),n)}var Et,jt={},St={};function kt(){return Et||(Et=1,e=St,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e.uniqBy=function(e,t){const n=new Map;for(let r=0;r=0}),Lt;var e}function Bt(){return Dt||(Dt=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Rt();e.isArrayLike=function(e){return null!=e&&"function"!=typeof e&&t.isLength(e.length)}}(zt)),zt}var Kt,Ft,Ut={};function Wt(){return Kt||(Kt=1,e=Ut,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e.isObjectLike=function(e){return"object"==typeof e&&null!==e}),Ut;var e}function $t(){return Ft||(Ft=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Bt(),n=Wt();e.isArrayLikeObject=function(e){return n.isObjectLike(e)&&t.isArrayLike(e)}}(Nt)),Nt}var Ht,Vt={},qt={};function Yt(){return Ht||(Ht=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Xe();e.property=function(e){return function(n){return t.get(n,e)}}}(qt)),qt}var Xt,Gt={},Zt={},Qt={},Jt={};function en(){return Xt||(Xt=1,e=Jt,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e.isObject=function(e){return null!==e&&("object"==typeof e||"function"==typeof e)}),Jt;var e}var tn,nn={};function rn(){return tn||(tn=1,e=nn,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e.isPrimitive=function(e){return null==e||"object"!=typeof e&&"function"!=typeof e}),nn;var e}var an,on,cn,ln={};function un(){return an||(an=1,e=ln,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e.eq=function(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}),ln;var e}function sn(){return on||(on=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=en(),n=rn(),r=un();function i(e,c,l,u){if(c===e)return!0;switch(typeof c){case"object":return function(e,t,r,i){if(null==t)return!0;if(Array.isArray(t))return a(e,t,r,i);if(t instanceof Map)return function(e,t,n,r){if(0===t.size)return!0;if(!(e instanceof Map))return!1;for(const[i,a]of t.entries())if(!1===n(e.get(i),a,i,e,t,r))return!1;return!0}(e,t,r,i);if(t instanceof Set)return o(e,t,r,i);const c=Object.keys(t);if(null==e)return 0===c.length;if(0===c.length)return!0;if(null==i?void 0:i.has(t))return i.get(t)===e;null==i||i.set(t,e);try{for(let a=0;a0?i(e,{...c},l,u):r.eq(e,c);default:return t.isObject(e)?"string"!=typeof c||""===c:r.eq(e,c)}}function a(e,t,n,r){if(0===t.length)return!0;if(!Array.isArray(e))return!1;const i=new Set;for(let a=0;a{}):i(t,n,function e(t,n,a,o,c,l){const u=r(t,n,a,o,c,l);return void 0!==u?Boolean(u):i(t,n,e,l)},new Map)},e.isSetMatch=o}(Qt)),Qt}function fn(){return cn||(cn=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=sn();e.isMatch=function(e,n){return t.isMatchWith(e,n,()=>{})}}(Zt)),Zt}var dn,hn={},pn={},yn={};function vn(){return dn||(dn=1,e=yn,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e.getSymbols=function(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}),yn;var e}var gn,mn={};function bn(){return gn||(gn=1,e=mn,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e.getTag=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}),mn;var e}var wn,xn={};function On(){return wn||(wn=1,e=xn,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e.argumentsTag="[object Arguments]",e.arrayBufferTag="[object ArrayBuffer]",e.arrayTag="[object Array]",e.bigInt64ArrayTag="[object BigInt64Array]",e.bigUint64ArrayTag="[object BigUint64Array]",e.booleanTag="[object Boolean]",e.dataViewTag="[object DataView]",e.dateTag="[object Date]",e.errorTag="[object Error]",e.float32ArrayTag="[object Float32Array]",e.float64ArrayTag="[object Float64Array]",e.functionTag="[object Function]",e.int16ArrayTag="[object Int16Array]",e.int32ArrayTag="[object Int32Array]",e.int8ArrayTag="[object Int8Array]",e.mapTag="[object Map]",e.numberTag="[object Number]",e.objectTag="[object Object]",e.regexpTag="[object RegExp]",e.setTag="[object Set]",e.stringTag="[object String]",e.symbolTag="[object Symbol]",e.uint16ArrayTag="[object Uint16Array]",e.uint32ArrayTag="[object Uint32Array]",e.uint8ArrayTag="[object Uint8Array]",e.uint8ClampedArrayTag="[object Uint8ClampedArray]"),xn;var e}var _n,Pn,An,En,jn={};function Sn(){return _n||(_n=1,e=jn,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e.isTypedArray=function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}),jn;var e}function kn(){return Pn||(Pn=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=vn(),n=bn(),r=On(),i=rn(),a=Sn();function o(e,t,l,u=new Map,s=void 0){const f=null==s?void 0:s(e,t,l,u);if(void 0!==f)return f;if(i.isPrimitive(e))return e;if(u.has(e))return u.get(e);if(Array.isArray(e)){const t=new Array(e.length);u.set(e,t);for(let n=0;nt.isMatch(n,e)}}(Gt)),Gt}var Tn,In,Dn={},Nn={},zn={};function Ln(){return Tn||(Tn=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=kn(),n=On();e.cloneDeepWith=function(e,r){return t.cloneDeepWith(e,(i,a,o,c)=>{const l=null==r?void 0:r(i,a,o,c);if(void 0!==l)return l;if("object"==typeof e)switch(Object.prototype.toString.call(e)){case n.numberTag:case n.stringTag:case n.booleanTag:{const n=new e.constructor(null==e?void 0:e.valueOf());return t.copyProperties(n,e),n}case n.argumentsTag:{const n={};return t.copyProperties(n,e),n.length=e.length,n[Symbol.iterator]=e[Symbol.iterator],n}default:return}})}}(zn)),zn}function Rn(){return In||(In=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Ln();e.cloneDeep=function(e){return t.cloneDeepWith(e)}}(Nn)),Nn}var Bn,Kn={},Fn={};function Un(){return Bn||(Bn=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=/^(?:0|[1-9]\d*)$/;e.isIndex=function(e,n=Number.MAX_SAFE_INTEGER){switch(typeof e){case"number":return Number.isInteger(e)&&e>=0&&ee,pr=()=>{var e=n.useContext(dr);return e?e.store.dispatch:hr},yr=()=>{},vr=()=>yr,gr=(e,t)=>e===t;function mr(e){var t=n.useContext(dr);return fr.useSyncExternalStoreWithSelector(t?t.subscription.addNestedSub:vr,t?t.store.getState:yr,t?t.store.getState:yr,t?e:yr,gr)}var br=e=>Array.isArray(e)?e:[e];var wr="undefined"!=typeof WeakRef?WeakRef:class{constructor(e){this.value=e}deref(){return this.value}};function xr(){return{s:0,v:void 0,o:null,p:null}}function Or(e,t={}){let n={s:0,v:void 0,o:null,p:null};const{resultEqualityCheck:r}=t;let i,a=0;function o(){var t;let o=n;const{length:c}=arguments;for(let e=0,n=c;e{n={s:0,v:void 0,o:null,p:null},o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function _r(e,...t){const n="function"==typeof e?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t,r=0,i=0,a={},o=e.pop();"object"==typeof o&&(a=o,o=e.pop()),function(e,t="expected a function, instead received "+typeof e){if("function"!=typeof e)throw new TypeError(t)}(o,`createSelector expects an output function after the inputs, but received: [${typeof o}]`);const c={...n,...a},{memoize:l,memoizeOptions:u=[],argsMemoize:s=Or,argsMemoizeOptions:f=[]}=c,d=br(u),h=br(f),p=function(e){const t=Array.isArray(e[0])?e[0]:e;return function(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(e=>"function"==typeof e)){const n=e.map(e=>"function"==typeof e?`function ${e.name||"unnamed"}()`:typeof e).join(", ");throw new TypeError(`${t}[${n}]`)}}(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}(e),y=l(function(){return r++,o.apply(null,arguments)},...d),v=s(function(){i++;const e=function(e,t){const n=[],{length:r}=e;for(let i=0;ii,resetDependencyRecomputations:()=>{i=0},lastResult:()=>t,recomputations:()=>r,resetRecomputations:()=>{r=0},memoize:l,argsMemoize:s})};return Object.assign(r,{withTypes:()=>r}),r}var Pr,Ar=_r(Or),Er=Object.assign((e,t=Ar)=>{!function(e,t="expected an object, instead received "+typeof e){if("object"!=typeof e)throw new TypeError(t)}(e,"createStructuredSelector expects first argument to be an object where each property is a selector, instead received a "+typeof e);const n=Object.keys(e);return t(n.map(t=>e[t]),(...e)=>e.reduce((e,t,r)=>(e[n[r]]=t,e),{}))},{withTypes:()=>Er}),jr={},Sr={},kr={};function Mr(){return Pr||(Pr=1,function(e){function t(e){return"symbol"==typeof e?1:null===e?2:void 0===e?3:e!=e?4:0}Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e.compareValues=(e,n,r)=>{if(e!==n){const i=t(e),a=t(n);if(i===a&&0===i){if(en)return"desc"===r?-1:1}return"desc"===r?a-i:i-a}return 0}}(kr)),kr}var Cr,Tr,Ir,Dr={},Nr={};function zr(){return Cr||(Cr=1,e=Nr,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e.isSymbol=function(e){return"symbol"==typeof e||e instanceof Symbol}),Nr;var e}function Lr(){return Tr||(Tr=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=zr(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;e.isKey=function(e,i){return!Array.isArray(e)&&(!("number"!=typeof e&&"boolean"!=typeof e&&null!=e&&!t.isSymbol(e))||"string"==typeof e&&(r.test(e)||!n.test(e))||null!=i&&Object.hasOwn(i,e))}}(Dr)),Dr}function Rr(){return Ir||(Ir=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Mr(),n=Lr(),r=Ye();e.orderBy=function(e,i,a,o){if(null==e)return[];a=o?void 0:a,Array.isArray(e)||(e=Object.values(e)),Array.isArray(i)||(i=null==i?[null]:[i]),0===i.length&&(i=[null]),Array.isArray(a)||(a=null==a?[]:[a]),a=a.map(e=>String(e));const c=(e,t)=>{let n=e;for(let r=0;r(Array.isArray(e)&&1===e.length&&(e=e[0]),null==e||"function"==typeof e||Array.isArray(e)||n.isKey(e)?e:{key:e,path:r.toPath(e)}));return e.map(e=>({original:e,criteria:l.map(t=>((e,t)=>null==t||null==e?t:"object"==typeof e&&"key"in e?Object.hasOwn(t,e.key)?t[e.key]:c(t,e.path):"function"==typeof e?e(t):Array.isArray(e)?c(t,e):"object"==typeof t?t[e]:t)(t,e))})).slice().sort((e,n)=>{for(let r=0;re.original)}}(Sr)),Sr}var Br,Kr={};function Fr(){return Br||(Br=1,e=Kr,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e.flatten=function(e,t=1){const n=[],r=Math.floor(t),i=(e,t)=>{for(let a=0;a1&&r.isIterateeCall(e,i[0],i[1])?i=[]:a>2&&r.isIterateeCall(i[0],i[1],i[2])&&(i=[i[0]]),t.orderBy(e,n.flatten(i),["asc"])}}(jr)),jr).sortBy)}const Xr=l(Yr());var Gr=e=>e.legend.settings;function Zr(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}Ar([e=>e.legend.payload,Gr],(e,t)=>{var{itemSorter:n}=t,r=e.flat(1);return n?Xr(r,n):r});var Qr=(()=>"function"==typeof Symbol&&Symbol.observable||"@@observable")(),Jr=()=>Math.random().toString(36).substring(7).split("").join("."),ei={INIT:`@@redux/INIT${Jr()}`,REPLACE:`@@redux/REPLACE${Jr()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Jr()}`};function ti(e){if("object"!=typeof e||null===e)return!1;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||null===Object.getPrototypeOf(e)}function ni(e,t,n){if("function"!=typeof e)throw new Error(Zr(2));if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(Zr(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(Zr(1));return n(ni)(e,t)}let r=e,i=t,a=new Map,o=a,c=0,l=!1;function u(){o===a&&(o=new Map,a.forEach((e,t)=>{o.set(t,e)}))}function s(){if(l)throw new Error(Zr(3));return i}function f(e){if("function"!=typeof e)throw new Error(Zr(4));if(l)throw new Error(Zr(5));let t=!0;u();const n=c++;return o.set(n,e),function(){if(t){if(l)throw new Error(Zr(6));t=!1,u(),o.delete(n),a=null}}}function d(e){if(!ti(e))throw new Error(Zr(7));if(void 0===e.type)throw new Error(Zr(8));if("string"!=typeof e.type)throw new Error(Zr(17));if(l)throw new Error(Zr(9));try{l=!0,i=r(i,e)}finally{l=!1}return(a=o).forEach(e=>{e()}),e}return d({type:ei.INIT}),{dispatch:d,subscribe:f,getState:s,replaceReducer:function(e){if("function"!=typeof e)throw new Error(Zr(10));r=e,d({type:ei.REPLACE})},[Qr]:function(){const e=f;return{subscribe(t){if("object"!=typeof t||null===t)throw new Error(Zr(11));function n(){const e=t;e.next&&e.next(s())}return n(),{unsubscribe:e(n)}},[Qr](){return this}}}}}function ri(e){const t=Object.keys(e),n={};for(let a=0;a{const n=e[t];if(void 0===n(void 0,{type:ei.INIT}))throw new Error(Zr(12));if(void 0===n(void 0,{type:ei.PROBE_UNKNOWN_ACTION()}))throw new Error(Zr(13))})}(n)}catch(eA){i=eA}return function(e={},t){if(i)throw i;let a=!1;const o={};for(let i=0;ie:1===e.length?e[0]:e.reduce((e,t)=>(...n)=>e(t(...n)))}function ai(e){return ti(e)&&"type"in e&&"string"==typeof e.type}var oi=Symbol.for("immer-nothing"),ci=Symbol.for("immer-draftable"),li=Symbol.for("immer-state");function ui(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var si=Object,fi=si.getPrototypeOf,di="constructor",hi="prototype",pi="configurable",yi="enumerable",vi="writable",gi="value",mi=e=>!!e&&!!e[li];function bi(e){var t;return!!e&&(Oi(e)||Si(e)||!!e[ci]||!!(null==(t=e[di])?void 0:t[ci])||ki(e)||Mi(e))}var wi=si[hi][di].toString(),xi=new WeakMap;function Oi(e){if(!e||!Ci(e))return!1;const t=fi(e);if(null===t||t===si[hi])return!0;const n=si.hasOwnProperty.call(t,di)&&t[di];if(n===Object)return!0;if(!Ti(n))return!1;let r=xi.get(n);return void 0===r&&(r=Function.toString.call(n),xi.set(n,r)),r===wi}function _i(e,t,n=!0){0===Pi(e)?(n?Reflect.ownKeys(e):si.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Pi(e){const t=e[li];return t?t.type_:Si(e)?1:ki(e)?2:Mi(e)?3:0}var Ai=(e,t,n=Pi(e))=>2===n?e.has(t):si[hi].hasOwnProperty.call(e,t),Ei=(e,t,n=Pi(e))=>2===n?e.get(t):e[t],ji=(e,t,n,r=Pi(e))=>{2===r?e.set(t,n):3===r?e.add(n):e[t]=n},Si=Array.isArray,ki=e=>e instanceof Map,Mi=e=>e instanceof Set,Ci=e=>"object"==typeof e,Ti=e=>"function"==typeof e,Ii=e=>"boolean"==typeof e,Di=e=>e.copy_||e.base_,Ni=e=>e.modified_?e.copy_:e.base_;function zi(e,t){if(ki(e))return new Map(e);if(Mi(e))return new Set(e);if(Si(e))return Array[hi].slice.call(e);const n=Oi(e);if(!0===t||"class_only"===t&&!n){const t=si.getOwnPropertyDescriptors(e);delete t[li];let n=Reflect.ownKeys(t);for(let r=0;r1&&si.defineProperties(e,{set:Ri,add:Ri,clear:Ri,delete:Ri}),si.freeze(e),t&&_i(e,(e,t)=>{Li(t,!0)},!1)),e}var Ri={[gi]:function(){ui(2)}};function Bi(e){return null===e||!Ci(e)||si.isFrozen(e)}var Ki="MapSet",Fi="Patches",Ui={};function Wi(e){const t=Ui[e];return t||ui(0),t}var $i,Hi=()=>$i;function Vi(e,t){t&&(e.patchPlugin_=Wi(Fi),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function qi(e){Yi(e),e.drafts_.forEach(Gi),e.drafts_=null}function Yi(e){e===$i&&($i=e.parent_)}var Xi=e=>{return $i={drafts_:[],parent_:$i,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:(t=Ki,Ui[t]?Wi(Ki):void 0)};var t};function Gi(e){const t=e[li];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function Zi(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];if(void 0!==e&&e!==n){n[li].modified_&&(qi(t),ui(4)),bi(e)&&(e=Qi(t,e));const{patchPlugin_:r}=t;r&&r.generateReplacementPatches_(n[li].base_,e,t)}else e=Qi(t,n);return function(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Li(t,n)}(t,e,!0),qi(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==oi?e:void 0}function Qi(e,t){if(Bi(t))return t;const n=t[li];if(!n)return ia(t,e.handledSet_,e);if(!ea(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){const{callbacks_:t}=n;if(t)for(;t.length>0;)t.pop()(e);ra(n,e)}return n.copy_}function Ji(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var ea=(e,t)=>e.scope_===t,ta=[];function na(e,t,n,r){const i=Di(e),a=e.type_;if(void 0!==r&&Ei(i,r,a)===t)return void ji(i,r,n,a);if(!e.draftLocations_){const t=e.draftLocations_=new Map;_i(i,(e,n)=>{if(mi(n)){const r=t.get(n)||[];r.push(e),t.set(n,r)}})}const o=e.draftLocations_.get(t)??ta;for(const c of o)ji(i,c,n,a)}function ra(e,t){var n;if(e.modified_&&!e.finalized_&&(3===e.type_||((null==(n=e.assigned_)?void 0:n.size)??0)>0)){const{patchPlugin_:n}=t;if(n){const r=n.getPath(e);r&&n.generatePatches_(e,r,t)}Ji(e)}}function ia(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||mi(e)||t.has(e)||!bi(e)||Bi(e)||(t.add(e),_i(e,(r,i)=>{if(mi(i)){const t=i[li];if(ea(t,n)){const n=Ni(t);ji(e,r,n,e.type_),Ji(t)}}else bi(i)&&ia(i,t,n)})),e}var aa={get(e,t){if(t===li)return e;const n=Di(e);if(!Ai(n,t,e.type_))return function(e,t,n){var r;const i=la(t,n);return i?gi in i?i[gi]:null==(r=i.get)?void 0:r.call(e.draft_):void 0}(e,n,t);const r=n[t];if(e.finalized_||!bi(r))return r;if(r===ca(e.base_,t)){sa(e);const n=1===e.type_?+t:t,i=fa(e.scope_,r,e,n);return e.copy_[n]=i}return r},has:(e,t)=>t in Di(e),ownKeys:e=>Reflect.ownKeys(Di(e)),set(e,t,n){const r=la(Di(e),t);if(null==r?void 0:r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=ca(Di(e),t),o=null==r?void 0:r[li];if(o&&o.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if(((i=n)===(a=r)?0!==i||1/i==1/a:i!=i&&a!=a)&&(void 0!==n||Ai(e.base_,t,e.type_)))return!0;sa(e),ua(e)}var i,a;return e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_.set(t,!0),function(e,t,n){const{scope_:r}=e;if(mi(n)){const i=n[li];ea(i,r)&&i.callbacks_.push(function(){sa(e);const r=Ni(i);na(e,n,r,t)})}else bi(n)&&e.callbacks_.push(function(){const i=Di(e);Ei(i,t,e.type_)===n&&r.drafts_.length>1&&!0===(e.assigned_.get(t)??!1)&&e.copy_&&ia(Ei(e.copy_,t,e.type_),r.handledSet_,r)})}(e,t,n)),!0},deleteProperty:(e,t)=>(sa(e),void 0!==ca(e.base_,t)||t in e.base_?(e.assigned_.set(t,!1),ua(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=Di(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{[vi]:!0,[pi]:1!==e.type_||"length"!==t,[yi]:r[yi],[gi]:n[t]}:r},defineProperty(){ui(11)},getPrototypeOf:e=>fi(e.base_),setPrototypeOf(){ui(12)}},oa={};function ca(e,t){const n=e[li];return(n?Di(n):e)[t]}function la(e,t){if(!(t in e))return;let n=fi(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=fi(n)}}function ua(e){e.modified_||(e.modified_=!0,e.parent_&&ua(e.parent_))}function sa(e){e.copy_||(e.assigned_=new Map,e.copy_=zi(e.base_,e.scope_.immer_.useStrictShallowCopy_))}function fa(e,t,n,r){const[i,a]=ki(t)?Wi(Ki).proxyMap_(t,n):Mi(t)?Wi(Ki).proxySet_(t,n):function(e,t){const n=Si(e),r={type_:n?1:0,scope_:t?t.scope_:Hi(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let i=r,a=aa;n&&(i=[r],a=oa);const{revoke:o,proxy:c}=Proxy.revocable(i,a);return r.draft_=c,r.revoke_=o,[c,r]}(t,n);return((null==n?void 0:n.scope_)??Hi()).drafts_.push(i),a.callbacks_=(null==n?void 0:n.callbacks_)??[],a.key_=r,n&&void 0!==r?function(e,t,n){e.callbacks_.push(function(r){var i;const a=t;if(!a||!ea(a,r))return;null==(i=r.mapSetPlugin_)||i.fixSetContents(a);const o=Ni(a);na(e,a.draft_??a,o,n),ra(a,r)})}(n,a,r):a.callbacks_.push(function(e){var t;null==(t=e.mapSetPlugin_)||t.fixSetContents(a);const{patchPlugin_:n}=e;a.modified_&&n&&n.generatePatches_(a,[],e)}),i}function da(e){return mi(e)||ui(10),ha(e)}function ha(e){if(!bi(e)||Bi(e))return e;const t=e[li];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=zi(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=zi(e,!0);return _i(n,(e,t)=>{ji(n,e,ha(t))},r),t&&(t.finalized_=!1),n}_i(aa,(e,t)=>{oa[e]=function(){const e=arguments;return e[0]=e[0][0],t.apply(this,e)}}),oa.deleteProperty=function(e,t){return oa.set.call(this,e,t,void 0)},oa.set=function(e,t,n){return aa.set.call(this,e[0],t,n,e[0])};var pa=(new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,n)=>{if(Ti(e)&&!Ti(t)){const n=t;t=e;const r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}let r;if(Ti(t)||ui(6),void 0===n||Ti(n)||ui(7),bi(e)){const i=Xi(this),a=fa(0,e,void 0);let o=!0;try{r=t(a),o=!1}finally{o?qi(i):Yi(i)}return Vi(i,n),Zi(r,i)}if(!e||!Ci(e)){if(r=t(e),void 0===r&&(r=e),r===oi&&(r=void 0),this.autoFreeze_&&Li(r,!0),n){const t=[],i=[];Wi(Fi).generateReplacementPatches_(e,r,{patches_:t,inversePatches_:i}),n(t,i)}return r}ui(1)},this.produceWithPatches=(e,t)=>{if(Ti(e))return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;return[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},Ii(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),Ii(null==e?void 0:e.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),Ii(null==e?void 0:e.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){bi(e)||ui(8),mi(e)&&(e=da(e));const t=Xi(this),n=fa(0,e,void 0);return n[li].isManual_=!0,Yi(t),n}finishDraft(e,t){const n=e&&e[li];n&&n.isManual_||ui(9);const{scope_:r}=n;return Vi(r,t),Zi(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));const r=Wi(Fi).applyPatches_;return mi(e)?r(e,t):this.produce(e,e=>r(e,t))}}).produce;function ya(e){return({dispatch:t,getState:n})=>r=>i=>"function"==typeof i?i(t,n,e):r(i)}var va=ya(),ga=ya,ma="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?ii:ii.apply(null,arguments)};function ba(e,t){function n(...n){if(t){let r=t(...n);if(!r)throw new Error(fo(0));return{type:e,payload:r.payload,..."meta"in r&&{meta:r.meta},..."error"in r&&{error:r.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>ai(t)&&t.type===e,n}var wa=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return 1===t.length&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function xa(e){return bi(e)?pa(e,()=>{}):e}function Oa(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}var _a="RTK_autoBatch",Pa=()=>e=>({payload:e,meta:{[_a]:!0}}),Aa=e=>t=>{setTimeout(t,e)},Ea=(e={type:"raf"})=>t=>(...n)=>{const r=t(...n);let i=!0,a=!1,o=!1;const c=new Set,l="tick"===e.type?queueMicrotask:"raf"===e.type?"undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:Aa(10):"callback"===e.type?e.queueNotification:Aa(e.timeout),u=()=>{o=!1,a&&(a=!1,c.forEach(e=>e()))};return Object.assign({},r,{subscribe(e){const t=r.subscribe(()=>i&&e());return c.add(e),()=>{t(),c.delete(e)}},dispatch(e){var t;try{return i=!(null==(t=null==e?void 0:e.meta)?void 0:t[_a]),a=!i,a&&(o||(o=!0,l(u))),r.dispatch(e)}finally{i=!0}}})};function ja(e){const t={},n=[];let r;const i={addCase(e,n){const r="string"==typeof e?e:e.type;if(!r)throw new Error(fo(28));if(r in t)throw new Error(fo(29));return t[r]=n,i},addAsyncThunk:(e,r)=>(r.pending&&(t[e.pending.type]=r.pending),r.rejected&&(t[e.rejected.type]=r.rejected),r.fulfilled&&(t[e.fulfilled.type]=r.fulfilled),r.settled&&n.push({matcher:e.settled,reducer:r.settled}),i),addMatcher:(e,t)=>(n.push({matcher:e,reducer:t}),i),addDefaultCase:e=>(r=e,i)};return e(i),[t,n,r]}var Sa=(e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t},ka=Symbol.for("rtk-slice-createasyncthunk");function Ma(e,t){return`${e}/${t}`}function Ca({creators:e}={}){var t;const n=null==(t=null==e?void 0:e.asyncThunk)?void 0:t[ka];return function(e){const{name:t,reducerPath:r=t}=e;if(!t)throw new Error(fo(11));const i=("function"==typeof e.reducers?e.reducers(function(){function e(e,t){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer:e=>Object.assign({[e.name]:(...t)=>e(...t)}[e.name],{_reducerDefinitionType:"reducer"}),preparedReducer:(e,t)=>({_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:t}),asyncThunk:e}}()):e.reducers)||{},a=Object.keys(i),o={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},c={addCase(e,t){const n="string"==typeof e?e:e.type;if(!n)throw new Error(fo(12));if(n in o.sliceCaseReducersByType)throw new Error(fo(13));return o.sliceCaseReducersByType[n]=t,c},addMatcher:(e,t)=>(o.sliceMatchers.push({matcher:e,reducer:t}),c),exposeAction:(e,t)=>(o.actionCreators[e]=t,c),exposeCaseReducer:(e,t)=>(o.sliceCaseReducersByName[e]=t,c)};function l(){const[t={},n=[],r]="function"==typeof e.extraReducers?ja(e.extraReducers):[e.extraReducers],i={...t,...o.sliceCaseReducersByType};return function(e){let t,[a,c,l]=ja(e=>{for(let t in i)e.addCase(t,i[t]);for(let t of o.sliceMatchers)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);r&&e.addDefaultCase(r)});if("function"==typeof e)t=()=>xa(e());else{const n=xa(e);t=()=>n}function u(e=t(),n){let r=[a[n.type],...c.filter(({matcher:e})=>e(n)).map(({reducer:e})=>e)];return 0===r.filter(e=>!!e).length&&(r=[l]),r.reduce((e,t)=>{if(t){if(mi(e)){const r=t(e,n);return void 0===r?e:r}if(bi(e))return pa(e,e=>t(e,n));{const r=t(e,n);if(void 0===r){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return r}}return e},e)}return u.getInitialState=t,u}(e.initialState)}a.forEach(r=>{const a=i[r],o={reducerName:r,type:Ma(t,r),createNotation:"function"==typeof e.reducers};!function(e){return"asyncThunk"===e._reducerDefinitionType}(a)?function({type:e,reducerName:t,createNotation:n},r,i){let a,o;if("reducer"in r){if(n&&!function(e){return"reducerWithPrepare"===e._reducerDefinitionType}(r))throw new Error(fo(17));a=r.reducer,o=r.prepare}else a=r;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,o?ba(e,o):ba(e))}(o,a,c):function({type:e,reducerName:t},n,r,i){if(!i)throw new Error(fo(18));const{payloadCreator:a,fulfilled:o,pending:c,rejected:l,settled:u,options:s}=n,f=i(e,a,s);r.exposeAction(t,f),o&&r.addCase(f.fulfilled,o),c&&r.addCase(f.pending,c),l&&r.addCase(f.rejected,l),u&&r.addMatcher(f.settled,u),r.exposeCaseReducer(t,{fulfilled:o||Da,pending:c||Da,rejected:l||Da,settled:u||Da})}(o,a,c,n)});const u=e=>e,s=new Map,f=new WeakMap;let d;function h(e,t){return d||(d=l()),d(e,t)}function p(){return d||(d=l()),d.getInitialState()}function y(t,n=!1){function r(e){let i=e[t];return void 0===i&&n&&(i=Oa(f,r,p)),i}function i(t=u){const r=Oa(s,n,()=>new WeakMap);return Oa(r,t,()=>{const r={};for(const[i,a]of Object.entries(e.selectors??{}))r[i]=Ta(a,t,()=>Oa(f,t,p),n);return r})}return{reducerPath:t,getSelectors:i,get selectors(){return i(r)},selectSlice:r}}const v={name:t,reducer:h,actions:o.actionCreators,caseReducers:o.sliceCaseReducersByName,getInitialState:p,...y(r),injectInto(e,{reducerPath:t,...n}={}){const i=t??r;return e.inject({reducerPath:i,reducer:h},n),{...v,...y(i,!0)}}};return v}}function Ta(e,t,n,r){function i(i,...a){let o=t(i);return void 0===o&&r&&(o=n()),e(o,...a)}return i.unwrapped=e,i}var Ia=Ca();function Da(){}var Na="listener",za="completed",La="cancelled",Ra=`task-${La}`,Ba=`task-${za}`,Ka=`${Na}-${La}`,Fa=`${Na}-${za}`,Ua=class{constructor(e){t(this,"name","TaskAbortError"),t(this,"message"),this.code=e,this.message=`task ${La} (reason: ${e})`}},Wa=(e,t)=>{if("function"!=typeof e)throw new TypeError(fo(32))},$a=()=>{},Ha=(e,t=$a)=>(e.catch(t),e),Va=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),qa=e=>{if(e.aborted)throw new Ua(e.reason)};function Ya(e,t){let n=$a;return new Promise((r,i)=>{const a=()=>i(new Ua(e.reason));e.aborted?a():(n=Va(e,a),t.finally(()=>n()).then(r,i))}).finally(()=>{n=$a})}var Xa=e=>t=>Ha(Ya(e,t).then(t=>(qa(e),t))),Ga=e=>{const t=Xa(e);return e=>t(new Promise(t=>setTimeout(t,e)))},{assign:Za}=Object,Qa={},Ja="listenerMiddleware",eo=(e,t)=>(n,r)=>{Wa(n);const i=new AbortController;var a;a=i,Va(e,()=>a.abort(e.reason));const o=(async(t,r)=>{try{return await Promise.resolve(),{status:"ok",value:await(async()=>{qa(e),qa(i.signal);const t=await n({pause:Xa(i.signal),delay:Ga(i.signal),signal:i.signal});return qa(i.signal),t})()}}catch(a){return{status:a instanceof Ua?"cancelled":"rejected",error:a}}finally{null==r||r()}})(0,()=>i.abort(Ba));return(null==r?void 0:r.autoJoin)&&t.push(o.catch($a)),{result:Xa(e)(o),cancel(){i.abort(Ra)}}},to=e=>{let{type:t,actionCreator:n,matcher:r,predicate:i,effect:a}=e;if(t)i=ba(t).match;else if(n)t=n.type,i=n.match;else if(r)i=r;else if(!i)throw new Error(fo(21));return Wa(a),{predicate:i,type:t,effect:a}},no=Za(e=>{const{type:t,predicate:n,effect:r}=to(e);return{id:Sa(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(fo(22))}}},{withTypes:()=>no}),ro=(e,t)=>{const{type:n,effect:r,predicate:i}=to(t);return Array.from(e.values()).find(e=>("string"==typeof n?e.type===n:e.predicate===i)&&e.effect===r)},io=e=>{e.pending.forEach(e=>{e.abort(Ka)})},ao=(e,t,n)=>{try{e(t,n)}catch(r){setTimeout(()=>{throw r},0)}},oo=Za(ba(`${Ja}/add`),{withTypes:()=>oo}),co=ba(`${Ja}/removeAll`),lo=Za(ba(`${Ja}/remove`),{withTypes:()=>lo}),uo=(...e)=>{},so=(e={})=>{const t=new Map,n=new Map,{extra:r,onError:i=uo}=e;Wa(i);const a=e=>{return(n=ro(t,e)??no(e)).unsubscribe=()=>t.delete(n.id),t.set(n.id,n),e=>{n.unsubscribe(),(null==e?void 0:e.cancelActive)&&io(n)};var n};Za(a,{withTypes:()=>a});const o=e=>{const n=ro(t,e);return n&&(n.unsubscribe(),e.cancelActive&&io(n)),!!n};Za(o,{withTypes:()=>o});const c=async(e,o,c,l)=>{const u=new AbortController,s=((e,t)=>(n,r)=>Ha((async(n,r)=>{qa(t);let i=()=>{};const a=[new Promise((t,r)=>{let a=e({predicate:n,effect:(e,n)=>{n.unsubscribe(),t([e,n.getState(),n.getOriginalState()])}});i=()=>{a(),r()}})];null!=r&&a.push(new Promise(e=>setTimeout(e,r,null)));try{const e=await Ya(t,Promise.race(a));return qa(t),e}finally{i()}})(n,r)))(a,u.signal),f=[];try{e.pending.add(u),(e=>{const t=n.get(e)??0;n.set(e,t+1)})(e),await Promise.resolve(e.effect(o,Za({},c,{getOriginalState:l,condition:(e,t)=>s(e,t).then(Boolean),take:s,delay:Ga(u.signal),pause:Xa(u.signal),extra:r,signal:u.signal,fork:eo(u.signal,f),unsubscribe:e.unsubscribe,subscribe:()=>{t.set(e.id,e)},cancelActiveListeners:()=>{e.pending.forEach((e,t,n)=>{e!==u&&(e.abort(Ka),n.delete(e))})},cancel:()=>{u.abort(Ka),e.pending.delete(u)},throwIfCancelled:()=>{qa(u.signal)}})))}catch(d){d instanceof Ua||ao(i,d,{raisedBy:"effect"})}finally{await Promise.all(f),u.abort(Fa),(e=>{const t=n.get(e)??1;1===t?n.delete(e):n.set(e,t-1)})(e),e.pending.delete(u)}},l=((e,t)=>()=>{for(const e of t.keys())io(e);e.clear()})(t,n);return{middleware:e=>n=>r=>{if(!ai(r))return n(r);if(oo.match(r))return a(r.payload);if(co.match(r))return void l();if(lo.match(r))return o(r.payload);let u=e.getState();const s=()=>{if(u===Qa)throw new Error(fo(23));return u};let f;try{if(f=n(r),t.size>0){const n=e.getState(),a=Array.from(t.values());for(const t of a){let a=!1;try{a=t.predicate(r,n,u)}catch(d){a=!1,ao(i,d,{raisedBy:"predicate"})}a&&c(t,r,e,s)}}}finally{u=Qa}return f},startListening:a,stopListening:o,clearListeners:l}};function fo(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var ho=Ia({name:"chartLayout",initialState:{layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){var n,r,i,a;e.margin.top=null!==(n=t.payload.top)&&void 0!==n?n:0,e.margin.right=null!==(r=t.payload.right)&&void 0!==r?r:0,e.margin.bottom=null!==(i=t.payload.bottom)&&void 0!==i?i:0,e.margin.left=null!==(a=t.payload.left)&&void 0!==a?a:0},setScale(e,t){e.scale=t.payload}}}),{setMargin:po,setLayout:yo,setChartSize:vo,setScale:go}=ho.actions,mo=ho.reducer;function bo(e,t,n){return Array.isArray(e)&&e&&t+n!==0?e.slice(t,n+1):e}function wo(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function xo(e){for(var t=1;t"horizontal"===e&&"xAxis"===t||"vertical"===e&&"yAxis"===t||"centric"===e&&"angleAxis"===t||"radial"===e&&"radiusAxis"===t,Ao=(e,t,n,r)=>{if(r)return e.map(e=>e.coordinate);var i,a,o=e.map(e=>(e.coordinate===t&&(i=!0),e.coordinate===n&&(a=!0),e.coordinate));return i||o.push(t),a||o.push(n),o},Eo=(e,t,n)=>{if(!e)return null;var{duplicateDomain:r,type:i,range:a,scale:o,realScaleType:c,isCategorical:l,categoricalDomain:u,tickCount:s,ticks:f,niceTicks:d,axisType:h}=e;if(!o)return null;var p="scaleBand"===c&&o.bandwidth?o.bandwidth()/2:2,y="category"===i&&o.bandwidth?o.bandwidth()/p:0;return y="angleAxis"===h&&a&&a.length>=2?2*Qe(a[0]-a[1])*y:y,f||d?(f||d||[]).map((e,t)=>{var n=r?r.indexOf(e):e;return{coordinate:o(n)+y,value:e,offset:y,index:t}}).filter(e=>!Je(e.coordinate)):l&&u?u.map((e,t)=>({coordinate:o(e)+y,value:e,index:t,offset:y})):o.ticks&&null!=s?o.ticks(s).map((e,t)=>({coordinate:o(e)+y,value:e,offset:y,index:t})):o.domain().map((e,t)=>({coordinate:o(e)+y,value:r?r[e]:e,index:t,offset:y}))},jo=1e-4,So={sign:e=>{var t=e.length;if(!(t<=0))for(var n=0,r=e[0].length;n=0?(e[o][n][0]=i,e[o][n][1]=i+c,i=e[o][n][1]):(e[o][n][0]=a,e[o][n][1]=a+c,a=e[o][n][1])}},expand:function(e,t){if((r=e.length)>0){for(var n,r,i,a=0,o=e[0].length;a0){for(var n,r=0,i=e[t[0]],a=i.length;r0&&(r=(n=e[t[0]]).length)>0){for(var n,r,i,a=0,o=1;o{var t=e.length;if(!(t<=0))for(var n=0,r=e[0].length;n=0?(e[a][n][0]=i,e[a][n][1]=i+o,i=e[a][n][1]):(e[a][n][0]=0,e[a][n][1]=0)}}},ko=(e,t,n)=>{var r=So[n],i=function(){var e=E([]),t=je,n=Ee,r=Se;function i(i){var a,o,c=Array.from(e.apply(this,arguments),ke),l=c.length,u=-1;for(const e of i)for(a=0,++u;aNumber(_o(e,t,0))).order(je).offset(r);return i(e)};function Mo(e){var{axis:t,ticks:n,bandSize:r,entry:i,index:a,dataKey:o}=e;if("category"===t.type){if(!t.allowDuplicatedCategory&&t.dataKey&&!ut(i[t.dataKey])){var c=lt(n,"value",i[t.dataKey]);if(c)return c.coordinate+r/2}return n[a]?n[a].coordinate+r/2:null}var l=_o(i,ut(o)?t.dataKey:o);return ut(l)?null:t.scale(l)}var Co=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,To=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Io=(e,t,n)=>{if(e&&e.scale&&e.scale.bandwidth){var r=e.scale.bandwidth();if(!n||r>0)return r}if(e&&t&&t.length>=2){for(var i=Xr(t,e=>e.coordinate),a=1/0,o=1,c=i.length;oe.layout.width,Lo=e=>e.layout.height,Ro=e=>e.layout.scale,Bo=e=>e.layout.margin,Ko=Ar(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),Fo=Ar(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),Uo=["#1890FF","#66B5FF","#41D9C7","#2FC25B","#6EDB8F","#9AE65C","#FACC14","#E6965C","#57AD71","#223273","#738AE6","#7564CC","#8543E0","#A877ED","#5C8EE6","#13C2C2","#70E0E0","#5CA3E6","#3436C7","#8082FF","#DD81E6","#F04864","#FA7D92","#D598D9"];function Wo(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function $o(e){for(var t=1;te.brush.height,function(e){return Fo(e).reduce((e,t)=>"left"!==t.orientation||t.mirror||t.hide?e:e+("number"==typeof t.width?t.width:60),0)},function(e){return Fo(e).reduce((e,t)=>"right"!==t.orientation||t.mirror||t.hide?e:e+("number"==typeof t.width?t.width:60),0)},function(e){return Ko(e).reduce((e,t)=>"top"!==t.orientation||t.mirror||t.hide?e:e+t.height,0)},function(e){return Ko(e).reduce((e,t)=>"bottom"!==t.orientation||t.mirror||t.hide?e:e+t.height,0)},Gr,e=>e.legend.size],(e,t,n,r,i,a,o,c,l,u)=>{var s={left:(n.left||0)+i,right:(n.right||0)+a},f=$o($o({},{top:(n.top||0)+o,bottom:(n.bottom||0)+c}),s),d=f.bottom;f.bottom+=r,f=((e,t,n)=>{if(t&&n){var{width:r,height:i}=n,{align:a,verticalAlign:o,layout:c}=t;if(("vertical"===c||"horizontal"===c&&"middle"===o)&&"center"!==a&&tt(e[a]))return xo(xo({},e),{},{[a]:e[a]+(r||0)});if(("horizontal"===c||"vertical"===c&&"center"===a)&&"middle"!==o&&tt(e[o]))return xo(xo({},e),{},{[o]:e[o]+(i||0)})}return e})(f,l,u);var h=e-f.left-f.right,p=t-f.top-f.bottom;return $o($o({brushBottom:d},f),{},{width:Math.max(h,0),height:Math.max(p,0)})}),Qo=Ar(Zo,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),Jo=Ar(zo,Lo,(e,t)=>({x:0,y:0,width:e,height:t})),ec=n.createContext(null),tc=()=>null!=n.useContext(ec),nc=e=>e.brush,rc=Ar([nc,Zo,Bo],(e,t,n)=>({height:e.height,x:tt(e.x)?e.x:t.left,y:tt(e.y)?e.y:t.top+t.height+t.brushBottom-((null==n?void 0:n.bottom)||0),width:tt(e.width)?e.width:t.width})),ic={},ac={},oc={};function cc(){return Vo||(Vo=1,e=oc,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e.debounce=function(e,t,{signal:n,edges:r}={}){let i,a=null;const o=null!=r&&r.includes("leading"),c=null==r||r.includes("trailing"),l=()=>{null!==a&&(e.apply(i,a),i=void 0,a=null)};let u=null;const s=()=>{null!=u&&clearTimeout(u),u=setTimeout(()=>{u=null,c&&l(),f()},t)},f=()=>{null!==u&&(clearTimeout(u),u=null),i=void 0,a=null},d=function(...e){if(null==n?void 0:n.aborted)return;i=this,a=e;const t=null==u;s(),o&&t&&l()};return d.schedule=s,d.cancel=f,d.flush=()=>{l()},null==n||n.addEventListener("abort",f,{once:!0}),d}),oc;var e}function lc(){return qo||(qo=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=cc();e.debounce=function(e,n=0,r={}){"object"!=typeof r&&(r={});const{leading:i=!1,trailing:a=!0,maxWait:o}=r,c=Array(2);let l;i&&(c[0]="leading"),a&&(c[1]="trailing");let u=null;const s=t.debounce(function(...t){l=e.apply(this,t),u=null},n,{edges:c}),f=function(...t){return null!=o&&(null===u&&(u=Date.now()),Date.now()-u>=o)?(l=e.apply(this,t),u=Date.now(),s.cancel(),s.schedule(),l):(s.apply(this,t),l)};return f.cancel=s.cancel,f.flush=()=>(s.flush(),l),f}}(ac)),ac}function uc(){return Go?Xo:(Go=1,Xo=(Yo||(Yo=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=lc();e.throttle=function(e,n=0,r={}){const{leading:i=!0,trailing:a=!0}=r;return t.debounce(e,n,{leading:i,maxWait:n,trailing:a})}}(ic)),ic).throttle)}const sc=l(uc());var fc=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i{var{width:r="100%",height:i="100%",aspect:a,maxHeight:o}=n,c=et(r)?e:Number(r),l=et(i)?t:Number(i);return a&&a>0&&(c?l=c/a:l&&(c=l*a),o&&null!=l&&l>o&&(l=o)),{calculatedWidth:c,calculatedHeight:l}},hc={width:0,height:0,overflow:"visible"},pc={width:0,overflowX:"visible"},yc={height:0,overflowY:"visible"},vc={},gc=e=>{var{width:t,height:n}=e,r=et(t),i=et(n);return r&&i?hc:r?pc:i?yc:vc};function mc(e){return Number.isFinite(e)}function bc(e){return"number"==typeof e&&e>0&&Number.isFinite(e)}function wc(){return wc=Object.assign?Object.assign.bind():function(e){for(var t=1;t({width:r,height:i}),[r,i]);return function(e){return bc(e.width)&&bc(e.height)}(a)?n.createElement(Pc.Provider,{value:a},t):null}var Ec=()=>n.useContext(Pc),jc=n.forwardRef((e,t)=>{var{aspect:r,initialDimension:i={width:-1,height:-1},width:a,height:o,minWidth:c=0,minHeight:l,maxHeight:u,children:f,debounce:d=0,id:h,className:p,onResize:y,style:v={}}=e,g=n.useRef(null),m=n.useRef();m.current=y,n.useImperativeHandle(t,()=>g.current);var[b,w]=n.useState({containerWidth:i.width,containerHeight:i.height}),x=n.useCallback((e,t)=>{w(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]);n.useEffect(()=>{if(null==g.current||"undefined"==typeof ResizeObserver)return dt;var e=e=>{var t,{width:n,height:r}=e[0].contentRect;x(n,r),null===(t=m.current)||void 0===t||t.call(m,n,r)};d>0&&(e=sc(e,d,{trailing:!0,leading:!1}));var t=new ResizeObserver(e),{width:n,height:r}=g.current.getBoundingClientRect();return x(n,r),t.observe(g.current),()=>{t.disconnect()}},[x,d]);var{containerWidth:O,containerHeight:_}=b;fc(!r||r>0,"The aspect(%s) must be greater than zero.",r);var{calculatedWidth:P,calculatedHeight:A}=dc(O,_,{width:a,height:o,aspect:r,maxHeight:u});return fc(null!=P&&P>0||null!=A&&A>0,"The width(%s) and height(%s) of chart should be greater than 0,\n please check the style of container, or the props width(%s) and height(%s),\n or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the\n height and width.",P,A,a,o,c,l,r),n.createElement("div",{id:h?"".concat(h):void 0,className:s("recharts-responsive-container",p),style:Oc(Oc({},v),{},{width:a,height:o,minWidth:c,minHeight:l,maxHeight:u}),ref:g},n.createElement("div",{style:gc({width:a,height:o})},n.createElement(Ac,{width:P,height:A},f)))}),Sc=n.forwardRef((e,t)=>{var r=Ec();if(bc(r.width)&&bc(r.height))return e.children;var{width:i,height:a}=function(e){var{width:t,height:n,aspect:r}=e,i=t,a=n;return void 0===i&&void 0===a?(i="100%",a="100%"):void 0===i?i=r&&r>0?void 0:"100%":void 0===a&&(a=r&&r>0?void 0:"100%"),{width:i,height:a}}({width:e.width,height:e.height,aspect:e.aspect}),{calculatedWidth:o,calculatedHeight:c}=dc(void 0,void 0,{width:i,height:a,aspect:e.aspect,maxHeight:e.maxHeight});return tt(o)&&tt(c)?n.createElement(Ac,{width:o,height:c},e.children):n.createElement(jc,wc({},e,{width:i,height:a,ref:t}))});function kc(e){if(e)return{x:e.x,y:e.y,upperWidth:"upperWidth"in e?e.upperWidth:e.width,lowerWidth:"lowerWidth"in e?e.lowerWidth:e.width,width:e.width,height:e.height}}var Mc=()=>{var e,t=tc(),n=mr(Qo),r=mr(rc),i=null===(e=mr(nc))||void 0===e?void 0:e.padding;return t&&r&&i?{width:r.width-i.left-i.right,height:r.height-i.top-i.bottom,x:i.left,y:i.top}:n},Cc={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},Tc=()=>{var e;return null!==(e=mr(Zo))&&void 0!==e?e:Cc},Ic=()=>mr(zo),Dc=()=>mr(Lo),Nc=e=>e.layout.layoutType,zc=()=>mr(Nc),Lc=e=>{var t=pr(),r=tc(),{width:i,height:a}=e,o=Ec(),c=i,l=a;return o&&(c=o.width>0?o.width:i,l=o.height>0?o.height:a),n.useEffect(()=>{!r&&bc(c)&&bc(l)&&t(vo({width:c,height:l}))},[t,r,c,l]),null},Rc=e=>{var{margin:t}=e,r=pr();return n.useEffect(()=>{r(po(t))},[r,t]),null},Bc=Symbol.for("immer-nothing"),Kc=Symbol.for("immer-draftable"),Fc=Symbol.for("immer-state");function Uc(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Wc=Object.getPrototypeOf;function $c(e){return!!e&&!!e[Fc]}function Hc(e){var t;return!!e&&(Yc(e)||Array.isArray(e)||!!e[Kc]||!!(null==(t=e.constructor)?void 0:t[Kc])||Jc(e)||el(e))}var Vc=Object.prototype.constructor.toString(),qc=new WeakMap;function Yc(e){if(!e||"object"!=typeof e)return!1;const t=Object.getPrototypeOf(e);if(null===t||t===Object.prototype)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(n===Object)return!0;if("function"!=typeof n)return!1;let r=qc.get(n);return void 0===r&&(r=Function.toString.call(n),qc.set(n,r)),r===Vc}function Xc(e,t,n=!0){0===Gc(e)?(n?Reflect.ownKeys(e):Object.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Gc(e){const t=e[Fc];return t?t.type_:Array.isArray(e)?1:Jc(e)?2:el(e)?3:0}function Zc(e,t){return 2===Gc(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Qc(e,t,n){const r=Gc(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function Jc(e){return e instanceof Map}function el(e){return e instanceof Set}function tl(e){return e.copy_||e.base_}function nl(e,t){if(Jc(e))return new Map(e);if(el(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=Yc(e);if(!0===t||"class_only"===t&&!n){const t=Object.getOwnPropertyDescriptors(e);delete t[Fc];let n=Reflect.ownKeys(t);for(let r=0;r1&&Object.defineProperties(e,{set:il,add:il,clear:il,delete:il}),Object.freeze(e),t&&Object.values(e).forEach(e=>rl(e,!0))),e}var il={value:function(){Uc(2)}};function al(e){return null===e||"object"!=typeof e||Object.isFrozen(e)}var ol,cl={};function ll(e){const t=cl[e];return t||Uc(0),t}function ul(){return ol}function sl(e,t){t&&(ll("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function fl(e){dl(e),e.drafts_.forEach(pl),e.drafts_=null}function dl(e){e===ol&&(ol=e.parent_)}function hl(e){return ol={drafts_:[],parent_:ol,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function pl(e){const t=e[Fc];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function yl(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[Fc].modified_&&(fl(t),Uc(4)),Hc(e)&&(e=vl(t,e),t.parent_||ml(t,e)),t.patches_&&ll("Patches").generateReplacementPatches_(n[Fc].base_,e,t.patches_,t.inversePatches_)):e=vl(t,n,[]),fl(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Bc?e:void 0}function vl(e,t,n){if(al(t))return t;const r=e.immer_.shouldUseStrictIteration(),i=t[Fc];if(!i)return Xc(t,(r,a)=>gl(e,i,t,r,a,n),r),t;if(i.scope_!==e)return t;if(!i.modified_)return ml(e,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const t=i.copy_;let a=t,o=!1;3===i.type_&&(a=new Set(t),t.clear(),o=!0),Xc(a,(r,a)=>gl(e,i,t,r,a,n,o),r),ml(e,t,!1),n&&e.patches_&&ll("Patches").generatePatches_(i,n,e.patches_,e.inversePatches_)}return i.copy_}function gl(e,t,n,r,i,a,o){if(null==i)return;if("object"!=typeof i&&!o)return;const c=al(i);if(!c||o){if($c(i)){const o=vl(e,i,a&&t&&3!==t.type_&&!Zc(t.assigned_,r)?a.concat(r):void 0);if(Qc(n,r,o),!$c(o))return;e.canAutoFreeze_=!1}else o&&n.add(i);if(Hc(i)&&!c){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;if(t&&t.base_&&t.base_[r]===i&&c)return;vl(e,i),t&&t.scope_.parent_||"symbol"==typeof r||!(Jc(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))||ml(e,i)}}}function ml(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&rl(t,n)}var bl={get(e,t){if(t===Fc)return e;const n=tl(e);if(!Zc(n,t))return function(e,t,n){var r;const i=Ol(t,n);return i?"value"in i?i.value:null==(r=i.get)?void 0:r.call(e.draft_):void 0}(e,n,t);const r=n[t];return e.finalized_||!Hc(r)?r:r===xl(e.base_,t)?(Pl(e),e.copy_[t]=Al(r,e)):r},has:(e,t)=>t in tl(e),ownKeys:e=>Reflect.ownKeys(tl(e)),set(e,t,n){const r=Ol(tl(e),t);if(null==r?void 0:r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=xl(tl(e),t),o=null==r?void 0:r[Fc];if(o&&o.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(((i=n)===(a=r)?0!==i||1/i==1/a:i!=i&&a!=a)&&(void 0!==n||Zc(e.base_,t)))return!0;Pl(e),_l(e)}var i,a;return e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty:(e,t)=>(void 0!==xl(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,Pl(e),_l(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=tl(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty(){Uc(11)},getPrototypeOf:e=>Wc(e.base_),setPrototypeOf(){Uc(12)}},wl={};function xl(e,t){const n=e[Fc];return(n?tl(n):e)[t]}function Ol(e,t){if(!(t in e))return;let n=Wc(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=Wc(n)}}function _l(e){e.modified_||(e.modified_=!0,e.parent_&&_l(e.parent_))}function Pl(e){e.copy_||(e.copy_=nl(e.base_,e.scope_.immer_.useStrictShallowCopy_))}function Al(e,t){const n=Jc(e)?ll("MapSet").proxyMap_(e,t):el(e)?ll("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:ul(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,a=bl;n&&(i=[r],a=wl);const{revoke:o,proxy:c}=Proxy.revocable(i,a);return r.draft_=c,r.revoke_=o,c}(e,t);return(t?t.scope_:ul()).drafts_.push(n),n}function El(e){if(!Hc(e)||al(e))return e;const t=e[Fc];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=nl(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=nl(e,!0);return Xc(n,(e,t)=>{Qc(n,e,El(t))},r),t&&(t.finalized_=!1),n}Xc(bl,(e,t)=>{wl[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),wl.deleteProperty=function(e,t){return wl.set.call(this,e,t,void 0)},wl.set=function(e,t,n){return bl.set.call(this,e[0],t,n,e[0])},(new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(e,t,n)=>{if("function"==typeof e&&"function"!=typeof t){const n=t;t=e;const r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}let r;if("function"!=typeof t&&Uc(6),void 0!==n&&"function"!=typeof n&&Uc(7),Hc(e)){const i=hl(this),a=Al(e,void 0);let o=!0;try{r=t(a),o=!1}finally{o?fl(i):dl(i)}return sl(i,n),yl(r,i)}if(!e||"object"!=typeof e){if(r=t(e),void 0===r&&(r=e),r===Bc&&(r=void 0),this.autoFreeze_&&rl(r,!0),n){const t=[],i=[];ll("Patches").generateReplacementPatches_(e,r,t,i),n(t,i)}return r}Uc(1)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;return[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof(null==e?void 0:e.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),"boolean"==typeof(null==e?void 0:e.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){var t;Hc(e)||Uc(8),$c(e)&&($c(t=e)||Uc(10),e=El(t));const n=hl(this),r=Al(e,void 0);return r[Fc].isManual_=!0,dl(n),r}finishDraft(e,t){const n=e&&e[Fc];n&&n.isManual_||Uc(9);const{scope_:r}=n;return sl(r,t),yl(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));const r=ll("Patches").applyPatches_;return $c(e)?r(e,t):this.produce(e,e=>r(e,t))}}).produce;var jl=Ia({name:"legend",initialState:{settings:{layout:"horizontal",align:"center",verticalAlign:"middle",itemSorter:"value"},size:{width:0,height:0},payload:[]},reducers:{setLegendSize(e,t){e.size.width=t.payload.width,e.size.height=t.payload.height},setLegendSettings(e,t){e.settings.align=t.payload.align,e.settings.layout=t.payload.layout,e.settings.verticalAlign=t.payload.verticalAlign,e.settings.itemSorter=t.payload.itemSorter},addLegendPayload:{reducer(e,t){e.payload.push(t.payload)},prepare:Pa()},replaceLegendPayload:{reducer(e,t){var{prev:n,next:r}=t.payload,i=da(e).payload.indexOf(n);i>-1&&(e.payload[i]=r)},prepare:Pa()},removeLegendPayload:{reducer(e,t){var n=da(e).payload.indexOf(t.payload);n>-1&&e.payload.splice(n,1)},prepare:Pa()}}}),{setLegendSize:Sl,setLegendSettings:kl,addLegendPayload:Ml,replaceLegendPayload:Cl,removeLegendPayload:Tl}=jl.actions,Il=jl.reducer;function Dl(){return Dl=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{separator:t=" : ",contentStyle:r={},itemStyle:i={},labelStyle:a={},payload:o,formatter:c,itemSorter:l,wrapperClassName:u,labelClassName:f,label:d,labelFormatter:h,accessibilityLayer:p=!1}=e,y=zl({margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},r),v=zl({margin:0},a),g=!ut(d),m=g?d:"",b=s("recharts-default-tooltip",u),w=s("recharts-tooltip-label",f);g&&h&&null!=o&&(m=h(d,o));var x=p?{role:"status","aria-live":"assertive"}:{};return n.createElement("div",Dl({className:b,style:y},x),n.createElement("p",{className:w,style:v},n.isValidElement(m)?m:"".concat(m)),(()=>{if(o&&o.length){var e=(l?Xr(o,l):o).map((e,r)=>{if("none"===e.type)return null;var a=e.formatter||c||Rl,{value:l,name:u}=e,s=l,f=u;if(a){var d=a(l,u,e,r,o);if(Array.isArray(d))[s,f]=d;else{if(null==d)return null;s=d}}var h=zl({display:"block",paddingTop:4,paddingBottom:4,color:e.color||"#000"},i);return n.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(r),style:h},nt(f)?n.createElement("span",{className:"recharts-tooltip-item-name"},f):null,nt(f)?n.createElement("span",{className:"recharts-tooltip-item-separator"},t):null,n.createElement("span",{className:"recharts-tooltip-item-value"},s),n.createElement("span",{className:"recharts-tooltip-item-unit"},e.unit||""))});return n.createElement("ul",{className:"recharts-tooltip-item-list",style:{padding:0,margin:0}},e)}return null})())},Kl="recharts-tooltip-wrapper",Fl={visibility:"hidden"};function Ul(e){var{coordinate:t,translateX:n,translateY:r}=e;return s(Kl,{["".concat(Kl,"-right")]:tt(n)&&t&&tt(t.x)&&n>=t.x,["".concat(Kl,"-left")]:tt(n)&&t&&tt(t.x)&&n=t.y,["".concat(Kl,"-top")]:tt(r)&&t&&tt(t.y)&&r0?i:0),f=n[r]+i;if(t[r])return o[r]?s:f;var d=l[r];return null==d?0:o[r]?sd+u?Math.max(s,d):Math.max(f,d)}function $l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Hl(e){for(var t=1;t{var t,n,r,i;"Escape"===e.key&&this.setState({dismissed:!0,dismissedAtCoordinate:{x:null!==(t=null===(n=this.props.coordinate)||void 0===n?void 0:n.x)&&void 0!==t?t:0,y:null!==(r=null===(i=this.props.coordinate)||void 0===i?void 0:i.y)&&void 0!==r?r:0}})})}componentDidMount(){document.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.removeEventListener("keydown",this.handleKeyDown)}componentDidUpdate(){var e,t;this.state.dismissed&&((null===(e=this.props.coordinate)||void 0===e?void 0:e.x)===this.state.dismissedAtCoordinate.x&&(null===(t=this.props.coordinate)||void 0===t?void 0:t.y)===this.state.dismissedAtCoordinate.y||(this.state.dismissed=!1))}render(){var{active:e,allowEscapeViewBox:t,animationDuration:r,animationEasing:i,children:a,coordinate:o,hasPayload:c,isAnimationActive:l,offset:u,position:s,reverseDirection:f,useTranslate3d:d,viewBox:h,wrapperStyle:p,lastBoundingBox:y,innerRef:v,hasPortalFromProps:g}=this.props,{cssClasses:m,cssProperties:b}=function(e){var t,n,r,{allowEscapeViewBox:i,coordinate:a,offsetTopLeft:o,position:c,reverseDirection:l,tooltipBox:u,useTranslate3d:s,viewBox:f}=e;return t=u.height>0&&u.width>0&&a?function(e){var{translateX:t,translateY:n,useTranslate3d:r}=e;return{transform:r?"translate3d(".concat(t,"px, ").concat(n,"px, 0)"):"translate(".concat(t,"px, ").concat(n,"px)")}}({translateX:n=Wl({allowEscapeViewBox:i,coordinate:a,key:"x",offsetTopLeft:o,position:c,reverseDirection:l,tooltipDimension:u.width,viewBox:f,viewBoxDimension:f.width}),translateY:r=Wl({allowEscapeViewBox:i,coordinate:a,key:"y",offsetTopLeft:o,position:c,reverseDirection:l,tooltipDimension:u.height,viewBox:f,viewBoxDimension:f.height}),useTranslate3d:s}):Fl,{cssProperties:t,cssClasses:Ul({translateX:n,translateY:r,coordinate:a})}}({allowEscapeViewBox:t,coordinate:o,offsetTopLeft:u,position:s,reverseDirection:f,tooltipBox:{height:y.height,width:y.width},useTranslate3d:d,viewBox:h}),w=g?{}:Hl(Hl({transition:l&&e?"transform ".concat(r,"ms ").concat(i):void 0},b),{},{pointerEvents:"none",visibility:!this.state.dismissed&&e&&c?"visible":"hidden",position:"absolute",top:0,left:0}),x=Hl(Hl({},w),{},{visibility:!this.state.dismissed&&e&&c?"visible":"hidden"},p);return n.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:m,style:x,ref:v},a)}}var Yl=()=>{var e;return null===(e=mr(e=>e.rootProps.accessibilityLayer))||void 0===e||e};function Xl(){return Xl=Object.assign?Object.assign.bind():function(e){for(var t=1;tmc(e.x)&&mc(e.y),tu=e=>null!=e.base&&eu(e.base)&&eu(e),nu=e=>e.x,ru=e=>e.y,iu=e=>{var{className:t,points:r,path:i,pathRef:a}=e;if(!(r&&r.length||i))return null;var o=r&&r.length?(e=>{var{type:t="linear",points:n=[],baseLine:r,layout:i,connectNulls:a=!1}=e,o=((e,t)=>{if("function"==typeof e)return e;var n="curve".concat(st(e));return"curveMonotone"!==n&&"curveBump"!==n||!t?Jl[n]||F:Jl["".concat(n).concat("vertical"===t?"Y":"X")]})(t,i),c=a?n.filter(eu):n;if(Array.isArray(r)){var l=n.map((e,t)=>Zl(Zl({},e),{},{base:r[t]}));return("vertical"===i?H().y(ru).x1(nu).x0(e=>e.base.x):H().x(nu).y1(ru).y0(e=>e.base.y)).defined(tu).curve(o)(a?l.filter(tu):l)}return("vertical"===i&&tt(r)?H().y(ru).x1(nu).x0(r):tt(r)?H().x(nu).y1(ru).y0(r):$().x(nu).y(ru)).defined(eu).curve(o)(c)})(e):i;return n.createElement("path",Xl({},v(e),Ot(e),{className:s("recharts-curve",t),d:null===o?void 0:o,ref:a}))},au=["x","y","top","left","width","height","className"];function ou(){return ou=Object.assign?Object.assign.bind():function(e){for(var t=1;t"M".concat(e,",").concat(i,"v").concat(r,"M").concat(a,",").concat(t,"h").concat(n),su=e=>{var{x:t=0,y:r=0,top:i=0,left:a=0,width:o=0,height:c=0,className:l}=e,u=function(e){for(var t=1;te.map(e=>{return"".concat((r=e,r.replace(/([A-Z])/g,e=>"-".concat(e.toLowerCase())))," ").concat(t,"ms ").concat(n);var r}).join(","),yu=(e,t)=>Object.keys(t).reduce((n,r)=>du(du({},n),{},{[r]:e(r,t[r])}),{});function vu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function gu(e){for(var t=1;te+(t-e)*n,wu=e=>{var{from:t,to:n}=e;return t!==n},xu=(e,t,n)=>{var r=yu((t,n)=>{if(wu(n)){var[r,i]=e(n.from,n.to,n.velocity);return gu(gu({},n),{},{from:r,velocity:i})}return n},t);return n<1?yu((e,t)=>wu(t)?gu(gu({},t),{},{velocity:bu(t.velocity,r[e].velocity,n),from:bu(t.from,r[e].from,n)}):t,t):xu(e,r,n-1)};const Ou=(e,t,n,r,i,a)=>{var o,c,l=(o=e,c=t,[Object.keys(o),Object.keys(c)].reduce((e,t)=>e.filter(e=>t.includes(e))));return null==n?()=>(i(gu(gu({},e),t)),()=>{}):!0===n.isStepper?function(e,t,n,r,i,a){var o,c=r.reduce((n,r)=>gu(gu({},n),{},{[r]:{from:e[r],velocity:0,to:t[r]}}),{}),l=null,u=r=>{o||(o=r);var s=(r-o)/n.dt;c=xu(n,c,s),i(gu(gu(gu({},e),t),yu((e,t)=>t.from,c))),o=r,Object.values(c).filter(wu).length&&(l=a.setTimeout(u))};return()=>(l=a.setTimeout(u),()=>{var e;null===(e=l)||void 0===e||e()})}(e,t,n,l,i,a):function(e,t,n,r,i,a,o){var c,l=null,u=i.reduce((n,r)=>gu(gu({},n),{},{[r]:[e[r],t[r]]}),{}),s=i=>{c||(c=i);var f=(i-c)/r,d=yu((e,t)=>bu(...t,n(f)),u);if(a(gu(gu(gu({},e),t),d)),f<1)l=o.setTimeout(s);else{var h=yu((e,t)=>bu(...t,n(1)),u);a(gu(gu(gu({},e),t),h))}};return()=>(l=o.setTimeout(s),()=>{var e;null===(e=l)||void 0===e||e()})}(e,t,n,r,l,i,a)};var _u=1e-4,Pu=(e,t)=>[0,3*e,3*t-6*e,3*e-3*t+1],Au=(e,t)=>e.map((e,n)=>e*t**n).reduce((e,t)=>e+t),Eu=(e,t)=>n=>{var r=Pu(e,t);return Au(r,n)},ju=function(){return((e,t,n,r)=>{var i,a,o=Eu(e,n),c=Eu(t,r),l=(i=e,a=n,e=>{var t=[...Pu(i,a).map((e,t)=>e*t).slice(1),0];return Au(t,e)}),u=e=>e>1?1:e<0?0:e,s=e=>{for(var t=e>1?1:e,n=t,r=0;r<8;++r){var i=o(n)-t,a=l(n);if(Math.abs(i-t)<_u||a<_u)return c(n);n=u(n-i/a)}return c(n)};return s.isStepper=!1,s})(...function(){for(var e=arguments.length,t=new Array(e),n=0;nparseFloat(e));return[a[0],a[1],a[2],a[3]]}}return 4===t.length?t:[0,0,1,1]}(...arguments))};class Su{setTimeout(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=performance.now(),r=null,i=a=>{a-n>=t?e(a):"function"==typeof requestAnimationFrame&&(r=requestAnimationFrame(i))};return r=requestAnimationFrame(i),()=>{null!=r&&cancelAnimationFrame(r)}}}function ku(){return e=new Su,t=()=>null,n=!1,r=null,i=a=>{if(!n){if(Array.isArray(a)){if(!a.length)return;var o=a,[c,...l]=o;return"number"==typeof c?void(r=e.setTimeout(i.bind(null,l),c)):(i(c),void(r=e.setTimeout(i.bind(null,l))))}"string"==typeof a&&t(a),"object"==typeof a&&t(a),"function"==typeof a&&a()}},{stop:()=>{n=!0},start:e=>{n=!1,r&&(r(),r=null),i(e)},subscribe:e=>(t=e,()=>{t=()=>null}),getTimeoutController:()=>e};var e,t,n,r,i}var Mu=n.createContext(ku);function Cu(e,t){var r=n.useContext(Mu);return n.useMemo(()=>null!=t?t:r(e),[e,t,r])}var Tu=!("undefined"!=typeof window&&window.document&&Boolean(window.document.createElement)&&window.setTimeout),Iu={begin:0,duration:1e3,easing:"ease",isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}},Du={t:0},Nu={t:1};function zu(e){var t=At(e,Iu),{isActive:r,canBegin:i,duration:a,easing:o,begin:c,onAnimationEnd:l,onAnimationStart:u,children:s}=t,f="auto"===r?!Tu:r,d=Cu(t.animationId,t.animationManager),[h,p]=n.useState(f?Du:Nu),y=n.useRef(null);return n.useEffect(()=>{f||p(Nu)},[f]),n.useEffect(()=>{if(!f||!i)return dt;var e=Ou(Du,Nu,(e=>{if("string"==typeof e)switch(e){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return ju(e);case"spring":return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{stiff:t=100,damping:n=8,dt:r=17}=e,i=(e,i,a)=>{var o=a+(-(e-i)*t-a*n)*r/1e3,c=a*r/1e3+e;return Math.abs(c-i)<_u&&Math.abs(o)<_u?[i,0]:[c,o]};return i.isStepper=!0,i.dt=r,i}();default:if("cubic-bezier"===e.split("(")[0])return ju(e)}return"function"==typeof e?e:null})(o),a,p,d.getTimeoutController());return d.start([u,c,()=>{y.current=e()},a,l]),()=>{d.stop(),y.current&&y.current(),l()}},[f,i,a,o,c,u,l,d]),s(h.t)}function Lu(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"animation-",r=n.useRef(it(t)),i=n.useRef(e);return i.current!==e&&(r.current=it(t),i.current=e),r.current}var Ru=["radius"],Bu=["radius"];function Ku(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Fu(e){for(var t=1;t{var a,o=Math.min(Math.abs(n)/2,Math.abs(r)/2),c=r>=0?1:-1,l=n>=0?1:-1,u=r>=0&&n>=0||r<0&&n<0?1:0;if(o>0&&i instanceof Array){for(var s=[0,0,0,0],f=0;f<4;f++)s[f]=i[f]>o?o:i[f];a="M".concat(e,",").concat(t+c*s[0]),s[0]>0&&(a+="A ".concat(s[0],",").concat(s[0],",0,0,").concat(u,",").concat(e+l*s[0],",").concat(t)),a+="L ".concat(e+n-l*s[1],",").concat(t),s[1]>0&&(a+="A ".concat(s[1],",").concat(s[1],",0,0,").concat(u,",\n ").concat(e+n,",").concat(t+c*s[1])),a+="L ".concat(e+n,",").concat(t+r-c*s[2]),s[2]>0&&(a+="A ".concat(s[2],",").concat(s[2],",0,0,").concat(u,",\n ").concat(e+n-l*s[2],",").concat(t+r)),a+="L ".concat(e+l*s[3],",").concat(t+r),s[3]>0&&(a+="A ".concat(s[3],",").concat(s[3],",0,0,").concat(u,",\n ").concat(e,",").concat(t+r-c*s[3])),a+="Z"}else if(o>0&&i===+i&&i>0){var d=Math.min(o,i);a="M ".concat(e,",").concat(t+c*d,"\n A ").concat(d,",").concat(d,",0,0,").concat(u,",").concat(e+l*d,",").concat(t,"\n L ").concat(e+n-l*d,",").concat(t,"\n A ").concat(d,",").concat(d,",0,0,").concat(u,",").concat(e+n,",").concat(t+c*d,"\n L ").concat(e+n,",").concat(t+r-c*d,"\n A ").concat(d,",").concat(d,",0,0,").concat(u,",").concat(e+n-l*d,",").concat(t+r,"\n L ").concat(e+l*d,",").concat(t+r,"\n A ").concat(d,",").concat(d,",0,0,").concat(u,",").concat(e,",").concat(t+r-c*d," Z")}else a="M ".concat(e,",").concat(t," h ").concat(n," v ").concat(r," h ").concat(-n," Z");return a},Vu={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},qu=e=>{var t=At(e,Vu),r=n.useRef(null),[i,a]=n.useState(-1);n.useEffect(()=>{if(r.current&&r.current.getTotalLength)try{var e=r.current.getTotalLength();e&&a(e)}catch(t){}},[]);var{x:o,y:c,width:l,height:u,radius:f,className:d}=t,{animationEasing:h,animationDuration:p,animationBegin:y,isAnimationActive:v,isUpdateAnimationActive:g}=t,b=n.useRef(l),w=n.useRef(u),x=n.useRef(o),O=n.useRef(c),_=Lu(n.useMemo(()=>({x:o,y:c,width:l,height:u,radius:f}),[o,c,l,u,f]),"rectangle-");if(o!==+o||c!==+c||l!==+l||u!==+u||0===l||0===u)return null;var P=s("recharts-rectangle",d);if(!g){var A=m(t),{radius:E}=A,j=$u(A,Ru);return n.createElement("path",Wu({},j,{radius:"number"==typeof f?f:void 0,className:P,d:Hu(o,c,l,u,f)}))}var S=b.current,k=w.current,M=x.current,C=O.current,T="0px ".concat(-1===i?1:i,"px"),I="".concat(i,"px 0px"),D=pu(["strokeDasharray"],p,"string"==typeof h?h:Vu.animationEasing);return n.createElement(zu,{animationId:_,key:_,canBegin:i>0,duration:p,easing:h,isActive:g,begin:y},e=>{var i,a=ct(S,l,e),s=ct(k,u,e),d=ct(M,o,e),h=ct(C,c,e);r.current&&(b.current=a,w.current=s,x.current=d,O.current=h),i=v?e>0?{transition:D,strokeDasharray:I}:{strokeDasharray:T}:{strokeDasharray:I};var p=m(t),{radius:y}=p,g=$u(p,Bu);return n.createElement("path",Wu({},g,{radius:"number"==typeof f?f:void 0,className:P,d:Hu(d,h,a,s,f),ref:r,style:Fu(Fu({},i),t.style)}))})};function Yu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Xu(e){for(var t=1;t180*e/Math.PI,Ju=(e,t,n,r)=>({x:e+Math.cos(-Zu*r)*n,y:t+Math.sin(-Zu*r)*n}),es=(e,t)=>{var{startAngle:n,endAngle:r}=t,i=Math.floor(n/360),a=Math.floor(r/360);return e+360*Math.min(i,a)},ts=(e,t)=>{var{chartX:n,chartY:r}=e,{radius:i,angle:a}=((e,t)=>{var{x:n,y:r}=e,{cx:i,cy:a}=t,o=((e,t)=>{var{x:n,y:r}=e,{x:i,y:a}=t;return Math.sqrt((n-i)**2+(r-a)**2)})({x:n,y:r},{x:i,y:a});if(o<=0)return{radius:o,angle:0};var c=(n-i)/o,l=Math.acos(c);return r>a&&(l=2*Math.PI-l),{radius:o,angle:Qu(l),angleInRadian:l}})({x:n,y:r},t),{innerRadius:o,outerRadius:c}=t;if(ic)return null;if(0===i)return null;var l,{startAngle:u,endAngle:s}=(e=>{var{startAngle:t,endAngle:n}=e,r=Math.floor(t/360),i=Math.floor(n/360),a=Math.min(r,i);return{startAngle:t-360*a,endAngle:n-360*a}})(t),f=a;if(u<=s){for(;f>s;)f-=360;for(;f=u&&f<=s}else{for(;f>u;)f-=360;for(;f=s&&f<=u}return l?Xu(Xu({},t),{},{radius:i,angle:es(f,t)}):null};function ns(e){var{cx:t,cy:n,radius:r,startAngle:i,endAngle:a}=e;return{points:[Ju(t,n,r,i),Ju(t,n,r,a)],cx:t,cy:n,radius:r,startAngle:i,endAngle:a}}function rs(){return rs=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{cx:t,cy:n,radius:r,angle:i,sign:a,isExternal:o,cornerRadius:c,cornerIsExternal:l}=e,u=c*(o?1:-1)+r,s=Math.asin(c/u)/Zu,f=l?i:i+a*s,d=l?i-a*s:i;return{center:Ju(t,n,u,f),circleTangency:Ju(t,n,r,f),lineTangency:Ju(t,n,u*Math.cos(s*Zu),d),theta:s}},as=e=>{var{cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:a,endAngle:o}=e,c=((e,t)=>Qe(t-e)*Math.min(Math.abs(t-e),359.999))(a,o),l=a+c,u=Ju(t,n,i,a),s=Ju(t,n,i,l),f="M ".concat(u.x,",").concat(u.y,"\n A ").concat(i,",").concat(i,",0,\n ").concat(+(Math.abs(c)>180),",").concat(+(a>l),",\n ").concat(s.x,",").concat(s.y,"\n ");if(r>0){var d=Ju(t,n,r,a),h=Ju(t,n,r,l);f+="L ".concat(h.x,",").concat(h.y,"\n A ").concat(r,",").concat(r,",0,\n ").concat(+(Math.abs(c)>180),",").concat(+(a<=l),",\n ").concat(d.x,",").concat(d.y," Z")}else f+="L ".concat(t,",").concat(n," Z");return f},os={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},cs=e=>{var t=At(e,os),{cx:r,cy:i,innerRadius:a,outerRadius:o,cornerRadius:c,forceCornerRadius:l,cornerIsExternal:u,startAngle:f,endAngle:d,className:h}=t;if(o0&&Math.abs(f-d)<360?(e=>{var{cx:t,cy:n,innerRadius:r,outerRadius:i,cornerRadius:a,forceCornerRadius:o,cornerIsExternal:c,startAngle:l,endAngle:u}=e,s=Qe(u-l),{circleTangency:f,lineTangency:d,theta:h}=is({cx:t,cy:n,radius:i,angle:l,sign:s,cornerRadius:a,cornerIsExternal:c}),{circleTangency:p,lineTangency:y,theta:v}=is({cx:t,cy:n,radius:i,angle:u,sign:-s,cornerRadius:a,cornerIsExternal:c}),g=c?Math.abs(l-u):Math.abs(l-u)-h-v;if(g<0)return o?"M ".concat(d.x,",").concat(d.y,"\n a").concat(a,",").concat(a,",0,0,1,").concat(2*a,",0\n a").concat(a,",").concat(a,",0,0,1,").concat(2*-a,",0\n "):as({cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:l,endAngle:u});var m="M ".concat(d.x,",").concat(d.y,"\n A").concat(a,",").concat(a,",0,0,").concat(+(s<0),",").concat(f.x,",").concat(f.y,"\n A").concat(i,",").concat(i,",0,").concat(+(g>180),",").concat(+(s<0),",").concat(p.x,",").concat(p.y,"\n A").concat(a,",").concat(a,",0,0,").concat(+(s<0),",").concat(y.x,",").concat(y.y,"\n ");if(r>0){var{circleTangency:b,lineTangency:w,theta:x}=is({cx:t,cy:n,radius:r,angle:l,sign:s,isExternal:!0,cornerRadius:a,cornerIsExternal:c}),{circleTangency:O,lineTangency:_,theta:P}=is({cx:t,cy:n,radius:r,angle:u,sign:-s,isExternal:!0,cornerRadius:a,cornerIsExternal:c}),A=c?Math.abs(l-u):Math.abs(l-u)-x-P;if(A<0&&0===a)return"".concat(m,"L").concat(t,",").concat(n,"Z");m+="L".concat(_.x,",").concat(_.y,"\n A").concat(a,",").concat(a,",0,0,").concat(+(s<0),",").concat(O.x,",").concat(O.y,"\n A").concat(r,",").concat(r,",0,").concat(+(A>180),",").concat(+(s>0),",").concat(b.x,",").concat(b.y,"\n A").concat(a,",").concat(a,",0,0,").concat(+(s<0),",").concat(w.x,",").concat(w.y,"Z")}else m+="L".concat(t,",").concat(n,"Z");return m})({cx:r,cy:i,innerRadius:a,outerRadius:o,cornerRadius:Math.min(g,v/2),forceCornerRadius:l,cornerIsExternal:u,startAngle:f,endAngle:d}):as({cx:r,cy:i,innerRadius:a,outerRadius:o,startAngle:f,endAngle:d}),n.createElement("path",rs({},m(t),{className:y,d:p}))};function ls(e,t,n){if("horizontal"===e)return[{x:t.x,y:n.top},{x:t.x,y:n.top+n.height}];if("vertical"===e)return[{x:n.left,y:t.y},{x:n.left+n.width,y:t.y}];if(xt(t)){if("centric"===e){var{cx:r,cy:i,innerRadius:a,outerRadius:o,angle:c}=t,l=Ju(r,i,a,c),u=Ju(r,i,o,c);return[{x:l.x,y:l.y},{x:u.x,y:u.y}]}return ns(t)}}var us,ss,fs,ds,hs,ps={},ys={},vs={};function gs(){return us||(us=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=zr();e.toNumber=function(e){return t.isSymbol(e)?NaN:Number(e)}}(vs)),vs}function ms(){return ss||(ss=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=gs();e.toFinite=function(e){return e?(e=t.toNumber(e))===1/0||e===-1/0?(e<0?-1:1)*Number.MAX_VALUE:e==e?e:0:0===e?e:0}}(ys)),ys}function bs(){return hs?ds:(hs=1,ds=(fs||(fs=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=qr(),n=ms();e.range=function(e,r,i){i&&"number"!=typeof i&&t.isIterateeCall(e,r,i)&&(r=i=void 0),e=n.toFinite(e),void 0===r?(r=e,e=0):r=n.toFinite(r),i=void 0===i?et?1:e>=t?0:NaN}function Os(e,t){return null==e||null==t?NaN:te?1:t>=e?0:NaN}function _s(e){let t,n,r;function i(e,r,i=0,a=e.length){if(i>>1;n(e[t],r)<0?i=t+1:a=t}while(ixs(e(t),n),r=(t,n)=>e(t)-n):(t=e===xs||e===Os?e:Ps,n=e,r=e),{left:i,center:function(e,t,n=0,a=e.length){const o=i(e,t,n,a-1);return o>n&&r(e[o-1],t)>-r(e[o],t)?o-1:o},right:function(e,r,i=0,a=e.length){if(i>>1;n(e[t],r)<=0?i=t+1:a=t}while(i{if(!((a-=o)>=i))return;let c=e*r[i];const l=o*e;for(let e=i,t=i+l;e{if(!((o-=c)>=a))return;let l=t*i[a];const u=c*t,s=u+c;for(let t=a,n=a+u;t=0))throw new RangeError("invalid rx");if(!((n=+n)>=0))throw new RangeError("invalid ry");let{data:r,width:i,height:a}=e;if(!((i=Math.floor(i))>=0))throw new RangeError("invalid width");if(!((a=Math.floor(void 0!==a?a:r.length/i))>=0))throw new RangeError("invalid height");if(!i||!a||!t&&!n)return e;const o=t&&Ss(t),c=n&&Ss(n),l=r.slice();return o&&c?(ks(o,l,r,i,a),ks(o,r,l,i,a),ks(o,l,r,i,a),Ms(c,r,l,i,a),Ms(c,l,r,i,a),Ms(c,r,l,i,a)):o?(ks(o,r,l,i,a),ks(o,l,r,i,a),ks(o,r,l,i,a)):c&&(Ms(c,r,l,i,a),Ms(c,l,r,i,a),Ms(c,r,l,i,a)),e});var Ss;function ks(e,t,n,r,i){for(let a=0,o=r*i;a=i&&(n=r=i):(n>i&&(n=i),r=a&&(n=r=a):(n>a&&(n=a),r=e))-(null==t||!(t>=t))||(et?1:0)}const zs=Math.sqrt(50),Ls=Math.sqrt(10),Rs=Math.sqrt(2);function Bs(e,t,n){const r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/Math.pow(10,i),o=a>=zs?10:a>=Ls?5:a>=Rs?2:1;let c,l,u;return i<0?(u=Math.pow(10,-i)/o,c=Math.round(e*u),l=Math.round(t*u),c/ut&&--l,u=-u):(u=Math.pow(10,i)*o,c=Math.round(e/u),l=Math.round(t/u),c*ut&&--l),l0))return[];if((e=+e)===(t=+t))return[e];const r=t=i))return[];const c=a-i+1,l=new Array(c);if(r)if(o<0)for(let u=0;u=n&&++t;return t}(e))/Math.LN2)+1)}function $s(e,t){let n;for(const r of e)null!=r&&(n=r)&&(n=r);return n}function Hs(e,t){let n;for(const r of e)null!=r&&(n>r||void 0===n&&r>=r)&&(n=r);return n}function Vs(e,t,n=0,r=1/0,i){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(i=void 0===i?Ns:function(e=xs){if(e===xs)return Ns;if("function"!=typeof e)throw new TypeError("compare is not a function");return(t,n)=>{const r=e(t,n);return r||0===r?r:(0===e(n,n))-(0===e(t,t))}}(i);r>n;){if(r-n>600){const a=r-n+1,o=t-n+1,c=Math.log(a),l=.5*Math.exp(2*c/3),u=.5*Math.sqrt(c*l*(a-l)/a)*(o-a/2<0?-1:1);Vs(e,t,Math.max(n,Math.floor(t-o*l/a+u)),Math.min(r,Math.floor(t+(a-o)*l/a+u)),i)}const a=e[t];let o=n,c=r;for(qs(e,n,t),i(e[r],a)>0&&qs(e,n,r);o0;)--c}0===i(e[n],a)?qs(e,n,c):(++c,qs(e,c,r)),c<=t&&(n=c+1),t<=c&&(r=c-1)}return e}function qs(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function Ys(e,t,n){if((r=(e=Float64Array.from(function*(e){for(let t of e)null!=t&&(t=+t)>=t&&(yield t)}(e))).length)&&!isNaN(t=+t)){if(t<=0||r<2)return Hs(e);if(t>=1)return $s(e);var r,i=(r-1)*t,a=Math.floor(i),o=$s(Vs(e,a).subarray(0,a+1));return o+(Hs(e.subarray(a+1))-o)*(i-a)}}function Xs(e,t,n=As){if((r=e.length)&&!isNaN(t=+t)){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,a=Math.floor(i),o=+n(e[a],a,e);return o+(+n(e[a+1],a+1,e)-o)*(i-a)}}function Gs(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e)}return this}function Zs(e,t){switch(arguments.length){case 0:break;case 1:"function"==typeof e?this.interpolator(e):this.range(e);break;default:this.domain(e),"function"==typeof t?this.interpolator(t):this.range(t)}return this}const Qs=Symbol("implicit");function Js(){var e=new Ts,t=[],n=[],r=Qs;function i(i){let a=e.get(i);if(void 0===a){if(r!==Qs)return r;e.set(i,a=t.push(i)-1)}return n[a%n.length]}return i.domain=function(n){if(!arguments.length)return t.slice();t=[],e=new Ts;for(const r of n)e.has(r)||e.set(r,t.push(r)-1);return i},i.range=function(e){return arguments.length?(n=Array.from(e),i):n.slice()},i.unknown=function(e){return arguments.length?(r=e,i):r},i.copy=function(){return Js(t,n).unknown(r)},Gs.apply(i,arguments),i}function ef(){var e,t,n=Js().unknown(void 0),r=n.domain,i=n.range,a=0,o=1,c=!1,l=0,u=0,s=.5;function f(){var n=r().length,f=o>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?_f(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?_f(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=df.exec(e))?new Ef(t[1],t[2],t[3],1):(t=hf.exec(e))?new Ef(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=pf.exec(e))?_f(t[1],t[2],t[3],t[4]):(t=yf.exec(e))?_f(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=vf.exec(e))?Tf(t[1],t[2]/100,t[3]/100,1):(t=gf.exec(e))?Tf(t[1],t[2]/100,t[3]/100,t[4]):mf.hasOwnProperty(e)?Of(mf[e]):"transparent"===e?new Ef(NaN,NaN,NaN,0):null}function Of(e){return new Ef(e>>16&255,e>>8&255,255&e,1)}function _f(e,t,n,r){return r<=0&&(e=t=n=NaN),new Ef(e,t,n,r)}function Pf(e){return e instanceof af||(e=xf(e)),e?new Ef((e=e.rgb()).r,e.g,e.b,e.opacity):new Ef}function Af(e,t,n,r){return 1===arguments.length?Pf(e):new Ef(e,t,n,null==r?1:r)}function Ef(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function jf(){return`#${Cf(this.r)}${Cf(this.g)}${Cf(this.b)}`}function Sf(){const e=kf(this.opacity);return`${1===e?"rgb(":"rgba("}${Mf(this.r)}, ${Mf(this.g)}, ${Mf(this.b)}${1===e?")":`, ${e})`}`}function kf(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Mf(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Cf(e){return((e=Mf(e))<16?"0":"")+e.toString(16)}function Tf(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Df(e,t,n,r)}function If(e){if(e instanceof Df)return new Df(e.h,e.s,e.l,e.opacity);if(e instanceof af||(e=xf(e)),!e)return new Df;if(e instanceof Df)return e;var t=(e=e.rgb()).r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,c=a-i,l=(a+i)/2;return c?(o=t===a?(n-r)/c+6*(n0&&l<1?0:o,new Df(o,c,l,e.opacity)}function Df(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function Nf(e){return(e=(e||0)%360)<0?e+360:e}function zf(e){return Math.max(0,Math.min(1,e||0))}function Lf(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}nf(af,xf,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:bf,formatHex:bf,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return If(this).formatHsl()},formatRgb:wf,toString:wf}),nf(Ef,Af,rf(af,{brighter(e){return e=null==e?cf:Math.pow(cf,e),new Ef(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?of:Math.pow(of,e),new Ef(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ef(Mf(this.r),Mf(this.g),Mf(this.b),kf(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:jf,formatHex:jf,formatHex8:function(){return`#${Cf(this.r)}${Cf(this.g)}${Cf(this.b)}${Cf(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Sf,toString:Sf})),nf(Df,function(e,t,n,r){return 1===arguments.length?If(e):new Df(e,t,n,null==r?1:r)},rf(af,{brighter(e){return e=null==e?cf:Math.pow(cf,e),new Df(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?of:Math.pow(of,e),new Df(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Ef(Lf(e>=240?e-240:e+120,i,r),Lf(e,i,r),Lf(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Df(Nf(this.h),zf(this.s),zf(this.l),kf(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=kf(this.opacity);return`${1===e?"hsl(":"hsla("}${Nf(this.h)}, ${100*zf(this.s)}%, ${100*zf(this.l)}%${1===e?")":`, ${e})`}`}}));const Rf=Math.PI/180,Bf=180/Math.PI;var Kf=-.14861,Ff=1.78277,Uf=-.29227,Wf=-.90649,$f=1.97294,Hf=$f*Wf,Vf=$f*Ff,qf=Ff*Uf-Wf*Kf;function Yf(e,t,n,r){return 1===arguments.length?function(e){if(e instanceof Xf)return new Xf(e.h,e.s,e.l,e.opacity);e instanceof Ef||(e=Pf(e));var t=e.r/255,n=e.g/255,r=e.b/255,i=(qf*r+Hf*t-Vf*n)/(qf+Hf-Vf),a=r-i,o=($f*(n-i)-Uf*a)/Wf,c=Math.sqrt(o*o+a*a)/($f*i*(1-i)),l=c?Math.atan2(o,a)*Bf-120:NaN;return new Xf(l<0?l+360:l,c,i,e.opacity)}(e):new Xf(e,t,n,null==r?1:r)}function Xf(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}nf(Xf,Yf,rf(af,{brighter(e){return e=null==e?cf:Math.pow(cf,e),new Xf(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?of:Math.pow(of,e),new Xf(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=isNaN(this.h)?0:(this.h+120)*Rf,t=+this.l,n=isNaN(this.s)?0:this.s*t*(1-t),r=Math.cos(e),i=Math.sin(e);return new Ef(255*(t+n*(Kf*r+Ff*i)),255*(t+n*(Uf*r+Wf*i)),255*(t+n*($f*r)),this.opacity)}}));const Gf=e=>()=>e;function Zf(e,t){return function(n){return e+n*t}}function Qf(e,t){var n=t-e;return n?Zf(e,n):Gf(isNaN(e)?t:e)}const Jf=function e(t){var n=function(e){return 1===(e=+e)?Qf:function(t,n){return n-t?function(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}(t,n,e):Gf(isNaN(t)?n:t)}}(t);function r(e,t){var r=n((e=Af(e)).r,(t=Af(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=Qf(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+""}}return r.gamma=e,r}(1);function ed(e,t){t||(t=[]);var n,r=e?Math.min(t.length,e.length):0,i=t.slice();return function(a){for(n=0;na&&(i=t.slice(a,i),c[o]?c[o]+=i:c[++o]=i),(n=n[0])===(r=r[0])?c[o]?c[o]+=r:c[++o]=r:(c[++o]=null,l.push({i:o,x:rd(n,r)})),a=od.lastIndex;return a180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+"rotate(",null,r)-2,x:rd(e,t)})):t&&n.push(i(n)+"rotate("+t+r)}(a.rotate,o.rotate,c,l),function(e,t,n,a){e!==t?a.push({i:n.push(i(n)+"skewX(",null,r)-2,x:rd(e,t)}):t&&n.push(i(n)+"skewX("+t+r)}(a.skewX,o.skewX,c,l),function(e,t,n,r,a,o){if(e!==n||t!==r){var c=a.push(i(a)+"scale(",null,",",null,")");o.push({i:c-4,x:rd(e,n)},{i:c-2,x:rd(t,r)})}else 1===n&&1===r||a.push(i(a)+"scale("+n+","+r+")")}(a.scaleX,a.scaleY,o.scaleX,o.scaleY,c,l),a=o=null,function(e){for(var t,n=-1,r=l.length;++n180||n<-180?n-360*Math.round(n/360):n):Gf(isNaN(e)?t:e)});function bd(e,t){void 0===t&&(t=e,e=ld);for(var n=0,r=t.length-1,i=t[0],a=new Array(r<0?0:r);nt&&(n=e,e=t,t=n),u=function(n){return Math.max(e,Math.min(t,n))}),r=l>2?Ed:Ad,i=a=null,f}function f(t){return null==t||isNaN(t=+t)?n:(i||(i=r(o.map(e),c,l)))(e(u(t)))}return f.invert=function(n){return u(t((a||(a=r(c,o.map(e),rd)))(n)))},f.domain=function(e){return arguments.length?(o=Array.from(e,xd),s()):o.slice()},f.range=function(e){return arguments.length?(c=Array.from(e),s()):c.slice()},f.rangeRound=function(e){return c=Array.from(e),l=ud,s()},f.clamp=function(e){return arguments.length?(u=!!e||_d,s()):u!==_d},f.interpolate=function(e){return arguments.length?(l=e,s()):l},f.unknown=function(e){return arguments.length?(n=e,f):n},function(n,r){return e=n,t=r,s()}}function kd(){return Sd()(_d,_d)}function Md(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function Cd(e){return(e=Md(Math.abs(e)))?e[1]:NaN}var Td,Id=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Dd(e){if(!(t=Id.exec(e)))throw new Error("invalid format: "+e);var t;return new Nd({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}function Nd(e){this.fill=void 0===e.fill?" ":e.fill+"",this.align=void 0===e.align?">":e.align+"",this.sign=void 0===e.sign?"-":e.sign+"",this.symbol=void 0===e.symbol?"":e.symbol+"",this.zero=!!e.zero,this.width=void 0===e.width?void 0:+e.width,this.comma=!!e.comma,this.precision=void 0===e.precision?void 0:+e.precision,this.trim=!!e.trim,this.type=void 0===e.type?"":e.type+""}function zd(e,t){var n=Md(e,t);if(!n)return e+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}Dd.prototype=Nd.prototype,Nd.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};const Ld={"%":(e,t)=>(100*e).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:function(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)},e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>zd(100*e,t),r:zd,s:function(e,t){var n=Md(e,t);if(!n)return e+"";var r=n[0],i=n[1],a=i-(Td=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,o=r.length;return a===o?r:a>o?r+new Array(a-o+1).join("0"):a>0?r.slice(0,a)+"."+r.slice(a):"0."+new Array(1-a).join("0")+Md(e,Math.max(0,t+a-1))[0]},X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function Rd(e){return e}var Bd,Kd,Fd,Ud=Array.prototype.map,Wd=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function $d(e,t,n,r){var i,a=Us(e,t,n);switch((r=Dd(null==r?",f":r)).type){case"s":var o=Math.max(Math.abs(e),Math.abs(t));return null!=r.precision||isNaN(i=function(e,t){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(Cd(t)/3)))-Cd(Math.abs(e)))}(a,o))||(r.precision=i),Fd(r,o);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(i=function(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Cd(t)-Cd(e))+1}(a,Math.max(Math.abs(e),Math.abs(t))))||(r.precision=i-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(i=function(e){return Math.max(0,-Cd(Math.abs(e)))}(a))||(r.precision=i-2*("%"===r.type))}return Kd(r)}function Hd(e){var t=e.domain;return e.ticks=function(e){var n=t();return Ks(n[0],n[n.length-1],null==e?10:e)},e.tickFormat=function(e,n){var r=t();return $d(r[0],r[r.length-1],null==e?10:e,n)},e.nice=function(n){null==n&&(n=10);var r,i,a=t(),o=0,c=a.length-1,l=a[o],u=a[c],s=10;for(u0;){if((i=Fs(l,u,n))===r)return a[o]=l,a[c]=u,t(a);if(i>0)l=Math.floor(l/i)*i,u=Math.ceil(u/i)*i;else{if(!(i<0))break;l=Math.ceil(l*i)/i,u=Math.floor(u*i)/i}r=i}return e},e}function Vd(){var e=kd();return e.copy=function(){return jd(e,Vd())},Gs.apply(e,arguments),Hd(e)}function qd(e,t){var n,r=0,i=(e=e.slice()).length-1,a=e[r],o=e[i];return o-e(-t,n)}function eh(e){const t=e(Yd,Xd),n=t.domain;let r,i,a=10;function o(){return r=function(e){return e===Math.E?Math.log:10===e&&Math.log10||2===e&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}(a),i=function(e){return 10===e?Qd:e===Math.E?Math.exp:t=>Math.pow(e,t)}(a),n()[0]<0?(r=Jd(r),i=Jd(i),e(Gd,Zd)):e(Yd,Xd),t}return t.base=function(e){return arguments.length?(a=+e,o()):a},t.domain=function(e){return arguments.length?(n(e),o()):n()},t.ticks=e=>{const t=n();let o=t[0],c=t[t.length-1];const l=c0){for(;f<=d;++f)for(u=1;uc)break;p.push(s)}}else for(;f<=d;++f)for(u=a-1;u>=1;--u)if(s=f>0?u/i(-f):u*i(f),!(sc)break;p.push(s)}2*p.length{if(null==e&&(e=10),null==n&&(n=10===a?"s":","),"function"!=typeof n&&(a%1||null!=(n=Dd(n)).precision||(n.trim=!0),n=Kd(n)),e===1/0)return n;const o=Math.max(1,a*e/t.ticks().length);return e=>{let t=e/i(Math.round(r(e)));return t*an(qd(n(),{floor:e=>i(Math.floor(r(e))),ceil:e=>i(Math.ceil(r(e)))})),t}function th(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function nh(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function rh(e){var t=1,n=e(th(t),nh(t));return n.constant=function(n){return arguments.length?e(th(t=+n),nh(t)):t},Hd(n)}function ih(){var e=rh(Sd());return e.copy=function(){return jd(e,ih()).constant(e.constant())},Gs.apply(e,arguments)}function ah(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function oh(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function ch(e){return e<0?-e*e:e*e}function lh(e){var t=e(_d,_d),n=1;return t.exponent=function(t){return arguments.length?1===(n=+t)?e(_d,_d):.5===n?e(oh,ch):e(ah(n),ah(1/n)):n},Hd(t)}function uh(){var e=lh(Sd());return e.copy=function(){return jd(e,uh()).exponent(e.exponent())},Gs.apply(e,arguments),e}function sh(e){return Math.sign(e)*e*e}function fh(){var e,t=0,n=1,r=1,i=[.5],a=[0,1];function o(t){return null!=t&&t<=t?a[Es(i,t,0,r)]:e}function c(){var e=-1;for(i=new Array(r);++e=r?[i[r-1],n]:[i[o-1],i[o]]},o.unknown=function(t){return arguments.length?(e=t,o):o},o.thresholds=function(){return i.slice()},o.copy=function(){return fh().domain([t,n]).range(a).unknown(e)},Gs.apply(Hd(o),arguments)}Bd=function(e){var t,n,r=void 0===e.grouping||void 0===e.thousands?Rd:(t=Ud.call(e.grouping,Number),n=e.thousands+"",function(e,r){for(var i=e.length,a=[],o=0,c=t[0],l=0;i>0&&c>0&&(l+c+1>r&&(c=Math.max(1,r-l)),a.push(e.substring(i-=c,i+c)),!((l+=c+1)>r));)c=t[o=(o+1)%t.length];return a.reverse().join(n)}),i=void 0===e.currency?"":e.currency[0]+"",a=void 0===e.currency?"":e.currency[1]+"",o=void 0===e.decimal?".":e.decimal+"",c=void 0===e.numerals?Rd:function(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}(Ud.call(e.numerals,String)),l=void 0===e.percent?"%":e.percent+"",u=void 0===e.minus?"−":e.minus+"",s=void 0===e.nan?"NaN":e.nan+"";function f(e){var t=(e=Dd(e)).fill,n=e.align,f=e.sign,d=e.symbol,h=e.zero,p=e.width,y=e.comma,v=e.precision,g=e.trim,m=e.type;"n"===m?(y=!0,m="g"):Ld[m]||(void 0===v&&(v=12),g=!0,m="g"),(h||"0"===t&&"="===n)&&(h=!0,t="0",n="=");var b="$"===d?i:"#"===d&&/[boxX]/.test(m)?"0"+m.toLowerCase():"",w="$"===d?a:/[%p]/.test(m)?l:"",x=Ld[m],O=/[defgprs%]/.test(m);function _(e){var i,a,l,d=b,_=w;if("c"===m)_=x(e)+_,e="";else{var P=(e=+e)<0||1/e<0;if(e=isNaN(e)?s:x(Math.abs(e),v),g&&(e=function(e){e:for(var t,n=e.length,r=1,i=-1;r0&&(i=0)}return i>0?e.slice(0,i)+e.slice(t+1):e}(e)),P&&0===+e&&"+"!==f&&(P=!1),d=(P?"("===f?f:u:"-"===f||"("===f?"":f)+d,_=("s"===m?Wd[8+Td/3]:"")+_+(P&&"("===f?")":""),O)for(i=-1,a=e.length;++i(l=e.charCodeAt(i))||l>57){_=(46===l?o+e.slice(i+1):e.slice(i))+_,e=e.slice(0,i);break}}y&&!h&&(e=r(e,1/0));var A=d.length+e.length+_.length,E=A>1)+d+e+_+E.slice(A);break;default:e=E+d+e+_}return c(e)}return v=void 0===v?6:/[gprs]/.test(m)?Math.max(1,Math.min(21,v)):Math.max(0,Math.min(20,v)),_.toString=function(){return e+""},_}return{format:f,formatPrefix:function(e,t){var n=f(((e=Dd(e)).type="f",e)),r=3*Math.max(-8,Math.min(8,Math.floor(Cd(t)/3))),i=Math.pow(10,-r),a=Wd[8+r/3];return function(e){return n(i*e)+a}}}}({thousands:",",grouping:[3],currency:["$",""]}),Kd=Bd.format,Fd=Bd.formatPrefix;const dh=new Date,hh=new Date;function ph(e,t,n,r){function i(t){return e(t=0===arguments.length?new Date:new Date(+t)),t}return i.floor=t=>(e(t=new Date(+t)),t),i.ceil=n=>(e(n=new Date(n-1)),t(n,1),e(n),n),i.round=e=>{const t=i(e),n=i.ceil(e);return e-t(t(e=new Date(+e),null==n?1:Math.floor(n)),e),i.range=(n,r,a)=>{const o=[];if(n=i.ceil(n),a=null==a?1:Math.floor(a),!(n0))return o;let c;do{o.push(c=new Date(+n)),t(n,a),e(n)}while(cph(t=>{if(t>=t)for(;e(t),!n(t);)t.setTime(t-1)},(e,r)=>{if(e>=e)if(r<0)for(;++r<=0;)for(;t(e,-1),!n(e););else for(;--r>=0;)for(;t(e,1),!n(e););}),n&&(i.count=(t,r)=>(dh.setTime(+t),hh.setTime(+r),e(dh),e(hh),Math.floor(n(dh,hh))),i.every=e=>(e=Math.floor(e),isFinite(e)&&e>0?e>1?i.filter(r?t=>r(t)%e===0:t=>i.count(0,t)%e===0):i:null)),i}const yh=ph(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);yh.every=e=>(e=Math.floor(e),isFinite(e)&&e>0?e>1?ph(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):yh:null),yh.range;const vh=1e3,gh=6e4,mh=36e5,bh=864e5,wh=6048e5,xh=31536e6,Oh=ph(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*vh)},(e,t)=>(t-e)/vh,e=>e.getUTCSeconds());Oh.range;const _h=ph(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*vh)},(e,t)=>{e.setTime(+e+t*gh)},(e,t)=>(t-e)/gh,e=>e.getMinutes());_h.range;const Ph=ph(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*gh)},(e,t)=>(t-e)/gh,e=>e.getUTCMinutes());Ph.range;const Ah=ph(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*vh-e.getMinutes()*gh)},(e,t)=>{e.setTime(+e+t*mh)},(e,t)=>(t-e)/mh,e=>e.getHours());Ah.range;const Eh=ph(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*mh)},(e,t)=>(t-e)/mh,e=>e.getUTCHours());Eh.range;const jh=ph(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*gh)/bh,e=>e.getDate()-1);jh.range;const Sh=ph(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/bh,e=>e.getUTCDate()-1);Sh.range;const kh=ph(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/bh,e=>Math.floor(e/bh));function Mh(e){return ph(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(e,t)=>{e.setDate(e.getDate()+7*t)},(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*gh)/wh)}kh.range;const Ch=Mh(0),Th=Mh(1),Ih=Mh(2),Dh=Mh(3),Nh=Mh(4),zh=Mh(5),Lh=Mh(6);function Rh(e){return ph(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+7*t)},(e,t)=>(t-e)/wh)}Ch.range,Th.range,Ih.range,Dh.range,Nh.range,zh.range,Lh.range;const Bh=Rh(0),Kh=Rh(1),Fh=Rh(2),Uh=Rh(3),Wh=Rh(4),$h=Rh(5),Hh=Rh(6);Bh.range,Kh.range,Fh.range,Uh.range,Wh.range,$h.range,Hh.range;const Vh=ph(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+12*(t.getFullYear()-e.getFullYear()),e=>e.getMonth());Vh.range;const qh=ph(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+12*(t.getUTCFullYear()-e.getUTCFullYear()),e=>e.getUTCMonth());qh.range;const Yh=ph(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());Yh.every=e=>isFinite(e=Math.floor(e))&&e>0?ph(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)}):null,Yh.range;const Xh=ph(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());function Gh(e,t,n,r,i,a){const o=[[Oh,1,vh],[Oh,5,5e3],[Oh,15,15e3],[Oh,30,3e4],[a,1,gh],[a,5,3e5],[a,15,9e5],[a,30,18e5],[i,1,mh],[i,3,108e5],[i,6,216e5],[i,12,432e5],[r,1,bh],[r,2,1728e5],[n,1,wh],[t,1,2592e6],[t,3,7776e6],[e,1,xh]];function c(t,n,r){const i=Math.abs(n-t)/r,a=_s(([,,e])=>e).right(o,i);if(a===o.length)return e.every(Us(t/xh,n/xh,r));if(0===a)return yh.every(Math.max(Us(t,n,r),1));const[c,l]=o[i/o[a-1][2]isFinite(e=Math.floor(e))&&e>0?ph(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)}):null,Xh.range;const[Zh,Qh]=Gh(Xh,qh,Bh,kh,Eh,Ph),[Jh,ep]=Gh(Yh,Vh,Ch,jh,Ah,_h);function tp(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function np(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function rp(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}var ip,ap,op,cp={"-":"",_:" ",0:"0"},lp=/^\s*\d+/,up=/^%/,sp=/[\\^$*+?|[\]().{}]/g;function fp(e,t,n){var r=e<0?"-":"",i=(r?-e:e)+"",a=i.length;return r+(a[e.toLowerCase(),t]))}function yp(e,t,n){var r=lp.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function vp(e,t,n){var r=lp.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function gp(e,t,n){var r=lp.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function mp(e,t,n){var r=lp.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function bp(e,t,n){var r=lp.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function wp(e,t,n){var r=lp.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function xp(e,t,n){var r=lp.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Op(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function _p(e,t,n){var r=lp.exec(t.slice(n,n+1));return r?(e.q=3*r[0]-3,n+r[0].length):-1}function Pp(e,t,n){var r=lp.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function Ap(e,t,n){var r=lp.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function Ep(e,t,n){var r=lp.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function jp(e,t,n){var r=lp.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function Sp(e,t,n){var r=lp.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function kp(e,t,n){var r=lp.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function Mp(e,t,n){var r=lp.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function Cp(e,t,n){var r=lp.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Tp(e,t,n){var r=up.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function Ip(e,t,n){var r=lp.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function Dp(e,t,n){var r=lp.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function Np(e,t){return fp(e.getDate(),t,2)}function zp(e,t){return fp(e.getHours(),t,2)}function Lp(e,t){return fp(e.getHours()%12||12,t,2)}function Rp(e,t){return fp(1+jh.count(Yh(e),e),t,3)}function Bp(e,t){return fp(e.getMilliseconds(),t,3)}function Kp(e,t){return Bp(e,t)+"000"}function Fp(e,t){return fp(e.getMonth()+1,t,2)}function Up(e,t){return fp(e.getMinutes(),t,2)}function Wp(e,t){return fp(e.getSeconds(),t,2)}function $p(e){var t=e.getDay();return 0===t?7:t}function Hp(e,t){return fp(Ch.count(Yh(e)-1,e),t,2)}function Vp(e){var t=e.getDay();return t>=4||0===t?Nh(e):Nh.ceil(e)}function qp(e,t){return e=Vp(e),fp(Nh.count(Yh(e),e)+(4===Yh(e).getDay()),t,2)}function Yp(e){return e.getDay()}function Xp(e,t){return fp(Th.count(Yh(e)-1,e),t,2)}function Gp(e,t){return fp(e.getFullYear()%100,t,2)}function Zp(e,t){return fp((e=Vp(e)).getFullYear()%100,t,2)}function Qp(e,t){return fp(e.getFullYear()%1e4,t,4)}function Jp(e,t){var n=e.getDay();return fp((e=n>=4||0===n?Nh(e):Nh.ceil(e)).getFullYear()%1e4,t,4)}function ey(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+fp(t/60|0,"0",2)+fp(t%60,"0",2)}function ty(e,t){return fp(e.getUTCDate(),t,2)}function ny(e,t){return fp(e.getUTCHours(),t,2)}function ry(e,t){return fp(e.getUTCHours()%12||12,t,2)}function iy(e,t){return fp(1+Sh.count(Xh(e),e),t,3)}function ay(e,t){return fp(e.getUTCMilliseconds(),t,3)}function oy(e,t){return ay(e,t)+"000"}function cy(e,t){return fp(e.getUTCMonth()+1,t,2)}function ly(e,t){return fp(e.getUTCMinutes(),t,2)}function uy(e,t){return fp(e.getUTCSeconds(),t,2)}function sy(e){var t=e.getUTCDay();return 0===t?7:t}function fy(e,t){return fp(Bh.count(Xh(e)-1,e),t,2)}function dy(e){var t=e.getUTCDay();return t>=4||0===t?Wh(e):Wh.ceil(e)}function hy(e,t){return e=dy(e),fp(Wh.count(Xh(e),e)+(4===Xh(e).getUTCDay()),t,2)}function py(e){return e.getUTCDay()}function yy(e,t){return fp(Kh.count(Xh(e)-1,e),t,2)}function vy(e,t){return fp(e.getUTCFullYear()%100,t,2)}function gy(e,t){return fp((e=dy(e)).getUTCFullYear()%100,t,2)}function my(e,t){return fp(e.getUTCFullYear()%1e4,t,4)}function by(e,t){var n=e.getUTCDay();return fp((e=n>=4||0===n?Wh(e):Wh.ceil(e)).getUTCFullYear()%1e4,t,4)}function wy(){return"+0000"}function xy(){return"%"}function Oy(e){return+e}function _y(e){return Math.floor(+e/1e3)}function Py(e){return new Date(e)}function Ay(e){return e instanceof Date?+e:+new Date(+e)}function Ey(e,t,n,r,i,a,o,c,l,u){var s=kd(),f=s.invert,d=s.domain,h=u(".%L"),p=u(":%S"),y=u("%I:%M"),v=u("%I %p"),g=u("%a %d"),m=u("%b %d"),b=u("%B"),w=u("%Y");function x(e){return(l(e)=12)]},q:function(e){return 1+~~(e.getMonth()/3)},Q:Oy,s:_y,S:Wp,u:$p,U:Hp,V:qp,w:Yp,W:Xp,x:null,X:null,y:Gp,Y:Qp,Z:ey,"%":xy},w={a:function(e){return o[e.getUTCDay()]},A:function(e){return a[e.getUTCDay()]},b:function(e){return l[e.getUTCMonth()]},B:function(e){return c[e.getUTCMonth()]},c:null,d:ty,e:ty,f:oy,g:gy,G:by,H:ny,I:ry,j:iy,L:ay,m:cy,M:ly,p:function(e){return i[+(e.getUTCHours()>=12)]},q:function(e){return 1+~~(e.getUTCMonth()/3)},Q:Oy,s:_y,S:uy,u:sy,U:fy,V:hy,w:py,W:yy,x:null,X:null,y:vy,Y:my,Z:wy,"%":xy},x={a:function(e,t,n){var r=h.exec(t.slice(n));return r?(e.w=p.get(r[0].toLowerCase()),n+r[0].length):-1},A:function(e,t,n){var r=f.exec(t.slice(n));return r?(e.w=d.get(r[0].toLowerCase()),n+r[0].length):-1},b:function(e,t,n){var r=g.exec(t.slice(n));return r?(e.m=m.get(r[0].toLowerCase()),n+r[0].length):-1},B:function(e,t,n){var r=y.exec(t.slice(n));return r?(e.m=v.get(r[0].toLowerCase()),n+r[0].length):-1},c:function(e,n,r){return P(e,t,n,r)},d:Ap,e:Ap,f:Cp,g:xp,G:wp,H:jp,I:jp,j:Ep,L:Mp,m:Pp,M:Sp,p:function(e,t,n){var r=u.exec(t.slice(n));return r?(e.p=s.get(r[0].toLowerCase()),n+r[0].length):-1},q:_p,Q:Ip,s:Dp,S:kp,u:vp,U:gp,V:mp,w:yp,W:bp,x:function(e,t,r){return P(e,n,t,r)},X:function(e,t,n){return P(e,r,t,n)},y:xp,Y:wp,Z:Op,"%":Tp};function O(e,t){return function(n){var r,i,a,o=[],c=-1,l=0,u=e.length;for(n instanceof Date||(n=new Date(+n));++c53)return null;"w"in a||(a.w=1),"Z"in a?(i=(r=np(rp(a.y,0,1))).getUTCDay(),r=i>4||0===i?Kh.ceil(r):Kh(r),r=Sh.offset(r,7*(a.V-1)),a.y=r.getUTCFullYear(),a.m=r.getUTCMonth(),a.d=r.getUTCDate()+(a.w+6)%7):(i=(r=tp(rp(a.y,0,1))).getDay(),r=i>4||0===i?Th.ceil(r):Th(r),r=jh.offset(r,7*(a.V-1)),a.y=r.getFullYear(),a.m=r.getMonth(),a.d=r.getDate()+(a.w+6)%7)}else("W"in a||"U"in a)&&("w"in a||(a.w="u"in a?a.u%7:"W"in a?1:0),i="Z"in a?np(rp(a.y,0,1)).getUTCDay():tp(rp(a.y,0,1)).getDay(),a.m=0,a.d="W"in a?(a.w+6)%7+7*a.W-(i+5)%7:a.w+7*a.U-(i+6)%7);return"Z"in a?(a.H+=a.Z/100|0,a.M+=a.Z%100,np(a)):tp(a)}}function P(e,t,n,r){for(var i,a,o=0,c=t.length,l=n.length;o=l)return-1;if(37===(i=t.charCodeAt(o++))){if(i=t.charAt(o++),!(a=x[i in cp?t.charAt(o++):i])||(r=a(e,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}return b.x=O(n,b),b.X=O(r,b),b.c=O(t,b),w.x=O(n,w),w.X=O(r,w),w.c=O(t,w),{format:function(e){var t=O(e+="",b);return t.toString=function(){return e},t},parse:function(e){var t=_(e+="",!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=O(e+="",w);return t.toString=function(){return e},t},utcParse:function(e){var t=_(e+="",!0);return t.toString=function(){return e},t}}}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}),ap=ip.format,ip.parse,op=ip.utcFormat,ip.utcParse;const Dy=Object.freeze(Object.defineProperty({__proto__:null,scaleBand:ef,scaleDiverging:function e(){var t=Hd(Ty()(_d));return t.copy=function(){return ky(t,e())},Zs.apply(t,arguments)},scaleDivergingLog:function e(){var t=eh(Ty()).domain([.1,1,10]);return t.copy=function(){return ky(t,e()).base(t.base())},Zs.apply(t,arguments)},scaleDivergingPow:Iy,scaleDivergingSqrt:function(){return Iy.apply(null,arguments).exponent(.5)},scaleDivergingSymlog:function e(){var t=rh(Ty());return t.copy=function(){return ky(t,e()).constant(t.constant())},Zs.apply(t,arguments)},scaleIdentity:function e(t){var n;function r(e){return null==e||isNaN(e=+e)?n:e}return r.invert=r,r.domain=r.range=function(e){return arguments.length?(t=Array.from(e,xd),r):t.slice()},r.unknown=function(e){return arguments.length?(n=e,r):n},r.copy=function(){return e(t).unknown(n)},t=arguments.length?Array.from(t,xd):[0,1],Hd(r)},scaleImplicit:Qs,scaleLinear:Vd,scaleLog:function e(){const t=eh(Sd()).domain([1,10]);return t.copy=()=>jd(t,e()).base(t.base()),Gs.apply(t,arguments),t},scaleOrdinal:Js,scalePoint:function(){return tf(ef.apply(null,arguments).paddingInner(1))},scalePow:uh,scaleQuantile:function e(){var t,n=[],r=[],i=[];function a(){var e=0,t=Math.max(1,r.length);for(i=new Array(t-1);++e0?i[t-1]:n[0],tn(r/(t.length-1)))},r.quantiles=function(e){return Array.from({length:e+1},(n,r)=>Ys(t,r/e))},r.copy=function(){return e(n).domain(t)},Zs.apply(r,arguments)},scaleSequentialSqrt:function(){return Cy.apply(null,arguments).exponent(.5)},scaleSequentialSymlog:function e(){var t=rh(Sy());return t.copy=function(){return ky(t,e()).constant(t.constant())},Zs.apply(t,arguments)},scaleSqrt:function(){return uh.apply(null,arguments).exponent(.5)},scaleSymlog:ih,scaleThreshold:function e(){var t,n=[.5],r=[0,1],i=1;function a(e){return null!=e&&e<=e?r[Es(n,e,0,i)]:t}return a.domain=function(e){return arguments.length?(n=Array.from(e),i=Math.min(n.length,r.length-1),a):n.slice()},a.range=function(e){return arguments.length?(r=Array.from(e),i=Math.min(n.length,r.length-1),a):r.slice()},a.invertExtent=function(e){var t=r.indexOf(e);return[n[t-1],n[t]]},a.unknown=function(e){return arguments.length?(t=e,a):t},a.copy=function(){return e().domain(n).range(r).unknown(t)},Gs.apply(a,arguments)},scaleTime:jy,scaleUtc:function(){return Gs.apply(Ey(Zh,Qh,Xh,qh,Bh,Sh,Eh,Ph,Oh,op).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)},tickFormat:$d},Symbol.toStringTag,{value:"Module"}));var Ny=e=>e.chartData,zy=Ar([Ny],e=>{var t=null!=e.chartData?e.chartData.length-1:0;return{chartData:e.chartData,computedData:e.computedData,dataEndIndex:t,dataStartIndex:0}}),Ly=(e,t,n,r)=>r?zy(e):Ny(e);function Ry(e){if(Array.isArray(e)&&2===e.length){var[t,n]=e;if(mc(t)&&mc(n))return!0}return!1}function By(e,t,n){return n?e:[Math.min(e[0],t[0]),Math.max(e[1],t[1])]}function Ky(e,t){if(t&&"function"!=typeof e&&Array.isArray(e)&&2===e.length){var n,r,[i,a]=e;if(mc(i))n=i;else if("function"==typeof i)return;if(mc(a))r=a;else if("function"==typeof a)return;var o=[n,r];if(Ry(o))return o}}var Fy,Uy=1e9,Wy=!0,$y="[DecimalError] ",Hy=$y+"Invalid argument: ",Vy=$y+"Exponent out of range: ",qy=Math.floor,Yy=Math.pow,Xy=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Gy=1e7,Zy=qy(1286742750677284.5),Qy={};function Jy(e,t){var n,r,i,a,o,c,l,u,s=e.constructor,f=s.precision;if(!e.s||!t.s)return t.s||(t=new s(e)),Wy?uv(t,f):t;if(l=e.d,u=t.d,o=e.e,i=t.e,l=l.slice(),a=o-i){for(a<0?(r=l,a=-a,c=u.length):(r=u,i=o,c=l.length),a>(c=(o=Math.ceil(f/7))>c?o+1:c+1)&&(a=c,r.length=1),r.reverse();a--;)r.push(0);r.reverse()}for((c=l.length)-(a=u.length)<0&&(a=c,r=u,u=l,l=r),n=0;a;)n=(l[--a]=l[a]+u[a]+n)/Gy|0,l[a]%=Gy;for(n&&(l.unshift(n),++i),c=l.length;0==l[--c];)l.pop();return t.d=l,t.e=i,Wy?uv(t,f):t}function ev(e,t,n){if(e!==~~e||en)throw Error(Hy+e)}function tv(e){var t,n,r,i=e.length-1,a="",o=e[0];if(i>0){for(a+=o,t=1;te.e^a.s<0?1:-1;for(t=0,n=(r=a.d.length)<(i=e.d.length)?r:i;te.d[t]^a.s<0?1:-1;return r===i?0:r>i^a.s<0?1:-1},Qy.decimalPlaces=Qy.dp=function(){var e=this,t=e.d.length-1,n=7*(t-e.e);if(t=e.d[t])for(;t%10==0;t/=10)n--;return n<0?0:n},Qy.dividedBy=Qy.div=function(e){return nv(this,new this.constructor(e))},Qy.dividedToIntegerBy=Qy.idiv=function(e){var t=this.constructor;return uv(nv(this,new t(e),0,1),t.precision)},Qy.equals=Qy.eq=function(e){return!this.cmp(e)},Qy.exponent=function(){return iv(this)},Qy.greaterThan=Qy.gt=function(e){return this.cmp(e)>0},Qy.greaterThanOrEqualTo=Qy.gte=function(e){return this.cmp(e)>=0},Qy.isInteger=Qy.isint=function(){return this.e>this.d.length-2},Qy.isNegative=Qy.isneg=function(){return this.s<0},Qy.isPositive=Qy.ispos=function(){return this.s>0},Qy.isZero=function(){return 0===this.s},Qy.lessThan=Qy.lt=function(e){return this.cmp(e)<0},Qy.lessThanOrEqualTo=Qy.lte=function(e){return this.cmp(e)<1},Qy.logarithm=Qy.log=function(e){var t,n=this,r=n.constructor,i=r.precision,a=i+5;if(void 0===e)e=new r(10);else if((e=new r(e)).s<1||e.eq(Fy))throw Error($y+"NaN");if(n.s<1)throw Error($y+(n.s?"NaN":"-Infinity"));return n.eq(Fy)?new r(0):(Wy=!1,t=nv(cv(n,a),cv(e,a),a),Wy=!0,uv(t,i))},Qy.minus=Qy.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?sv(t,e):Jy(t,(e.s=-e.s,e))},Qy.modulo=Qy.mod=function(e){var t,n=this,r=n.constructor,i=r.precision;if(!(e=new r(e)).s)throw Error($y+"NaN");return n.s?(Wy=!1,t=nv(n,e,0,1).times(e),Wy=!0,n.minus(t)):uv(new r(n),i)},Qy.naturalExponential=Qy.exp=function(){return rv(this)},Qy.naturalLogarithm=Qy.ln=function(){return cv(this)},Qy.negated=Qy.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e},Qy.plus=Qy.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?Jy(t,e):sv(t,(e.s=-e.s,e))},Qy.precision=Qy.sd=function(e){var t,n,r,i=this;if(void 0!==e&&e!==!!e&&1!==e&&0!==e)throw Error(Hy+e);if(t=iv(i)+1,n=7*(r=i.d.length-1)+1,r=i.d[r]){for(;r%10==0;r/=10)n--;for(r=i.d[0];r>=10;r/=10)n++}return e&&t>n?t:n},Qy.squareRoot=Qy.sqrt=function(){var e,t,n,r,i,a,o,c=this,l=c.constructor;if(c.s<1){if(!c.s)return new l(0);throw Error($y+"NaN")}for(e=iv(c),Wy=!1,0==(i=Math.sqrt(+c))||i==1/0?(((t=tv(c.d)).length+e)%2==0&&(t+="0"),i=Math.sqrt(t),e=qy((e+1)/2)-(e<0||e%2),r=new l(t=i==1/0?"5e"+e:(t=i.toExponential()).slice(0,t.indexOf("e")+1)+e)):r=new l(i.toString()),i=o=(n=l.precision)+3;;)if(r=(a=r).plus(nv(c,a,o+2)).times(.5),tv(a.d).slice(0,o)===(t=tv(r.d)).slice(0,o)){if(t=t.slice(o-3,o+1),i==o&&"4999"==t){if(uv(a,n+1,0),a.times(a).eq(c)){r=a;break}}else if("9999"!=t)break;o+=4}return Wy=!0,uv(r,n)},Qy.times=Qy.mul=function(e){var t,n,r,i,a,o,c,l,u,s=this,f=s.constructor,d=s.d,h=(e=new f(e)).d;if(!s.s||!e.s)return new f(0);for(e.s*=s.s,n=s.e+e.e,(l=d.length)<(u=h.length)&&(a=d,d=h,h=a,o=l,l=u,u=o),a=[],r=o=l+u;r--;)a.push(0);for(r=u;--r>=0;){for(t=0,i=l+r;i>r;)c=a[i]+h[r]*d[i-r-1]+t,a[i--]=c%Gy|0,t=c/Gy|0;a[i]=(a[i]+t)%Gy|0}for(;!a[--o];)a.pop();return t?++n:a.shift(),e.d=a,e.e=n,Wy?uv(e,f.precision):e},Qy.toDecimalPlaces=Qy.todp=function(e,t){var n=this,r=n.constructor;return n=new r(n),void 0===e?n:(ev(e,0,Uy),void 0===t?t=r.rounding:ev(t,0,8),uv(n,e+iv(n)+1,t))},Qy.toExponential=function(e,t){var n,r=this,i=r.constructor;return void 0===e?n=fv(r,!0):(ev(e,0,Uy),void 0===t?t=i.rounding:ev(t,0,8),n=fv(r=uv(new i(r),e+1,t),!0,e+1)),n},Qy.toFixed=function(e,t){var n,r,i=this,a=i.constructor;return void 0===e?fv(i):(ev(e,0,Uy),void 0===t?t=a.rounding:ev(t,0,8),n=fv((r=uv(new a(i),e+iv(i)+1,t)).abs(),!1,e+iv(r)+1),i.isneg()&&!i.isZero()?"-"+n:n)},Qy.toInteger=Qy.toint=function(){var e=this,t=e.constructor;return uv(new t(e),iv(e)+1,t.rounding)},Qy.toNumber=function(){return+this},Qy.toPower=Qy.pow=function(e){var t,n,r,i,a,o,c=this,l=c.constructor,u=+(e=new l(e));if(!e.s)return new l(Fy);if(!(c=new l(c)).s){if(e.s<1)throw Error($y+"Infinity");return c}if(c.eq(Fy))return c;if(r=l.precision,e.eq(Fy))return uv(c,r);if(o=(t=e.e)>=(n=e.d.length-1),a=c.s,o){if((n=u<0?-u:u)<=9007199254740991){for(i=new l(Fy),t=Math.ceil(r/7+4),Wy=!1;n%2&&dv((i=i.times(c)).d,t),0!==(n=qy(n/2));)dv((c=c.times(c)).d,t);return Wy=!0,e.s<0?new l(Fy).div(i):uv(i,r)}}else if(a<0)throw Error($y+"NaN");return a=a<0&&1&e.d[Math.max(t,n)]?-1:1,c.s=1,Wy=!1,i=e.times(cv(c,r+12)),Wy=!0,(i=rv(i)).s=a,i},Qy.toPrecision=function(e,t){var n,r,i=this,a=i.constructor;return void 0===e?r=fv(i,(n=iv(i))<=a.toExpNeg||n>=a.toExpPos):(ev(e,1,Uy),void 0===t?t=a.rounding:ev(t,0,8),r=fv(i=uv(new a(i),e,t),e<=(n=iv(i))||n<=a.toExpNeg,e)),r},Qy.toSignificantDigits=Qy.tosd=function(e,t){var n=this.constructor;return void 0===e?(e=n.precision,t=n.rounding):(ev(e,1,Uy),void 0===t?t=n.rounding:ev(t,0,8)),uv(new n(this),e,t)},Qy.toString=Qy.valueOf=Qy.val=Qy.toJSON=Qy[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=iv(e),n=e.constructor;return fv(e,t<=n.toExpNeg||t>=n.toExpPos)};var nv=function(){function e(e,t){var n,r=0,i=e.length;for(e=e.slice();i--;)n=e[i]*t+r,e[i]=n%Gy|0,r=n/Gy|0;return r&&e.unshift(r),e}function t(e,t,n,r){var i,a;if(n!=r)a=n>r?1:-1;else for(i=a=0;it[i]?1:-1;break}return a}function n(e,t,n){for(var r=0;n--;)e[n]-=r,r=e[n]1;)e.shift()}return function(r,i,a,o){var c,l,u,s,f,d,h,p,y,v,g,m,b,w,x,O,_,P,A=r.constructor,E=r.s==i.s?1:-1,j=r.d,S=i.d;if(!r.s)return new A(r);if(!i.s)throw Error($y+"Division by zero");for(l=r.e-i.e,_=S.length,x=j.length,p=(h=new A(E)).d=[],u=0;S[u]==(j[u]||0);)++u;if(S[u]>(j[u]||0)&&--l,(m=null==a?a=A.precision:o?a+(iv(r)-iv(i))+1:a)<0)return new A(0);if(m=m/7+2|0,u=0,1==_)for(s=0,S=S[0],m++;(u1&&(S=e(S,s),j=e(j,s),_=S.length,x=j.length),w=_,v=(y=j.slice(0,_)).length;v<_;)y[v++]=0;(P=S.slice()).unshift(0),O=S[0],S[1]>=Gy/2&&++O;do{s=0,(c=t(S,y,_,v))<0?(g=y[0],_!=v&&(g=g*Gy+(y[1]||0)),(s=g/O|0)>1?(s>=Gy&&(s=Gy-1),1==(c=t(f=e(S,s),y,d=f.length,v=y.length))&&(s--,n(f,_16)throw Error(Vy+iv(e));if(!e.s)return new u(Fy);for(Wy=!1,o=s,a=new u(.03125);e.abs().gte(.1);)e=e.times(a),l+=5;for(o+=Math.log(Yy(2,l))/Math.LN10*2+5|0,n=r=i=new u(Fy),u.precision=o;;){if(r=uv(r.times(e),o),n=n.times(++c),tv((a=i.plus(nv(r,n,o))).d).slice(0,o)===tv(i.d).slice(0,o)){for(;l--;)i=uv(i.times(i),o);return u.precision=s,null==t?(Wy=!0,uv(i,s)):i}i=a}}function iv(e){for(var t=7*e.e,n=e.d[0];n>=10;n/=10)t++;return t}function av(e,t,n){if(t>e.LN10.sd())throw Wy=!0,n&&(e.precision=n),Error($y+"LN10 precision limit exceeded");return uv(new e(e.LN10),t)}function ov(e){for(var t="";e--;)t+="0";return t}function cv(e,t){var n,r,i,a,o,c,l,u,s,f=1,d=e,h=d.d,p=d.constructor,y=p.precision;if(d.s<1)throw Error($y+(d.s?"NaN":"-Infinity"));if(d.eq(Fy))return new p(0);if(null==t?(Wy=!1,u=y):u=t,d.eq(10))return null==t&&(Wy=!0),av(p,u);if(u+=10,p.precision=u,r=(n=tv(h)).charAt(0),a=iv(d),!(Math.abs(a)<15e14))return l=av(p,u+2,y).times(a+""),d=cv(new p(r+"."+n.slice(1)),u-10).plus(l),p.precision=y,null==t?(Wy=!0,uv(d,y)):d;for(;r<7&&1!=r||1==r&&n.charAt(1)>3;)r=(n=tv((d=d.times(e)).d)).charAt(0),f++;for(a=iv(d),r>1?(d=new p("0."+n),a++):d=new p(r+"."+n.slice(1)),c=o=d=nv(d.minus(Fy),d.plus(Fy),u),s=uv(d.times(d),u),i=3;;){if(o=uv(o.times(s),u),tv((l=c.plus(nv(o,new p(i),u))).d).slice(0,u)===tv(c.d).slice(0,u))return c=c.times(2),0!==a&&(c=c.plus(av(p,u+2,y).times(a+""))),c=nv(c,new p(f),u),p.precision=y,null==t?(Wy=!0,uv(c,y)):c;c=l,i+=2}}function lv(e,t){var n,r,i;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;48===t.charCodeAt(r);)++r;for(i=t.length;48===t.charCodeAt(i-1);)--i;if(t=t.slice(r,i)){if(i-=r,n=n-r-1,e.e=qy(n/7),e.d=[],r=(n+1)%7,n<0&&(r+=7),rZy||e.e<-Zy))throw Error(Vy+n)}else e.s=0,e.e=0,e.d=[0];return e}function uv(e,t,n){var r,i,a,o,c,l,u,s,f=e.d;for(o=1,a=f[0];a>=10;a/=10)o++;if((r=t-o)<0)r+=7,i=t,u=f[s=0];else{if((s=Math.ceil((r+1)/7))>=(a=f.length))return e;for(u=a=f[s],o=1;a>=10;a/=10)o++;i=(r%=7)-7+o}if(void 0!==n&&(c=u/(a=Yy(10,o-i-1))%10|0,l=t<0||void 0!==f[s+1]||u%a,l=n<4?(c||l)&&(0==n||n==(e.s<0?3:2)):c>5||5==c&&(4==n||l||6==n&&(r>0?i>0?u/Yy(10,o-i):0:f[s-1])%10&1||n==(e.s<0?8:7))),t<1||!f[0])return l?(a=iv(e),f.length=1,t=t-a-1,f[0]=Yy(10,(7-t%7)%7),e.e=qy(-t/7)||0):(f.length=1,f[0]=e.e=e.s=0),e;if(0==r?(f.length=s,a=1,s--):(f.length=s+1,a=Yy(10,7-r),f[s]=i>0?(u/Yy(10,o-i)%Yy(10,i)|0)*a:0),l)for(;;){if(0==s){(f[0]+=a)==Gy&&(f[0]=1,++e.e);break}if(f[s]+=a,f[s]!=Gy)break;f[s--]=0,a=1}for(r=f.length;0===f[--r];)f.pop();if(Wy&&(e.e>Zy||e.e<-Zy))throw Error(Vy+iv(e));return e}function sv(e,t){var n,r,i,a,o,c,l,u,s,f,d=e.constructor,h=d.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new d(e),Wy?uv(t,h):t;if(l=e.d,f=t.d,r=t.e,u=e.e,l=l.slice(),o=u-r){for((s=o<0)?(n=l,o=-o,c=f.length):(n=f,r=u,c=l.length),o>(i=Math.max(Math.ceil(h/7),c)+2)&&(o=i,n.length=1),n.reverse(),i=o;i--;)n.push(0);n.reverse()}else{for((s=(i=l.length)<(c=f.length))&&(c=i),i=0;i0;--i)l[c++]=0;for(i=f.length;i>o;){if(l[--i]0?a=a.charAt(0)+"."+a.slice(1)+ov(r):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(i<0?"e":"e+")+i):i<0?(a="0."+ov(-i-1)+a,n&&(r=n-o)>0&&(a+=ov(r))):i>=o?(a+=ov(i+1-o),n&&(r=n-i-1)>0&&(a=a+"."+ov(r))):((r=i+1)0&&(i+1===o&&(a+="."),a+=ov(r))),e.s<0?"-"+a:a}function dv(e,t){if(e.length>t)return e.length=t,!0}function hv(e){if(!e||"object"!=typeof e)throw Error($y+"Object expected");var t,n,r,i=["precision",1,Uy,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(t=0;t=i[t+1]&&r<=i[t+2]))throw Error(Hy+n+": "+r);this[n]=r}if(void 0!==(r=e[n="LN10"])){if(r!=Math.LN10)throw Error(Hy+n+": "+r);this[n]=new this(r)}return this}var pv=function e(t){var n,r,i;function a(e){var t=this;if(!(t instanceof a))return new a(e);if(t.constructor=a,e instanceof a)return t.s=e.s,t.e=e.e,void(t.d=(e=e.d)?e.slice():e);if("number"==typeof e){if(0*e!=0)throw Error(Hy+e);if(e>0)t.s=1;else{if(!(e<0))return t.s=0,t.e=0,void(t.d=[0]);e=-e,t.s=-1}return e===~~e&&e<1e7?(t.e=0,void(t.d=[e])):lv(t,e.toString())}if("string"!=typeof e)throw Error(Hy+e);if(45===e.charCodeAt(0)?(e=e.slice(1),t.s=-1):t.s=1,!Xy.test(e))throw Error(Hy+e);lv(t,e)}if(a.prototype=Qy,a.ROUND_UP=0,a.ROUND_DOWN=1,a.ROUND_CEIL=2,a.ROUND_FLOOR=3,a.ROUND_HALF_UP=4,a.ROUND_HALF_DOWN=5,a.ROUND_HALF_EVEN=6,a.ROUND_HALF_CEIL=7,a.ROUND_HALF_FLOOR=8,a.clone=e,a.config=a.set=hv,void 0===t&&(t={}),t)for(i=["precision","rounding","toExpNeg","toExpPos","LN10"],n=0;ne,mv={},bv=e=>e===mv,wv=e=>function t(){return 0===arguments.length||1===arguments.length&&bv(arguments.length<=0?void 0:arguments[0])?t:e(...arguments)},xv=(e,t)=>1===e?t:wv(function(){for(var n=arguments.length,r=new Array(n),i=0;ie!==mv).length;return a>=e?t(...r):xv(e-a,wv(function(){for(var e=arguments.length,n=new Array(e),i=0;ibv(e)?n.shift():e);return t(...a,...n)}))}),Ov=(e,t)=>{for(var n=[],r=e;rArray.isArray(t)?t.map(e):Object.keys(t).map(e=>t[e]).map(e)).length,vv),Pv=e=>Array.isArray(e)?e.reverse():e.split("").reverse().join("");function Av(e){return 0===e?1:Math.floor(new yv(e).abs().log(10).toNumber())+1}function Ev(e,t,n){for(var r=new yv(e),i=0,a=[];r.lt(t)&&i<1e5;)a.push(r.toNumber()),r=r.add(n),i++;return a}var jv=e=>{var[t,n]=e,[r,i]=[t,n];return t>n&&([r,i]=[n,t]),[r,i]},Sv=(e,t,n)=>{if(e.lte(0))return new yv(0);var r=Av(e.toNumber()),i=new yv(10).pow(r),a=e.div(i),o=1!==r?.05:.1,c=new yv(Math.ceil(a.div(o).toNumber())).add(n).mul(o).mul(i);return new yv(t?c.toNumber():Math.ceil(c.toNumber()))},kv=function(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!Number.isFinite((t-e)/(n-1)))return{step:new yv(0),tickMin:new yv(0),tickMax:new yv(0)};var a,o=Sv(new yv(t).sub(e).div(n-1),r,i);a=e<=0&&t>=0?new yv(0):(a=new yv(e).add(t).div(2)).sub(new yv(a).mod(o));var c=Math.ceil(a.sub(e).div(o).toNumber()),l=Math.ceil(new yv(t).sub(a).div(o).toNumber()),u=c+l+1;return u>n?kv(e,t,n,r,i+1):(u0?l+(n-u):l,c=t>0?c:c+(n-u)),{step:o,tickMin:a.sub(new yv(c).mul(o)),tickMax:a.add(new yv(l).mul(o))})},Mv=e=>e.rootProps.stackOffset,Cv=e=>e.rootProps.reverseStackOrder,Tv=e=>e.options.chartName,Iv=e=>e.rootProps.syncId,Dv=e=>e.rootProps.syncMethod,Nv=e=>e.options.eventEmitter,zv={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},Lv="auto",Rv=!0,Bv=!1,Kv=!0,Fv="auto",Uv=!0,Wv=(e,t)=>{if(e&&t)return null!=e&&e.reversed?[t[1],t[0]]:t},$v={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!1,dataKey:void 0,domain:void 0,id:0,includeHidden:!1,name:void 0,reversed:!1,scale:Lv,tick:Rv,tickCount:void 0,ticks:void 0,type:"category",unit:void 0},Hv={allowDataOverflow:Bv,allowDecimals:!1,allowDuplicatedCategory:Kv,dataKey:void 0,domain:void 0,id:0,includeHidden:!1,name:void 0,reversed:!1,scale:Fv,tick:Uv,tickCount:5,ticks:void 0,type:"number",unit:void 0},Vv={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!0,dataKey:void 0,domain:void 0,id:0,includeHidden:!1,name:void 0,reversed:!1,scale:Lv,tick:Rv,tickCount:void 0,ticks:void 0,type:"number",unit:void 0},qv={allowDataOverflow:Bv,allowDecimals:!1,allowDuplicatedCategory:Kv,dataKey:void 0,domain:void 0,id:0,includeHidden:!1,name:void 0,reversed:!1,scale:Fv,tick:Uv,tickCount:5,ticks:void 0,type:"category",unit:void 0},Yv=(e,t)=>null!=e.polarAxis.angleAxis[t]?e.polarAxis.angleAxis[t]:"radial"===e.layout.layoutType?Vv:$v,Xv=(e,t)=>null!=e.polarAxis.radiusAxis[t]?e.polarAxis.radiusAxis[t]:"radial"===e.layout.layoutType?qv:Hv,Gv=e=>e.polarOptions,Zv=Ar([zo,Lo,Zo],function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(e-(n.left||0)-(n.right||0)),Math.abs(t-(n.top||0)-(n.bottom||0)))/2}),Qv=Ar([Gv,Zv],(e,t)=>{if(null!=e)return at(e.innerRadius,t,0)}),Jv=Ar([Gv,Zv],(e,t)=>{if(null!=e)return at(e.outerRadius,t,.8*t)}),eg=Ar([Gv],e=>{if(null==e)return[0,0];var{startAngle:t,endAngle:n}=e;return[t,n]});Ar([Yv,eg],Wv);var tg=Ar([Zv,Qv,Jv],(e,t,n)=>{if(null!=e&&null!=t&&null!=n)return[t,n]});Ar([Xv,tg],Wv);var ng=Ar([Nc,Gv,Qv,Jv,zo,Lo],(e,t,n,r,i,a)=>{if(("centric"===e||"radial"===e)&&null!=t&&null!=n&&null!=r){var{cx:o,cy:c,startAngle:l,endAngle:u}=t;return{cx:at(o,i,i/2),cy:at(c,a,a/2),innerRadius:n,outerRadius:r,startAngle:l,endAngle:u,clockWise:!1}}}),rg=(e,t)=>t,ig=(e,t,n)=>n;function ag(e){return null==e?void 0:e.id}function og(e,t,n){var{chartData:r=[]}=t,{allowDuplicatedCategory:i,dataKey:a}=n,o=new Map;return e.forEach(e=>{var t,n=null!==(t=e.data)&&void 0!==t?t:r;if(null!=n&&0!==n.length){var c=ag(e);n.forEach((t,n)=>{var r,l=null==a||i?n:String(_o(t,a,null)),u=_o(t,e.dataKey,0);r=o.has(l)?o.get(l):{},Object.assign(r,{[c]:u}),o.set(l,r)})}}),Array.from(o.values())}function cg(e){return null!=e.stackId&&null!=e.dataKey}var lg=(e,t)=>e===t||null!=e&&null!=t&&e[0]===t[0]&&e[1]===t[1];function ug(e,t){return!(!Array.isArray(e)||!Array.isArray(t)||0!==e.length||0!==t.length)||e===t}var sg=e=>{var t=Nc(e);return"horizontal"===t?"xAxis":"vertical"===t?"yAxis":"centric"===t?"angleAxis":"radiusAxis"},fg=e=>e.tooltip.settings.axisId;function dg(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function hg(e){for(var t=1;te.cartesianAxis.xAxis[t],mg=(e,t)=>{var n=gg(e,t);return null==n?vg:n},bg={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:yg,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"left",padding:{top:0,bottom:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"number",unit:void 0,width:60},wg=(e,t)=>e.cartesianAxis.yAxis[t],xg=(e,t)=>{var n=wg(e,t);return null==n?bg:n},Og={domain:[0,"auto"],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:"",range:[64,64],scale:"auto",type:"number",unit:""},_g=(e,t)=>{var n=e.cartesianAxis.zAxis[t];return null==n?Og:n},Pg=(e,t,n)=>{switch(t){case"xAxis":return mg(e,n);case"yAxis":return xg(e,n);case"zAxis":return _g(e,n);case"angleAxis":return Yv(e,n);case"radiusAxis":return Xv(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},Ag=(e,t,n)=>{switch(t){case"xAxis":return mg(e,n);case"yAxis":return xg(e,n);case"angleAxis":return Yv(e,n);case"radiusAxis":return Xv(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},Eg=e=>e.graphicalItems.cartesianItems.some(e=>"bar"===e.type)||e.graphicalItems.polarItems.some(e=>"radialBar"===e.type);function jg(e,t){return n=>{switch(e){case"xAxis":return"xAxisId"in n&&n.xAxisId===t;case"yAxis":return"yAxisId"in n&&n.yAxisId===t;case"zAxis":return"zAxisId"in n&&n.zAxisId===t;case"angleAxis":return"angleAxisId"in n&&n.angleAxisId===t;case"radiusAxis":return"radiusAxisId"in n&&n.radiusAxisId===t;default:return!1}}}var Sg=e=>e.graphicalItems.cartesianItems,kg=Ar([rg,ig],jg),Mg=(e,t,n)=>e.filter(n).filter(e=>!0===(null==t?void 0:t.includeHidden)||!e.hide),Cg=Ar([Sg,Pg,kg],Mg,{memoizeOptions:{resultEqualityCheck:ug}}),Tg=Ar([Cg],e=>e.filter(e=>"area"===e.type||"bar"===e.type).filter(cg)),Ig=e=>e.filter(e=>!("stackId"in e)||void 0===e.stackId),Dg=Ar([Cg],Ig),Ng=e=>e.map(e=>e.data).filter(Boolean).flat(1),zg=Ar([Cg],Ng,{memoizeOptions:{resultEqualityCheck:ug}}),Lg=(e,t)=>{var{chartData:n=[],dataStartIndex:r,dataEndIndex:i}=t;return e.length>0?e:n.slice(r,i+1)},Rg=Ar([zg,Ly],Lg),Bg=(e,t,n)=>null!=(null==t?void 0:t.dataKey)?e.map(e=>({value:_o(e,t.dataKey)})):n.length>0?n.map(e=>e.dataKey).flatMap(t=>e.map(e=>({value:_o(e,t)}))):e.map(e=>({value:e})),Kg=Ar([Rg,Pg,Cg],Bg);function Fg(e,t){switch(e){case"xAxis":return"x"===t.direction;case"yAxis":return"y"===t.direction;default:return!1}}function Ug(e){if(nt(e)||e instanceof Date){var t=Number(e);if(mc(t))return t}}function Wg(e){if(Array.isArray(e)){var t=[Ug(e[0]),Ug(e[1])];return Ry(t)?t:void 0}var n=Ug(e);if(null!=n)return[n,n]}function $g(e){return e.map(Ug).filter(ft)}var Hg=e=>{var t=sg(e),n=fg(e);return Ag(e,t,n)},Vg=Ar([Hg],e=>null==e?void 0:e.dataKey),qg=Ar([Tg,Ly,Hg],og),Yg=(e,t,n,r)=>{var i=t.reduce((e,t)=>(null==t.stackId||(null==e[t.stackId]&&(e[t.stackId]=[]),e[t.stackId].push(t)),e),{});return Object.fromEntries(Object.entries(i).map(t=>{var[i,a]=t,o=r?[...a].reverse():a,c=o.map(ag);return[i,{stackedData:ko(e,c,n),graphicalItems:o}]}))},Xg=Ar([qg,Tg,Mv,Cv],Yg),Gg=(e,t,n,r)=>{var{dataStartIndex:i,dataEndIndex:a}=t;if(null==r&&"zAxis"!==n){var o=((e,t,n)=>{var r;if(null!=e)return[(r=Object.keys(e).reduce((r,i)=>{var a=e[i],{stackedData:o}=a,c=o.reduce((e,r)=>{var i,a=(i=bo(r,t,n).flat(2).filter(tt),[Math.min(...i),Math.max(...i)]);return[Math.min(e[0],a[0]),Math.max(e[1],a[1])]},[1/0,-1/0]);return[Math.min(c[0],r[0]),Math.max(c[1],r[1])]},[1/0,-1/0]))[0]===1/0?0:r[0],r[1]===-1/0?0:r[1]]})(e,i,a);if(null==o||0!==o[0]||0!==o[1])return o}},Zg=Ar([Pg],e=>e.allowDataOverflow),Qg=e=>{var t;if(null==e||!("domain"in e))return yg;if(null!=e.domain)return e.domain;if(null!=e.ticks){if("number"===e.type){var n=$g(e.ticks);return[Math.min(...n),Math.max(...n)]}if("category"===e.type)return e.ticks.map(String)}return null!==(t=null==e?void 0:e.domain)&&void 0!==t?t:yg},Jg=Ar([Pg],Qg),em=Ar([Jg,Zg],Ky),tm=Ar([Xg,Ny,rg,em],Gg,{memoizeOptions:{resultEqualityCheck:lg}}),nm=e=>e.errorBars,rm=function(){for(var e=arguments.length,t=new Array(e),n=0;n{var a,o;if(n.length>0&&e.forEach(e=>{n.forEach(n=>{var c,l,u=null===(c=r[n.id])||void 0===c?void 0:c.filter(e=>Fg(i,e)),s=_o(e,null!==(l=t.dataKey)&&void 0!==l?l:n.dataKey),f=function(e,t,n){return!n||"number"!=typeof t||Je(t)?[]:n.length?$g(n.flatMap(n=>{var r,i,a=_o(e,n.dataKey);if(Array.isArray(a)?[r,i]=a:r=i=a,mc(r)&&mc(i))return[t-r,t+i]})):[]}(e,s,u);if(f.length>=2){var d=Math.min(...f),h=Math.max(...f);(null==a||do)&&(o=h)}var p=Wg(s);null!=p&&(a=null==a?p[0]:Math.min(a,p[0]),o=null==o?p[1]:Math.max(o,p[1]))})}),null!=(null==t?void 0:t.dataKey)&&e.forEach(e=>{var n=Wg(_o(e,t.dataKey));null!=n&&(a=null==a?n[0]:Math.min(a,n[0]),o=null==o?n[1]:Math.max(o,n[1]))}),mc(a)&&mc(o))return[a,o]},am=Ar([Rg,Pg,Dg,nm,rg],im,{memoizeOptions:{resultEqualityCheck:lg}});function om(e){var{value:t}=e;if(nt(t)||t instanceof Date)return t}var cm=e=>e.referenceElements.dots,lm=(e,t,n)=>e.filter(e=>"extendDomain"===e.ifOverflow).filter(e=>"xAxis"===t?e.xAxisId===n:e.yAxisId===n),um=Ar([cm,rg,ig],lm),sm=e=>e.referenceElements.areas,fm=Ar([sm,rg,ig],lm),dm=e=>e.referenceElements.lines,hm=Ar([dm,rg,ig],lm),pm=(e,t)=>{var n=$g(e.map(e=>"xAxis"===t?e.x:e.y));if(0!==n.length)return[Math.min(...n),Math.max(...n)]},ym=Ar(um,rg,pm),vm=(e,t)=>{var n=$g(e.flatMap(e=>["xAxis"===t?e.x1:e.y1,"xAxis"===t?e.x2:e.y2]));if(0!==n.length)return[Math.min(...n),Math.max(...n)]},gm=Ar([fm,rg],vm),mm=(e,t)=>{var n=e.flatMap(e=>"xAxis"===t?function(e){var t;if(null!=e.x)return $g([e.x]);var n=null===(t=e.segment)||void 0===t?void 0:t.map(e=>e.x);return null==n||0===n.length?[]:$g(n)}(e):function(e){var t;if(null!=e.y)return $g([e.y]);var n=null===(t=e.segment)||void 0===t?void 0:t.map(e=>e.y);return null==n||0===n.length?[]:$g(n)}(e));if(0!==n.length)return[Math.min(...n),Math.max(...n)]},bm=Ar([hm,rg],mm),wm=Ar(ym,bm,gm,(e,t,n)=>rm(e,n,t)),xm=(e,t,n,r,i,a,o,c)=>null!=n?n:function(e,t,n){if(n||null!=t){if("function"==typeof e&&null!=t)try{var r=e(t,n);if(Ry(r))return By(r,t,n)}catch(h){}if(Array.isArray(e)&&2===e.length){var i,a,[o,c]=e;if("auto"===o)null!=t&&(i=Math.min(...t));else if(tt(o))i=o;else if("function"==typeof o)try{null!=t&&(i=o(null==t?void 0:t[0]))}catch(p){}else if("string"==typeof o&&Co.test(o)){var l=Co.exec(o);if(null==l||null==t)i=void 0;else{var u=+l[1];i=t[0]-u}}else i=null==t?void 0:t[0];if("auto"===c)null!=t&&(a=Math.max(...t));else if(tt(c))a=c;else if("function"==typeof c)try{null!=t&&(a=c(null==t?void 0:t[1]))}catch(y){}else if("string"==typeof c&&To.test(c)){var s=To.exec(c);if(null==s||null==t)a=void 0;else{var f=+s[1];a=t[1]+f}}else a=null==t?void 0:t[1];var d=[i,a];if(Ry(d))return null==t?d:By(d,t,n)}}}(t,"vertical"===o&&"xAxis"===c||"horizontal"===o&&"yAxis"===c?rm(r,a,i):rm(a,i),e.allowDataOverflow),Om=Ar([Pg,Jg,em,tm,am,wm,Nc,rg],xm,{memoizeOptions:{resultEqualityCheck:lg}}),_m=[0,1],Pm=(e,t,n,r,i,a,o)=>{if(null!=e&&null!=n&&0!==n.length||void 0!==o){var c,{dataKey:l,type:u}=e,s=Po(t,a);return s&&null==l?ws(0,null!==(c=null==n?void 0:n.length)&&void 0!==c?c:0):"category"===u?((e,t,n)=>{var r=e.map(om).filter(e=>null!=e);return n&&(null==t.dataKey||t.allowDuplicatedCategory&&ot(r))?ws(0,e.length):t.allowDuplicatedCategory?r:Array.from(new Set(r))})(r,e,s):"expand"===i?_m:o}},Am=Ar([Pg,Nc,Rg,Kg,Mv,rg,Om],Pm),Em=(e,t,n,r,i)=>{if(null!=e){var{scale:a,type:o}=e;if("auto"===a)return"radial"===t&&"radiusAxis"===i?"band":"radial"===t&&"angleAxis"===i?"linear":"category"===o&&r&&(r.indexOf("LineChart")>=0||r.indexOf("AreaChart")>=0||r.indexOf("ComposedChart")>=0&&!n)?"point":"category"===o?"band":"linear";if("string"==typeof a){var c="scale".concat(st(a));return c in Dy?c:"point"}}},jm=Ar([Pg,Nc,Eg,Tv,rg],Em);function Sm(e,t,n,r){if(null!=n&&null!=r){if("function"==typeof e.scale)return e.scale.copy().domain(n).range(r);var i=function(e){if(null!=e){if(e in Dy)return Dy[e]();var t="scale".concat(st(e));return t in Dy?Dy[t]():void 0}}(t);if(null!=i){var a=i.domain(n).range(r);return(e=>{var t=e.domain();if(t&&!(t.length<=2)){var n=t.length,r=e.range(),i=Math.min(r[0],r[1])-jo,a=Math.max(r[0],r[1])+jo,o=e(t[0]),c=e(t[n-1]);(oa||ca)&&e.domain([t[0],t[n-1]])}})(a),a}}}var km=(e,t,n)=>{var r=Qg(t);if("auto"===n||"linear"===n)return null!=t&&t.tickCount&&Array.isArray(r)&&("auto"===r[0]||"auto"===r[1])&&Ry(e)?function(e){var[t,n]=e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6,i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=Math.max(r,2),[o,c]=jv([t,n]);if(o===-1/0||c===1/0){var l=c===1/0?[o,...Ov(0,r-1).map(()=>1/0)]:[...Ov(0,r-1).map(()=>-1/0),c];return t>n?Pv(l):l}if(o===c)return((e,t,n)=>{var r=new yv(1),i=new yv(e);if(!i.isint()&&n){var a=Math.abs(e);a<1?(r=new yv(10).pow(Av(e)-1),i=new yv(Math.floor(i.div(r).toNumber())).mul(r)):a>1&&(i=new yv(Math.floor(e)))}else 0===e?i=new yv(Math.floor((t-1)/2)):n||(i=new yv(Math.floor(e)));var o=Math.floor((t-1)/2);return function(){for(var e=arguments.length,t=new Array(e),n=0;nt(e),i(...arguments))}}(_v(e=>i.add(new yv(e-o).mul(r)).toNumber()),Ov)(0,t)})(o,r,i);var{step:u,tickMin:s,tickMax:f}=kv(o,c,a,i,0),d=Ev(s,f.add(new yv(.1).mul(u)),u);return t>n?Pv(d):d}(e,t.tickCount,t.allowDecimals):null!=t&&t.tickCount&&"number"===t.type&&Ry(e)?function(e,t){var[n,r]=e,i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],[a,o]=jv([n,r]);if(a===-1/0||o===1/0)return[n,r];if(a===o)return[a];var c=Math.max(t,2),l=Sv(new yv(o).sub(a).div(c-1),i,0),u=[...Ev(new yv(a),new yv(o),l),o];return!1===i&&(u=u.map(e=>Math.round(e))),n>r?Pv(u):u}(e,t.tickCount,t.allowDecimals):void 0},Mm=Ar([Am,Ag,jm],km),Cm=(e,t,n,r)=>{if("angleAxis"!==r&&"number"===(null==e?void 0:e.type)&&Ry(t)&&Array.isArray(n)&&n.length>0){var i=t[0],a=n[0],o=t[1],c=n[n.length-1];return[Math.min(i,a),Math.max(o,c)]}return t},Tm=Ar([Pg,Am,Mm,rg],Cm),Im=Ar(Kg,Pg,(e,t)=>{if(t&&"number"===t.type){var n=1/0,r=Array.from($g(e.map(e=>e.value))).sort((e,t)=>e-t);if(r.length<2)return 1/0;var i=r[r.length-1]-r[0];if(0===i)return 1/0;for(var a=0;ae.rootProps.barCategoryGap,Zo,(e,t,n,r)=>r,(e,t,n,r,i)=>{if(!mc(e))return 0;var a="vertical"===t?r.height:r.width;if("gap"===i)return e*a/2;if("no-gap"===i){var o=at(n,e*a),c=e*a/2;return c-o-(c-o)/a*o}return 0}),Nm=Ar(mg,(e,t)=>{var n=mg(e,t);return null==n||"string"!=typeof n.padding?0:Dm(e,"xAxis",t,n.padding)},(e,t)=>{var n,r;if(null==e)return{left:0,right:0};var{padding:i}=e;return"string"==typeof i?{left:t,right:t}:{left:(null!==(n=i.left)&&void 0!==n?n:0)+t,right:(null!==(r=i.right)&&void 0!==r?r:0)+t}}),zm=Ar(xg,(e,t)=>{var n=xg(e,t);return null==n||"string"!=typeof n.padding?0:Dm(e,"yAxis",t,n.padding)},(e,t)=>{var n,r;if(null==e)return{top:0,bottom:0};var{padding:i}=e;return"string"==typeof i?{top:t,bottom:t}:{top:(null!==(n=i.top)&&void 0!==n?n:0)+t,bottom:(null!==(r=i.bottom)&&void 0!==r?r:0)+t}}),Lm=Ar([Zo,Nm,rc,nc,(e,t,n)=>n],(e,t,n,r,i)=>{var{padding:a}=r;return i?[a.left,n.width-a.right]:[e.left+t.left,e.left+e.width-t.right]}),Rm=Ar([Zo,Nc,zm,rc,nc,(e,t,n)=>n],(e,t,n,r,i,a)=>{var{padding:o}=i;return a?[r.height-o.bottom,o.top]:"horizontal"===t?[e.top+e.height-n.bottom,e.top+n.top]:[e.top+n.top,e.top+e.height-n.bottom]}),Bm=(e,t,n,r)=>{var i;switch(t){case"xAxis":return Lm(e,n,r);case"yAxis":return Rm(e,n,r);case"zAxis":return null===(i=_g(e,n))||void 0===i?void 0:i.range;case"angleAxis":return eg(e);case"radiusAxis":return tg(e,n);default:return}},Km=Ar([Pg,Bm],Wv),Fm=Ar([Pg,jm,Tm,Km],Sm);function Um(e,t){return e.idt.id?1:0}Ar([Cg,nm,rg],(e,t,n)=>e.flatMap(e=>t[e.id]).filter(Boolean).filter(e=>Fg(n,e)));var Wm=(e,t)=>t,$m=(e,t,n)=>n,Hm=Ar(Ko,Wm,$m,(e,t,n)=>e.filter(e=>e.orientation===t).filter(e=>e.mirror===n).sort(Um)),Vm=Ar(Fo,Wm,$m,(e,t,n)=>e.filter(e=>e.orientation===t).filter(e=>e.mirror===n).sort(Um)),qm=(e,t)=>({width:e.width,height:t.height}),Ym=Ar(Zo,mg,qm),Xm=Ar(Lo,Zo,Hm,Wm,$m,(e,t,n,r,i)=>{var a,o={};return n.forEach(n=>{var c=qm(t,n);null==a&&(a=((e,t,n)=>{switch(t){case"top":return e.top;case"bottom":return n-e.bottom;default:return 0}})(t,r,e));var l="top"===r&&!i||"bottom"===r&&i;o[n.id]=a-Number(l)*c.height,a+=(l?-1:1)*c.height}),o}),Gm=Ar(zo,Zo,Vm,Wm,$m,(e,t,n,r,i)=>{var a,o={};return n.forEach(n=>{var c=((e,t)=>({width:"number"==typeof t.width?t.width:60,height:e.height}))(t,n);null==a&&(a=((e,t,n)=>{switch(t){case"left":return e.left;case"right":return n-e.right;default:return 0}})(t,r,e));var l="left"===r&&!i||"right"===r&&i;o[n.id]=a-Number(l)*c.width,a+=(l?-1:1)*c.width}),o}),Zm=Ar([Zo,mg,(e,t)=>{var n=mg(e,t);if(null!=n)return Xm(e,n.orientation,n.mirror)},(e,t)=>t],(e,t,n,r)=>{if(null!=t){var i=null==n?void 0:n[r];return null==i?{x:e.left,y:0}:{x:e.left,y:i}}}),Qm=Ar([Zo,xg,(e,t)=>{var n=xg(e,t);if(null!=n)return Gm(e,n.orientation,n.mirror)},(e,t)=>t],(e,t,n,r)=>{if(null!=t){var i=null==n?void 0:n[r];return null==i?{x:0,y:e.top}:{x:i,y:e.top}}}),Jm=Ar(Zo,xg,(e,t)=>({width:"number"==typeof t.width?t.width:60,height:e.height})),eb=(e,t,n,r)=>{if(null!=n){var{allowDuplicatedCategory:i,type:a,dataKey:o}=n,c=Po(e,r),l=t.map(e=>e.value);return o&&c&&"category"===a&&i&&ot(l)?l:void 0}},tb=Ar([Nc,Kg,Pg,rg],eb),nb=(e,t,n,r)=>{if(null!=n&&null!=n.dataKey){var{type:i,scale:a}=n;return!Po(e,r)||"number"!==i&&"auto"===a?void 0:t.map(e=>e.value)}},rb=Ar([Nc,Kg,Ag,rg],nb),ib=Ar([Nc,(e,t,n)=>{switch(t){case"xAxis":return mg(e,n);case"yAxis":return xg(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},jm,Fm,tb,rb,Bm,Mm,rg],(e,t,n,r,i,a,o,c,l)=>{if(null!=t){var u=Po(e,l);return{angle:t.angle,interval:t.interval,minTickGap:t.minTickGap,orientation:t.orientation,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,axisType:l,categoricalDomain:a,duplicateDomain:i,isCategorical:u,niceTicks:c,range:o,realScaleType:n,scale:r}}}),ab=Ar([Nc,Ag,jm,Fm,Mm,Bm,tb,rb,rg],(e,t,n,r,i,a,o,c,l)=>{if(null!=t&&null!=r){var u=Po(e,l),{type:s,ticks:f,tickCount:d}=t,h="scaleBand"===n&&"function"==typeof r.bandwidth?r.bandwidth()/2:2,p="category"===s&&r.bandwidth?r.bandwidth()/h:0;p="angleAxis"===l&&null!=a&&a.length>=2?2*Qe(a[0]-a[1])*p:p;var y=f||i;return y?y.map((e,t)=>{var n=o?o.indexOf(e):e;return{index:t,coordinate:r(n)+p,value:e,offset:p}}).filter(e=>mc(e.coordinate)):u&&c?c.map((e,t)=>({coordinate:r(e)+p,value:e,index:t,offset:p})).filter(e=>mc(e.coordinate)):r.ticks?r.ticks(d).map(e=>({coordinate:r(e)+p,value:e,offset:p})):r.domain().map((e,t)=>({coordinate:r(e)+p,value:o?o[e]:e,index:t,offset:p}))}}),ob=Ar([Nc,Ag,Fm,Bm,tb,rb,rg],(e,t,n,r,i,a,o)=>{if(null!=t&&null!=n&&null!=r&&r[0]!==r[1]){var c=Po(e,o),{tickCount:l}=t,u=0;return u="angleAxis"===o&&(null==r?void 0:r.length)>=2?2*Qe(r[0]-r[1])*u:u,c&&a?a.map((e,t)=>({coordinate:n(e)+u,value:e,index:t,offset:u})):n.ticks?n.ticks(l).map(e=>({coordinate:n(e)+u,value:e,offset:u})):n.domain().map((e,t)=>({coordinate:n(e)+u,value:i?i[e]:e,index:t,offset:u}))}}),cb=Ar(Pg,Fm,(e,t)=>{if(null!=e&&null!=t)return hg(hg({},e),{},{scale:t})}),lb=Ar([Pg,jm,Am,Km],Sm);Ar((e,t,n)=>_g(e,n),lb,(e,t)=>{if(null!=e&&null!=t)return hg(hg({},e),{},{scale:t})});var ub=Ar([Nc,Ko,Fo],(e,t,n)=>{switch(e){case"horizontal":return t.some(e=>e.reversed)?"right-to-left":"left-to-right";case"vertical":return n.some(e=>e.reversed)?"bottom-to-top":"top-to-bottom";case"centric":case"radial":return"left-to-right";default:return}}),sb=e=>e.options.defaultTooltipEventType,fb=e=>e.options.validateTooltipEventTypes;function db(e,t,n){if(null==e)return t;var r=e?"axis":"item";return null==n?t:n.includes(r)?r:t}function hb(e,t){return db(t,sb(e),fb(e))}var pb=(e,t)=>{var n,r=Number(t);if(!Je(r)&&null!=t)return r>=0?null==e||null===(n=e[r])||void 0===n?void 0:n.value:void 0},yb={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},vb=Ia({name:"tooltip",initialState:{itemInteraction:{click:yb,hover:yb},axisInteraction:{click:yb,hover:yb},keyboardInteraction:yb,syncInteraction:{active:!1,index:null,dataKey:void 0,label:void 0,coordinate:void 0,sourceViewBox:void 0,graphicalItemId:void 0},tooltipItemPayloads:[],settings:{shared:void 0,trigger:"hover",axisId:0,active:!1,defaultIndex:void 0}},reducers:{addTooltipEntrySettings:{reducer(e,t){e.tooltipItemPayloads.push(t.payload)},prepare:Pa()},replaceTooltipEntrySettings:{reducer(e,t){var{prev:n,next:r}=t.payload,i=da(e).tooltipItemPayloads.indexOf(n);i>-1&&(e.tooltipItemPayloads[i]=r)},prepare:Pa()},removeTooltipEntrySettings:{reducer(e,t){var n=da(e).tooltipItemPayloads.indexOf(t.payload);n>-1&&e.tooltipItemPayloads.splice(n,1)},prepare:Pa()},setTooltipSettingsState(e,t){e.settings=t.payload},setActiveMouseOverItemIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.itemInteraction.hover.active=!0,e.itemInteraction.hover.index=t.payload.activeIndex,e.itemInteraction.hover.dataKey=t.payload.activeDataKey,e.itemInteraction.hover.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.hover.coordinate=t.payload.activeCoordinate},mouseLeaveChart(e){e.itemInteraction.hover.active=!1,e.axisInteraction.hover.active=!1},mouseLeaveItem(e){e.itemInteraction.hover.active=!1},setActiveClickItemIndex(e,t){e.syncInteraction.active=!1,e.itemInteraction.click.active=!0,e.keyboardInteraction.active=!1,e.itemInteraction.click.index=t.payload.activeIndex,e.itemInteraction.click.dataKey=t.payload.activeDataKey,e.itemInteraction.click.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.click.coordinate=t.payload.activeCoordinate},setMouseOverAxisIndex(e,t){e.syncInteraction.active=!1,e.axisInteraction.hover.active=!0,e.keyboardInteraction.active=!1,e.axisInteraction.hover.index=t.payload.activeIndex,e.axisInteraction.hover.dataKey=t.payload.activeDataKey,e.axisInteraction.hover.coordinate=t.payload.activeCoordinate},setMouseClickAxisIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.axisInteraction.click.active=!0,e.axisInteraction.click.index=t.payload.activeIndex,e.axisInteraction.click.dataKey=t.payload.activeDataKey,e.axisInteraction.click.coordinate=t.payload.activeCoordinate},setSyncInteraction(e,t){e.syncInteraction=t.payload},setKeyboardInteraction(e,t){e.keyboardInteraction.active=t.payload.active,e.keyboardInteraction.index=t.payload.activeIndex,e.keyboardInteraction.coordinate=t.payload.activeCoordinate,e.keyboardInteraction.dataKey=t.payload.activeDataKey}}}),{addTooltipEntrySettings:gb,replaceTooltipEntrySettings:mb,removeTooltipEntrySettings:bb,setTooltipSettingsState:wb,setActiveMouseOverItemIndex:xb,mouseLeaveItem:Ob,mouseLeaveChart:_b,setActiveClickItemIndex:Pb,setMouseOverAxisIndex:Ab,setMouseClickAxisIndex:Eb,setSyncInteraction:jb,setKeyboardInteraction:Sb}=vb.actions,kb=vb.reducer;function Mb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Cb(e){for(var t=1;t{if(null==t)return yb;var i=function(e,t,n){return"axis"===t?"click"===n?e.axisInteraction.click:e.axisInteraction.hover:"click"===n?e.itemInteraction.click:e.itemInteraction.hover}(e,t,n);if(null==i)return yb;if(i.active)return i;if(e.keyboardInteraction.active)return e.keyboardInteraction;if(e.syncInteraction.active&&null!=e.syncInteraction.index)return e.syncInteraction;var a=!0===e.settings.active;if(null!=i.index){if(a)return Cb(Cb({},i),{},{active:!0})}else if(null!=r)return{active:!0,coordinate:void 0,dataKey:void 0,index:r,graphicalItemId:void 0};return Cb(Cb({},yb),{},{coordinate:i.coordinate})};var Db=(e,t,n,r)=>{var i=null==e?void 0:e.index;if(null==i)return null;var a=Number(i);if(!mc(a))return i;var o=1/0;t.length>0&&(o=t.length-1);var c=Math.max(0,Math.min(a,o)),l=t[c];return null==l||function(e,t,n){if(null==n||null==t)return!0;var r=_o(e,t);return null==r||!Ry(n)||function(e,t){var n=function(e){if("number"==typeof e)return Number.isFinite(e)?e:void 0;if(e instanceof Date){var t=e.valueOf();return Number.isFinite(t)?t:void 0}var n=Number(e);return Number.isFinite(n)?n:void 0}(e),r=t[0],i=t[1];if(void 0===n)return!1;var a=Math.min(r,i),o=Math.max(r,i);return n>=a&&n<=o}(r,n)}(l,n,r)?String(c):null},Nb=(e,t,n,r,i,a,o,c)=>{if(null!=a&&null!=c){var l=o[0],u=null==l?void 0:c(l.positions,a);if(null!=u)return u;var s=null==i?void 0:i[Number(a)];if(s)return"horizontal"===n?{x:s.coordinate,y:(r.top+t)/2}:{x:(r.left+e)/2,y:s.coordinate}}},zb=(e,t,n,r)=>{return"axis"===t?e.tooltipItemPayloads:0===e.tooltipItemPayloads.length?[]:null==(i="hover"===n?e.itemInteraction.hover.dataKey:e.itemInteraction.click.dataKey)&&null!=r?[e.tooltipItemPayloads[0]]:e.tooltipItemPayloads.filter(e=>{var t;return(null===(t=e.settings)||void 0===t?void 0:t.dataKey)===i});var i},Lb=e=>e.options.tooltipPayloadSearcher,Rb=e=>e.tooltip;function Bb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Kb(e){for(var t=1;t{if(null!=t&&null!=a){var{chartData:c,computedData:l,dataStartIndex:u,dataEndIndex:s}=n;return e.reduce((e,n)=>{var f,d,h,{dataDefinedOnItem:p,settings:y}=n,v=function(e,t){return null!=e?e:t}(p,c),g=Array.isArray(v)?bo(v,u,s):v,m=null!==(f=null==y?void 0:y.dataKey)&&void 0!==f?f:r,b=null==y?void 0:y.nameKey;return d=r&&Array.isArray(g)&&!Array.isArray(g[0])&&"axis"===o?lt(g,r,i):a(g,t,l,b),Array.isArray(d)?d.forEach(t=>{var n=Kb(Kb({},y),{},{name:t.name,unit:t.unit,color:void 0,fill:void 0});e.push(Do({tooltipEntrySettings:n,dataKey:t.dataKey,payload:t.payload,value:_o(t.payload,t.dataKey),name:t.name}))}):e.push(Do({tooltipEntrySettings:y,dataKey:m,payload:d,value:_o(d,m),name:null!==(h=_o(d,b))&&void 0!==h?h:null==y?void 0:y.name})),e},[])}},Wb=Ar([Hg,Nc,Eg,Tv,sg],Em),$b=Ar([e=>e.graphicalItems.cartesianItems,e=>e.graphicalItems.polarItems],(e,t)=>[...e,...t]),Hb=Ar([sg,fg],jg),Vb=Ar([$b,Hg,Hb],Mg,{memoizeOptions:{resultEqualityCheck:ug}}),qb=Ar([Vb],e=>e.filter(cg)),Yb=Ar([Vb],Ng,{memoizeOptions:{resultEqualityCheck:ug}}),Xb=Ar([Yb,Ny],Lg),Gb=Ar([qb,Ny,Hg],og),Zb=Ar([Xb,Hg,Vb],Bg),Qb=Ar([Hg],Qg),Jb=Ar([Hg],e=>e.allowDataOverflow),ew=Ar([Qb,Jb],Ky),tw=Ar([Vb],e=>e.filter(cg)),nw=Ar([Gb,tw,Mv,Cv],Yg),rw=Ar([nw,Ny,sg,ew],Gg),iw=Ar([Vb],Ig),aw=Ar([Xb,Hg,iw,nm,sg],im,{memoizeOptions:{resultEqualityCheck:lg}}),ow=Ar([cm,sg,fg],lm),cw=Ar([ow,sg],pm),lw=Ar([sm,sg,fg],lm),uw=Ar([lw,sg],vm),sw=Ar([dm,sg,fg],lm),fw=Ar([sw,sg],mm),dw=Ar([cw,fw,uw],rm),hw=Ar([Hg,Qb,ew,rw,aw,dw,Nc,sg],xm),pw=Ar([Hg,Nc,Xb,Zb,Mv,sg,hw],Pm),yw=Ar([pw,Hg,Wb],km),vw=Ar([Hg,pw,yw,sg],Cm),gw=e=>{var t=sg(e),n=fg(e);return Bm(e,t,n,!1)},mw=Ar([Hg,gw],Wv),bw=Ar([Hg,Wb,vw,mw],Sm),ww=Ar([Nc,Zb,Hg,sg],eb),xw=Ar([Nc,Zb,Hg,sg],nb),Ow=Ar([Nc,Hg,Wb,bw,gw,ww,xw,sg],(e,t,n,r,i,a,o,c)=>{if(t){var{type:l}=t,u=Po(e,c);if(r){var s="scaleBand"===n&&r.bandwidth?r.bandwidth()/2:2,f="category"===l&&r.bandwidth?r.bandwidth()/s:0;return f="angleAxis"===c&&null!=i&&(null==i?void 0:i.length)>=2?2*Qe(i[0]-i[1])*f:f,u&&o?o.map((e,t)=>({coordinate:r(e)+f,value:e,index:t,offset:f})):r.domain().map((e,t)=>({coordinate:r(e)+f,value:a?a[e]:e,index:t,offset:f}))}}}),_w=Ar([sb,fb,e=>e.tooltip.settings],(e,t,n)=>db(n.shared,e,t)),Pw=e=>e.tooltip.settings.trigger,Aw=e=>e.tooltip.settings.defaultIndex,Ew=Ar([Rb,_w,Pw,Aw],Ib),jw=Ar([Ew,Xb,Vg,pw],Db),Sw=Ar([Ow,jw],pb),kw=Ar([Ew],e=>{if(e)return e.dataKey});Ar([Ew],e=>{if(e)return e.graphicalItemId});var Mw=Ar([Rb,_w,Pw,Aw],zb),Cw=Ar([zo,Lo,Nc,Zo,Ow,Aw,Mw,Lb],Nb),Tw=Ar([Ew,Cw],(e,t)=>null!=e&&e.coordinate?e.coordinate:t),Iw=Ar([Ew],e=>e.active),Dw=Ar([Mw,jw,Ny,Vg,Sw,Lb,_w],Ub),Nw=Ar([Dw],e=>{if(null!=e){var t=e.map(e=>e.payload).filter(e=>null!=e);return Array.from(new Set(t))}});function zw(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Lw(e){for(var t=1;t{var a,o=-1,c=null!==(a=null==t?void 0:t.length)&&void 0!==a?a:0;if(c<=1||null==e)return 0;if("angleAxis"===r&&null!=i&&Math.abs(Math.abs(i[1]-i[0])-360)<=1e-6)for(var l=0;l0?n[l-1].coordinate:n[c-1].coordinate,s=n[l].coordinate,f=l>=c-1?n[0].coordinate:n[l+1].coordinate,d=void 0;if(Qe(s-u)!==Qe(f-s)){var h=[];if(Qe(f-s)===Qe(i[1]-i[0])){d=f;var p=s+i[1]-i[0];h[0]=Math.min(p,(p+u)/2),h[1]=Math.max(p,(p+u)/2)}else{d=u;var y=f+i[1]-i[0];h[0]=Math.min(s,(y+s)/2),h[1]=Math.max(s,(y+s)/2)}var v=[Math.min(s,(d+s)/2),Math.max(s,(d+s)/2)];if(e>v[0]&&e<=v[1]||e>=h[0]&&e<=h[1]){({index:o}=n[l]);break}}else{var g=Math.min(u,f),m=Math.max(u,f);if(e>(g+s)/2&&e<=(m+s)/2){({index:o}=n[l]);break}}}else if(t)for(var b=0;b0&&b(t[b].coordinate+t[b-1].coordinate)/2&&e<=(t[b].coordinate+t[b+1].coordinate)/2||b===c-1&&e>(t[b].coordinate+t[b-1].coordinate)/2){({index:o}=t[b]);break}return o},Ww=()=>mr(Tv),$w=(e,t)=>t,Hw=(e,t,n)=>n,Vw=(e,t,n,r)=>r,qw=Ar(Ow,e=>Xr(e,e=>e.coordinate)),Yw=Ar([Rb,$w,Hw,Vw],Ib),Xw=Ar([Yw,Xb,Vg,pw],Db),Gw=Ar([Rb,$w,Hw,Vw],zb),Zw=Ar([zo,Lo,Nc,Zo,Ow,Vw,Gw,Lb],Nb),Qw=Ar([Yw,Zw],(e,t)=>{var n;return null!==(n=e.coordinate)&&void 0!==n?n:t}),Jw=Ar([Ow,Xw],pb),ex=Ar([Gw,Xw,Ny,Vg,Jw,Lb,$w],Ub),tx=Ar([Yw,Xw],(e,t)=>({isActive:e.active&&null!=t,activeIndex:t})),nx=Ar(e=>e.zIndex.zIndexMap,(e,t)=>t,(e,t,n)=>n,(e,t,n)=>{if(null!=t){var r=e[t];if(null!=r)return n?r.panoramaElementId:r.elementId}}),rx=Ar(e=>e.zIndex.zIndexMap,e=>{var t=Object.keys(e).map(e=>parseInt(e,10)).concat(Object.values(zv));return Array.from(new Set(t)).sort((e,t)=>e-t)},{memoizeOptions:{resultEqualityCheck:function(e,t){if(e.length===t.length){for(var n=0;nax(ax({},e),{},{[t]:{elementId:void 0,panoramaElementId:void 0,consumers:0}}),{})},lx=new Set(Object.values(zv)),ux=Ia({name:"zIndex",initialState:cx,reducers:{registerZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]?e.zIndexMap[n].consumers+=1:e.zIndexMap[n]={consumers:1,elementId:void 0,panoramaElementId:void 0}},prepare:Pa()},unregisterZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(e.zIndexMap[n].consumers-=1,e.zIndexMap[n].consumers<=0&&!function(e){return lx.has(e)}(n)&&delete e.zIndexMap[n])},prepare:Pa()},registerZIndexPortalId:{reducer:(e,t)=>{var{zIndex:n,elementId:r,isPanorama:i}=t.payload;e.zIndexMap[n]?i?e.zIndexMap[n].panoramaElementId=r:e.zIndexMap[n].elementId=r:e.zIndexMap[n]={consumers:0,elementId:i?void 0:r,panoramaElementId:i?r:void 0}},prepare:Pa()},unregisterZIndexPortalId:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(t.payload.isPanorama?e.zIndexMap[n].panoramaElementId=void 0:e.zIndexMap[n].elementId=void 0)},prepare:Pa()}}}),{registerZIndexPortal:sx,unregisterZIndexPortal:fx,registerZIndexPortalId:dx,unregisterZIndexPortalId:hx}=ux.actions,px=ux.reducer;function yx(e){var{zIndex:t,children:r}=e,a=void 0!==zc()&&void 0!==t&&0!==t,o=tc(),c=pr();n.useLayoutEffect(()=>a?(c(sx({zIndex:t})),()=>{c(fx({zIndex:t}))}):dt,[c,t,a]);var l=mr(e=>nx(e,t,o));if(!a)return r;if(!l)return null;var u=document.getElementById(l);return u?i.createPortal(r,u):null}function vx(){return vx=Object.assign?Object.assign.bind():function(e){for(var t=1;t{null==e.eventEmitter&&(e.eventEmitter=Symbol("rechartsEventEmitter"))}}}),Tx=Cx.reducer,{createEventEmitter:Ix}=Cx.actions;function Dx(e){return e.tooltip.syncInteraction}var Nx=Ia({name:"chartData",initialState:{chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},reducers:{setChartData(e,t){if(e.chartData=t.payload,null==t.payload)return e.dataStartIndex=0,void(e.dataEndIndex=0);t.payload.length>0&&e.dataEndIndex!==t.payload.length-1&&(e.dataEndIndex=t.payload.length-1)},setComputedData(e,t){e.computedData=t.payload},setDataStartEndIndexes(e,t){var{startIndex:n,endIndex:r}=t.payload;null!=n&&(e.dataStartIndex=n),null!=r&&(e.dataEndIndex=r)}}}),{setChartData:zx,setDataStartEndIndexes:Lx,setComputedData:Rx}=Nx.actions,Bx=Nx.reducer,Kx=["x","y"];function Fx(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ux(e){for(var t=1;t{e(Ix())},[e]),function(){var e=mr(Iv),t=mr(Nv),r=pr(),i=mr(Dv),a=mr(Ow),o=zc(),c=Mc(),l=mr(e=>e.rootProps.className);n.useEffect(()=>{if(null==e)return dt;var n=(n,l,u)=>{var s;if(t!==u&&e===n)if("index"!==i){if(null!=a){var f;if("function"==typeof i){var d={activeTooltipIndex:null==l.payload.index?void 0:Number(l.payload.index),isTooltipActive:l.payload.active,activeIndex:null==l.payload.index?void 0:Number(l.payload.index),activeLabel:l.payload.label,activeDataKey:l.payload.dataKey,activeCoordinate:l.payload.coordinate},h=i(a,d);f=a[h]}else"value"===i&&(f=a.find(e=>String(e.value)===l.payload.label));var{coordinate:p}=l.payload;if(null!=f&&!1!==l.payload.active&&null!=p&&null!=c){var{x:y,y:v}=p,g=Math.min(y,c.x+c.width),m=Math.min(v,c.y+c.height),b={x:"horizontal"===o?f.coordinate:g,y:"horizontal"===o?m:f.coordinate},w=jb({active:l.payload.active,coordinate:b,dataKey:l.payload.dataKey,index:String(f.index),label:l.payload.label,sourceViewBox:l.payload.sourceViewBox,graphicalItemId:l.payload.graphicalItemId});r(w)}else r(jb({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}))}}else if(c&&null!=l&&null!==(s=l.payload)&&void 0!==s&&s.coordinate&&l.payload.sourceViewBox){var x=l.payload.coordinate,{x:O,y:_}=x,P=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{jx.off(Sx,n)}},[l,r,t,e,i,a,o,c])}(),function(){var e=mr(Iv),t=mr(Nv),r=pr();n.useEffect(()=>{if(null==e)return dt;var n=(n,i,a)=>{t!==a&&e===n&&r(Lx(i))};return jx.on(kx,n),()=>{jx.off(kx,n)}},[r,t,e])}()}function Hx(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Vx(e){for(var t=1;t{A(wb({shared:w,trigger:x,axisId:P,active:o,defaultIndex:E}))},[A,w,x,P,o,E]);var j=Mc(),S=Yl(),k=function(e){return mr(t=>hb(t,e))}(w),{activeIndex:M,isActive:C}=null!==(t=mr(e=>tx(e,k,x,E)))&&void 0!==t?t:{},T=mr(e=>ex(e,k,x,E)),I=mr(e=>Jw(e,k,x,E)),D=mr(e=>Qw(e,k,x,E)),N=T,z=n.useContext(Px),L=null!==(r=null!=o?o:C)&&void 0!==r&&r,[R,B]=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],[t,r]=n.useState({height:0,left:0,top:0,width:0}),i=n.useCallback(e=>{if(null!=e){var n=e.getBoundingClientRect(),i={height:n.height,left:n.left,top:n.top,width:n.width};(Math.abs(i.height-t.height)>1||Math.abs(i.left-t.left)>1||Math.abs(i.top-t.top)>1||Math.abs(i.width-t.width)>1)&&r({height:i.height,left:i.left,top:i.top,width:i.width})}},[t.width,t.height,t.top,t.left,...e]);return[t,i]}([N,L]),K="axis"===k?I:void 0;!function(e,t,r,i,a,o){var c=mr(n=>((e,t,n)=>{if(null!=t){var r=Rb(e);return"axis"===t?"hover"===n?r.axisInteraction.hover.dataKey:r.axisInteraction.click.dataKey:"hover"===n?r.itemInteraction.hover.dataKey:r.itemInteraction.click.dataKey}})(n,e,t)),l=mr(Nv),u=mr(Iv),s=mr(Dv),f=mr(Dx),d=null==f?void 0:f.active,h=Mc();n.useEffect(()=>{if(!d&&null!=u&&null!=l){var e=jb({active:o,coordinate:r,dataKey:c,index:a,label:"number"==typeof i?String(i):i,sourceViewBox:h,graphicalItemId:void 0});jx.emit(Sx,u,e,l)}},[d,r,c,a,i,l,u,s,o,h])}(k,x,D,K,M,L);var F=null!=_?_:z;if(null==F||null==j||null==k)return null;var U=null!=N?N:Xx;L||(U=Xx),f&&U.length&&(U=function(e,t){return!0===t?nr(e,Yx):"function"==typeof t?nr(e,t):e}(U.filter(e=>null!=e.value&&(!0!==e.hide||a.includeHidden)),p));var W=U.length>0,$=n.createElement(ql,{allowEscapeViewBox:c,animationDuration:l,animationEasing:u,isAnimationActive:d,active:L,coordinate:D,hasPayload:W,offset:h,position:y,reverseDirection:v,useTranslate3d:g,viewBox:j,wrapperStyle:m,lastBoundingBox:R,innerRef:B,hasPortalFromProps:Boolean(_)},function(e,t){return n.isValidElement(e)?n.cloneElement(e,t):"function"==typeof e?n.createElement(e,t):n.createElement(Bl,t)}(s,Vx(Vx({},a),{},{payload:U,label:K,active:L,activeIndex:M,coordinate:D,accessibilityLayer:S})));return n.createElement(n.Fragment,null,i.createPortal($,F),L&&n.createElement(Ox,{cursor:b,tooltipEventType:k,coordinate:D,payload:U,index:M}))}function Qx(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Jx(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var eO=function(e){for(var t=1;t=this.maxSize){var n=this.cache.keys().next().value;null!=n&&this.cache.delete(n)}this.cache.set(e,t)}clear(){this.cache.clear()}size(){return this.cache.size}}(eO.cacheSize),nO={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},rO="recharts_measurement_span",iO=(e,t)=>{try{var n=document.getElementById(rO);n||((n=document.createElement("span")).setAttribute("id",rO),n.setAttribute("aria-hidden","true"),document.body.appendChild(n)),Object.assign(n.style,nO,t),n.textContent="".concat(e);var r=n.getBoundingClientRect();return{width:r.width,height:r.height}}catch(i){return{width:0,height:0}}},aO=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null==e||Tu)return{width:0,height:0};if(!eO.enableCache)return iO(e,t);var n=function(e,t){var n=t.fontSize||"",r=t.fontFamily||"",i=t.fontWeight||"",a=t.fontStyle||"",o=t.letterSpacing||"",c=t.textTransform||"";return"".concat(e,"|").concat(n,"|").concat(r,"|").concat(i,"|").concat(a,"|").concat(o,"|").concat(c)}(e,t),r=tO.get(n);if(r)return r;var i=iO(e,t);return tO.set(n,i),i},oO=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,cO=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,lO=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,uO=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,sO={cm:96/2.54,mm:96/25.4,pt:96/72,pc:16,in:96,Q:96/101.6,px:1},fO=Object.keys(sO),dO="NaN";class hO{static parse(e){var t,[,n,r]=null!==(t=uO.exec(e))&&void 0!==t?t:[];return new hO(parseFloat(n),null!=r?r:"")}constructor(e,t){this.num=e,this.unit=t,this.num=e,this.unit=t,Je(e)&&(this.unit=""),""===t||lO.test(t)||(this.num=NaN,this.unit=""),fO.includes(t)&&(this.num=function(e,t){return e*sO[t]}(e,t),this.unit="px")}add(e){return this.unit!==e.unit?new hO(NaN,""):new hO(this.num+e.num,this.unit)}subtract(e){return this.unit!==e.unit?new hO(NaN,""):new hO(this.num-e.num,this.unit)}multiply(e){return""!==this.unit&&""!==e.unit&&this.unit!==e.unit?new hO(NaN,""):new hO(this.num*e.num,this.unit||e.unit)}divide(e){return""!==this.unit&&""!==e.unit&&this.unit!==e.unit?new hO(NaN,""):new hO(this.num/e.num,this.unit||e.unit)}toString(){return"".concat(this.num).concat(this.unit)}isNaN(){return Je(this.num)}}function pO(e){if(e.includes(dO))return dO;for(var t=e;t.includes("*")||t.includes("/");){var n,[,r,i,a]=null!==(n=oO.exec(t))&&void 0!==n?n:[],o=hO.parse(null!=r?r:""),c=hO.parse(null!=a?a:""),l="*"===i?o.multiply(c):o.divide(c);if(l.isNaN())return dO;t=t.replace(oO,l.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var u,[,s,f,d]=null!==(u=cO.exec(t))&&void 0!==u?u:[],h=hO.parse(null!=s?s:""),p=hO.parse(null!=d?d:""),y="+"===f?h.add(p):h.subtract(p);if(y.isNaN())return dO;t=t.replace(cO,y.toString())}return t}var yO=/\(([^()]*)\)/;function vO(e){var t=function(e){try{return function(e){var t=e.replace(/\s+/g,"");return t=function(e){for(var t,n=e;null!=(t=yO.exec(n));){var[,r]=t;n=n.replace(yO,pO(r))}return n}(t),pO(t)}(e)}catch(t){return dO}}(e.slice(5,-1));return t===dO?"":t}var gO=["x","y","lineHeight","capHeight","fill","scaleToFit","textAnchor","verticalAnchor"],mO=["dx","dy","angle","className","breakAll"];function bO(){return bO=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{children:t,breakAll:n,style:r}=e;try{var i=[];return ut(t)||(i=n?t.toString().split(""):t.toString().split(xO)),{wordsWithComputedWidth:i.map(e=>({word:e,width:aO(e,r).width})),spaceWidth:n?0:aO(" ",r).width}}catch(a){return null}};function _O(e){return"start"===e||"middle"===e||"end"===e||"inherit"===e}var PO=(e,t,n,r)=>e.reduce((e,i)=>{var{word:a,width:o}=i,c=e[e.length-1];if(c&&null!=o&&(null==t||r||c.width+o+ne.reduce((e,t)=>e.width>t.width?e:t),EO=(e,t,n,r,i,a,o,c)=>{var l=e.slice(0,t),u=OO({breakAll:n,style:r,children:l+"…"});if(!u)return[!1,[]];var s=PO(u.wordsWithComputedWidth,a,o,c);return[s.length>i||AO(s).width>Number(a),s]},jO=e=>[{words:ut(e)?[]:e.toString().split(xO),width:void 0}],SO="#808080",kO={angle:0,breakAll:!1,capHeight:"0.71em",fill:SO,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},MO=n.forwardRef((e,t)=>{var r=At(e,kO),{x:i,y:a,lineHeight:o,capHeight:c,fill:l,scaleToFit:u,textAnchor:f,verticalAnchor:d}=r,h=wO(r,gO),p=n.useMemo(()=>(e=>{var{width:t,scaleToFit:n,children:r,style:i,breakAll:a,maxLines:o}=e;if((t||n)&&!Tu){var c=OO({breakAll:a,children:r,style:i});if(!c)return jO(r);var{wordsWithComputedWidth:l,spaceWidth:u}=c;return((e,t,n,r,i)=>{var{maxLines:a,children:o,style:c,breakAll:l}=e,u=tt(a),s=String(o),f=PO(t,r,n,i);if(!u||i)return f;if(!(f.length>a||AO(f).width>Number(r)))return f;for(var d,h=0,p=s.length-1,y=0;h<=p&&y<=s.length-1;){var v=Math.floor((h+p)/2),g=v-1,[m,b]=EO(s,g,l,c,a,r,n,i),[w]=EO(s,v,l,c,a,r,n,i);if(m||w||(h=v+1),m&&w&&(p=v-1),!m&&w){d=b;break}y++}return d||f})({breakAll:a,children:r,maxLines:o,style:i},l,u,t,Boolean(n))}return jO(r)})({breakAll:h.breakAll,children:h.children,maxLines:h.maxLines,scaleToFit:u,style:h.style,width:h.width}),[h.breakAll,h.children,h.maxLines,u,h.style,h.width]),{dx:y,dy:v,angle:g,className:b,breakAll:w}=h,x=wO(h,mO);if(!nt(i)||!nt(a)||0===p.length)return null;var O,_=Number(i)+(tt(y)?y:0),P=Number(a)+(tt(v)?v:0);if(!mc(_)||!mc(P))return null;switch(d){case"start":O=vO("calc(".concat(c,")"));break;case"middle":O=vO("calc(".concat((p.length-1)/2," * -").concat(o," + (").concat(c," / 2))"));break;default:O=vO("calc(".concat(p.length-1," * -").concat(o,")"))}var A=[];if(u){var E=p[0].width,{width:j}=h;A.push("scale(".concat(tt(j)&&tt(E)?j/E:1,")"))}return g&&A.push("rotate(".concat(g,", ").concat(_,", ").concat(P,")")),A.length&&(x.transform=A.join(" ")),n.createElement("text",bO({},m(x),{ref:t,x:_,y:P,className:s("recharts-text",b),textAnchor:f,fill:l.includes("url")?SO:l}),p.map((e,t)=>{var r=e.words.join(w?"":" ");return n.createElement("tspan",{x:_,dy:0===t?O:o,key:"".concat(r,"-").concat(t)},r)}))});MO.displayName="Text";var CO=["labelRef"];function TO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function IO(e){for(var t=1;t{var{x:t,y:r,upperWidth:i,lowerWidth:a,width:o,height:c,children:l}=e,u=n.useMemo(()=>({x:t,y:r,upperWidth:i,lowerWidth:a,width:o,height:c}),[t,r,i,a,o,c]);return n.createElement(zO.Provider,{value:u},l)},RO=()=>{var e=n.useContext(zO),t=Mc();return e||kc(t)},BO=n.createContext(null),KO=e=>null!=e&&"function"==typeof e,FO=e=>"cx"in e&&tt(e.cx),UO={angle:0,offset:5,zIndex:zv.label,position:"middle",textBreakAll:!1};function WO(e){var t,r,i,a,o,c=At(e,UO),{viewBox:l,position:u,value:f,children:d,content:h,className:p="",textBreakAll:y,labelRef:v}=c,g=(t=n.useContext(BO),r=mr(ng),t||r),b=RO();if(!(i=null==l?"center"===u?b:null!=g?g:b:FO(l)?l:kc(l))||ut(f)&&ut(d)&&!n.isValidElement(h)&&"function"!=typeof h)return null;var w=IO(IO({},c),{},{viewBox:i});if(n.isValidElement(h)){var{labelRef:x}=w,O=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{var{value:t,formatter:n}=e,r=ut(e.children)?t:e.children;return"function"==typeof n?n(r):r})(c);var _=m(c);if(FO(i)){if("insideStart"===u||"insideEnd"===u||"end"===u)return((e,t,r,i,a)=>{var o,c,{offset:l,className:u}=e,{cx:f,cy:d,innerRadius:h,outerRadius:p,startAngle:y,endAngle:v,clockWise:g}=a,m=(h+p)/2,b=((e,t)=>Qe(t-e)*Math.min(Math.abs(t-e),360))(y,v),w=b>=0?1:-1;switch(t){case"insideStart":o=y+w*l,c=g;break;case"insideEnd":o=v-w*l,c=!g;break;case"end":o=v+w*l,c=g;break;default:throw new Error("Unsupported position ".concat(t))}c=b<=0?c:!c;var x=Ju(f,d,m,o),O=Ju(f,d,m,o+359*(c?1:-1)),_="M".concat(x.x,",").concat(x.y,"\n A").concat(m,",").concat(m,",0,1,").concat(c?0:1,",\n ").concat(O.x,",").concat(O.y),P=ut(e.id)?it("recharts-radial-line-"):e.id;return n.createElement("text",NO({},i,{dominantBaseline:"central",className:s("recharts-radial-bar-label",u)}),n.createElement("defs",null,n.createElement("path",{id:P,d:_})),n.createElement("textPath",{xlinkHref:"#".concat(P)},r))})(c,u,a,_,i);o=((e,t,n)=>{var{cx:r,cy:i,innerRadius:a,outerRadius:o,startAngle:c,endAngle:l}=e,u=(c+l)/2;if("outside"===n){var{x:s,y:f}=Ju(r,i,o+t,u);return{x:s,y:f,textAnchor:s>=r?"start":"end",verticalAnchor:"middle"}}if("center"===n)return{x:r,y:i,textAnchor:"middle",verticalAnchor:"middle"};if("centerTop"===n)return{x:r,y:i,textAnchor:"middle",verticalAnchor:"start"};if("centerBottom"===n)return{x:r,y:i,textAnchor:"middle",verticalAnchor:"end"};var d=(a+o)/2,{x:h,y:p}=Ju(r,i,d,u);return{x:h,y:p,textAnchor:"middle",verticalAnchor:"middle"}})(i,c.offset,c.position)}else o=((e,t)=>{var n,{parentViewBox:r,offset:i,position:a}=e;null==r||FO(r)||(n=r);var{x:o,y:c,upperWidth:l,lowerWidth:u,height:s}=t,f=o,d=o+(l-u)/2,h=(f+d)/2,p=(l+u)/2,y=f+l/2,v=s>=0?1:-1,g=v*i,m=v>0?"end":"start",b=v>0?"start":"end",w=l>=0?1:-1,x=w*i,O=w>0?"end":"start",_=w>0?"start":"end";if("top"===a)return IO(IO({},{x:f+l/2,y:c-g,textAnchor:"middle",verticalAnchor:m}),n?{height:Math.max(c-n.y,0),width:l}:{});if("bottom"===a)return IO(IO({},{x:d+u/2,y:c+s+g,textAnchor:"middle",verticalAnchor:b}),n?{height:Math.max(n.y+n.height-(c+s),0),width:u}:{});if("left"===a){var P={x:h-x,y:c+s/2,textAnchor:O,verticalAnchor:"middle"};return IO(IO({},P),n?{width:Math.max(P.x-n.x,0),height:s}:{})}if("right"===a){var A={x:h+p+x,y:c+s/2,textAnchor:_,verticalAnchor:"middle"};return IO(IO({},A),n?{width:Math.max(n.x+n.width-A.x,0),height:s}:{})}var E=n?{width:p,height:s}:{};return"insideLeft"===a?IO({x:h+x,y:c+s/2,textAnchor:_,verticalAnchor:"middle"},E):"insideRight"===a?IO({x:h+p-x,y:c+s/2,textAnchor:O,verticalAnchor:"middle"},E):"insideTop"===a?IO({x:f+l/2,y:c+g,textAnchor:"middle",verticalAnchor:b},E):"insideBottom"===a?IO({x:d+u/2,y:c+s-g,textAnchor:"middle",verticalAnchor:m},E):"insideTopLeft"===a?IO({x:f+x,y:c+g,textAnchor:_,verticalAnchor:b},E):"insideTopRight"===a?IO({x:f+l-x,y:c+g,textAnchor:O,verticalAnchor:b},E):"insideBottomLeft"===a?IO({x:d+x,y:c+s-g,textAnchor:_,verticalAnchor:m},E):"insideBottomRight"===a?IO({x:d+u-x,y:c+s-g,textAnchor:O,verticalAnchor:m},E):a&&"object"==typeof a&&(tt(a.x)||et(a.x))&&(tt(a.y)||et(a.y))?IO({x:o+at(a.x,p),y:c+at(a.y,s),textAnchor:"end",verticalAnchor:"end"},E):IO({x:y,y:c+s/2,textAnchor:"middle",verticalAnchor:"middle"},E)})(c,i);return n.createElement(yx,{zIndex:c.zIndex},n.createElement(MO,NO({ref:v,className:s("recharts-label",p)},_,o,{textAnchor:_O(_.textAnchor)?_.textAnchor:o.textAnchor,breakAll:y}),a))}function $O(e){var{label:t,labelRef:r}=e;return((e,t,r)=>{if(!e)return null;var i={viewBox:t,labelRef:r};return!0===e?n.createElement(WO,NO({key:"label-implicit"},i)):nt(e)?n.createElement(WO,NO({key:"label-implicit",value:e},i)):n.isValidElement(e)?e.type===WO?n.cloneElement(e,IO({key:"label-implicit"},i)):n.createElement(WO,NO({key:"label-implicit",content:e},i)):KO(e)?n.createElement(WO,NO({key:"label-implicit",content:e},i)):e&&"object"==typeof e?n.createElement(WO,NO({},e,{key:"label-implicit"},i)):null})(t,RO(),r)||null}WO.displayName="Label";var HO,VO={},qO={};function YO(){return HO||(HO=1,e=qO,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e.last=function(e){return e[e.length-1]}),qO;var e}var XO,GO,ZO,QO,JO={};function e_(){return XO||(XO=1,e=JO,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e.toArray=function(e){return Array.isArray(e)?e:Array.from(e)}),JO;var e}function t_(){return QO?ZO:(QO=1,ZO=(GO||(GO=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=YO(),n=e_(),r=Bt();e.last=function(e){if(r.isArrayLike(e))return t.last(n.toArray(e))}}(VO)),VO).last)}const n_=l(t_());var r_=["valueAccessor"],i_=["dataKey","clockWise","id","textBreakAll","zIndex"];function a_(){return a_=Object.assign?Object.assign.bind():function(e){for(var t=1;tArray.isArray(e.value)?n_(e.value):e.value,l_=n.createContext(void 0),u_=l_.Provider,s_=n.createContext(void 0);function f_(e){var{valueAccessor:t=c_}=e,r=o_(e,r_),{dataKey:i,clockWise:a,id:o,textBreakAll:c,zIndex:l}=r,u=o_(r,i_),s=n.useContext(l_),f=n.useContext(s_),d=s||f;return d&&d.length?n.createElement(yx,{zIndex:null!=l?l:zv.label},n.createElement(P,{className:"recharts-label-list"},d.map((e,a)=>{var l,s=ut(i)?t(e,a):_o(e&&e.payload,i),f=ut(o)?{}:{id:"".concat(o,"-").concat(a)};return n.createElement(WO,a_({key:"label-".concat(a)},m(e),u,f,{fill:null!==(l=r.fill)&&void 0!==l?l:e.fill,parentViewBox:e.parentViewBox,value:s,textBreakAll:c,viewBox:e.viewBox,index:a,zIndex:0}))}))):null}function d_(e){var{label:t}=e;return t?!0===t?n.createElement(f_,{key:"labelList-implicit"}):n.isValidElement(t)||KO(t)?n.createElement(f_,{key:"labelList-implicit",content:t}):"object"==typeof t?n.createElement(f_,a_({key:"labelList-implicit"},t,{type:String(t.type)})):null:null}s_.Provider,f_.displayName="LabelList";var h_=["points","className","baseLinePoints","connectNulls"];function p_(){return p_=Object.assign?Object.assign.bind():function(e){for(var t=1;te&&e.x===+e.x&&e.y===+e.y,v_=(e,t)=>{var n=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=[[]];return e.forEach(e=>{y_(e)?t[t.length-1].push(e):t[t.length-1].length>0&&t.push([])}),y_(e[0])&&t[t.length-1].push(e[0]),t[t.length-1].length<=0&&(t=t.slice(0,-1)),t}(e);t&&(n=[n.reduce((e,t)=>[...e,...t],[])]);var r=n.map(e=>e.reduce((e,t,n)=>"".concat(e).concat(0===n?"M":"L").concat(t.x,",").concat(t.y),"")).join("");return 1===n.length?"".concat(r,"Z"):r},g_=e=>{var{points:t,className:r,baseLinePoints:i,connectNulls:a}=e,o=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{var r=v_(e,n);return"".concat("Z"===r.slice(-1)?r.slice(0,-1):r,"L").concat(v_(Array.from(t).reverse(),n).slice(1))})(t,i,a);return n.createElement("g",{className:c},n.createElement("path",p_({},m(o),{fill:"Z"===u.slice(-1)?o.fill:"none",stroke:"none",d:u})),l?n.createElement("path",p_({},m(o),{fill:"none",d:v_(t,a)})):null,l?n.createElement("path",p_({},m(o),{fill:"none",d:v_(i,a)})):null)}var f=v_(t,a);return n.createElement("path",p_({},m(o),{fill:"Z"===f.slice(-1)?o.fill:"none",className:c,d:f}))};function m_(){return m_=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{cx:t,cy:r,r:i,className:a}=e,o=s("recharts-dot",a);return tt(t)&&tt(r)&&tt(i)?n.createElement("circle",m_({},v(e),Ot(e),{className:o,cx:t,cy:r,r:i})):null},__=Ia({name:"polarAxis",initialState:{radiusAxis:{},angleAxis:{}},reducers:{addRadiusAxis(e,t){e.radiusAxis[t.payload.id]=t.payload},removeRadiusAxis(e,t){delete e.radiusAxis[t.payload.id]},addAngleAxis(e,t){e.angleAxis[t.payload.id]=t.payload},removeAngleAxis(e,t){delete e.angleAxis[t.payload.id]}}}),{addRadiusAxis:P_,removeRadiusAxis:A_,addAngleAxis:E_,removeAngleAxis:j_}=__.actions,S_=__.reducer,k_=e=>!e||"object"!=typeof e||!("clipDot"in e)||Boolean(e.clipDot),M_={};function C_(){return b_||(b_=1,e=M_,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e.isPlainObject=function(e){var t;if("object"!=typeof e)return!1;if(null==e)return!1;if(null===Object.getPrototypeOf(e))return!0;if("[object Object]"!==Object.prototype.toString.call(e)){const n=e[Symbol.toStringTag];return null!=n&&!!(null==(t=Object.getOwnPropertyDescriptor(e,Symbol.toStringTag))?void 0:t.writable)&&e.toString()===`[object ${n}]`}let n=e;for(;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(e)===n}),M_;var e}function T_(){return x_?w_:(x_=1,w_=C_().isPlainObject)}const I_=l(T_());function D_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function N_(e){for(var t=1;t{var a,o=n-r;return a="M ".concat(e,",").concat(t),a+="L ".concat(e+n,",").concat(t),a+="L ".concat(e+n-o/2,",").concat(t+i),(a+="L ".concat(e+n-o/2-r,",").concat(t+i))+"L ".concat(e,",").concat(t," Z")},K_={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},F_=e=>{var t=At(e,K_),{x:r,y:i,upperWidth:a,lowerWidth:o,height:c,className:l}=t,{animationEasing:u,animationDuration:f,animationBegin:d,isUpdateAnimationActive:h}=t,p=n.useRef(null),[y,v]=n.useState(-1),g=n.useRef(a),b=n.useRef(o),w=n.useRef(c),x=n.useRef(r),O=n.useRef(i),_=Lu(e,"trapezoid-");if(n.useEffect(()=>{if(p.current&&p.current.getTotalLength)try{var e=p.current.getTotalLength();e&&v(e)}catch(t){}},[]),r!==+r||i!==+i||a!==+a||o!==+o||c!==+c||0===a&&0===o||0===c)return null;var P=s("recharts-trapezoid",l);if(!h)return n.createElement("g",null,n.createElement("path",L_({},m(t),{className:P,d:B_(r,i,a,o,c)})));var A=g.current,E=b.current,j=w.current,S=x.current,k=O.current,M="0px ".concat(-1===y?1:y,"px"),C="".concat(y,"px 0px"),T=pu(["strokeDasharray"],f,u);return n.createElement(zu,{animationId:_,key:_,canBegin:y>0,duration:f,easing:u,isActive:h,begin:d},e=>{var l=ct(A,a,e),u=ct(E,o,e),s=ct(j,c,e),f=ct(S,r,e),d=ct(k,i,e);p.current&&(g.current=l,b.current=u,w.current=s,x.current=f,O.current=d);var h=e>0?{transition:T,strokeDasharray:C}:{strokeDasharray:M};return n.createElement("path",L_({},m(t),{className:P,d:B_(f,d,l,u,s),ref:p,style:N_(N_({},h),t.style)}))})},U_=["option","shapeType","propTransformer","activeClassName"];function W_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function $_(e){for(var t=1;t{i||(null===a.current?r(gb(t)):a.current!==t&&r(mb({prev:a.current,next:t})),a.current=t)},[t,r,i]),n.useLayoutEffect(()=>()=>{a.current&&(r(bb(a.current)),a.current=null)},[r]),null}function G_(e){var{legendPayload:t}=e,r=pr(),i=tc(),a=n.useRef(null);return n.useLayoutEffect(()=>{i||(null===a.current?r(Ml(t)):a.current!==t&&r(Cl({prev:a.current,next:t})),a.current=t)},[r,i,t]),n.useLayoutEffect(()=>()=>{a.current&&(r(Tl(a.current)),a.current=null)},[r]),null}var Z_=null!==(R_=a["useId".toString()])&&void 0!==R_?R_:()=>{var[e]=n.useState(()=>it("uid-"));return e};function Q_(e,t){var n=Z_();return t||(e?"".concat(e,"-").concat(n):n)}var J_=n.createContext(void 0),eP=e=>{var{id:t,type:r,children:i}=e,a=Q_("recharts-".concat(r),t);return n.createElement(J_.Provider,{value:a},i(a))},tP=Ia({name:"graphicalItems",initialState:{cartesianItems:[],polarItems:[]},reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(t.payload)},prepare:Pa()},replaceCartesianGraphicalItem:{reducer(e,t){var{prev:n,next:r}=t.payload,i=da(e).cartesianItems.indexOf(n);i>-1&&(e.cartesianItems[i]=r)},prepare:Pa()},removeCartesianGraphicalItem:{reducer(e,t){var n=da(e).cartesianItems.indexOf(t.payload);n>-1&&e.cartesianItems.splice(n,1)},prepare:Pa()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(t.payload)},prepare:Pa()},removePolarGraphicalItem:{reducer(e,t){var n=da(e).polarItems.indexOf(t.payload);n>-1&&e.polarItems.splice(n,1)},prepare:Pa()}}}),{addCartesianGraphicalItem:nP,replaceCartesianGraphicalItem:rP,removeCartesianGraphicalItem:iP,addPolarGraphicalItem:aP,removePolarGraphicalItem:oP}=tP.actions,cP=tP.reducer,lP=e=>{var t=pr(),r=n.useRef(null);return n.useLayoutEffect(()=>{null===r.current?t(nP(e)):r.current!==e&&t(rP({prev:r.current,next:e})),r.current=e},[t,e]),n.useLayoutEffect(()=>()=>{r.current&&(t(iP(r.current)),r.current=null)},[t]),null},uP=n.memo(lP),sP=["points"];function fP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function dP(e){for(var t=1;t{var l,u,s=dP(dP(dP({r:3},c),h),{},{index:i,cx:null!==(l=e.x)&&void 0!==l?l:void 0,cy:null!==(u=e.y)&&void 0!==u?u:void 0,dataKey:o,value:e.value,payload:e.payload,points:t});return n.createElement(yP,{key:"dot-".concat(i),option:r,dotProps:s,className:a})}),y={};return l&&null!=u&&(y.clipPath="url(#clipPath-".concat(d?"":"dots-").concat(u,")")),n.createElement(yx,{zIndex:s},n.createElement(P,pP({className:i},y),p))}function gP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function mP(e){for(var t=1;t({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),IP=Ar([TP,zo,Lo],(e,t,n)=>{if(e&&null!=t&&null!=n)return{x:e.left,y:e.top,width:Math.max(0,t-e.left-e.right),height:Math.max(0,n-e.top-e.bottom)}}),DP=()=>mr(IP);function NP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function zP(e){for(var t=1;t{var{point:t,childIndex:r,mainColor:i,activeDot:a,dataKey:o,clipPath:c}=e;if(!1===a||null==t.x||null==t.y)return null;var l,u=zP(zP(zP({},{index:r,dataKey:o,cx:t.x,cy:t.y,r:4,fill:null!=i?i:"none",strokeWidth:2,stroke:"#fff",payload:t.payload,value:t.value}),g(a)),Ot(a));return l=n.isValidElement(a)?n.cloneElement(a,u):"function"==typeof a?a(u):n.createElement(O_,u),n.createElement(P,{className:"recharts-active-dot",clipPath:c},l)};function BP(e){var{points:t,mainColor:r,activeDot:i,itemDataKey:a,clipPath:o,zIndex:c=zv.activeDot}=e,l=mr(jw),u=mr(Nw);if(null==t||null==u)return null;var s=t.find(e=>u.includes(e.payload));return ut(s)?null:n.createElement(yx,{zIndex:c},n.createElement(RP,{point:s,childIndex:Number(l),mainColor:r,dataKey:a,activeDot:i,clipPath:o}))}var KP=Ia({name:"errorBars",initialState:{},reducers:{addErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]||(e[n]=[]),e[n].push(r)},replaceErrorBar:(e,t)=>{var{itemId:n,prev:r,next:i}=t.payload;e[n]&&(e[n]=e[n].map(e=>e.dataKey===r.dataKey&&e.direction===r.direction?i:e))},removeErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]&&(e[n]=e[n].filter(e=>e.dataKey!==r.dataKey||e.direction!==r.direction))}}}),{addErrorBar:FP,replaceErrorBar:UP,removeErrorBar:WP}=KP.actions,$P=KP.reducer,HP=["children"],VP={data:[],xAxisId:"xAxis-0",yAxisId:"yAxis-0",dataPointFormatter:()=>({x:0,y:0,value:0}),errorBarOffset:0},qP=n.createContext(VP);function YP(e){var{children:t}=e,r=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;rmg(t,e)),a=mr(e=>xg(e,t)),o=null!==(n=null==i?void 0:i.allowDataOverflow)&&void 0!==n?n:vg.allowDataOverflow,c=null!==(r=null==a?void 0:a.allowDataOverflow)&&void 0!==r?r:bg.allowDataOverflow;return{needClip:o||c,needClipX:o,needClipY:c}}function GP(e){var{xAxisId:t,yAxisId:r,clipPathId:i}=e,a=DP(),{needClipX:o,needClipY:c,needClip:l}=XP(t,r);if(!l||!a)return null;var{x:u,y:s,width:f,height:d}=a;return n.createElement("clipPath",{id:"clipPath-".concat(i)},n.createElement("rect",{x:o?u:u-f/2,y:c?s:s-d/2,width:o?f:2*f,height:c?d:2*d}))}var ZP=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle"]);function QP(e,t){return null==e&&null==t||("number"==typeof e&&"number"==typeof t?e===t||e!=e&&t!=t:e===t)}function JP(e,t){var n=new Set([...Object.keys(e),...Object.keys(t)]);for(var r of n)if(ZP.has(r)){if(null==e[r]&&null==t[r])continue;if(!o(e[r],t[r]))return!1}else if(!QP(e[r],t[r]))return!1;return!0}var eA,tA,nA,rA,iA=e=>{var{chartData:t}=e,r=pr(),i=tc();return n.useEffect(()=>i?()=>{}:(r(zx(t)),()=>{r(zx(void 0))}),[t,r,i]),null},aA={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},oA=Ia({name:"brush",initialState:aA,reducers:{setBrushSettings:(e,t)=>null==t.payload?aA:t.payload}}),{setBrushSettings:cA}=oA.actions,lA=oA.reducer;class uA{static create(e){return new uA(e)}constructor(e){this.scale=e}get domain(){return this.scale.domain}get range(){return this.scale.range}get rangeMin(){return this.range()[0]}get rangeMax(){return this.range()[1]}get bandwidth(){return this.scale.bandwidth}apply(e){var{bandAware:t,position:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(void 0!==e){if(n)switch(n){case"start":default:return this.scale(e);case"middle":var r=this.bandwidth?this.bandwidth()/2:0;return this.scale(e)+r;case"end":var i=this.bandwidth?this.bandwidth():0;return this.scale(e)+i}if(t){var a=this.bandwidth?this.bandwidth()/2:0;return this.scale(e)+a}return this.scale(e)}}isInRange(e){var t=this.range(),n=t[0],r=t[t.length-1];return n<=r?e>=n&&e<=r:e>=r&&e<=n}}eA=uA,nA=1e-4,rA=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(tA="EPS","string"),(tA="symbol"==typeof rA?rA:rA+"")in eA?Object.defineProperty(eA,tA,{value:nA,enumerable:!0,configurable:!0,writable:!0}):eA[tA]=nA;var sA=Ia({name:"referenceElements",initialState:{dots:[],areas:[],lines:[]},reducers:{addDot:(e,t)=>{e.dots.push(t.payload)},removeDot:(e,t)=>{var n=da(e).dots.findIndex(e=>e===t.payload);-1!==n&&e.dots.splice(n,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var n=da(e).areas.findIndex(e=>e===t.payload);-1!==n&&e.areas.splice(n,1)},addLine:(e,t)=>{e.lines.push(t.payload)},removeLine:(e,t)=>{var n=da(e).lines.findIndex(e=>e===t.payload);-1!==n&&e.lines.splice(n,1)}}}),{addDot:fA,removeDot:dA,addArea:hA,removeArea:pA,addLine:yA,removeLine:vA}=sA.actions,gA=sA.reducer,mA=n.createContext(void 0),bA=e=>{var{children:t}=e,[r]=n.useState("".concat(it("recharts"),"-clip")),i=DP();if(null==i)return null;var{x:a,y:o,width:c,height:l}=i;return n.createElement(mA.Provider,{value:r},n.createElement("defs",null,n.createElement("clipPath",{id:r},n.createElement("rect",{x:a,y:o,height:l,width:c}))),t)};function wA(e,t){if(t<1)return[];if(1===t)return e;for(var n=[],r=0;re*i)return!1;var a=n();return e*(t-e*a/2-r)>=0&&e*(t+e*a/2-i)<=0}function OA(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function _A(e){for(var t=1;t{var i="function"==typeof s?s(e.value,r):e.value;return"width"===p?function(e,t,n){return function(e){var{width:t,height:n}=e,r=function(e){return(e%180+180)%180}(arguments.length>1&&void 0!==arguments[1]?arguments[1]:0),i=r*Math.PI/180,a=Math.atan(n/t),o=i>a&&i=2?Qe(a[1].coordinate-a[0].coordinate):1,m=function(e,t,n){var r="width"===n,{x:i,y:a,width:o,height:c}=e;return 1===t?{start:r?i:a,end:r?i+o:a+c}:{start:r?i+o:a+c,end:r?i:a}}(o,g,p);return"equidistantPreserveStart"===u?function(e,t,n,r,i){for(var a,o=(r||[]).slice(),{start:c,end:l}=t,u=0,s=1,f=c,d=function(){var t=null==r?void 0:r[u];if(void 0===t)return{v:wA(r,s)};var a,o=u,d=()=>(void 0===a&&(a=n(t,o)),a),h=t.coordinate,p=0===u||xA(e,h,d,f,l);p||(u=0,f=c,s+=1),p&&(f=h+e*(d()/2+i),u+=s)};s<=o.length;)if(a=d())return a.v;return[]}(g,m,v,a,c):(h="preserveStart"===u||"preserveStartEnd"===u?function(e,t,n,r,i,a){var o=(r||[]).slice(),c=o.length,{start:l,end:u}=t;if(a){var s=r[c-1],f=n(s,c-1),d=e*(s.coordinate+e*f/2-u);o[c-1]=s=_A(_A({},s),{},{tickCoord:d>0?s.coordinate-d*e:s.coordinate}),null!=s.tickCoord&&xA(e,s.tickCoord,()=>f,l,u)&&(u=s.tickCoord-e*(f/2+i),o[c-1]=_A(_A({},s),{},{isShow:!0}))}for(var h=a?c-1:c,p=function(t){var r,a=o[t],c=()=>(void 0===r&&(r=n(a,t)),r);if(0===t){var s=e*(a.coordinate-e*c()/2-l);o[t]=a=_A(_A({},a),{},{tickCoord:s<0?a.coordinate-s*e:a.coordinate})}else o[t]=a=_A(_A({},a),{},{tickCoord:a.coordinate});null!=a.tickCoord&&xA(e,a.tickCoord,c,l,u)&&(l=a.tickCoord+e*(c()/2+i),o[t]=_A(_A({},a),{},{isShow:!0}))},y=0;y(void 0===r&&(r=n(u,t)),r);if(t===o-1){var f=e*(u.coordinate+e*s()/2-l);a[t]=u=_A(_A({},u),{},{tickCoord:f>0?u.coordinate-f*e:u.coordinate})}else a[t]=u=_A(_A({},u),{},{tickCoord:u.coordinate});null!=u.tickCoord&&xA(e,u.tickCoord,s,c,l)&&(l=u.tickCoord-e*(s()/2+i),a[t]=_A(_A({},u),{},{isShow:!0}))},s=o-1;s>=0;s--)u(s);return a}(g,m,v,a,c),h.filter(e=>e.isShow))}var EA=["axisLine","width","height","className","hide","ticks","axisType"];function jA(){return jA=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{ticks:r=[],tick:i,tickLine:a,stroke:o,tickFormatter:c,unit:l,padding:u,tickTextProps:f,orientation:h,mirror:p,x:y,y:m,width:b,height:w,tickSize:x,tickMargin:O,fontSize:_,letterSpacing:A,getTicksConfig:E,events:j,axisType:S}=e,k=AA(kA(kA({},E),{},{ticks:r}),_,A),M=function(e,t){switch(e){case"left":return t?"start":"end";case"right":return t?"end":"start";default:return"middle"}}(h,p),C=function(e,t){switch(e){case"left":case"right":return"middle";case"top":return t?"start":"end";default:return t?"end":"start"}}(h,p),T=v(E),I=g(i),D={};"object"==typeof a&&(D=a);var N=kA(kA({},T),{},{fill:"none"},D),z=k.map(e=>kA({entry:e},function(e,t,n,r,i,a,o,c,l){var u,s,f,d,h,p,y=c?-1:1,v=e.tickSize||o,g=tt(e.tickCoord)?e.tickCoord:e.coordinate;switch(a){case"top":u=s=e.coordinate,p=(f=(d=n+ +!c*i)-y*v)-y*l,h=g;break;case"left":f=d=e.coordinate,h=(u=(s=t+ +!c*r)-y*v)-y*l,p=g;break;case"right":f=d=e.coordinate,h=(u=(s=t+ +c*r)+y*v)+y*l,p=g;break;default:u=s=e.coordinate,p=(f=(d=n+ +c*i)+y*v)+y*l,h=g}return{line:{x1:u,y1:f,x2:s,y2:d},tick:{x:h,y:p}}}(e,y,m,b,w,h,x,p,O))),L=z.map(e=>{var{entry:t,line:r}=e;return n.createElement(P,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(t.value,"-").concat(t.coordinate,"-").concat(t.tickCoord)},a&&n.createElement("line",jA({},N,r,{className:s("recharts-cartesian-axis-tick-line",Ze(a,"className"))})))}),R=z.map((e,t)=>{var{entry:r,tick:a}=e,s=kA(kA(kA(kA({textAnchor:M,verticalAnchor:C},T),{},{stroke:"none",fill:o},I),a),{},{index:t,payload:r,visibleTicksCount:k.length,tickFormatter:c,padding:u},f);return n.createElement(P,jA({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(r.value,"-").concat(r.coordinate,"-").concat(r.tickCoord)},((e,t,n)=>{if(null===e||"object"!=typeof e&&"function"!=typeof e)return null;var r=null;return Object.keys(e).forEach(i=>{var a=e[i];d(i)&&"function"==typeof a&&(r||(r={}),r[i]=((e,t,n)=>r=>(e(t,n,r),null))(a,t,n))}),r})(j,r,t)),i&&n.createElement(IA,{option:i,tickProps:s,value:"".concat("function"==typeof c?c(r.value,t):r.value).concat(l||"")}))});return n.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(S,"-ticks")},R.length>0&&n.createElement(yx,{zIndex:zv.label},n.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(S,"-tick-labels"),ref:t},R)),L.length>0&&n.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(S,"-tick-lines")},L))}),NA=n.forwardRef((e,t)=>{var{axisLine:r,width:i,height:a,className:o,hide:c,ticks:l,axisType:u}=e,f=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r({getCalculatedWidth:()=>{var t;return(e=>{var{ticks:t,label:n,labelGapWithTick:r=5,tickSize:i=0,tickMargin:a=0}=e,o=0;if(t){Array.from(t).forEach(e=>{if(e){var t=e.getBoundingClientRect();t.width>o&&(o=t.width)}});var c=n?n.getBoundingClientRect().width:0,l=o+(i+a)+c+(n?r:0);return Math.round(l)}return 0})({ticks:g.current,label:null===(t=e.labelRef)||void 0===t?void 0:t.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin})}}));var m=n.useCallback(e=>{if(e){var t=e.getElementsByClassName("recharts-cartesian-axis-tick-value");g.current=t;var n=t[0];if(n){var r=window.getComputedStyle(n),i=r.fontSize,a=r.letterSpacing;i===d&&a===p||(h(i),y(a))}}},[d,p]);return c||null!=i&&i<=0||null!=a&&a<=0?null:n.createElement(yx,{zIndex:e.zIndex},n.createElement(P,{className:s("recharts-cartesian-axis",o)},n.createElement(TA,{x:e.x,y:e.y,width:i,height:a,orientation:e.orientation,mirror:e.mirror,axisLine:r,otherSvgProps:v(e)}),n.createElement(DA,{ref:m,axisType:u,events:f,fontSize:d,getTicksConfig:e,height:e.height,letterSpacing:p,mirror:e.mirror,orientation:e.orientation,padding:e.padding,stroke:e.stroke,tick:e.tick,tickFormatter:e.tickFormatter,tickLine:e.tickLine,tickMargin:e.tickMargin,tickSize:e.tickSize,tickTextProps:e.tickTextProps,ticks:l,unit:e.unit,width:e.width,x:e.x,y:e.y}),n.createElement(LO,{x:e.x,y:e.y,width:e.width,height:e.height,lowerWidth:e.width,upperWidth:e.width},n.createElement($O,{label:e.label,labelRef:e.labelRef}),e.children)))}),zA=n.forwardRef((e,t)=>{var r=At(e,CA);return n.createElement(NA,jA({},r,{ref:t}))});zA.displayName="CartesianAxis";var LA=["x1","y1","x2","y2","key"],RA=["offset"],BA=["xAxisId","yAxisId"],KA=["xAxisId","yAxisId"];function FA(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function UA(e){for(var t=1;t{var{fill:t}=e;if(!t||"none"===t)return null;var{fillOpacity:r,x:i,y:a,width:o,height:c,ry:l}=e;return n.createElement("rect",{x:i,y:a,ry:l,width:o,height:c,stroke:"none",fill:t,fillOpacity:r,className:"recharts-cartesian-grid-bg"})};function qA(e){var t,{option:r,lineItemProps:i}=e;if(n.isValidElement(r))t=n.cloneElement(r,i);else if("function"==typeof r)t=r(i);else{var a,{x1:o,y1:c,x2:l,y2:u,key:s}=i,f=null!==(a=v(HA(i,LA)))&&void 0!==a?a:{},{offset:d}=f,h=HA(f,RA);t=n.createElement("line",$A({},h,{x1:o,y1:c,x2:l,y2:u,fill:"none",key:s}))}return t}function YA(e){var{x:t,width:r,horizontal:i=!0,horizontalPoints:a}=e;if(!i||!a||!a.length)return null;var{xAxisId:o,yAxisId:c}=e,l=HA(e,BA),u=a.map((e,a)=>{var o=UA(UA({},l),{},{x1:t,y1:e,x2:t+r,y2:e,key:"line-".concat(a),index:a});return n.createElement(qA,{key:"line-".concat(a),option:i,lineItemProps:o})});return n.createElement("g",{className:"recharts-cartesian-grid-horizontal"},u)}function XA(e){var{y:t,height:r,vertical:i=!0,verticalPoints:a}=e;if(!i||!a||!a.length)return null;var{xAxisId:o,yAxisId:c}=e,l=HA(e,KA),u=a.map((e,a)=>{var o=UA(UA({},l),{},{x1:e,y1:t,x2:e,y2:t+r,key:"line-".concat(a),index:a});return n.createElement(qA,{option:i,lineItemProps:o,key:"line-".concat(a)})});return n.createElement("g",{className:"recharts-cartesian-grid-vertical"},u)}function GA(e){var{horizontalFill:t,fillOpacity:r,x:i,y:a,width:o,height:c,horizontalPoints:l,horizontal:u=!0}=e;if(!u||!t||!t.length||null==l)return null;var s=l.map(e=>Math.round(e+a-a)).sort((e,t)=>e-t);a!==s[0]&&s.unshift(0);var f=s.map((e,l)=>{var u=s[l+1]?s[l+1]-e:a+c-e;if(u<=0)return null;var f=l%t.length;return n.createElement("rect",{key:"react-".concat(l),y:e,x:i,height:u,width:o,stroke:"none",fill:t[f],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return n.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},f)}function ZA(e){var{vertical:t=!0,verticalFill:r,fillOpacity:i,x:a,y:o,width:c,height:l,verticalPoints:u}=e;if(!t||!r||!r.length)return null;var s=u.map(e=>Math.round(e+a-a)).sort((e,t)=>e-t);a!==s[0]&&s.unshift(0);var f=s.map((e,t)=>{var u=s[t+1]?s[t+1]-e:a+c-e;if(u<=0)return null;var f=t%r.length;return n.createElement("rect",{key:"react-".concat(t),x:e,y:o,width:u,height:l,stroke:"none",fill:r[f],fillOpacity:i,className:"recharts-cartesian-grid-bg"})});return n.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},f)}var QA=(e,t)=>{var{xAxis:n,width:r,height:i,offset:a}=e;return Ao(AA(UA(UA(UA({},CA),n),{},{ticks:Eo(n),viewBox:{x:0,y:0,width:r,height:i}})),a.left,a.left+a.width,t)},JA=(e,t)=>{var{yAxis:n,width:r,height:i,offset:a}=e;return Ao(AA(UA(UA(UA({},CA),n),{},{ticks:Eo(n),viewBox:{x:0,y:0,width:r,height:i}})),a.top,a.top+a.height,t)},eE={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:zv.grid};function tE(e){var t=Ic(),r=Dc(),i=Tc(),a=UA(UA({},At(e,eE)),{},{x:tt(e.x)?e.x:i.left,y:tt(e.y)?e.y:i.top,width:tt(e.width)?e.width:i.width,height:tt(e.height)?e.height:i.height}),{xAxisId:o,yAxisId:c,x:l,y:u,width:s,height:f,syncWithTicks:d,horizontalValues:h,verticalValues:p}=a,y=tc(),v=mr(e=>ib(e,"xAxis",o,y)),g=mr(e=>ib(e,"yAxis",c,y));if(!(bc(s)&&bc(f)&&tt(l)&&tt(u)))return null;var m=a.verticalCoordinatesGenerator||QA,b=a.horizontalCoordinatesGenerator||JA,{horizontalPoints:w,verticalPoints:x}=a;if(!(w&&w.length||"function"!=typeof b)){var O=h&&h.length,_=b({yAxis:g?UA(UA({},g),{},{ticks:O?h:g.ticks}):void 0,width:null!=t?t:s,height:null!=r?r:f,offset:i},!!O||d);fc(Array.isArray(_),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof _,"]")),Array.isArray(_)&&(w=_)}if(!(x&&x.length||"function"!=typeof m)){var P=p&&p.length,A=m({xAxis:v?UA(UA({},v),{},{ticks:P?p:v.ticks}):void 0,width:null!=t?t:s,height:null!=r?r:f,offset:i},!!P||d);fc(Array.isArray(A),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof A,"]")),Array.isArray(A)&&(x=A)}return n.createElement(yx,{zIndex:a.zIndex},n.createElement("g",{className:"recharts-cartesian-grid"},n.createElement(VA,{fill:a.fill,fillOpacity:a.fillOpacity,x:a.x,y:a.y,width:a.width,height:a.height,ry:a.ry}),n.createElement(GA,$A({},a,{horizontalPoints:w})),n.createElement(ZA,$A({},a,{verticalPoints:x})),n.createElement(YA,$A({},a,{offset:i,horizontalPoints:w,xAxis:v,yAxis:g})),n.createElement(XA,$A({},a,{offset:i,verticalPoints:x,xAxis:v,yAxis:g}))))}tE.displayName="CartesianGrid";var nE=(e,t,n,r)=>cb(e,"xAxis",t,r),rE=(e,t,n,r)=>ob(e,"xAxis",t,r),iE=(e,t,n,r)=>cb(e,"yAxis",n,r),aE=(e,t,n,r)=>ob(e,"yAxis",n,r),oE=Ar([Nc,nE,iE,rE,aE],(e,t,n,r,i)=>Po(e,"xAxis")?Io(t,r,!1):Io(n,i,!1));function cE(e){return"line"===e.type}var lE=Ar([Sg,(e,t,n,r,i)=>i],(e,t)=>e.filter(cE).find(e=>e.id===t)),uE=Ar([Nc,nE,iE,rE,aE,lE,oE,Ly],(e,t,n,r,i,a,o,c)=>{var{chartData:l,dataStartIndex:u,dataEndIndex:s}=c;if(null!=a&&null!=t&&null!=n&&null!=r&&null!=i&&0!==r.length&&0!==i.length&&null!=o&&("horizontal"===e||"vertical"===e)){var f,{dataKey:d,data:h}=a;if(null!=(f=null!=h&&h.length>0?h:null==l?void 0:l.slice(u,s+1)))return function(e){var{layout:t,xAxis:n,yAxis:r,xAxisTicks:i,yAxisTicks:a,dataKey:o,bandSize:c,displayedData:l}=e;return l.map((e,l)=>{var u=_o(e,o);if("horizontal"===t)return{x:Mo({axis:n,ticks:i,bandSize:c,entry:e,index:l}),y:ut(u)?null:r.scale(u),value:u,payload:e};var s=ut(u)?null:n.scale(u),f=Mo({axis:r,ticks:a,bandSize:c,entry:e,index:l});return null==s||null==f?null:{x:s,y:f,value:u,payload:e}}).filter(Boolean)}({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataKey:d,bandSize:o,displayedData:f})}});function sE(e){var t=g(e);if(null!=t){var{r:n,strokeWidth:r}=t,i=Number(n),a=Number(r);return(Number.isNaN(i)||i<0)&&(i=3),(Number.isNaN(a)||a<0)&&(a=2),{r:i,strokeWidth:a}}return{r:3,strokeWidth:2}}var fE=["id"],dE=["type","layout","connectNulls","needClip","shape"],hE=["activeDot","animateNewValues","animationBegin","animationDuration","animationEasing","connectNulls","dot","hide","isAnimationActive","label","legendType","xAxisId","yAxisId","id"];function pE(){return pE=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{dataKey:t,name:n,stroke:r,legendType:i,hide:a}=e;return[{inactive:a,dataKey:t,type:i,color:r,value:No(n,t),payload:e}]},wE=n.memo(e=>{var{dataKey:t,data:r,stroke:i,strokeWidth:a,fill:o,name:c,hide:l,unit:u,tooltipType:s}=e,f={dataDefinedOnItem:r,positions:void 0,settings:{stroke:i,strokeWidth:a,fill:o,dataKey:t,nameKey:void 0,name:No(c,t),hide:l,type:s,color:i,unit:u}};return n.createElement(X_,{tooltipEntrySettings:f})}),xE=(e,t)=>"".concat(t,"px ").concat(e-t,"px");function OE(e,t){for(var n=e.length%2!=0?[...e,0]:e,r=[],i=0;inull==i?void 0:i.map(e=>{var t,n,r={x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0,width:0,lowerWidth:0,upperWidth:0,height:0};return vE(vE({},r),{},{value:e.value,payload:e.payload,viewBox:r,parentViewBox:void 0,fill:void 0})}),[i]);return n.createElement(u_,{value:t?a:void 0},r)}function AE(e){var{clipPathId:t,pathRef:r,points:i,strokeDasharray:a,props:o}=e,{type:c,layout:l,connectNulls:u,needClip:s,shape:f}=o,d=vE(vE({},m(mE(o,dE))),{},{fill:"none",className:"recharts-line-curve",clipPath:s?"url(#clipPath-".concat(t,")"):void 0,points:i,type:c,layout:l,connectNulls:u,strokeDasharray:null!=a?a:o.strokeDasharray});return n.createElement(n.Fragment,null,(null==i?void 0:i.length)>1&&n.createElement(Y_,pE({shapeType:"curve",option:f},d,{pathRef:r})),n.createElement(_E,{points:i,clipPathId:t,props:o}))}function EE(e){var{clipPathId:t,props:r,pathRef:i,previousPointsRef:a,longestAnimatedLengthRef:o}=e,{points:c,strokeDasharray:l,isAnimationActive:u,animationBegin:s,animationDuration:f,animationEasing:d,animateNewValues:h,width:p,height:y,onAnimationEnd:v,onAnimationStart:g}=r,m=a.current,b=Lu(c,"recharts-line-"),w=n.useRef(b),[x,O]=n.useState(!1),_=!x,P=n.useCallback(()=>{"function"==typeof v&&v(),O(!1)},[v]),A=n.useCallback(()=>{"function"==typeof g&&g(),O(!0)},[g]),E=function(e){try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch(t){return 0}}(i.current),j=n.useRef(0);w.current!==b&&(j.current=o.current,w.current=b);var S=j.current;return n.createElement(PE,{points:c,showLabels:_},r.children,n.createElement(zu,{animationId:b,begin:s,duration:f,isActive:u,easing:d,onAnimationEnd:P,onAnimationStart:A,key:b},e=>{var s,f=ct(S,E+S,e),d=Math.min(f,E);if(u)if(l){var v="".concat(l).split(/[,\s]+/gim).map(e=>parseFloat(e));s=((e,t,n)=>{var r=n.reduce((e,t)=>e+t);if(!r)return xE(t,e);for(var i=Math.floor(e/r),a=e%r,o=t-e,c=[],l=0,u=0;la){c=[...n.slice(0,l),a-u];break}var s=c.length%2==0?[0,o]:[o];return[...OE(n,i),...c,...s].map(e=>"".concat(e,"px")).join(", ")})(d,E,v)}else s=xE(E,d);else s=null==l?void 0:String(l);if(e>0&&E>0&&(a.current=c,o.current=Math.max(o.current,d)),m){var g=m.length/c.length,b=1===e?c:c.map((t,n)=>{var r=Math.floor(n*g);if(m[r]){var i=m[r];return vE(vE({},t),{},{x:ct(i.x,t.x,e),y:ct(i.y,t.y,e)})}return vE(vE({},t),{},h?{x:ct(2*p,t.x,e),y:ct(y/2,t.y,e)}:{x:t.x,y:t.y})});return a.current=b,n.createElement(AE,{props:r,points:b,clipPathId:t,pathRef:i,strokeDasharray:s})}return n.createElement(AE,{props:r,points:c,clipPathId:t,pathRef:i,strokeDasharray:s})}),n.createElement(d_,{label:r.label}))}function jE(e){var{clipPathId:t,props:r}=e,i=n.useRef(null),a=n.useRef(0),o=n.useRef(null);return n.createElement(EE,{props:r,clipPathId:t,previousPointsRef:i,longestAnimatedLengthRef:a,pathRef:o})}var SE=(e,t)=>{var n,r;return{x:null!==(n=e.x)&&void 0!==n?n:void 0,y:null!==(r=e.y)&&void 0!==r?r:void 0,value:e.value,errorVal:_o(e.payload,t)}};class kE extends n.Component{render(){var{hide:e,dot:t,points:r,className:i,xAxisId:a,yAxisId:o,top:c,left:l,width:u,height:f,id:d,needClip:h,zIndex:p}=this.props;if(e)return null;var y=s("recharts-line",i),v=d,{r:g,strokeWidth:m}=sE(t),b=k_(t),w=2*g+m,x=h?"url(#clipPath-".concat(b?"":"dots-").concat(v,")"):void 0;return n.createElement(yx,{zIndex:p},n.createElement(P,{className:y},h&&n.createElement("defs",null,n.createElement(GP,{clipPathId:v,xAxisId:a,yAxisId:o}),!b&&n.createElement("clipPath",{id:"clipPath-dots-".concat(v)},n.createElement("rect",{x:l-w/2,y:c-w/2,width:u+w,height:f+w}))),n.createElement(YP,{xAxisId:a,yAxisId:o,data:r,dataPointFormatter:SE,errorBarOffset:0},n.createElement(jE,{props:this.props,clipPathId:v}))),n.createElement(BP,{activeDot:this.props.activeDot,points:r,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:x}))}}var ME={activeDot:!0,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!0,fill:"#fff",hide:!1,isAnimationActive:"auto",label:!1,legendType:"line",stroke:"#3182bd",strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:zv.line,type:"linear"};function CE(e){var t=At(e,ME),{activeDot:r,animateNewValues:i,animationBegin:a,animationDuration:o,animationEasing:c,connectNulls:l,dot:u,hide:s,isAnimationActive:f,label:d,legendType:h,xAxisId:p,yAxisId:y,id:v}=t,g=mE(t,hE),{needClip:m}=XP(p,y),b=DP(),w=zc(),x=tc(),O=mr(e=>uE(e,p,y,x,v));if("horizontal"!==w&&"vertical"!==w||null==O||null==b)return null;var{height:_,width:P,x:A,y:E}=b;return n.createElement(kE,pE({},g,{id:v,connectNulls:l,dot:u,activeDot:r,animateNewValues:i,animationBegin:a,animationDuration:o,animationEasing:c,isAnimationActive:f,hide:s,label:d,legendType:h,xAxisId:p,yAxisId:y,points:O,layout:w,height:_,width:P,left:A,top:E,needClip:m}))}function TE(e){var t=At(e,ME),r=tc();return n.createElement(eP,{id:t.id,type:"line"},e=>n.createElement(n.Fragment,null,n.createElement(G_,{legendPayload:bE(t)}),n.createElement(wE,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType}),n.createElement(uP,{type:"line",id:e,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:r}),n.createElement(CE,pE({},t,{id:e}))))}var IE=n.memo(TE,JP);IE.displayName="Line";var DE=(e,t,n,r)=>cb(e,"xAxis",t,r),NE=(e,t,n,r)=>ob(e,"xAxis",t,r),zE=(e,t,n,r)=>cb(e,"yAxis",n,r),LE=(e,t,n,r)=>ob(e,"yAxis",n,r),RE=Ar([Nc,DE,zE,NE,LE],(e,t,n,r,i)=>Po(e,"xAxis")?Io(t,r,!1):Io(n,i,!1)),BE=Ar([Sg,(e,t,n,r,i)=>i],(e,t)=>e.filter(e=>"area"===e.type).find(e=>e.id===t)),KE=Ar([Nc,DE,zE,NE,LE,(e,t,n,r,i)=>{var a,o=BE(e,t,n,r,i);if(null!=o){var c,l=Nc(e);if(null!=(c=Po(l,"xAxis")?Xg(e,"yAxis",n,r):Xg(e,"xAxis",t,r))){var{stackId:u}=o,s=ag(o);if(null!=u&&null!=s){var f=null===(a=c[u])||void 0===a?void 0:a.stackedData;return null==f?void 0:f.find(e=>e.key===s)}}}},Ly,RE,BE,e=>e.rootProps.baseValue],(e,t,n,r,i,a,o,c,l,u)=>{var{chartData:s,dataStartIndex:f,dataEndIndex:d}=o;if(null!=l&&("horizontal"===e||"vertical"===e)&&null!=t&&null!=n&&null!=r&&null!=i&&0!==r.length&&0!==i.length&&null!=c){var h,{data:p}=l;if(null!=(h=p&&p.length>0?p:null==s?void 0:s.slice(f,d+1)))return function(e){var t,{areaSettings:{connectNulls:n,baseValue:r,dataKey:i},stackedData:a,layout:o,chartBaseValue:c,xAxis:l,yAxis:u,displayedData:s,dataStartIndex:f,xAxisTicks:d,yAxisTicks:h,bandSize:p}=e,y=a&&a.length,v=lj(o,c,r,l,u),g="horizontal"===o,m=!1,b=s.map((e,t)=>{var r;y?r=a[f+t]:(r=_o(e,i),Array.isArray(r)?m=!0:r=[v,r]);var o=null==r[1]||y&&!n&&null==_o(e,i);return g?{x:Mo({axis:l,ticks:d,bandSize:p,entry:e,index:t}),y:o?null:u.scale(r[1]),value:r,payload:e}:{x:o?null:l.scale(r[1]),y:Mo({axis:u,ticks:h,bandSize:p,entry:e,index:t}),value:r,payload:e}});return t=y||m?b.map(e=>{var t=Array.isArray(e.value)?e.value[0]:null;return g?{x:e.x,y:null!=t&&null!=e.y?u.scale(t):null,payload:e.payload}:{x:null!=t?l.scale(t):null,y:e.y,payload:e.payload}}):g?u.scale(v):l.scale(v),{points:b,baseLine:t,isRange:m}}({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataStartIndex:f,areaSettings:l,stackedData:a,displayedData:h,chartBaseValue:u,bandSize:c})}}),FE=["id"],UE=["activeDot","animationBegin","animationDuration","animationEasing","connectNulls","dot","fill","fillOpacity","hide","isAnimationActive","legendType","stroke","xAxisId","yAxisId"];function WE(){return WE=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{dataKey:t,name:n,stroke:r,fill:i,legendType:a,hide:o}=e;return[{inactive:o,dataKey:t,type:a,color:YE(r,i),value:No(n,t),payload:e}]},GE=n.memo(e=>{var{dataKey:t,data:r,stroke:i,strokeWidth:a,fill:o,name:c,hide:l,unit:u,tooltipType:s}=e,f={dataDefinedOnItem:r,positions:void 0,settings:{stroke:i,strokeWidth:a,fill:o,dataKey:t,nameKey:void 0,name:No(c,t),hide:l,type:s,color:YE(i,o),unit:u}};return n.createElement(X_,{tooltipEntrySettings:f})});function ZE(e){var{clipPathId:t,points:r,props:i}=e,{needClip:a,dot:o,dataKey:c}=i,l=v(i);return n.createElement(vP,{points:r,dot:o,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:c,baseProps:l,needClip:a,clipPathId:t})}function QE(e){var{showLabels:t,children:r,points:i}=e,a=i.map(e=>{var t,n,r={x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0,width:0,lowerWidth:0,upperWidth:0,height:0};return VE(VE({},r),{},{value:e.value,payload:e.payload,parentViewBox:void 0,viewBox:r,fill:void 0})});return n.createElement(u_,{value:t?a:void 0},r)}function JE(e){var{points:t,baseLine:r,needClip:i,clipPathId:a,props:o}=e,{layout:c,type:l,stroke:u,connectNulls:s,isRange:f}=o,{id:d}=o,h=$E(o,FE),p=v(h),y=m(h);return n.createElement(n.Fragment,null,(null==t?void 0:t.length)>1&&n.createElement(P,{clipPath:i?"url(#clipPath-".concat(a,")"):void 0},n.createElement(iu,WE({},y,{id:d,points:t,connectNulls:s,type:l,baseLine:r,layout:c,stroke:"none",className:"recharts-area-area"})),"none"!==u&&n.createElement(iu,WE({},p,{className:"recharts-area-curve",layout:c,type:l,connectNulls:s,fill:"none",points:t})),"none"!==u&&f&&n.createElement(iu,WE({},p,{className:"recharts-area-curve",layout:c,type:l,connectNulls:s,fill:"none",points:r}))),n.createElement(ZE,{points:t,props:h,clipPathId:a}))}function ej(e){var{alpha:t,baseLine:r,points:i,strokeWidth:a}=e,o=i[0].y,c=i[i.length-1].y;if(!mc(o)||!mc(c))return null;var l=t*Math.abs(o-c),u=Math.max(...i.map(e=>e.x||0));return tt(r)?u=Math.max(r,u):r&&Array.isArray(r)&&r.length&&(u=Math.max(...r.map(e=>e.x||0),u)),tt(u)?n.createElement("rect",{x:0,y:oe.y||0));return tt(r)?u=Math.max(r,u):r&&Array.isArray(r)&&r.length&&(u=Math.max(...r.map(e=>e.y||0),u)),tt(u)?n.createElement("rect",{x:o({points:c,baseLine:l}),[c,l]),"recharts-area-"),v=(()=>{var e=zc();if("horizontal"===e||"vertical"===e)return e})(),[g,m]=n.useState(!1),b=!g,w=n.useCallback(()=>{"function"==typeof p&&p(),m(!1)},[p]),x=n.useCallback(()=>{"function"==typeof h&&h(),m(!0)},[h]);if(null==v)return null;var O=a.current,_=o.current;return n.createElement(QE,{showLabels:b,points:c},i.children,n.createElement(zu,{animationId:y,begin:s,duration:f,isActive:u,easing:d,onAnimationEnd:w,onAnimationStart:x,key:y},e=>{if(O){var s,f=O.length/c.length,d=1===e?c:c.map((t,n)=>{var r=Math.floor(n*f);if(O[r]){var i=O[r];return VE(VE({},t),{},{x:ct(i.x,t.x,e),y:ct(i.y,t.y,e)})}return t});return s=tt(l)?ct(_,l,e):ut(l)||Je(l)?ct(_,0,e):l.map((t,n)=>{var r=Math.floor(n*f);if(Array.isArray(_)&&_[r]){var i=_[r];return VE(VE({},t),{},{x:ct(i.x,t.x,e),y:ct(i.y,t.y,e)})}return t}),e>0&&(a.current=d,o.current=s),n.createElement(JE,{points:d,baseLine:s,needClip:t,clipPathId:r,props:i})}return e>0&&(a.current=c,o.current=l),n.createElement(P,null,u&&n.createElement("defs",null,n.createElement("clipPath",{id:"animationClipPath-".concat(r)},n.createElement(nj,{alpha:e,points:c,baseLine:l,layout:v,strokeWidth:i.strokeWidth}))),n.createElement(P,{clipPath:"url(#animationClipPath-".concat(r,")")},n.createElement(JE,{points:c,baseLine:l,needClip:t,clipPathId:r,props:i})))}),n.createElement(d_,{label:i.label}))}function ij(e){var{needClip:t,clipPathId:r,props:i}=e,a=n.useRef(null),o=n.useRef();return n.createElement(rj,{needClip:t,clipPathId:r,props:i,previousPointsRef:a,previousBaselineRef:o})}class aj extends n.PureComponent{render(){var{hide:e,dot:t,points:r,className:i,top:a,left:o,needClip:c,xAxisId:l,yAxisId:u,width:f,height:d,id:h,baseLine:p,zIndex:y}=this.props;if(e)return null;var v=s("recharts-area",i),g=h,{r:m,strokeWidth:b}=sE(t),w=k_(t),x=2*m+b,O=c?"url(#clipPath-".concat(w?"":"dots-").concat(g,")"):void 0;return n.createElement(yx,{zIndex:y},n.createElement(P,{className:v},c&&n.createElement("defs",null,n.createElement(GP,{clipPathId:g,xAxisId:l,yAxisId:u}),!w&&n.createElement("clipPath",{id:"clipPath-dots-".concat(g)},n.createElement("rect",{x:o-x/2,y:a-x/2,width:f+x,height:d+x}))),n.createElement(ij,{needClip:c,clipPathId:g,props:this.props})),n.createElement(BP,{points:r,mainColor:YE(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:O}),this.props.isRange&&Array.isArray(p)&&n.createElement(BP,{points:p,mainColor:YE(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:O}))}}var oj={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!1,fill:"#3182bd",fillOpacity:.6,hide:!1,isAnimationActive:"auto",legendType:"line",stroke:"#3182bd",strokeWidth:1,type:"linear",label:!1,xAxisId:0,yAxisId:0,zIndex:zv.area};function cj(e){var t,r=At(e,oj),{activeDot:i,animationBegin:a,animationDuration:o,animationEasing:c,connectNulls:l,dot:u,fill:s,fillOpacity:f,hide:d,isAnimationActive:h,legendType:p,stroke:y,xAxisId:v,yAxisId:g}=r,m=$E(r,UE),b=zc(),w=Ww(),{needClip:x}=XP(v,g),O=tc(),{points:_,isRange:P,baseLine:A}=null!==(t=mr(t=>KE(t,v,g,O,e.id)))&&void 0!==t?t:{},E=DP();if("horizontal"!==b&&"vertical"!==b||null==E)return null;if("AreaChart"!==w&&"ComposedChart"!==w)return null;var{height:j,width:S,x:k,y:M}=E;return _&&_.length?n.createElement(aj,WE({},m,{activeDot:i,animationBegin:a,animationDuration:o,animationEasing:c,baseLine:A,connectNulls:l,dot:u,fill:s,fillOpacity:f,height:j,hide:d,layout:b,isAnimationActive:"auto"===h?!Tu:h,isRange:P,legendType:p,needClip:x,points:_,stroke:y,width:S,left:k,top:M,xAxisId:v,yAxisId:g})):null}var lj=(e,t,n,r,i)=>{var a=null!=n?n:t;if(tt(a))return a;var o="horizontal"===e?i:r,c=o.scale.domain();if("number"===o.type){var l=Math.max(c[0],c[1]),u=Math.min(c[0],c[1]);return"dataMin"===a?u:"dataMax"===a||l<0?l:Math.max(Math.min(c[0],c[1]),0)}return"dataMin"===a?c[0]:"dataMax"===a?c[1]:c[0]};function uj(e){var t=At(e,oj),r=tc();return n.createElement(eP,{id:t.id,type:"area"},e=>{return n.createElement(n.Fragment,null,n.createElement(G_,{legendPayload:XE(t)}),n.createElement(GE,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType}),n.createElement(uP,{type:"area",id:e,data:t.data,dataKey:t.dataKey,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,stackId:(i=t.stackId,null==i?void 0:String(i)),hide:t.hide,barSize:void 0,baseValue:t.baseValue,isPanorama:r,connectNulls:t.connectNulls}),n.createElement(cj,WE({},t,{id:e})));var i})}var sj=n.memo(uj,JP);sj.displayName="Area";var fj=["domain","range"],dj=["domain","range"];function hj(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{null===r.current?t(xP(e)):r.current!==e&&t(OP({prev:r.current,next:e})),r.current=e},[e,t]),n.useLayoutEffect(()=>()=>{r.current&&(t(_P(r.current)),r.current=null)},[t]),null}var xj=e=>{var{xAxisId:t,className:r}=e,i=mr(Jo),a=tc(),o="xAxis",c=mr(e=>Fm(e,o,t,a)),l=mr(e=>ab(e,o,t,a)),u=mr(e=>Ym(e,t)),f=mr(e=>Zm(e,t)),d=mr(e=>gg(e,t));if(null==u||null==f||null==d)return null;var{dangerouslySetInnerHTML:h,ticks:p}=e,y=bj(e,vj),{id:v}=d,g=bj(d,gj);return n.createElement(zA,mj({},y,g,{scale:c,x:f.x,y:f.y,width:u.width,height:u.height,className:s("recharts-".concat(o," ").concat(o),r),viewBox:i,ticks:l,axisType:o}))},Oj={allowDataOverflow:vg.allowDataOverflow,allowDecimals:vg.allowDecimals,allowDuplicatedCategory:vg.allowDuplicatedCategory,angle:vg.angle,axisLine:CA.axisLine,height:vg.height,hide:!1,includeHidden:vg.includeHidden,interval:vg.interval,minTickGap:vg.minTickGap,mirror:vg.mirror,orientation:vg.orientation,padding:vg.padding,reversed:vg.reversed,scale:vg.scale,tick:vg.tick,tickCount:vg.tickCount,tickLine:CA.tickLine,tickSize:CA.tickSize,type:vg.type,xAxisId:0},_j=e=>{var t=At(e,Oj);return n.createElement(n.Fragment,null,n.createElement(wj,{allowDataOverflow:t.allowDataOverflow,allowDecimals:t.allowDecimals,allowDuplicatedCategory:t.allowDuplicatedCategory,angle:t.angle,dataKey:t.dataKey,domain:t.domain,height:t.height,hide:t.hide,id:t.xAxisId,includeHidden:t.includeHidden,interval:t.interval,minTickGap:t.minTickGap,mirror:t.mirror,name:t.name,orientation:t.orientation,padding:t.padding,reversed:t.reversed,scale:t.scale,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit}),n.createElement(xj,t))},Pj=n.memo(_j,yj);Pj.displayName="XAxis";var Aj=["dangerouslySetInnerHTML","ticks"],Ej=["id"];function jj(){return jj=Object.assign?Object.assign.bind():function(e){for(var t=1;t{null===r.current?t(PP(e)):r.current!==e&&t(AP({prev:r.current,next:e})),r.current=e},[e,t]),n.useLayoutEffect(()=>()=>{r.current&&(t(EP(r.current)),r.current=null)},[t]),null}var Mj=e=>{var{yAxisId:t,className:r,width:i,label:a}=e,o=n.useRef(null),c=n.useRef(null),l=mr(Jo),u=tc(),f=pr(),d="yAxis",h=mr(e=>Fm(e,d,t,u)),p=mr(e=>Jm(e,t)),y=mr(e=>Qm(e,t)),v=mr(e=>ab(e,d,t,u)),g=mr(e=>wg(e,t));if(n.useLayoutEffect(()=>{if("auto"===i&&p&&!KO(a)&&!n.isValidElement(a)&&null!=g){var e=o.current;if(e){var r=e.getCalculatedWidth();Math.round(p.width)!==Math.round(r)&&f(MP({id:t,width:r}))}}},[v,p,f,a,t,i,g]),null==p||null==y||null==g)return null;var{dangerouslySetInnerHTML:m,ticks:b}=e,w=Sj(e,Aj),{id:x}=g,O=Sj(g,Ej);return n.createElement(zA,jj({},w,O,{ref:o,labelRef:c,scale:h,x:y.x,y:y.y,tickTextProps:"auto"===i?{width:void 0}:{width:i},width:p.width,height:p.height,className:s("recharts-".concat(d," ").concat(d),r),viewBox:l,ticks:v,axisType:d}))},Cj={allowDataOverflow:bg.allowDataOverflow,allowDecimals:bg.allowDecimals,allowDuplicatedCategory:bg.allowDuplicatedCategory,angle:bg.angle,axisLine:CA.axisLine,hide:!1,includeHidden:bg.includeHidden,interval:bg.interval,minTickGap:bg.minTickGap,mirror:bg.mirror,orientation:bg.orientation,padding:bg.padding,reversed:bg.reversed,scale:bg.scale,tick:bg.tick,tickCount:bg.tickCount,tickLine:CA.tickLine,tickSize:CA.tickSize,type:bg.type,width:bg.width,yAxisId:0},Tj=e=>{var t=At(e,Cj);return n.createElement(n.Fragment,null,n.createElement(kj,{interval:t.interval,id:t.yAxisId,scale:t.scale,type:t.type,domain:t.domain,allowDataOverflow:t.allowDataOverflow,dataKey:t.dataKey,allowDuplicatedCategory:t.allowDuplicatedCategory,allowDecimals:t.allowDecimals,tickCount:t.tickCount,padding:t.padding,includeHidden:t.includeHidden,reversed:t.reversed,ticks:t.ticks,width:t.width,orientation:t.orientation,mirror:t.mirror,hide:t.hide,unit:t.unit,name:t.name,angle:t.angle,minTickGap:t.minTickGap,tick:t.tick,tickFormatter:t.tickFormatter}),n.createElement(Mj,t))},Ij=n.memo(Tj,yj);Ij.displayName="YAxis";var Dj={begin:0,duration:1e3,easing:"ease",isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}};function Nj(e){var t=At(e,Dj),{animationId:r,from:i,to:a,attributeName:o,isActive:c,canBegin:l,duration:u,easing:s,begin:f,onAnimationEnd:d,onAnimationStart:h,children:p}=t,y="auto"===c?!Tu:c,v=Cu(r+o,t.animationManager),[g,m]=n.useState(()=>y?i:a),b=n.useRef(!1),w=n.useCallback(()=>{m(i),h()},[i,h]);return n.useEffect(()=>{if(!y||!l)return dt;b.current=!0;var e=v.subscribe(m);return v.start([w,f,a,u,d]),()=>{v.stop(),e&&e(),d()}},[y,l,u,s,f,w,d,v,a,i]),y?l?b.current?p({transition:pu([o],u,s),[o]:g}):p({[o]:i}):p({[o]:i}):p({[o]:a})}var zj=Ar([(e,t)=>t,Nc,ng,sg,mw,Ow,qw,Zo],(e,t,n,r,i,a,o,c)=>{if(e&&t&&r&&i&&a)return"horizontal"===t||"vertical"===t?((e,t,n,r,i,a,o)=>{if(e&&n&&r&&i&&function(e,t){var{chartX:n,chartY:r}=e;return n>=t.left&&n<=t.left+t.width&&r>=t.top&&r<=t.top+t.height}(e,o)){var c=((e,t)=>"horizontal"===t?e.chartX:"vertical"===t?e.chartY:void 0)(e,t),l=Uw(c,a,i,n,r),u=((e,t,n,r)=>{var i=t.find(e=>e&&e.index===n);if(i){if("horizontal"===e)return{x:i.coordinate,y:r.chartY};if("vertical"===e)return{x:r.chartX,y:i.coordinate}}return{x:0,y:0}})(t,i,l,e);return{activeIndex:String(l),activeCoordinate:u}}})(e,t,r,i,a,o,c):((e,t,n,r,i,a,o)=>{if(e&&r&&i&&a&&n){var c=ts(e,n);if(c){var l=((e,t)=>"centric"===t?e.angle:e.radius)(c,t),u=Uw(l,o,a,r,i),s=((e,t,n,r)=>{var i=t.find(e=>e&&e.index===n);if(i){if("centric"===e){var a=i.coordinate,{radius:o}=r;return Kw(Kw(Kw({},r),Ju(r.cx,r.cy,o,a)),{},{angle:a,radius:o})}var c=i.coordinate,{angle:l}=r;return Kw(Kw(Kw({},r),Ju(r.cx,r.cy,c,l)),{},{angle:l,radius:c})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}})(t,a,u,c);return{activeIndex:String(u),activeCoordinate:s}}}})(e,t,n,r,i,a,o)}),Lj=e=>{var t=e.currentTarget.getBoundingClientRect(),n=t.width/e.currentTarget.offsetWidth,r=t.height/e.currentTarget.offsetHeight;return{chartX:Math.round((e.clientX-t.left)/n),chartY:Math.round((e.clientY-t.top)/r)}},Rj=ba("mouseClick"),Bj=so();Bj.startListening({actionCreator:Rj,effect:(e,t)=>{var n=e.payload,r=zj(t.getState(),Lj(n));null!=(null==r?void 0:r.activeIndex)&&t.dispatch(Eb({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var Kj=ba("mouseMove"),Fj=so(),Uj=null;Fj.startListening({actionCreator:Kj,effect:(e,t)=>{var n=e.payload;null!==Uj&&cancelAnimationFrame(Uj);var r=Lj(n);Uj=requestAnimationFrame(()=>{var e=t.getState();if("axis"===hb(e,e.tooltip.settings.shared)){var n=zj(e,r);null!=(null==n?void 0:n.activeIndex)?t.dispatch(Ab({activeIndex:n.activeIndex,activeDataKey:void 0,activeCoordinate:n.activeCoordinate})):t.dispatch(_b())}Uj=null})}});var Wj={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0,reverseStackOrder:!1},$j=Ia({name:"rootProps",initialState:Wj,reducers:{updateOptions:(e,t)=>{var n;e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=null!==(n=t.payload.barGap)&&void 0!==n?n:Wj.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue,e.reverseStackOrder=t.payload.reverseStackOrder}}}),Hj=$j.reducer,{updateOptions:Vj}=$j.actions,qj=Ia({name:"polarOptions",initialState:null,reducers:{updatePolarOptions:(e,t)=>t.payload}}),{updatePolarOptions:Yj}=qj.actions,Xj=qj.reducer,Gj=ba("keyDown"),Zj=ba("focus"),Qj=so();Qj.startListening({actionCreator:Gj,effect:(e,t)=>{var n=t.getState();if(!1!==n.rootProps.accessibilityLayer){var{keyboardInteraction:r}=n.tooltip,i=e.payload;if("ArrowRight"===i||"ArrowLeft"===i||"Enter"===i){var a=Db(r,Xb(n),Vg(n),pw(n)),o=null==a?-1:Number(a);if(Number.isFinite(o)&&!(o<0)){var c=Ow(n);if("Enter"!==i){var l=o+("ArrowRight"===i?1:-1)*("left-to-right"===ub(n)?1:-1);if(!(null==c||l>=c.length||l<0)){var u=Zw(n,"axis","hover",String(l));t.dispatch(Sb({active:!0,activeIndex:l.toString(),activeDataKey:void 0,activeCoordinate:u}))}}else{var s=Zw(n,"axis","hover",String(r.index));t.dispatch(Sb({active:!r.active,activeIndex:r.index,activeDataKey:r.dataKey,activeCoordinate:s}))}}}}}}),Qj.startListening({actionCreator:Zj,effect:(e,t)=>{var n=t.getState();if(!1!==n.rootProps.accessibilityLayer){var{keyboardInteraction:r}=n.tooltip;if(!r.active&&null==r.index){var i=Zw(n,"axis","hover",String("0"));t.dispatch(Sb({activeDataKey:void 0,active:!0,activeIndex:"0",activeCoordinate:i}))}}}});var Jj=ba("externalEvent"),eS=so(),tS=new Map;eS.startListening({actionCreator:Jj,effect:(e,t)=>{var{handler:n,reactEvent:r}=e.payload;if(null!=n){r.persist();var i=r.type,a=tS.get(i);void 0!==a&&cancelAnimationFrame(a);var o=requestAnimationFrame(()=>{try{var e=t.getState(),a={activeCoordinate:Tw(e),activeDataKey:kw(e),activeIndex:jw(e),activeLabel:Sw(e),activeTooltipIndex:jw(e),isTooltipActive:Iw(e)};n(a,r)}finally{tS.delete(i)}});tS.set(i,o)}}});var nS=Ar([Rb],e=>e.tooltipItemPayloads),rS=Ar([nS,Lb,(e,t,n)=>t,(e,t,n)=>n],(e,t,n,r)=>{var i=e.find(e=>e.settings.dataKey===r);if(null!=i){var{positions:a}=i;if(null!=a)return t(a,n)}}),iS=ba("touchMove"),aS=so();aS.startListening({actionCreator:iS,effect:(e,t)=>{var n=e.payload;if(null!=n.touches&&0!==n.touches.length){var r=t.getState(),i=hb(r,r.tooltip.settings.shared);if("axis"===i){var a=zj(r,Lj({clientX:n.touches[0].clientX,clientY:n.touches[0].clientY,currentTarget:n.currentTarget}));null!=(null==a?void 0:a.activeIndex)&&t.dispatch(Ab({activeIndex:a.activeIndex,activeDataKey:void 0,activeCoordinate:a.activeCoordinate}))}else if("item"===i){var o,c=n.touches[0];if(null==document.elementFromPoint)return;var l=document.elementFromPoint(c.clientX,c.clientY);if(!l||!l.getAttribute)return;var u=l.getAttribute("data-recharts-item-index"),s=null!==(o=l.getAttribute("data-recharts-item-data-key"))&&void 0!==o?o:void 0,f=rS(t.getState(),u,s);t.dispatch(xb({activeDataKey:s,activeIndex:u,activeCoordinate:f}))}}}});var oS=ri({brush:lA,cartesianAxis:CP,chartData:Bx,errorBars:$P,graphicalItems:cP,layout:mo,legend:Il,options:Tx,polarAxis:S_,polarOptions:Xj,referenceElements:gA,rootProps:Hj,tooltip:kb,zIndex:px});function cS(e){var{preloadedState:t,children:r,reduxStoreName:i}=e,a=tc(),o=n.useRef(null);if(a)return r;null==o.current&&(o.current=function(e){return function(e){const t=function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:i=!0}=e??{};let a=new wa;return t&&("boolean"==typeof t?a.push(va):a.push(ga(t.extraArgument))),a},{reducer:n,middleware:r,devTools:i=!0,preloadedState:a,enhancers:o}=e||{};let c,l;if("function"==typeof n)c=n;else{if(!ti(n))throw new Error(fo(1));c=ri(n)}l="function"==typeof r?r(t):t();let u=ii;i&&(u=ma({trace:!1,..."object"==typeof i&&i}));const s=function(...e){return t=>(n,r)=>{const i=t(n,r);let a=()=>{throw new Error(Zr(15))};const o={getState:i.getState,dispatch:(e,...t)=>a(e,...t)},c=e.map(e=>e(o));return a=ii(...c)(i.dispatch),{...i,dispatch:a}}}(...l),f=(e=>function(t){const{autoBatch:n=!0}=t??{};let r=new wa(e);return n&&r.push(Ea("object"==typeof n?n:void 0)),r})(s);return ni(c,a,u(..."function"==typeof o?o(f):f()))}({reducer:oS,preloadedState:e,middleware:e=>e({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes("es6")}).concat([Bj.middleware,Fj.middleware,Qj.middleware,eS.middleware,aS.middleware]),enhancers:e=>{var t=e;return"function"==typeof e&&(t=e()),t.concat(Ea({type:"raf"}))},devTools:false})}(t));var l=dr;return n.createElement(c,{context:l,store:o.current},r)}function lS(e){var{layout:t,margin:r}=e,i=pr(),a=tc();return n.useEffect(()=>{a||(i(yo(t)),i(po(r)))},[i,a,t,r]),null}var uS=n.memo(lS,JP);function sS(e){var t=pr();return n.useEffect(()=>{t(Vj(e))},[t,e]),null}function fS(e){var{zIndex:t,isPanorama:r}=e,i=Q_("".concat(r?"recharts-zindex-panorama-":"recharts-zindex-").concat(t)),a=pr();return n.useLayoutEffect(()=>(a(dx({zIndex:t,elementId:i,isPanorama:r})),()=>{a(hx({zIndex:t,isPanorama:r}))}),[a,t,i,r]),n.createElement("g",{tabIndex:-1,id:i})}function dS(e){var{children:t,isPanorama:r}=e,i=mr(rx);if(!i||0===i.length)return t;var a=i.filter(e=>e<0),o=i.filter(e=>e>0);return n.createElement(n.Fragment,null,a.map(e=>n.createElement(fS,{key:e,zIndex:e,isPanorama:r})),t,o.map(e=>n.createElement(fS,{key:e,zIndex:e,isPanorama:r})))}var hS=["children"];function pS(){return pS=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var r=Ic(),i=Dc(),a=Yl();if(!bc(r)||!bc(i))return null;var o,c,{children:l,otherAttributes:u,title:s,desc:f}=e;return null!=u&&(o="number"==typeof u.tabIndex?u.tabIndex:a?0:void 0,c="string"==typeof u.role?u.role:a?"application":void 0),n.createElement(x,pS({},u,{title:s,desc:f,role:c,tabIndex:o,width:r,height:i,style:yS,ref:t}),l)}),gS=e=>{var{children:t}=e,r=mr(rc);if(!r)return null;var{width:i,height:a,y:o,x:c}=r;return n.createElement(x,{width:i,height:a,x:c,y:o},t)},mS=n.forwardRef((e,t)=>{var{children:r}=e,i=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r($x(),null);function PS(e){if("number"==typeof e)return e;if("string"==typeof e){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var AS=n.forwardRef((e,t)=>{var r,i,a=n.useRef(null),[o,c]=n.useState({containerWidth:PS(null===(r=e.style)||void 0===r?void 0:r.width),containerHeight:PS(null===(i=e.style)||void 0===i?void 0:i.height)}),l=n.useCallback((e,t)=>{c(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]),u=n.useCallback(e=>{if("function"==typeof t&&t(e),null!=e&&"undefined"!=typeof ResizeObserver){var{width:n,height:r}=e.getBoundingClientRect();l(n,r);var i=new ResizeObserver(e=>{var{width:t,height:n}=e[0].contentRect;l(t,n)});i.observe(e),a.current=i}},[t,l]);return n.useEffect(()=>()=>{var e=a.current;null!=e&&e.disconnect()},[l]),n.createElement(n.Fragment,null,n.createElement(Lc,{width:o.containerWidth,height:o.containerHeight}),n.createElement("div",OS({ref:u},e)))}),ES=n.forwardRef((e,t)=>{var{width:r,height:i}=e,[a,o]=n.useState({containerWidth:PS(r),containerHeight:PS(i)}),c=n.useCallback((e,t)=>{o(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]),l=n.useCallback(e=>{if("function"==typeof t&&t(e),null!=e){var{width:n,height:r}=e.getBoundingClientRect();c(n,r)}},[t,c]);return n.createElement(n.Fragment,null,n.createElement(Lc,{width:a.containerWidth,height:a.containerHeight}),n.createElement("div",OS({ref:l},e)))}),jS=n.forwardRef((e,t)=>{var{width:r,height:i}=e;return n.createElement(n.Fragment,null,n.createElement(Lc,{width:r,height:i}),n.createElement("div",OS({ref:t},e)))}),SS=n.forwardRef((e,t)=>{var{width:r,height:i}=e;return et(r)||et(i)?n.createElement(ES,OS({},e,{ref:t})):n.createElement(jS,OS({},e,{ref:t}))}),kS=n.forwardRef((e,t)=>{var{children:r,className:i,height:a,onClick:o,onContextMenu:c,onDoubleClick:l,onMouseDown:u,onMouseEnter:f,onMouseLeave:d,onMouseMove:h,onMouseUp:p,onTouchEnd:y,onTouchMove:v,onTouchStart:g,style:m,width:b,responsive:w,dispatchTouchEvents:x=!0}=e,O=n.useRef(null),_=pr(),[P,E]=n.useState(null),[j,S]=n.useState(null),k=function(){var e=pr(),[t,r]=n.useState(null),i=mr(Ro);return n.useEffect(()=>{if(null!=t){var n=t.getBoundingClientRect().width/t.offsetWidth;mc(n)&&n!==i&&e(go(n))}},[t,e,i]),r}(),M=Ec(),C=(null==M?void 0:M.width)>0?M.width:b,T=(null==M?void 0:M.height)>0?M.height:a,I=n.useCallback(e=>{k(e),"function"==typeof t&&t(e),E(e),S(e),null!=e&&(O.current=e)},[k,t,E,S]),D=n.useCallback(e=>{_(Rj(e)),_(Jj({handler:o,reactEvent:e}))},[_,o]),N=n.useCallback(e=>{_(Kj(e)),_(Jj({handler:f,reactEvent:e}))},[_,f]),z=n.useCallback(e=>{_(_b()),_(Jj({handler:d,reactEvent:e}))},[_,d]),L=n.useCallback(e=>{_(Kj(e)),_(Jj({handler:h,reactEvent:e}))},[_,h]),R=n.useCallback(()=>{_(Zj())},[_]),B=n.useCallback(e=>{_(Gj(e.key))},[_]),K=n.useCallback(e=>{_(Jj({handler:c,reactEvent:e}))},[_,c]),F=n.useCallback(e=>{_(Jj({handler:l,reactEvent:e}))},[_,l]),U=n.useCallback(e=>{_(Jj({handler:u,reactEvent:e}))},[_,u]),W=n.useCallback(e=>{_(Jj({handler:p,reactEvent:e}))},[_,p]),$=n.useCallback(e=>{_(Jj({handler:g,reactEvent:e}))},[_,g]),H=n.useCallback(e=>{x&&_(iS(e)),_(Jj({handler:v,reactEvent:e}))},[_,x,v]),V=n.useCallback(e=>{_(Jj({handler:y,reactEvent:e}))},[_,y]),q=function(e){return!0===e?AS:SS}(w);return n.createElement(Px.Provider,{value:P},n.createElement(A.Provider,{value:j},n.createElement(q,{width:null!=C?C:null==m?void 0:m.width,height:null!=T?T:null==m?void 0:m.height,className:s("recharts-wrapper",i),style:wS({position:"relative",cursor:"default",width:C,height:T},m),onClick:D,onContextMenu:K,onDoubleClick:F,onFocus:R,onKeyDown:B,onMouseDown:U,onMouseEnter:N,onMouseLeave:z,onMouseMove:L,onMouseUp:W,onTouchEnd:V,onTouchMove:H,onTouchStart:$,ref:I},n.createElement(_S,null),r)))}),MS=["width","height","responsive","children","className","style","compact","title","desc"],CS=n.forwardRef((e,t)=>{var{width:r,height:i,responsive:a,children:o,className:c,style:l,compact:u,title:s,desc:f}=e,d=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;rn.createElement(NS,{chartName:"LineChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:zS,tooltipPayloadSearcher:Mx,categoricalChartProps:e,ref:t})),RS={},BS={},KS={};function FS(){return IS||(IS=1,e=KS,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e.isBuffer=function(e){return"undefined"!=typeof Buffer&&Buffer.isBuffer(e)}),KS;var e}var US,WS={};function $S(){return US||(US=1,e=WS,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e.isPrototype=function(e){const t=null==e?void 0:e.constructor;return e===("function"==typeof t?t.prototype:Object.prototype)}),WS;var e}var HS,VS={};function qS(){return HS||(HS=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Sn();e.isTypedArray=function(e){return t.isTypedArray(e)}}(VS)),VS}var YS,XS,GS,ZS={},QS={};function JS(){return YS||(YS=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=ms();e.toInteger=function(e){const n=t.toFinite(e),r=n%1;return r?n-r:n}}(QS)),QS}function ek(){return XS||(XS=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=JS();e.times=function(e,n){if((e=t.toInteger(e))<1||!Number.isSafeInteger(e))return[];const r=new Array(e);for(let t=0;t`${e}`),r=new Set(n);t.isBuffer(e)&&(r.add("offset"),r.add("parent")),i.isTypedArray(e)&&(r.add("buffer"),r.add("byteLength"),r.add("byteOffset"));const c=o(e).filter(e=>!r.has(e));return Array.isArray(e)?[...n,...c]:[...n.filter(t=>Object.hasOwn(e,t)),...c]}(e):n.isPrototype(e)?function(e){return o(e).filter(e=>"constructor"!==e)}(e):o(e);default:return o(Object(e))}}}(BS)),BS}var nk,rk={};function ik(){return nk||(nk=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Xe(),n=Ie(),r=ze(),i=Be(),a=Ye();function o(e,r){const i=1===r.length?e:t.get(e,r.slice(0,-1)),a=r[r.length-1];if(void 0===(null==i?void 0:i[a]))return!0;if(n.isUnsafeProperty(a))return!1;try{return delete i[a],!0}catch{return!1}}e.unset=function(e,t){if(null==e)return!0;switch(typeof t){case"symbol":case"number":case"object":if(Array.isArray(t))return o(e,t);if("number"==typeof t?t=i.toKey(t):"object"==typeof t&&(t=Object.is(null==t?void 0:t.valueOf(),-0)?"-0":String(t)),n.isUnsafeProperty(t))return!1;if(void 0===(null==e?void 0:e[t]))return!0;try{return delete e[t],!0}catch{return!1}case"string":if(void 0===(null==e?void 0:e[t])&&r.isDeepKey(t))return o(e,a.toPath(t));if(n.isUnsafeProperty(t))return!1;try{return delete e[t],!0}catch{return!1}}}}(rk)),rk}var ak,ok={};function ck(){return ak||(ak=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=vn();e.getSymbolsIn=function(e){const n=[];for(;e;)n.push(...t.getSymbols(e)),e=Object.getPrototypeOf(e);return n}}(ok)),ok}var lk,uk,sk,fk,dk={};function hk(){return lk||(lk=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Bt();e.flatten=function(e,n=1){const r=[],i=Math.floor(n);if(!t.isArrayLike(e))return r;const a=(e,t)=>{for(let n=0;nArray.isArray(e)||a.isDeepKey(e))?function(e){const r={},a=[...n.keysIn(e),...i.getSymbolsIn(e)];for(let n=0;n{if(!c.isPlainObject(e))return e})}return r}(e):function(e){const t={},r=[...n.keysIn(e),...i.getSymbolsIn(e)];for(let n=0;n{if(e&&t)return Ze(e,t)},_k={chartName:"Treemap",defaultTooltipEventType:"item",validateTooltipEventTypes:["item"],tooltipPayloadSearcher:Ok,eventEmitter:void 0},Pk=e=>{var t,{depth:n,node:r,index:i,dataKey:a,nameKey:o,nestedActiveTooltipIndex:c}=e,l=0===n?"":function(e){return"".concat(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"","children[").concat(e,"]")}(i,c),{children:u}=r,s=n+1,f=u&&u.length?u.map((e,t)=>Pk({depth:s,node:e,index:t,dataKey:a,nameKey:o,nestedActiveTooltipIndex:l})):null;return t=f&&f.length?f.reduce((e,t)=>e+t[xk],0):Je(r[a])||r[a]<=0?0:r[a],bk(bk({},r),{},{children:f,name:_o(r,o,""),[xk]:t,depth:n,index:i,tooltipIndex:l})},Ak=(e,t,n)=>{var r=t*t,i=e.area*e.area,{min:a,max:o}=e.reduce((e,t)=>({min:Math.min(e.min,t.area),max:Math.max(e.max,t.area)}),{min:1/0,max:0});return i?Math.max(r*o*n/i,i/(r*a*n)):1/0},Ek=(e,t,n,r)=>t===n.width?((e,t,n,r)=>{var i=t?Math.round(e.area/t):0;(r||i>n.height)&&(i=n.height);for(var a,o=n.x,c=0,l=e.length;c{var i=t?Math.round(e.area/t):0;(r||i>n.width)&&(i=n.width);for(var a,o=n.y,c=0,l=e.length;c{var{children:n}=e;if(n&&n.length){var r,i,a=(e=>({x:e.x,y:e.y,width:e.width,height:e.height}))(e),o=[],c=1/0,l=Math.min(a.width,a.height),u=((e,t)=>{var n=t<0?0:t;return e.map(e=>{var t=e[xk]*n;return bk(bk({},e),{},{area:Je(t)||t<=0?0:t})})})(n,a.width*a.height/e[xk]),s=u.slice();for(o.area=0;s.length>0;){var f,d;o.push(r=s[0]),o.area+=r.area,(i=Ak(o,l,t))<=c?(s.shift(),c=i):(o.area-=null!==(f=null===(d=o.pop())||void 0===d?void 0:d.area)&&void 0!==f?f:0,a=Ek(o,l,a,!1),l=Math.min(a.width,a.height),o.length=o.area=0,c=1/0)}return o.length&&(a=Ek(o,l,a,!0),o.length=o.area=0),bk(bk({},e),{},{children:u.map(e=>jk(e,t))})}return e},Sk={aspectRatio:.5*(1+Math.sqrt(5)),dataKey:"value",nameKey:"name",type:"flat",isAnimationActive:"auto",isUpdateAnimationActive:"auto",animationBegin:0,animationDuration:1500,animationEasing:"linear"},kk={isAnimationFinished:!1,formatRoot:null,currentRoot:null,nestIndex:[],prevAspectRatio:Sk.aspectRatio,prevDataKey:Sk.dataKey};function Mk(e){var{content:t,nodeProps:r,type:i,colorPanel:a,onMouseEnter:o,onMouseLeave:c,onClick:l}=e;if(n.isValidElement(t))return n.createElement(P,{onMouseEnter:o,onMouseLeave:c,onClick:l},n.cloneElement(t,r));if("function"==typeof t)return n.createElement(P,{onMouseEnter:o,onMouseLeave:c,onClick:l},t(r));var{x:u,y:s,width:f,height:d,index:h}=r,p=null;f>10&&d>10&&r.children&&"nest"===i&&(p=n.createElement(g_,{points:[{x:u+2,y:s+d/2},{x:u+6,y:s+d/2+3},{x:u+2,y:s+d/2+6}]}));var y=null,v=aO(r.name);f>20&&d>20&&v.width{t(xb({activeIndex:e.nodeProps.tooltipIndex,activeDataKey:e.dataKey,activeCoordinate:r}))},onMouseLeave:()=>{},onClick:()=>{t(Pb({activeIndex:e.nodeProps.tooltipIndex,activeDataKey:e.dataKey,activeCoordinate:r}))}}))}var Tk=n.memo(e=>{var{dataKey:t,nameKey:r,stroke:i,fill:a,currentRoot:o}=e,c={dataDefinedOnItem:o,positions:void 0,settings:{stroke:i,strokeWidth:void 0,fill:a,dataKey:t,nameKey:r,name:void 0,hide:!1,type:void 0,color:a,unit:""}};return n.createElement(X_,{tooltipEntrySettings:c})}),Ik={top:0,right:0,bottom:0,left:0};function Dk(e){var{content:t,nodeProps:r,isLeaf:i,treemapProps:a,onNestClick:o}=e,{isAnimationActive:c,animationBegin:l,animationDuration:u,animationEasing:s,isUpdateAnimationActive:f,type:d,colorPanel:h,dataKey:p,onAnimationStart:y,onAnimationEnd:v,onMouseEnter:g,onClick:m,onMouseLeave:b}=a,{width:w,height:x,x:O,y:_}=r,A=-O-w,E=e=>{!i&&"nest"!==d||"function"!=typeof g||g(r,e)},j=e=>{!i&&"nest"!==d||"function"!=typeof b||b(r,e)},S=()=>{"nest"===d&&o(r),!i&&"nest"!==d||"function"!=typeof m||m(r)},k=n.useCallback(()=>{"function"==typeof v&&v()},[v]),M=n.useCallback(()=>{"function"==typeof y&&y()},[y]);return n.createElement(Nj,{animationId:"treemap-".concat(r.tooltipIndex),from:"translate(".concat(A,"px, ").concat(0,"px)"),to:"translate(0, 0)",attributeName:"transform",begin:l,easing:s,isActive:c,duration:u,onAnimationStart:M,onAnimationEnd:k},e=>n.createElement(P,{onMouseEnter:E,onMouseLeave:j,onClick:S,style:bk(bk({},e),{},{transformOrigin:"".concat(O," ").concat(_)})},n.createElement(Ck,{content:t,dataKey:p,nodeProps:bk(bk({},r),{},{isAnimationActive:c,isUpdateAnimationActive:!f,width:w,height:x,x:O,y:_}),type:d,colorPanel:h})))}class Nk extends n.PureComponent{constructor(){super(...arguments),wk(this,"state",bk({},kk)),wk(this,"handleClick",e=>{var{onClick:t,type:n}=this.props;if("nest"===n&&e.children){var{width:r,height:i,dataKey:a,nameKey:o,aspectRatio:c}=this.props,l=Pk({depth:0,node:bk(bk({},e),{},{x:0,y:0,width:r,height:i}),index:0,dataKey:a,nameKey:o,nestedActiveTooltipIndex:e.tooltipIndex}),u=jk(l,c),{nestIndex:s}=this.state;s.push(e),this.setState({formatRoot:u,currentRoot:l,nestIndex:s})}t&&t(e)}),wk(this,"handleTouchMove",e=>{var t=e.touches[0],n=document.elementFromPoint(t.clientX,t.clientY);if(n&&n.getAttribute&&null!=this.state.formatRoot){var r=n.getAttribute("data-recharts-item-index"),i=Ok(this.state.formatRoot,r);if(i){var{dataKey:a,dispatch:o}=this.props,c={x:i.x+i.width/2,y:i.y+i.height/2};o(xb({activeIndex:r,activeDataKey:a,activeCoordinate:c}))}}})}static getDerivedStateFromProps(e,t){if(e.data!==t.prevData||e.type!==t.prevType||e.width!==t.prevWidth||e.height!==t.prevHeight||e.dataKey!==t.prevDataKey||e.aspectRatio!==t.prevAspectRatio){var n=Pk({depth:0,node:{children:e.data,x:0,y:0,width:e.width,height:e.height},index:0,dataKey:e.dataKey,nameKey:e.nameKey}),r=jk(n,e.aspectRatio);return bk(bk({},t),{},{formatRoot:r,currentRoot:n,nestIndex:[n],prevAspectRatio:e.aspectRatio,prevData:e.data,prevWidth:e.width,prevHeight:e.height,prevDataKey:e.dataKey,prevType:e.type})}return null}handleNestIndex(e,t){var{nestIndex:n}=this.state,{width:r,height:i,dataKey:a,nameKey:o,aspectRatio:c}=this.props,l=Pk({depth:0,node:bk(bk({},e),{},{x:0,y:0,width:r,height:i}),index:0,dataKey:a,nameKey:o,nestedActiveTooltipIndex:e.tooltipIndex}),u=jk(l,c);n=n.slice(0,t+1),this.setState({formatRoot:u,currentRoot:e,nestIndex:n})}renderNode(e,t){var{content:r,type:i}=this.props,a=bk(bk(bk({},v(this.props)),t),{},{root:e}),o=!t.children||!t.children.length,{currentRoot:c}=this.state;return!((null==c?void 0:c.children)||[]).filter(e=>e.depth===t.depth&&e.name===t.name).length&&e.depth&&"nest"===i?null:n.createElement(P,{key:"recharts-treemap-node-".concat(a.x,"-").concat(a.y,"-").concat(a.name),className:"recharts-treemap-depth-".concat(t.depth)},n.createElement(Dk,{isLeaf:o,content:r,nodeProps:a,treemapProps:this.props,onNestClick:this.handleClick}),t.children&&t.children.length?t.children.map(e=>this.renderNode(t,e)):null)}renderAllNodes(){var{formatRoot:e}=this.state;return e?this.renderNode(e,e):null}renderNestIndex(){var{nameKey:e,nestIndexContent:t}=this.props,{nestIndex:r}=this.state;return n.createElement("div",{className:"recharts-treemap-nest-index-wrapper",style:{marginTop:"8px",textAlign:"center"}},r.map((r,i)=>{var a,o=Ze(r,e,"root");return n.isValidElement(t)&&(a=n.cloneElement(t,r,i)),a="function"==typeof t?t(r,i):o,n.createElement("div",{onClick:this.handleNestIndex.bind(this,r,i),key:"nest-index-".concat(it()),className:"recharts-treemap-nest-index-box",style:{cursor:"pointer",display:"inline-block",padding:"0 7px",background:"#000",color:"#fff",marginRight:"3px"}},a)}))}render(){var e=this.props,{width:t,height:r,className:i,style:a,children:o,type:c}=e,l=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{null==l&&null!=e&&u(e)},onMouseEnter:void 0,onMouseLeave:void 0,onClick:void 0,onMouseMove:void 0,onMouseDown:void 0,onMouseUp:void 0,onContextMenu:void 0,onDoubleClick:void 0,onTouchStart:void 0,onTouchMove:void 0,onTouchEnd:void 0},n.createElement(Px.Provider,{value:l},n.createElement(zk,r))))}wk(Nk,"displayName","Treemap");var Rk=["axis"],Bk=n.forwardRef((e,t)=>n.createElement(NS,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:Rk,tooltipPayloadSearcher:Mx,categoricalChartProps:e,ref:t})),Kk="http://www.w3.org/1999/xhtml";const Fk={svg:"http://www.w3.org/2000/svg",xhtml:Kk,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Uk(e){var t=e+="",n=t.indexOf(":");return n>=0&&"xmlns"!==(t=e.slice(0,n))&&(e=e.slice(n+1)),Fk.hasOwnProperty(t)?{space:Fk[t],local:e}:e}function Wk(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Kk&&t.documentElement.namespaceURI===Kk?t.createElement(e):t.createElementNS(n,e)}}function $k(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Hk(e){var t=Uk(e);return(t.local?$k:Wk)(t)}function Vk(){}function qk(e){return null==e?Vk:function(){return this.querySelector(e)}}function Yk(){return[]}function Xk(e){return null==e?Yk:function(){return this.querySelectorAll(e)}}function Gk(e){return function(){return this.matches(e)}}function Zk(e){return function(t){return t.matches(e)}}var Qk=Array.prototype.find;function Jk(){return this.firstElementChild}var eM=Array.prototype.filter;function tM(){return Array.from(this.children)}function nM(e){return new Array(e.length)}function rM(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}function iM(e,t,n,r,i,a){for(var o,c=0,l=t.length,u=a.length;ct?1:e>=t?0:NaN}function uM(e){return function(){this.removeAttribute(e)}}function sM(e){return function(){this.removeAttributeNS(e.space,e.local)}}function fM(e,t){return function(){this.setAttribute(e,t)}}function dM(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function hM(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttribute(e):this.setAttribute(e,n)}}function pM(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function yM(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function vM(e){return function(){this.style.removeProperty(e)}}function gM(e,t,n){return function(){this.style.setProperty(e,t,n)}}function mM(e,t,n){return function(){var r=t.apply(this,arguments);null==r?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function bM(e,t){return e.style.getPropertyValue(t)||yM(e).getComputedStyle(e,null).getPropertyValue(t)}function wM(e){return function(){delete this[e]}}function xM(e,t){return function(){this[e]=t}}function OM(e,t){return function(){var n=t.apply(this,arguments);null==n?delete this[e]:this[e]=n}}function _M(e){return e.trim().split(/^|\s+/)}function PM(e){return e.classList||new AM(e)}function AM(e){this._node=e,this._names=_M(e.getAttribute("class")||"")}function EM(e,t){for(var n=PM(e),r=-1,i=t.length;++r=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};var YM=[null];function XM(e,t){this._groups=e,this._parents=t}function GM(){return new XM([[document.documentElement]],YM)}function ZM(e){return"string"==typeof e?new XM([[document.querySelector(e)]],[document.documentElement]):new XM([[e]],YM)}function QM(e,t){if(e=function(e){let t;for(;t=e.sourceEvent;)e=t;return e}(e),void 0===t&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,[(r=r.matrixTransform(t.getScreenCTM().inverse())).x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}XM.prototype=GM.prototype={constructor:XM,select:function(e){"function"!=typeof e&&(e=qk(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i=x&&(x=w+1);!(b=g[x])&&++x=0;)(r=i[a])&&(o&&4^r.compareDocumentPosition(o)&&o.parentNode.insertBefore(r,o),o=r);return this},sort:function(e){function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}e||(e=lM);for(var n=this._groups,r=n.length,i=new Array(r),a=0;a1?this.each((null==t?vM:"function"==typeof t?mM:gM)(e,t,null==n?"":n)):bM(this.node(),e)},property:function(e,t){return arguments.length>1?this.each((null==t?wM:"function"==typeof t?OM:xM)(e,t)):this.node()[e]},classed:function(e,t){var n=_M(e+"");if(arguments.length<2){for(var r=PM(this.node()),i=-1,a=n.length;++i=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}(e+""),o=a.length;if(!(arguments.length<2)){for(c=t?$M:WM,r=0;r{}};function eC(){for(var e,t=0,n=arguments.length,r={};t=0&&(t=e.slice(n+1),e=e.slice(0,n)),e&&!r.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:t}})),o=-1,c=a.length;if(!(arguments.length<2)){if(null!=t&&"function"!=typeof t)throw new Error("invalid callback: "+t);for(;++o0)for(var n,r,i=new Array(n),a=0;a=0&&t._call.call(void 0,e),t=t._next;--oC}()}finally{oC=0,function(){for(var e,t,n=iC,r=1/0;n;)n._call?(r>n._time&&(r=n._time),e=n,n=n._next):(t=n._next,n._next=null,n=e?e._next=t:iC=t);aC=e,wC(r)}(),sC=0}}function bC(){var e=dC.now(),t=e-uC;t>1e3&&(fC-=t,uC=e)}function wC(e){oC||(cC&&(cC=clearTimeout(cC)),e-sC>24?(e<1/0&&(cC=setTimeout(mC,e-dC.now()-fC)),lC&&(lC=clearInterval(lC))):(lC||(uC=dC.now(),lC=setInterval(bC,1e3)),oC=1,hC(mC)))}function xC(e,t,n){var r=new vC;return t=null==t?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}vC.prototype=gC.prototype={constructor:vC,restart:function(e,t,n){if("function"!=typeof e)throw new TypeError("callback is not a function");n=(null==n?pC():+n)+(null==t?0:+t),this._next||aC===this||(aC?aC._next=this:iC=this,aC=this),this._call=e,this._time=n,wC()},stop:function(){this._call&&(this._call=null,this._time=1/0,wC())}};var OC=eC("start","end","cancel","interrupt"),_C=[];function PC(e,t,n,r,i,a){var o=e.__transition;if(o){if(n in o)return}else e.__transition={};!function(e,t,n){var r,i=e.__transition;function a(l){var u,s,f,d;if(1!==n.state)return c();for(u in i)if((d=i[u]).name===n.name){if(3===d.state)return xC(a);4===d.state?(d.state=6,d.timer.stop(),d.on.call("interrupt",e,e.__data__,d.index,d.group),delete i[u]):+u0)throw new Error("too late; already scheduled");return n}function EC(e,t){var n=jC(e,t);if(n.state>3)throw new Error("too late; already running");return n}function jC(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function SC(e,t){var n,r,i,a=e.__transition,o=!0;if(a){for(i in t=null==t?null:t+"",a)(n=a[i]).name===t?(r=n.state>2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(r?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete a[i]):o=!1;o&&delete e.__transition}}function kC(e,t){var n,r;return function(){var i=EC(this,e),a=i.tween;if(a!==n)for(var o=0,c=(r=n=a).length;o=0&&(e=e.slice(0,t)),!e||"start"===e})}(t)?AC:EC;return function(){var o=a(this,e),c=o.on;c!==r&&(i=(r=c).copy()).on(t,n),o.on=i}}(n,e,t))},attr:function(e,t){var n=Uk(e),r="transform"===n?vd:TC;return this.attrTween(e,"function"==typeof t?(n.local?RC:LC)(n,r,CC(this,"attr."+e,t)):null==t?(n.local?DC:IC)(n):(n.local?zC:NC)(n,r,t))},attrTween:function(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!=typeof t)throw new Error;var r=Uk(e);return this.tween(n,(r.local?BC:KC)(r,t))},style:function(e,t,n){var r="transform"==(e+="")?yd:TC;return null==t?this.styleTween(e,function(e,t){var n,r,i;return function(){var a=bM(this,e),o=(this.style.removeProperty(e),bM(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}(e,r)).on("end.style."+e,VC(e)):"function"==typeof t?this.styleTween(e,function(e,t,n){var r,i,a;return function(){var o=bM(this,e),c=n(this),l=c+"";return null==c&&(this.style.removeProperty(e),l=c=bM(this,e)),o===l?null:o===r&&l===i?a:(i=l,a=t(r=o,c))}}(e,r,CC(this,"style."+e,t))).each(function(e,t){var n,r,i,a,o="style."+t,c="end."+o;return function(){var l=EC(this,e),u=l.on,s=null==l.value[o]?a||(a=VC(t)):void 0;u===n&&i===s||(r=(n=u).copy()).on(c,i=s),l.on=r}}(this._id,e)):this.styleTween(e,function(e,t,n){var r,i,a=n+"";return function(){var o=bM(this,e);return o===a?null:o===r?i:i=t(r=o,n)}}(e,r,t),n).on("end.style."+e,null)},styleTween:function(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==t)return this.tween(r,null);if("function"!=typeof t)throw new Error;return this.tween(r,function(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&function(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}(e,a,n)),r}return a._value=t,a}(e,t,null==n?"":n))},text:function(e){return this.tween("text","function"==typeof e?function(e){return function(){var t=e(this);this.textContent=null==t?"":t}}(CC(this,"text",e)):function(e){return function(){this.textContent=e}}(null==e?"":e+""))},textTween:function(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(null==e)return this.tween(t,null);if("function"!=typeof e)throw new Error;return this.tween(t,function(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&function(e){return function(t){this.textContent=e.call(this,t)}}(r)),t}return r._value=e,r}(e))},remove:function(){return this.on("end.remove",(e=this._id,function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}));var e},tween:function(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r,i=jC(this.node(),n).tween,a=0,o=i.length;a+e(t)}function rT(e,t){return t=Math.max(0,e.bandwidth()-2*t)/2,e.round()&&(t=Math.round(t)),n=>+e(n)+t}function iT(){return!this.__axis}function aT(e,t){var n=[],r=null,i=null,a=6,o=6,c=3,l="undefined"!=typeof window&&window.devicePixelRatio>1?0:.5,u=tT;function s(e){var s=null==r?t.ticks?t.ticks.apply(t,n):t.domain():r,f=null==i?t.tickFormat?t.tickFormat.apply(t,n):JC:i,d=Math.max(a,0)+c,h=t.range(),p=+h[0]+l,y=+h[h.length-1]+l,v=(t.bandwidth?rT:nT)(t.copy(),l),g=e.selection?e.selection():e,m=g.selectAll(".domain").data([null]),b=g.selectAll(".tick").data(s,t).order(),w=b.exit(),x=b.enter().append("g").attr("class","tick"),O=b.select("line"),_=b.select("text");m=m.merge(m.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),b=b.merge(x),O=O.merge(x.append("line").attr("stroke","currentColor").attr("y2",1*a)),_=_.merge(x.append("text").attr("fill","currentColor").attr("y",1*d).attr("dy","0.71em")),e!==g&&(m=m.transition(e),b=b.transition(e),O=O.transition(e),_=_.transition(e),w=w.transition(e).attr("opacity",eT).attr("transform",function(e){return isFinite(e=v(e))?u(e+l):this.getAttribute("transform")}),x.attr("opacity",eT).attr("transform",function(e){var t=this.parentNode.__axis;return u((t&&isFinite(t=t(e))?t:v(e))+l)})),w.remove(),m.attr("d",o?"M"+p+","+1*o+"V"+l+"H"+y+"V"+1*o:"M"+p+","+l+"H"+y),b.attr("opacity",1).attr("transform",function(e){return u(v(e)+l)}),O.attr("y2",1*a),_.attr("y",1*d).text(f),g.filter(iT).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor","middle"),g.each(function(){this.__axis=v})}return s.scale=function(e){return arguments.length?(t=e,s):t},s.ticks=function(){return n=Array.from(arguments),s},s.tickArguments=function(e){return arguments.length?(n=null==e?[]:Array.from(e),s):n.slice()},s.tickValues=function(e){return arguments.length?(r=null==e?null:Array.from(e),s):r&&r.slice()},s.tickFormat=function(e){return arguments.length?(i=e,s):i},s.tickSize=function(e){return arguments.length?(a=o=+e,s):a},s.tickSizeInner=function(e){return arguments.length?(a=+e,s):a},s.tickSizeOuter=function(e){return arguments.length?(o=+e,s):o},s.tickPadding=function(e){return arguments.length?(c=+e,s):c},s.offset=function(e){return arguments.length?(l=+e,s):l},s}function oT(e){return aT(0,e)}const cT={capture:!0,passive:!1};function lT(e){e.preventDefault(),e.stopImmediatePropagation()}const uT=e=>()=>e;function sT(e,{sourceEvent:t,target:n,selection:r,mode:i,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},selection:{value:r,enumerable:!0,configurable:!0},mode:{value:i,enumerable:!0,configurable:!0},_:{value:a}})}function fT(e){e.preventDefault(),e.stopImmediatePropagation()}var dT={name:"drag"},hT={name:"space"},pT={name:"handle"},yT={name:"center"};const{abs:vT,max:gT,min:mT}=Math;function bT(e){return[+e[0],+e[1]]}function wT(e){return[bT(e[0]),bT(e[1])]}var xT={name:"x",handles:["w","e"].map(kT),input:function(e,t){return null==e?null:[[+e[0],t[0][1]],[+e[1],t[1][1]]]},output:function(e){return e&&[e[0][0],e[1][0]]}},OT={},_T={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(kT),input:function(e){return null==e?null:wT(e)},output:function(e){return e}},PT={overlay:"crosshair",selection:"move",n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},AT={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},ET={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},jT={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},ST={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function kT(e){return{type:e}}function MT(e){return!e.ctrlKey&&!e.button}function CT(){var e=this.ownerSVGElement||this;return e.hasAttribute("viewBox")?[[(e=e.viewBox.baseVal).x,e.y],[e.x+e.width,e.y+e.height]]:[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]}function TT(){return navigator.maxTouchPoints||"ontouchstart"in this}function IT(e){for(;!e.__brush;)if(!(e=e.parentNode))return;return e.__brush}function DT(){return zT(xT)}function NT(){return zT(_T)}function zT(e){var t,n=CT,r=MT,i=TT,a=!0,o=eC("start","brush","end"),c=6;function l(t){var n=t.property("__brush",y).selectAll(".overlay").data([kT("overlay")]);n.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",PT.overlay).merge(n).each(function(){var e=IT(this).extent;ZM(this).attr("x",e[0][0]).attr("y",e[0][1]).attr("width",e[1][0]-e[0][0]).attr("height",e[1][1]-e[0][1])}),t.selectAll(".selection").data([kT("selection")]).enter().append("rect").attr("class","selection").attr("cursor",PT.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var r=t.selectAll(".handle").data(e.handles,function(e){return e.type});r.exit().remove(),r.enter().append("rect").attr("class",function(e){return"handle handle--"+e.type}).attr("cursor",function(e){return PT[e.type]}),t.each(u).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",d).filter(i).on("touchstart.brush",d).on("touchmove.brush",h).on("touchend.brush touchcancel.brush",p).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function u(){var e=ZM(this),t=IT(this).selection;t?(e.selectAll(".selection").style("display",null).attr("x",t[0][0]).attr("y",t[0][1]).attr("width",t[1][0]-t[0][0]).attr("height",t[1][1]-t[0][1]),e.selectAll(".handle").style("display",null).attr("x",function(e){return"e"===e.type[e.type.length-1]?t[1][0]-c/2:t[0][0]-c/2}).attr("y",function(e){return"s"===e.type[0]?t[1][1]-c/2:t[0][1]-c/2}).attr("width",function(e){return"n"===e.type||"s"===e.type?t[1][0]-t[0][0]+c:c}).attr("height",function(e){return"e"===e.type||"w"===e.type?t[1][1]-t[0][1]+c:c})):e.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function s(e,t,n){var r=e.__brush.emitter;return!r||n&&r.clean?new f(e,t,n):r}function f(e,t,n){this.that=e,this.args=t,this.state=e.__brush,this.active=0,this.clean=n}function d(n){if((!t||n.touches)&&r.apply(this,arguments)){var i,o,c,l,f,d,h,p,y,v,g,m=this,b=n.target.__data__.type,w="selection"===(a&&n.metaKey?b="overlay":b)?dT:a&&n.altKey?yT:pT,x=e===OT?null:jT[b],O=e===xT?null:ST[b],_=IT(m),P=_.extent,A=_.selection,E=P[0][0],j=P[0][1],S=P[1][0],k=P[1][1],M=0,C=0,T=x&&O&&a&&n.shiftKey,I=Array.from(n.touches||[n],e=>{const t=e.identifier;return(e=QM(e,m)).point0=e.slice(),e.identifier=t,e});SC(m);var D=s(m,arguments,!0).beforestart();if("overlay"===b){A&&(y=!0);const t=[I[0],I[1]||I[0]];_.selection=A=[[i=e===OT?E:mT(t[0][0],t[1][0]),c=e===xT?j:mT(t[0][1],t[1][1])],[f=e===OT?S:gT(t[0][0],t[1][0]),h=e===xT?k:gT(t[0][1],t[1][1])]],I.length>1&&B(n)}else i=A[0][0],c=A[0][1],f=A[1][0],h=A[1][1];o=i,l=c,d=f,p=h;var N=ZM(m).attr("pointer-events","none"),z=N.selectAll(".overlay").attr("cursor",PT[b]);if(n.touches)D.moved=R,D.ended=K;else{var L=ZM(n.view).on("mousemove.brush",R,!0).on("mouseup.brush",K,!0);a&&L.on("keydown.brush",function(e){switch(e.keyCode){case 16:T=x&&O;break;case 18:w===pT&&(x&&(f=d-M*x,i=o+M*x),O&&(h=p-C*O,c=l+C*O),w=yT,B(e));break;case 32:w!==pT&&w!==yT||(x<0?f=d-M:x>0&&(i=o-M),O<0?h=p-C:O>0&&(c=l-C),w=hT,z.attr("cursor",PT.selection),B(e));break;default:return}fT(e)},!0).on("keyup.brush",function(e){switch(e.keyCode){case 16:T&&(v=g=T=!1,B(e));break;case 18:w===yT&&(x<0?f=d:x>0&&(i=o),O<0?h=p:O>0&&(c=l),w=pT,B(e));break;case 32:w===hT&&(e.altKey?(x&&(f=d-M*x,i=o+M*x),O&&(h=p-C*O,c=l+C*O),w=yT):(x<0?f=d:x>0&&(i=o),O<0?h=p:O>0&&(c=l),w=pT),z.attr("cursor",PT[b]),B(e));break;default:return}fT(e)},!0),function(e){var t=e.document.documentElement,n=ZM(e).on("dragstart.drag",lT,cT);"onselectstart"in t?n.on("selectstart.drag",lT,cT):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}(n.view)}u.call(m),D.start(n,w.name)}function R(e){for(const t of e.changedTouches||[e])for(const e of I)e.identifier===t.identifier&&(e.cur=QM(t,m));if(T&&!v&&!g&&1===I.length){const e=I[0];vT(e.cur[0]-e[0])>vT(e.cur[1]-e[1])?g=!0:v=!0}for(const t of I)t.cur&&(t[0]=t.cur[0],t[1]=t.cur[1]);y=!0,fT(e),B(e)}function B(e){const t=I[0],n=t.point0;var r;switch(M=t[0]-n[0],C=t[1]-n[1],w){case hT:case dT:x&&(M=gT(E-i,mT(S-f,M)),o=i+M,d=f+M),O&&(C=gT(j-c,mT(k-h,C)),l=c+C,p=h+C);break;case pT:I[1]?(x&&(o=gT(E,mT(S,I[0][0])),d=gT(E,mT(S,I[1][0])),x=1),O&&(l=gT(j,mT(k,I[0][1])),p=gT(j,mT(k,I[1][1])),O=1)):(x<0?(M=gT(E-i,mT(S-i,M)),o=i+M,d=f):x>0&&(M=gT(E-f,mT(S-f,M)),o=i,d=f+M),O<0?(C=gT(j-c,mT(k-c,C)),l=c+C,p=h):O>0&&(C=gT(j-h,mT(k-h,C)),l=c,p=h+C));break;case yT:x&&(o=gT(E,mT(S,i-M*x)),d=gT(E,mT(S,f+M*x))),O&&(l=gT(j,mT(k,c-C*O)),p=gT(j,mT(k,h+C*O)))}d()=>e;function KT(e,t){for(var n,r=-1,i=t.length;++rr!=h>r&&n<(d-u)*(r-s)/(h-s)+u&&(i=-i)}return i}function UT(e,t,n){var r;return function(e,t,n){return(t[0]-e[0])*(n[1]-e[1])===(n[0]-e[0])*(t[1]-e[1])}(e,t,n)&&function(e,t,n){return e<=t&&t<=n||n<=t&&t<=e}(e[r=+(e[0]===t[0])],n[r],t[r])}function WT(){}var $T=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function HT(){var e=1,t=1,n=Ws,r=c;function i(e){var t=n(e);if(Array.isArray(t))t=t.slice().sort(RT);else{const n=Cs(e,VT);for(t=Ks(...function(e,t,n){let r;for(;;){const i=Fs(e,t,n);if(i===r||0===i||!isFinite(i))return[e,t];i>0?(e=Math.floor(e/i)*i,t=Math.ceil(t/i)*i):i<0&&(e=Math.ceil(e*i)/i,t=Math.floor(t*i)/i),r=i}}(n[0],n[1],t),t);t[t.length-1]>=n[1];)t.pop();for(;t[1]a(e,t))}function a(n,i){const a=null==i?NaN:+i;if(isNaN(a))throw new Error(`invalid value: ${i}`);var c=[],l=[];return function(n,r,i){var a,c,l,u,s,f,d=new Array,h=new Array;for(a=c=-1,u=qT(n[0],r),$T[u<<1].forEach(p);++a=r,$T[s<<2].forEach(p);++a0?c.push([e]):l.push(e)}),l.forEach(function(e){for(var t,n=0,r=c.length;n0&&a0&&o=0&&a>=0))throw new Error("invalid size");return e=r,t=a,i},i.thresholds=function(e){return arguments.length?(n="function"==typeof e?e:Array.isArray(e)?BT(LT.call(e)):BT(e),i):n},i.smooth=function(e){return arguments.length?(r=e?c:WT,i):r===c},i}function VT(e){return isFinite(e)?e:NaN}function qT(e,t){return null!=e&&+e>=t}function YT(e){return null==e||isNaN(e=+e)?-1/0:e}function XT(e,t,n,r){const i=r-t,a=n-t,o=isFinite(i)||isFinite(a)?i/a:Math.sign(i)/Math.sign(a);return isNaN(o)?e:e+o-.5}function GT(e){return e[0]}function ZT(e){return e[1]}function QT(){return 1}function JT(){var e=GT,t=ZT,n=QT,r=960,i=500,a=20,o=2,c=3*a,l=r+2*c>>o,u=i+2*c>>o,s=BT(20);function f(r){var i=new Float32Array(l*u),s=Math.pow(2,-o),f=-1;for(const a of r){var d=(e(a,++f,r)+c)*s,h=(t(a,f,r)+c)*s,p=+n(a,f,r);if(p&&d>=0&&d=0&&he*r))(t).map((e,t)=>(e.value=+n[t],h(e)))}function h(e){return e.coordinates.forEach(p),e}function p(e){e.forEach(y)}function y(e){e.forEach(v)}function v(e){e[0]=e[0]*Math.pow(2,o)-c,e[1]=e[1]*Math.pow(2,o)-c}function g(){return l=r+2*(c=3*a)>>o,u=i+2*c>>o,d}return d.contours=function(e){var t=f(e),n=HT().size([l,u]),r=Math.pow(2,2*o),i=e=>{e=+e;var i=h(n.contour(t,e*r));return i.value=e,i};return Object.defineProperty(i,"max",{get:()=>$s(t)/r}),i},d.x=function(t){return arguments.length?(e="function"==typeof t?t:BT(+t),d):e},d.y=function(e){return arguments.length?(t="function"==typeof e?e:BT(+e),d):t},d.weight=function(e){return arguments.length?(n="function"==typeof e?e:BT(+e),d):n},d.size=function(e){if(!arguments.length)return[r,i];var t=+e[0],n=+e[1];if(!(t>=0&&n>=0))throw new Error("invalid size");return r=t,i=n,g()},d.cellSize=function(e){if(!arguments.length)return 1<=1))throw new Error("invalid cell size");return o=Math.floor(Math.log(e)/Math.LN2),g()},d.thresholds=function(e){return arguments.length?(s="function"==typeof e?e:Array.isArray(e)?BT(LT.call(e)):BT(e),d):s},d.bandwidth=function(e){if(!arguments.length)return Math.sqrt(a*(a+1));if(!((e=+e)>=0))throw new Error("invalid bandwidth");return a=(Math.sqrt(4*e*e+1)-1)/2,g()},d}function eI(e,t,n){this.k=e,this.x=t,this.y=n}eI.prototype={constructor:eI,scale:function(e){return 1===e?this:new eI(this.k*e,this.x,this.y)},translate:function(e,t){return 0===e&0===t?this:new eI(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}},eI.prototype;export{Bk as A,tE as C,LS as L,Sc as R,Zx as T,Pj as X,Ij as Y,jy as a,oT as b,ZM as c,DT as d,Cs as e,Kd as f,xf as g,fh as h,My as i,md as j,wd as k,Vd as l,NT as m,s as n,Js as o,bd as p,Ys as q,Af as r,ih as s,ap as t,IE as u,sj as v,Lk as w,JT as x}; diff --git a/frontend/dist/assets/recharts-DVj1EL-m.js b/frontend/dist/assets/recharts-DVj1EL-m.js new file mode 100644 index 00000000..57141b86 --- /dev/null +++ b/frontend/dist/assets/recharts-DVj1EL-m.js @@ -0,0 +1 @@ +var e=Object.defineProperty,t=(t,n,r)=>((t,n,r)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[n]=r)(t,"symbol"!=typeof n?n+"":n,r);import{r as n,a as r,b as i,R as a}from"./vendor-react-DCIF8YoJ.js";import{g as o}from"./deckgl-DTsmDcfs.js";function c(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var i=e.length;for(t=0;t{var{children:n,width:i,height:a,viewBox:o,className:c,style:u,title:s,desc:f}=e,d=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{var{children:n,className:i}=e,a=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0))throw new Error(`invalid digits: ${e}`);if(t>15)return B;const n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;tL)if(Math.abs(s*c-l*u)>L&&i){let d=n-a,h=r-o,p=c*c+l*l,y=d*d+h*h,v=Math.sqrt(p),g=Math.sqrt(f),m=i*Math.tan((N-Math.acos((p+f-y)/(2*v*g)))/2),b=m/g,w=m/v;Math.abs(b-1)>L&&this._append`L${e+b*u},${t+b*s}`,this._append`A${i},${i},0,0,${+(s*d>u*h)},${this._x1=e+w*c},${this._y1=t+w*l}`}else this._append`L${this._x1=e},${this._y1=t}`}arc(e,t,n,r,i,a){if(e=+e,t=+t,a=!!a,(n=+n)<0)throw new Error(`negative radius: ${n}`);let o=n*Math.cos(r),c=n*Math.sin(r),l=e+o,u=t+c,s=1^a,f=a?r-i:i-r;null===this._x1?this._append`M${l},${u}`:(Math.abs(this._x1-l)>L||Math.abs(this._y1-u)>L)&&this._append`L${l},${u}`,n&&(f<0&&(f=f%z+z),f>R?this._append`A${n},${n},0,1,${s},${e-o},${t-c}A${n},${n},0,1,${s},${this._x1=l},${this._y1=u}`:f>L&&this._append`A${n},${n},0,${+(f>=N)},${s},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}}function F(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(null==n)t=null;else{const e=Math.floor(n);if(!(e>=0))throw new RangeError(`invalid digits: ${n}`);t=e}return e},()=>new K(t)}function U(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function W(e){this._context=e}function $(e){return new W(e)}function H(e){return e[0]}function V(e){return e[1]}function q(e,t){var n=k(!0),r=null,i=$,a=null,o=F(c);function c(c){var l,u,s,f=(c=U(c)).length,d=!1;for(null==r&&(a=i(s=o())),l=0;l<=f;++l)!(l=f;--d)c.point(g[d],m[d]);c.lineEnd(),c.areaEnd()}v&&(g[s]=+e(h,s,u),m[s]=+t(h,s,u),c.point(r?+r(h,s,u):g[s],n?+n(h,s,u):m[s]))}if(p)return c=null,p+""||null}function s(){return q().defined(i).curve(o).context(a)}return e="function"==typeof e?e:void 0===e?H:k(+e),t="function"==typeof t?t:k(void 0===t?0:+t),n="function"==typeof n?n:void 0===n?V:k(+n),u.x=function(t){return arguments.length?(e="function"==typeof t?t:k(+t),r=null,u):e},u.x0=function(t){return arguments.length?(e="function"==typeof t?t:k(+t),u):e},u.x1=function(e){return arguments.length?(r=null==e?null:"function"==typeof e?e:k(+e),u):r},u.y=function(e){return arguments.length?(t="function"==typeof e?e:k(+e),n=null,u):t},u.y0=function(e){return arguments.length?(t="function"==typeof e?e:k(+e),u):t},u.y1=function(e){return arguments.length?(n=null==e?null:"function"==typeof e?e:k(+e),u):n},u.lineX0=u.lineY0=function(){return s().x(e).y(t)},u.lineY1=function(){return s().x(e).y(n)},u.lineX1=function(){return s().x(r).y(t)},u.defined=function(e){return arguments.length?(i="function"==typeof e?e:k(!!e),u):i},u.curve=function(e){return arguments.length?(o=e,null!=a&&(c=o(a)),u):o},u.context=function(e){return arguments.length?(null==e?a=c=null:c=o(a=e),u):a},u}W.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t)}}};class X{constructor(e,t){this._context=e,this._x=t}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line}point(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,t,e,t):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+t)/2,e,this._y0,e,t)}this._x0=e,this._y0=t}}const G={draw(e,t){const n=T(t/I);e.moveTo(n,0),e.arc(0,0,n,0,D)}},Z={draw(e,t){const n=T(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},Q=T(1/3),J=2*Q,ee={draw(e,t){const n=T(t/J),r=n*Q;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},te={draw(e,t){const n=T(t),r=-n/2;e.rect(r,r,n,n)}},ne=C(I/10)/C(7*I/10),re=C(D/10)*ne,ie=-M(D/10)*ne,ae={draw(e,t){const n=T(.8908130915292852*t),r=re*n,i=ie*n;e.moveTo(0,-n),e.lineTo(r,i);for(let a=1;a<5;++a){const t=D*a/5,o=M(t),c=C(t);e.lineTo(c*n,-o*n),e.lineTo(o*r-c*i,c*r+o*i)}e.closePath()}},oe=T(3),ce={draw(e,t){const n=-T(t/(3*oe));e.moveTo(0,2*n),e.lineTo(-oe*n,-n),e.lineTo(oe*n,-n),e.closePath()}},le=-.5,ue=T(3)/2,se=1/T(12),fe=3*(se/2+1),de={draw(e,t){const n=T(t/fe),r=n/2,i=n*se,a=r,o=n*se+n,c=-a,l=o;e.moveTo(r,i),e.lineTo(a,o),e.lineTo(c,l),e.lineTo(le*r-ue*i,ue*r+le*i),e.lineTo(le*a-ue*o,ue*a+le*o),e.lineTo(le*c-ue*l,ue*c+le*l),e.lineTo(le*r+ue*i,le*i-ue*r),e.lineTo(le*a+ue*o,le*o-ue*a),e.lineTo(le*c+ue*l,le*l-ue*c),e.closePath()}};function he(){}function pe(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function ye(e){this._context=e}function ve(e){this._context=e}function ge(e){this._context=e}function me(e){this._context=e}function be(e){return e<0?-1:1}function we(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),c=(a*i+o*r)/(r+i);return(be(a)+be(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(c))||0}function xe(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function Oe(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,c=(a-r)/3;e._context.bezierCurveTo(r+c,i+c*t,a-c,o-c*n,a,o)}function _e(e){this._context=e}function Pe(e){this._context=new Ae(e)}function Ae(e){this._context=e}function Ee(e){this._context=e}function Se(e){var t,n,r=e.length-1,i=new Array(r),a=new Array(r),o=new Array(r);for(i[0]=0,a[0]=2,o[0]=e[0]+2*e[1],t=1;t=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[r-1]=(e[r]+i[r-1])/2,t=0;t1)for(var n,r,i,a=1,o=e[t[0]],c=o.length;a=0;)n[t]=t;return n}function Ce(e,t){return e[t]}function Te(e){const t=[];return t.key=e,t}ye.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:pe(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:pe(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}},ve.prototype={areaStart:he,areaEnd:he,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:pe(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}},ge.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:pe(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}},me.prototype={areaStart:he,areaEnd:he,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}},_e.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Oe(this,this._t0,xe(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(t=+t,(e=+e)!==this._x1||t!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,Oe(this,xe(this,n=we(this,e,t)),n);break;default:Oe(this,this._t0,n=we(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}},(Pe.prototype=Object.create(_e.prototype)).point=function(e,t){_e.prototype.point.call(this,t,e)},Ae.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}},Ee.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),2===n)this._context.lineTo(e[1],t[1]);else for(var r=Se(e),i=Se(t),a=0,o=1;o=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}}this._x=e,this._y=t}};var Ie,De={},Ne={};function ze(){return Ie||(Ie=1,e=Ne,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e.isUnsafeProperty=function(e){return"__proto__"===e}),Ne;var e}var Le,Re={};function Be(){return Le||(Le=1,e=Re,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e.isDeepKey=function(e){switch(typeof e){case"number":case"symbol":return!1;case"string":return e.includes(".")||e.includes("[")||e.includes("]")}}),Re;var e}var Ke,Fe={};function Ue(){return Ke||(Ke=1,e=Fe,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e.toKey=function(e){var t;return"string"==typeof e||"symbol"==typeof e?e:Object.is(null==(t=null==e?void 0:e.valueOf)?void 0:t.call(e),-0)?"-0":String(e)}),Fe;var e}var We,$e,He,Ve,qe,Ye={},Xe={};function Ge(){return We||(We=1,e=Xe,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e.toString=function e(t){if(null==t)return"";if("string"==typeof t)return t;if(Array.isArray(t))return t.map(e).join(",");const n=String(t);return"0"===n&&Object.is(Number(t),-0)?"-0":n}),Xe;var e}function Ze(){return $e||($e=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Ge(),n=Ue();e.toPath=function(e){if(Array.isArray(e))return e.map(n.toKey);if("symbol"==typeof e)return[e];const r=[],i=(e=t.toString(e)).length;if(0===i)return r;let a=0,o="",c="",l=!1;for(46===e.charCodeAt(0)&&(r.push(""),a++);a0===e?0:e>0?1:-1,nt=e=>"number"==typeof e&&e!=+e,rt=e=>"string"==typeof e&&e.indexOf("%")===e.length-1,it=e=>("number"==typeof e||e instanceof Number)&&!nt(e),at=e=>it(e)||"string"==typeof e,ot=0,ct=e=>{var t=++ot;return"".concat(e||"").concat(t)},lt=function(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!it(e)&&"string"!=typeof e)return r;if(rt(e)){if(null==t)return r;var a=e.indexOf("%");n=t*parseFloat(e.slice(0,a))/100}else n=+e;return nt(n)&&(n=r),i&&null!=t&&n>t&&(n=t),n},ut=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;re&&("function"==typeof t?t(e):et(e,t))===n)}var dt=e=>null==e,ht=e=>dt(e)?e:"".concat(e.charAt(0).toUpperCase()).concat(e.slice(1));function pt(e){return null!=e}function yt(){}var vt=["type","size","sizeType"];function gt(){return gt=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{type:t="circle",size:n=64,sizeType:i="area"}=e,a=bt(bt({},function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{var e=(e=>{var t="symbol".concat(ht(e));return xt[t]||G})(o),t=function(e,t){let n=null,r=F(i);function i(){let i;if(n||(n=i=r()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),i)return n=null,i+""||null}return e="function"==typeof e?e:k(e||G),t="function"==typeof t?t:k(void 0===t?64:+t),i.type=function(t){return arguments.length?(e="function"==typeof t?t:k(t),i):e},i.size=function(e){return arguments.length?(t="function"==typeof e?e:k(+e),i):t},i.context=function(e){return arguments.length?(n=null==e?null:e,i):n},i}().type(e).size(((e,t,n)=>{if("area"===t)return e;switch(n){case"cross":return 5*e*e/9;case"diamond":return.5*e*e/Math.sqrt(3);case"square":return e*e;case"star":var r=18*Ot;return 1.25*e*e*(Math.tan(r)-Math.tan(2*r)*Math.tan(r)**2);case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}})(n,i,o)),r=t();if(null!==r)return r})()})):null};_t.registerSymbol=(e,t)=>{xt["symbol".concat(ht(e))]=t};var Pt=e=>"radius"in e&&"startAngle"in e&&"endAngle"in e,At=(e,t)=>{if(!e||"function"==typeof e||"boolean"==typeof e)return null;var n=e;if(r.isValidElement(e)&&(n=e.props),"object"!=typeof n&&"function"!=typeof n)return null;var i={};return Object.keys(n).forEach(e=>{y(e)&&(i[e]=t=>n[e](n,t))}),i};function Et(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function St(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function jt(e,t){var n=function(e){for(var t=1;t(void 0===e[t]&&void 0!==r[t]&&(e[t]=r[t]),e),n)}var kt,Mt={},Ct={};function Tt(){return kt||(kt=1,e=Ct,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e.uniqBy=function(e,t){const n=new Map;for(let r=0;r=0}),Kt;var e}function Ut(){return Lt||(Lt=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Ft();e.isArrayLike=function(e){return null!=e&&"function"!=typeof e&&t.isLength(e.length)}}(Bt)),Bt}var Wt,$t,Ht={};function Vt(){return Wt||(Wt=1,e=Ht,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e.isObjectLike=function(e){return"object"==typeof e&&null!==e}),Ht;var e}function qt(){return $t||($t=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Ut(),n=Vt();e.isArrayLikeObject=function(e){return n.isObjectLike(e)&&t.isArrayLike(e)}}(Rt)),Rt}var Yt,Xt={},Gt={};function Zt(){return Yt||(Yt=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Qe();e.property=function(e){return function(n){return t.get(n,e)}}}(Gt)),Gt}var Qt,Jt={},en={},tn={},nn={};function rn(){return Qt||(Qt=1,e=nn,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e.isObject=function(e){return null!==e&&("object"==typeof e||"function"==typeof e)}),nn;var e}var an,on={};function cn(){return an||(an=1,e=on,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e.isPrimitive=function(e){return null==e||"object"!=typeof e&&"function"!=typeof e}),on;var e}var ln,un,sn,fn={};function dn(){return ln||(ln=1,e=fn,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e.eq=function(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}),fn;var e}function hn(){return un||(un=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=rn(),n=cn(),r=dn();function i(e,c,l,u){if(c===e)return!0;switch(typeof c){case"object":return function(e,t,r,i){if(null==t)return!0;if(Array.isArray(t))return a(e,t,r,i);if(t instanceof Map)return function(e,t,n,r){if(0===t.size)return!0;if(!(e instanceof Map))return!1;for(const[i,a]of t.entries())if(!1===n(e.get(i),a,i,e,t,r))return!1;return!0}(e,t,r,i);if(t instanceof Set)return o(e,t,r,i);const c=Object.keys(t);if(null==e)return 0===c.length;if(0===c.length)return!0;if(null==i?void 0:i.has(t))return i.get(t)===e;null==i||i.set(t,e);try{for(let a=0;a0?i(e,{...c},l,u):r.eq(e,c);default:return t.isObject(e)?"string"!=typeof c||""===c:r.eq(e,c)}}function a(e,t,n,r){if(0===t.length)return!0;if(!Array.isArray(e))return!1;const i=new Set;for(let a=0;a{}):i(t,n,function e(t,n,a,o,c,l){const u=r(t,n,a,o,c,l);return void 0!==u?Boolean(u):i(t,n,e,l)},new Map)},e.isSetMatch=o}(tn)),tn}function pn(){return sn||(sn=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=hn();e.isMatch=function(e,n){return t.isMatchWith(e,n,()=>{})}}(en)),en}var yn,vn={},gn={},mn={};function bn(){return yn||(yn=1,e=mn,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e.getSymbols=function(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}),mn;var e}var wn,xn={};function On(){return wn||(wn=1,e=xn,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e.getTag=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}),xn;var e}var _n,Pn={};function An(){return _n||(_n=1,e=Pn,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e.argumentsTag="[object Arguments]",e.arrayBufferTag="[object ArrayBuffer]",e.arrayTag="[object Array]",e.bigInt64ArrayTag="[object BigInt64Array]",e.bigUint64ArrayTag="[object BigUint64Array]",e.booleanTag="[object Boolean]",e.dataViewTag="[object DataView]",e.dateTag="[object Date]",e.errorTag="[object Error]",e.float32ArrayTag="[object Float32Array]",e.float64ArrayTag="[object Float64Array]",e.functionTag="[object Function]",e.int16ArrayTag="[object Int16Array]",e.int32ArrayTag="[object Int32Array]",e.int8ArrayTag="[object Int8Array]",e.mapTag="[object Map]",e.numberTag="[object Number]",e.objectTag="[object Object]",e.regexpTag="[object RegExp]",e.setTag="[object Set]",e.stringTag="[object String]",e.symbolTag="[object Symbol]",e.uint16ArrayTag="[object Uint16Array]",e.uint32ArrayTag="[object Uint32Array]",e.uint8ArrayTag="[object Uint8Array]",e.uint8ClampedArrayTag="[object Uint8ClampedArray]"),Pn;var e}var En,Sn,jn,kn,Mn={};function Cn(){return En||(En=1,e=Mn,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e.isTypedArray=function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}),Mn;var e}function Tn(){return Sn||(Sn=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=bn(),n=On(),r=An(),i=cn(),a=Cn();function o(e,t,l,u=new Map,s=void 0){const f=null==s?void 0:s(e,t,l,u);if(void 0!==f)return f;if(i.isPrimitive(e))return e;if(u.has(e))return u.get(e);if(Array.isArray(e)){const t=new Array(e.length);u.set(e,t);for(let n=0;nt.isMatch(n,e)}}(Jt)),Jt}var Nn,zn,Ln={},Rn={},Bn={};function Kn(){return Nn||(Nn=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Tn(),n=An();e.cloneDeepWith=function(e,r){return t.cloneDeepWith(e,(i,a,o,c)=>{const l=null==r?void 0:r(i,a,o,c);if(void 0!==l)return l;if("object"==typeof e)switch(Object.prototype.toString.call(e)){case n.numberTag:case n.stringTag:case n.booleanTag:{const n=new e.constructor(null==e?void 0:e.valueOf());return t.copyProperties(n,e),n}case n.argumentsTag:{const n={};return t.copyProperties(n,e),n.length=e.length,n[Symbol.iterator]=e[Symbol.iterator],n}default:return}})}}(Bn)),Bn}function Fn(){return zn||(zn=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Kn();e.cloneDeep=function(e){return t.cloneDeepWith(e)}}(Rn)),Rn}var Un,Wn={},$n={};function Hn(){return Un||(Un=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=/^(?:0|[1-9]\d*)$/;e.isIndex=function(e,n=Number.MAX_SAFE_INTEGER){switch(typeof e){case"number":return Number.isInteger(e)&&e>=0&&ee,gr=()=>{var e=r.useContext(yr);return e?e.store.dispatch:vr},mr=()=>{},br=()=>mr,wr=(e,t)=>e===t;function xr(e){var t=r.useContext(yr);return pr.useSyncExternalStoreWithSelector(t?t.subscription.addNestedSub:br,t?t.store.getState:mr,t?t.store.getState:mr,t?e:mr,wr)}var Or=e=>Array.isArray(e)?e:[e];var _r="undefined"!=typeof WeakRef?WeakRef:class{constructor(e){this.value=e}deref(){return this.value}};function Pr(){return{s:0,v:void 0,o:null,p:null}}function Ar(e,t={}){let n={s:0,v:void 0,o:null,p:null};const{resultEqualityCheck:r}=t;let i,a=0;function o(){var t;let o=n;const{length:c}=arguments;for(let e=0,n=c;e{n={s:0,v:void 0,o:null,p:null},o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function Er(e,...t){const n="function"==typeof e?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t,r=0,i=0,a={},o=e.pop();"object"==typeof o&&(a=o,o=e.pop()),function(e,t="expected a function, instead received "+typeof e){if("function"!=typeof e)throw new TypeError(t)}(o,`createSelector expects an output function after the inputs, but received: [${typeof o}]`);const c={...n,...a},{memoize:l,memoizeOptions:u=[],argsMemoize:s=Ar,argsMemoizeOptions:f=[]}=c,d=Or(u),h=Or(f),p=function(e){const t=Array.isArray(e[0])?e[0]:e;return function(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(e=>"function"==typeof e)){const n=e.map(e=>"function"==typeof e?`function ${e.name||"unnamed"}()`:typeof e).join(", ");throw new TypeError(`${t}[${n}]`)}}(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}(e),y=l(function(){return r++,o.apply(null,arguments)},...d),v=s(function(){i++;const e=function(e,t){const n=[],{length:r}=e;for(let i=0;ii,resetDependencyRecomputations:()=>{i=0},lastResult:()=>t,recomputations:()=>r,resetRecomputations:()=>{r=0},memoize:l,argsMemoize:s})};return Object.assign(r,{withTypes:()=>r}),r}var Sr,jr=Er(Ar),kr=Object.assign((e,t=jr)=>{!function(e,t="expected an object, instead received "+typeof e){if("object"!=typeof e)throw new TypeError(t)}(e,"createStructuredSelector expects first argument to be an object where each property is a selector, instead received a "+typeof e);const n=Object.keys(e);return t(n.map(t=>e[t]),(...e)=>e.reduce((e,t,r)=>(e[n[r]]=t,e),{}))},{withTypes:()=>kr}),Mr={},Cr={},Tr={};function Ir(){return Sr||(Sr=1,function(e){function t(e){return"symbol"==typeof e?1:null===e?2:void 0===e?3:e!=e?4:0}Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e.compareValues=(e,n,r)=>{if(e!==n){const i=t(e),a=t(n);if(i===a&&0===i){if(en)return"desc"===r?-1:1}return"desc"===r?a-i:i-a}return 0}}(Tr)),Tr}var Dr,Nr,zr,Lr={},Rr={};function Br(){return Dr||(Dr=1,e=Rr,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e.isSymbol=function(e){return"symbol"==typeof e||e instanceof Symbol}),Rr;var e}function Kr(){return Nr||(Nr=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Br(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;e.isKey=function(e,i){return!Array.isArray(e)&&(!("number"!=typeof e&&"boolean"!=typeof e&&null!=e&&!t.isSymbol(e))||"string"==typeof e&&(r.test(e)||!n.test(e))||null!=i&&Object.hasOwn(i,e))}}(Lr)),Lr}function Fr(){return zr||(zr=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Ir(),n=Kr(),r=Ze();e.orderBy=function(e,i,a,o){if(null==e)return[];a=o?void 0:a,Array.isArray(e)||(e=Object.values(e)),Array.isArray(i)||(i=null==i?[null]:[i]),0===i.length&&(i=[null]),Array.isArray(a)||(a=null==a?[]:[a]),a=a.map(e=>String(e));const c=(e,t)=>{let n=e;for(let r=0;r(Array.isArray(e)&&1===e.length&&(e=e[0]),null==e||"function"==typeof e||Array.isArray(e)||n.isKey(e)?e:{key:e,path:r.toPath(e)}));return e.map(e=>({original:e,criteria:l.map(t=>((e,t)=>null==t||null==e?t:"object"==typeof e&&"key"in e?Object.hasOwn(t,e.key)?t[e.key]:c(t,e.path):"function"==typeof e?e(t):Array.isArray(e)?c(t,e):"object"==typeof t?t[e]:t)(t,e))})).slice().sort((e,n)=>{for(let r=0;re.original)}}(Cr)),Cr}var Ur,Wr={};function $r(){return Ur||(Ur=1,e=Wr,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e.flatten=function(e,t=1){const n=[],r=Math.floor(t),i=(e,t)=>{for(let a=0;a1&&r.isIterateeCall(e,i[0],i[1])?i=[]:a>2&&r.isIterateeCall(i[0],i[1],i[2])&&(i=[i[0]]),t.orderBy(e,n.flatten(i),["asc"])}}(Mr)),Mr).sortBy)}const Qr=o(Zr());var Jr=e=>e.legend.settings;function ei(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}jr([e=>e.legend.payload,Jr],(e,t)=>{var{itemSorter:n}=t,r=e.flat(1);return n?Qr(r,n):r});var ti=(()=>"function"==typeof Symbol&&Symbol.observable||"@@observable")(),ni=()=>Math.random().toString(36).substring(7).split("").join("."),ri={INIT:`@@redux/INIT${ni()}`,REPLACE:`@@redux/REPLACE${ni()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${ni()}`};function ii(e){if("object"!=typeof e||null===e)return!1;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||null===Object.getPrototypeOf(e)}function ai(e,t,n){if("function"!=typeof e)throw new Error(ei(2));if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(ei(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(ei(1));return n(ai)(e,t)}let r=e,i=t,a=new Map,o=a,c=0,l=!1;function u(){o===a&&(o=new Map,a.forEach((e,t)=>{o.set(t,e)}))}function s(){if(l)throw new Error(ei(3));return i}function f(e){if("function"!=typeof e)throw new Error(ei(4));if(l)throw new Error(ei(5));let t=!0;u();const n=c++;return o.set(n,e),function(){if(t){if(l)throw new Error(ei(6));t=!1,u(),o.delete(n),a=null}}}function d(e){if(!ii(e))throw new Error(ei(7));if(void 0===e.type)throw new Error(ei(8));if("string"!=typeof e.type)throw new Error(ei(17));if(l)throw new Error(ei(9));try{l=!0,i=r(i,e)}finally{l=!1}return(a=o).forEach(e=>{e()}),e}return d({type:ri.INIT}),{dispatch:d,subscribe:f,getState:s,replaceReducer:function(e){if("function"!=typeof e)throw new Error(ei(10));r=e,d({type:ri.REPLACE})},[ti]:function(){const e=f;return{subscribe(t){if("object"!=typeof t||null===t)throw new Error(ei(11));function n(){const e=t;e.next&&e.next(s())}return n(),{unsubscribe:e(n)}},[ti](){return this}}}}}function oi(e){const t=Object.keys(e),n={};for(let a=0;a{const n=e[t];if(void 0===n(void 0,{type:ri.INIT}))throw new Error(ei(12));if(void 0===n(void 0,{type:ri.PROBE_UNKNOWN_ACTION()}))throw new Error(ei(13))})}(n)}catch(pA){i=pA}return function(e={},t){if(i)throw i;let a=!1;const o={};for(let i=0;ie:1===e.length?e[0]:e.reduce((e,t)=>(...n)=>e(t(...n)))}function li(e){return ii(e)&&"type"in e&&"string"==typeof e.type}var ui=Symbol.for("immer-nothing"),si=Symbol.for("immer-draftable"),fi=Symbol.for("immer-state");function di(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var hi=Object,pi=hi.getPrototypeOf,yi="constructor",vi="prototype",gi="configurable",mi="enumerable",bi="writable",wi="value",xi=e=>!!e&&!!e[fi];function Oi(e){var t;return!!e&&(Ai(e)||Ci(e)||!!e[si]||!!(null==(t=e[yi])?void 0:t[si])||Ti(e)||Ii(e))}var _i=hi[vi][yi].toString(),Pi=new WeakMap;function Ai(e){if(!e||!Di(e))return!1;const t=pi(e);if(null===t||t===hi[vi])return!0;const n=hi.hasOwnProperty.call(t,yi)&&t[yi];if(n===Object)return!0;if(!Ni(n))return!1;let r=Pi.get(n);return void 0===r&&(r=Function.toString.call(n),Pi.set(n,r)),r===_i}function Ei(e,t,n=!0){0===Si(e)?(n?Reflect.ownKeys(e):hi.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Si(e){const t=e[fi];return t?t.type_:Ci(e)?1:Ti(e)?2:Ii(e)?3:0}var ji=(e,t,n=Si(e))=>2===n?e.has(t):hi[vi].hasOwnProperty.call(e,t),ki=(e,t,n=Si(e))=>2===n?e.get(t):e[t],Mi=(e,t,n,r=Si(e))=>{2===r?e.set(t,n):3===r?e.add(n):e[t]=n},Ci=Array.isArray,Ti=e=>e instanceof Map,Ii=e=>e instanceof Set,Di=e=>"object"==typeof e,Ni=e=>"function"==typeof e,zi=e=>"boolean"==typeof e,Li=e=>e.copy_||e.base_,Ri=e=>e.modified_?e.copy_:e.base_;function Bi(e,t){if(Ti(e))return new Map(e);if(Ii(e))return new Set(e);if(Ci(e))return Array[vi].slice.call(e);const n=Ai(e);if(!0===t||"class_only"===t&&!n){const t=hi.getOwnPropertyDescriptors(e);delete t[fi];let n=Reflect.ownKeys(t);for(let r=0;r1&&hi.defineProperties(e,{set:Fi,add:Fi,clear:Fi,delete:Fi}),hi.freeze(e),t&&Ei(e,(e,t)=>{Ki(t,!0)},!1)),e}var Fi={[wi]:function(){di(2)}};function Ui(e){return null===e||!Di(e)||hi.isFrozen(e)}var Wi="MapSet",$i="Patches",Hi={};function Vi(e){const t=Hi[e];return t||di(0),t}var qi,Yi=()=>qi;function Xi(e,t){t&&(e.patchPlugin_=Vi($i),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Gi(e){Zi(e),e.drafts_.forEach(Ji),e.drafts_=null}function Zi(e){e===qi&&(qi=e.parent_)}var Qi=e=>{return qi={drafts_:[],parent_:qi,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:(t=Wi,Hi[t]?Vi(Wi):void 0)};var t};function Ji(e){const t=e[fi];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function ea(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];if(void 0!==e&&e!==n){n[fi].modified_&&(Gi(t),di(4)),Oi(e)&&(e=ta(t,e));const{patchPlugin_:r}=t;r&&r.generateReplacementPatches_(n[fi].base_,e,t)}else e=ta(t,n);return function(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Ki(t,n)}(t,e,!0),Gi(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==ui?e:void 0}function ta(e,t){if(Ui(t))return t;const n=t[fi];if(!n)return ca(t,e.handledSet_,e);if(!ra(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){const{callbacks_:t}=n;if(t)for(;t.length>0;)t.pop()(e);oa(n,e)}return n.copy_}function na(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var ra=(e,t)=>e.scope_===t,ia=[];function aa(e,t,n,r){const i=Li(e),a=e.type_;if(void 0!==r&&ki(i,r,a)===t)return void Mi(i,r,n,a);if(!e.draftLocations_){const t=e.draftLocations_=new Map;Ei(i,(e,n)=>{if(xi(n)){const r=t.get(n)||[];r.push(e),t.set(n,r)}})}const o=e.draftLocations_.get(t)??ia;for(const c of o)Mi(i,c,n,a)}function oa(e,t){var n;if(e.modified_&&!e.finalized_&&(3===e.type_||((null==(n=e.assigned_)?void 0:n.size)??0)>0)){const{patchPlugin_:n}=t;if(n){const r=n.getPath(e);r&&n.generatePatches_(e,r,t)}na(e)}}function ca(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||xi(e)||t.has(e)||!Oi(e)||Ui(e)||(t.add(e),Ei(e,(r,i)=>{if(xi(i)){const t=i[fi];if(ra(t,n)){const n=Ri(t);Mi(e,r,n,e.type_),na(t)}}else Oi(i)&&ca(i,t,n)})),e}var la={get(e,t){if(t===fi)return e;const n=Li(e);if(!ji(n,t,e.type_))return function(e,t,n){var r;const i=fa(t,n);return i?wi in i?i[wi]:null==(r=i.get)?void 0:r.call(e.draft_):void 0}(e,n,t);const r=n[t];if(e.finalized_||!Oi(r))return r;if(r===sa(e.base_,t)){ha(e);const n=1===e.type_?+t:t,i=pa(e.scope_,r,e,n);return e.copy_[n]=i}return r},has:(e,t)=>t in Li(e),ownKeys:e=>Reflect.ownKeys(Li(e)),set(e,t,n){const r=fa(Li(e),t);if(null==r?void 0:r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=sa(Li(e),t),o=null==r?void 0:r[fi];if(o&&o.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if(((i=n)===(a=r)?0!==i||1/i==1/a:i!=i&&a!=a)&&(void 0!==n||ji(e.base_,t,e.type_)))return!0;ha(e),da(e)}var i,a;return e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_.set(t,!0),function(e,t,n){const{scope_:r}=e;if(xi(n)){const i=n[fi];ra(i,r)&&i.callbacks_.push(function(){ha(e);const r=Ri(i);aa(e,n,r,t)})}else Oi(n)&&e.callbacks_.push(function(){const i=Li(e);ki(i,t,e.type_)===n&&r.drafts_.length>1&&!0===(e.assigned_.get(t)??!1)&&e.copy_&&ca(ki(e.copy_,t,e.type_),r.handledSet_,r)})}(e,t,n)),!0},deleteProperty:(e,t)=>(ha(e),void 0!==sa(e.base_,t)||t in e.base_?(e.assigned_.set(t,!1),da(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=Li(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{[bi]:!0,[gi]:1!==e.type_||"length"!==t,[mi]:r[mi],[wi]:n[t]}:r},defineProperty(){di(11)},getPrototypeOf:e=>pi(e.base_),setPrototypeOf(){di(12)}},ua={};function sa(e,t){const n=e[fi];return(n?Li(n):e)[t]}function fa(e,t){if(!(t in e))return;let n=pi(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=pi(n)}}function da(e){e.modified_||(e.modified_=!0,e.parent_&&da(e.parent_))}function ha(e){e.copy_||(e.assigned_=new Map,e.copy_=Bi(e.base_,e.scope_.immer_.useStrictShallowCopy_))}function pa(e,t,n,r){const[i,a]=Ti(t)?Vi(Wi).proxyMap_(t,n):Ii(t)?Vi(Wi).proxySet_(t,n):function(e,t){const n=Ci(e),r={type_:n?1:0,scope_:t?t.scope_:Yi(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let i=r,a=la;n&&(i=[r],a=ua);const{revoke:o,proxy:c}=Proxy.revocable(i,a);return r.draft_=c,r.revoke_=o,[c,r]}(t,n);return((null==n?void 0:n.scope_)??Yi()).drafts_.push(i),a.callbacks_=(null==n?void 0:n.callbacks_)??[],a.key_=r,n&&void 0!==r?function(e,t,n){e.callbacks_.push(function(r){var i;const a=t;if(!a||!ra(a,r))return;null==(i=r.mapSetPlugin_)||i.fixSetContents(a);const o=Ri(a);aa(e,a.draft_??a,o,n),oa(a,r)})}(n,a,r):a.callbacks_.push(function(e){var t;null==(t=e.mapSetPlugin_)||t.fixSetContents(a);const{patchPlugin_:n}=e;a.modified_&&n&&n.generatePatches_(a,[],e)}),i}function ya(e){return xi(e)||di(10),va(e)}function va(e){if(!Oi(e)||Ui(e))return e;const t=e[fi];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Bi(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=Bi(e,!0);return Ei(n,(e,t)=>{Mi(n,e,va(t))},r),t&&(t.finalized_=!1),n}Ei(la,(e,t)=>{ua[e]=function(){const e=arguments;return e[0]=e[0][0],t.apply(this,e)}}),ua.deleteProperty=function(e,t){return ua.set.call(this,e,t,void 0)},ua.set=function(e,t,n){return la.set.call(this,e[0],t,n,e[0])};var ga=(new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,n)=>{if(Ni(e)&&!Ni(t)){const n=t;t=e;const r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}let r;if(Ni(t)||di(6),void 0===n||Ni(n)||di(7),Oi(e)){const i=Qi(this),a=pa(0,e,void 0);let o=!0;try{r=t(a),o=!1}finally{o?Gi(i):Zi(i)}return Xi(i,n),ea(r,i)}if(!e||!Di(e)){if(r=t(e),void 0===r&&(r=e),r===ui&&(r=void 0),this.autoFreeze_&&Ki(r,!0),n){const t=[],i=[];Vi($i).generateReplacementPatches_(e,r,{patches_:t,inversePatches_:i}),n(t,i)}return r}di(1)},this.produceWithPatches=(e,t)=>{if(Ni(e))return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;return[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},zi(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),zi(null==e?void 0:e.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),zi(null==e?void 0:e.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){Oi(e)||di(8),xi(e)&&(e=ya(e));const t=Qi(this),n=pa(0,e,void 0);return n[fi].isManual_=!0,Zi(t),n}finishDraft(e,t){const n=e&&e[fi];n&&n.isManual_||di(9);const{scope_:r}=n;return Xi(r,t),ea(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));const r=Vi($i).applyPatches_;return xi(e)?r(e,t):this.produce(e,e=>r(e,t))}}).produce;function ma(e){return({dispatch:t,getState:n})=>r=>i=>"function"==typeof i?i(t,n,e):r(i)}var ba=ma(),wa=ma,xa="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?ci:ci.apply(null,arguments)};function Oa(e,t){function n(...n){if(t){let r=t(...n);if(!r)throw new Error(yo(0));return{type:e,payload:r.payload,..."meta"in r&&{meta:r.meta},..."error"in r&&{error:r.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>li(t)&&t.type===e,n}var _a=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return 1===t.length&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function Pa(e){return Oi(e)?ga(e,()=>{}):e}function Aa(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}var Ea="RTK_autoBatch",Sa=()=>e=>({payload:e,meta:{[Ea]:!0}}),ja=e=>t=>{setTimeout(t,e)},ka=(e={type:"raf"})=>t=>(...n)=>{const r=t(...n);let i=!0,a=!1,o=!1;const c=new Set,l="tick"===e.type?queueMicrotask:"raf"===e.type?"undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:ja(10):"callback"===e.type?e.queueNotification:ja(e.timeout),u=()=>{o=!1,a&&(a=!1,c.forEach(e=>e()))};return Object.assign({},r,{subscribe(e){const t=r.subscribe(()=>i&&e());return c.add(e),()=>{t(),c.delete(e)}},dispatch(e){var t;try{return i=!(null==(t=null==e?void 0:e.meta)?void 0:t[Ea]),a=!i,a&&(o||(o=!0,l(u))),r.dispatch(e)}finally{i=!0}}})};function Ma(e){const t={},n=[];let r;const i={addCase(e,n){const r="string"==typeof e?e:e.type;if(!r)throw new Error(yo(28));if(r in t)throw new Error(yo(29));return t[r]=n,i},addAsyncThunk:(e,r)=>(r.pending&&(t[e.pending.type]=r.pending),r.rejected&&(t[e.rejected.type]=r.rejected),r.fulfilled&&(t[e.fulfilled.type]=r.fulfilled),r.settled&&n.push({matcher:e.settled,reducer:r.settled}),i),addMatcher:(e,t)=>(n.push({matcher:e,reducer:t}),i),addDefaultCase:e=>(r=e,i)};return e(i),[t,n,r]}var Ca=(e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t},Ta=Symbol.for("rtk-slice-createasyncthunk");function Ia(e,t){return`${e}/${t}`}function Da({creators:e}={}){var t;const n=null==(t=null==e?void 0:e.asyncThunk)?void 0:t[Ta];return function(e){const{name:t,reducerPath:r=t}=e;if(!t)throw new Error(yo(11));const i=("function"==typeof e.reducers?e.reducers(function(){function e(e,t){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer:e=>Object.assign({[e.name]:(...t)=>e(...t)}[e.name],{_reducerDefinitionType:"reducer"}),preparedReducer:(e,t)=>({_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:t}),asyncThunk:e}}()):e.reducers)||{},a=Object.keys(i),o={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},c={addCase(e,t){const n="string"==typeof e?e:e.type;if(!n)throw new Error(yo(12));if(n in o.sliceCaseReducersByType)throw new Error(yo(13));return o.sliceCaseReducersByType[n]=t,c},addMatcher:(e,t)=>(o.sliceMatchers.push({matcher:e,reducer:t}),c),exposeAction:(e,t)=>(o.actionCreators[e]=t,c),exposeCaseReducer:(e,t)=>(o.sliceCaseReducersByName[e]=t,c)};function l(){const[t={},n=[],r]="function"==typeof e.extraReducers?Ma(e.extraReducers):[e.extraReducers],i={...t,...o.sliceCaseReducersByType};return function(e){let t,[a,c,l]=Ma(e=>{for(let t in i)e.addCase(t,i[t]);for(let t of o.sliceMatchers)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);r&&e.addDefaultCase(r)});if("function"==typeof e)t=()=>Pa(e());else{const n=Pa(e);t=()=>n}function u(e=t(),n){let r=[a[n.type],...c.filter(({matcher:e})=>e(n)).map(({reducer:e})=>e)];return 0===r.filter(e=>!!e).length&&(r=[l]),r.reduce((e,t)=>{if(t){if(xi(e)){const r=t(e,n);return void 0===r?e:r}if(Oi(e))return ga(e,e=>t(e,n));{const r=t(e,n);if(void 0===r){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return r}}return e},e)}return u.getInitialState=t,u}(e.initialState)}a.forEach(r=>{const a=i[r],o={reducerName:r,type:Ia(t,r),createNotation:"function"==typeof e.reducers};!function(e){return"asyncThunk"===e._reducerDefinitionType}(a)?function({type:e,reducerName:t,createNotation:n},r,i){let a,o;if("reducer"in r){if(n&&!function(e){return"reducerWithPrepare"===e._reducerDefinitionType}(r))throw new Error(yo(17));a=r.reducer,o=r.prepare}else a=r;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,o?Oa(e,o):Oa(e))}(o,a,c):function({type:e,reducerName:t},n,r,i){if(!i)throw new Error(yo(18));const{payloadCreator:a,fulfilled:o,pending:c,rejected:l,settled:u,options:s}=n,f=i(e,a,s);r.exposeAction(t,f),o&&r.addCase(f.fulfilled,o),c&&r.addCase(f.pending,c),l&&r.addCase(f.rejected,l),u&&r.addMatcher(f.settled,u),r.exposeCaseReducer(t,{fulfilled:o||La,pending:c||La,rejected:l||La,settled:u||La})}(o,a,c,n)});const u=e=>e,s=new Map,f=new WeakMap;let d;function h(e,t){return d||(d=l()),d(e,t)}function p(){return d||(d=l()),d.getInitialState()}function y(t,n=!1){function r(e){let i=e[t];return void 0===i&&n&&(i=Aa(f,r,p)),i}function i(t=u){const r=Aa(s,n,()=>new WeakMap);return Aa(r,t,()=>{const r={};for(const[i,a]of Object.entries(e.selectors??{}))r[i]=Na(a,t,()=>Aa(f,t,p),n);return r})}return{reducerPath:t,getSelectors:i,get selectors(){return i(r)},selectSlice:r}}const v={name:t,reducer:h,actions:o.actionCreators,caseReducers:o.sliceCaseReducersByName,getInitialState:p,...y(r),injectInto(e,{reducerPath:t,...n}={}){const i=t??r;return e.inject({reducerPath:i,reducer:h},n),{...v,...y(i,!0)}}};return v}}function Na(e,t,n,r){function i(i,...a){let o=t(i);return void 0===o&&r&&(o=n()),e(o,...a)}return i.unwrapped=e,i}var za=Da();function La(){}var Ra="listener",Ba="completed",Ka="cancelled",Fa=`task-${Ka}`,Ua=`task-${Ba}`,Wa=`${Ra}-${Ka}`,$a=`${Ra}-${Ba}`,Ha=class{constructor(e){t(this,"name","TaskAbortError"),t(this,"message"),this.code=e,this.message=`task ${Ka} (reason: ${e})`}},Va=(e,t)=>{if("function"!=typeof e)throw new TypeError(yo(32))},qa=()=>{},Ya=(e,t=qa)=>(e.catch(t),e),Xa=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),Ga=e=>{if(e.aborted)throw new Ha(e.reason)};function Za(e,t){let n=qa;return new Promise((r,i)=>{const a=()=>i(new Ha(e.reason));e.aborted?a():(n=Xa(e,a),t.finally(()=>n()).then(r,i))}).finally(()=>{n=qa})}var Qa=e=>t=>Ya(Za(e,t).then(t=>(Ga(e),t))),Ja=e=>{const t=Qa(e);return e=>t(new Promise(t=>setTimeout(t,e)))},{assign:eo}=Object,to={},no="listenerMiddleware",ro=(e,t)=>(n,r)=>{Va(n);const i=new AbortController;var a;a=i,Xa(e,()=>a.abort(e.reason));const o=(async(t,r)=>{try{return await Promise.resolve(),{status:"ok",value:await(async()=>{Ga(e),Ga(i.signal);const t=await n({pause:Qa(i.signal),delay:Ja(i.signal),signal:i.signal});return Ga(i.signal),t})()}}catch(a){return{status:a instanceof Ha?"cancelled":"rejected",error:a}}finally{null==r||r()}})(0,()=>i.abort(Ua));return(null==r?void 0:r.autoJoin)&&t.push(o.catch(qa)),{result:Qa(e)(o),cancel(){i.abort(Fa)}}},io=e=>{let{type:t,actionCreator:n,matcher:r,predicate:i,effect:a}=e;if(t)i=Oa(t).match;else if(n)t=n.type,i=n.match;else if(r)i=r;else if(!i)throw new Error(yo(21));return Va(a),{predicate:i,type:t,effect:a}},ao=eo(e=>{const{type:t,predicate:n,effect:r}=io(e);return{id:Ca(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(yo(22))}}},{withTypes:()=>ao}),oo=(e,t)=>{const{type:n,effect:r,predicate:i}=io(t);return Array.from(e.values()).find(e=>("string"==typeof n?e.type===n:e.predicate===i)&&e.effect===r)},co=e=>{e.pending.forEach(e=>{e.abort(Wa)})},lo=(e,t,n)=>{try{e(t,n)}catch(r){setTimeout(()=>{throw r},0)}},uo=eo(Oa(`${no}/add`),{withTypes:()=>uo}),so=Oa(`${no}/removeAll`),fo=eo(Oa(`${no}/remove`),{withTypes:()=>fo}),ho=(...e)=>{},po=(e={})=>{const t=new Map,n=new Map,{extra:r,onError:i=ho}=e;Va(i);const a=e=>{return(n=oo(t,e)??ao(e)).unsubscribe=()=>t.delete(n.id),t.set(n.id,n),e=>{n.unsubscribe(),(null==e?void 0:e.cancelActive)&&co(n)};var n};eo(a,{withTypes:()=>a});const o=e=>{const n=oo(t,e);return n&&(n.unsubscribe(),e.cancelActive&&co(n)),!!n};eo(o,{withTypes:()=>o});const c=async(e,o,c,l)=>{const u=new AbortController,s=((e,t)=>(n,r)=>Ya((async(n,r)=>{Ga(t);let i=()=>{};const a=[new Promise((t,r)=>{let a=e({predicate:n,effect:(e,n)=>{n.unsubscribe(),t([e,n.getState(),n.getOriginalState()])}});i=()=>{a(),r()}})];null!=r&&a.push(new Promise(e=>setTimeout(e,r,null)));try{const e=await Za(t,Promise.race(a));return Ga(t),e}finally{i()}})(n,r)))(a,u.signal),f=[];try{e.pending.add(u),(e=>{const t=n.get(e)??0;n.set(e,t+1)})(e),await Promise.resolve(e.effect(o,eo({},c,{getOriginalState:l,condition:(e,t)=>s(e,t).then(Boolean),take:s,delay:Ja(u.signal),pause:Qa(u.signal),extra:r,signal:u.signal,fork:ro(u.signal,f),unsubscribe:e.unsubscribe,subscribe:()=>{t.set(e.id,e)},cancelActiveListeners:()=>{e.pending.forEach((e,t,n)=>{e!==u&&(e.abort(Wa),n.delete(e))})},cancel:()=>{u.abort(Wa),e.pending.delete(u)},throwIfCancelled:()=>{Ga(u.signal)}})))}catch(d){d instanceof Ha||lo(i,d,{raisedBy:"effect"})}finally{await Promise.all(f),u.abort($a),(e=>{const t=n.get(e)??1;1===t?n.delete(e):n.set(e,t-1)})(e),e.pending.delete(u)}},l=((e,t)=>()=>{for(const e of t.keys())co(e);e.clear()})(t,n);return{middleware:e=>n=>r=>{if(!li(r))return n(r);if(uo.match(r))return a(r.payload);if(so.match(r))return void l();if(fo.match(r))return o(r.payload);let u=e.getState();const s=()=>{if(u===to)throw new Error(yo(23));return u};let f;try{if(f=n(r),t.size>0){const n=e.getState(),a=Array.from(t.values());for(const t of a){let a=!1;try{a=t.predicate(r,n,u)}catch(d){a=!1,lo(i,d,{raisedBy:"predicate"})}a&&c(t,r,e,s)}}}finally{u=to}return f},startListening:a,stopListening:o,clearListeners:l}};function yo(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var vo=za({name:"chartLayout",initialState:{layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){var n,r,i,a;e.margin.top=null!==(n=t.payload.top)&&void 0!==n?n:0,e.margin.right=null!==(r=t.payload.right)&&void 0!==r?r:0,e.margin.bottom=null!==(i=t.payload.bottom)&&void 0!==i?i:0,e.margin.left=null!==(a=t.payload.left)&&void 0!==a?a:0},setScale(e,t){e.scale=t.payload}}}),{setMargin:go,setLayout:mo,setChartSize:bo,setScale:wo}=vo.actions,xo=vo.reducer;function Oo(e,t,n){return Array.isArray(e)&&e&&t+n!==0?e.slice(t,n+1):e}function _o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Po(e){for(var t=1;t"horizontal"===e&&"xAxis"===t||"vertical"===e&&"yAxis"===t||"centric"===e&&"angleAxis"===t||"radial"===e&&"radiusAxis"===t,jo=(e,t,n,r)=>{if(r)return e.map(e=>e.coordinate);var i,a,o=e.map(e=>(e.coordinate===t&&(i=!0),e.coordinate===n&&(a=!0),e.coordinate));return i||o.push(t),a||o.push(n),o},ko=(e,t,n)=>{if(!e)return null;var{duplicateDomain:r,type:i,range:a,scale:o,realScaleType:c,isCategorical:l,categoricalDomain:u,tickCount:s,ticks:f,niceTicks:d,axisType:h}=e;if(!o)return null;var p="scaleBand"===c&&o.bandwidth?o.bandwidth()/2:2,y="category"===i&&o.bandwidth?o.bandwidth()/p:0;return y="angleAxis"===h&&a&&a.length>=2?2*tt(a[0]-a[1])*y:y,f||d?(f||d||[]).map((e,t)=>{var n=r?r.indexOf(e):e;return{coordinate:o(n)+y,value:e,offset:y,index:t}}).filter(e=>!nt(e.coordinate)):l&&u?u.map((e,t)=>({coordinate:o(e)+y,value:e,index:t,offset:y})):o.ticks&&null!=s?o.ticks(s).map((e,t)=>({coordinate:o(e)+y,value:e,offset:y,index:t})):o.domain().map((e,t)=>({coordinate:o(e)+y,value:r?r[e]:e,index:t,offset:y}))},Mo=1e-4,Co={sign:e=>{var t=e.length;if(!(t<=0))for(var n=0,r=e[0].length;n=0?(e[o][n][0]=i,e[o][n][1]=i+c,i=e[o][n][1]):(e[o][n][0]=a,e[o][n][1]=a+c,a=e[o][n][1])}},expand:function(e,t){if((r=e.length)>0){for(var n,r,i,a=0,o=e[0].length;a0){for(var n,r=0,i=e[t[0]],a=i.length;r0&&(r=(n=e[t[0]]).length)>0){for(var n,r,i,a=0,o=1;o{var t=e.length;if(!(t<=0))for(var n=0,r=e[0].length;n=0?(e[a][n][0]=i,e[a][n][1]=i+o,i=e[a][n][1]):(e[a][n][0]=0,e[a][n][1]=0)}}},To=(e,t,n)=>{var r=Co[n],i=function(){var e=k([]),t=Me,n=ke,r=Ce;function i(i){var a,o,c=Array.from(e.apply(this,arguments),Te),l=c.length,u=-1;for(const e of i)for(a=0,++u;aNumber(Eo(e,t,0))).order(Me).offset(r);return i(e)};function Io(e){var{axis:t,ticks:n,bandSize:r,entry:i,index:a,dataKey:o}=e;if("category"===t.type){if(!t.allowDuplicatedCategory&&t.dataKey&&!dt(i[t.dataKey])){var c=ft(n,"value",i[t.dataKey]);if(c)return c.coordinate+r/2}return n[a]?n[a].coordinate+r/2:null}var l=Eo(i,dt(o)?t.dataKey:o);return dt(l)?null:t.scale(l)}var Do=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,No=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,zo=(e,t,n)=>{if(e&&e.scale&&e.scale.bandwidth){var r=e.scale.bandwidth();if(!n||r>0)return r}if(e&&t&&t.length>=2){for(var i=Qr(t,e=>e.coordinate),a=1/0,o=1,c=i.length;oe.layout.width,Ko=e=>e.layout.height,Fo=e=>e.layout.scale,Uo=e=>e.layout.margin,Wo=jr(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),$o=jr(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),Ho=["#1890FF","#66B5FF","#41D9C7","#2FC25B","#6EDB8F","#9AE65C","#FACC14","#E6965C","#57AD71","#223273","#738AE6","#7564CC","#8543E0","#A877ED","#5C8EE6","#13C2C2","#70E0E0","#5CA3E6","#3436C7","#8082FF","#DD81E6","#F04864","#FA7D92","#D598D9"];function Vo(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function qo(e){for(var t=1;te.brush.height,function(e){return $o(e).reduce((e,t)=>"left"!==t.orientation||t.mirror||t.hide?e:e+("number"==typeof t.width?t.width:60),0)},function(e){return $o(e).reduce((e,t)=>"right"!==t.orientation||t.mirror||t.hide?e:e+("number"==typeof t.width?t.width:60),0)},function(e){return Wo(e).reduce((e,t)=>"top"!==t.orientation||t.mirror||t.hide?e:e+t.height,0)},function(e){return Wo(e).reduce((e,t)=>"bottom"!==t.orientation||t.mirror||t.hide?e:e+t.height,0)},Jr,e=>e.legend.size],(e,t,n,r,i,a,o,c,l,u)=>{var s={left:(n.left||0)+i,right:(n.right||0)+a},f=qo(qo({},{top:(n.top||0)+o,bottom:(n.bottom||0)+c}),s),d=f.bottom;f.bottom+=r,f=((e,t,n)=>{if(t&&n){var{width:r,height:i}=n,{align:a,verticalAlign:o,layout:c}=t;if(("vertical"===c||"horizontal"===c&&"middle"===o)&&"center"!==a&&it(e[a]))return Po(Po({},e),{},{[a]:e[a]+(r||0)});if(("horizontal"===c||"vertical"===c&&"center"===a)&&"middle"!==o&&it(e[o]))return Po(Po({},e),{},{[o]:e[o]+(i||0)})}return e})(f,l,u);var h=e-f.left-f.right,p=t-f.top-f.bottom;return qo(qo({brushBottom:d},f),{},{width:Math.max(h,0),height:Math.max(p,0)})}),tc=jr(ec,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),nc=jr(Bo,Ko,(e,t)=>({x:0,y:0,width:e,height:t})),rc=r.createContext(null),ic=()=>null!=r.useContext(rc),ac=e=>e.brush,oc=jr([ac,ec,Uo],(e,t,n)=>({height:e.height,x:it(e.x)?e.x:t.left,y:it(e.y)?e.y:t.top+t.height+t.brushBottom-((null==n?void 0:n.bottom)||0),width:it(e.width)?e.width:t.width})),cc={},lc={},uc={};function sc(){return Xo||(Xo=1,e=uc,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e.debounce=function(e,t,{signal:n,edges:r}={}){let i,a=null;const o=null!=r&&r.includes("leading"),c=null==r||r.includes("trailing"),l=()=>{null!==a&&(e.apply(i,a),i=void 0,a=null)};let u=null;const s=()=>{null!=u&&clearTimeout(u),u=setTimeout(()=>{u=null,c&&l(),f()},t)},f=()=>{null!==u&&(clearTimeout(u),u=null),i=void 0,a=null},d=function(...e){if(null==n?void 0:n.aborted)return;i=this,a=e;const t=null==u;s(),o&&t&&l()};return d.schedule=s,d.cancel=f,d.flush=()=>{l()},null==n||n.addEventListener("abort",f,{once:!0}),d}),uc;var e}function fc(){return Go||(Go=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=sc();e.debounce=function(e,n=0,r={}){"object"!=typeof r&&(r={});const{leading:i=!1,trailing:a=!0,maxWait:o}=r,c=Array(2);let l;i&&(c[0]="leading"),a&&(c[1]="trailing");let u=null;const s=t.debounce(function(...t){l=e.apply(this,t),u=null},n,{edges:c}),f=function(...t){return null!=o&&(null===u&&(u=Date.now()),Date.now()-u>=o)?(l=e.apply(this,t),u=Date.now(),s.cancel(),s.schedule(),l):(s.apply(this,t),l)};return f.cancel=s.cancel,f.flush=()=>(s.flush(),l),f}}(lc)),lc}function dc(){return Jo?Qo:(Jo=1,Qo=(Zo||(Zo=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=fc();e.throttle=function(e,n=0,r={}){const{leading:i=!0,trailing:a=!0}=r;return t.debounce(e,n,{leading:i,maxWait:n,trailing:a})}}(cc)),cc).throttle)}const hc=o(dc());var pc=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i{var{width:r="100%",height:i="100%",aspect:a,maxHeight:o}=n,c=rt(r)?e:Number(r),l=rt(i)?t:Number(i);return a&&a>0&&(c?l=c/a:l&&(c=l*a),o&&null!=l&&l>o&&(l=o)),{calculatedWidth:c,calculatedHeight:l}},vc={width:0,height:0,overflow:"visible"},gc={width:0,overflowX:"visible"},mc={height:0,overflowY:"visible"},bc={},wc=e=>{var{width:t,height:n}=e,r=rt(t),i=rt(n);return r&&i?vc:r?gc:i?mc:bc};function xc(e){return Number.isFinite(e)}function Oc(e){return"number"==typeof e&&e>0&&Number.isFinite(e)}function _c(){return _c=Object.assign?Object.assign.bind():function(e){for(var t=1;t({width:n,height:i}),[n,i]);return function(e){return Oc(e.width)&&Oc(e.height)}(a)?r.createElement(Sc.Provider,{value:a},t):null}var kc=()=>r.useContext(Sc),Mc=r.forwardRef((e,t)=>{var{aspect:n,initialDimension:i={width:-1,height:-1},width:a,height:o,minWidth:c=0,minHeight:u,maxHeight:s,children:f,debounce:d=0,id:h,className:p,onResize:y,style:v={}}=e,g=r.useRef(null),m=r.useRef();m.current=y,r.useImperativeHandle(t,()=>g.current);var[b,w]=r.useState({containerWidth:i.width,containerHeight:i.height}),x=r.useCallback((e,t)=>{w(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]);r.useEffect(()=>{if(null==g.current||"undefined"==typeof ResizeObserver)return yt;var e=e=>{var t,{width:n,height:r}=e[0].contentRect;x(n,r),null===(t=m.current)||void 0===t||t.call(m,n,r)};d>0&&(e=hc(e,d,{trailing:!0,leading:!1}));var t=new ResizeObserver(e),{width:n,height:r}=g.current.getBoundingClientRect();return x(n,r),t.observe(g.current),()=>{t.disconnect()}},[x,d]);var{containerWidth:O,containerHeight:_}=b;pc(!n||n>0,"The aspect(%s) must be greater than zero.",n);var{calculatedWidth:P,calculatedHeight:A}=yc(O,_,{width:a,height:o,aspect:n,maxHeight:s});return pc(null!=P&&P>0||null!=A&&A>0,"The width(%s) and height(%s) of chart should be greater than 0,\n please check the style of container, or the props width(%s) and height(%s),\n or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the\n height and width.",P,A,a,o,c,u,n),r.createElement("div",{id:h?"".concat(h):void 0,className:l("recharts-responsive-container",p),style:Ac(Ac({},v),{},{width:a,height:o,minWidth:c,minHeight:u,maxHeight:s}),ref:g},r.createElement("div",{style:wc({width:a,height:o})},r.createElement(jc,{width:P,height:A},f)))}),Cc=r.forwardRef((e,t)=>{var n=kc();if(Oc(n.width)&&Oc(n.height))return e.children;var{width:i,height:a}=function(e){var{width:t,height:n,aspect:r}=e,i=t,a=n;return void 0===i&&void 0===a?(i="100%",a="100%"):void 0===i?i=r&&r>0?void 0:"100%":void 0===a&&(a=r&&r>0?void 0:"100%"),{width:i,height:a}}({width:e.width,height:e.height,aspect:e.aspect}),{calculatedWidth:o,calculatedHeight:c}=yc(void 0,void 0,{width:i,height:a,aspect:e.aspect,maxHeight:e.maxHeight});return it(o)&&it(c)?r.createElement(jc,{width:o,height:c},e.children):r.createElement(Mc,_c({},e,{width:i,height:a,ref:t}))});function Tc(e){if(e)return{x:e.x,y:e.y,upperWidth:"upperWidth"in e?e.upperWidth:e.width,lowerWidth:"lowerWidth"in e?e.lowerWidth:e.width,width:e.width,height:e.height}}var Ic=()=>{var e,t=ic(),n=xr(tc),r=xr(oc),i=null===(e=xr(ac))||void 0===e?void 0:e.padding;return t&&r&&i?{width:r.width-i.left-i.right,height:r.height-i.top-i.bottom,x:i.left,y:i.top}:n},Dc={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},Nc=()=>{var e;return null!==(e=xr(ec))&&void 0!==e?e:Dc},zc=()=>xr(Bo),Lc=()=>xr(Ko),Rc=e=>e.layout.layoutType,Bc=()=>xr(Rc),Kc=e=>{var t=gr(),n=ic(),{width:i,height:a}=e,o=kc(),c=i,l=a;return o&&(c=o.width>0?o.width:i,l=o.height>0?o.height:a),r.useEffect(()=>{!n&&Oc(c)&&Oc(l)&&t(bo({width:c,height:l}))},[t,n,c,l]),null},Fc=e=>{var{margin:t}=e,n=gr();return r.useEffect(()=>{n(go(t))},[n,t]),null},Uc=Symbol.for("immer-nothing"),Wc=Symbol.for("immer-draftable"),$c=Symbol.for("immer-state");function Hc(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Vc=Object.getPrototypeOf;function qc(e){return!!e&&!!e[$c]}function Yc(e){var t;return!!e&&(Zc(e)||Array.isArray(e)||!!e[Wc]||!!(null==(t=e.constructor)?void 0:t[Wc])||nl(e)||rl(e))}var Xc=Object.prototype.constructor.toString(),Gc=new WeakMap;function Zc(e){if(!e||"object"!=typeof e)return!1;const t=Object.getPrototypeOf(e);if(null===t||t===Object.prototype)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(n===Object)return!0;if("function"!=typeof n)return!1;let r=Gc.get(n);return void 0===r&&(r=Function.toString.call(n),Gc.set(n,r)),r===Xc}function Qc(e,t,n=!0){0===Jc(e)?(n?Reflect.ownKeys(e):Object.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Jc(e){const t=e[$c];return t?t.type_:Array.isArray(e)?1:nl(e)?2:rl(e)?3:0}function el(e,t){return 2===Jc(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function tl(e,t,n){const r=Jc(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function nl(e){return e instanceof Map}function rl(e){return e instanceof Set}function il(e){return e.copy_||e.base_}function al(e,t){if(nl(e))return new Map(e);if(rl(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=Zc(e);if(!0===t||"class_only"===t&&!n){const t=Object.getOwnPropertyDescriptors(e);delete t[$c];let n=Reflect.ownKeys(t);for(let r=0;r1&&Object.defineProperties(e,{set:cl,add:cl,clear:cl,delete:cl}),Object.freeze(e),t&&Object.values(e).forEach(e=>ol(e,!0))),e}var cl={value:function(){Hc(2)}};function ll(e){return null===e||"object"!=typeof e||Object.isFrozen(e)}var ul,sl={};function fl(e){const t=sl[e];return t||Hc(0),t}function dl(){return ul}function hl(e,t){t&&(fl("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function pl(e){yl(e),e.drafts_.forEach(gl),e.drafts_=null}function yl(e){e===ul&&(ul=e.parent_)}function vl(e){return ul={drafts_:[],parent_:ul,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function gl(e){const t=e[$c];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function ml(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[$c].modified_&&(pl(t),Hc(4)),Yc(e)&&(e=bl(t,e),t.parent_||xl(t,e)),t.patches_&&fl("Patches").generateReplacementPatches_(n[$c].base_,e,t.patches_,t.inversePatches_)):e=bl(t,n,[]),pl(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Uc?e:void 0}function bl(e,t,n){if(ll(t))return t;const r=e.immer_.shouldUseStrictIteration(),i=t[$c];if(!i)return Qc(t,(r,a)=>wl(e,i,t,r,a,n),r),t;if(i.scope_!==e)return t;if(!i.modified_)return xl(e,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const t=i.copy_;let a=t,o=!1;3===i.type_&&(a=new Set(t),t.clear(),o=!0),Qc(a,(r,a)=>wl(e,i,t,r,a,n,o),r),xl(e,t,!1),n&&e.patches_&&fl("Patches").generatePatches_(i,n,e.patches_,e.inversePatches_)}return i.copy_}function wl(e,t,n,r,i,a,o){if(null==i)return;if("object"!=typeof i&&!o)return;const c=ll(i);if(!c||o){if(qc(i)){const o=bl(e,i,a&&t&&3!==t.type_&&!el(t.assigned_,r)?a.concat(r):void 0);if(tl(n,r,o),!qc(o))return;e.canAutoFreeze_=!1}else o&&n.add(i);if(Yc(i)&&!c){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;if(t&&t.base_&&t.base_[r]===i&&c)return;bl(e,i),t&&t.scope_.parent_||"symbol"==typeof r||!(nl(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))||xl(e,i)}}}function xl(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&ol(t,n)}var Ol={get(e,t){if(t===$c)return e;const n=il(e);if(!el(n,t))return function(e,t,n){var r;const i=Al(t,n);return i?"value"in i?i.value:null==(r=i.get)?void 0:r.call(e.draft_):void 0}(e,n,t);const r=n[t];return e.finalized_||!Yc(r)?r:r===Pl(e.base_,t)?(Sl(e),e.copy_[t]=jl(r,e)):r},has:(e,t)=>t in il(e),ownKeys:e=>Reflect.ownKeys(il(e)),set(e,t,n){const r=Al(il(e),t);if(null==r?void 0:r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=Pl(il(e),t),o=null==r?void 0:r[$c];if(o&&o.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(((i=n)===(a=r)?0!==i||1/i==1/a:i!=i&&a!=a)&&(void 0!==n||el(e.base_,t)))return!0;Sl(e),El(e)}var i,a;return e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty:(e,t)=>(void 0!==Pl(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,Sl(e),El(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=il(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty(){Hc(11)},getPrototypeOf:e=>Vc(e.base_),setPrototypeOf(){Hc(12)}},_l={};function Pl(e,t){const n=e[$c];return(n?il(n):e)[t]}function Al(e,t){if(!(t in e))return;let n=Vc(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=Vc(n)}}function El(e){e.modified_||(e.modified_=!0,e.parent_&&El(e.parent_))}function Sl(e){e.copy_||(e.copy_=al(e.base_,e.scope_.immer_.useStrictShallowCopy_))}function jl(e,t){const n=nl(e)?fl("MapSet").proxyMap_(e,t):rl(e)?fl("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:dl(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,a=Ol;n&&(i=[r],a=_l);const{revoke:o,proxy:c}=Proxy.revocable(i,a);return r.draft_=c,r.revoke_=o,c}(e,t);return(t?t.scope_:dl()).drafts_.push(n),n}function kl(e){if(!Yc(e)||ll(e))return e;const t=e[$c];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=al(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=al(e,!0);return Qc(n,(e,t)=>{tl(n,e,kl(t))},r),t&&(t.finalized_=!1),n}Qc(Ol,(e,t)=>{_l[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),_l.deleteProperty=function(e,t){return _l.set.call(this,e,t,void 0)},_l.set=function(e,t,n){return Ol.set.call(this,e[0],t,n,e[0])},(new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(e,t,n)=>{if("function"==typeof e&&"function"!=typeof t){const n=t;t=e;const r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}let r;if("function"!=typeof t&&Hc(6),void 0!==n&&"function"!=typeof n&&Hc(7),Yc(e)){const i=vl(this),a=jl(e,void 0);let o=!0;try{r=t(a),o=!1}finally{o?pl(i):yl(i)}return hl(i,n),ml(r,i)}if(!e||"object"!=typeof e){if(r=t(e),void 0===r&&(r=e),r===Uc&&(r=void 0),this.autoFreeze_&&ol(r,!0),n){const t=[],i=[];fl("Patches").generateReplacementPatches_(e,r,t,i),n(t,i)}return r}Hc(1)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;return[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof(null==e?void 0:e.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),"boolean"==typeof(null==e?void 0:e.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){var t;Yc(e)||Hc(8),qc(e)&&(qc(t=e)||Hc(10),e=kl(t));const n=vl(this),r=jl(e,void 0);return r[$c].isManual_=!0,yl(n),r}finishDraft(e,t){const n=e&&e[$c];n&&n.isManual_||Hc(9);const{scope_:r}=n;return hl(r,t),ml(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));const r=fl("Patches").applyPatches_;return qc(e)?r(e,t):this.produce(e,e=>r(e,t))}}).produce;var Ml=za({name:"legend",initialState:{settings:{layout:"horizontal",align:"center",verticalAlign:"middle",itemSorter:"value"},size:{width:0,height:0},payload:[]},reducers:{setLegendSize(e,t){e.size.width=t.payload.width,e.size.height=t.payload.height},setLegendSettings(e,t){e.settings.align=t.payload.align,e.settings.layout=t.payload.layout,e.settings.verticalAlign=t.payload.verticalAlign,e.settings.itemSorter=t.payload.itemSorter},addLegendPayload:{reducer(e,t){e.payload.push(t.payload)},prepare:Sa()},replaceLegendPayload:{reducer(e,t){var{prev:n,next:r}=t.payload,i=ya(e).payload.indexOf(n);i>-1&&(e.payload[i]=r)},prepare:Sa()},removeLegendPayload:{reducer(e,t){var n=ya(e).payload.indexOf(t.payload);n>-1&&e.payload.splice(n,1)},prepare:Sa()}}}),{setLegendSize:Cl,setLegendSettings:Tl,addLegendPayload:Il,replaceLegendPayload:Dl,removeLegendPayload:Nl}=Ml.actions,zl=Ml.reducer;function Ll(){return Ll=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{separator:t=" : ",contentStyle:n={},itemStyle:i={},labelStyle:a={},payload:o,formatter:c,itemSorter:u,wrapperClassName:s,labelClassName:f,label:d,labelFormatter:h,accessibilityLayer:p=!1}=e,y=Bl({margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},n),v=Bl({margin:0},a),g=!dt(d),m=g?d:"",b=l("recharts-default-tooltip",s),w=l("recharts-tooltip-label",f);g&&h&&null!=o&&(m=h(d,o));var x=p?{role:"status","aria-live":"assertive"}:{};return r.createElement("div",Ll({className:b,style:y},x),r.createElement("p",{className:w,style:v},r.isValidElement(m)?m:"".concat(m)),(()=>{if(o&&o.length){var e=(u?Qr(o,u):o).map((e,n)=>{if("none"===e.type)return null;var a=e.formatter||c||Fl,{value:l,name:u}=e,s=l,f=u;if(a){var d=a(l,u,e,n,o);if(Array.isArray(d))[s,f]=d;else{if(null==d)return null;s=d}}var h=Bl({display:"block",paddingTop:4,paddingBottom:4,color:e.color||"#000"},i);return r.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(n),style:h},at(f)?r.createElement("span",{className:"recharts-tooltip-item-name"},f):null,at(f)?r.createElement("span",{className:"recharts-tooltip-item-separator"},t):null,r.createElement("span",{className:"recharts-tooltip-item-value"},s),r.createElement("span",{className:"recharts-tooltip-item-unit"},e.unit||""))});return r.createElement("ul",{className:"recharts-tooltip-item-list",style:{padding:0,margin:0}},e)}return null})())},Wl="recharts-tooltip-wrapper",$l={visibility:"hidden"};function Hl(e){var{coordinate:t,translateX:n,translateY:r}=e;return l(Wl,{["".concat(Wl,"-right")]:it(n)&&t&&it(t.x)&&n>=t.x,["".concat(Wl,"-left")]:it(n)&&t&&it(t.x)&&n=t.y,["".concat(Wl,"-top")]:it(r)&&t&&it(t.y)&&r0?i:0),f=n[r]+i;if(t[r])return o[r]?s:f;var d=l[r];return null==d?0:o[r]?sd+u?Math.max(s,d):Math.max(f,d)}function ql(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Yl(e){for(var t=1;t{var t,n,r,i;"Escape"===e.key&&this.setState({dismissed:!0,dismissedAtCoordinate:{x:null!==(t=null===(n=this.props.coordinate)||void 0===n?void 0:n.x)&&void 0!==t?t:0,y:null!==(r=null===(i=this.props.coordinate)||void 0===i?void 0:i.y)&&void 0!==r?r:0}})})}componentDidMount(){document.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.removeEventListener("keydown",this.handleKeyDown)}componentDidUpdate(){var e,t;this.state.dismissed&&((null===(e=this.props.coordinate)||void 0===e?void 0:e.x)===this.state.dismissedAtCoordinate.x&&(null===(t=this.props.coordinate)||void 0===t?void 0:t.y)===this.state.dismissedAtCoordinate.y||(this.state.dismissed=!1))}render(){var{active:e,allowEscapeViewBox:t,animationDuration:n,animationEasing:i,children:a,coordinate:o,hasPayload:c,isAnimationActive:l,offset:u,position:s,reverseDirection:f,useTranslate3d:d,viewBox:h,wrapperStyle:p,lastBoundingBox:y,innerRef:v,hasPortalFromProps:g}=this.props,{cssClasses:m,cssProperties:b}=function(e){var t,n,r,{allowEscapeViewBox:i,coordinate:a,offsetTopLeft:o,position:c,reverseDirection:l,tooltipBox:u,useTranslate3d:s,viewBox:f}=e;return t=u.height>0&&u.width>0&&a?function(e){var{translateX:t,translateY:n,useTranslate3d:r}=e;return{transform:r?"translate3d(".concat(t,"px, ").concat(n,"px, 0)"):"translate(".concat(t,"px, ").concat(n,"px)")}}({translateX:n=Vl({allowEscapeViewBox:i,coordinate:a,key:"x",offsetTopLeft:o,position:c,reverseDirection:l,tooltipDimension:u.width,viewBox:f,viewBoxDimension:f.width}),translateY:r=Vl({allowEscapeViewBox:i,coordinate:a,key:"y",offsetTopLeft:o,position:c,reverseDirection:l,tooltipDimension:u.height,viewBox:f,viewBoxDimension:f.height}),useTranslate3d:s}):$l,{cssProperties:t,cssClasses:Hl({translateX:n,translateY:r,coordinate:a})}}({allowEscapeViewBox:t,coordinate:o,offsetTopLeft:u,position:s,reverseDirection:f,tooltipBox:{height:y.height,width:y.width},useTranslate3d:d,viewBox:h}),w=g?{}:Yl(Yl({transition:l&&e?"transform ".concat(n,"ms ").concat(i):void 0},b),{},{pointerEvents:"none",visibility:!this.state.dismissed&&e&&c?"visible":"hidden",position:"absolute",top:0,left:0}),x=Yl(Yl({},w),{},{visibility:!this.state.dismissed&&e&&c?"visible":"hidden"},p);return r.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:m,style:x,ref:v},a)}}var Zl=()=>{var e;return null===(e=xr(e=>e.rootProps.accessibilityLayer))||void 0===e||e};function Ql(){return Ql=Object.assign?Object.assign.bind():function(e){for(var t=1;txc(e.x)&&xc(e.y),iu=e=>null!=e.base&&ru(e.base)&&ru(e),au=e=>e.x,ou=e=>e.y,cu=e=>{var{className:t,points:n,path:i,pathRef:a}=e;if(!(n&&n.length||i))return null;var o=n&&n.length?(e=>{var{type:t="linear",points:n=[],baseLine:r,layout:i,connectNulls:a=!1}=e,o=((e,t)=>{if("function"==typeof e)return e;var n="curve".concat(ht(e));return"curveMonotone"!==n&&"curveBump"!==n||!t?nu[n]||$:nu["".concat(n).concat("vertical"===t?"Y":"X")]})(t,i),c=a?n.filter(ru):n;if(Array.isArray(r)){var l=n.map((e,t)=>eu(eu({},e),{},{base:r[t]}));return("vertical"===i?Y().y(ou).x1(au).x0(e=>e.base.x):Y().x(au).y1(ou).y0(e=>e.base.y)).defined(iu).curve(o)(a?l.filter(iu):l)}return("vertical"===i&&it(r)?Y().y(ou).x1(au).x0(r):it(r)?Y().x(au).y1(ou).y0(r):q().x(au).y(ou)).defined(ru).curve(o)(c)})(e):i;return r.createElement("path",Ql({},b(e),At(e),{className:l("recharts-curve",t),d:null===o?void 0:o,ref:a}))},lu=["x","y","top","left","width","height","className"];function uu(){return uu=Object.assign?Object.assign.bind():function(e){for(var t=1;t"M".concat(e,",").concat(i,"v").concat(r,"M").concat(a,",").concat(t,"h").concat(n),hu=e=>{var{x:t=0,y:n=0,top:i=0,left:a=0,width:o=0,height:c=0,className:u}=e,s=function(e){for(var t=1;te.map(e=>{return"".concat((r=e,r.replace(/([A-Z])/g,e=>"-".concat(e.toLowerCase())))," ").concat(t,"ms ").concat(n);var r}).join(","),mu=(e,t)=>Object.keys(t).reduce((n,r)=>yu(yu({},n),{},{[r]:e(r,t[r])}),{});function bu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function wu(e){for(var t=1;te+(t-e)*n,_u=e=>{var{from:t,to:n}=e;return t!==n},Pu=(e,t,n)=>{var r=mu((t,n)=>{if(_u(n)){var[r,i]=e(n.from,n.to,n.velocity);return wu(wu({},n),{},{from:r,velocity:i})}return n},t);return n<1?mu((e,t)=>_u(t)?wu(wu({},t),{},{velocity:Ou(t.velocity,r[e].velocity,n),from:Ou(t.from,r[e].from,n)}):t,t):Pu(e,r,n-1)};const Au=(e,t,n,r,i,a)=>{var o,c,l=(o=e,c=t,[Object.keys(o),Object.keys(c)].reduce((e,t)=>e.filter(e=>t.includes(e))));return null==n?()=>(i(wu(wu({},e),t)),()=>{}):!0===n.isStepper?function(e,t,n,r,i,a){var o,c=r.reduce((n,r)=>wu(wu({},n),{},{[r]:{from:e[r],velocity:0,to:t[r]}}),{}),l=null,u=r=>{o||(o=r);var s=(r-o)/n.dt;c=Pu(n,c,s),i(wu(wu(wu({},e),t),mu((e,t)=>t.from,c))),o=r,Object.values(c).filter(_u).length&&(l=a.setTimeout(u))};return()=>(l=a.setTimeout(u),()=>{var e;null===(e=l)||void 0===e||e()})}(e,t,n,l,i,a):function(e,t,n,r,i,a,o){var c,l=null,u=i.reduce((n,r)=>wu(wu({},n),{},{[r]:[e[r],t[r]]}),{}),s=i=>{c||(c=i);var f=(i-c)/r,d=mu((e,t)=>Ou(...t,n(f)),u);if(a(wu(wu(wu({},e),t),d)),f<1)l=o.setTimeout(s);else{var h=mu((e,t)=>Ou(...t,n(1)),u);a(wu(wu(wu({},e),t),h))}};return()=>(l=o.setTimeout(s),()=>{var e;null===(e=l)||void 0===e||e()})}(e,t,n,r,l,i,a)};var Eu=1e-4,Su=(e,t)=>[0,3*e,3*t-6*e,3*e-3*t+1],ju=(e,t)=>e.map((e,n)=>e*t**n).reduce((e,t)=>e+t),ku=(e,t)=>n=>{var r=Su(e,t);return ju(r,n)},Mu=function(){return((e,t,n,r)=>{var i,a,o=ku(e,n),c=ku(t,r),l=(i=e,a=n,e=>{var t=[...Su(i,a).map((e,t)=>e*t).slice(1),0];return ju(t,e)}),u=e=>e>1?1:e<0?0:e,s=e=>{for(var t=e>1?1:e,n=t,r=0;r<8;++r){var i=o(n)-t,a=l(n);if(Math.abs(i-t)parseFloat(e));return[a[0],a[1],a[2],a[3]]}}return 4===t.length?t:[0,0,1,1]}(...arguments))};class Cu{setTimeout(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=performance.now(),r=null,i=a=>{a-n>=t?e(a):"function"==typeof requestAnimationFrame&&(r=requestAnimationFrame(i))};return r=requestAnimationFrame(i),()=>{null!=r&&cancelAnimationFrame(r)}}}function Tu(){return e=new Cu,t=()=>null,n=!1,r=null,i=a=>{if(!n){if(Array.isArray(a)){if(!a.length)return;var o=a,[c,...l]=o;return"number"==typeof c?void(r=e.setTimeout(i.bind(null,l),c)):(i(c),void(r=e.setTimeout(i.bind(null,l))))}"string"==typeof a&&t(a),"object"==typeof a&&t(a),"function"==typeof a&&a()}},{stop:()=>{n=!0},start:e=>{n=!1,r&&(r(),r=null),i(e)},subscribe:e=>(t=e,()=>{t=()=>null}),getTimeoutController:()=>e};var e,t,n,r,i}var Iu=r.createContext(Tu);function Du(e,t){var n=r.useContext(Iu);return r.useMemo(()=>null!=t?t:n(e),[e,t,n])}var Nu=!("undefined"!=typeof window&&window.document&&Boolean(window.document.createElement)&&window.setTimeout),zu={begin:0,duration:1e3,easing:"ease",isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}},Lu={t:0},Ru={t:1};function Bu(e){var t=jt(e,zu),{isActive:n,canBegin:i,duration:a,easing:o,begin:c,onAnimationEnd:l,onAnimationStart:u,children:s}=t,f="auto"===n?!Nu:n,d=Du(t.animationId,t.animationManager),[h,p]=r.useState(f?Lu:Ru),y=r.useRef(null);return r.useEffect(()=>{f||p(Ru)},[f]),r.useEffect(()=>{if(!f||!i)return yt;var e=Au(Lu,Ru,(e=>{if("string"==typeof e)switch(e){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return Mu(e);case"spring":return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{stiff:t=100,damping:n=8,dt:r=17}=e,i=(e,i,a)=>{var o=a+(-(e-i)*t-a*n)*r/1e3,c=a*r/1e3+e;return Math.abs(c-i){y.current=e()},a,l]),()=>{d.stop(),y.current&&y.current(),l()}},[f,i,a,o,c,u,l,d]),s(h.t)}function Ku(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"animation-",n=r.useRef(ct(t)),i=r.useRef(e);return i.current!==e&&(n.current=ct(t),i.current=e),n.current}var Fu=["radius"],Uu=["radius"];function Wu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function $u(e){for(var t=1;t{var a,o=Math.min(Math.abs(n)/2,Math.abs(r)/2),c=r>=0?1:-1,l=n>=0?1:-1,u=r>=0&&n>=0||r<0&&n<0?1:0;if(o>0&&i instanceof Array){for(var s=[0,0,0,0],f=0;f<4;f++)s[f]=i[f]>o?o:i[f];a="M".concat(e,",").concat(t+c*s[0]),s[0]>0&&(a+="A ".concat(s[0],",").concat(s[0],",0,0,").concat(u,",").concat(e+l*s[0],",").concat(t)),a+="L ".concat(e+n-l*s[1],",").concat(t),s[1]>0&&(a+="A ".concat(s[1],",").concat(s[1],",0,0,").concat(u,",\n ").concat(e+n,",").concat(t+c*s[1])),a+="L ".concat(e+n,",").concat(t+r-c*s[2]),s[2]>0&&(a+="A ".concat(s[2],",").concat(s[2],",0,0,").concat(u,",\n ").concat(e+n-l*s[2],",").concat(t+r)),a+="L ".concat(e+l*s[3],",").concat(t+r),s[3]>0&&(a+="A ".concat(s[3],",").concat(s[3],",0,0,").concat(u,",\n ").concat(e,",").concat(t+r-c*s[3])),a+="Z"}else if(o>0&&i===+i&&i>0){var d=Math.min(o,i);a="M ".concat(e,",").concat(t+c*d,"\n A ").concat(d,",").concat(d,",0,0,").concat(u,",").concat(e+l*d,",").concat(t,"\n L ").concat(e+n-l*d,",").concat(t,"\n A ").concat(d,",").concat(d,",0,0,").concat(u,",").concat(e+n,",").concat(t+c*d,"\n L ").concat(e+n,",").concat(t+r-c*d,"\n A ").concat(d,",").concat(d,",0,0,").concat(u,",").concat(e+n-l*d,",").concat(t+r,"\n L ").concat(e+l*d,",").concat(t+r,"\n A ").concat(d,",").concat(d,",0,0,").concat(u,",").concat(e,",").concat(t+r-c*d," Z")}else a="M ".concat(e,",").concat(t," h ").concat(n," v ").concat(r," h ").concat(-n," Z");return a},Xu={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},Gu=e=>{var t=jt(e,Xu),n=r.useRef(null),[i,a]=r.useState(-1);r.useEffect(()=>{if(n.current&&n.current.getTotalLength)try{var e=n.current.getTotalLength();e&&a(e)}catch(t){}},[]);var{x:o,y:c,width:u,height:s,radius:f,className:d}=t,{animationEasing:h,animationDuration:p,animationBegin:y,isAnimationActive:v,isUpdateAnimationActive:g}=t,m=r.useRef(u),b=r.useRef(s),w=r.useRef(o),O=r.useRef(c),_=Ku(r.useMemo(()=>({x:o,y:c,width:u,height:s,radius:f}),[o,c,u,s,f]),"rectangle-");if(o!==+o||c!==+c||u!==+u||s!==+s||0===u||0===s)return null;var P=l("recharts-rectangle",d);if(!g){var A=x(t),{radius:E}=A,S=qu(A,Fu);return r.createElement("path",Vu({},S,{radius:"number"==typeof f?f:void 0,className:P,d:Yu(o,c,u,s,f)}))}var j=m.current,k=b.current,M=w.current,C=O.current,T="0px ".concat(-1===i?1:i,"px"),I="".concat(i,"px 0px"),D=gu(["strokeDasharray"],p,"string"==typeof h?h:Xu.animationEasing);return r.createElement(Bu,{animationId:_,key:_,canBegin:i>0,duration:p,easing:h,isActive:g,begin:y},e=>{var i,a=st(j,u,e),l=st(k,s,e),d=st(M,o,e),h=st(C,c,e);n.current&&(m.current=a,b.current=l,w.current=d,O.current=h),i=v?e>0?{transition:D,strokeDasharray:I}:{strokeDasharray:T}:{strokeDasharray:I};var p=x(t),{radius:y}=p,g=qu(p,Uu);return r.createElement("path",Vu({},g,{radius:"number"==typeof f?f:void 0,className:P,d:Yu(d,h,a,l,f),ref:n,style:$u($u({},i),t.style)}))})};function Zu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Qu(e){for(var t=1;t180*e/Math.PI,ns=(e,t,n,r)=>({x:e+Math.cos(-es*r)*n,y:t+Math.sin(-es*r)*n}),rs=(e,t)=>{var{startAngle:n,endAngle:r}=t,i=Math.floor(n/360),a=Math.floor(r/360);return e+360*Math.min(i,a)},is=(e,t)=>{var{chartX:n,chartY:r}=e,{radius:i,angle:a}=((e,t)=>{var{x:n,y:r}=e,{cx:i,cy:a}=t,o=((e,t)=>{var{x:n,y:r}=e,{x:i,y:a}=t;return Math.sqrt((n-i)**2+(r-a)**2)})({x:n,y:r},{x:i,y:a});if(o<=0)return{radius:o,angle:0};var c=(n-i)/o,l=Math.acos(c);return r>a&&(l=2*Math.PI-l),{radius:o,angle:ts(l),angleInRadian:l}})({x:n,y:r},t),{innerRadius:o,outerRadius:c}=t;if(ic)return null;if(0===i)return null;var l,{startAngle:u,endAngle:s}=(e=>{var{startAngle:t,endAngle:n}=e,r=Math.floor(t/360),i=Math.floor(n/360),a=Math.min(r,i);return{startAngle:t-360*a,endAngle:n-360*a}})(t),f=a;if(u<=s){for(;f>s;)f-=360;for(;f=u&&f<=s}else{for(;f>u;)f-=360;for(;f=s&&f<=u}return l?Qu(Qu({},t),{},{radius:i,angle:rs(f,t)}):null};function as(e){var{cx:t,cy:n,radius:r,startAngle:i,endAngle:a}=e;return{points:[ns(t,n,r,i),ns(t,n,r,a)],cx:t,cy:n,radius:r,startAngle:i,endAngle:a}}function os(){return os=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{cx:t,cy:n,radius:r,angle:i,sign:a,isExternal:o,cornerRadius:c,cornerIsExternal:l}=e,u=c*(o?1:-1)+r,s=Math.asin(c/u)/es,f=l?i:i+a*s,d=l?i-a*s:i;return{center:ns(t,n,u,f),circleTangency:ns(t,n,r,f),lineTangency:ns(t,n,u*Math.cos(s*es),d),theta:s}},ls=e=>{var{cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:a,endAngle:o}=e,c=((e,t)=>tt(t-e)*Math.min(Math.abs(t-e),359.999))(a,o),l=a+c,u=ns(t,n,i,a),s=ns(t,n,i,l),f="M ".concat(u.x,",").concat(u.y,"\n A ").concat(i,",").concat(i,",0,\n ").concat(+(Math.abs(c)>180),",").concat(+(a>l),",\n ").concat(s.x,",").concat(s.y,"\n ");if(r>0){var d=ns(t,n,r,a),h=ns(t,n,r,l);f+="L ".concat(h.x,",").concat(h.y,"\n A ").concat(r,",").concat(r,",0,\n ").concat(+(Math.abs(c)>180),",").concat(+(a<=l),",\n ").concat(d.x,",").concat(d.y," Z")}else f+="L ".concat(t,",").concat(n," Z");return f},us={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},ss=e=>{var t=jt(e,us),{cx:n,cy:i,innerRadius:a,outerRadius:o,cornerRadius:c,forceCornerRadius:u,cornerIsExternal:s,startAngle:f,endAngle:d,className:h}=t;if(o0&&Math.abs(f-d)<360?(e=>{var{cx:t,cy:n,innerRadius:r,outerRadius:i,cornerRadius:a,forceCornerRadius:o,cornerIsExternal:c,startAngle:l,endAngle:u}=e,s=tt(u-l),{circleTangency:f,lineTangency:d,theta:h}=cs({cx:t,cy:n,radius:i,angle:l,sign:s,cornerRadius:a,cornerIsExternal:c}),{circleTangency:p,lineTangency:y,theta:v}=cs({cx:t,cy:n,radius:i,angle:u,sign:-s,cornerRadius:a,cornerIsExternal:c}),g=c?Math.abs(l-u):Math.abs(l-u)-h-v;if(g<0)return o?"M ".concat(d.x,",").concat(d.y,"\n a").concat(a,",").concat(a,",0,0,1,").concat(2*a,",0\n a").concat(a,",").concat(a,",0,0,1,").concat(2*-a,",0\n "):ls({cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:l,endAngle:u});var m="M ".concat(d.x,",").concat(d.y,"\n A").concat(a,",").concat(a,",0,0,").concat(+(s<0),",").concat(f.x,",").concat(f.y,"\n A").concat(i,",").concat(i,",0,").concat(+(g>180),",").concat(+(s<0),",").concat(p.x,",").concat(p.y,"\n A").concat(a,",").concat(a,",0,0,").concat(+(s<0),",").concat(y.x,",").concat(y.y,"\n ");if(r>0){var{circleTangency:b,lineTangency:w,theta:x}=cs({cx:t,cy:n,radius:r,angle:l,sign:s,isExternal:!0,cornerRadius:a,cornerIsExternal:c}),{circleTangency:O,lineTangency:_,theta:P}=cs({cx:t,cy:n,radius:r,angle:u,sign:-s,isExternal:!0,cornerRadius:a,cornerIsExternal:c}),A=c?Math.abs(l-u):Math.abs(l-u)-x-P;if(A<0&&0===a)return"".concat(m,"L").concat(t,",").concat(n,"Z");m+="L".concat(_.x,",").concat(_.y,"\n A").concat(a,",").concat(a,",0,0,").concat(+(s<0),",").concat(O.x,",").concat(O.y,"\n A").concat(r,",").concat(r,",0,").concat(+(A>180),",").concat(+(s>0),",").concat(b.x,",").concat(b.y,"\n A").concat(a,",").concat(a,",0,0,").concat(+(s<0),",").concat(w.x,",").concat(w.y,"Z")}else m+="L".concat(t,",").concat(n,"Z");return m})({cx:n,cy:i,innerRadius:a,outerRadius:o,cornerRadius:Math.min(g,v/2),forceCornerRadius:u,cornerIsExternal:s,startAngle:f,endAngle:d}):ls({cx:n,cy:i,innerRadius:a,outerRadius:o,startAngle:f,endAngle:d}),r.createElement("path",os({},x(t),{className:y,d:p}))};function fs(e,t,n){if("horizontal"===e)return[{x:t.x,y:n.top},{x:t.x,y:n.top+n.height}];if("vertical"===e)return[{x:n.left,y:t.y},{x:n.left+n.width,y:t.y}];if(Pt(t)){if("centric"===e){var{cx:r,cy:i,innerRadius:a,outerRadius:o,angle:c}=t,l=ns(r,i,a,c),u=ns(r,i,o,c);return[{x:l.x,y:l.y},{x:u.x,y:u.y}]}return as(t)}}var ds,hs,ps,ys,vs,gs={},ms={},bs={};function ws(){return ds||(ds=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Br();e.toNumber=function(e){return t.isSymbol(e)?NaN:Number(e)}}(bs)),bs}function xs(){return hs||(hs=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=ws();e.toFinite=function(e){return e?(e=t.toNumber(e))===1/0||e===-1/0?(e<0?-1:1)*Number.MAX_VALUE:e==e?e:0:0===e?e:0}}(ms)),ms}function Os(){return vs?ys:(vs=1,ys=(ps||(ps=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Gr(),n=xs();e.range=function(e,r,i){i&&"number"!=typeof i&&t.isIterateeCall(e,r,i)&&(r=i=void 0),e=n.toFinite(e),void 0===r?(r=e,e=0):r=n.toFinite(r),i=void 0===i?et?1:e>=t?0:NaN}function As(e,t){return null==e||null==t?NaN:te?1:t>=e?0:NaN}function Es(e){let t,n,r;function i(e,r,i=0,a=e.length){if(i>>1;n(e[t],r)<0?i=t+1:a=t}while(iPs(e(t),n),r=(t,n)=>e(t)-n):(t=e===Ps||e===As?e:Ss,n=e,r=e),{left:i,center:function(e,t,n=0,a=e.length){const o=i(e,t,n,a-1);return o>n&&r(e[o-1],t)>-r(e[o],t)?o-1:o},right:function(e,r,i=0,a=e.length){if(i>>1;n(e[t],r)<=0?i=t+1:a=t}while(i{if(!((a-=o)>=i))return;let c=e*r[i];const l=o*e;for(let e=i,t=i+l;e{if(!((o-=c)>=a))return;let l=t*i[a];const u=c*t,s=u+c;for(let t=a,n=a+u;t=0))throw new RangeError("invalid rx");if(!((n=+n)>=0))throw new RangeError("invalid ry");let{data:r,width:i,height:a}=e;if(!((i=Math.floor(i))>=0))throw new RangeError("invalid width");if(!((a=Math.floor(void 0!==a?a:r.length/i))>=0))throw new RangeError("invalid height");if(!i||!a||!t&&!n)return e;const o=t&&Cs(t),c=n&&Cs(n),l=r.slice();return o&&c?(Ts(o,l,r,i,a),Ts(o,r,l,i,a),Ts(o,l,r,i,a),Is(c,r,l,i,a),Is(c,l,r,i,a),Is(c,r,l,i,a)):o?(Ts(o,r,l,i,a),Ts(o,l,r,i,a),Ts(o,r,l,i,a)):c&&(Is(c,r,l,i,a),Is(c,l,r,i,a),Is(c,r,l,i,a)),e});var Cs;function Ts(e,t,n,r,i){for(let a=0,o=r*i;a=i&&(n=r=i):(n>i&&(n=i),r=a&&(n=r=a):(n>a&&(n=a),r=e))-(null==t||!(t>=t))||(et?1:0)}const Bs=Math.sqrt(50),Ks=Math.sqrt(10),Fs=Math.sqrt(2);function Us(e,t,n){const r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/Math.pow(10,i),o=a>=Bs?10:a>=Ks?5:a>=Fs?2:1;let c,l,u;return i<0?(u=Math.pow(10,-i)/o,c=Math.round(e*u),l=Math.round(t*u),c/ut&&--l,u=-u):(u=Math.pow(10,i)*o,c=Math.round(e/u),l=Math.round(t/u),c*ut&&--l),l0))return[];if((e=+e)===(t=+t))return[e];const r=t=i))return[];const c=a-i+1,l=new Array(c);if(r)if(o<0)for(let u=0;u=n&&++t;return t}(e))/Math.LN2)+1)}function qs(e,t){let n;for(const r of e)null!=r&&(n=r)&&(n=r);return n}function Ys(e,t){let n;for(const r of e)null!=r&&(n>r||void 0===n&&r>=r)&&(n=r);return n}function Xs(e,t,n=0,r=1/0,i){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(i=void 0===i?Rs:function(e=Ps){if(e===Ps)return Rs;if("function"!=typeof e)throw new TypeError("compare is not a function");return(t,n)=>{const r=e(t,n);return r||0===r?r:(0===e(n,n))-(0===e(t,t))}}(i);r>n;){if(r-n>600){const a=r-n+1,o=t-n+1,c=Math.log(a),l=.5*Math.exp(2*c/3),u=.5*Math.sqrt(c*l*(a-l)/a)*(o-a/2<0?-1:1);Xs(e,t,Math.max(n,Math.floor(t-o*l/a+u)),Math.min(r,Math.floor(t+(a-o)*l/a+u)),i)}const a=e[t];let o=n,c=r;for(Gs(e,n,t),i(e[r],a)>0&&Gs(e,n,r);o0;)--c}0===i(e[n],a)?Gs(e,n,c):(++c,Gs(e,c,r)),c<=t&&(n=c+1),t<=c&&(r=c-1)}return e}function Gs(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function Zs(e,t,n){if((r=(e=Float64Array.from(function*(e){for(let t of e)null!=t&&(t=+t)>=t&&(yield t)}(e))).length)&&!isNaN(t=+t)){if(t<=0||r<2)return Ys(e);if(t>=1)return qs(e);var r,i=(r-1)*t,a=Math.floor(i),o=qs(Xs(e,a).subarray(0,a+1));return o+(Ys(e.subarray(a+1))-o)*(i-a)}}function Qs(e,t,n=js){if((r=e.length)&&!isNaN(t=+t)){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,a=Math.floor(i),o=+n(e[a],a,e);return o+(+n(e[a+1],a+1,e)-o)*(i-a)}}function Js(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e)}return this}function ef(e,t){switch(arguments.length){case 0:break;case 1:"function"==typeof e?this.interpolator(e):this.range(e);break;default:this.domain(e),"function"==typeof t?this.interpolator(t):this.range(t)}return this}const tf=Symbol("implicit");function nf(){var e=new Ns,t=[],n=[],r=tf;function i(i){let a=e.get(i);if(void 0===a){if(r!==tf)return r;e.set(i,a=t.push(i)-1)}return n[a%n.length]}return i.domain=function(n){if(!arguments.length)return t.slice();t=[],e=new Ns;for(const r of n)e.has(r)||e.set(r,t.push(r)-1);return i},i.range=function(e){return arguments.length?(n=Array.from(e),i):n.slice()},i.unknown=function(e){return arguments.length?(r=e,i):r},i.copy=function(){return nf(t,n).unknown(r)},Js.apply(i,arguments),i}function rf(){var e,t,n=nf().unknown(void 0),r=n.domain,i=n.range,a=0,o=1,c=!1,l=0,u=0,s=.5;function f(){var n=r().length,f=o>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?Ef(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?Ef(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=yf.exec(e))?new kf(t[1],t[2],t[3],1):(t=vf.exec(e))?new kf(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=gf.exec(e))?Ef(t[1],t[2],t[3],t[4]):(t=mf.exec(e))?Ef(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=bf.exec(e))?Nf(t[1],t[2]/100,t[3]/100,1):(t=wf.exec(e))?Nf(t[1],t[2]/100,t[3]/100,t[4]):xf.hasOwnProperty(e)?Af(xf[e]):"transparent"===e?new kf(NaN,NaN,NaN,0):null}function Af(e){return new kf(e>>16&255,e>>8&255,255&e,1)}function Ef(e,t,n,r){return r<=0&&(e=t=n=NaN),new kf(e,t,n,r)}function Sf(e){return e instanceof lf||(e=Pf(e)),e?new kf((e=e.rgb()).r,e.g,e.b,e.opacity):new kf}function jf(e,t,n,r){return 1===arguments.length?Sf(e):new kf(e,t,n,null==r?1:r)}function kf(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function Mf(){return`#${Df(this.r)}${Df(this.g)}${Df(this.b)}`}function Cf(){const e=Tf(this.opacity);return`${1===e?"rgb(":"rgba("}${If(this.r)}, ${If(this.g)}, ${If(this.b)}${1===e?")":`, ${e})`}`}function Tf(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function If(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Df(e){return((e=If(e))<16?"0":"")+e.toString(16)}function Nf(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Lf(e,t,n,r)}function zf(e){if(e instanceof Lf)return new Lf(e.h,e.s,e.l,e.opacity);if(e instanceof lf||(e=Pf(e)),!e)return new Lf;if(e instanceof Lf)return e;var t=(e=e.rgb()).r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,c=a-i,l=(a+i)/2;return c?(o=t===a?(n-r)/c+6*(n0&&l<1?0:o,new Lf(o,c,l,e.opacity)}function Lf(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function Rf(e){return(e=(e||0)%360)<0?e+360:e}function Bf(e){return Math.max(0,Math.min(1,e||0))}function Kf(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}of(lf,Pf,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Of,formatHex:Of,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return zf(this).formatHsl()},formatRgb:_f,toString:_f}),of(kf,jf,cf(lf,{brighter(e){return e=null==e?sf:Math.pow(sf,e),new kf(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?uf:Math.pow(uf,e),new kf(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new kf(If(this.r),If(this.g),If(this.b),Tf(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Mf,formatHex:Mf,formatHex8:function(){return`#${Df(this.r)}${Df(this.g)}${Df(this.b)}${Df(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Cf,toString:Cf})),of(Lf,function(e,t,n,r){return 1===arguments.length?zf(e):new Lf(e,t,n,null==r?1:r)},cf(lf,{brighter(e){return e=null==e?sf:Math.pow(sf,e),new Lf(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?uf:Math.pow(uf,e),new Lf(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new kf(Kf(e>=240?e-240:e+120,i,r),Kf(e,i,r),Kf(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Lf(Rf(this.h),Bf(this.s),Bf(this.l),Tf(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Tf(this.opacity);return`${1===e?"hsl(":"hsla("}${Rf(this.h)}, ${100*Bf(this.s)}%, ${100*Bf(this.l)}%${1===e?")":`, ${e})`}`}}));const Ff=Math.PI/180,Uf=180/Math.PI;var Wf=-.14861,$f=1.78277,Hf=-.29227,Vf=-.90649,qf=1.97294,Yf=qf*Vf,Xf=qf*$f,Gf=$f*Hf-Vf*Wf;function Zf(e,t,n,r){return 1===arguments.length?function(e){if(e instanceof Qf)return new Qf(e.h,e.s,e.l,e.opacity);e instanceof kf||(e=Sf(e));var t=e.r/255,n=e.g/255,r=e.b/255,i=(Gf*r+Yf*t-Xf*n)/(Gf+Yf-Xf),a=r-i,o=(qf*(n-i)-Hf*a)/Vf,c=Math.sqrt(o*o+a*a)/(qf*i*(1-i)),l=c?Math.atan2(o,a)*Uf-120:NaN;return new Qf(l<0?l+360:l,c,i,e.opacity)}(e):new Qf(e,t,n,null==r?1:r)}function Qf(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}of(Qf,Zf,cf(lf,{brighter(e){return e=null==e?sf:Math.pow(sf,e),new Qf(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?uf:Math.pow(uf,e),new Qf(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=isNaN(this.h)?0:(this.h+120)*Ff,t=+this.l,n=isNaN(this.s)?0:this.s*t*(1-t),r=Math.cos(e),i=Math.sin(e);return new kf(255*(t+n*(Wf*r+$f*i)),255*(t+n*(Hf*r+Vf*i)),255*(t+n*(qf*r)),this.opacity)}}));const Jf=e=>()=>e;function ed(e,t){return function(n){return e+n*t}}function td(e,t){var n=t-e;return n?ed(e,n):Jf(isNaN(e)?t:e)}const nd=function e(t){var n=function(e){return 1===(e=+e)?td:function(t,n){return n-t?function(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}(t,n,e):Jf(isNaN(t)?n:t)}}(t);function r(e,t){var r=n((e=jf(e)).r,(t=jf(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=td(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+""}}return r.gamma=e,r}(1);function rd(e,t){t||(t=[]);var n,r=e?Math.min(t.length,e.length):0,i=t.slice();return function(a){for(n=0;na&&(i=t.slice(a,i),c[o]?c[o]+=i:c[++o]=i),(n=n[0])===(r=r[0])?c[o]?c[o]+=r:c[++o]=r:(c[++o]=null,l.push({i:o,x:od(n,r)})),a=ud.lastIndex;return a180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+"rotate(",null,r)-2,x:od(e,t)})):t&&n.push(i(n)+"rotate("+t+r)}(a.rotate,o.rotate,c,l),function(e,t,n,a){e!==t?a.push({i:n.push(i(n)+"skewX(",null,r)-2,x:od(e,t)}):t&&n.push(i(n)+"skewX("+t+r)}(a.skewX,o.skewX,c,l),function(e,t,n,r,a,o){if(e!==n||t!==r){var c=a.push(i(a)+"scale(",null,",",null,")");o.push({i:c-4,x:od(e,n)},{i:c-2,x:od(t,r)})}else 1===n&&1===r||a.push(i(a)+"scale("+n+","+r+")")}(a.scaleX,a.scaleY,o.scaleX,o.scaleY,c,l),a=o=null,function(e){for(var t,n=-1,r=l.length;++n180||n<-180?n-360*Math.round(n/360):n):Jf(isNaN(e)?t:e)});function Od(e,t){void 0===t&&(t=e,e=fd);for(var n=0,r=t.length-1,i=t[0],a=new Array(r<0?0:r);nt&&(n=e,e=t,t=n),u=function(n){return Math.max(e,Math.min(t,n))}),r=l>2?kd:jd,i=a=null,f}function f(t){return null==t||isNaN(t=+t)?n:(i||(i=r(o.map(e),c,l)))(e(u(t)))}return f.invert=function(n){return u(t((a||(a=r(c,o.map(e),od)))(n)))},f.domain=function(e){return arguments.length?(o=Array.from(e,Pd),s()):o.slice()},f.range=function(e){return arguments.length?(c=Array.from(e),s()):c.slice()},f.rangeRound=function(e){return c=Array.from(e),l=dd,s()},f.clamp=function(e){return arguments.length?(u=!!e||Ed,s()):u!==Ed},f.interpolate=function(e){return arguments.length?(l=e,s()):l},f.unknown=function(e){return arguments.length?(n=e,f):n},function(n,r){return e=n,t=r,s()}}function Td(){return Cd()(Ed,Ed)}function Id(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function Dd(e){return(e=Id(Math.abs(e)))?e[1]:NaN}var Nd,zd=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Ld(e){if(!(t=zd.exec(e)))throw new Error("invalid format: "+e);var t;return new Rd({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}function Rd(e){this.fill=void 0===e.fill?" ":e.fill+"",this.align=void 0===e.align?">":e.align+"",this.sign=void 0===e.sign?"-":e.sign+"",this.symbol=void 0===e.symbol?"":e.symbol+"",this.zero=!!e.zero,this.width=void 0===e.width?void 0:+e.width,this.comma=!!e.comma,this.precision=void 0===e.precision?void 0:+e.precision,this.trim=!!e.trim,this.type=void 0===e.type?"":e.type+""}function Bd(e,t){var n=Id(e,t);if(!n)return e+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}Ld.prototype=Rd.prototype,Rd.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};const Kd={"%":(e,t)=>(100*e).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:function(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)},e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>Bd(100*e,t),r:Bd,s:function(e,t){var n=Id(e,t);if(!n)return e+"";var r=n[0],i=n[1],a=i-(Nd=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,o=r.length;return a===o?r:a>o?r+new Array(a-o+1).join("0"):a>0?r.slice(0,a)+"."+r.slice(a):"0."+new Array(1-a).join("0")+Id(e,Math.max(0,t+a-1))[0]},X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function Fd(e){return e}var Ud,Wd,$d,Hd=Array.prototype.map,Vd=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function qd(e,t,n,r){var i,a=Hs(e,t,n);switch((r=Ld(null==r?",f":r)).type){case"s":var o=Math.max(Math.abs(e),Math.abs(t));return null!=r.precision||isNaN(i=function(e,t){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(Dd(t)/3)))-Dd(Math.abs(e)))}(a,o))||(r.precision=i),$d(r,o);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(i=function(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Dd(t)-Dd(e))+1}(a,Math.max(Math.abs(e),Math.abs(t))))||(r.precision=i-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(i=function(e){return Math.max(0,-Dd(Math.abs(e)))}(a))||(r.precision=i-2*("%"===r.type))}return Wd(r)}function Yd(e){var t=e.domain;return e.ticks=function(e){var n=t();return Ws(n[0],n[n.length-1],null==e?10:e)},e.tickFormat=function(e,n){var r=t();return qd(r[0],r[r.length-1],null==e?10:e,n)},e.nice=function(n){null==n&&(n=10);var r,i,a=t(),o=0,c=a.length-1,l=a[o],u=a[c],s=10;for(u0;){if((i=$s(l,u,n))===r)return a[o]=l,a[c]=u,t(a);if(i>0)l=Math.floor(l/i)*i,u=Math.ceil(u/i)*i;else{if(!(i<0))break;l=Math.ceil(l*i)/i,u=Math.floor(u*i)/i}r=i}return e},e}function Xd(){var e=Td();return e.copy=function(){return Md(e,Xd())},Js.apply(e,arguments),Yd(e)}function Gd(e,t){var n,r=0,i=(e=e.slice()).length-1,a=e[r],o=e[i];return o-e(-t,n)}function rh(e){const t=e(Zd,Qd),n=t.domain;let r,i,a=10;function o(){return r=function(e){return e===Math.E?Math.log:10===e&&Math.log10||2===e&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}(a),i=function(e){return 10===e?th:e===Math.E?Math.exp:t=>Math.pow(e,t)}(a),n()[0]<0?(r=nh(r),i=nh(i),e(Jd,eh)):e(Zd,Qd),t}return t.base=function(e){return arguments.length?(a=+e,o()):a},t.domain=function(e){return arguments.length?(n(e),o()):n()},t.ticks=e=>{const t=n();let o=t[0],c=t[t.length-1];const l=c0){for(;f<=d;++f)for(u=1;uc)break;p.push(s)}}else for(;f<=d;++f)for(u=a-1;u>=1;--u)if(s=f>0?u/i(-f):u*i(f),!(sc)break;p.push(s)}2*p.length{if(null==e&&(e=10),null==n&&(n=10===a?"s":","),"function"!=typeof n&&(a%1||null!=(n=Ld(n)).precision||(n.trim=!0),n=Wd(n)),e===1/0)return n;const o=Math.max(1,a*e/t.ticks().length);return e=>{let t=e/i(Math.round(r(e)));return t*an(Gd(n(),{floor:e=>i(Math.floor(r(e))),ceil:e=>i(Math.ceil(r(e)))})),t}function ih(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function ah(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function oh(e){var t=1,n=e(ih(t),ah(t));return n.constant=function(n){return arguments.length?e(ih(t=+n),ah(t)):t},Yd(n)}function ch(){var e=oh(Cd());return e.copy=function(){return Md(e,ch()).constant(e.constant())},Js.apply(e,arguments)}function lh(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function uh(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function sh(e){return e<0?-e*e:e*e}function fh(e){var t=e(Ed,Ed),n=1;return t.exponent=function(t){return arguments.length?1===(n=+t)?e(Ed,Ed):.5===n?e(uh,sh):e(lh(n),lh(1/n)):n},Yd(t)}function dh(){var e=fh(Cd());return e.copy=function(){return Md(e,dh()).exponent(e.exponent())},Js.apply(e,arguments),e}function hh(e){return Math.sign(e)*e*e}function ph(){var e,t=0,n=1,r=1,i=[.5],a=[0,1];function o(t){return null!=t&&t<=t?a[ks(i,t,0,r)]:e}function c(){var e=-1;for(i=new Array(r);++e=r?[i[r-1],n]:[i[o-1],i[o]]},o.unknown=function(t){return arguments.length?(e=t,o):o},o.thresholds=function(){return i.slice()},o.copy=function(){return ph().domain([t,n]).range(a).unknown(e)},Js.apply(Yd(o),arguments)}Ud=function(e){var t,n,r=void 0===e.grouping||void 0===e.thousands?Fd:(t=Hd.call(e.grouping,Number),n=e.thousands+"",function(e,r){for(var i=e.length,a=[],o=0,c=t[0],l=0;i>0&&c>0&&(l+c+1>r&&(c=Math.max(1,r-l)),a.push(e.substring(i-=c,i+c)),!((l+=c+1)>r));)c=t[o=(o+1)%t.length];return a.reverse().join(n)}),i=void 0===e.currency?"":e.currency[0]+"",a=void 0===e.currency?"":e.currency[1]+"",o=void 0===e.decimal?".":e.decimal+"",c=void 0===e.numerals?Fd:function(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}(Hd.call(e.numerals,String)),l=void 0===e.percent?"%":e.percent+"",u=void 0===e.minus?"−":e.minus+"",s=void 0===e.nan?"NaN":e.nan+"";function f(e){var t=(e=Ld(e)).fill,n=e.align,f=e.sign,d=e.symbol,h=e.zero,p=e.width,y=e.comma,v=e.precision,g=e.trim,m=e.type;"n"===m?(y=!0,m="g"):Kd[m]||(void 0===v&&(v=12),g=!0,m="g"),(h||"0"===t&&"="===n)&&(h=!0,t="0",n="=");var b="$"===d?i:"#"===d&&/[boxX]/.test(m)?"0"+m.toLowerCase():"",w="$"===d?a:/[%p]/.test(m)?l:"",x=Kd[m],O=/[defgprs%]/.test(m);function _(e){var i,a,l,d=b,_=w;if("c"===m)_=x(e)+_,e="";else{var P=(e=+e)<0||1/e<0;if(e=isNaN(e)?s:x(Math.abs(e),v),g&&(e=function(e){e:for(var t,n=e.length,r=1,i=-1;r0&&(i=0)}return i>0?e.slice(0,i)+e.slice(t+1):e}(e)),P&&0===+e&&"+"!==f&&(P=!1),d=(P?"("===f?f:u:"-"===f||"("===f?"":f)+d,_=("s"===m?Vd[8+Nd/3]:"")+_+(P&&"("===f?")":""),O)for(i=-1,a=e.length;++i(l=e.charCodeAt(i))||l>57){_=(46===l?o+e.slice(i+1):e.slice(i))+_,e=e.slice(0,i);break}}y&&!h&&(e=r(e,1/0));var A=d.length+e.length+_.length,E=A>1)+d+e+_+E.slice(A);break;default:e=E+d+e+_}return c(e)}return v=void 0===v?6:/[gprs]/.test(m)?Math.max(1,Math.min(21,v)):Math.max(0,Math.min(20,v)),_.toString=function(){return e+""},_}return{format:f,formatPrefix:function(e,t){var n=f(((e=Ld(e)).type="f",e)),r=3*Math.max(-8,Math.min(8,Math.floor(Dd(t)/3))),i=Math.pow(10,-r),a=Vd[8+r/3];return function(e){return n(i*e)+a}}}}({thousands:",",grouping:[3],currency:["$",""]}),Wd=Ud.format,$d=Ud.formatPrefix;const yh=new Date,vh=new Date;function gh(e,t,n,r){function i(t){return e(t=0===arguments.length?new Date:new Date(+t)),t}return i.floor=t=>(e(t=new Date(+t)),t),i.ceil=n=>(e(n=new Date(n-1)),t(n,1),e(n),n),i.round=e=>{const t=i(e),n=i.ceil(e);return e-t(t(e=new Date(+e),null==n?1:Math.floor(n)),e),i.range=(n,r,a)=>{const o=[];if(n=i.ceil(n),a=null==a?1:Math.floor(a),!(n0))return o;let c;do{o.push(c=new Date(+n)),t(n,a),e(n)}while(cgh(t=>{if(t>=t)for(;e(t),!n(t);)t.setTime(t-1)},(e,r)=>{if(e>=e)if(r<0)for(;++r<=0;)for(;t(e,-1),!n(e););else for(;--r>=0;)for(;t(e,1),!n(e););}),n&&(i.count=(t,r)=>(yh.setTime(+t),vh.setTime(+r),e(yh),e(vh),Math.floor(n(yh,vh))),i.every=e=>(e=Math.floor(e),isFinite(e)&&e>0?e>1?i.filter(r?t=>r(t)%e===0:t=>i.count(0,t)%e===0):i:null)),i}const mh=gh(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);mh.every=e=>(e=Math.floor(e),isFinite(e)&&e>0?e>1?gh(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):mh:null),mh.range;const bh=1e3,wh=6e4,xh=36e5,Oh=864e5,_h=6048e5,Ph=31536e6,Ah=gh(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*bh)},(e,t)=>(t-e)/bh,e=>e.getUTCSeconds());Ah.range;const Eh=gh(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*bh)},(e,t)=>{e.setTime(+e+t*wh)},(e,t)=>(t-e)/wh,e=>e.getMinutes());Eh.range;const Sh=gh(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*wh)},(e,t)=>(t-e)/wh,e=>e.getUTCMinutes());Sh.range;const jh=gh(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*bh-e.getMinutes()*wh)},(e,t)=>{e.setTime(+e+t*xh)},(e,t)=>(t-e)/xh,e=>e.getHours());jh.range;const kh=gh(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*xh)},(e,t)=>(t-e)/xh,e=>e.getUTCHours());kh.range;const Mh=gh(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*wh)/Oh,e=>e.getDate()-1);Mh.range;const Ch=gh(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Oh,e=>e.getUTCDate()-1);Ch.range;const Th=gh(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Oh,e=>Math.floor(e/Oh));function Ih(e){return gh(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(e,t)=>{e.setDate(e.getDate()+7*t)},(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*wh)/_h)}Th.range;const Dh=Ih(0),Nh=Ih(1),zh=Ih(2),Lh=Ih(3),Rh=Ih(4),Bh=Ih(5),Kh=Ih(6);function Fh(e){return gh(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+7*t)},(e,t)=>(t-e)/_h)}Dh.range,Nh.range,zh.range,Lh.range,Rh.range,Bh.range,Kh.range;const Uh=Fh(0),Wh=Fh(1),$h=Fh(2),Hh=Fh(3),Vh=Fh(4),qh=Fh(5),Yh=Fh(6);Uh.range,Wh.range,$h.range,Hh.range,Vh.range,qh.range,Yh.range;const Xh=gh(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+12*(t.getFullYear()-e.getFullYear()),e=>e.getMonth());Xh.range;const Gh=gh(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+12*(t.getUTCFullYear()-e.getUTCFullYear()),e=>e.getUTCMonth());Gh.range;const Zh=gh(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());Zh.every=e=>isFinite(e=Math.floor(e))&&e>0?gh(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)}):null,Zh.range;const Qh=gh(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());function Jh(e,t,n,r,i,a){const o=[[Ah,1,bh],[Ah,5,5e3],[Ah,15,15e3],[Ah,30,3e4],[a,1,wh],[a,5,3e5],[a,15,9e5],[a,30,18e5],[i,1,xh],[i,3,108e5],[i,6,216e5],[i,12,432e5],[r,1,Oh],[r,2,1728e5],[n,1,_h],[t,1,2592e6],[t,3,7776e6],[e,1,Ph]];function c(t,n,r){const i=Math.abs(n-t)/r,a=Es(([,,e])=>e).right(o,i);if(a===o.length)return e.every(Hs(t/Ph,n/Ph,r));if(0===a)return mh.every(Math.max(Hs(t,n,r),1));const[c,l]=o[i/o[a-1][2]isFinite(e=Math.floor(e))&&e>0?gh(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)}):null,Qh.range;const[ep,tp]=Jh(Qh,Gh,Uh,Th,kh,Sh),[np,rp]=Jh(Zh,Xh,Dh,Mh,jh,Eh);function ip(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function ap(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function op(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}var cp,lp,up,sp={"-":"",_:" ",0:"0"},fp=/^\s*\d+/,dp=/^%/,hp=/[\\^$*+?|[\]().{}]/g;function pp(e,t,n){var r=e<0?"-":"",i=(r?-e:e)+"",a=i.length;return r+(a[e.toLowerCase(),t]))}function mp(e,t,n){var r=fp.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function bp(e,t,n){var r=fp.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function wp(e,t,n){var r=fp.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function xp(e,t,n){var r=fp.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function Op(e,t,n){var r=fp.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function _p(e,t,n){var r=fp.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function Pp(e,t,n){var r=fp.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Ap(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function Ep(e,t,n){var r=fp.exec(t.slice(n,n+1));return r?(e.q=3*r[0]-3,n+r[0].length):-1}function Sp(e,t,n){var r=fp.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function jp(e,t,n){var r=fp.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function kp(e,t,n){var r=fp.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function Mp(e,t,n){var r=fp.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function Cp(e,t,n){var r=fp.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function Tp(e,t,n){var r=fp.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function Ip(e,t,n){var r=fp.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function Dp(e,t,n){var r=fp.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Np(e,t,n){var r=dp.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function zp(e,t,n){var r=fp.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function Lp(e,t,n){var r=fp.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function Rp(e,t){return pp(e.getDate(),t,2)}function Bp(e,t){return pp(e.getHours(),t,2)}function Kp(e,t){return pp(e.getHours()%12||12,t,2)}function Fp(e,t){return pp(1+Mh.count(Zh(e),e),t,3)}function Up(e,t){return pp(e.getMilliseconds(),t,3)}function Wp(e,t){return Up(e,t)+"000"}function $p(e,t){return pp(e.getMonth()+1,t,2)}function Hp(e,t){return pp(e.getMinutes(),t,2)}function Vp(e,t){return pp(e.getSeconds(),t,2)}function qp(e){var t=e.getDay();return 0===t?7:t}function Yp(e,t){return pp(Dh.count(Zh(e)-1,e),t,2)}function Xp(e){var t=e.getDay();return t>=4||0===t?Rh(e):Rh.ceil(e)}function Gp(e,t){return e=Xp(e),pp(Rh.count(Zh(e),e)+(4===Zh(e).getDay()),t,2)}function Zp(e){return e.getDay()}function Qp(e,t){return pp(Nh.count(Zh(e)-1,e),t,2)}function Jp(e,t){return pp(e.getFullYear()%100,t,2)}function ey(e,t){return pp((e=Xp(e)).getFullYear()%100,t,2)}function ty(e,t){return pp(e.getFullYear()%1e4,t,4)}function ny(e,t){var n=e.getDay();return pp((e=n>=4||0===n?Rh(e):Rh.ceil(e)).getFullYear()%1e4,t,4)}function ry(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+pp(t/60|0,"0",2)+pp(t%60,"0",2)}function iy(e,t){return pp(e.getUTCDate(),t,2)}function ay(e,t){return pp(e.getUTCHours(),t,2)}function oy(e,t){return pp(e.getUTCHours()%12||12,t,2)}function cy(e,t){return pp(1+Ch.count(Qh(e),e),t,3)}function ly(e,t){return pp(e.getUTCMilliseconds(),t,3)}function uy(e,t){return ly(e,t)+"000"}function sy(e,t){return pp(e.getUTCMonth()+1,t,2)}function fy(e,t){return pp(e.getUTCMinutes(),t,2)}function dy(e,t){return pp(e.getUTCSeconds(),t,2)}function hy(e){var t=e.getUTCDay();return 0===t?7:t}function py(e,t){return pp(Uh.count(Qh(e)-1,e),t,2)}function yy(e){var t=e.getUTCDay();return t>=4||0===t?Vh(e):Vh.ceil(e)}function vy(e,t){return e=yy(e),pp(Vh.count(Qh(e),e)+(4===Qh(e).getUTCDay()),t,2)}function gy(e){return e.getUTCDay()}function my(e,t){return pp(Wh.count(Qh(e)-1,e),t,2)}function by(e,t){return pp(e.getUTCFullYear()%100,t,2)}function wy(e,t){return pp((e=yy(e)).getUTCFullYear()%100,t,2)}function xy(e,t){return pp(e.getUTCFullYear()%1e4,t,4)}function Oy(e,t){var n=e.getUTCDay();return pp((e=n>=4||0===n?Vh(e):Vh.ceil(e)).getUTCFullYear()%1e4,t,4)}function _y(){return"+0000"}function Py(){return"%"}function Ay(e){return+e}function Ey(e){return Math.floor(+e/1e3)}function Sy(e){return new Date(e)}function jy(e){return e instanceof Date?+e:+new Date(+e)}function ky(e,t,n,r,i,a,o,c,l,u){var s=Td(),f=s.invert,d=s.domain,h=u(".%L"),p=u(":%S"),y=u("%I:%M"),v=u("%I %p"),g=u("%a %d"),m=u("%b %d"),b=u("%B"),w=u("%Y");function x(e){return(l(e)=12)]},q:function(e){return 1+~~(e.getMonth()/3)},Q:Ay,s:Ey,S:Vp,u:qp,U:Yp,V:Gp,w:Zp,W:Qp,x:null,X:null,y:Jp,Y:ty,Z:ry,"%":Py},w={a:function(e){return o[e.getUTCDay()]},A:function(e){return a[e.getUTCDay()]},b:function(e){return l[e.getUTCMonth()]},B:function(e){return c[e.getUTCMonth()]},c:null,d:iy,e:iy,f:uy,g:wy,G:Oy,H:ay,I:oy,j:cy,L:ly,m:sy,M:fy,p:function(e){return i[+(e.getUTCHours()>=12)]},q:function(e){return 1+~~(e.getUTCMonth()/3)},Q:Ay,s:Ey,S:dy,u:hy,U:py,V:vy,w:gy,W:my,x:null,X:null,y:by,Y:xy,Z:_y,"%":Py},x={a:function(e,t,n){var r=h.exec(t.slice(n));return r?(e.w=p.get(r[0].toLowerCase()),n+r[0].length):-1},A:function(e,t,n){var r=f.exec(t.slice(n));return r?(e.w=d.get(r[0].toLowerCase()),n+r[0].length):-1},b:function(e,t,n){var r=g.exec(t.slice(n));return r?(e.m=m.get(r[0].toLowerCase()),n+r[0].length):-1},B:function(e,t,n){var r=y.exec(t.slice(n));return r?(e.m=v.get(r[0].toLowerCase()),n+r[0].length):-1},c:function(e,n,r){return P(e,t,n,r)},d:jp,e:jp,f:Dp,g:Pp,G:_p,H:Mp,I:Mp,j:kp,L:Ip,m:Sp,M:Cp,p:function(e,t,n){var r=u.exec(t.slice(n));return r?(e.p=s.get(r[0].toLowerCase()),n+r[0].length):-1},q:Ep,Q:zp,s:Lp,S:Tp,u:bp,U:wp,V:xp,w:mp,W:Op,x:function(e,t,r){return P(e,n,t,r)},X:function(e,t,n){return P(e,r,t,n)},y:Pp,Y:_p,Z:Ap,"%":Np};function O(e,t){return function(n){var r,i,a,o=[],c=-1,l=0,u=e.length;for(n instanceof Date||(n=new Date(+n));++c53)return null;"w"in a||(a.w=1),"Z"in a?(i=(r=ap(op(a.y,0,1))).getUTCDay(),r=i>4||0===i?Wh.ceil(r):Wh(r),r=Ch.offset(r,7*(a.V-1)),a.y=r.getUTCFullYear(),a.m=r.getUTCMonth(),a.d=r.getUTCDate()+(a.w+6)%7):(i=(r=ip(op(a.y,0,1))).getDay(),r=i>4||0===i?Nh.ceil(r):Nh(r),r=Mh.offset(r,7*(a.V-1)),a.y=r.getFullYear(),a.m=r.getMonth(),a.d=r.getDate()+(a.w+6)%7)}else("W"in a||"U"in a)&&("w"in a||(a.w="u"in a?a.u%7:"W"in a?1:0),i="Z"in a?ap(op(a.y,0,1)).getUTCDay():ip(op(a.y,0,1)).getDay(),a.m=0,a.d="W"in a?(a.w+6)%7+7*a.W-(i+5)%7:a.w+7*a.U-(i+6)%7);return"Z"in a?(a.H+=a.Z/100|0,a.M+=a.Z%100,ap(a)):ip(a)}}function P(e,t,n,r){for(var i,a,o=0,c=t.length,l=n.length;o=l)return-1;if(37===(i=t.charCodeAt(o++))){if(i=t.charAt(o++),!(a=x[i in sp?t.charAt(o++):i])||(r=a(e,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}return b.x=O(n,b),b.X=O(r,b),b.c=O(t,b),w.x=O(n,w),w.X=O(r,w),w.c=O(t,w),{format:function(e){var t=O(e+="",b);return t.toString=function(){return e},t},parse:function(e){var t=_(e+="",!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=O(e+="",w);return t.toString=function(){return e},t},utcParse:function(e){var t=_(e+="",!0);return t.toString=function(){return e},t}}}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}),lp=cp.format,cp.parse,up=cp.utcFormat,cp.utcParse;const Ly=Object.freeze(Object.defineProperty({__proto__:null,scaleBand:rf,scaleDiverging:function e(){var t=Yd(Ny()(Ed));return t.copy=function(){return Ty(t,e())},ef.apply(t,arguments)},scaleDivergingLog:function e(){var t=rh(Ny()).domain([.1,1,10]);return t.copy=function(){return Ty(t,e()).base(t.base())},ef.apply(t,arguments)},scaleDivergingPow:zy,scaleDivergingSqrt:function(){return zy.apply(null,arguments).exponent(.5)},scaleDivergingSymlog:function e(){var t=oh(Ny());return t.copy=function(){return Ty(t,e()).constant(t.constant())},ef.apply(t,arguments)},scaleIdentity:function e(t){var n;function r(e){return null==e||isNaN(e=+e)?n:e}return r.invert=r,r.domain=r.range=function(e){return arguments.length?(t=Array.from(e,Pd),r):t.slice()},r.unknown=function(e){return arguments.length?(n=e,r):n},r.copy=function(){return e(t).unknown(n)},t=arguments.length?Array.from(t,Pd):[0,1],Yd(r)},scaleImplicit:tf,scaleLinear:Xd,scaleLog:function e(){const t=rh(Cd()).domain([1,10]);return t.copy=()=>Md(t,e()).base(t.base()),Js.apply(t,arguments),t},scaleOrdinal:nf,scalePoint:function(){return af(rf.apply(null,arguments).paddingInner(1))},scalePow:dh,scaleQuantile:function e(){var t,n=[],r=[],i=[];function a(){var e=0,t=Math.max(1,r.length);for(i=new Array(t-1);++e0?i[t-1]:n[0],tn(r/(t.length-1)))},r.quantiles=function(e){return Array.from({length:e+1},(n,r)=>Zs(t,r/e))},r.copy=function(){return e(n).domain(t)},ef.apply(r,arguments)},scaleSequentialSqrt:function(){return Dy.apply(null,arguments).exponent(.5)},scaleSequentialSymlog:function e(){var t=oh(Cy());return t.copy=function(){return Ty(t,e()).constant(t.constant())},ef.apply(t,arguments)},scaleSqrt:function(){return dh.apply(null,arguments).exponent(.5)},scaleSymlog:ch,scaleThreshold:function e(){var t,n=[.5],r=[0,1],i=1;function a(e){return null!=e&&e<=e?r[ks(n,e,0,i)]:t}return a.domain=function(e){return arguments.length?(n=Array.from(e),i=Math.min(n.length,r.length-1),a):n.slice()},a.range=function(e){return arguments.length?(r=Array.from(e),i=Math.min(n.length,r.length-1),a):r.slice()},a.invertExtent=function(e){var t=r.indexOf(e);return[n[t-1],n[t]]},a.unknown=function(e){return arguments.length?(t=e,a):t},a.copy=function(){return e().domain(n).range(r).unknown(t)},Js.apply(a,arguments)},scaleTime:My,scaleUtc:function(){return Js.apply(ky(ep,tp,Qh,Gh,Uh,Ch,kh,Sh,Ah,up).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)},tickFormat:qd},Symbol.toStringTag,{value:"Module"}));var Ry=e=>e.chartData,By=jr([Ry],e=>{var t=null!=e.chartData?e.chartData.length-1:0;return{chartData:e.chartData,computedData:e.computedData,dataEndIndex:t,dataStartIndex:0}}),Ky=(e,t,n,r)=>r?By(e):Ry(e);function Fy(e){if(Array.isArray(e)&&2===e.length){var[t,n]=e;if(xc(t)&&xc(n))return!0}return!1}function Uy(e,t,n){return n?e:[Math.min(e[0],t[0]),Math.max(e[1],t[1])]}function Wy(e,t){if(t&&"function"!=typeof e&&Array.isArray(e)&&2===e.length){var n,r,[i,a]=e;if(xc(i))n=i;else if("function"==typeof i)return;if(xc(a))r=a;else if("function"==typeof a)return;var o=[n,r];if(Fy(o))return o}}var $y,Hy=1e9,Vy=!0,qy="[DecimalError] ",Yy=qy+"Invalid argument: ",Xy=qy+"Exponent out of range: ",Gy=Math.floor,Zy=Math.pow,Qy=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Jy=1e7,ev=Gy(1286742750677284.5),tv={};function nv(e,t){var n,r,i,a,o,c,l,u,s=e.constructor,f=s.precision;if(!e.s||!t.s)return t.s||(t=new s(e)),Vy?dv(t,f):t;if(l=e.d,u=t.d,o=e.e,i=t.e,l=l.slice(),a=o-i){for(a<0?(r=l,a=-a,c=u.length):(r=u,i=o,c=l.length),a>(c=(o=Math.ceil(f/7))>c?o+1:c+1)&&(a=c,r.length=1),r.reverse();a--;)r.push(0);r.reverse()}for((c=l.length)-(a=u.length)<0&&(a=c,r=u,u=l,l=r),n=0;a;)n=(l[--a]=l[a]+u[a]+n)/Jy|0,l[a]%=Jy;for(n&&(l.unshift(n),++i),c=l.length;0==l[--c];)l.pop();return t.d=l,t.e=i,Vy?dv(t,f):t}function rv(e,t,n){if(e!==~~e||en)throw Error(Yy+e)}function iv(e){var t,n,r,i=e.length-1,a="",o=e[0];if(i>0){for(a+=o,t=1;te.e^a.s<0?1:-1;for(t=0,n=(r=a.d.length)<(i=e.d.length)?r:i;te.d[t]^a.s<0?1:-1;return r===i?0:r>i^a.s<0?1:-1},tv.decimalPlaces=tv.dp=function(){var e=this,t=e.d.length-1,n=7*(t-e.e);if(t=e.d[t])for(;t%10==0;t/=10)n--;return n<0?0:n},tv.dividedBy=tv.div=function(e){return av(this,new this.constructor(e))},tv.dividedToIntegerBy=tv.idiv=function(e){var t=this.constructor;return dv(av(this,new t(e),0,1),t.precision)},tv.equals=tv.eq=function(e){return!this.cmp(e)},tv.exponent=function(){return cv(this)},tv.greaterThan=tv.gt=function(e){return this.cmp(e)>0},tv.greaterThanOrEqualTo=tv.gte=function(e){return this.cmp(e)>=0},tv.isInteger=tv.isint=function(){return this.e>this.d.length-2},tv.isNegative=tv.isneg=function(){return this.s<0},tv.isPositive=tv.ispos=function(){return this.s>0},tv.isZero=function(){return 0===this.s},tv.lessThan=tv.lt=function(e){return this.cmp(e)<0},tv.lessThanOrEqualTo=tv.lte=function(e){return this.cmp(e)<1},tv.logarithm=tv.log=function(e){var t,n=this,r=n.constructor,i=r.precision,a=i+5;if(void 0===e)e=new r(10);else if((e=new r(e)).s<1||e.eq($y))throw Error(qy+"NaN");if(n.s<1)throw Error(qy+(n.s?"NaN":"-Infinity"));return n.eq($y)?new r(0):(Vy=!1,t=av(sv(n,a),sv(e,a),a),Vy=!0,dv(t,i))},tv.minus=tv.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?hv(t,e):nv(t,(e.s=-e.s,e))},tv.modulo=tv.mod=function(e){var t,n=this,r=n.constructor,i=r.precision;if(!(e=new r(e)).s)throw Error(qy+"NaN");return n.s?(Vy=!1,t=av(n,e,0,1).times(e),Vy=!0,n.minus(t)):dv(new r(n),i)},tv.naturalExponential=tv.exp=function(){return ov(this)},tv.naturalLogarithm=tv.ln=function(){return sv(this)},tv.negated=tv.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e},tv.plus=tv.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?nv(t,e):hv(t,(e.s=-e.s,e))},tv.precision=tv.sd=function(e){var t,n,r,i=this;if(void 0!==e&&e!==!!e&&1!==e&&0!==e)throw Error(Yy+e);if(t=cv(i)+1,n=7*(r=i.d.length-1)+1,r=i.d[r]){for(;r%10==0;r/=10)n--;for(r=i.d[0];r>=10;r/=10)n++}return e&&t>n?t:n},tv.squareRoot=tv.sqrt=function(){var e,t,n,r,i,a,o,c=this,l=c.constructor;if(c.s<1){if(!c.s)return new l(0);throw Error(qy+"NaN")}for(e=cv(c),Vy=!1,0==(i=Math.sqrt(+c))||i==1/0?(((t=iv(c.d)).length+e)%2==0&&(t+="0"),i=Math.sqrt(t),e=Gy((e+1)/2)-(e<0||e%2),r=new l(t=i==1/0?"5e"+e:(t=i.toExponential()).slice(0,t.indexOf("e")+1)+e)):r=new l(i.toString()),i=o=(n=l.precision)+3;;)if(r=(a=r).plus(av(c,a,o+2)).times(.5),iv(a.d).slice(0,o)===(t=iv(r.d)).slice(0,o)){if(t=t.slice(o-3,o+1),i==o&&"4999"==t){if(dv(a,n+1,0),a.times(a).eq(c)){r=a;break}}else if("9999"!=t)break;o+=4}return Vy=!0,dv(r,n)},tv.times=tv.mul=function(e){var t,n,r,i,a,o,c,l,u,s=this,f=s.constructor,d=s.d,h=(e=new f(e)).d;if(!s.s||!e.s)return new f(0);for(e.s*=s.s,n=s.e+e.e,(l=d.length)<(u=h.length)&&(a=d,d=h,h=a,o=l,l=u,u=o),a=[],r=o=l+u;r--;)a.push(0);for(r=u;--r>=0;){for(t=0,i=l+r;i>r;)c=a[i]+h[r]*d[i-r-1]+t,a[i--]=c%Jy|0,t=c/Jy|0;a[i]=(a[i]+t)%Jy|0}for(;!a[--o];)a.pop();return t?++n:a.shift(),e.d=a,e.e=n,Vy?dv(e,f.precision):e},tv.toDecimalPlaces=tv.todp=function(e,t){var n=this,r=n.constructor;return n=new r(n),void 0===e?n:(rv(e,0,Hy),void 0===t?t=r.rounding:rv(t,0,8),dv(n,e+cv(n)+1,t))},tv.toExponential=function(e,t){var n,r=this,i=r.constructor;return void 0===e?n=pv(r,!0):(rv(e,0,Hy),void 0===t?t=i.rounding:rv(t,0,8),n=pv(r=dv(new i(r),e+1,t),!0,e+1)),n},tv.toFixed=function(e,t){var n,r,i=this,a=i.constructor;return void 0===e?pv(i):(rv(e,0,Hy),void 0===t?t=a.rounding:rv(t,0,8),n=pv((r=dv(new a(i),e+cv(i)+1,t)).abs(),!1,e+cv(r)+1),i.isneg()&&!i.isZero()?"-"+n:n)},tv.toInteger=tv.toint=function(){var e=this,t=e.constructor;return dv(new t(e),cv(e)+1,t.rounding)},tv.toNumber=function(){return+this},tv.toPower=tv.pow=function(e){var t,n,r,i,a,o,c=this,l=c.constructor,u=+(e=new l(e));if(!e.s)return new l($y);if(!(c=new l(c)).s){if(e.s<1)throw Error(qy+"Infinity");return c}if(c.eq($y))return c;if(r=l.precision,e.eq($y))return dv(c,r);if(o=(t=e.e)>=(n=e.d.length-1),a=c.s,o){if((n=u<0?-u:u)<=9007199254740991){for(i=new l($y),t=Math.ceil(r/7+4),Vy=!1;n%2&&yv((i=i.times(c)).d,t),0!==(n=Gy(n/2));)yv((c=c.times(c)).d,t);return Vy=!0,e.s<0?new l($y).div(i):dv(i,r)}}else if(a<0)throw Error(qy+"NaN");return a=a<0&&1&e.d[Math.max(t,n)]?-1:1,c.s=1,Vy=!1,i=e.times(sv(c,r+12)),Vy=!0,(i=ov(i)).s=a,i},tv.toPrecision=function(e,t){var n,r,i=this,a=i.constructor;return void 0===e?r=pv(i,(n=cv(i))<=a.toExpNeg||n>=a.toExpPos):(rv(e,1,Hy),void 0===t?t=a.rounding:rv(t,0,8),r=pv(i=dv(new a(i),e,t),e<=(n=cv(i))||n<=a.toExpNeg,e)),r},tv.toSignificantDigits=tv.tosd=function(e,t){var n=this.constructor;return void 0===e?(e=n.precision,t=n.rounding):(rv(e,1,Hy),void 0===t?t=n.rounding:rv(t,0,8)),dv(new n(this),e,t)},tv.toString=tv.valueOf=tv.val=tv.toJSON=tv[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=cv(e),n=e.constructor;return pv(e,t<=n.toExpNeg||t>=n.toExpPos)};var av=function(){function e(e,t){var n,r=0,i=e.length;for(e=e.slice();i--;)n=e[i]*t+r,e[i]=n%Jy|0,r=n/Jy|0;return r&&e.unshift(r),e}function t(e,t,n,r){var i,a;if(n!=r)a=n>r?1:-1;else for(i=a=0;it[i]?1:-1;break}return a}function n(e,t,n){for(var r=0;n--;)e[n]-=r,r=e[n]1;)e.shift()}return function(r,i,a,o){var c,l,u,s,f,d,h,p,y,v,g,m,b,w,x,O,_,P,A=r.constructor,E=r.s==i.s?1:-1,S=r.d,j=i.d;if(!r.s)return new A(r);if(!i.s)throw Error(qy+"Division by zero");for(l=r.e-i.e,_=j.length,x=S.length,p=(h=new A(E)).d=[],u=0;j[u]==(S[u]||0);)++u;if(j[u]>(S[u]||0)&&--l,(m=null==a?a=A.precision:o?a+(cv(r)-cv(i))+1:a)<0)return new A(0);if(m=m/7+2|0,u=0,1==_)for(s=0,j=j[0],m++;(u1&&(j=e(j,s),S=e(S,s),_=j.length,x=S.length),w=_,v=(y=S.slice(0,_)).length;v<_;)y[v++]=0;(P=j.slice()).unshift(0),O=j[0],j[1]>=Jy/2&&++O;do{s=0,(c=t(j,y,_,v))<0?(g=y[0],_!=v&&(g=g*Jy+(y[1]||0)),(s=g/O|0)>1?(s>=Jy&&(s=Jy-1),1==(c=t(f=e(j,s),y,d=f.length,v=y.length))&&(s--,n(f,_16)throw Error(Xy+cv(e));if(!e.s)return new u($y);for(Vy=!1,o=s,a=new u(.03125);e.abs().gte(.1);)e=e.times(a),l+=5;for(o+=Math.log(Zy(2,l))/Math.LN10*2+5|0,n=r=i=new u($y),u.precision=o;;){if(r=dv(r.times(e),o),n=n.times(++c),iv((a=i.plus(av(r,n,o))).d).slice(0,o)===iv(i.d).slice(0,o)){for(;l--;)i=dv(i.times(i),o);return u.precision=s,null==t?(Vy=!0,dv(i,s)):i}i=a}}function cv(e){for(var t=7*e.e,n=e.d[0];n>=10;n/=10)t++;return t}function lv(e,t,n){if(t>e.LN10.sd())throw Vy=!0,n&&(e.precision=n),Error(qy+"LN10 precision limit exceeded");return dv(new e(e.LN10),t)}function uv(e){for(var t="";e--;)t+="0";return t}function sv(e,t){var n,r,i,a,o,c,l,u,s,f=1,d=e,h=d.d,p=d.constructor,y=p.precision;if(d.s<1)throw Error(qy+(d.s?"NaN":"-Infinity"));if(d.eq($y))return new p(0);if(null==t?(Vy=!1,u=y):u=t,d.eq(10))return null==t&&(Vy=!0),lv(p,u);if(u+=10,p.precision=u,r=(n=iv(h)).charAt(0),a=cv(d),!(Math.abs(a)<15e14))return l=lv(p,u+2,y).times(a+""),d=sv(new p(r+"."+n.slice(1)),u-10).plus(l),p.precision=y,null==t?(Vy=!0,dv(d,y)):d;for(;r<7&&1!=r||1==r&&n.charAt(1)>3;)r=(n=iv((d=d.times(e)).d)).charAt(0),f++;for(a=cv(d),r>1?(d=new p("0."+n),a++):d=new p(r+"."+n.slice(1)),c=o=d=av(d.minus($y),d.plus($y),u),s=dv(d.times(d),u),i=3;;){if(o=dv(o.times(s),u),iv((l=c.plus(av(o,new p(i),u))).d).slice(0,u)===iv(c.d).slice(0,u))return c=c.times(2),0!==a&&(c=c.plus(lv(p,u+2,y).times(a+""))),c=av(c,new p(f),u),p.precision=y,null==t?(Vy=!0,dv(c,y)):c;c=l,i+=2}}function fv(e,t){var n,r,i;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;48===t.charCodeAt(r);)++r;for(i=t.length;48===t.charCodeAt(i-1);)--i;if(t=t.slice(r,i)){if(i-=r,n=n-r-1,e.e=Gy(n/7),e.d=[],r=(n+1)%7,n<0&&(r+=7),rev||e.e<-ev))throw Error(Xy+n)}else e.s=0,e.e=0,e.d=[0];return e}function dv(e,t,n){var r,i,a,o,c,l,u,s,f=e.d;for(o=1,a=f[0];a>=10;a/=10)o++;if((r=t-o)<0)r+=7,i=t,u=f[s=0];else{if((s=Math.ceil((r+1)/7))>=(a=f.length))return e;for(u=a=f[s],o=1;a>=10;a/=10)o++;i=(r%=7)-7+o}if(void 0!==n&&(c=u/(a=Zy(10,o-i-1))%10|0,l=t<0||void 0!==f[s+1]||u%a,l=n<4?(c||l)&&(0==n||n==(e.s<0?3:2)):c>5||5==c&&(4==n||l||6==n&&(r>0?i>0?u/Zy(10,o-i):0:f[s-1])%10&1||n==(e.s<0?8:7))),t<1||!f[0])return l?(a=cv(e),f.length=1,t=t-a-1,f[0]=Zy(10,(7-t%7)%7),e.e=Gy(-t/7)||0):(f.length=1,f[0]=e.e=e.s=0),e;if(0==r?(f.length=s,a=1,s--):(f.length=s+1,a=Zy(10,7-r),f[s]=i>0?(u/Zy(10,o-i)%Zy(10,i)|0)*a:0),l)for(;;){if(0==s){(f[0]+=a)==Jy&&(f[0]=1,++e.e);break}if(f[s]+=a,f[s]!=Jy)break;f[s--]=0,a=1}for(r=f.length;0===f[--r];)f.pop();if(Vy&&(e.e>ev||e.e<-ev))throw Error(Xy+cv(e));return e}function hv(e,t){var n,r,i,a,o,c,l,u,s,f,d=e.constructor,h=d.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new d(e),Vy?dv(t,h):t;if(l=e.d,f=t.d,r=t.e,u=e.e,l=l.slice(),o=u-r){for((s=o<0)?(n=l,o=-o,c=f.length):(n=f,r=u,c=l.length),o>(i=Math.max(Math.ceil(h/7),c)+2)&&(o=i,n.length=1),n.reverse(),i=o;i--;)n.push(0);n.reverse()}else{for((s=(i=l.length)<(c=f.length))&&(c=i),i=0;i0;--i)l[c++]=0;for(i=f.length;i>o;){if(l[--i]0?a=a.charAt(0)+"."+a.slice(1)+uv(r):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(i<0?"e":"e+")+i):i<0?(a="0."+uv(-i-1)+a,n&&(r=n-o)>0&&(a+=uv(r))):i>=o?(a+=uv(i+1-o),n&&(r=n-i-1)>0&&(a=a+"."+uv(r))):((r=i+1)0&&(i+1===o&&(a+="."),a+=uv(r))),e.s<0?"-"+a:a}function yv(e,t){if(e.length>t)return e.length=t,!0}function vv(e){if(!e||"object"!=typeof e)throw Error(qy+"Object expected");var t,n,r,i=["precision",1,Hy,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(t=0;t=i[t+1]&&r<=i[t+2]))throw Error(Yy+n+": "+r);this[n]=r}if(void 0!==(r=e[n="LN10"])){if(r!=Math.LN10)throw Error(Yy+n+": "+r);this[n]=new this(r)}return this}var gv=function e(t){var n,r,i;function a(e){var t=this;if(!(t instanceof a))return new a(e);if(t.constructor=a,e instanceof a)return t.s=e.s,t.e=e.e,void(t.d=(e=e.d)?e.slice():e);if("number"==typeof e){if(0*e!=0)throw Error(Yy+e);if(e>0)t.s=1;else{if(!(e<0))return t.s=0,t.e=0,void(t.d=[0]);e=-e,t.s=-1}return e===~~e&&e<1e7?(t.e=0,void(t.d=[e])):fv(t,e.toString())}if("string"!=typeof e)throw Error(Yy+e);if(45===e.charCodeAt(0)?(e=e.slice(1),t.s=-1):t.s=1,!Qy.test(e))throw Error(Yy+e);fv(t,e)}if(a.prototype=tv,a.ROUND_UP=0,a.ROUND_DOWN=1,a.ROUND_CEIL=2,a.ROUND_FLOOR=3,a.ROUND_HALF_UP=4,a.ROUND_HALF_DOWN=5,a.ROUND_HALF_EVEN=6,a.ROUND_HALF_CEIL=7,a.ROUND_HALF_FLOOR=8,a.clone=e,a.config=a.set=vv,void 0===t&&(t={}),t)for(i=["precision","rounding","toExpNeg","toExpPos","LN10"],n=0;ne,xv={},Ov=e=>e===xv,_v=e=>function t(){return 0===arguments.length||1===arguments.length&&Ov(arguments.length<=0?void 0:arguments[0])?t:e(...arguments)},Pv=(e,t)=>1===e?t:_v(function(){for(var n=arguments.length,r=new Array(n),i=0;ie!==xv).length;return a>=e?t(...r):Pv(e-a,_v(function(){for(var e=arguments.length,n=new Array(e),i=0;iOv(e)?n.shift():e);return t(...a,...n)}))}),Av=(e,t)=>{for(var n=[],r=e;rArray.isArray(t)?t.map(e):Object.keys(t).map(e=>t[e]).map(e)).length,bv),Sv=e=>Array.isArray(e)?e.reverse():e.split("").reverse().join("");function jv(e){return 0===e?1:Math.floor(new mv(e).abs().log(10).toNumber())+1}function kv(e,t,n){for(var r=new mv(e),i=0,a=[];r.lt(t)&&i<1e5;)a.push(r.toNumber()),r=r.add(n),i++;return a}var Mv=e=>{var[t,n]=e,[r,i]=[t,n];return t>n&&([r,i]=[n,t]),[r,i]},Cv=(e,t,n)=>{if(e.lte(0))return new mv(0);var r=jv(e.toNumber()),i=new mv(10).pow(r),a=e.div(i),o=1!==r?.05:.1,c=new mv(Math.ceil(a.div(o).toNumber())).add(n).mul(o).mul(i);return new mv(t?c.toNumber():Math.ceil(c.toNumber()))},Tv=function(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!Number.isFinite((t-e)/(n-1)))return{step:new mv(0),tickMin:new mv(0),tickMax:new mv(0)};var a,o=Cv(new mv(t).sub(e).div(n-1),r,i);a=e<=0&&t>=0?new mv(0):(a=new mv(e).add(t).div(2)).sub(new mv(a).mod(o));var c=Math.ceil(a.sub(e).div(o).toNumber()),l=Math.ceil(new mv(t).sub(a).div(o).toNumber()),u=c+l+1;return u>n?Tv(e,t,n,r,i+1):(u0?l+(n-u):l,c=t>0?c:c+(n-u)),{step:o,tickMin:a.sub(new mv(c).mul(o)),tickMax:a.add(new mv(l).mul(o))})},Iv=e=>e.rootProps.stackOffset,Dv=e=>e.rootProps.reverseStackOrder,Nv=e=>e.options.chartName,zv=e=>e.rootProps.syncId,Lv=e=>e.rootProps.syncMethod,Rv=e=>e.options.eventEmitter,Bv={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},Kv="auto",Fv=!0,Uv=!1,Wv=!0,$v="auto",Hv=!0,Vv=(e,t)=>{if(e&&t)return null!=e&&e.reversed?[t[1],t[0]]:t},qv={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!1,dataKey:void 0,domain:void 0,id:0,includeHidden:!1,name:void 0,reversed:!1,scale:Kv,tick:Fv,tickCount:void 0,ticks:void 0,type:"category",unit:void 0},Yv={allowDataOverflow:Uv,allowDecimals:!1,allowDuplicatedCategory:Wv,dataKey:void 0,domain:void 0,id:0,includeHidden:!1,name:void 0,reversed:!1,scale:$v,tick:Hv,tickCount:5,ticks:void 0,type:"number",unit:void 0},Xv={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!0,dataKey:void 0,domain:void 0,id:0,includeHidden:!1,name:void 0,reversed:!1,scale:Kv,tick:Fv,tickCount:void 0,ticks:void 0,type:"number",unit:void 0},Gv={allowDataOverflow:Uv,allowDecimals:!1,allowDuplicatedCategory:Wv,dataKey:void 0,domain:void 0,id:0,includeHidden:!1,name:void 0,reversed:!1,scale:$v,tick:Hv,tickCount:5,ticks:void 0,type:"category",unit:void 0},Zv=(e,t)=>null!=e.polarAxis.angleAxis[t]?e.polarAxis.angleAxis[t]:"radial"===e.layout.layoutType?Xv:qv,Qv=(e,t)=>null!=e.polarAxis.radiusAxis[t]?e.polarAxis.radiusAxis[t]:"radial"===e.layout.layoutType?Gv:Yv,Jv=e=>e.polarOptions,eg=jr([Bo,Ko,ec],function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(e-(n.left||0)-(n.right||0)),Math.abs(t-(n.top||0)-(n.bottom||0)))/2}),tg=jr([Jv,eg],(e,t)=>{if(null!=e)return lt(e.innerRadius,t,0)}),ng=jr([Jv,eg],(e,t)=>{if(null!=e)return lt(e.outerRadius,t,.8*t)}),rg=jr([Jv],e=>{if(null==e)return[0,0];var{startAngle:t,endAngle:n}=e;return[t,n]});jr([Zv,rg],Vv);var ig=jr([eg,tg,ng],(e,t,n)=>{if(null!=e&&null!=t&&null!=n)return[t,n]});jr([Qv,ig],Vv);var ag=jr([Rc,Jv,tg,ng,Bo,Ko],(e,t,n,r,i,a)=>{if(("centric"===e||"radial"===e)&&null!=t&&null!=n&&null!=r){var{cx:o,cy:c,startAngle:l,endAngle:u}=t;return{cx:lt(o,i,i/2),cy:lt(c,a,a/2),innerRadius:n,outerRadius:r,startAngle:l,endAngle:u,clockWise:!1}}}),og=(e,t)=>t,cg=(e,t,n)=>n;function lg(e){return null==e?void 0:e.id}function ug(e,t,n){var{chartData:r=[]}=t,{allowDuplicatedCategory:i,dataKey:a}=n,o=new Map;return e.forEach(e=>{var t,n=null!==(t=e.data)&&void 0!==t?t:r;if(null!=n&&0!==n.length){var c=lg(e);n.forEach((t,n)=>{var r,l=null==a||i?n:String(Eo(t,a,null)),u=Eo(t,e.dataKey,0);r=o.has(l)?o.get(l):{},Object.assign(r,{[c]:u}),o.set(l,r)})}}),Array.from(o.values())}function sg(e){return null!=e.stackId&&null!=e.dataKey}var fg=(e,t)=>e===t||null!=e&&null!=t&&e[0]===t[0]&&e[1]===t[1];function dg(e,t){return!(!Array.isArray(e)||!Array.isArray(t)||0!==e.length||0!==t.length)||e===t}var hg=e=>{var t=Rc(e);return"horizontal"===t?"xAxis":"vertical"===t?"yAxis":"centric"===t?"angleAxis":"radiusAxis"},pg=e=>e.tooltip.settings.axisId;function yg(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function vg(e){for(var t=1;te.cartesianAxis.xAxis[t],xg=(e,t)=>{var n=wg(e,t);return null==n?bg:n},Og={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:mg,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"left",padding:{top:0,bottom:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"number",unit:void 0,width:60},_g=(e,t)=>e.cartesianAxis.yAxis[t],Pg=(e,t)=>{var n=_g(e,t);return null==n?Og:n},Ag={domain:[0,"auto"],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:"",range:[64,64],scale:"auto",type:"number",unit:""},Eg=(e,t)=>{var n=e.cartesianAxis.zAxis[t];return null==n?Ag:n},Sg=(e,t,n)=>{switch(t){case"xAxis":return xg(e,n);case"yAxis":return Pg(e,n);case"zAxis":return Eg(e,n);case"angleAxis":return Zv(e,n);case"radiusAxis":return Qv(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},jg=(e,t,n)=>{switch(t){case"xAxis":return xg(e,n);case"yAxis":return Pg(e,n);case"angleAxis":return Zv(e,n);case"radiusAxis":return Qv(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},kg=e=>e.graphicalItems.cartesianItems.some(e=>"bar"===e.type)||e.graphicalItems.polarItems.some(e=>"radialBar"===e.type);function Mg(e,t){return n=>{switch(e){case"xAxis":return"xAxisId"in n&&n.xAxisId===t;case"yAxis":return"yAxisId"in n&&n.yAxisId===t;case"zAxis":return"zAxisId"in n&&n.zAxisId===t;case"angleAxis":return"angleAxisId"in n&&n.angleAxisId===t;case"radiusAxis":return"radiusAxisId"in n&&n.radiusAxisId===t;default:return!1}}}var Cg=e=>e.graphicalItems.cartesianItems,Tg=jr([og,cg],Mg),Ig=(e,t,n)=>e.filter(n).filter(e=>!0===(null==t?void 0:t.includeHidden)||!e.hide),Dg=jr([Cg,Sg,Tg],Ig,{memoizeOptions:{resultEqualityCheck:dg}}),Ng=jr([Dg],e=>e.filter(e=>"area"===e.type||"bar"===e.type).filter(sg)),zg=e=>e.filter(e=>!("stackId"in e)||void 0===e.stackId),Lg=jr([Dg],zg),Rg=e=>e.map(e=>e.data).filter(Boolean).flat(1),Bg=jr([Dg],Rg,{memoizeOptions:{resultEqualityCheck:dg}}),Kg=(e,t)=>{var{chartData:n=[],dataStartIndex:r,dataEndIndex:i}=t;return e.length>0?e:n.slice(r,i+1)},Fg=jr([Bg,Ky],Kg),Ug=(e,t,n)=>null!=(null==t?void 0:t.dataKey)?e.map(e=>({value:Eo(e,t.dataKey)})):n.length>0?n.map(e=>e.dataKey).flatMap(t=>e.map(e=>({value:Eo(e,t)}))):e.map(e=>({value:e})),Wg=jr([Fg,Sg,Dg],Ug);function $g(e,t){switch(e){case"xAxis":return"x"===t.direction;case"yAxis":return"y"===t.direction;default:return!1}}function Hg(e){if(at(e)||e instanceof Date){var t=Number(e);if(xc(t))return t}}function Vg(e){if(Array.isArray(e)){var t=[Hg(e[0]),Hg(e[1])];return Fy(t)?t:void 0}var n=Hg(e);if(null!=n)return[n,n]}function qg(e){return e.map(Hg).filter(pt)}var Yg=e=>{var t=hg(e),n=pg(e);return jg(e,t,n)},Xg=jr([Yg],e=>null==e?void 0:e.dataKey),Gg=jr([Ng,Ky,Yg],ug),Zg=(e,t,n,r)=>{var i=t.reduce((e,t)=>(null==t.stackId||(null==e[t.stackId]&&(e[t.stackId]=[]),e[t.stackId].push(t)),e),{});return Object.fromEntries(Object.entries(i).map(t=>{var[i,a]=t,o=r?[...a].reverse():a,c=o.map(lg);return[i,{stackedData:To(e,c,n),graphicalItems:o}]}))},Qg=jr([Gg,Ng,Iv,Dv],Zg),Jg=(e,t,n,r)=>{var{dataStartIndex:i,dataEndIndex:a}=t;if(null==r&&"zAxis"!==n){var o=((e,t,n)=>{var r;if(null!=e)return[(r=Object.keys(e).reduce((r,i)=>{var a=e[i],{stackedData:o}=a,c=o.reduce((e,r)=>{var i,a=(i=Oo(r,t,n).flat(2).filter(it),[Math.min(...i),Math.max(...i)]);return[Math.min(e[0],a[0]),Math.max(e[1],a[1])]},[1/0,-1/0]);return[Math.min(c[0],r[0]),Math.max(c[1],r[1])]},[1/0,-1/0]))[0]===1/0?0:r[0],r[1]===-1/0?0:r[1]]})(e,i,a);if(null==o||0!==o[0]||0!==o[1])return o}},em=jr([Sg],e=>e.allowDataOverflow),tm=e=>{var t;if(null==e||!("domain"in e))return mg;if(null!=e.domain)return e.domain;if(null!=e.ticks){if("number"===e.type){var n=qg(e.ticks);return[Math.min(...n),Math.max(...n)]}if("category"===e.type)return e.ticks.map(String)}return null!==(t=null==e?void 0:e.domain)&&void 0!==t?t:mg},nm=jr([Sg],tm),rm=jr([nm,em],Wy),im=jr([Qg,Ry,og,rm],Jg,{memoizeOptions:{resultEqualityCheck:fg}}),am=e=>e.errorBars,om=function(){for(var e=arguments.length,t=new Array(e),n=0;n{var a,o;if(n.length>0&&e.forEach(e=>{n.forEach(n=>{var c,l,u=null===(c=r[n.id])||void 0===c?void 0:c.filter(e=>$g(i,e)),s=Eo(e,null!==(l=t.dataKey)&&void 0!==l?l:n.dataKey),f=function(e,t,n){return!n||"number"!=typeof t||nt(t)?[]:n.length?qg(n.flatMap(n=>{var r,i,a=Eo(e,n.dataKey);if(Array.isArray(a)?[r,i]=a:r=i=a,xc(r)&&xc(i))return[t-r,t+i]})):[]}(e,s,u);if(f.length>=2){var d=Math.min(...f),h=Math.max(...f);(null==a||do)&&(o=h)}var p=Vg(s);null!=p&&(a=null==a?p[0]:Math.min(a,p[0]),o=null==o?p[1]:Math.max(o,p[1]))})}),null!=(null==t?void 0:t.dataKey)&&e.forEach(e=>{var n=Vg(Eo(e,t.dataKey));null!=n&&(a=null==a?n[0]:Math.min(a,n[0]),o=null==o?n[1]:Math.max(o,n[1]))}),xc(a)&&xc(o))return[a,o]},lm=jr([Fg,Sg,Lg,am,og],cm,{memoizeOptions:{resultEqualityCheck:fg}});function um(e){var{value:t}=e;if(at(t)||t instanceof Date)return t}var sm=e=>e.referenceElements.dots,fm=(e,t,n)=>e.filter(e=>"extendDomain"===e.ifOverflow).filter(e=>"xAxis"===t?e.xAxisId===n:e.yAxisId===n),dm=jr([sm,og,cg],fm),hm=e=>e.referenceElements.areas,pm=jr([hm,og,cg],fm),ym=e=>e.referenceElements.lines,vm=jr([ym,og,cg],fm),gm=(e,t)=>{var n=qg(e.map(e=>"xAxis"===t?e.x:e.y));if(0!==n.length)return[Math.min(...n),Math.max(...n)]},mm=jr(dm,og,gm),bm=(e,t)=>{var n=qg(e.flatMap(e=>["xAxis"===t?e.x1:e.y1,"xAxis"===t?e.x2:e.y2]));if(0!==n.length)return[Math.min(...n),Math.max(...n)]},wm=jr([pm,og],bm),xm=(e,t)=>{var n=e.flatMap(e=>"xAxis"===t?function(e){var t;if(null!=e.x)return qg([e.x]);var n=null===(t=e.segment)||void 0===t?void 0:t.map(e=>e.x);return null==n||0===n.length?[]:qg(n)}(e):function(e){var t;if(null!=e.y)return qg([e.y]);var n=null===(t=e.segment)||void 0===t?void 0:t.map(e=>e.y);return null==n||0===n.length?[]:qg(n)}(e));if(0!==n.length)return[Math.min(...n),Math.max(...n)]},Om=jr([vm,og],xm),_m=jr(mm,Om,wm,(e,t,n)=>om(e,n,t)),Pm=(e,t,n,r,i,a,o,c)=>null!=n?n:function(e,t,n){if(n||null!=t){if("function"==typeof e&&null!=t)try{var r=e(t,n);if(Fy(r))return Uy(r,t,n)}catch(h){}if(Array.isArray(e)&&2===e.length){var i,a,[o,c]=e;if("auto"===o)null!=t&&(i=Math.min(...t));else if(it(o))i=o;else if("function"==typeof o)try{null!=t&&(i=o(null==t?void 0:t[0]))}catch(p){}else if("string"==typeof o&&Do.test(o)){var l=Do.exec(o);if(null==l||null==t)i=void 0;else{var u=+l[1];i=t[0]-u}}else i=null==t?void 0:t[0];if("auto"===c)null!=t&&(a=Math.max(...t));else if(it(c))a=c;else if("function"==typeof c)try{null!=t&&(a=c(null==t?void 0:t[1]))}catch(y){}else if("string"==typeof c&&No.test(c)){var s=No.exec(c);if(null==s||null==t)a=void 0;else{var f=+s[1];a=t[1]+f}}else a=null==t?void 0:t[1];var d=[i,a];if(Fy(d))return null==t?d:Uy(d,t,n)}}}(t,"vertical"===o&&"xAxis"===c||"horizontal"===o&&"yAxis"===c?om(r,a,i):om(a,i),e.allowDataOverflow),Am=jr([Sg,nm,rm,im,lm,_m,Rc,og],Pm,{memoizeOptions:{resultEqualityCheck:fg}}),Em=[0,1],Sm=(e,t,n,r,i,a,o)=>{if(null!=e&&null!=n&&0!==n.length||void 0!==o){var c,{dataKey:l,type:u}=e,s=So(t,a);return s&&null==l?_s(0,null!==(c=null==n?void 0:n.length)&&void 0!==c?c:0):"category"===u?((e,t,n)=>{var r=e.map(um).filter(e=>null!=e);return n&&(null==t.dataKey||t.allowDuplicatedCategory&&ut(r))?_s(0,e.length):t.allowDuplicatedCategory?r:Array.from(new Set(r))})(r,e,s):"expand"===i?Em:o}},jm=jr([Sg,Rc,Fg,Wg,Iv,og,Am],Sm),km=(e,t,n,r,i)=>{if(null!=e){var{scale:a,type:o}=e;if("auto"===a)return"radial"===t&&"radiusAxis"===i?"band":"radial"===t&&"angleAxis"===i?"linear":"category"===o&&r&&(r.indexOf("LineChart")>=0||r.indexOf("AreaChart")>=0||r.indexOf("ComposedChart")>=0&&!n)?"point":"category"===o?"band":"linear";if("string"==typeof a){var c="scale".concat(ht(a));return c in Ly?c:"point"}}},Mm=jr([Sg,Rc,kg,Nv,og],km);function Cm(e,t,n,r){if(null!=n&&null!=r){if("function"==typeof e.scale)return e.scale.copy().domain(n).range(r);var i=function(e){if(null!=e){if(e in Ly)return Ly[e]();var t="scale".concat(ht(e));return t in Ly?Ly[t]():void 0}}(t);if(null!=i){var a=i.domain(n).range(r);return(e=>{var t=e.domain();if(t&&!(t.length<=2)){var n=t.length,r=e.range(),i=Math.min(r[0],r[1])-Mo,a=Math.max(r[0],r[1])+Mo,o=e(t[0]),c=e(t[n-1]);(oa||ca)&&e.domain([t[0],t[n-1]])}})(a),a}}}var Tm=(e,t,n)=>{var r=tm(t);if("auto"===n||"linear"===n)return null!=t&&t.tickCount&&Array.isArray(r)&&("auto"===r[0]||"auto"===r[1])&&Fy(e)?function(e){var[t,n]=e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6,i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=Math.max(r,2),[o,c]=Mv([t,n]);if(o===-1/0||c===1/0){var l=c===1/0?[o,...Av(0,r-1).map(()=>1/0)]:[...Av(0,r-1).map(()=>-1/0),c];return t>n?Sv(l):l}if(o===c)return((e,t,n)=>{var r=new mv(1),i=new mv(e);if(!i.isint()&&n){var a=Math.abs(e);a<1?(r=new mv(10).pow(jv(e)-1),i=new mv(Math.floor(i.div(r).toNumber())).mul(r)):a>1&&(i=new mv(Math.floor(e)))}else 0===e?i=new mv(Math.floor((t-1)/2)):n||(i=new mv(Math.floor(e)));var o=Math.floor((t-1)/2);return function(){for(var e=arguments.length,t=new Array(e),n=0;nt(e),i(...arguments))}}(Ev(e=>i.add(new mv(e-o).mul(r)).toNumber()),Av)(0,t)})(o,r,i);var{step:u,tickMin:s,tickMax:f}=Tv(o,c,a,i,0),d=kv(s,f.add(new mv(.1).mul(u)),u);return t>n?Sv(d):d}(e,t.tickCount,t.allowDecimals):null!=t&&t.tickCount&&"number"===t.type&&Fy(e)?function(e,t){var[n,r]=e,i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],[a,o]=Mv([n,r]);if(a===-1/0||o===1/0)return[n,r];if(a===o)return[a];var c=Math.max(t,2),l=Cv(new mv(o).sub(a).div(c-1),i,0),u=[...kv(new mv(a),new mv(o),l),o];return!1===i&&(u=u.map(e=>Math.round(e))),n>r?Sv(u):u}(e,t.tickCount,t.allowDecimals):void 0},Im=jr([jm,jg,Mm],Tm),Dm=(e,t,n,r)=>{if("angleAxis"!==r&&"number"===(null==e?void 0:e.type)&&Fy(t)&&Array.isArray(n)&&n.length>0){var i=t[0],a=n[0],o=t[1],c=n[n.length-1];return[Math.min(i,a),Math.max(o,c)]}return t},Nm=jr([Sg,jm,Im,og],Dm),zm=jr(Wg,Sg,(e,t)=>{if(t&&"number"===t.type){var n=1/0,r=Array.from(qg(e.map(e=>e.value))).sort((e,t)=>e-t);if(r.length<2)return 1/0;var i=r[r.length-1]-r[0];if(0===i)return 1/0;for(var a=0;ae.rootProps.barCategoryGap,ec,(e,t,n,r)=>r,(e,t,n,r,i)=>{if(!xc(e))return 0;var a="vertical"===t?r.height:r.width;if("gap"===i)return e*a/2;if("no-gap"===i){var o=lt(n,e*a),c=e*a/2;return c-o-(c-o)/a*o}return 0}),Rm=jr(xg,(e,t)=>{var n=xg(e,t);return null==n||"string"!=typeof n.padding?0:Lm(e,"xAxis",t,n.padding)},(e,t)=>{var n,r;if(null==e)return{left:0,right:0};var{padding:i}=e;return"string"==typeof i?{left:t,right:t}:{left:(null!==(n=i.left)&&void 0!==n?n:0)+t,right:(null!==(r=i.right)&&void 0!==r?r:0)+t}}),Bm=jr(Pg,(e,t)=>{var n=Pg(e,t);return null==n||"string"!=typeof n.padding?0:Lm(e,"yAxis",t,n.padding)},(e,t)=>{var n,r;if(null==e)return{top:0,bottom:0};var{padding:i}=e;return"string"==typeof i?{top:t,bottom:t}:{top:(null!==(n=i.top)&&void 0!==n?n:0)+t,bottom:(null!==(r=i.bottom)&&void 0!==r?r:0)+t}}),Km=jr([ec,Rm,oc,ac,(e,t,n)=>n],(e,t,n,r,i)=>{var{padding:a}=r;return i?[a.left,n.width-a.right]:[e.left+t.left,e.left+e.width-t.right]}),Fm=jr([ec,Rc,Bm,oc,ac,(e,t,n)=>n],(e,t,n,r,i,a)=>{var{padding:o}=i;return a?[r.height-o.bottom,o.top]:"horizontal"===t?[e.top+e.height-n.bottom,e.top+n.top]:[e.top+n.top,e.top+e.height-n.bottom]}),Um=(e,t,n,r)=>{var i;switch(t){case"xAxis":return Km(e,n,r);case"yAxis":return Fm(e,n,r);case"zAxis":return null===(i=Eg(e,n))||void 0===i?void 0:i.range;case"angleAxis":return rg(e);case"radiusAxis":return ig(e,n);default:return}},Wm=jr([Sg,Um],Vv),$m=jr([Sg,Mm,Nm,Wm],Cm);function Hm(e,t){return e.idt.id?1:0}jr([Dg,am,og],(e,t,n)=>e.flatMap(e=>t[e.id]).filter(Boolean).filter(e=>$g(n,e)));var Vm=(e,t)=>t,qm=(e,t,n)=>n,Ym=jr(Wo,Vm,qm,(e,t,n)=>e.filter(e=>e.orientation===t).filter(e=>e.mirror===n).sort(Hm)),Xm=jr($o,Vm,qm,(e,t,n)=>e.filter(e=>e.orientation===t).filter(e=>e.mirror===n).sort(Hm)),Gm=(e,t)=>({width:e.width,height:t.height}),Zm=jr(ec,xg,Gm),Qm=jr(Ko,ec,Ym,Vm,qm,(e,t,n,r,i)=>{var a,o={};return n.forEach(n=>{var c=Gm(t,n);null==a&&(a=((e,t,n)=>{switch(t){case"top":return e.top;case"bottom":return n-e.bottom;default:return 0}})(t,r,e));var l="top"===r&&!i||"bottom"===r&&i;o[n.id]=a-Number(l)*c.height,a+=(l?-1:1)*c.height}),o}),Jm=jr(Bo,ec,Xm,Vm,qm,(e,t,n,r,i)=>{var a,o={};return n.forEach(n=>{var c=((e,t)=>({width:"number"==typeof t.width?t.width:60,height:e.height}))(t,n);null==a&&(a=((e,t,n)=>{switch(t){case"left":return e.left;case"right":return n-e.right;default:return 0}})(t,r,e));var l="left"===r&&!i||"right"===r&&i;o[n.id]=a-Number(l)*c.width,a+=(l?-1:1)*c.width}),o}),eb=jr([ec,xg,(e,t)=>{var n=xg(e,t);if(null!=n)return Qm(e,n.orientation,n.mirror)},(e,t)=>t],(e,t,n,r)=>{if(null!=t){var i=null==n?void 0:n[r];return null==i?{x:e.left,y:0}:{x:e.left,y:i}}}),tb=jr([ec,Pg,(e,t)=>{var n=Pg(e,t);if(null!=n)return Jm(e,n.orientation,n.mirror)},(e,t)=>t],(e,t,n,r)=>{if(null!=t){var i=null==n?void 0:n[r];return null==i?{x:0,y:e.top}:{x:i,y:e.top}}}),nb=jr(ec,Pg,(e,t)=>({width:"number"==typeof t.width?t.width:60,height:e.height})),rb=(e,t,n,r)=>{if(null!=n){var{allowDuplicatedCategory:i,type:a,dataKey:o}=n,c=So(e,r),l=t.map(e=>e.value);return o&&c&&"category"===a&&i&&ut(l)?l:void 0}},ib=jr([Rc,Wg,Sg,og],rb),ab=(e,t,n,r)=>{if(null!=n&&null!=n.dataKey){var{type:i,scale:a}=n;return!So(e,r)||"number"!==i&&"auto"===a?void 0:t.map(e=>e.value)}},ob=jr([Rc,Wg,jg,og],ab),cb=jr([Rc,(e,t,n)=>{switch(t){case"xAxis":return xg(e,n);case"yAxis":return Pg(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},Mm,$m,ib,ob,Um,Im,og],(e,t,n,r,i,a,o,c,l)=>{if(null!=t){var u=So(e,l);return{angle:t.angle,interval:t.interval,minTickGap:t.minTickGap,orientation:t.orientation,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,axisType:l,categoricalDomain:a,duplicateDomain:i,isCategorical:u,niceTicks:c,range:o,realScaleType:n,scale:r}}}),lb=jr([Rc,jg,Mm,$m,Im,Um,ib,ob,og],(e,t,n,r,i,a,o,c,l)=>{if(null!=t&&null!=r){var u=So(e,l),{type:s,ticks:f,tickCount:d}=t,h="scaleBand"===n&&"function"==typeof r.bandwidth?r.bandwidth()/2:2,p="category"===s&&r.bandwidth?r.bandwidth()/h:0;p="angleAxis"===l&&null!=a&&a.length>=2?2*tt(a[0]-a[1])*p:p;var y=f||i;return y?y.map((e,t)=>{var n=o?o.indexOf(e):e;return{index:t,coordinate:r(n)+p,value:e,offset:p}}).filter(e=>xc(e.coordinate)):u&&c?c.map((e,t)=>({coordinate:r(e)+p,value:e,index:t,offset:p})).filter(e=>xc(e.coordinate)):r.ticks?r.ticks(d).map(e=>({coordinate:r(e)+p,value:e,offset:p})):r.domain().map((e,t)=>({coordinate:r(e)+p,value:o?o[e]:e,index:t,offset:p}))}}),ub=jr([Rc,jg,$m,Um,ib,ob,og],(e,t,n,r,i,a,o)=>{if(null!=t&&null!=n&&null!=r&&r[0]!==r[1]){var c=So(e,o),{tickCount:l}=t,u=0;return u="angleAxis"===o&&(null==r?void 0:r.length)>=2?2*tt(r[0]-r[1])*u:u,c&&a?a.map((e,t)=>({coordinate:n(e)+u,value:e,index:t,offset:u})):n.ticks?n.ticks(l).map(e=>({coordinate:n(e)+u,value:e,offset:u})):n.domain().map((e,t)=>({coordinate:n(e)+u,value:i?i[e]:e,index:t,offset:u}))}}),sb=jr(Sg,$m,(e,t)=>{if(null!=e&&null!=t)return vg(vg({},e),{},{scale:t})}),fb=jr([Sg,Mm,jm,Wm],Cm);jr((e,t,n)=>Eg(e,n),fb,(e,t)=>{if(null!=e&&null!=t)return vg(vg({},e),{},{scale:t})});var db=jr([Rc,Wo,$o],(e,t,n)=>{switch(e){case"horizontal":return t.some(e=>e.reversed)?"right-to-left":"left-to-right";case"vertical":return n.some(e=>e.reversed)?"bottom-to-top":"top-to-bottom";case"centric":case"radial":return"left-to-right";default:return}}),hb=e=>e.options.defaultTooltipEventType,pb=e=>e.options.validateTooltipEventTypes;function yb(e,t,n){if(null==e)return t;var r=e?"axis":"item";return null==n?t:n.includes(r)?r:t}function vb(e,t){return yb(t,hb(e),pb(e))}var gb=(e,t)=>{var n,r=Number(t);if(!nt(r)&&null!=t)return r>=0?null==e||null===(n=e[r])||void 0===n?void 0:n.value:void 0},mb={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},bb=za({name:"tooltip",initialState:{itemInteraction:{click:mb,hover:mb},axisInteraction:{click:mb,hover:mb},keyboardInteraction:mb,syncInteraction:{active:!1,index:null,dataKey:void 0,label:void 0,coordinate:void 0,sourceViewBox:void 0,graphicalItemId:void 0},tooltipItemPayloads:[],settings:{shared:void 0,trigger:"hover",axisId:0,active:!1,defaultIndex:void 0}},reducers:{addTooltipEntrySettings:{reducer(e,t){e.tooltipItemPayloads.push(t.payload)},prepare:Sa()},replaceTooltipEntrySettings:{reducer(e,t){var{prev:n,next:r}=t.payload,i=ya(e).tooltipItemPayloads.indexOf(n);i>-1&&(e.tooltipItemPayloads[i]=r)},prepare:Sa()},removeTooltipEntrySettings:{reducer(e,t){var n=ya(e).tooltipItemPayloads.indexOf(t.payload);n>-1&&e.tooltipItemPayloads.splice(n,1)},prepare:Sa()},setTooltipSettingsState(e,t){e.settings=t.payload},setActiveMouseOverItemIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.itemInteraction.hover.active=!0,e.itemInteraction.hover.index=t.payload.activeIndex,e.itemInteraction.hover.dataKey=t.payload.activeDataKey,e.itemInteraction.hover.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.hover.coordinate=t.payload.activeCoordinate},mouseLeaveChart(e){e.itemInteraction.hover.active=!1,e.axisInteraction.hover.active=!1},mouseLeaveItem(e){e.itemInteraction.hover.active=!1},setActiveClickItemIndex(e,t){e.syncInteraction.active=!1,e.itemInteraction.click.active=!0,e.keyboardInteraction.active=!1,e.itemInteraction.click.index=t.payload.activeIndex,e.itemInteraction.click.dataKey=t.payload.activeDataKey,e.itemInteraction.click.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.click.coordinate=t.payload.activeCoordinate},setMouseOverAxisIndex(e,t){e.syncInteraction.active=!1,e.axisInteraction.hover.active=!0,e.keyboardInteraction.active=!1,e.axisInteraction.hover.index=t.payload.activeIndex,e.axisInteraction.hover.dataKey=t.payload.activeDataKey,e.axisInteraction.hover.coordinate=t.payload.activeCoordinate},setMouseClickAxisIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.axisInteraction.click.active=!0,e.axisInteraction.click.index=t.payload.activeIndex,e.axisInteraction.click.dataKey=t.payload.activeDataKey,e.axisInteraction.click.coordinate=t.payload.activeCoordinate},setSyncInteraction(e,t){e.syncInteraction=t.payload},setKeyboardInteraction(e,t){e.keyboardInteraction.active=t.payload.active,e.keyboardInteraction.index=t.payload.activeIndex,e.keyboardInteraction.coordinate=t.payload.activeCoordinate,e.keyboardInteraction.dataKey=t.payload.activeDataKey}}}),{addTooltipEntrySettings:wb,replaceTooltipEntrySettings:xb,removeTooltipEntrySettings:Ob,setTooltipSettingsState:_b,setActiveMouseOverItemIndex:Pb,mouseLeaveItem:Ab,mouseLeaveChart:Eb,setActiveClickItemIndex:Sb,setMouseOverAxisIndex:jb,setMouseClickAxisIndex:kb,setSyncInteraction:Mb,setKeyboardInteraction:Cb}=bb.actions,Tb=bb.reducer;function Ib(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Db(e){for(var t=1;t{if(null==t)return mb;var i=function(e,t,n){return"axis"===t?"click"===n?e.axisInteraction.click:e.axisInteraction.hover:"click"===n?e.itemInteraction.click:e.itemInteraction.hover}(e,t,n);if(null==i)return mb;if(i.active)return i;if(e.keyboardInteraction.active)return e.keyboardInteraction;if(e.syncInteraction.active&&null!=e.syncInteraction.index)return e.syncInteraction;var a=!0===e.settings.active;if(null!=i.index){if(a)return Db(Db({},i),{},{active:!0})}else if(null!=r)return{active:!0,coordinate:void 0,dataKey:void 0,index:r,graphicalItemId:void 0};return Db(Db({},mb),{},{coordinate:i.coordinate})};var Lb=(e,t,n,r)=>{var i=null==e?void 0:e.index;if(null==i)return null;var a=Number(i);if(!xc(a))return i;var o=1/0;t.length>0&&(o=t.length-1);var c=Math.max(0,Math.min(a,o)),l=t[c];return null==l||function(e,t,n){if(null==n||null==t)return!0;var r=Eo(e,t);return null==r||!Fy(n)||function(e,t){var n=function(e){if("number"==typeof e)return Number.isFinite(e)?e:void 0;if(e instanceof Date){var t=e.valueOf();return Number.isFinite(t)?t:void 0}var n=Number(e);return Number.isFinite(n)?n:void 0}(e),r=t[0],i=t[1];if(void 0===n)return!1;var a=Math.min(r,i),o=Math.max(r,i);return n>=a&&n<=o}(r,n)}(l,n,r)?String(c):null},Rb=(e,t,n,r,i,a,o,c)=>{if(null!=a&&null!=c){var l=o[0],u=null==l?void 0:c(l.positions,a);if(null!=u)return u;var s=null==i?void 0:i[Number(a)];if(s)return"horizontal"===n?{x:s.coordinate,y:(r.top+t)/2}:{x:(r.left+e)/2,y:s.coordinate}}},Bb=(e,t,n,r)=>{return"axis"===t?e.tooltipItemPayloads:0===e.tooltipItemPayloads.length?[]:null==(i="hover"===n?e.itemInteraction.hover.dataKey:e.itemInteraction.click.dataKey)&&null!=r?[e.tooltipItemPayloads[0]]:e.tooltipItemPayloads.filter(e=>{var t;return(null===(t=e.settings)||void 0===t?void 0:t.dataKey)===i});var i},Kb=e=>e.options.tooltipPayloadSearcher,Fb=e=>e.tooltip;function Ub(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Wb(e){for(var t=1;t{if(null!=t&&null!=a){var{chartData:c,computedData:l,dataStartIndex:u,dataEndIndex:s}=n;return e.reduce((e,n)=>{var f,d,h,{dataDefinedOnItem:p,settings:y}=n,v=function(e,t){return null!=e?e:t}(p,c),g=Array.isArray(v)?Oo(v,u,s):v,m=null!==(f=null==y?void 0:y.dataKey)&&void 0!==f?f:r,b=null==y?void 0:y.nameKey;return d=r&&Array.isArray(g)&&!Array.isArray(g[0])&&"axis"===o?ft(g,r,i):a(g,t,l,b),Array.isArray(d)?d.forEach(t=>{var n=Wb(Wb({},y),{},{name:t.name,unit:t.unit,color:void 0,fill:void 0});e.push(Lo({tooltipEntrySettings:n,dataKey:t.dataKey,payload:t.payload,value:Eo(t.payload,t.dataKey),name:t.name}))}):e.push(Lo({tooltipEntrySettings:y,dataKey:m,payload:d,value:Eo(d,m),name:null!==(h=Eo(d,b))&&void 0!==h?h:null==y?void 0:y.name})),e},[])}},Vb=jr([Yg,Rc,kg,Nv,hg],km),qb=jr([e=>e.graphicalItems.cartesianItems,e=>e.graphicalItems.polarItems],(e,t)=>[...e,...t]),Yb=jr([hg,pg],Mg),Xb=jr([qb,Yg,Yb],Ig,{memoizeOptions:{resultEqualityCheck:dg}}),Gb=jr([Xb],e=>e.filter(sg)),Zb=jr([Xb],Rg,{memoizeOptions:{resultEqualityCheck:dg}}),Qb=jr([Zb,Ry],Kg),Jb=jr([Gb,Ry,Yg],ug),ew=jr([Qb,Yg,Xb],Ug),tw=jr([Yg],tm),nw=jr([Yg],e=>e.allowDataOverflow),rw=jr([tw,nw],Wy),iw=jr([Xb],e=>e.filter(sg)),aw=jr([Jb,iw,Iv,Dv],Zg),ow=jr([aw,Ry,hg,rw],Jg),cw=jr([Xb],zg),lw=jr([Qb,Yg,cw,am,hg],cm,{memoizeOptions:{resultEqualityCheck:fg}}),uw=jr([sm,hg,pg],fm),sw=jr([uw,hg],gm),fw=jr([hm,hg,pg],fm),dw=jr([fw,hg],bm),hw=jr([ym,hg,pg],fm),pw=jr([hw,hg],xm),yw=jr([sw,pw,dw],om),vw=jr([Yg,tw,rw,ow,lw,yw,Rc,hg],Pm),gw=jr([Yg,Rc,Qb,ew,Iv,hg,vw],Sm),mw=jr([gw,Yg,Vb],Tm),bw=jr([Yg,gw,mw,hg],Dm),ww=e=>{var t=hg(e),n=pg(e);return Um(e,t,n,!1)},xw=jr([Yg,ww],Vv),Ow=jr([Yg,Vb,bw,xw],Cm),_w=jr([Rc,ew,Yg,hg],rb),Pw=jr([Rc,ew,Yg,hg],ab),Aw=jr([Rc,Yg,Vb,Ow,ww,_w,Pw,hg],(e,t,n,r,i,a,o,c)=>{if(t){var{type:l}=t,u=So(e,c);if(r){var s="scaleBand"===n&&r.bandwidth?r.bandwidth()/2:2,f="category"===l&&r.bandwidth?r.bandwidth()/s:0;return f="angleAxis"===c&&null!=i&&(null==i?void 0:i.length)>=2?2*tt(i[0]-i[1])*f:f,u&&o?o.map((e,t)=>({coordinate:r(e)+f,value:e,index:t,offset:f})):r.domain().map((e,t)=>({coordinate:r(e)+f,value:a?a[e]:e,index:t,offset:f}))}}}),Ew=jr([hb,pb,e=>e.tooltip.settings],(e,t,n)=>yb(n.shared,e,t)),Sw=e=>e.tooltip.settings.trigger,jw=e=>e.tooltip.settings.defaultIndex,kw=jr([Fb,Ew,Sw,jw],zb),Mw=jr([kw,Qb,Xg,gw],Lb),Cw=jr([Aw,Mw],gb),Tw=jr([kw],e=>{if(e)return e.dataKey});jr([kw],e=>{if(e)return e.graphicalItemId});var Iw=jr([Fb,Ew,Sw,jw],Bb),Dw=jr([Bo,Ko,Rc,ec,Aw,jw,Iw,Kb],Rb),Nw=jr([kw,Dw],(e,t)=>null!=e&&e.coordinate?e.coordinate:t),zw=jr([kw],e=>e.active),Lw=jr([Iw,Mw,Ry,Xg,Cw,Kb,Ew],Hb),Rw=jr([Lw],e=>{if(null!=e){var t=e.map(e=>e.payload).filter(e=>null!=e);return Array.from(new Set(t))}});function Bw(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Kw(e){for(var t=1;t{var a,o=-1,c=null!==(a=null==t?void 0:t.length)&&void 0!==a?a:0;if(c<=1||null==e)return 0;if("angleAxis"===r&&null!=i&&Math.abs(Math.abs(i[1]-i[0])-360)<=1e-6)for(var l=0;l0?n[l-1].coordinate:n[c-1].coordinate,s=n[l].coordinate,f=l>=c-1?n[0].coordinate:n[l+1].coordinate,d=void 0;if(tt(s-u)!==tt(f-s)){var h=[];if(tt(f-s)===tt(i[1]-i[0])){d=f;var p=s+i[1]-i[0];h[0]=Math.min(p,(p+u)/2),h[1]=Math.max(p,(p+u)/2)}else{d=u;var y=f+i[1]-i[0];h[0]=Math.min(s,(y+s)/2),h[1]=Math.max(s,(y+s)/2)}var v=[Math.min(s,(d+s)/2),Math.max(s,(d+s)/2)];if(e>v[0]&&e<=v[1]||e>=h[0]&&e<=h[1]){({index:o}=n[l]);break}}else{var g=Math.min(u,f),m=Math.max(u,f);if(e>(g+s)/2&&e<=(m+s)/2){({index:o}=n[l]);break}}}else if(t)for(var b=0;b0&&b(t[b].coordinate+t[b-1].coordinate)/2&&e<=(t[b].coordinate+t[b+1].coordinate)/2||b===c-1&&e>(t[b].coordinate+t[b-1].coordinate)/2){({index:o}=t[b]);break}return o},Vw=()=>xr(Nv),qw=(e,t)=>t,Yw=(e,t,n)=>n,Xw=(e,t,n,r)=>r,Gw=jr(Aw,e=>Qr(e,e=>e.coordinate)),Zw=jr([Fb,qw,Yw,Xw],zb),Qw=jr([Zw,Qb,Xg,gw],Lb),Jw=jr([Fb,qw,Yw,Xw],Bb),ex=jr([Bo,Ko,Rc,ec,Aw,Xw,Jw,Kb],Rb),tx=jr([Zw,ex],(e,t)=>{var n;return null!==(n=e.coordinate)&&void 0!==n?n:t}),nx=jr([Aw,Qw],gb),rx=jr([Jw,Qw,Ry,Xg,nx,Kb,qw],Hb),ix=jr([Zw,Qw],(e,t)=>({isActive:e.active&&null!=t,activeIndex:t})),ax=jr(e=>e.zIndex.zIndexMap,(e,t)=>t,(e,t,n)=>n,(e,t,n)=>{if(null!=t){var r=e[t];if(null!=r)return n?r.panoramaElementId:r.elementId}}),ox=jr(e=>e.zIndex.zIndexMap,e=>{var t=Object.keys(e).map(e=>parseInt(e,10)).concat(Object.values(Bv));return Array.from(new Set(t)).sort((e,t)=>e-t)},{memoizeOptions:{resultEqualityCheck:function(e,t){if(e.length===t.length){for(var n=0;nlx(lx({},e),{},{[t]:{elementId:void 0,panoramaElementId:void 0,consumers:0}}),{})},fx=new Set(Object.values(Bv)),dx=za({name:"zIndex",initialState:sx,reducers:{registerZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]?e.zIndexMap[n].consumers+=1:e.zIndexMap[n]={consumers:1,elementId:void 0,panoramaElementId:void 0}},prepare:Sa()},unregisterZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(e.zIndexMap[n].consumers-=1,e.zIndexMap[n].consumers<=0&&!function(e){return fx.has(e)}(n)&&delete e.zIndexMap[n])},prepare:Sa()},registerZIndexPortalId:{reducer:(e,t)=>{var{zIndex:n,elementId:r,isPanorama:i}=t.payload;e.zIndexMap[n]?i?e.zIndexMap[n].panoramaElementId=r:e.zIndexMap[n].elementId=r:e.zIndexMap[n]={consumers:0,elementId:i?void 0:r,panoramaElementId:i?r:void 0}},prepare:Sa()},unregisterZIndexPortalId:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(t.payload.isPanorama?e.zIndexMap[n].panoramaElementId=void 0:e.zIndexMap[n].elementId=void 0)},prepare:Sa()}}}),{registerZIndexPortal:hx,unregisterZIndexPortal:px,registerZIndexPortalId:yx,unregisterZIndexPortalId:vx}=dx.actions,gx=dx.reducer;function mx(e){var{zIndex:t,children:n}=e,a=void 0!==Bc()&&void 0!==t&&0!==t,o=ic(),c=gr();r.useLayoutEffect(()=>a?(c(hx({zIndex:t})),()=>{c(px({zIndex:t}))}):yt,[c,t,a]);var l=xr(e=>ax(e,t,o));if(!a)return n;if(!l)return null;var u=document.getElementById(l);return u?i.createPortal(n,u):null}function bx(){return bx=Object.assign?Object.assign.bind():function(e){for(var t=1;t{null==e.eventEmitter&&(e.eventEmitter=Symbol("rechartsEventEmitter"))}}}),Nx=Dx.reducer,{createEventEmitter:zx}=Dx.actions;function Lx(e){return e.tooltip.syncInteraction}var Rx=za({name:"chartData",initialState:{chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},reducers:{setChartData(e,t){if(e.chartData=t.payload,null==t.payload)return e.dataStartIndex=0,void(e.dataEndIndex=0);t.payload.length>0&&e.dataEndIndex!==t.payload.length-1&&(e.dataEndIndex=t.payload.length-1)},setComputedData(e,t){e.computedData=t.payload},setDataStartEndIndexes(e,t){var{startIndex:n,endIndex:r}=t.payload;null!=n&&(e.dataStartIndex=n),null!=r&&(e.dataEndIndex=r)}}}),{setChartData:Bx,setDataStartEndIndexes:Kx,setComputedData:Fx}=Rx.actions,Ux=Rx.reducer,Wx=["x","y"];function $x(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Hx(e){for(var t=1;t{e(zx())},[e]),function(){var e=xr(zv),t=xr(Rv),n=gr(),i=xr(Lv),a=xr(Aw),o=Bc(),c=Ic(),l=xr(e=>e.rootProps.className);r.useEffect(()=>{if(null==e)return yt;var r=(r,l,u)=>{var s;if(t!==u&&e===r)if("index"!==i){if(null!=a){var f;if("function"==typeof i){var d={activeTooltipIndex:null==l.payload.index?void 0:Number(l.payload.index),isTooltipActive:l.payload.active,activeIndex:null==l.payload.index?void 0:Number(l.payload.index),activeLabel:l.payload.label,activeDataKey:l.payload.dataKey,activeCoordinate:l.payload.coordinate},h=i(a,d);f=a[h]}else"value"===i&&(f=a.find(e=>String(e.value)===l.payload.label));var{coordinate:p}=l.payload;if(null!=f&&!1!==l.payload.active&&null!=p&&null!=c){var{x:y,y:v}=p,g=Math.min(y,c.x+c.width),m=Math.min(v,c.y+c.height),b={x:"horizontal"===o?f.coordinate:g,y:"horizontal"===o?m:f.coordinate},w=Mb({active:l.payload.active,coordinate:b,dataKey:l.payload.dataKey,index:String(f.index),label:l.payload.label,sourceViewBox:l.payload.sourceViewBox,graphicalItemId:l.payload.graphicalItemId});n(w)}else n(Mb({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}))}}else if(c&&null!=l&&null!==(s=l.payload)&&void 0!==s&&s.coordinate&&l.payload.sourceViewBox){var x=l.payload.coordinate,{x:O,y:_}=x,P=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{Mx.off(Cx,r)}},[l,n,t,e,i,a,o,c])}(),function(){var e=xr(zv),t=xr(Rv),n=gr();r.useEffect(()=>{if(null==e)return yt;var r=(r,i,a)=>{t!==a&&e===r&&n(Kx(i))};return Mx.on(Tx,r),()=>{Mx.off(Tx,r)}},[n,t,e])}()}function Yx(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Xx(e){for(var t=1;t{A(_b({shared:w,trigger:x,axisId:P,active:o,defaultIndex:E}))},[A,w,x,P,o,E]);var S=Ic(),j=Zl(),k=function(e){return xr(t=>vb(t,e))}(w),{activeIndex:M,isActive:C}=null!==(t=xr(e=>ix(e,k,x,E)))&&void 0!==t?t:{},T=xr(e=>rx(e,k,x,E)),I=xr(e=>nx(e,k,x,E)),D=xr(e=>tx(e,k,x,E)),N=T,z=r.useContext(Sx),L=null!==(n=null!=o?o:C)&&void 0!==n&&n,[R,B]=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],[t,n]=r.useState({height:0,left:0,top:0,width:0}),i=r.useCallback(e=>{if(null!=e){var r=e.getBoundingClientRect(),i={height:r.height,left:r.left,top:r.top,width:r.width};(Math.abs(i.height-t.height)>1||Math.abs(i.left-t.left)>1||Math.abs(i.top-t.top)>1||Math.abs(i.width-t.width)>1)&&n({height:i.height,left:i.left,top:i.top,width:i.width})}},[t.width,t.height,t.top,t.left,...e]);return[t,i]}([N,L]),K="axis"===k?I:void 0;!function(e,t,n,i,a,o){var c=xr(n=>((e,t,n)=>{if(null!=t){var r=Fb(e);return"axis"===t?"hover"===n?r.axisInteraction.hover.dataKey:r.axisInteraction.click.dataKey:"hover"===n?r.itemInteraction.hover.dataKey:r.itemInteraction.click.dataKey}})(n,e,t)),l=xr(Rv),u=xr(zv),s=xr(Lv),f=xr(Lx),d=null==f?void 0:f.active,h=Ic();r.useEffect(()=>{if(!d&&null!=u&&null!=l){var e=Mb({active:o,coordinate:n,dataKey:c,index:a,label:"number"==typeof i?String(i):i,sourceViewBox:h,graphicalItemId:void 0});Mx.emit(Cx,u,e,l)}},[d,n,c,a,i,l,u,s,o,h])}(k,x,D,K,M,L);var F=null!=_?_:z;if(null==F||null==S||null==k)return null;var U=null!=N?N:Qx;L||(U=Qx),f&&U.length&&(U=function(e,t){return!0===t?ar(e,Zx):"function"==typeof t?ar(e,t):e}(U.filter(e=>null!=e.value&&(!0!==e.hide||a.includeHidden)),p));var W=U.length>0,$=r.createElement(Gl,{allowEscapeViewBox:c,animationDuration:l,animationEasing:u,isAnimationActive:d,active:L,coordinate:D,hasPayload:W,offset:h,position:y,reverseDirection:v,useTranslate3d:g,viewBox:S,wrapperStyle:m,lastBoundingBox:R,innerRef:B,hasPortalFromProps:Boolean(_)},function(e,t){return r.isValidElement(e)?r.cloneElement(e,t):"function"==typeof e?r.createElement(e,t):r.createElement(Ul,t)}(s,Xx(Xx({},a),{},{payload:U,label:K,active:L,activeIndex:M,coordinate:D,accessibilityLayer:j})));return r.createElement(r.Fragment,null,i.createPortal($,F),L&&r.createElement(Ax,{cursor:b,tooltipEventType:k,coordinate:D,payload:U,index:M}))}function tO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function nO(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var rO=function(e){for(var t=1;t=this.maxSize){var n=this.cache.keys().next().value;null!=n&&this.cache.delete(n)}this.cache.set(e,t)}clear(){this.cache.clear()}size(){return this.cache.size}}(rO.cacheSize),aO={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},oO="recharts_measurement_span",cO=(e,t)=>{try{var n=document.getElementById(oO);n||((n=document.createElement("span")).setAttribute("id",oO),n.setAttribute("aria-hidden","true"),document.body.appendChild(n)),Object.assign(n.style,aO,t),n.textContent="".concat(e);var r=n.getBoundingClientRect();return{width:r.width,height:r.height}}catch(i){return{width:0,height:0}}},lO=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null==e||Nu)return{width:0,height:0};if(!rO.enableCache)return cO(e,t);var n=function(e,t){var n=t.fontSize||"",r=t.fontFamily||"",i=t.fontWeight||"",a=t.fontStyle||"",o=t.letterSpacing||"",c=t.textTransform||"";return"".concat(e,"|").concat(n,"|").concat(r,"|").concat(i,"|").concat(a,"|").concat(o,"|").concat(c)}(e,t),r=iO.get(n);if(r)return r;var i=cO(e,t);return iO.set(n,i),i},uO=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,sO=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,fO=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,dO=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,hO={cm:96/2.54,mm:96/25.4,pt:96/72,pc:16,in:96,Q:96/101.6,px:1},pO=Object.keys(hO),yO="NaN";class vO{static parse(e){var t,[,n,r]=null!==(t=dO.exec(e))&&void 0!==t?t:[];return new vO(parseFloat(n),null!=r?r:"")}constructor(e,t){this.num=e,this.unit=t,this.num=e,this.unit=t,nt(e)&&(this.unit=""),""===t||fO.test(t)||(this.num=NaN,this.unit=""),pO.includes(t)&&(this.num=function(e,t){return e*hO[t]}(e,t),this.unit="px")}add(e){return this.unit!==e.unit?new vO(NaN,""):new vO(this.num+e.num,this.unit)}subtract(e){return this.unit!==e.unit?new vO(NaN,""):new vO(this.num-e.num,this.unit)}multiply(e){return""!==this.unit&&""!==e.unit&&this.unit!==e.unit?new vO(NaN,""):new vO(this.num*e.num,this.unit||e.unit)}divide(e){return""!==this.unit&&""!==e.unit&&this.unit!==e.unit?new vO(NaN,""):new vO(this.num/e.num,this.unit||e.unit)}toString(){return"".concat(this.num).concat(this.unit)}isNaN(){return nt(this.num)}}function gO(e){if(e.includes(yO))return yO;for(var t=e;t.includes("*")||t.includes("/");){var n,[,r,i,a]=null!==(n=uO.exec(t))&&void 0!==n?n:[],o=vO.parse(null!=r?r:""),c=vO.parse(null!=a?a:""),l="*"===i?o.multiply(c):o.divide(c);if(l.isNaN())return yO;t=t.replace(uO,l.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var u,[,s,f,d]=null!==(u=sO.exec(t))&&void 0!==u?u:[],h=vO.parse(null!=s?s:""),p=vO.parse(null!=d?d:""),y="+"===f?h.add(p):h.subtract(p);if(y.isNaN())return yO;t=t.replace(sO,y.toString())}return t}var mO=/\(([^()]*)\)/;function bO(e){var t=function(e){try{return function(e){var t=e.replace(/\s+/g,"");return t=function(e){for(var t,n=e;null!=(t=mO.exec(n));){var[,r]=t;n=n.replace(mO,gO(r))}return n}(t),gO(t)}(e)}catch(t){return yO}}(e.slice(5,-1));return t===yO?"":t}var wO=["x","y","lineHeight","capHeight","fill","scaleToFit","textAnchor","verticalAnchor"],xO=["dx","dy","angle","className","breakAll"];function OO(){return OO=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{children:t,breakAll:n,style:r}=e;try{var i=[];return dt(t)||(i=n?t.toString().split(""):t.toString().split(PO)),{wordsWithComputedWidth:i.map(e=>({word:e,width:lO(e,r).width})),spaceWidth:n?0:lO(" ",r).width}}catch(a){return null}};function EO(e){return"start"===e||"middle"===e||"end"===e||"inherit"===e}var SO=(e,t,n,r)=>e.reduce((e,i)=>{var{word:a,width:o}=i,c=e[e.length-1];if(c&&null!=o&&(null==t||r||c.width+o+ne.reduce((e,t)=>e.width>t.width?e:t),kO=(e,t,n,r,i,a,o,c)=>{var l=e.slice(0,t),u=AO({breakAll:n,style:r,children:l+"…"});if(!u)return[!1,[]];var s=SO(u.wordsWithComputedWidth,a,o,c);return[s.length>i||jO(s).width>Number(a),s]},MO=e=>[{words:dt(e)?[]:e.toString().split(PO),width:void 0}],CO="#808080",TO={angle:0,breakAll:!1,capHeight:"0.71em",fill:CO,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},IO=r.forwardRef((e,t)=>{var n=jt(e,TO),{x:i,y:a,lineHeight:o,capHeight:c,fill:u,scaleToFit:s,textAnchor:f,verticalAnchor:d}=n,h=_O(n,wO),p=r.useMemo(()=>(e=>{var{width:t,scaleToFit:n,children:r,style:i,breakAll:a,maxLines:o}=e;if((t||n)&&!Nu){var c=AO({breakAll:a,children:r,style:i});if(!c)return MO(r);var{wordsWithComputedWidth:l,spaceWidth:u}=c;return((e,t,n,r,i)=>{var{maxLines:a,children:o,style:c,breakAll:l}=e,u=it(a),s=String(o),f=SO(t,r,n,i);if(!u||i)return f;if(!(f.length>a||jO(f).width>Number(r)))return f;for(var d,h=0,p=s.length-1,y=0;h<=p&&y<=s.length-1;){var v=Math.floor((h+p)/2),g=v-1,[m,b]=kO(s,g,l,c,a,r,n,i),[w]=kO(s,v,l,c,a,r,n,i);if(m||w||(h=v+1),m&&w&&(p=v-1),!m&&w){d=b;break}y++}return d||f})({breakAll:a,children:r,maxLines:o,style:i},l,u,t,Boolean(n))}return MO(r)})({breakAll:h.breakAll,children:h.children,maxLines:h.maxLines,scaleToFit:s,style:h.style,width:h.width}),[h.breakAll,h.children,h.maxLines,s,h.style,h.width]),{dx:y,dy:v,angle:g,className:m,breakAll:b}=h,w=_O(h,xO);if(!at(i)||!at(a)||0===p.length)return null;var O,_=Number(i)+(it(y)?y:0),P=Number(a)+(it(v)?v:0);if(!xc(_)||!xc(P))return null;switch(d){case"start":O=bO("calc(".concat(c,")"));break;case"middle":O=bO("calc(".concat((p.length-1)/2," * -").concat(o," + (").concat(c," / 2))"));break;default:O=bO("calc(".concat(p.length-1," * -").concat(o,")"))}var A=[];if(s){var E=p[0].width,{width:S}=h;A.push("scale(".concat(it(S)&&it(E)?S/E:1,")"))}return g&&A.push("rotate(".concat(g,", ").concat(_,", ").concat(P,")")),A.length&&(w.transform=A.join(" ")),r.createElement("text",OO({},x(w),{ref:t,x:_,y:P,className:l("recharts-text",m),textAnchor:f,fill:u.includes("url")?CO:u}),p.map((e,t)=>{var n=e.words.join(b?"":" ");return r.createElement("tspan",{x:_,dy:0===t?O:o,key:"".concat(n,"-").concat(t)},n)}))});IO.displayName="Text";var DO=["labelRef"];function NO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function zO(e){for(var t=1;t{var{x:t,y:n,upperWidth:i,lowerWidth:a,width:o,height:c,children:l}=e,u=r.useMemo(()=>({x:t,y:n,upperWidth:i,lowerWidth:a,width:o,height:c}),[t,n,i,a,o,c]);return r.createElement(BO.Provider,{value:u},l)},FO=()=>{var e=r.useContext(BO),t=Ic();return e||Tc(t)},UO=r.createContext(null),WO=e=>null!=e&&"function"==typeof e,$O=e=>"cx"in e&&it(e.cx),HO={angle:0,offset:5,zIndex:Bv.label,position:"middle",textBreakAll:!1};function VO(e){var t,n,i,a,o,c=jt(e,HO),{viewBox:u,position:s,value:f,children:d,content:h,className:p="",textBreakAll:y,labelRef:v}=c,g=(t=r.useContext(UO),n=xr(ag),t||n),m=FO();if(!(i=null==u?"center"===s?m:null!=g?g:m:$O(u)?u:Tc(u))||dt(f)&&dt(d)&&!r.isValidElement(h)&&"function"!=typeof h)return null;var b=zO(zO({},c),{},{viewBox:i});if(r.isValidElement(h)){var{labelRef:w}=b,O=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{var{value:t,formatter:n}=e,r=dt(e.children)?t:e.children;return"function"==typeof n?n(r):r})(c);var _=x(c);if($O(i)){if("insideStart"===s||"insideEnd"===s||"end"===s)return((e,t,n,i,a)=>{var o,c,{offset:u,className:s}=e,{cx:f,cy:d,innerRadius:h,outerRadius:p,startAngle:y,endAngle:v,clockWise:g}=a,m=(h+p)/2,b=((e,t)=>tt(t-e)*Math.min(Math.abs(t-e),360))(y,v),w=b>=0?1:-1;switch(t){case"insideStart":o=y+w*u,c=g;break;case"insideEnd":o=v-w*u,c=!g;break;case"end":o=v+w*u,c=g;break;default:throw new Error("Unsupported position ".concat(t))}c=b<=0?c:!c;var x=ns(f,d,m,o),O=ns(f,d,m,o+359*(c?1:-1)),_="M".concat(x.x,",").concat(x.y,"\n A").concat(m,",").concat(m,",0,1,").concat(c?0:1,",\n ").concat(O.x,",").concat(O.y),P=dt(e.id)?ct("recharts-radial-line-"):e.id;return r.createElement("text",RO({},i,{dominantBaseline:"central",className:l("recharts-radial-bar-label",s)}),r.createElement("defs",null,r.createElement("path",{id:P,d:_})),r.createElement("textPath",{xlinkHref:"#".concat(P)},n))})(c,s,a,_,i);o=((e,t,n)=>{var{cx:r,cy:i,innerRadius:a,outerRadius:o,startAngle:c,endAngle:l}=e,u=(c+l)/2;if("outside"===n){var{x:s,y:f}=ns(r,i,o+t,u);return{x:s,y:f,textAnchor:s>=r?"start":"end",verticalAnchor:"middle"}}if("center"===n)return{x:r,y:i,textAnchor:"middle",verticalAnchor:"middle"};if("centerTop"===n)return{x:r,y:i,textAnchor:"middle",verticalAnchor:"start"};if("centerBottom"===n)return{x:r,y:i,textAnchor:"middle",verticalAnchor:"end"};var d=(a+o)/2,{x:h,y:p}=ns(r,i,d,u);return{x:h,y:p,textAnchor:"middle",verticalAnchor:"middle"}})(i,c.offset,c.position)}else o=((e,t)=>{var n,{parentViewBox:r,offset:i,position:a}=e;null==r||$O(r)||(n=r);var{x:o,y:c,upperWidth:l,lowerWidth:u,height:s}=t,f=o,d=o+(l-u)/2,h=(f+d)/2,p=(l+u)/2,y=f+l/2,v=s>=0?1:-1,g=v*i,m=v>0?"end":"start",b=v>0?"start":"end",w=l>=0?1:-1,x=w*i,O=w>0?"end":"start",_=w>0?"start":"end";if("top"===a)return zO(zO({},{x:f+l/2,y:c-g,textAnchor:"middle",verticalAnchor:m}),n?{height:Math.max(c-n.y,0),width:l}:{});if("bottom"===a)return zO(zO({},{x:d+u/2,y:c+s+g,textAnchor:"middle",verticalAnchor:b}),n?{height:Math.max(n.y+n.height-(c+s),0),width:u}:{});if("left"===a){var P={x:h-x,y:c+s/2,textAnchor:O,verticalAnchor:"middle"};return zO(zO({},P),n?{width:Math.max(P.x-n.x,0),height:s}:{})}if("right"===a){var A={x:h+p+x,y:c+s/2,textAnchor:_,verticalAnchor:"middle"};return zO(zO({},A),n?{width:Math.max(n.x+n.width-A.x,0),height:s}:{})}var E=n?{width:p,height:s}:{};return"insideLeft"===a?zO({x:h+x,y:c+s/2,textAnchor:_,verticalAnchor:"middle"},E):"insideRight"===a?zO({x:h+p-x,y:c+s/2,textAnchor:O,verticalAnchor:"middle"},E):"insideTop"===a?zO({x:f+l/2,y:c+g,textAnchor:"middle",verticalAnchor:b},E):"insideBottom"===a?zO({x:d+u/2,y:c+s-g,textAnchor:"middle",verticalAnchor:m},E):"insideTopLeft"===a?zO({x:f+x,y:c+g,textAnchor:_,verticalAnchor:b},E):"insideTopRight"===a?zO({x:f+l-x,y:c+g,textAnchor:O,verticalAnchor:b},E):"insideBottomLeft"===a?zO({x:d+x,y:c+s-g,textAnchor:_,verticalAnchor:m},E):"insideBottomRight"===a?zO({x:d+u-x,y:c+s-g,textAnchor:O,verticalAnchor:m},E):a&&"object"==typeof a&&(it(a.x)||rt(a.x))&&(it(a.y)||rt(a.y))?zO({x:o+lt(a.x,p),y:c+lt(a.y,s),textAnchor:"end",verticalAnchor:"end"},E):zO({x:y,y:c+s/2,textAnchor:"middle",verticalAnchor:"middle"},E)})(c,i);return r.createElement(mx,{zIndex:c.zIndex},r.createElement(IO,RO({ref:v,className:l("recharts-label",p)},_,o,{textAnchor:EO(_.textAnchor)?_.textAnchor:o.textAnchor,breakAll:y}),a))}function qO(e){var{label:t,labelRef:n}=e;return((e,t,n)=>{if(!e)return null;var i={viewBox:t,labelRef:n};return!0===e?r.createElement(VO,RO({key:"label-implicit"},i)):at(e)?r.createElement(VO,RO({key:"label-implicit",value:e},i)):r.isValidElement(e)?e.type===VO?r.cloneElement(e,zO({key:"label-implicit"},i)):r.createElement(VO,RO({key:"label-implicit",content:e},i)):WO(e)?r.createElement(VO,RO({key:"label-implicit",content:e},i)):e&&"object"==typeof e?r.createElement(VO,RO({},e,{key:"label-implicit"},i)):null})(t,FO(),n)||null}VO.displayName="Label";var YO,XO={},GO={};function ZO(){return YO||(YO=1,e=GO,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e.last=function(e){return e[e.length-1]}),GO;var e}var QO,JO,e_,t_,n_={};function r_(){return QO||(QO=1,e=n_,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e.toArray=function(e){return Array.isArray(e)?e:Array.from(e)}),n_;var e}function i_(){return t_?e_:(t_=1,e_=(JO||(JO=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=ZO(),n=r_(),r=Ut();e.last=function(e){if(r.isArrayLike(e))return t.last(n.toArray(e))}}(XO)),XO).last)}const a_=o(i_());var o_=["valueAccessor"],c_=["dataKey","clockWise","id","textBreakAll","zIndex"];function l_(){return l_=Object.assign?Object.assign.bind():function(e){for(var t=1;tArray.isArray(e.value)?a_(e.value):e.value,f_=r.createContext(void 0),d_=f_.Provider,h_=r.createContext(void 0);function p_(e){var{valueAccessor:t=s_}=e,n=u_(e,o_),{dataKey:i,clockWise:a,id:o,textBreakAll:c,zIndex:l}=n,u=u_(n,c_),s=r.useContext(f_),f=r.useContext(h_),d=s||f;return d&&d.length?r.createElement(mx,{zIndex:null!=l?l:Bv.label},r.createElement(S,{className:"recharts-label-list"},d.map((e,a)=>{var l,s=dt(i)?t(e,a):Eo(e&&e.payload,i),f=dt(o)?{}:{id:"".concat(o,"-").concat(a)};return r.createElement(VO,l_({key:"label-".concat(a)},x(e),u,f,{fill:null!==(l=n.fill)&&void 0!==l?l:e.fill,parentViewBox:e.parentViewBox,value:s,textBreakAll:c,viewBox:e.viewBox,index:a,zIndex:0}))}))):null}function y_(e){var{label:t}=e;return t?!0===t?r.createElement(p_,{key:"labelList-implicit"}):r.isValidElement(t)||WO(t)?r.createElement(p_,{key:"labelList-implicit",content:t}):"object"==typeof t?r.createElement(p_,l_({key:"labelList-implicit"},t,{type:String(t.type)})):null:null}h_.Provider,p_.displayName="LabelList";var v_=["points","className","baseLinePoints","connectNulls"];function g_(){return g_=Object.assign?Object.assign.bind():function(e){for(var t=1;te&&e.x===+e.x&&e.y===+e.y,b_=(e,t)=>{var n=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=[[]];return e.forEach(e=>{m_(e)?t[t.length-1].push(e):t[t.length-1].length>0&&t.push([])}),m_(e[0])&&t[t.length-1].push(e[0]),t[t.length-1].length<=0&&(t=t.slice(0,-1)),t}(e);t&&(n=[n.reduce((e,t)=>[...e,...t],[])]);var r=n.map(e=>e.reduce((e,t,n)=>"".concat(e).concat(0===n?"M":"L").concat(t.x,",").concat(t.y),"")).join("");return 1===n.length?"".concat(r,"Z"):r},w_=e=>{var{points:t,className:n,baseLinePoints:i,connectNulls:a}=e,o=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{var r=b_(e,n);return"".concat("Z"===r.slice(-1)?r.slice(0,-1):r,"L").concat(b_(Array.from(t).reverse(),n).slice(1))})(t,i,a);return r.createElement("g",{className:c},r.createElement("path",g_({},x(o),{fill:"Z"===s.slice(-1)?o.fill:"none",stroke:"none",d:s})),u?r.createElement("path",g_({},x(o),{fill:"none",d:b_(t,a)})):null,u?r.createElement("path",g_({},x(o),{fill:"none",d:b_(i,a)})):null)}var f=b_(t,a);return r.createElement("path",g_({},x(o),{fill:"Z"===f.slice(-1)?o.fill:"none",className:c,d:f}))};function x_(){return x_=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{cx:t,cy:n,r:i,className:a}=e,o=l("recharts-dot",a);return it(t)&&it(n)&&it(i)?r.createElement("circle",x_({},b(e),At(e),{className:o,cx:t,cy:n,r:i})):null},E_=za({name:"polarAxis",initialState:{radiusAxis:{},angleAxis:{}},reducers:{addRadiusAxis(e,t){e.radiusAxis[t.payload.id]=t.payload},removeRadiusAxis(e,t){delete e.radiusAxis[t.payload.id]},addAngleAxis(e,t){e.angleAxis[t.payload.id]=t.payload},removeAngleAxis(e,t){delete e.angleAxis[t.payload.id]}}}),{addRadiusAxis:S_,removeRadiusAxis:j_,addAngleAxis:k_,removeAngleAxis:M_}=E_.actions,C_=E_.reducer,T_=e=>!e||"object"!=typeof e||!("clipDot"in e)||Boolean(e.clipDot),I_={};function D_(){return O_||(O_=1,e=I_,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e.isPlainObject=function(e){var t;if("object"!=typeof e)return!1;if(null==e)return!1;if(null===Object.getPrototypeOf(e))return!0;if("[object Object]"!==Object.prototype.toString.call(e)){const n=e[Symbol.toStringTag];return null!=n&&!!(null==(t=Object.getOwnPropertyDescriptor(e,Symbol.toStringTag))?void 0:t.writable)&&e.toString()===`[object ${n}]`}let n=e;for(;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(e)===n}),I_;var e}function N_(){return P_?__:(P_=1,__=D_().isPlainObject)}const z_=o(N_());function L_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function R_(e){for(var t=1;t{var a,o=n-r;return a="M ".concat(e,",").concat(t),a+="L ".concat(e+n,",").concat(t),a+="L ".concat(e+n-o/2,",").concat(t+i),(a+="L ".concat(e+n-o/2-r,",").concat(t+i))+"L ".concat(e,",").concat(t," Z")},W_={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},$_=e=>{var t=jt(e,W_),{x:n,y:i,upperWidth:a,lowerWidth:o,height:c,className:u}=t,{animationEasing:s,animationDuration:f,animationBegin:d,isUpdateAnimationActive:h}=t,p=r.useRef(null),[y,v]=r.useState(-1),g=r.useRef(a),m=r.useRef(o),b=r.useRef(c),w=r.useRef(n),O=r.useRef(i),_=Ku(e,"trapezoid-");if(r.useEffect(()=>{if(p.current&&p.current.getTotalLength)try{var e=p.current.getTotalLength();e&&v(e)}catch(t){}},[]),n!==+n||i!==+i||a!==+a||o!==+o||c!==+c||0===a&&0===o||0===c)return null;var P=l("recharts-trapezoid",u);if(!h)return r.createElement("g",null,r.createElement("path",K_({},x(t),{className:P,d:U_(n,i,a,o,c)})));var A=g.current,E=m.current,S=b.current,j=w.current,k=O.current,M="0px ".concat(-1===y?1:y,"px"),C="".concat(y,"px 0px"),T=gu(["strokeDasharray"],f,s);return r.createElement(Bu,{animationId:_,key:_,canBegin:y>0,duration:f,easing:s,isActive:h,begin:d},e=>{var l=st(A,a,e),u=st(E,o,e),s=st(S,c,e),f=st(j,n,e),d=st(k,i,e);p.current&&(g.current=l,m.current=u,b.current=s,w.current=f,O.current=d);var h=e>0?{transition:T,strokeDasharray:C}:{strokeDasharray:M};return r.createElement("path",K_({},x(t),{className:P,d:U_(f,d,l,u,s),ref:p,style:R_(R_({},h),t.style)}))})},H_=["option","shapeType","propTransformer","activeClassName"];function V_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function q_(e){for(var t=1;t{i||(null===a.current?n(wb(t)):a.current!==t&&n(xb({prev:a.current,next:t})),a.current=t)},[t,n,i]),r.useLayoutEffect(()=>()=>{a.current&&(n(Ob(a.current)),a.current=null)},[n]),null}function J_(e){var{legendPayload:t}=e,n=gr(),i=ic(),a=r.useRef(null);return r.useLayoutEffect(()=>{i||(null===a.current?n(Il(t)):a.current!==t&&n(Dl({prev:a.current,next:t})),a.current=t)},[n,i,t]),r.useLayoutEffect(()=>()=>{a.current&&(n(Nl(a.current)),a.current=null)},[n]),null}var eP=null!==(F_=a["useId".toString()])&&void 0!==F_?F_:()=>{var[e]=r.useState(()=>ct("uid-"));return e};function tP(e,t){var n=eP();return t||(e?"".concat(e,"-").concat(n):n)}var nP=r.createContext(void 0),rP=e=>{var{id:t,type:n,children:i}=e,a=tP("recharts-".concat(n),t);return r.createElement(nP.Provider,{value:a},i(a))},iP=za({name:"graphicalItems",initialState:{cartesianItems:[],polarItems:[]},reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(t.payload)},prepare:Sa()},replaceCartesianGraphicalItem:{reducer(e,t){var{prev:n,next:r}=t.payload,i=ya(e).cartesianItems.indexOf(n);i>-1&&(e.cartesianItems[i]=r)},prepare:Sa()},removeCartesianGraphicalItem:{reducer(e,t){var n=ya(e).cartesianItems.indexOf(t.payload);n>-1&&e.cartesianItems.splice(n,1)},prepare:Sa()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(t.payload)},prepare:Sa()},removePolarGraphicalItem:{reducer(e,t){var n=ya(e).polarItems.indexOf(t.payload);n>-1&&e.polarItems.splice(n,1)},prepare:Sa()}}}),{addCartesianGraphicalItem:aP,replaceCartesianGraphicalItem:oP,removeCartesianGraphicalItem:cP,addPolarGraphicalItem:lP,removePolarGraphicalItem:uP}=iP.actions,sP=iP.reducer,fP=e=>{var t=gr(),n=r.useRef(null);return r.useLayoutEffect(()=>{null===n.current?t(aP(e)):n.current!==e&&t(oP({prev:n.current,next:e})),n.current=e},[t,e]),r.useLayoutEffect(()=>()=>{n.current&&(t(cP(n.current)),n.current=null)},[t]),null},dP=r.memo(fP),hP=["points"];function pP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function yP(e){for(var t=1;t{var l,u,s=yP(yP(yP({r:3},c),h),{},{index:i,cx:null!==(l=e.x)&&void 0!==l?l:void 0,cy:null!==(u=e.y)&&void 0!==u?u:void 0,dataKey:o,value:e.value,payload:e.payload,points:t});return r.createElement(mP,{key:"dot-".concat(i),option:n,dotProps:s,className:a})}),y={};return l&&null!=u&&(y.clipPath="url(#clipPath-".concat(d?"":"dots-").concat(u,")")),r.createElement(mx,{zIndex:s},r.createElement(S,gP({className:i},y),p))}function wP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function xP(e){for(var t=1;t({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),zP=jr([NP,Bo,Ko],(e,t,n)=>{if(e&&null!=t&&null!=n)return{x:e.left,y:e.top,width:Math.max(0,t-e.left-e.right),height:Math.max(0,n-e.top-e.bottom)}}),LP=()=>xr(zP);function RP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function BP(e){for(var t=1;t{var{point:t,childIndex:n,mainColor:i,activeDot:a,dataKey:o,clipPath:c}=e;if(!1===a||null==t.x||null==t.y)return null;var l,u=BP(BP(BP({},{index:n,dataKey:o,cx:t.x,cy:t.y,r:4,fill:null!=i?i:"none",strokeWidth:2,stroke:"#fff",payload:t.payload,value:t.value}),w(a)),At(a));return l=r.isValidElement(a)?r.cloneElement(a,u):"function"==typeof a?a(u):r.createElement(A_,u),r.createElement(S,{className:"recharts-active-dot",clipPath:c},l)};function UP(e){var{points:t,mainColor:n,activeDot:i,itemDataKey:a,clipPath:o,zIndex:c=Bv.activeDot}=e,l=xr(Mw),u=xr(Rw);if(null==t||null==u)return null;var s=t.find(e=>u.includes(e.payload));return dt(s)?null:r.createElement(mx,{zIndex:c},r.createElement(FP,{point:s,childIndex:Number(l),mainColor:n,dataKey:a,activeDot:i,clipPath:o}))}var WP=za({name:"errorBars",initialState:{},reducers:{addErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]||(e[n]=[]),e[n].push(r)},replaceErrorBar:(e,t)=>{var{itemId:n,prev:r,next:i}=t.payload;e[n]&&(e[n]=e[n].map(e=>e.dataKey===r.dataKey&&e.direction===r.direction?i:e))},removeErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]&&(e[n]=e[n].filter(e=>e.dataKey!==r.dataKey||e.direction!==r.direction))}}}),{addErrorBar:$P,replaceErrorBar:HP,removeErrorBar:VP}=WP.actions,qP=WP.reducer,YP=["children"],XP={data:[],xAxisId:"xAxis-0",yAxisId:"yAxis-0",dataPointFormatter:()=>({x:0,y:0,value:0}),errorBarOffset:0},GP=r.createContext(XP);function ZP(e){var{children:t}=e,n=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;rxg(t,e)),a=xr(e=>Pg(e,t)),o=null!==(n=null==i?void 0:i.allowDataOverflow)&&void 0!==n?n:bg.allowDataOverflow,c=null!==(r=null==a?void 0:a.allowDataOverflow)&&void 0!==r?r:Og.allowDataOverflow;return{needClip:o||c,needClipX:o,needClipY:c}}function JP(e){var{xAxisId:t,yAxisId:n,clipPathId:i}=e,a=LP(),{needClipX:o,needClipY:c,needClip:l}=QP(t,n);if(!l||!a)return null;var{x:u,y:s,width:f,height:d}=a;return r.createElement("clipPath",{id:"clipPath-".concat(i)},r.createElement("rect",{x:o?u:u-f/2,y:c?s:s-d/2,width:o?f:2*f,height:c?d:2*d}))}var eA={notify(){},get:()=>[]},tA=(()=>!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement))(),nA=(()=>"undefined"!=typeof navigator&&"ReactNative"===navigator.product)(),rA=(()=>tA||nA?r.useLayoutEffect:r.useEffect)();function iA(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}function aA(e,t){if(iA(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let i=0;i{const e=function(e){let t,n=eA,r=0,i=!1;function a(){l.onStateChange&&l.onStateChange()}function o(){r++,t||(t=e.subscribe(a),n=function(){let e=null,t=null;return{clear(){e=null,t=null},notify(){(()=>{let t=e;for(;t;)t.callback(),t=t.next})()},get(){const t=[];let n=e;for(;n;)t.push(n),n=n.next;return t},subscribe(n){let r=!0;const i=t={callback:n,next:null,prev:t};return i.prev?i.prev.next=i:e=i,function(){r&&null!==e&&(r=!1,i.next?i.next.prev=i.prev:t=i.prev,i.prev?i.prev.next=i.next:e=i.next)}}}}())}function c(){r--,t&&0===r&&(t(),t=void 0,n.clear(),n=eA)}const l={addNestedSub:function(e){o();const t=n.subscribe(e);let r=!1;return()=>{r||(r=!0,t(),c())}},notifyNestedSubs:function(){n.notify()},handleChangeWrapper:a,isSubscribed:function(){return i},trySubscribe:function(){i||(i=!0,o())},tryUnsubscribe:function(){i&&(i=!1,c())},getListeners:()=>n};return l}(a);return{store:a,subscription:e,getServerState:i?()=>i:void 0}},[a,i]),c=r.useMemo(()=>a.getState(),[a]);rA(()=>{const{subscription:e}=o;return e.onStateChange=e.notifyNestedSubs,e.trySubscribe(),c!==a.getState()&&e.notifyNestedSubs(),()=>{e.tryUnsubscribe(),e.onStateChange=void 0}},[o,c]);const l=n||uA;return r.createElement(l.Provider,{value:o},t)},fA=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle"]);function dA(e,t){return null==e&&null==t||("number"==typeof e&&"number"==typeof t?e===t||e!=e&&t!=t:e===t)}function hA(e,t){var n=new Set([...Object.keys(e),...Object.keys(t)]);for(var r of n)if(fA.has(r)){if(null==e[r]&&null==t[r])continue;if(!aA(e[r],t[r]))return!1}else if(!dA(e[r],t[r]))return!1;return!0}var pA,yA,vA,gA,mA=e=>{var{chartData:t}=e,n=gr(),i=ic();return r.useEffect(()=>i?()=>{}:(n(Bx(t)),()=>{n(Bx(void 0))}),[t,n,i]),null},bA={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},wA=za({name:"brush",initialState:bA,reducers:{setBrushSettings:(e,t)=>null==t.payload?bA:t.payload}}),{setBrushSettings:xA}=wA.actions,OA=wA.reducer;class _A{static create(e){return new _A(e)}constructor(e){this.scale=e}get domain(){return this.scale.domain}get range(){return this.scale.range}get rangeMin(){return this.range()[0]}get rangeMax(){return this.range()[1]}get bandwidth(){return this.scale.bandwidth}apply(e){var{bandAware:t,position:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(void 0!==e){if(n)switch(n){case"start":default:return this.scale(e);case"middle":var r=this.bandwidth?this.bandwidth()/2:0;return this.scale(e)+r;case"end":var i=this.bandwidth?this.bandwidth():0;return this.scale(e)+i}if(t){var a=this.bandwidth?this.bandwidth()/2:0;return this.scale(e)+a}return this.scale(e)}}isInRange(e){var t=this.range(),n=t[0],r=t[t.length-1];return n<=r?e>=n&&e<=r:e>=r&&e<=n}}pA=_A,vA=1e-4,gA=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(yA="EPS","string"),(yA="symbol"==typeof gA?gA:gA+"")in pA?Object.defineProperty(pA,yA,{value:vA,enumerable:!0,configurable:!0,writable:!0}):pA[yA]=vA;var PA=za({name:"referenceElements",initialState:{dots:[],areas:[],lines:[]},reducers:{addDot:(e,t)=>{e.dots.push(t.payload)},removeDot:(e,t)=>{var n=ya(e).dots.findIndex(e=>e===t.payload);-1!==n&&e.dots.splice(n,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var n=ya(e).areas.findIndex(e=>e===t.payload);-1!==n&&e.areas.splice(n,1)},addLine:(e,t)=>{e.lines.push(t.payload)},removeLine:(e,t)=>{var n=ya(e).lines.findIndex(e=>e===t.payload);-1!==n&&e.lines.splice(n,1)}}}),{addDot:AA,removeDot:EA,addArea:SA,removeArea:jA,addLine:kA,removeLine:MA}=PA.actions,CA=PA.reducer,TA=r.createContext(void 0),IA=e=>{var{children:t}=e,[n]=r.useState("".concat(ct("recharts"),"-clip")),i=LP();if(null==i)return null;var{x:a,y:o,width:c,height:l}=i;return r.createElement(TA.Provider,{value:n},r.createElement("defs",null,r.createElement("clipPath",{id:n},r.createElement("rect",{x:a,y:o,height:l,width:c}))),t)};function DA(e,t){if(t<1)return[];if(1===t)return e;for(var n=[],r=0;re*i)return!1;var a=n();return e*(t-e*a/2-r)>=0&&e*(t+e*a/2-i)<=0}function zA(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function LA(e){for(var t=1;t{var i="function"==typeof s?s(e.value,r):e.value;return"width"===p?function(e,t,n){return function(e){var{width:t,height:n}=e,r=function(e){return(e%180+180)%180}(arguments.length>1&&void 0!==arguments[1]?arguments[1]:0),i=r*Math.PI/180,a=Math.atan(n/t),o=i>a&&i=2?tt(a[1].coordinate-a[0].coordinate):1,m=function(e,t,n){var r="width"===n,{x:i,y:a,width:o,height:c}=e;return 1===t?{start:r?i:a,end:r?i+o:a+c}:{start:r?i+o:a+c,end:r?i:a}}(o,g,p);return"equidistantPreserveStart"===u?function(e,t,n,r,i){for(var a,o=(r||[]).slice(),{start:c,end:l}=t,u=0,s=1,f=c,d=function(){var t=null==r?void 0:r[u];if(void 0===t)return{v:DA(r,s)};var a,o=u,d=()=>(void 0===a&&(a=n(t,o)),a),h=t.coordinate,p=0===u||NA(e,h,d,f,l);p||(u=0,f=c,s+=1),p&&(f=h+e*(d()/2+i),u+=s)};s<=o.length;)if(a=d())return a.v;return[]}(g,m,v,a,c):(h="preserveStart"===u||"preserveStartEnd"===u?function(e,t,n,r,i,a){var o=(r||[]).slice(),c=o.length,{start:l,end:u}=t;if(a){var s=r[c-1],f=n(s,c-1),d=e*(s.coordinate+e*f/2-u);o[c-1]=s=LA(LA({},s),{},{tickCoord:d>0?s.coordinate-d*e:s.coordinate}),null!=s.tickCoord&&NA(e,s.tickCoord,()=>f,l,u)&&(u=s.tickCoord-e*(f/2+i),o[c-1]=LA(LA({},s),{},{isShow:!0}))}for(var h=a?c-1:c,p=function(t){var r,a=o[t],c=()=>(void 0===r&&(r=n(a,t)),r);if(0===t){var s=e*(a.coordinate-e*c()/2-l);o[t]=a=LA(LA({},a),{},{tickCoord:s<0?a.coordinate-s*e:a.coordinate})}else o[t]=a=LA(LA({},a),{},{tickCoord:a.coordinate});null!=a.tickCoord&&NA(e,a.tickCoord,c,l,u)&&(l=a.tickCoord+e*(c()/2+i),o[t]=LA(LA({},a),{},{isShow:!0}))},y=0;y(void 0===r&&(r=n(u,t)),r);if(t===o-1){var f=e*(u.coordinate+e*s()/2-l);a[t]=u=LA(LA({},u),{},{tickCoord:f>0?u.coordinate-f*e:u.coordinate})}else a[t]=u=LA(LA({},u),{},{tickCoord:u.coordinate});null!=u.tickCoord&&NA(e,u.tickCoord,s,c,l)&&(l=u.tickCoord-e*(s()/2+i),a[t]=LA(LA({},u),{},{isShow:!0}))},s=o-1;s>=0;s--)u(s);return a}(g,m,v,a,c),h.filter(e=>e.isShow))}var KA=["axisLine","width","height","className","hide","ticks","axisType"];function FA(){return FA=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{ticks:n=[],tick:i,tickLine:a,stroke:o,tickFormatter:c,unit:u,padding:s,tickTextProps:f,orientation:d,mirror:h,x:p,y:v,width:g,height:m,tickSize:x,tickMargin:O,fontSize:_,letterSpacing:P,getTicksConfig:A,events:E,axisType:j}=e,k=BA(WA(WA({},A),{},{ticks:n}),_,P),M=function(e,t){switch(e){case"left":return t?"start":"end";case"right":return t?"end":"start";default:return"middle"}}(d,h),C=function(e,t){switch(e){case"left":case"right":return"middle";case"top":return t?"start":"end";default:return t?"end":"start"}}(d,h),T=b(A),I=w(i),D={};"object"==typeof a&&(D=a);var N=WA(WA({},T),{},{fill:"none"},D),z=k.map(e=>WA({entry:e},function(e,t,n,r,i,a,o,c,l){var u,s,f,d,h,p,y=c?-1:1,v=e.tickSize||o,g=it(e.tickCoord)?e.tickCoord:e.coordinate;switch(a){case"top":u=s=e.coordinate,p=(f=(d=n+ +!c*i)-y*v)-y*l,h=g;break;case"left":f=d=e.coordinate,h=(u=(s=t+ +!c*r)-y*v)-y*l,p=g;break;case"right":f=d=e.coordinate,h=(u=(s=t+ +c*r)+y*v)+y*l,p=g;break;default:u=s=e.coordinate,p=(f=(d=n+ +c*i)+y*v)+y*l,h=g}return{line:{x1:u,y1:f,x2:s,y2:d},tick:{x:h,y:p}}}(e,p,v,g,m,d,x,h,O))),L=z.map(e=>{var{entry:t,line:n}=e;return r.createElement(S,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(t.value,"-").concat(t.coordinate,"-").concat(t.tickCoord)},a&&r.createElement("line",FA({},N,n,{className:l("recharts-cartesian-axis-tick-line",et(a,"className"))})))}),R=z.map((e,t)=>{var{entry:n,tick:a}=e,l=WA(WA(WA(WA({textAnchor:M,verticalAnchor:C},T),{},{stroke:"none",fill:o},I),a),{},{index:t,payload:n,visibleTicksCount:k.length,tickFormatter:c,padding:s},f);return r.createElement(S,FA({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(n.value,"-").concat(n.coordinate,"-").concat(n.tickCoord)},((e,t,n)=>{if(null===e||"object"!=typeof e&&"function"!=typeof e)return null;var r=null;return Object.keys(e).forEach(i=>{var a=e[i];y(i)&&"function"==typeof a&&(r||(r={}),r[i]=((e,t,n)=>r=>(e(t,n,r),null))(a,t,n))}),r})(E,n,t)),i&&r.createElement(qA,{option:i,tickProps:l,value:"".concat("function"==typeof c?c(n.value,t):n.value).concat(u||"")}))});return r.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(j,"-ticks")},R.length>0&&r.createElement(mx,{zIndex:Bv.label},r.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(j,"-tick-labels"),ref:t},R)),L.length>0&&r.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(j,"-tick-lines")},L))}),XA=r.forwardRef((e,t)=>{var{axisLine:n,width:i,height:a,className:o,hide:c,ticks:u,axisType:s}=e,f=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r({getCalculatedWidth:()=>{var t;return(e=>{var{ticks:t,label:n,labelGapWithTick:r=5,tickSize:i=0,tickMargin:a=0}=e,o=0;if(t){Array.from(t).forEach(e=>{if(e){var t=e.getBoundingClientRect();t.width>o&&(o=t.width)}});var c=n?n.getBoundingClientRect().width:0,l=o+(i+a)+c+(n?r:0);return Math.round(l)}return 0})({ticks:v.current,label:null===(t=e.labelRef)||void 0===t?void 0:t.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin})}}));var g=r.useCallback(e=>{if(e){var t=e.getElementsByClassName("recharts-cartesian-axis-tick-value");v.current=t;var n=t[0];if(n){var r=window.getComputedStyle(n),i=r.fontSize,a=r.letterSpacing;i===d&&a===p||(h(i),y(a))}}},[d,p]);return c||null!=i&&i<=0||null!=a&&a<=0?null:r.createElement(mx,{zIndex:e.zIndex},r.createElement(S,{className:l("recharts-cartesian-axis",o)},r.createElement(VA,{x:e.x,y:e.y,width:i,height:a,orientation:e.orientation,mirror:e.mirror,axisLine:n,otherSvgProps:b(e)}),r.createElement(YA,{ref:g,axisType:s,events:f,fontSize:d,getTicksConfig:e,height:e.height,letterSpacing:p,mirror:e.mirror,orientation:e.orientation,padding:e.padding,stroke:e.stroke,tick:e.tick,tickFormatter:e.tickFormatter,tickLine:e.tickLine,tickMargin:e.tickMargin,tickSize:e.tickSize,tickTextProps:e.tickTextProps,ticks:u,unit:e.unit,width:e.width,x:e.x,y:e.y}),r.createElement(KO,{x:e.x,y:e.y,width:e.width,height:e.height,lowerWidth:e.width,upperWidth:e.width},r.createElement(qO,{label:e.label,labelRef:e.labelRef}),e.children)))}),GA=r.forwardRef((e,t)=>{var n=jt(e,HA);return r.createElement(XA,FA({},n,{ref:t}))});GA.displayName="CartesianAxis";var ZA=["x1","y1","x2","y2","key"],QA=["offset"],JA=["xAxisId","yAxisId"],eE=["xAxisId","yAxisId"];function tE(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function nE(e){for(var t=1;t{var{fill:t}=e;if(!t||"none"===t)return null;var{fillOpacity:n,x:i,y:a,width:o,height:c,ry:l}=e;return r.createElement("rect",{x:i,y:a,ry:l,width:o,height:c,stroke:"none",fill:t,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function cE(e){var t,{option:n,lineItemProps:i}=e;if(r.isValidElement(n))t=r.cloneElement(n,i);else if("function"==typeof n)t=n(i);else{var a,{x1:o,y1:c,x2:l,y2:u,key:s}=i,f=null!==(a=b(aE(i,ZA)))&&void 0!==a?a:{},{offset:d}=f,h=aE(f,QA);t=r.createElement("line",iE({},h,{x1:o,y1:c,x2:l,y2:u,fill:"none",key:s}))}return t}function lE(e){var{x:t,width:n,horizontal:i=!0,horizontalPoints:a}=e;if(!i||!a||!a.length)return null;var{xAxisId:o,yAxisId:c}=e,l=aE(e,JA),u=a.map((e,a)=>{var o=nE(nE({},l),{},{x1:t,y1:e,x2:t+n,y2:e,key:"line-".concat(a),index:a});return r.createElement(cE,{key:"line-".concat(a),option:i,lineItemProps:o})});return r.createElement("g",{className:"recharts-cartesian-grid-horizontal"},u)}function uE(e){var{y:t,height:n,vertical:i=!0,verticalPoints:a}=e;if(!i||!a||!a.length)return null;var{xAxisId:o,yAxisId:c}=e,l=aE(e,eE),u=a.map((e,a)=>{var o=nE(nE({},l),{},{x1:e,y1:t,x2:e,y2:t+n,key:"line-".concat(a),index:a});return r.createElement(cE,{option:i,lineItemProps:o,key:"line-".concat(a)})});return r.createElement("g",{className:"recharts-cartesian-grid-vertical"},u)}function sE(e){var{horizontalFill:t,fillOpacity:n,x:i,y:a,width:o,height:c,horizontalPoints:l,horizontal:u=!0}=e;if(!u||!t||!t.length||null==l)return null;var s=l.map(e=>Math.round(e+a-a)).sort((e,t)=>e-t);a!==s[0]&&s.unshift(0);var f=s.map((e,l)=>{var u=s[l+1]?s[l+1]-e:a+c-e;if(u<=0)return null;var f=l%t.length;return r.createElement("rect",{key:"react-".concat(l),y:e,x:i,height:u,width:o,stroke:"none",fill:t[f],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return r.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},f)}function fE(e){var{vertical:t=!0,verticalFill:n,fillOpacity:i,x:a,y:o,width:c,height:l,verticalPoints:u}=e;if(!t||!n||!n.length)return null;var s=u.map(e=>Math.round(e+a-a)).sort((e,t)=>e-t);a!==s[0]&&s.unshift(0);var f=s.map((e,t)=>{var u=s[t+1]?s[t+1]-e:a+c-e;if(u<=0)return null;var f=t%n.length;return r.createElement("rect",{key:"react-".concat(t),x:e,y:o,width:u,height:l,stroke:"none",fill:n[f],fillOpacity:i,className:"recharts-cartesian-grid-bg"})});return r.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},f)}var dE=(e,t)=>{var{xAxis:n,width:r,height:i,offset:a}=e;return jo(BA(nE(nE(nE({},HA),n),{},{ticks:ko(n),viewBox:{x:0,y:0,width:r,height:i}})),a.left,a.left+a.width,t)},hE=(e,t)=>{var{yAxis:n,width:r,height:i,offset:a}=e;return jo(BA(nE(nE(nE({},HA),n),{},{ticks:ko(n),viewBox:{x:0,y:0,width:r,height:i}})),a.top,a.top+a.height,t)},pE={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:Bv.grid};function yE(e){var t=zc(),n=Lc(),i=Nc(),a=nE(nE({},jt(e,pE)),{},{x:it(e.x)?e.x:i.left,y:it(e.y)?e.y:i.top,width:it(e.width)?e.width:i.width,height:it(e.height)?e.height:i.height}),{xAxisId:o,yAxisId:c,x:l,y:u,width:s,height:f,syncWithTicks:d,horizontalValues:h,verticalValues:p}=a,y=ic(),v=xr(e=>cb(e,"xAxis",o,y)),g=xr(e=>cb(e,"yAxis",c,y));if(!(Oc(s)&&Oc(f)&&it(l)&&it(u)))return null;var m=a.verticalCoordinatesGenerator||dE,b=a.horizontalCoordinatesGenerator||hE,{horizontalPoints:w,verticalPoints:x}=a;if(!(w&&w.length||"function"!=typeof b)){var O=h&&h.length,_=b({yAxis:g?nE(nE({},g),{},{ticks:O?h:g.ticks}):void 0,width:null!=t?t:s,height:null!=n?n:f,offset:i},!!O||d);pc(Array.isArray(_),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof _,"]")),Array.isArray(_)&&(w=_)}if(!(x&&x.length||"function"!=typeof m)){var P=p&&p.length,A=m({xAxis:v?nE(nE({},v),{},{ticks:P?p:v.ticks}):void 0,width:null!=t?t:s,height:null!=n?n:f,offset:i},!!P||d);pc(Array.isArray(A),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof A,"]")),Array.isArray(A)&&(x=A)}return r.createElement(mx,{zIndex:a.zIndex},r.createElement("g",{className:"recharts-cartesian-grid"},r.createElement(oE,{fill:a.fill,fillOpacity:a.fillOpacity,x:a.x,y:a.y,width:a.width,height:a.height,ry:a.ry}),r.createElement(sE,iE({},a,{horizontalPoints:w})),r.createElement(fE,iE({},a,{verticalPoints:x})),r.createElement(lE,iE({},a,{offset:i,horizontalPoints:w,xAxis:v,yAxis:g})),r.createElement(uE,iE({},a,{offset:i,verticalPoints:x,xAxis:v,yAxis:g}))))}yE.displayName="CartesianGrid";var vE=(e,t,n,r)=>sb(e,"xAxis",t,r),gE=(e,t,n,r)=>ub(e,"xAxis",t,r),mE=(e,t,n,r)=>sb(e,"yAxis",n,r),bE=(e,t,n,r)=>ub(e,"yAxis",n,r),wE=jr([Rc,vE,mE,gE,bE],(e,t,n,r,i)=>So(e,"xAxis")?zo(t,r,!1):zo(n,i,!1));function xE(e){return"line"===e.type}var OE=jr([Cg,(e,t,n,r,i)=>i],(e,t)=>e.filter(xE).find(e=>e.id===t)),_E=jr([Rc,vE,mE,gE,bE,OE,wE,Ky],(e,t,n,r,i,a,o,c)=>{var{chartData:l,dataStartIndex:u,dataEndIndex:s}=c;if(null!=a&&null!=t&&null!=n&&null!=r&&null!=i&&0!==r.length&&0!==i.length&&null!=o&&("horizontal"===e||"vertical"===e)){var f,{dataKey:d,data:h}=a;if(null!=(f=null!=h&&h.length>0?h:null==l?void 0:l.slice(u,s+1)))return function(e){var{layout:t,xAxis:n,yAxis:r,xAxisTicks:i,yAxisTicks:a,dataKey:o,bandSize:c,displayedData:l}=e;return l.map((e,l)=>{var u=Eo(e,o);if("horizontal"===t)return{x:Io({axis:n,ticks:i,bandSize:c,entry:e,index:l}),y:dt(u)?null:r.scale(u),value:u,payload:e};var s=dt(u)?null:n.scale(u),f=Io({axis:r,ticks:a,bandSize:c,entry:e,index:l});return null==s||null==f?null:{x:s,y:f,value:u,payload:e}}).filter(Boolean)}({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataKey:d,bandSize:o,displayedData:f})}});function PE(e){var t=w(e);if(null!=t){var{r:n,strokeWidth:r}=t,i=Number(n),a=Number(r);return(Number.isNaN(i)||i<0)&&(i=3),(Number.isNaN(a)||a<0)&&(a=2),{r:i,strokeWidth:a}}return{r:3,strokeWidth:2}}var AE=["id"],EE=["type","layout","connectNulls","needClip","shape"],SE=["activeDot","animateNewValues","animationBegin","animationDuration","animationEasing","connectNulls","dot","hide","isAnimationActive","label","legendType","xAxisId","yAxisId","id"];function jE(){return jE=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{dataKey:t,name:n,stroke:r,legendType:i,hide:a}=e;return[{inactive:a,dataKey:t,type:i,color:r,value:Ro(n,t),payload:e}]},DE=r.memo(e=>{var{dataKey:t,data:n,stroke:i,strokeWidth:a,fill:o,name:c,hide:l,unit:u,tooltipType:s}=e,f={dataDefinedOnItem:n,positions:void 0,settings:{stroke:i,strokeWidth:a,fill:o,dataKey:t,nameKey:void 0,name:Ro(c,t),hide:l,type:s,color:i,unit:u}};return r.createElement(Q_,{tooltipEntrySettings:f})}),NE=(e,t)=>"".concat(t,"px ").concat(e-t,"px");function zE(e,t){for(var n=e.length%2!=0?[...e,0]:e,r=[],i=0;inull==i?void 0:i.map(e=>{var t,n,r={x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0,width:0,lowerWidth:0,upperWidth:0,height:0};return ME(ME({},r),{},{value:e.value,payload:e.payload,viewBox:r,parentViewBox:void 0,fill:void 0})}),[i]);return r.createElement(d_,{value:t?a:void 0},n)}function BE(e){var{clipPathId:t,pathRef:n,points:i,strokeDasharray:a,props:o}=e,{type:c,layout:l,connectNulls:u,needClip:s,shape:f}=o,d=ME(ME({},x(TE(o,EE))),{},{fill:"none",className:"recharts-line-curve",clipPath:s?"url(#clipPath-".concat(t,")"):void 0,points:i,type:c,layout:l,connectNulls:u,strokeDasharray:null!=a?a:o.strokeDasharray});return r.createElement(r.Fragment,null,(null==i?void 0:i.length)>1&&r.createElement(Z_,jE({shapeType:"curve",option:f},d,{pathRef:n})),r.createElement(LE,{points:i,clipPathId:t,props:o}))}function KE(e){var{clipPathId:t,props:n,pathRef:i,previousPointsRef:a,longestAnimatedLengthRef:o}=e,{points:c,strokeDasharray:l,isAnimationActive:u,animationBegin:s,animationDuration:f,animationEasing:d,animateNewValues:h,width:p,height:y,onAnimationEnd:v,onAnimationStart:g}=n,m=a.current,b=Ku(c,"recharts-line-"),w=r.useRef(b),[x,O]=r.useState(!1),_=!x,P=r.useCallback(()=>{"function"==typeof v&&v(),O(!1)},[v]),A=r.useCallback(()=>{"function"==typeof g&&g(),O(!0)},[g]),E=function(e){try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch(t){return 0}}(i.current),S=r.useRef(0);w.current!==b&&(S.current=o.current,w.current=b);var j=S.current;return r.createElement(RE,{points:c,showLabels:_},n.children,r.createElement(Bu,{animationId:b,begin:s,duration:f,isActive:u,easing:d,onAnimationEnd:P,onAnimationStart:A,key:b},e=>{var s,f=st(j,E+j,e),d=Math.min(f,E);if(u)if(l){var v="".concat(l).split(/[,\s]+/gim).map(e=>parseFloat(e));s=((e,t,n)=>{var r=n.reduce((e,t)=>e+t);if(!r)return NE(t,e);for(var i=Math.floor(e/r),a=e%r,o=t-e,c=[],l=0,u=0;la){c=[...n.slice(0,l),a-u];break}var s=c.length%2==0?[0,o]:[o];return[...zE(n,i),...c,...s].map(e=>"".concat(e,"px")).join(", ")})(d,E,v)}else s=NE(E,d);else s=null==l?void 0:String(l);if(e>0&&E>0&&(a.current=c,o.current=Math.max(o.current,d)),m){var g=m.length/c.length,b=1===e?c:c.map((t,n)=>{var r=Math.floor(n*g);if(m[r]){var i=m[r];return ME(ME({},t),{},{x:st(i.x,t.x,e),y:st(i.y,t.y,e)})}return ME(ME({},t),{},h?{x:st(2*p,t.x,e),y:st(y/2,t.y,e)}:{x:t.x,y:t.y})});return a.current=b,r.createElement(BE,{props:n,points:b,clipPathId:t,pathRef:i,strokeDasharray:s})}return r.createElement(BE,{props:n,points:c,clipPathId:t,pathRef:i,strokeDasharray:s})}),r.createElement(y_,{label:n.label}))}function FE(e){var{clipPathId:t,props:n}=e,i=r.useRef(null),a=r.useRef(0),o=r.useRef(null);return r.createElement(KE,{props:n,clipPathId:t,previousPointsRef:i,longestAnimatedLengthRef:a,pathRef:o})}var UE=(e,t)=>{var n,r;return{x:null!==(n=e.x)&&void 0!==n?n:void 0,y:null!==(r=e.y)&&void 0!==r?r:void 0,value:e.value,errorVal:Eo(e.payload,t)}};class WE extends r.Component{render(){var{hide:e,dot:t,points:n,className:i,xAxisId:a,yAxisId:o,top:c,left:u,width:s,height:f,id:d,needClip:h,zIndex:p}=this.props;if(e)return null;var y=l("recharts-line",i),v=d,{r:g,strokeWidth:m}=PE(t),b=T_(t),w=2*g+m,x=h?"url(#clipPath-".concat(b?"":"dots-").concat(v,")"):void 0;return r.createElement(mx,{zIndex:p},r.createElement(S,{className:y},h&&r.createElement("defs",null,r.createElement(JP,{clipPathId:v,xAxisId:a,yAxisId:o}),!b&&r.createElement("clipPath",{id:"clipPath-dots-".concat(v)},r.createElement("rect",{x:u-w/2,y:c-w/2,width:s+w,height:f+w}))),r.createElement(ZP,{xAxisId:a,yAxisId:o,data:n,dataPointFormatter:UE,errorBarOffset:0},r.createElement(FE,{props:this.props,clipPathId:v}))),r.createElement(UP,{activeDot:this.props.activeDot,points:n,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:x}))}}var $E={activeDot:!0,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!0,fill:"#fff",hide:!1,isAnimationActive:"auto",label:!1,legendType:"line",stroke:"#3182bd",strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:Bv.line,type:"linear"};function HE(e){var t=jt(e,$E),{activeDot:n,animateNewValues:i,animationBegin:a,animationDuration:o,animationEasing:c,connectNulls:l,dot:u,hide:s,isAnimationActive:f,label:d,legendType:h,xAxisId:p,yAxisId:y,id:v}=t,g=TE(t,SE),{needClip:m}=QP(p,y),b=LP(),w=Bc(),x=ic(),O=xr(e=>_E(e,p,y,x,v));if("horizontal"!==w&&"vertical"!==w||null==O||null==b)return null;var{height:_,width:P,x:A,y:E}=b;return r.createElement(WE,jE({},g,{id:v,connectNulls:l,dot:u,activeDot:n,animateNewValues:i,animationBegin:a,animationDuration:o,animationEasing:c,isAnimationActive:f,hide:s,label:d,legendType:h,xAxisId:p,yAxisId:y,points:O,layout:w,height:_,width:P,left:A,top:E,needClip:m}))}function VE(e){var t=jt(e,$E),n=ic();return r.createElement(rP,{id:t.id,type:"line"},e=>r.createElement(r.Fragment,null,r.createElement(J_,{legendPayload:IE(t)}),r.createElement(DE,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType}),r.createElement(dP,{type:"line",id:e,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:n}),r.createElement(HE,jE({},t,{id:e}))))}var qE=r.memo(VE,hA);qE.displayName="Line";var YE=(e,t,n,r)=>sb(e,"xAxis",t,r),XE=(e,t,n,r)=>ub(e,"xAxis",t,r),GE=(e,t,n,r)=>sb(e,"yAxis",n,r),ZE=(e,t,n,r)=>ub(e,"yAxis",n,r),QE=jr([Rc,YE,GE,XE,ZE],(e,t,n,r,i)=>So(e,"xAxis")?zo(t,r,!1):zo(n,i,!1)),JE=jr([Cg,(e,t,n,r,i)=>i],(e,t)=>e.filter(e=>"area"===e.type).find(e=>e.id===t)),eS=jr([Rc,YE,GE,XE,ZE,(e,t,n,r,i)=>{var a,o=JE(e,t,n,r,i);if(null!=o){var c,l=Rc(e);if(null!=(c=So(l,"xAxis")?Qg(e,"yAxis",n,r):Qg(e,"xAxis",t,r))){var{stackId:u}=o,s=lg(o);if(null!=u&&null!=s){var f=null===(a=c[u])||void 0===a?void 0:a.stackedData;return null==f?void 0:f.find(e=>e.key===s)}}}},Ky,QE,JE,e=>e.rootProps.baseValue],(e,t,n,r,i,a,o,c,l,u)=>{var{chartData:s,dataStartIndex:f,dataEndIndex:d}=o;if(null!=l&&("horizontal"===e||"vertical"===e)&&null!=t&&null!=n&&null!=r&&null!=i&&0!==r.length&&0!==i.length&&null!=c){var h,{data:p}=l;if(null!=(h=p&&p.length>0?p:null==s?void 0:s.slice(f,d+1)))return function(e){var t,{areaSettings:{connectNulls:n,baseValue:r,dataKey:i},stackedData:a,layout:o,chartBaseValue:c,xAxis:l,yAxis:u,displayedData:s,dataStartIndex:f,xAxisTicks:d,yAxisTicks:h,bandSize:p}=e,y=a&&a.length,v=OS(o,c,r,l,u),g="horizontal"===o,m=!1,b=s.map((e,t)=>{var r;y?r=a[f+t]:(r=Eo(e,i),Array.isArray(r)?m=!0:r=[v,r]);var o=null==r[1]||y&&!n&&null==Eo(e,i);return g?{x:Io({axis:l,ticks:d,bandSize:p,entry:e,index:t}),y:o?null:u.scale(r[1]),value:r,payload:e}:{x:o?null:l.scale(r[1]),y:Io({axis:u,ticks:h,bandSize:p,entry:e,index:t}),value:r,payload:e}});return t=y||m?b.map(e=>{var t=Array.isArray(e.value)?e.value[0]:null;return g?{x:e.x,y:null!=t&&null!=e.y?u.scale(t):null,payload:e.payload}:{x:null!=t?l.scale(t):null,y:e.y,payload:e.payload}}):g?u.scale(v):l.scale(v),{points:b,baseLine:t,isRange:m}}({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataStartIndex:f,areaSettings:l,stackedData:a,displayedData:h,chartBaseValue:u,bandSize:c})}}),tS=["id"],nS=["activeDot","animationBegin","animationDuration","animationEasing","connectNulls","dot","fill","fillOpacity","hide","isAnimationActive","legendType","stroke","xAxisId","yAxisId"];function rS(){return rS=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{dataKey:t,name:n,stroke:r,fill:i,legendType:a,hide:o}=e;return[{inactive:o,dataKey:t,type:a,color:lS(r,i),value:Ro(n,t),payload:e}]},sS=r.memo(e=>{var{dataKey:t,data:n,stroke:i,strokeWidth:a,fill:o,name:c,hide:l,unit:u,tooltipType:s}=e,f={dataDefinedOnItem:n,positions:void 0,settings:{stroke:i,strokeWidth:a,fill:o,dataKey:t,nameKey:void 0,name:Ro(c,t),hide:l,type:s,color:lS(i,o),unit:u}};return r.createElement(Q_,{tooltipEntrySettings:f})});function fS(e){var{clipPathId:t,points:n,props:i}=e,{needClip:a,dot:o,dataKey:c}=i,l=b(i);return r.createElement(bP,{points:n,dot:o,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:c,baseProps:l,needClip:a,clipPathId:t})}function dS(e){var{showLabels:t,children:n,points:i}=e,a=i.map(e=>{var t,n,r={x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0,width:0,lowerWidth:0,upperWidth:0,height:0};return oS(oS({},r),{},{value:e.value,payload:e.payload,parentViewBox:void 0,viewBox:r,fill:void 0})});return r.createElement(d_,{value:t?a:void 0},n)}function hS(e){var{points:t,baseLine:n,needClip:i,clipPathId:a,props:o}=e,{layout:c,type:l,stroke:u,connectNulls:s,isRange:f}=o,{id:d}=o,h=iS(o,tS),p=b(h),y=x(h);return r.createElement(r.Fragment,null,(null==t?void 0:t.length)>1&&r.createElement(S,{clipPath:i?"url(#clipPath-".concat(a,")"):void 0},r.createElement(cu,rS({},y,{id:d,points:t,connectNulls:s,type:l,baseLine:n,layout:c,stroke:"none",className:"recharts-area-area"})),"none"!==u&&r.createElement(cu,rS({},p,{className:"recharts-area-curve",layout:c,type:l,connectNulls:s,fill:"none",points:t})),"none"!==u&&f&&r.createElement(cu,rS({},p,{className:"recharts-area-curve",layout:c,type:l,connectNulls:s,fill:"none",points:n}))),r.createElement(fS,{points:t,props:h,clipPathId:a}))}function pS(e){var{alpha:t,baseLine:n,points:i,strokeWidth:a}=e,o=i[0].y,c=i[i.length-1].y;if(!xc(o)||!xc(c))return null;var l=t*Math.abs(o-c),u=Math.max(...i.map(e=>e.x||0));return it(n)?u=Math.max(n,u):n&&Array.isArray(n)&&n.length&&(u=Math.max(...n.map(e=>e.x||0),u)),it(u)?r.createElement("rect",{x:0,y:oe.y||0));return it(n)?u=Math.max(n,u):n&&Array.isArray(n)&&n.length&&(u=Math.max(...n.map(e=>e.y||0),u)),it(u)?r.createElement("rect",{x:o({points:c,baseLine:l}),[c,l]),"recharts-area-"),v=(()=>{var e=Bc();if("horizontal"===e||"vertical"===e)return e})(),[g,m]=r.useState(!1),b=!g,w=r.useCallback(()=>{"function"==typeof p&&p(),m(!1)},[p]),x=r.useCallback(()=>{"function"==typeof h&&h(),m(!0)},[h]);if(null==v)return null;var O=a.current,_=o.current;return r.createElement(dS,{showLabels:b,points:c},i.children,r.createElement(Bu,{animationId:y,begin:s,duration:f,isActive:u,easing:d,onAnimationEnd:w,onAnimationStart:x,key:y},e=>{if(O){var s,f=O.length/c.length,d=1===e?c:c.map((t,n)=>{var r=Math.floor(n*f);if(O[r]){var i=O[r];return oS(oS({},t),{},{x:st(i.x,t.x,e),y:st(i.y,t.y,e)})}return t});return s=it(l)?st(_,l,e):dt(l)||nt(l)?st(_,0,e):l.map((t,n)=>{var r=Math.floor(n*f);if(Array.isArray(_)&&_[r]){var i=_[r];return oS(oS({},t),{},{x:st(i.x,t.x,e),y:st(i.y,t.y,e)})}return t}),e>0&&(a.current=d,o.current=s),r.createElement(hS,{points:d,baseLine:s,needClip:t,clipPathId:n,props:i})}return e>0&&(a.current=c,o.current=l),r.createElement(S,null,u&&r.createElement("defs",null,r.createElement("clipPath",{id:"animationClipPath-".concat(n)},r.createElement(vS,{alpha:e,points:c,baseLine:l,layout:v,strokeWidth:i.strokeWidth}))),r.createElement(S,{clipPath:"url(#animationClipPath-".concat(n,")")},r.createElement(hS,{points:c,baseLine:l,needClip:t,clipPathId:n,props:i})))}),r.createElement(y_,{label:i.label}))}function mS(e){var{needClip:t,clipPathId:n,props:i}=e,a=r.useRef(null),o=r.useRef();return r.createElement(gS,{needClip:t,clipPathId:n,props:i,previousPointsRef:a,previousBaselineRef:o})}class bS extends r.PureComponent{render(){var{hide:e,dot:t,points:n,className:i,top:a,left:o,needClip:c,xAxisId:u,yAxisId:s,width:f,height:d,id:h,baseLine:p,zIndex:y}=this.props;if(e)return null;var v=l("recharts-area",i),g=h,{r:m,strokeWidth:b}=PE(t),w=T_(t),x=2*m+b,O=c?"url(#clipPath-".concat(w?"":"dots-").concat(g,")"):void 0;return r.createElement(mx,{zIndex:y},r.createElement(S,{className:v},c&&r.createElement("defs",null,r.createElement(JP,{clipPathId:g,xAxisId:u,yAxisId:s}),!w&&r.createElement("clipPath",{id:"clipPath-dots-".concat(g)},r.createElement("rect",{x:o-x/2,y:a-x/2,width:f+x,height:d+x}))),r.createElement(mS,{needClip:c,clipPathId:g,props:this.props})),r.createElement(UP,{points:n,mainColor:lS(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:O}),this.props.isRange&&Array.isArray(p)&&r.createElement(UP,{points:p,mainColor:lS(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:O}))}}var wS={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!1,fill:"#3182bd",fillOpacity:.6,hide:!1,isAnimationActive:"auto",legendType:"line",stroke:"#3182bd",strokeWidth:1,type:"linear",label:!1,xAxisId:0,yAxisId:0,zIndex:Bv.area};function xS(e){var t,n=jt(e,wS),{activeDot:i,animationBegin:a,animationDuration:o,animationEasing:c,connectNulls:l,dot:u,fill:s,fillOpacity:f,hide:d,isAnimationActive:h,legendType:p,stroke:y,xAxisId:v,yAxisId:g}=n,m=iS(n,nS),b=Bc(),w=Vw(),{needClip:x}=QP(v,g),O=ic(),{points:_,isRange:P,baseLine:A}=null!==(t=xr(t=>eS(t,v,g,O,e.id)))&&void 0!==t?t:{},E=LP();if("horizontal"!==b&&"vertical"!==b||null==E)return null;if("AreaChart"!==w&&"ComposedChart"!==w)return null;var{height:S,width:j,x:k,y:M}=E;return _&&_.length?r.createElement(bS,rS({},m,{activeDot:i,animationBegin:a,animationDuration:o,animationEasing:c,baseLine:A,connectNulls:l,dot:u,fill:s,fillOpacity:f,height:S,hide:d,layout:b,isAnimationActive:"auto"===h?!Nu:h,isRange:P,legendType:p,needClip:x,points:_,stroke:y,width:j,left:k,top:M,xAxisId:v,yAxisId:g})):null}var OS=(e,t,n,r,i)=>{var a=null!=n?n:t;if(it(a))return a;var o="horizontal"===e?i:r,c=o.scale.domain();if("number"===o.type){var l=Math.max(c[0],c[1]),u=Math.min(c[0],c[1]);return"dataMin"===a?u:"dataMax"===a||l<0?l:Math.max(Math.min(c[0],c[1]),0)}return"dataMin"===a?c[0]:"dataMax"===a?c[1]:c[0]};function _S(e){var t=jt(e,wS),n=ic();return r.createElement(rP,{id:t.id,type:"area"},e=>{return r.createElement(r.Fragment,null,r.createElement(J_,{legendPayload:uS(t)}),r.createElement(sS,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType}),r.createElement(dP,{type:"area",id:e,data:t.data,dataKey:t.dataKey,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,stackId:(i=t.stackId,null==i?void 0:String(i)),hide:t.hide,barSize:void 0,baseValue:t.baseValue,isPanorama:n,connectNulls:t.connectNulls}),r.createElement(xS,rS({},t,{id:e})));var i})}var PS=r.memo(_S,hA);PS.displayName="Area";var AS=["domain","range"],ES=["domain","range"];function SS(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{null===n.current?t(PP(e)):n.current!==e&&t(AP({prev:n.current,next:e})),n.current=e},[e,t]),r.useLayoutEffect(()=>()=>{n.current&&(t(EP(n.current)),n.current=null)},[t]),null}var NS=e=>{var{xAxisId:t,className:n}=e,i=xr(nc),a=ic(),o="xAxis",c=xr(e=>$m(e,o,t,a)),u=xr(e=>lb(e,o,t,a)),s=xr(e=>Zm(e,t)),f=xr(e=>eb(e,t)),d=xr(e=>wg(e,t));if(null==s||null==f||null==d)return null;var{dangerouslySetInnerHTML:h,ticks:p}=e,y=IS(e,MS),{id:v}=d,g=IS(d,CS);return r.createElement(GA,TS({},y,g,{scale:c,x:f.x,y:f.y,width:s.width,height:s.height,className:l("recharts-".concat(o," ").concat(o),n),viewBox:i,ticks:u,axisType:o}))},zS={allowDataOverflow:bg.allowDataOverflow,allowDecimals:bg.allowDecimals,allowDuplicatedCategory:bg.allowDuplicatedCategory,angle:bg.angle,axisLine:HA.axisLine,height:bg.height,hide:!1,includeHidden:bg.includeHidden,interval:bg.interval,minTickGap:bg.minTickGap,mirror:bg.mirror,orientation:bg.orientation,padding:bg.padding,reversed:bg.reversed,scale:bg.scale,tick:bg.tick,tickCount:bg.tickCount,tickLine:HA.tickLine,tickSize:HA.tickSize,type:bg.type,xAxisId:0},LS=e=>{var t=jt(e,zS);return r.createElement(r.Fragment,null,r.createElement(DS,{allowDataOverflow:t.allowDataOverflow,allowDecimals:t.allowDecimals,allowDuplicatedCategory:t.allowDuplicatedCategory,angle:t.angle,dataKey:t.dataKey,domain:t.domain,height:t.height,hide:t.hide,id:t.xAxisId,includeHidden:t.includeHidden,interval:t.interval,minTickGap:t.minTickGap,mirror:t.mirror,name:t.name,orientation:t.orientation,padding:t.padding,reversed:t.reversed,scale:t.scale,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit}),r.createElement(NS,t))},RS=r.memo(LS,kS);RS.displayName="XAxis";var BS=["dangerouslySetInnerHTML","ticks"],KS=["id"];function FS(){return FS=Object.assign?Object.assign.bind():function(e){for(var t=1;t{null===n.current?t(SP(e)):n.current!==e&&t(jP({prev:n.current,next:e})),n.current=e},[e,t]),r.useLayoutEffect(()=>()=>{n.current&&(t(kP(n.current)),n.current=null)},[t]),null}var $S=e=>{var{yAxisId:t,className:n,width:i,label:a}=e,o=r.useRef(null),c=r.useRef(null),u=xr(nc),s=ic(),f=gr(),d="yAxis",h=xr(e=>$m(e,d,t,s)),p=xr(e=>nb(e,t)),y=xr(e=>tb(e,t)),v=xr(e=>lb(e,d,t,s)),g=xr(e=>_g(e,t));if(r.useLayoutEffect(()=>{if("auto"===i&&p&&!WO(a)&&!r.isValidElement(a)&&null!=g){var e=o.current;if(e){var n=e.getCalculatedWidth();Math.round(p.width)!==Math.round(n)&&f(IP({id:t,width:n}))}}},[v,p,f,a,t,i,g]),null==p||null==y||null==g)return null;var{dangerouslySetInnerHTML:m,ticks:b}=e,w=US(e,BS),{id:x}=g,O=US(g,KS);return r.createElement(GA,FS({},w,O,{ref:o,labelRef:c,scale:h,x:y.x,y:y.y,tickTextProps:"auto"===i?{width:void 0}:{width:i},width:p.width,height:p.height,className:l("recharts-".concat(d," ").concat(d),n),viewBox:u,ticks:v,axisType:d}))},HS={allowDataOverflow:Og.allowDataOverflow,allowDecimals:Og.allowDecimals,allowDuplicatedCategory:Og.allowDuplicatedCategory,angle:Og.angle,axisLine:HA.axisLine,hide:!1,includeHidden:Og.includeHidden,interval:Og.interval,minTickGap:Og.minTickGap,mirror:Og.mirror,orientation:Og.orientation,padding:Og.padding,reversed:Og.reversed,scale:Og.scale,tick:Og.tick,tickCount:Og.tickCount,tickLine:HA.tickLine,tickSize:HA.tickSize,type:Og.type,width:Og.width,yAxisId:0},VS=e=>{var t=jt(e,HS);return r.createElement(r.Fragment,null,r.createElement(WS,{interval:t.interval,id:t.yAxisId,scale:t.scale,type:t.type,domain:t.domain,allowDataOverflow:t.allowDataOverflow,dataKey:t.dataKey,allowDuplicatedCategory:t.allowDuplicatedCategory,allowDecimals:t.allowDecimals,tickCount:t.tickCount,padding:t.padding,includeHidden:t.includeHidden,reversed:t.reversed,ticks:t.ticks,width:t.width,orientation:t.orientation,mirror:t.mirror,hide:t.hide,unit:t.unit,name:t.name,angle:t.angle,minTickGap:t.minTickGap,tick:t.tick,tickFormatter:t.tickFormatter}),r.createElement($S,t))},qS=r.memo(VS,kS);qS.displayName="YAxis";var YS={begin:0,duration:1e3,easing:"ease",isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}};function XS(e){var t=jt(e,YS),{animationId:n,from:i,to:a,attributeName:o,isActive:c,canBegin:l,duration:u,easing:s,begin:f,onAnimationEnd:d,onAnimationStart:h,children:p}=t,y="auto"===c?!Nu:c,v=Du(n+o,t.animationManager),[g,m]=r.useState(()=>y?i:a),b=r.useRef(!1),w=r.useCallback(()=>{m(i),h()},[i,h]);return r.useEffect(()=>{if(!y||!l)return yt;b.current=!0;var e=v.subscribe(m);return v.start([w,f,a,u,d]),()=>{v.stop(),e&&e(),d()}},[y,l,u,s,f,w,d,v,a,i]),y?l?b.current?p({transition:gu([o],u,s),[o]:g}):p({[o]:i}):p({[o]:i}):p({[o]:a})}var GS=jr([(e,t)=>t,Rc,ag,hg,xw,Aw,Gw,ec],(e,t,n,r,i,a,o,c)=>{if(e&&t&&r&&i&&a)return"horizontal"===t||"vertical"===t?((e,t,n,r,i,a,o)=>{if(e&&n&&r&&i&&function(e,t){var{chartX:n,chartY:r}=e;return n>=t.left&&n<=t.left+t.width&&r>=t.top&&r<=t.top+t.height}(e,o)){var c=((e,t)=>"horizontal"===t?e.chartX:"vertical"===t?e.chartY:void 0)(e,t),l=Hw(c,a,i,n,r),u=((e,t,n,r)=>{var i=t.find(e=>e&&e.index===n);if(i){if("horizontal"===e)return{x:i.coordinate,y:r.chartY};if("vertical"===e)return{x:r.chartX,y:i.coordinate}}return{x:0,y:0}})(t,i,l,e);return{activeIndex:String(l),activeCoordinate:u}}})(e,t,r,i,a,o,c):((e,t,n,r,i,a,o)=>{if(e&&r&&i&&a&&n){var c=is(e,n);if(c){var l=((e,t)=>"centric"===t?e.angle:e.radius)(c,t),u=Hw(l,o,a,r,i),s=((e,t,n,r)=>{var i=t.find(e=>e&&e.index===n);if(i){if("centric"===e){var a=i.coordinate,{radius:o}=r;return Ww(Ww(Ww({},r),ns(r.cx,r.cy,o,a)),{},{angle:a,radius:o})}var c=i.coordinate,{angle:l}=r;return Ww(Ww(Ww({},r),ns(r.cx,r.cy,c,l)),{},{angle:l,radius:c})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}})(t,a,u,c);return{activeIndex:String(u),activeCoordinate:s}}}})(e,t,n,r,i,a,o)}),ZS=e=>{var t=e.currentTarget.getBoundingClientRect(),n=t.width/e.currentTarget.offsetWidth,r=t.height/e.currentTarget.offsetHeight;return{chartX:Math.round((e.clientX-t.left)/n),chartY:Math.round((e.clientY-t.top)/r)}},QS=Oa("mouseClick"),JS=po();JS.startListening({actionCreator:QS,effect:(e,t)=>{var n=e.payload,r=GS(t.getState(),ZS(n));null!=(null==r?void 0:r.activeIndex)&&t.dispatch(kb({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var ej=Oa("mouseMove"),tj=po(),nj=null;tj.startListening({actionCreator:ej,effect:(e,t)=>{var n=e.payload;null!==nj&&cancelAnimationFrame(nj);var r=ZS(n);nj=requestAnimationFrame(()=>{var e=t.getState();if("axis"===vb(e,e.tooltip.settings.shared)){var n=GS(e,r);null!=(null==n?void 0:n.activeIndex)?t.dispatch(jb({activeIndex:n.activeIndex,activeDataKey:void 0,activeCoordinate:n.activeCoordinate})):t.dispatch(Eb())}nj=null})}});var rj={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0,reverseStackOrder:!1},ij=za({name:"rootProps",initialState:rj,reducers:{updateOptions:(e,t)=>{var n;e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=null!==(n=t.payload.barGap)&&void 0!==n?n:rj.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue,e.reverseStackOrder=t.payload.reverseStackOrder}}}),aj=ij.reducer,{updateOptions:oj}=ij.actions,cj=za({name:"polarOptions",initialState:null,reducers:{updatePolarOptions:(e,t)=>t.payload}}),{updatePolarOptions:lj}=cj.actions,uj=cj.reducer,sj=Oa("keyDown"),fj=Oa("focus"),dj=po();dj.startListening({actionCreator:sj,effect:(e,t)=>{var n=t.getState();if(!1!==n.rootProps.accessibilityLayer){var{keyboardInteraction:r}=n.tooltip,i=e.payload;if("ArrowRight"===i||"ArrowLeft"===i||"Enter"===i){var a=Lb(r,Qb(n),Xg(n),gw(n)),o=null==a?-1:Number(a);if(Number.isFinite(o)&&!(o<0)){var c=Aw(n);if("Enter"!==i){var l=o+("ArrowRight"===i?1:-1)*("left-to-right"===db(n)?1:-1);if(!(null==c||l>=c.length||l<0)){var u=ex(n,"axis","hover",String(l));t.dispatch(Cb({active:!0,activeIndex:l.toString(),activeDataKey:void 0,activeCoordinate:u}))}}else{var s=ex(n,"axis","hover",String(r.index));t.dispatch(Cb({active:!r.active,activeIndex:r.index,activeDataKey:r.dataKey,activeCoordinate:s}))}}}}}}),dj.startListening({actionCreator:fj,effect:(e,t)=>{var n=t.getState();if(!1!==n.rootProps.accessibilityLayer){var{keyboardInteraction:r}=n.tooltip;if(!r.active&&null==r.index){var i=ex(n,"axis","hover",String("0"));t.dispatch(Cb({activeDataKey:void 0,active:!0,activeIndex:"0",activeCoordinate:i}))}}}});var hj=Oa("externalEvent"),pj=po(),yj=new Map;pj.startListening({actionCreator:hj,effect:(e,t)=>{var{handler:n,reactEvent:r}=e.payload;if(null!=n){r.persist();var i=r.type,a=yj.get(i);void 0!==a&&cancelAnimationFrame(a);var o=requestAnimationFrame(()=>{try{var e=t.getState(),a={activeCoordinate:Nw(e),activeDataKey:Tw(e),activeIndex:Mw(e),activeLabel:Cw(e),activeTooltipIndex:Mw(e),isTooltipActive:zw(e)};n(a,r)}finally{yj.delete(i)}});yj.set(i,o)}}});var vj=jr([Fb],e=>e.tooltipItemPayloads),gj=jr([vj,Kb,(e,t,n)=>t,(e,t,n)=>n],(e,t,n,r)=>{var i=e.find(e=>e.settings.dataKey===r);if(null!=i){var{positions:a}=i;if(null!=a)return t(a,n)}}),mj=Oa("touchMove"),bj=po();bj.startListening({actionCreator:mj,effect:(e,t)=>{var n=e.payload;if(null!=n.touches&&0!==n.touches.length){var r=t.getState(),i=vb(r,r.tooltip.settings.shared);if("axis"===i){var a=GS(r,ZS({clientX:n.touches[0].clientX,clientY:n.touches[0].clientY,currentTarget:n.currentTarget}));null!=(null==a?void 0:a.activeIndex)&&t.dispatch(jb({activeIndex:a.activeIndex,activeDataKey:void 0,activeCoordinate:a.activeCoordinate}))}else if("item"===i){var o,c=n.touches[0];if(null==document.elementFromPoint)return;var l=document.elementFromPoint(c.clientX,c.clientY);if(!l||!l.getAttribute)return;var u=l.getAttribute("data-recharts-item-index"),s=null!==(o=l.getAttribute("data-recharts-item-data-key"))&&void 0!==o?o:void 0,f=gj(t.getState(),u,s);t.dispatch(Pb({activeDataKey:s,activeIndex:u,activeCoordinate:f}))}}}});var wj=oi({brush:OA,cartesianAxis:DP,chartData:Ux,errorBars:qP,graphicalItems:sP,layout:xo,legend:zl,options:Nx,polarAxis:C_,polarOptions:uj,referenceElements:CA,rootProps:aj,tooltip:Tb,zIndex:gx});function xj(e){var{preloadedState:t,children:n,reduxStoreName:i}=e,a=ic(),o=r.useRef(null);if(a)return n;null==o.current&&(o.current=function(e){return function(e){const t=function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:i=!0}=e??{};let a=new _a;return t&&("boolean"==typeof t?a.push(ba):a.push(wa(t.extraArgument))),a},{reducer:n,middleware:r,devTools:i=!0,preloadedState:a,enhancers:o}=e||{};let c,l;if("function"==typeof n)c=n;else{if(!ii(n))throw new Error(yo(1));c=oi(n)}l="function"==typeof r?r(t):t();let u=ci;i&&(u=xa({trace:!1,..."object"==typeof i&&i}));const s=function(...e){return t=>(n,r)=>{const i=t(n,r);let a=()=>{throw new Error(ei(15))};const o={getState:i.getState,dispatch:(e,...t)=>a(e,...t)},c=e.map(e=>e(o));return a=ci(...c)(i.dispatch),{...i,dispatch:a}}}(...l),f=(e=>function(t){const{autoBatch:n=!0}=t??{};let r=new _a(e);return n&&r.push(ka("object"==typeof n?n:void 0)),r})(s);return ai(c,a,u(..."function"==typeof o?o(f):f()))}({reducer:wj,preloadedState:e,middleware:e=>e({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes("es6")}).concat([JS.middleware,tj.middleware,dj.middleware,pj.middleware,bj.middleware]),enhancers:e=>{var t=e;return"function"==typeof e&&(t=e()),t.concat(ka({type:"raf"}))},devTools:false})}(t));var c=yr;return r.createElement(sA,{context:c,store:o.current},n)}function Oj(e){var{layout:t,margin:n}=e,i=gr(),a=ic();return r.useEffect(()=>{a||(i(mo(t)),i(go(n)))},[i,a,t,n]),null}var _j=r.memo(Oj,hA);function Pj(e){var t=gr();return r.useEffect(()=>{t(oj(e))},[t,e]),null}function Aj(e){var{zIndex:t,isPanorama:n}=e,i=tP("".concat(n?"recharts-zindex-panorama-":"recharts-zindex-").concat(t)),a=gr();return r.useLayoutEffect(()=>(a(yx({zIndex:t,elementId:i,isPanorama:n})),()=>{a(vx({zIndex:t,isPanorama:n}))}),[a,t,i,n]),r.createElement("g",{tabIndex:-1,id:i})}function Ej(e){var{children:t,isPanorama:n}=e,i=xr(ox);if(!i||0===i.length)return t;var a=i.filter(e=>e<0),o=i.filter(e=>e>0);return r.createElement(r.Fragment,null,a.map(e=>r.createElement(Aj,{key:e,zIndex:e,isPanorama:n})),t,o.map(e=>r.createElement(Aj,{key:e,zIndex:e,isPanorama:n})))}var Sj=["children"];function jj(){return jj=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=zc(),i=Lc(),a=Zl();if(!Oc(n)||!Oc(i))return null;var o,c,{children:l,otherAttributes:u,title:s,desc:f}=e;return null!=u&&(o="number"==typeof u.tabIndex?u.tabIndex:a?0:void 0,c="string"==typeof u.role?u.role:a?"application":void 0),r.createElement(P,jj({},u,{title:s,desc:f,role:c,tabIndex:o,width:n,height:i,style:kj,ref:t}),l)}),Cj=e=>{var{children:t}=e,n=xr(oc);if(!n)return null;var{width:i,height:a,y:o,x:c}=n;return r.createElement(P,{width:i,height:a,x:c,y:o},t)},Tj=r.forwardRef((e,t)=>{var{children:n}=e,i=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r(qx(),null);function Rj(e){if("number"==typeof e)return e;if("string"==typeof e){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var Bj=r.forwardRef((e,t)=>{var n,i,a=r.useRef(null),[o,c]=r.useState({containerWidth:Rj(null===(n=e.style)||void 0===n?void 0:n.width),containerHeight:Rj(null===(i=e.style)||void 0===i?void 0:i.height)}),l=r.useCallback((e,t)=>{c(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]),u=r.useCallback(e=>{if("function"==typeof t&&t(e),null!=e&&"undefined"!=typeof ResizeObserver){var{width:n,height:r}=e.getBoundingClientRect();l(n,r);var i=new ResizeObserver(e=>{var{width:t,height:n}=e[0].contentRect;l(t,n)});i.observe(e),a.current=i}},[t,l]);return r.useEffect(()=>()=>{var e=a.current;null!=e&&e.disconnect()},[l]),r.createElement(r.Fragment,null,r.createElement(Kc,{width:o.containerWidth,height:o.containerHeight}),r.createElement("div",zj({ref:u},e)))}),Kj=r.forwardRef((e,t)=>{var{width:n,height:i}=e,[a,o]=r.useState({containerWidth:Rj(n),containerHeight:Rj(i)}),c=r.useCallback((e,t)=>{o(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]),l=r.useCallback(e=>{if("function"==typeof t&&t(e),null!=e){var{width:n,height:r}=e.getBoundingClientRect();c(n,r)}},[t,c]);return r.createElement(r.Fragment,null,r.createElement(Kc,{width:a.containerWidth,height:a.containerHeight}),r.createElement("div",zj({ref:l},e)))}),Fj=r.forwardRef((e,t)=>{var{width:n,height:i}=e;return r.createElement(r.Fragment,null,r.createElement(Kc,{width:n,height:i}),r.createElement("div",zj({ref:t},e)))}),Uj=r.forwardRef((e,t)=>{var{width:n,height:i}=e;return rt(n)||rt(i)?r.createElement(Kj,zj({},e,{ref:t})):r.createElement(Fj,zj({},e,{ref:t}))}),Wj=r.forwardRef((e,t)=>{var{children:n,className:i,height:a,onClick:o,onContextMenu:c,onDoubleClick:u,onMouseDown:s,onMouseEnter:f,onMouseLeave:d,onMouseMove:h,onMouseUp:p,onTouchEnd:y,onTouchMove:v,onTouchStart:g,style:m,width:b,responsive:w,dispatchTouchEvents:x=!0}=e,O=r.useRef(null),_=gr(),[P,A]=r.useState(null),[E,S]=r.useState(null),k=function(){var e=gr(),[t,n]=r.useState(null),i=xr(Fo);return r.useEffect(()=>{if(null!=t){var n=t.getBoundingClientRect().width/t.offsetWidth;xc(n)&&n!==i&&e(wo(n))}},[t,e,i]),n}(),M=kc(),C=(null==M?void 0:M.width)>0?M.width:b,T=(null==M?void 0:M.height)>0?M.height:a,I=r.useCallback(e=>{k(e),"function"==typeof t&&t(e),A(e),S(e),null!=e&&(O.current=e)},[k,t,A,S]),D=r.useCallback(e=>{_(QS(e)),_(hj({handler:o,reactEvent:e}))},[_,o]),N=r.useCallback(e=>{_(ej(e)),_(hj({handler:f,reactEvent:e}))},[_,f]),z=r.useCallback(e=>{_(Eb()),_(hj({handler:d,reactEvent:e}))},[_,d]),L=r.useCallback(e=>{_(ej(e)),_(hj({handler:h,reactEvent:e}))},[_,h]),R=r.useCallback(()=>{_(fj())},[_]),B=r.useCallback(e=>{_(sj(e.key))},[_]),K=r.useCallback(e=>{_(hj({handler:c,reactEvent:e}))},[_,c]),F=r.useCallback(e=>{_(hj({handler:u,reactEvent:e}))},[_,u]),U=r.useCallback(e=>{_(hj({handler:s,reactEvent:e}))},[_,s]),W=r.useCallback(e=>{_(hj({handler:p,reactEvent:e}))},[_,p]),$=r.useCallback(e=>{_(hj({handler:g,reactEvent:e}))},[_,g]),H=r.useCallback(e=>{x&&_(mj(e)),_(hj({handler:v,reactEvent:e}))},[_,x,v]),V=r.useCallback(e=>{_(hj({handler:y,reactEvent:e}))},[_,y]),q=function(e){return!0===e?Bj:Uj}(w);return r.createElement(Sx.Provider,{value:P},r.createElement(j.Provider,{value:E},r.createElement(q,{width:null!=C?C:null==m?void 0:m.width,height:null!=T?T:null==m?void 0:m.height,className:l("recharts-wrapper",i),style:Dj({position:"relative",cursor:"default",width:C,height:T},m),onClick:D,onContextMenu:K,onDoubleClick:F,onFocus:R,onKeyDown:B,onMouseDown:U,onMouseEnter:N,onMouseLeave:z,onMouseMove:L,onMouseUp:W,onTouchEnd:V,onTouchMove:H,onTouchStart:$,ref:I},r.createElement(Lj,null),n)))}),$j=["width","height","responsive","children","className","style","compact","title","desc"],Hj=r.forwardRef((e,t)=>{var{width:n,height:i,responsive:a,children:o,className:c,style:l,compact:u,title:s,desc:f}=e,d=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;rr.createElement(Xj,{chartName:"LineChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:Gj,tooltipPayloadSearcher:Ix,categoricalChartProps:e,ref:t})),Qj={},Jj={},ek={};function tk(){return qj||(qj=1,e=ek,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e.isBuffer=function(e){return"undefined"!=typeof Buffer&&Buffer.isBuffer(e)}),ek;var e}var nk,rk={};function ik(){return nk||(nk=1,e=rk,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e.isPrototype=function(e){const t=null==e?void 0:e.constructor;return e===("function"==typeof t?t.prototype:Object.prototype)}),rk;var e}var ak,ok={};function ck(){return ak||(ak=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Cn();e.isTypedArray=function(e){return t.isTypedArray(e)}}(ok)),ok}var lk,uk,sk,fk={},dk={};function hk(){return lk||(lk=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=xs();e.toInteger=function(e){const n=t.toFinite(e),r=n%1;return r?n-r:n}}(dk)),dk}function pk(){return uk||(uk=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=hk();e.times=function(e,n){if((e=t.toInteger(e))<1||!Number.isSafeInteger(e))return[];const r=new Array(e);for(let t=0;t`${e}`),r=new Set(n);t.isBuffer(e)&&(r.add("offset"),r.add("parent")),i.isTypedArray(e)&&(r.add("buffer"),r.add("byteLength"),r.add("byteOffset"));const c=o(e).filter(e=>!r.has(e));return Array.isArray(e)?[...n,...c]:[...n.filter(t=>Object.hasOwn(e,t)),...c]}(e):n.isPrototype(e)?function(e){return o(e).filter(e=>"constructor"!==e)}(e):o(e);default:return o(Object(e))}}}(Jj)),Jj}var vk,gk={};function mk(){return vk||(vk=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Qe(),n=ze(),r=Be(),i=Ue(),a=Ze();function o(e,r){const i=1===r.length?e:t.get(e,r.slice(0,-1)),a=r[r.length-1];if(void 0===(null==i?void 0:i[a]))return!0;if(n.isUnsafeProperty(a))return!1;try{return delete i[a],!0}catch{return!1}}e.unset=function(e,t){if(null==e)return!0;switch(typeof t){case"symbol":case"number":case"object":if(Array.isArray(t))return o(e,t);if("number"==typeof t?t=i.toKey(t):"object"==typeof t&&(t=Object.is(null==t?void 0:t.valueOf(),-0)?"-0":String(t)),n.isUnsafeProperty(t))return!1;if(void 0===(null==e?void 0:e[t]))return!0;try{return delete e[t],!0}catch{return!1}case"string":if(void 0===(null==e?void 0:e[t])&&r.isDeepKey(t))return o(e,a.toPath(t));if(n.isUnsafeProperty(t))return!1;try{return delete e[t],!0}catch{return!1}}}}(gk)),gk}var bk,wk={};function xk(){return bk||(bk=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=bn();e.getSymbolsIn=function(e){const n=[];for(;e;)n.push(...t.getSymbols(e)),e=Object.getPrototypeOf(e);return n}}(wk)),wk}var Ok,_k,Pk,Ak,Ek={};function Sk(){return Ok||(Ok=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Ut();e.flatten=function(e,n=1){const r=[],i=Math.floor(n);if(!t.isArrayLike(e))return r;const a=(e,t)=>{for(let n=0;nArray.isArray(e)||a.isDeepKey(e))?function(e){const r={},a=[...n.keysIn(e),...i.getSymbolsIn(e)];for(let n=0;n{if(!c.isPlainObject(e))return e})}return r}(e):function(e){const t={},r=[...n.keysIn(e),...i.getSymbolsIn(e)];for(let n=0;n{if(e&&t)return et(e,t)},Lk={chartName:"Treemap",defaultTooltipEventType:"item",validateTooltipEventTypes:["item"],tooltipPayloadSearcher:zk,eventEmitter:void 0},Rk=e=>{var t,{depth:n,node:r,index:i,dataKey:a,nameKey:o,nestedActiveTooltipIndex:c}=e,l=0===n?"":function(e){return"".concat(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"","children[").concat(e,"]")}(i,c),{children:u}=r,s=n+1,f=u&&u.length?u.map((e,t)=>Rk({depth:s,node:e,index:t,dataKey:a,nameKey:o,nestedActiveTooltipIndex:l})):null;return t=f&&f.length?f.reduce((e,t)=>e+t[Nk],0):nt(r[a])||r[a]<=0?0:r[a],Ik(Ik({},r),{},{children:f,name:Eo(r,o,""),[Nk]:t,depth:n,index:i,tooltipIndex:l})},Bk=(e,t,n)=>{var r=t*t,i=e.area*e.area,{min:a,max:o}=e.reduce((e,t)=>({min:Math.min(e.min,t.area),max:Math.max(e.max,t.area)}),{min:1/0,max:0});return i?Math.max(r*o*n/i,i/(r*a*n)):1/0},Kk=(e,t,n,r)=>t===n.width?((e,t,n,r)=>{var i=t?Math.round(e.area/t):0;(r||i>n.height)&&(i=n.height);for(var a,o=n.x,c=0,l=e.length;c{var i=t?Math.round(e.area/t):0;(r||i>n.width)&&(i=n.width);for(var a,o=n.y,c=0,l=e.length;c{var{children:n}=e;if(n&&n.length){var r,i,a=(e=>({x:e.x,y:e.y,width:e.width,height:e.height}))(e),o=[],c=1/0,l=Math.min(a.width,a.height),u=((e,t)=>{var n=t<0?0:t;return e.map(e=>{var t=e[Nk]*n;return Ik(Ik({},e),{},{area:nt(t)||t<=0?0:t})})})(n,a.width*a.height/e[Nk]),s=u.slice();for(o.area=0;s.length>0;){var f,d;o.push(r=s[0]),o.area+=r.area,(i=Bk(o,l,t))<=c?(s.shift(),c=i):(o.area-=null!==(f=null===(d=o.pop())||void 0===d?void 0:d.area)&&void 0!==f?f:0,a=Kk(o,l,a,!1),l=Math.min(a.width,a.height),o.length=o.area=0,c=1/0)}return o.length&&(a=Kk(o,l,a,!0),o.length=o.area=0),Ik(Ik({},e),{},{children:u.map(e=>Fk(e,t))})}return e},Uk={aspectRatio:.5*(1+Math.sqrt(5)),dataKey:"value",nameKey:"name",type:"flat",isAnimationActive:"auto",isUpdateAnimationActive:"auto",animationBegin:0,animationDuration:1500,animationEasing:"linear"},Wk={isAnimationFinished:!1,formatRoot:null,currentRoot:null,nestIndex:[],prevAspectRatio:Uk.aspectRatio,prevDataKey:Uk.dataKey};function $k(e){var{content:t,nodeProps:n,type:i,colorPanel:a,onMouseEnter:o,onMouseLeave:c,onClick:l}=e;if(r.isValidElement(t))return r.createElement(S,{onMouseEnter:o,onMouseLeave:c,onClick:l},r.cloneElement(t,n));if("function"==typeof t)return r.createElement(S,{onMouseEnter:o,onMouseLeave:c,onClick:l},t(n));var{x:u,y:s,width:f,height:d,index:h}=n,p=null;f>10&&d>10&&n.children&&"nest"===i&&(p=r.createElement(w_,{points:[{x:u+2,y:s+d/2},{x:u+6,y:s+d/2+3},{x:u+2,y:s+d/2+6}]}));var y=null,v=lO(n.name);f>20&&d>20&&v.width{t(Pb({activeIndex:e.nodeProps.tooltipIndex,activeDataKey:e.dataKey,activeCoordinate:n}))},onMouseLeave:()=>{},onClick:()=>{t(Sb({activeIndex:e.nodeProps.tooltipIndex,activeDataKey:e.dataKey,activeCoordinate:n}))}}))}var Vk=r.memo(e=>{var{dataKey:t,nameKey:n,stroke:i,fill:a,currentRoot:o}=e,c={dataDefinedOnItem:o,positions:void 0,settings:{stroke:i,strokeWidth:void 0,fill:a,dataKey:t,nameKey:n,name:void 0,hide:!1,type:void 0,color:a,unit:""}};return r.createElement(Q_,{tooltipEntrySettings:c})}),qk={top:0,right:0,bottom:0,left:0};function Yk(e){var{content:t,nodeProps:n,isLeaf:i,treemapProps:a,onNestClick:o}=e,{isAnimationActive:c,animationBegin:l,animationDuration:u,animationEasing:s,isUpdateAnimationActive:f,type:d,colorPanel:h,dataKey:p,onAnimationStart:y,onAnimationEnd:v,onMouseEnter:g,onClick:m,onMouseLeave:b}=a,{width:w,height:x,x:O,y:_}=n,P=-O-w,A=e=>{!i&&"nest"!==d||"function"!=typeof g||g(n,e)},E=e=>{!i&&"nest"!==d||"function"!=typeof b||b(n,e)},j=()=>{"nest"===d&&o(n),!i&&"nest"!==d||"function"!=typeof m||m(n)},k=r.useCallback(()=>{"function"==typeof v&&v()},[v]),M=r.useCallback(()=>{"function"==typeof y&&y()},[y]);return r.createElement(XS,{animationId:"treemap-".concat(n.tooltipIndex),from:"translate(".concat(P,"px, ").concat(0,"px)"),to:"translate(0, 0)",attributeName:"transform",begin:l,easing:s,isActive:c,duration:u,onAnimationStart:M,onAnimationEnd:k},e=>r.createElement(S,{onMouseEnter:A,onMouseLeave:E,onClick:j,style:Ik(Ik({},e),{},{transformOrigin:"".concat(O," ").concat(_)})},r.createElement(Hk,{content:t,dataKey:p,nodeProps:Ik(Ik({},n),{},{isAnimationActive:c,isUpdateAnimationActive:!f,width:w,height:x,x:O,y:_}),type:d,colorPanel:h})))}class Xk extends r.PureComponent{constructor(){super(...arguments),Dk(this,"state",Ik({},Wk)),Dk(this,"handleClick",e=>{var{onClick:t,type:n}=this.props;if("nest"===n&&e.children){var{width:r,height:i,dataKey:a,nameKey:o,aspectRatio:c}=this.props,l=Rk({depth:0,node:Ik(Ik({},e),{},{x:0,y:0,width:r,height:i}),index:0,dataKey:a,nameKey:o,nestedActiveTooltipIndex:e.tooltipIndex}),u=Fk(l,c),{nestIndex:s}=this.state;s.push(e),this.setState({formatRoot:u,currentRoot:l,nestIndex:s})}t&&t(e)}),Dk(this,"handleTouchMove",e=>{var t=e.touches[0],n=document.elementFromPoint(t.clientX,t.clientY);if(n&&n.getAttribute&&null!=this.state.formatRoot){var r=n.getAttribute("data-recharts-item-index"),i=zk(this.state.formatRoot,r);if(i){var{dataKey:a,dispatch:o}=this.props,c={x:i.x+i.width/2,y:i.y+i.height/2};o(Pb({activeIndex:r,activeDataKey:a,activeCoordinate:c}))}}})}static getDerivedStateFromProps(e,t){if(e.data!==t.prevData||e.type!==t.prevType||e.width!==t.prevWidth||e.height!==t.prevHeight||e.dataKey!==t.prevDataKey||e.aspectRatio!==t.prevAspectRatio){var n=Rk({depth:0,node:{children:e.data,x:0,y:0,width:e.width,height:e.height},index:0,dataKey:e.dataKey,nameKey:e.nameKey}),r=Fk(n,e.aspectRatio);return Ik(Ik({},t),{},{formatRoot:r,currentRoot:n,nestIndex:[n],prevAspectRatio:e.aspectRatio,prevData:e.data,prevWidth:e.width,prevHeight:e.height,prevDataKey:e.dataKey,prevType:e.type})}return null}handleNestIndex(e,t){var{nestIndex:n}=this.state,{width:r,height:i,dataKey:a,nameKey:o,aspectRatio:c}=this.props,l=Rk({depth:0,node:Ik(Ik({},e),{},{x:0,y:0,width:r,height:i}),index:0,dataKey:a,nameKey:o,nestedActiveTooltipIndex:e.tooltipIndex}),u=Fk(l,c);n=n.slice(0,t+1),this.setState({formatRoot:u,currentRoot:e,nestIndex:n})}renderNode(e,t){var{content:n,type:i}=this.props,a=Ik(Ik(Ik({},b(this.props)),t),{},{root:e}),o=!t.children||!t.children.length,{currentRoot:c}=this.state;return!((null==c?void 0:c.children)||[]).filter(e=>e.depth===t.depth&&e.name===t.name).length&&e.depth&&"nest"===i?null:r.createElement(S,{key:"recharts-treemap-node-".concat(a.x,"-").concat(a.y,"-").concat(a.name),className:"recharts-treemap-depth-".concat(t.depth)},r.createElement(Yk,{isLeaf:o,content:n,nodeProps:a,treemapProps:this.props,onNestClick:this.handleClick}),t.children&&t.children.length?t.children.map(e=>this.renderNode(t,e)):null)}renderAllNodes(){var{formatRoot:e}=this.state;return e?this.renderNode(e,e):null}renderNestIndex(){var{nameKey:e,nestIndexContent:t}=this.props,{nestIndex:n}=this.state;return r.createElement("div",{className:"recharts-treemap-nest-index-wrapper",style:{marginTop:"8px",textAlign:"center"}},n.map((n,i)=>{var a,o=et(n,e,"root");return r.isValidElement(t)&&(a=r.cloneElement(t,n,i)),a="function"==typeof t?t(n,i):o,r.createElement("div",{onClick:this.handleNestIndex.bind(this,n,i),key:"nest-index-".concat(ct()),className:"recharts-treemap-nest-index-box",style:{cursor:"pointer",display:"inline-block",padding:"0 7px",background:"#000",color:"#fff",marginRight:"3px"}},a)}))}render(){var e=this.props,{width:t,height:n,className:i,style:a,children:o,type:c}=e,l=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{null==l&&null!=e&&u(e)},onMouseEnter:void 0,onMouseLeave:void 0,onClick:void 0,onMouseMove:void 0,onMouseDown:void 0,onMouseUp:void 0,onContextMenu:void 0,onDoubleClick:void 0,onTouchStart:void 0,onTouchMove:void 0,onTouchEnd:void 0},r.createElement(Sx.Provider,{value:l},r.createElement(Gk,n))))}Dk(Xk,"displayName","Treemap");var Qk=["axis"],Jk=r.forwardRef((e,t)=>r.createElement(Xj,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:Qk,tooltipPayloadSearcher:Ix,categoricalChartProps:e,ref:t})),eM="http://www.w3.org/1999/xhtml";const tM={svg:"http://www.w3.org/2000/svg",xhtml:eM,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function nM(e){var t=e+="",n=t.indexOf(":");return n>=0&&"xmlns"!==(t=e.slice(0,n))&&(e=e.slice(n+1)),tM.hasOwnProperty(t)?{space:tM[t],local:e}:e}function rM(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===eM&&t.documentElement.namespaceURI===eM?t.createElement(e):t.createElementNS(n,e)}}function iM(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function aM(e){var t=nM(e);return(t.local?iM:rM)(t)}function oM(){}function cM(e){return null==e?oM:function(){return this.querySelector(e)}}function lM(){return[]}function uM(e){return null==e?lM:function(){return this.querySelectorAll(e)}}function sM(e){return function(){return this.matches(e)}}function fM(e){return function(t){return t.matches(e)}}var dM=Array.prototype.find;function hM(){return this.firstElementChild}var pM=Array.prototype.filter;function yM(){return Array.from(this.children)}function vM(e){return new Array(e.length)}function gM(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}function mM(e,t,n,r,i,a){for(var o,c=0,l=t.length,u=a.length;ct?1:e>=t?0:NaN}function _M(e){return function(){this.removeAttribute(e)}}function PM(e){return function(){this.removeAttributeNS(e.space,e.local)}}function AM(e,t){return function(){this.setAttribute(e,t)}}function EM(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function SM(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttribute(e):this.setAttribute(e,n)}}function jM(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function kM(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function MM(e){return function(){this.style.removeProperty(e)}}function CM(e,t,n){return function(){this.style.setProperty(e,t,n)}}function TM(e,t,n){return function(){var r=t.apply(this,arguments);null==r?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function IM(e,t){return e.style.getPropertyValue(t)||kM(e).getComputedStyle(e,null).getPropertyValue(t)}function DM(e){return function(){delete this[e]}}function NM(e,t){return function(){this[e]=t}}function zM(e,t){return function(){var n=t.apply(this,arguments);null==n?delete this[e]:this[e]=n}}function LM(e){return e.trim().split(/^|\s+/)}function RM(e){return e.classList||new BM(e)}function BM(e){this._node=e,this._names=LM(e.getAttribute("class")||"")}function KM(e,t){for(var n=RM(e),r=-1,i=t.length;++r=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};var lC=[null];function uC(e,t){this._groups=e,this._parents=t}function sC(){return new uC([[document.documentElement]],lC)}function fC(e){return"string"==typeof e?new uC([[document.querySelector(e)]],[document.documentElement]):new uC([[e]],lC)}function dC(e,t){if(e=function(e){let t;for(;t=e.sourceEvent;)e=t;return e}(e),void 0===t&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,[(r=r.matrixTransform(t.getScreenCTM().inverse())).x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}uC.prototype=sC.prototype={constructor:uC,select:function(e){"function"!=typeof e&&(e=cM(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i=x&&(x=w+1);!(b=g[x])&&++x=0;)(r=i[a])&&(o&&4^r.compareDocumentPosition(o)&&o.parentNode.insertBefore(r,o),o=r);return this},sort:function(e){function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}e||(e=OM);for(var n=this._groups,r=n.length,i=new Array(r),a=0;a1?this.each((null==t?MM:"function"==typeof t?TM:CM)(e,t,null==n?"":n)):IM(this.node(),e)},property:function(e,t){return arguments.length>1?this.each((null==t?DM:"function"==typeof t?zM:NM)(e,t)):this.node()[e]},classed:function(e,t){var n=LM(e+"");if(arguments.length<2){for(var r=RM(this.node()),i=-1,a=n.length;++i=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}(e+""),o=a.length;if(!(arguments.length<2)){for(c=t?iC:rC,r=0;r{}};function pC(){for(var e,t=0,n=arguments.length,r={};t=0&&(t=e.slice(n+1),e=e.slice(0,n)),e&&!r.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:t}})),o=-1,c=a.length;if(!(arguments.length<2)){if(null!=t&&"function"!=typeof t)throw new Error("invalid callback: "+t);for(;++o0)for(var n,r,i=new Array(n),a=0;a=0&&t._call.call(void 0,e),t=t._next;--wC}()}finally{wC=0,function(){for(var e,t,n=mC,r=1/0;n;)n._call?(r>n._time&&(r=n._time),e=n,n=n._next):(t=n._next,n._next=null,n=e?e._next=t:mC=t);bC=e,DC(r)}(),PC=0}}function IC(){var e=EC.now(),t=e-_C;t>1e3&&(AC-=t,_C=e)}function DC(e){wC||(xC&&(xC=clearTimeout(xC)),e-PC>24?(e<1/0&&(xC=setTimeout(TC,e-EC.now()-AC)),OC&&(OC=clearInterval(OC))):(OC||(_C=EC.now(),OC=setInterval(IC,1e3)),wC=1,SC(TC)))}function NC(e,t,n){var r=new MC;return t=null==t?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}MC.prototype=CC.prototype={constructor:MC,restart:function(e,t,n){if("function"!=typeof e)throw new TypeError("callback is not a function");n=(null==n?jC():+n)+(null==t?0:+t),this._next||bC===this||(bC?bC._next=this:mC=this,bC=this),this._call=e,this._time=n,DC()},stop:function(){this._call&&(this._call=null,this._time=1/0,DC())}};var zC=pC("start","end","cancel","interrupt"),LC=[];function RC(e,t,n,r,i,a){var o=e.__transition;if(o){if(n in o)return}else e.__transition={};!function(e,t,n){var r,i=e.__transition;function a(l){var u,s,f,d;if(1!==n.state)return c();for(u in i)if((d=i[u]).name===n.name){if(3===d.state)return NC(a);4===d.state?(d.state=6,d.timer.stop(),d.on.call("interrupt",e,e.__data__,d.index,d.group),delete i[u]):+u0)throw new Error("too late; already scheduled");return n}function KC(e,t){var n=FC(e,t);if(n.state>3)throw new Error("too late; already running");return n}function FC(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function UC(e,t){var n,r,i,a=e.__transition,o=!0;if(a){for(i in t=null==t?null:t+"",a)(n=a[i]).name===t?(r=n.state>2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(r?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete a[i]):o=!1;o&&delete e.__transition}}function WC(e,t){var n,r;return function(){var i=KC(this,e),a=i.tween;if(a!==n)for(var o=0,c=(r=n=a).length;o=0&&(e=e.slice(0,t)),!e||"start"===e})}(t)?BC:KC;return function(){var o=a(this,e),c=o.on;c!==r&&(i=(r=c).copy()).on(t,n),o.on=i}}(n,e,t))},attr:function(e,t){var n=nM(e),r="transform"===n?bd:VC;return this.attrTween(e,"function"==typeof t?(n.local?QC:ZC)(n,r,HC(this,"attr."+e,t)):null==t?(n.local?YC:qC)(n):(n.local?GC:XC)(n,r,t))},attrTween:function(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!=typeof t)throw new Error;var r=nM(e);return this.tween(n,(r.local?JC:eT)(r,t))},style:function(e,t,n){var r="transform"==(e+="")?md:VC;return null==t?this.styleTween(e,function(e,t){var n,r,i;return function(){var a=IM(this,e),o=(this.style.removeProperty(e),IM(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}(e,r)).on("end.style."+e,oT(e)):"function"==typeof t?this.styleTween(e,function(e,t,n){var r,i,a;return function(){var o=IM(this,e),c=n(this),l=c+"";return null==c&&(this.style.removeProperty(e),l=c=IM(this,e)),o===l?null:o===r&&l===i?a:(i=l,a=t(r=o,c))}}(e,r,HC(this,"style."+e,t))).each(function(e,t){var n,r,i,a,o="style."+t,c="end."+o;return function(){var l=KC(this,e),u=l.on,s=null==l.value[o]?a||(a=oT(t)):void 0;u===n&&i===s||(r=(n=u).copy()).on(c,i=s),l.on=r}}(this._id,e)):this.styleTween(e,function(e,t,n){var r,i,a=n+"";return function(){var o=IM(this,e);return o===a?null:o===r?i:i=t(r=o,n)}}(e,r,t),n).on("end.style."+e,null)},styleTween:function(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==t)return this.tween(r,null);if("function"!=typeof t)throw new Error;return this.tween(r,function(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&function(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}(e,a,n)),r}return a._value=t,a}(e,t,null==n?"":n))},text:function(e){return this.tween("text","function"==typeof e?function(e){return function(){var t=e(this);this.textContent=null==t?"":t}}(HC(this,"text",e)):function(e){return function(){this.textContent=e}}(null==e?"":e+""))},textTween:function(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(null==e)return this.tween(t,null);if("function"!=typeof e)throw new Error;return this.tween(t,function(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&function(e){return function(t){this.textContent=e.call(this,t)}}(r)),t}return r._value=e,r}(e))},remove:function(){return this.on("end.remove",(e=this._id,function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}));var e},tween:function(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r,i=FC(this.node(),n).tween,a=0,o=i.length;a+e(t)}function gT(e,t){return t=Math.max(0,e.bandwidth()-2*t)/2,e.round()&&(t=Math.round(t)),n=>+e(n)+t}function mT(){return!this.__axis}function bT(e,t){var n=[],r=null,i=null,a=6,o=6,c=3,l="undefined"!=typeof window&&window.devicePixelRatio>1?0:.5,u=yT;function s(e){var s=null==r?t.ticks?t.ticks.apply(t,n):t.domain():r,f=null==i?t.tickFormat?t.tickFormat.apply(t,n):hT:i,d=Math.max(a,0)+c,h=t.range(),p=+h[0]+l,y=+h[h.length-1]+l,v=(t.bandwidth?gT:vT)(t.copy(),l),g=e.selection?e.selection():e,m=g.selectAll(".domain").data([null]),b=g.selectAll(".tick").data(s,t).order(),w=b.exit(),x=b.enter().append("g").attr("class","tick"),O=b.select("line"),_=b.select("text");m=m.merge(m.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),b=b.merge(x),O=O.merge(x.append("line").attr("stroke","currentColor").attr("y2",1*a)),_=_.merge(x.append("text").attr("fill","currentColor").attr("y",1*d).attr("dy","0.71em")),e!==g&&(m=m.transition(e),b=b.transition(e),O=O.transition(e),_=_.transition(e),w=w.transition(e).attr("opacity",pT).attr("transform",function(e){return isFinite(e=v(e))?u(e+l):this.getAttribute("transform")}),x.attr("opacity",pT).attr("transform",function(e){var t=this.parentNode.__axis;return u((t&&isFinite(t=t(e))?t:v(e))+l)})),w.remove(),m.attr("d",o?"M"+p+","+1*o+"V"+l+"H"+y+"V"+1*o:"M"+p+","+l+"H"+y),b.attr("opacity",1).attr("transform",function(e){return u(v(e)+l)}),O.attr("y2",1*a),_.attr("y",1*d).text(f),g.filter(mT).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor","middle"),g.each(function(){this.__axis=v})}return s.scale=function(e){return arguments.length?(t=e,s):t},s.ticks=function(){return n=Array.from(arguments),s},s.tickArguments=function(e){return arguments.length?(n=null==e?[]:Array.from(e),s):n.slice()},s.tickValues=function(e){return arguments.length?(r=null==e?null:Array.from(e),s):r&&r.slice()},s.tickFormat=function(e){return arguments.length?(i=e,s):i},s.tickSize=function(e){return arguments.length?(a=o=+e,s):a},s.tickSizeInner=function(e){return arguments.length?(a=+e,s):a},s.tickSizeOuter=function(e){return arguments.length?(o=+e,s):o},s.tickPadding=function(e){return arguments.length?(c=+e,s):c},s.offset=function(e){return arguments.length?(l=+e,s):l},s}function wT(e){return bT(0,e)}const xT={capture:!0,passive:!1};function OT(e){e.preventDefault(),e.stopImmediatePropagation()}const _T=e=>()=>e;function PT(e,{sourceEvent:t,target:n,selection:r,mode:i,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},selection:{value:r,enumerable:!0,configurable:!0},mode:{value:i,enumerable:!0,configurable:!0},_:{value:a}})}function AT(e){e.preventDefault(),e.stopImmediatePropagation()}var ET={name:"drag"},ST={name:"space"},jT={name:"handle"},kT={name:"center"};const{abs:MT,max:CT,min:TT}=Math;function IT(e){return[+e[0],+e[1]]}function DT(e){return[IT(e[0]),IT(e[1])]}var NT={name:"x",handles:["w","e"].map(WT),input:function(e,t){return null==e?null:[[+e[0],t[0][1]],[+e[1],t[1][1]]]},output:function(e){return e&&[e[0][0],e[1][0]]}},zT={},LT={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(WT),input:function(e){return null==e?null:DT(e)},output:function(e){return e}},RT={overlay:"crosshair",selection:"move",n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},BT={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},KT={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},FT={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},UT={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function WT(e){return{type:e}}function $T(e){return!e.ctrlKey&&!e.button}function HT(){var e=this.ownerSVGElement||this;return e.hasAttribute("viewBox")?[[(e=e.viewBox.baseVal).x,e.y],[e.x+e.width,e.y+e.height]]:[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]}function VT(){return navigator.maxTouchPoints||"ontouchstart"in this}function qT(e){for(;!e.__brush;)if(!(e=e.parentNode))return;return e.__brush}function YT(){return GT(NT)}function XT(){return GT(LT)}function GT(e){var t,n=HT,r=$T,i=VT,a=!0,o=pC("start","brush","end"),c=6;function l(t){var n=t.property("__brush",y).selectAll(".overlay").data([WT("overlay")]);n.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",RT.overlay).merge(n).each(function(){var e=qT(this).extent;fC(this).attr("x",e[0][0]).attr("y",e[0][1]).attr("width",e[1][0]-e[0][0]).attr("height",e[1][1]-e[0][1])}),t.selectAll(".selection").data([WT("selection")]).enter().append("rect").attr("class","selection").attr("cursor",RT.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var r=t.selectAll(".handle").data(e.handles,function(e){return e.type});r.exit().remove(),r.enter().append("rect").attr("class",function(e){return"handle handle--"+e.type}).attr("cursor",function(e){return RT[e.type]}),t.each(u).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",d).filter(i).on("touchstart.brush",d).on("touchmove.brush",h).on("touchend.brush touchcancel.brush",p).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function u(){var e=fC(this),t=qT(this).selection;t?(e.selectAll(".selection").style("display",null).attr("x",t[0][0]).attr("y",t[0][1]).attr("width",t[1][0]-t[0][0]).attr("height",t[1][1]-t[0][1]),e.selectAll(".handle").style("display",null).attr("x",function(e){return"e"===e.type[e.type.length-1]?t[1][0]-c/2:t[0][0]-c/2}).attr("y",function(e){return"s"===e.type[0]?t[1][1]-c/2:t[0][1]-c/2}).attr("width",function(e){return"n"===e.type||"s"===e.type?t[1][0]-t[0][0]+c:c}).attr("height",function(e){return"e"===e.type||"w"===e.type?t[1][1]-t[0][1]+c:c})):e.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function s(e,t,n){var r=e.__brush.emitter;return!r||n&&r.clean?new f(e,t,n):r}function f(e,t,n){this.that=e,this.args=t,this.state=e.__brush,this.active=0,this.clean=n}function d(n){if((!t||n.touches)&&r.apply(this,arguments)){var i,o,c,l,f,d,h,p,y,v,g,m=this,b=n.target.__data__.type,w="selection"===(a&&n.metaKey?b="overlay":b)?ET:a&&n.altKey?kT:jT,x=e===zT?null:FT[b],O=e===NT?null:UT[b],_=qT(m),P=_.extent,A=_.selection,E=P[0][0],S=P[0][1],j=P[1][0],k=P[1][1],M=0,C=0,T=x&&O&&a&&n.shiftKey,I=Array.from(n.touches||[n],e=>{const t=e.identifier;return(e=dC(e,m)).point0=e.slice(),e.identifier=t,e});UC(m);var D=s(m,arguments,!0).beforestart();if("overlay"===b){A&&(y=!0);const t=[I[0],I[1]||I[0]];_.selection=A=[[i=e===zT?E:TT(t[0][0],t[1][0]),c=e===NT?S:TT(t[0][1],t[1][1])],[f=e===zT?j:CT(t[0][0],t[1][0]),h=e===NT?k:CT(t[0][1],t[1][1])]],I.length>1&&B(n)}else i=A[0][0],c=A[0][1],f=A[1][0],h=A[1][1];o=i,l=c,d=f,p=h;var N=fC(m).attr("pointer-events","none"),z=N.selectAll(".overlay").attr("cursor",RT[b]);if(n.touches)D.moved=R,D.ended=K;else{var L=fC(n.view).on("mousemove.brush",R,!0).on("mouseup.brush",K,!0);a&&L.on("keydown.brush",function(e){switch(e.keyCode){case 16:T=x&&O;break;case 18:w===jT&&(x&&(f=d-M*x,i=o+M*x),O&&(h=p-C*O,c=l+C*O),w=kT,B(e));break;case 32:w!==jT&&w!==kT||(x<0?f=d-M:x>0&&(i=o-M),O<0?h=p-C:O>0&&(c=l-C),w=ST,z.attr("cursor",RT.selection),B(e));break;default:return}AT(e)},!0).on("keyup.brush",function(e){switch(e.keyCode){case 16:T&&(v=g=T=!1,B(e));break;case 18:w===kT&&(x<0?f=d:x>0&&(i=o),O<0?h=p:O>0&&(c=l),w=jT,B(e));break;case 32:w===ST&&(e.altKey?(x&&(f=d-M*x,i=o+M*x),O&&(h=p-C*O,c=l+C*O),w=kT):(x<0?f=d:x>0&&(i=o),O<0?h=p:O>0&&(c=l),w=jT),z.attr("cursor",RT[b]),B(e));break;default:return}AT(e)},!0),function(e){var t=e.document.documentElement,n=fC(e).on("dragstart.drag",OT,xT);"onselectstart"in t?n.on("selectstart.drag",OT,xT):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}(n.view)}u.call(m),D.start(n,w.name)}function R(e){for(const t of e.changedTouches||[e])for(const e of I)e.identifier===t.identifier&&(e.cur=dC(t,m));if(T&&!v&&!g&&1===I.length){const e=I[0];MT(e.cur[0]-e[0])>MT(e.cur[1]-e[1])?g=!0:v=!0}for(const t of I)t.cur&&(t[0]=t.cur[0],t[1]=t.cur[1]);y=!0,AT(e),B(e)}function B(e){const t=I[0],n=t.point0;var r;switch(M=t[0]-n[0],C=t[1]-n[1],w){case ST:case ET:x&&(M=CT(E-i,TT(j-f,M)),o=i+M,d=f+M),O&&(C=CT(S-c,TT(k-h,C)),l=c+C,p=h+C);break;case jT:I[1]?(x&&(o=CT(E,TT(j,I[0][0])),d=CT(E,TT(j,I[1][0])),x=1),O&&(l=CT(S,TT(k,I[0][1])),p=CT(S,TT(k,I[1][1])),O=1)):(x<0?(M=CT(E-i,TT(j-i,M)),o=i+M,d=f):x>0&&(M=CT(E-f,TT(j-f,M)),o=i,d=f+M),O<0?(C=CT(S-c,TT(k-c,C)),l=c+C,p=h):O>0&&(C=CT(S-h,TT(k-h,C)),l=c,p=h+C));break;case kT:x&&(o=CT(E,TT(j,i-M*x)),d=CT(E,TT(j,f+M*x))),O&&(l=CT(S,TT(k,c-C*O)),p=CT(S,TT(k,h+C*O)))}d()=>e;function eI(e,t){for(var n,r=-1,i=t.length;++rr!=h>r&&n<(d-u)*(r-s)/(h-s)+u&&(i=-i)}return i}function nI(e,t,n){var r;return function(e,t,n){return(t[0]-e[0])*(n[1]-e[1])===(n[0]-e[0])*(t[1]-e[1])}(e,t,n)&&function(e,t,n){return e<=t&&t<=n||n<=t&&t<=e}(e[r=+(e[0]===t[0])],n[r],t[r])}function rI(){}var iI=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function aI(){var e=1,t=1,n=Vs,r=c;function i(e){var t=n(e);if(Array.isArray(t))t=t.slice().sort(QT);else{const n=Ds(e,oI);for(t=Ws(...function(e,t,n){let r;for(;;){const i=$s(e,t,n);if(i===r||0===i||!isFinite(i))return[e,t];i>0?(e=Math.floor(e/i)*i,t=Math.ceil(t/i)*i):i<0&&(e=Math.ceil(e*i)/i,t=Math.floor(t*i)/i),r=i}}(n[0],n[1],t),t);t[t.length-1]>=n[1];)t.pop();for(;t[1]a(e,t))}function a(n,i){const a=null==i?NaN:+i;if(isNaN(a))throw new Error(`invalid value: ${i}`);var c=[],l=[];return function(n,r,i){var a,c,l,u,s,f,d=new Array,h=new Array;for(a=c=-1,u=cI(n[0],r),iI[u<<1].forEach(p);++a=r,iI[s<<2].forEach(p);++a0?c.push([e]):l.push(e)}),l.forEach(function(e){for(var t,n=0,r=c.length;n0&&a0&&o=0&&a>=0))throw new Error("invalid size");return e=r,t=a,i},i.thresholds=function(e){return arguments.length?(n="function"==typeof e?e:Array.isArray(e)?JT(ZT.call(e)):JT(e),i):n},i.smooth=function(e){return arguments.length?(r=e?c:rI,i):r===c},i}function oI(e){return isFinite(e)?e:NaN}function cI(e,t){return null!=e&&+e>=t}function lI(e){return null==e||isNaN(e=+e)?-1/0:e}function uI(e,t,n,r){const i=r-t,a=n-t,o=isFinite(i)||isFinite(a)?i/a:Math.sign(i)/Math.sign(a);return isNaN(o)?e:e+o-.5}function sI(e){return e[0]}function fI(e){return e[1]}function dI(){return 1}function hI(){var e=sI,t=fI,n=dI,r=960,i=500,a=20,o=2,c=3*a,l=r+2*c>>o,u=i+2*c>>o,s=JT(20);function f(r){var i=new Float32Array(l*u),s=Math.pow(2,-o),f=-1;for(const a of r){var d=(e(a,++f,r)+c)*s,h=(t(a,f,r)+c)*s,p=+n(a,f,r);if(p&&d>=0&&d=0&&he*r))(t).map((e,t)=>(e.value=+n[t],h(e)))}function h(e){return e.coordinates.forEach(p),e}function p(e){e.forEach(y)}function y(e){e.forEach(v)}function v(e){e[0]=e[0]*Math.pow(2,o)-c,e[1]=e[1]*Math.pow(2,o)-c}function g(){return l=r+2*(c=3*a)>>o,u=i+2*c>>o,d}return d.contours=function(e){var t=f(e),n=aI().size([l,u]),r=Math.pow(2,2*o),i=e=>{e=+e;var i=h(n.contour(t,e*r));return i.value=e,i};return Object.defineProperty(i,"max",{get:()=>qs(t)/r}),i},d.x=function(t){return arguments.length?(e="function"==typeof t?t:JT(+t),d):e},d.y=function(e){return arguments.length?(t="function"==typeof e?e:JT(+e),d):t},d.weight=function(e){return arguments.length?(n="function"==typeof e?e:JT(+e),d):n},d.size=function(e){if(!arguments.length)return[r,i];var t=+e[0],n=+e[1];if(!(t>=0&&n>=0))throw new Error("invalid size");return r=t,i=n,g()},d.cellSize=function(e){if(!arguments.length)return 1<=1))throw new Error("invalid cell size");return o=Math.floor(Math.log(e)/Math.LN2),g()},d.thresholds=function(e){return arguments.length?(s="function"==typeof e?e:Array.isArray(e)?JT(ZT.call(e)):JT(e),d):s},d.bandwidth=function(e){if(!arguments.length)return Math.sqrt(a*(a+1));if(!((e=+e)>=0))throw new Error("invalid bandwidth");return a=(Math.sqrt(4*e*e+1)-1)/2,g()},d}function pI(e,t,n){this.k=e,this.x=t,this.y=n}pI.prototype={constructor:pI,scale:function(e){return 1===e?this:new pI(this.k*e,this.x,this.y)},translate:function(e,t){return 0===e&0===t?this:new pI(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}},pI.prototype;export{Jk as A,yE as C,Zj as L,Cc as R,eO as T,RS as X,qS as Y,My as a,wT as b,fC as c,YT as d,Ds as e,Wd as f,Pf as g,ph as h,Iy as i,xd as j,_d as k,Xd as l,XT as m,l as n,nf as o,Od as p,Zs as q,jf as r,ch as s,lp as t,qE as u,PS as v,h as w,Zk as x,hI as y}; diff --git a/frontend/dist/assets/refresh-cw-ccP9GKH1.js b/frontend/dist/assets/refresh-cw-ccP9GKH1.js new file mode 100644 index 00000000..c284bb1b --- /dev/null +++ b/frontend/dist/assets/refresh-cw-ccP9GKH1.js @@ -0,0 +1 @@ +import{c as a}from"./index-BGs2yNOg.js";const e=a("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);export{e as R}; diff --git a/frontend/dist/assets/route-DRIRJjaN.js b/frontend/dist/assets/route-DRIRJjaN.js new file mode 100644 index 00000000..c1723021 --- /dev/null +++ b/frontend/dist/assets/route-DRIRJjaN.js @@ -0,0 +1 @@ +import{c as y}from"./index-BGs2yNOg.js";const a=y("hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]),e=y("layers",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]),l=y("route",[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15",key:"1d8sl"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]]);export{a as H,e as L,l as R}; diff --git a/frontend/dist/assets/target-De7OqeGi.js b/frontend/dist/assets/target-De7OqeGi.js new file mode 100644 index 00000000..1f2dd908 --- /dev/null +++ b/frontend/dist/assets/target-De7OqeGi.js @@ -0,0 +1 @@ +import{c}from"./index-BGs2yNOg.js";const e=c("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),r=c("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]),y=c("target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);export{e as E,r as S,y as T}; diff --git a/frontend/dist/assets/trending-up-2SYsZdKi.js b/frontend/dist/assets/trending-up-2SYsZdKi.js new file mode 100644 index 00000000..39544953 --- /dev/null +++ b/frontend/dist/assets/trending-up-2SYsZdKi.js @@ -0,0 +1 @@ +import{c as t}from"./index-BGs2yNOg.js";const a=t("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]),d=t("trending-down",[["path",{d:"M16 17h6v-6",key:"t6n2it"}],["path",{d:"m22 17-8.5-8.5-5 5L2 7",key:"x473p"}]]),e=t("trending-up",[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]]);export{a as M,e as T,d as a}; diff --git a/frontend/dist/assets/triangle-alert-2-1YN-Am.js b/frontend/dist/assets/triangle-alert-2-1YN-Am.js new file mode 100644 index 00000000..3c728d9a --- /dev/null +++ b/frontend/dist/assets/triangle-alert-2-1YN-Am.js @@ -0,0 +1 @@ +import{c as a}from"./index-BGs2yNOg.js";const e=a("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);export{e as T}; diff --git a/frontend/dist/assets/usePolling-CtRLadGa.js b/frontend/dist/assets/usePolling-CtRLadGa.js deleted file mode 100644 index 3fcca0c8..00000000 --- a/frontend/dist/assets/usePolling-CtRLadGa.js +++ /dev/null @@ -1 +0,0 @@ -import{r}from"./vendor-react-C341c8YC.js";function e(e,t,n=!0,c=!1){const u=r.useRef(e);r.useEffect(()=>{u.current=e},[e]),r.useEffect(()=>{if(!n)return;c||u.current();const r=setInterval(()=>{u.current()},t);return()=>clearInterval(r)},[t,n,c])}export{e as u}; diff --git a/frontend/dist/assets/usePolling-DIhP09j-.js b/frontend/dist/assets/usePolling-DIhP09j-.js new file mode 100644 index 00000000..f53822a4 --- /dev/null +++ b/frontend/dist/assets/usePolling-DIhP09j-.js @@ -0,0 +1 @@ +import{a as e}from"./vendor-react-DCIF8YoJ.js";function r(r,t,n=!0,c=!1){const u=e.useRef(r);e.useEffect(()=>{u.current=r},[r]),e.useEffect(()=>{if(!n)return;c||u.current();const e=setInterval(()=>{u.current()},t);return()=>clearInterval(e)},[t,n,c])}export{r as u}; diff --git a/frontend/dist/assets/useThemeColors-AeHMyThq.js b/frontend/dist/assets/useThemeColors-CGx-Jxyf.js similarity index 98% rename from frontend/dist/assets/useThemeColors-AeHMyThq.js rename to frontend/dist/assets/useThemeColors-CGx-Jxyf.js index d6a09ec1..aa79c888 100644 --- a/frontend/dist/assets/useThemeColors-AeHMyThq.js +++ b/frontend/dist/assets/useThemeColors-CGx-Jxyf.js @@ -1 +1 @@ -var r=Object.defineProperty,t=(t,e,o)=>((t,e,o)=>e in t?r(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o)(t,"symbol"!=typeof e?e+"":e,o);import{r as e}from"./vendor-react-C341c8YC.js";const o=new class{constructor(){t(this,"observer",null),t(this,"subscribers",new Set),t(this,"isObserving",!1)}subscribe(r){return this.subscribers.add(r),this.isObserving||this.startObserving(),()=>{this.subscribers.delete(r),0===this.subscribers.size&&this.stopObserving()}}get subscriberCount(){return this.subscribers.size}startObserving(){"undefined"!=typeof window&&(this.isObserving||(this.observer=new MutationObserver(r=>{for(const t of r)if("data-theme"===t.attributeName||"data-color-scheme"===t.attributeName||"class"===t.attributeName){setTimeout(()=>this.notifySubscribers(),50);break}}),this.observer.observe(document.documentElement,{attributes:!0}),this.isObserving=!0))}stopObserving(){this.observer&&(this.observer.disconnect(),this.observer=null),this.isObserving=!1}notifySubscribers(){for(const t of this.subscribers)try{t()}catch(r){}}};function a(r){if(!r)return null;const t=r.match(/color\(display-p3\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)/);if(t)return{r:Math.round(255*Math.min(1,Math.max(0,parseFloat(t[1])))),g:Math.round(255*Math.min(1,Math.max(0,parseFloat(t[2])))),b:Math.round(255*Math.min(1,Math.max(0,parseFloat(t[3]))))};if(r.startsWith("#")){const t=r.replace("#","");if(3===t.length)return{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16)};if(t.length>=6)return{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16)}}const e=r.match(/rgba?\(([\d.]+),?\s*([\d.]+),?\s*([\d.]+)/);return e?{r:Math.round(parseFloat(e[1])),g:Math.round(parseFloat(e[2])),b:Math.round(parseFloat(e[3]))}:null}function n(r){return"undefined"==typeof window?"":getComputedStyle(document.documentElement).getPropertyValue(r).trim()}function i(r){return function(r){if(!r)return"";if(r.startsWith("#"))return r;const t=r.match(/color\(display-p3\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)/);if(t){const r=Math.round(255*Math.min(1,Math.max(0,parseFloat(t[1])))),e=Math.round(255*Math.min(1,Math.max(0,parseFloat(t[2])))),o=Math.round(255*Math.min(1,Math.max(0,parseFloat(t[3]))));return`#${r.toString(16).padStart(2,"0")}${e.toString(16).padStart(2,"0")}${o.toString(16).padStart(2,"0")}`}const e=r.match(/rgba?\(([\d.]+),?\s*([\d.]+),?\s*([\d.]+)/);if(e){const r=Math.round(parseFloat(e[1])),t=Math.round(parseFloat(e[2])),o=Math.round(parseFloat(e[3]));return`#${r.toString(16).padStart(2,"0")}${t.toString(16).padStart(2,"0")}${o.toString(16).padStart(2,"0")}`}return r}(n(r))}function s(r,t){const[a,n]=e.useState(t),i=e.useCallback(()=>{n(r())},[r]);return e.useEffect(()=>(i(),o.subscribe(i)),[i]),a}const c={chart1:"#719CDF",chart2:"#0074BE",chart3:"#6FBCBD",chart4:"#DFBC72",chart5:"#719872",chart6:"#E12672",chart7:"#E17899",chart8:"#999ABD"},u={received:"#719872",forwarded:"#0074BE",transmitted:"#DFBC72",dropped:"#E12672",neutral:"#BFBFBF"},h="#00FF00",l="#8CE619",d="#FFD900",g="#FF8C26",b="#FF3333",m={primary:"#719CDF",secondary:"#DFBC72",tertiary:"#6FBCBD",success:"#719872",danger:"#E12672"},p={primary:"#E4E4E4",secondary:"#BFBFBF",muted:"#727272"},f={nodeFill:"#3B82F6",nodeStroke:"rgba(255,255,255,0.9)",hubColor:"#8E4EC6",hubStroke:"rgba(255,255,255,0.9)",gatewayColor:"#5B5BD6",gatewayStroke:"rgba(255,255,255,0.85)",localColor:"#FFB224",neighborColor:"#FFB224",neighborStroke:"rgba(0,0,0,0.4)",mobileColor:"#F76B15",roomColor:"#D6409F",ghostColor:"#00A2C7"};function y(){return"undefined"==typeof window?c:{chart1:n("--chart-1")||c.chart1,chart2:n("--chart-2")||c.chart2,chart3:n("--chart-3")||c.chart3,chart4:n("--chart-4")||c.chart4,chart5:n("--chart-5")||c.chart5,chart6:n("--chart-6")||c.chart6,chart7:n("--chart-7")||c.chart7,chart8:n("--chart-8")||c.chart8}}function F(){return"undefined"==typeof window?u:{received:n("--metric-received")||u.received,forwarded:n("--metric-forwarded")||u.forwarded,transmitted:n("--metric-transmitted")||u.transmitted,dropped:n("--metric-dropped")||u.dropped,neutral:n("--metric-neutral")||u.neutral}}function C(){return"undefined"==typeof window?p:{primary:n("--text-primary")||p.primary,secondary:n("--text-secondary")||p.secondary,muted:n("--text-muted")||p.muted}}function S(){return"undefined"==typeof window?m:{primary:n("--accent-primary")||m.primary,secondary:n("--accent-secondary")||m.secondary,tertiary:n("--accent-tertiary")||m.tertiary,success:n("--accent-success")||m.success,danger:n("--accent-danger")||m.danger}}function w(){return s(y,c)}function k(){return s(F,u)}function v(){return s(C,p)}function B(){return s(S,m)}function M(){return"undefined"==typeof window?f:{nodeFill:n("--map-node-fill")||f.nodeFill,nodeStroke:n("--map-node-stroke")||f.nodeStroke,hubColor:n("--map-hub-color")||f.hubColor,hubStroke:n("--map-hub-stroke")||f.hubStroke,gatewayColor:n("--map-gateway-color")||f.gatewayColor,gatewayStroke:n("--map-gateway-stroke")||f.gatewayStroke,localColor:n("--map-local-color")||f.localColor,neighborColor:n("--map-neighbor-color")||f.neighborColor,neighborStroke:n("--map-neighbor-stroke")||f.neighborStroke,mobileColor:n("--map-mobile-color")||f.mobileColor,roomColor:n("--map-room-color")||f.roomColor,ghostColor:n("--map-ghost-color")||f.ghostColor}}function D(){return s(M,f)}const E={nodeStroke:"rgba(0,0,0,0.6)",hubStroke:"rgba(0,0,0,0.5)",gatewayStroke:"rgba(0,0,0,0.45)",neighborStroke:"rgba(0,0,0,0.5)"},x={nodeStroke:"rgba(255,255,255,0.9)",hubStroke:"rgba(255,255,255,0.9)",gatewayStroke:"rgba(255,255,255,0.85)",neighborStroke:"rgba(0,0,0,0.4)"};function O(r){if("undefined"==typeof window)return f;const t="light"===function(){if("undefined"==typeof window)return"dark";const r=document.querySelector("[data-basemap]");return r&&r.getAttribute("data-basemap")||"dark"}()?E:x;return{nodeFill:i("--map-node-fill")||f.nodeFill,nodeStroke:t.nodeStroke,hubColor:i("--map-hub-color")||f.hubColor,hubStroke:t.hubStroke,gatewayColor:i("--map-gateway-color")||f.gatewayColor,gatewayStroke:t.gatewayStroke,localColor:i("--map-local-color")||f.localColor,neighborColor:i("--map-neighbor-color")||f.neighborColor,neighborStroke:t.neighborStroke,mobileColor:i("--map-mobile-color")||f.mobileColor,roomColor:i("--map-room-color")||f.roomColor,ghostColor:i("--map-ghost-color")||f.ghostColor}}const A={rest:"#4B4B4B",restBright:"#616161",restDim:"#3F3F3F",hoverDirect:"#6FBCBD",hoverLoop:"#8B7BAD",hoverStandard:"#8A8A8A",hoverNeighbor:"#FBBF24",highlight:"#FFD700"},I={rest:"rgba(0, 0, 0, 0.20)",restBright:"rgba(0, 0, 0, 0.30)",restDim:"rgba(0, 0, 0, 0.12)"},$={rest:"rgba(255, 255, 255, 0.25)",restBright:"rgba(255, 255, 255, 0.35)",restDim:"rgba(255, 255, 255, 0.15)"};function N(r){if("undefined"==typeof window)return A;const t="light"===r?I:$;return{rest:t.rest,restBright:t.restBright,restDim:t.restDim,hoverDirect:i("--map-edge-hover-direct")||A.hoverDirect,hoverLoop:i("--map-edge-hover-loop")||A.hoverLoop,hoverStandard:i("--map-edge-hover-standard")||A.hoverStandard,hoverNeighbor:i("--map-edge-hover-neighbor")||A.hoverNeighbor,highlight:i("--map-edge-highlight")||A.highlight}}const q={grid:"rgba(191, 191, 191, 0.15)",axisTick:"#BFBFBF",cursor:"rgba(255, 255, 255, 0.2)"};function L(){return"undefined"==typeof window?q:{grid:n("--chart-grid")||q.grid,axisTick:n("--chart-axis-tick")||q.axisTick,cursor:n("--chart-cursor")||q.cursor}}function T(){return s(L,q)}function j(r,t){return n(`--palette-${r}-${t}`)||""}function z(){const r=[];for(let t=0;t<24;t++){const e=t/23,o=1-e,a=j("aqua",[900,800,700,600,500,400,300,200,100,50][Math.min(8,Math.floor(9*o))]),n=parseInt(a.slice(1,3),16)||0,i=parseInt(a.slice(3,5),16)||0,s=parseInt(a.slice(5,7),16)||0,c=Math.round(80+130*e);r.push([n,i,s,c])}return r}function P(){const r=n("--signal-excellent")||h,t=n("--signal-good")||l,e=n("--signal-fair")||d,o=n("--signal-poor")||g,a=n("--signal-critical")||b,i=[];for(let n=0;n<24;n++){let s;s=n<5?r:n<10?t:n<15?e:n<20?o:a,i.push(s)}return i}function W(){const r=i("--signal-excellent")||h,t=i("--signal-good")||l,e=i("--signal-fair")||d,o=i("--signal-poor")||g,a=i("--signal-critical")||b,n=[];for(let i=0;i<24;i++){let s;s=i<5?r:i<10?t:i<15?e:i<20?o:a,n.push(s)}return n}function V(){const[r,t]=e.useState(()=>P());return e.useEffect(()=>{const r=()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{t(P())})})};return r(),o.subscribe(r)},[]),r}function G(r){const t=(Math.max(-12,Math.min(12,r))- -12)/24;return Math.round(23*(1-t))}function H(){const r=e.useCallback(()=>"undefined"!=typeof document&&document.documentElement.classList.contains("ribbon-mode"),[]),[t,a]=e.useState(r);return e.useEffect(()=>(a(r()),o.subscribe(()=>a(r()))),[r]),t}export{T as a,B as b,v as c,V as d,w as e,H as f,P as g,W as h,O as i,N as j,D as k,z as l,a as p,G as s,k as u}; +var r=Object.defineProperty,t=(t,e,o)=>((t,e,o)=>e in t?r(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o)(t,"symbol"!=typeof e?e+"":e,o);import{a as e}from"./vendor-react-DCIF8YoJ.js";const o=new class{constructor(){t(this,"observer",null),t(this,"subscribers",new Set),t(this,"isObserving",!1)}subscribe(r){return this.subscribers.add(r),this.isObserving||this.startObserving(),()=>{this.subscribers.delete(r),0===this.subscribers.size&&this.stopObserving()}}get subscriberCount(){return this.subscribers.size}startObserving(){"undefined"!=typeof window&&(this.isObserving||(this.observer=new MutationObserver(r=>{for(const t of r)if("data-theme"===t.attributeName||"data-color-scheme"===t.attributeName||"class"===t.attributeName){setTimeout(()=>this.notifySubscribers(),50);break}}),this.observer.observe(document.documentElement,{attributes:!0}),this.isObserving=!0))}stopObserving(){this.observer&&(this.observer.disconnect(),this.observer=null),this.isObserving=!1}notifySubscribers(){for(const t of this.subscribers)try{t()}catch(r){}}};function a(r){if(!r)return null;const t=r.match(/color\(display-p3\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)/);if(t)return{r:Math.round(255*Math.min(1,Math.max(0,parseFloat(t[1])))),g:Math.round(255*Math.min(1,Math.max(0,parseFloat(t[2])))),b:Math.round(255*Math.min(1,Math.max(0,parseFloat(t[3]))))};if(r.startsWith("#")){const t=r.replace("#","");if(3===t.length)return{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16)};if(t.length>=6)return{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16)}}const e=r.match(/rgba?\(([\d.]+),?\s*([\d.]+),?\s*([\d.]+)/);return e?{r:Math.round(parseFloat(e[1])),g:Math.round(parseFloat(e[2])),b:Math.round(parseFloat(e[3]))}:null}function n(r){return"undefined"==typeof window?"":getComputedStyle(document.documentElement).getPropertyValue(r).trim()}function i(r){return function(r){if(!r)return"";if(r.startsWith("#"))return r;const t=r.match(/color\(display-p3\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)/);if(t){const r=Math.round(255*Math.min(1,Math.max(0,parseFloat(t[1])))),e=Math.round(255*Math.min(1,Math.max(0,parseFloat(t[2])))),o=Math.round(255*Math.min(1,Math.max(0,parseFloat(t[3]))));return`#${r.toString(16).padStart(2,"0")}${e.toString(16).padStart(2,"0")}${o.toString(16).padStart(2,"0")}`}const e=r.match(/rgba?\(([\d.]+),?\s*([\d.]+),?\s*([\d.]+)/);if(e){const r=Math.round(parseFloat(e[1])),t=Math.round(parseFloat(e[2])),o=Math.round(parseFloat(e[3]));return`#${r.toString(16).padStart(2,"0")}${t.toString(16).padStart(2,"0")}${o.toString(16).padStart(2,"0")}`}return r}(n(r))}function s(r,t){const[a,n]=e.useState(t),i=e.useCallback(()=>{n(r())},[r]);return e.useEffect(()=>(i(),o.subscribe(i)),[i]),a}const c={chart1:"#719CDF",chart2:"#0074BE",chart3:"#6FBCBD",chart4:"#DFBC72",chart5:"#719872",chart6:"#E12672",chart7:"#E17899",chart8:"#999ABD"},u={received:"#719872",forwarded:"#0074BE",transmitted:"#DFBC72",dropped:"#E12672",neutral:"#BFBFBF"},h="#00FF00",l="#8CE619",d="#FFD900",g="#FF8C26",b="#FF3333",m={primary:"#719CDF",secondary:"#DFBC72",tertiary:"#6FBCBD",success:"#719872",danger:"#E12672"},p={primary:"#E4E4E4",secondary:"#BFBFBF",muted:"#727272"},f={nodeFill:"#3B82F6",nodeStroke:"rgba(255,255,255,0.9)",hubColor:"#8E4EC6",hubStroke:"rgba(255,255,255,0.9)",gatewayColor:"#5B5BD6",gatewayStroke:"rgba(255,255,255,0.85)",localColor:"#FFB224",neighborColor:"#FFB224",neighborStroke:"rgba(0,0,0,0.4)",mobileColor:"#F76B15",roomColor:"#D6409F",ghostColor:"#00A2C7"};function y(){return"undefined"==typeof window?c:{chart1:n("--chart-1")||c.chart1,chart2:n("--chart-2")||c.chart2,chart3:n("--chart-3")||c.chart3,chart4:n("--chart-4")||c.chart4,chart5:n("--chart-5")||c.chart5,chart6:n("--chart-6")||c.chart6,chart7:n("--chart-7")||c.chart7,chart8:n("--chart-8")||c.chart8}}function F(){return"undefined"==typeof window?u:{received:n("--metric-received")||u.received,forwarded:n("--metric-forwarded")||u.forwarded,transmitted:n("--metric-transmitted")||u.transmitted,dropped:n("--metric-dropped")||u.dropped,neutral:n("--metric-neutral")||u.neutral}}function C(){return"undefined"==typeof window?p:{primary:n("--text-primary")||p.primary,secondary:n("--text-secondary")||p.secondary,muted:n("--text-muted")||p.muted}}function S(){return"undefined"==typeof window?m:{primary:n("--accent-primary")||m.primary,secondary:n("--accent-secondary")||m.secondary,tertiary:n("--accent-tertiary")||m.tertiary,success:n("--accent-success")||m.success,danger:n("--accent-danger")||m.danger}}function w(){return s(y,c)}function k(){return s(F,u)}function v(){return s(C,p)}function B(){return s(S,m)}function M(){return"undefined"==typeof window?f:{nodeFill:n("--map-node-fill")||f.nodeFill,nodeStroke:n("--map-node-stroke")||f.nodeStroke,hubColor:n("--map-hub-color")||f.hubColor,hubStroke:n("--map-hub-stroke")||f.hubStroke,gatewayColor:n("--map-gateway-color")||f.gatewayColor,gatewayStroke:n("--map-gateway-stroke")||f.gatewayStroke,localColor:n("--map-local-color")||f.localColor,neighborColor:n("--map-neighbor-color")||f.neighborColor,neighborStroke:n("--map-neighbor-stroke")||f.neighborStroke,mobileColor:n("--map-mobile-color")||f.mobileColor,roomColor:n("--map-room-color")||f.roomColor,ghostColor:n("--map-ghost-color")||f.ghostColor}}function D(){return s(M,f)}const E={nodeStroke:"rgba(0,0,0,0.6)",hubStroke:"rgba(0,0,0,0.5)",gatewayStroke:"rgba(0,0,0,0.45)",neighborStroke:"rgba(0,0,0,0.5)"},x={nodeStroke:"rgba(255,255,255,0.9)",hubStroke:"rgba(255,255,255,0.9)",gatewayStroke:"rgba(255,255,255,0.85)",neighborStroke:"rgba(0,0,0,0.4)"};function O(r){if("undefined"==typeof window)return f;const t="light"===function(){if("undefined"==typeof window)return"dark";const r=document.querySelector("[data-basemap]");return r&&r.getAttribute("data-basemap")||"dark"}()?E:x;return{nodeFill:i("--map-node-fill")||f.nodeFill,nodeStroke:t.nodeStroke,hubColor:i("--map-hub-color")||f.hubColor,hubStroke:t.hubStroke,gatewayColor:i("--map-gateway-color")||f.gatewayColor,gatewayStroke:t.gatewayStroke,localColor:i("--map-local-color")||f.localColor,neighborColor:i("--map-neighbor-color")||f.neighborColor,neighborStroke:t.neighborStroke,mobileColor:i("--map-mobile-color")||f.mobileColor,roomColor:i("--map-room-color")||f.roomColor,ghostColor:i("--map-ghost-color")||f.ghostColor}}const A={rest:"#4B4B4B",restBright:"#616161",restDim:"#3F3F3F",hoverDirect:"#6FBCBD",hoverLoop:"#8B7BAD",hoverStandard:"#8A8A8A",hoverNeighbor:"#FBBF24",highlight:"#FFD700"},I={rest:"rgba(0, 0, 0, 0.20)",restBright:"rgba(0, 0, 0, 0.30)",restDim:"rgba(0, 0, 0, 0.12)"},$={rest:"rgba(255, 255, 255, 0.25)",restBright:"rgba(255, 255, 255, 0.35)",restDim:"rgba(255, 255, 255, 0.15)"};function N(r){if("undefined"==typeof window)return A;const t="light"===r?I:$;return{rest:t.rest,restBright:t.restBright,restDim:t.restDim,hoverDirect:i("--map-edge-hover-direct")||A.hoverDirect,hoverLoop:i("--map-edge-hover-loop")||A.hoverLoop,hoverStandard:i("--map-edge-hover-standard")||A.hoverStandard,hoverNeighbor:i("--map-edge-hover-neighbor")||A.hoverNeighbor,highlight:i("--map-edge-highlight")||A.highlight}}const q={grid:"rgba(191, 191, 191, 0.15)",axisTick:"#BFBFBF",cursor:"rgba(255, 255, 255, 0.2)"};function L(){return"undefined"==typeof window?q:{grid:n("--chart-grid")||q.grid,axisTick:n("--chart-axis-tick")||q.axisTick,cursor:n("--chart-cursor")||q.cursor}}function T(){return s(L,q)}function j(r,t){return n(`--palette-${r}-${t}`)||""}function z(){const r=[];for(let t=0;t<24;t++){const e=t/23,o=1-e,a=j("aqua",[900,800,700,600,500,400,300,200,100,50][Math.min(8,Math.floor(9*o))]),n=parseInt(a.slice(1,3),16)||0,i=parseInt(a.slice(3,5),16)||0,s=parseInt(a.slice(5,7),16)||0,c=Math.round(80+130*e);r.push([n,i,s,c])}return r}function P(){const r=n("--signal-excellent")||h,t=n("--signal-good")||l,e=n("--signal-fair")||d,o=n("--signal-poor")||g,a=n("--signal-critical")||b,i=[];for(let n=0;n<24;n++){let s;s=n<5?r:n<10?t:n<15?e:n<20?o:a,i.push(s)}return i}function W(){const r=i("--signal-excellent")||h,t=i("--signal-good")||l,e=i("--signal-fair")||d,o=i("--signal-poor")||g,a=i("--signal-critical")||b,n=[];for(let i=0;i<24;i++){let s;s=i<5?r:i<10?t:i<15?e:i<20?o:a,n.push(s)}return n}function V(){const[r,t]=e.useState(()=>P());return e.useEffect(()=>{const r=()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{t(P())})})};return r(),o.subscribe(r)},[]),r}function G(r){const t=(Math.max(-12,Math.min(12,r))- -12)/24;return Math.round(23*(1-t))}function H(){const r=e.useCallback(()=>"undefined"!=typeof document&&document.documentElement.classList.contains("ribbon-mode"),[]),[t,a]=e.useState(r);return e.useEffect(()=>(a(r()),o.subscribe(()=>a(r()))),[r]),t}export{T as a,B as b,v as c,V as d,w as e,H as f,P as g,W as h,O as i,N as j,D as k,z as l,a as p,G as s,k as u}; diff --git a/frontend/dist/assets/users-D0iUt2so.js b/frontend/dist/assets/users-D0iUt2so.js new file mode 100644 index 00000000..aa239c7b --- /dev/null +++ b/frontend/dist/assets/users-D0iUt2so.js @@ -0,0 +1 @@ +import{c as a}from"./index-BGs2yNOg.js";const e=a("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]);export{e as U}; diff --git a/frontend/dist/assets/vendor-core-Dl9MTgSr.js b/frontend/dist/assets/vendor-core-Dl9MTgSr.js new file mode 100644 index 00000000..add5599d --- /dev/null +++ b/frontend/dist/assets/vendor-core-Dl9MTgSr.js @@ -0,0 +1 @@ +import{a as e,c as t}from"./vendor-react-DCIF8YoJ.js";var n="popstate";function r(e,t){if(!1===e||null==e)throw new Error(t)}function a(e,t){if(!e)try{throw new Error(t)}catch(n){}}function o(e,t){return{usr:e.state,key:e.key,idx:t}}function i(e,t,n=null,r){return{pathname:"string"==typeof e?e:e.pathname,search:"",hash:"",..."string"==typeof t?s(t):t,state:n,key:t&&t.key||r||Math.random().toString(36).substring(2,10)}}function l({pathname:e="/",search:t="",hash:n=""}){return t&&"?"!==t&&(e+="?"===t.charAt(0)?t:"?"+t),n&&"#"!==n&&(e+="#"===n.charAt(0)?n:"#"+n),e}function s(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function u(e,t,n="/"){return function(e,t,n){let r=C(("string"==typeof t?s(t):t).pathname||"/",n);if(null==r)return null;let a=c(e);!function(e){e.sort((e,t)=>e.score!==t.score?t.score-e.score:function(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)))}(a);let o=null;for(let i=0;null==o&&i{let u={relativePath:void 0===s?e.path||"":s,caseSensitive:!0===e.caseSensitive,childrenIndex:i,route:e};if(u.relativePath.startsWith("/")){if(!u.relativePath.startsWith(a)&&l)return;r(u.relativePath.startsWith(a),`Absolute route path "${u.relativePath}" nested under path "${a}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),u.relativePath=u.relativePath.slice(a.length)}let h=k([a,u.relativePath]),d=n.concat(u);e.children&&e.children.length>0&&(r(!0!==e.index,`Index routes must not have child routes. Please remove all child routes from route path "${h}".`),c(e.children,t,d,h,l)),(null!=e.path||e.index)&&t.push({path:h,score:w(h,e.index),routesMeta:d})};return e.forEach((e,t)=>{var n;if(""!==e.path&&(null==(n=e.path)?void 0:n.includes("?")))for(let r of h(e.path))i(e,t,!0,r);else i(e,t)}),t}function h(e){let t=e.split("/");if(0===t.length)return[];let[n,...r]=t,a=n.endsWith("?"),o=n.replace(/\?$/,"");if(0===r.length)return a?[o,""]:[o];let i=h(r.join("/")),l=[];return l.push(...i.map(e=>""===e?o:[o,e].join("/"))),a&&l.push(...i),l.map(t=>e.startsWith("/")&&""===t?"/":t)}var d=/^:[\w-]+$/,p=3,m=2,f=1,v=10,g=-2,y=e=>"*"===e;function w(e,t){let n=e.split("/"),r=n.length;return n.some(y)&&(r+=g),t&&(r+=m),n.filter(e=>!y(e)).reduce((e,t)=>e+(d.test(t)?p:""===t?f:v),r)}function b(e,t,n=!1){let{routesMeta:r}=e,a={},o="/",i=[];for(let l=0;l(r.push({paramName:t,isOptional:null!=n}),n?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),o+="*"===e||"/*"===e?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?o+="\\/*$":""!==e&&"/"!==e&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),r]}(e.path,e.caseSensitive,e.end),o=t.match(n);if(!o)return null;let i=o[0],l=i.replace(/(.)\/+$/,"$1"),s=o.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if("*"===t){let e=s[r]||"";l=i.slice(0,i.length-e.length).replace(/(.)\/+$/,"$1")}const a=s[r];return e[t]=n&&!a?void 0:(a||"").replace(/%2F/g,"/"),e},{}),pathname:i,pathnameBase:l,pattern:e}}function x(e){try{return e.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(t){return a(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function C(e,t){if("/"===t)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&"/"!==r?null:e.slice(n)||"/"}var R=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function S(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(e=>{".."===e?n.length>1&&n.pop():"."!==e&&n.push(e)}),n.length>1?n.join("/"):"/"}function $(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in and the router will parse it for you.`}function L(e){let t=function(e){return e.filter((e,t)=>0===t||e.route.path&&e.route.path.length>0)}(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function T(e,t,n,o=!1){let i;"string"==typeof e?i=s(e):(i={...e},r(!i.pathname||!i.pathname.includes("?"),$("?","pathname","search",i)),r(!i.pathname||!i.pathname.includes("#"),$("#","pathname","hash",i)),r(!i.search||!i.search.includes("#"),$("#","search","hash",i)));let l,u=""===e||""===i.pathname,c=u?"/":i.pathname;if(null==c)l=n;else{let e=t.length-1;if(!o&&c.startsWith("..")){let t=c.split("/");for(;".."===t[0];)t.shift(),e-=1;i.pathname=t.join("/")}l=e>=0?t[e]:"/"}let h=function(e,t="/"){let n,{pathname:r,search:o="",hash:i=""}="string"==typeof e?s(e):e;if(r)if(l=r,R.test(l))n=r;else{if(r.includes("//")){let e=r;r=r.replace(/\/\/+/g,"/"),a(!1,`Pathnames cannot have embedded double slashes - normalizing ${e} -> ${r}`)}n=r.startsWith("/")?S(r.substring(1),"/"):S(r,t)}else n=t;var l;return{pathname:n,search:N(o),hash:O(i)}}(i,l),d=c&&"/"!==c&&c.endsWith("/"),p=(u||"."===c)&&n.endsWith("/");return h.pathname.endsWith("/")||!d&&!p||(h.pathname+="/"),h}var k=e=>e.join("/").replace(/\/\/+/g,"/"),P=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),N=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",O=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"";function F(e){return e.map(e=>e.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var M=["POST","PUT","PATCH","DELETE"];new Set(M);var A=["GET",...M];new Set(A);var D=e.createContext(null);D.displayName="DataRouter";var j=e.createContext(null);j.displayName="DataRouterState",e.createContext(!1);var W=e.createContext({isTransitioning:!1});W.displayName="ViewTransition",e.createContext(new Map).displayName="Fetchers",e.createContext(null).displayName="Await";var I=e.createContext(null);I.displayName="Navigation";var B=e.createContext(null);B.displayName="Location";var _=e.createContext({outlet:null,matches:[],isDataRoute:!1});_.displayName="Route";var U=e.createContext(null);function H(){return null!=e.useContext(B)}function z(){return r(H(),"useLocation() may be used only in the context of a component."),e.useContext(B).location}U.displayName="RouteError";var J="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Y(t){e.useContext(I).static||e.useLayoutEffect(t)}function K(){let{isDataRoute:t}=e.useContext(_);return t?function(){let{router:t}=function(){let t=e.useContext(D);return r(t,ee("useNavigate")),t}(),n=te("useNavigate"),o=e.useRef(!1);return Y(()=>{o.current=!0}),e.useCallback(async(e,r={})=>{a(o.current,J),o.current&&("number"==typeof e?await t.navigate(e):await t.navigate(e,{fromRouteId:n,...r}))},[t,n])}():function(){r(H(),"useNavigate() may be used only in the context of a component.");let t=e.useContext(D),{basename:n,navigator:o}=e.useContext(I),{matches:i}=e.useContext(_),{pathname:l}=z(),s=JSON.stringify(L(i)),u=e.useRef(!1);return Y(()=>{u.current=!0}),e.useCallback((e,r={})=>{if(a(u.current,J),!u.current)return;if("number"==typeof e)return void o.go(e);let i=T(e,JSON.parse(s),l,"path"===r.relative);null==t&&"/"!==n&&(i.pathname="/"===i.pathname?n:k([n,i.pathname])),(r.replace?o.replace:o.push)(i,r.state,r)},[n,o,s,l,t])}()}function V(t,{relative:n}={}){let{matches:r}=e.useContext(_),{pathname:a}=z(),o=JSON.stringify(L(r));return e.useMemo(()=>T(t,JSON.parse(o),a,"path"===n),[t,o,a,n])}function q(t,n,o,i,l){var c;r(H(),"useRoutes() may be used only in the context of a component.");let{navigator:h}=e.useContext(I),{matches:d}=e.useContext(_),p=d[d.length-1],m=p?p.params:{},f=p?p.pathname:"/",v=p?p.pathnameBase:"/",g=p&&p.route;{let e=g&&g.path||"";re(f,!g||e.endsWith("*")||e.endsWith("*?"),`You rendered descendant (or called \`useRoutes()\`) at "${f}" (under ) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.\n\nPlease change the parent to .`)}let y,w=z();if(n){let e="string"==typeof n?s(n):n;r("/"===v||(null==(c=e.pathname)?void 0:c.startsWith(v)),`When overriding the location using \`\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${v}" but pathname "${e.pathname}" was given in the \`location\` prop.`),y=e}else y=w;let b=y.pathname||"/",E=b;if("/"!==v){let e=v.replace(/^\//,"").split("/");E="/"+b.replace(/^\//,"").split("/").slice(e.length).join("/")}let x=u(t,{pathname:E});a(g||null!=x,`No routes matched location "${y.pathname}${y.search}${y.hash}" `),a(null==x||void 0!==x[x.length-1].route.element||void 0!==x[x.length-1].route.Component||void 0!==x[x.length-1].route.lazy,`Matched leaf route at location "${y.pathname}${y.search}${y.hash}" does not have an element or Component. This means it will render an with a null value by default resulting in an "empty" page.`);let C=function(t,n=[],a=null,o=null){if(null==t){if(!a)return null;if(a.errors)t=a.matches;else{if(0!==n.length||a.initialized||!(a.matches.length>0))return null;t=a.matches}}let i=t,l=null==a?void 0:a.errors;if(null!=l){let e=i.findIndex(e=>e.route.id&&void 0!==(null==l?void 0:l[e.route.id]));r(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(l).join(",")}`),i=i.slice(0,Math.min(i.length,e+1))}let s=!1,u=-1;if(a)for(let e=0;e=0?i.slice(0,u+1):[i[0]];break}}}let c=a&&o?(e,t)=>{var n,r;o(e,{location:a.location,params:(null==(r=null==(n=a.matches)?void 0:n[0])?void 0:r.params)??{},unstable_pattern:F(a.matches),errorInfo:t})}:void 0;return i.reduceRight((t,r,o)=>{let h,d=!1,p=null,m=null;a&&(h=l&&r.route.id?l[r.route.id]:void 0,p=r.route.errorElement||X,s&&(u<0&&0===o?(re("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,m=null):u===o&&(d=!0,m=r.route.hydrateFallbackElement||null)));let f=n.concat(i.slice(0,o+1)),v=()=>{let n;return n=h?p:d?m:r.route.Component?e.createElement(r.route.Component,null):r.route.element?r.route.element:t,e.createElement(Z,{match:r,routeContext:{outlet:t,matches:f,isDataRoute:null!=a},children:n})};return a&&(r.route.ErrorBoundary||r.route.errorElement||0===o)?e.createElement(Q,{location:a.location,revalidation:a.revalidation,component:p,error:h,children:v(),routeContext:{outlet:null,matches:f,isDataRoute:!0},onError:c}):v()},null)}(x&&x.map(e=>Object.assign({},e,{params:Object.assign({},m,e.params),pathname:k([v,h.encodeLocation?h.encodeLocation(e.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:e.pathname]),pathnameBase:"/"===e.pathnameBase?v:k([v,h.encodeLocation?h.encodeLocation(e.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:e.pathnameBase])})),d,o,i);return n&&C?e.createElement(B.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...y},navigationType:"POP"}},C):C}function G(){let t=function(){var t;let n=e.useContext(U),a=function(){let t=e.useContext(j);return r(t,ee("useRouteError")),t}(),o=te("useRouteError");return void 0!==n?n:null==(t=a.errors)?void 0:t[o]}(),n=function(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"boolean"==typeof e.internal&&"data"in e}(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),a=t instanceof Error?t.stack:null,o="rgba(200,200,200, 0.5)",i={padding:"0.5rem",backgroundColor:o},l={padding:"2px 4px",backgroundColor:o},s=null;return s=e.createElement(e.Fragment,null,e.createElement("p",null,"💿 Hey developer 👋"),e.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",e.createElement("code",{style:l},"ErrorBoundary")," or"," ",e.createElement("code",{style:l},"errorElement")," prop on your route.")),e.createElement(e.Fragment,null,e.createElement("h2",null,"Unexpected Application Error!"),e.createElement("h3",{style:{fontStyle:"italic"}},n),a?e.createElement("pre",{style:i},a):null,s)}e.createContext(null);var X=e.createElement(G,null),Q=class extends e.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||"idle"!==t.revalidation&&"idle"===e.revalidation?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:void 0!==e.error?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError&&this.props.onError(e,t)}render(){return void 0!==this.state.error?e.createElement(_.Provider,{value:this.props.routeContext},e.createElement(U.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function Z({routeContext:t,match:n,children:r}){let a=e.useContext(D);return a&&a.static&&a.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=n.route.id),e.createElement(_.Provider,{value:t},r)}function ee(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function te(t){let n=function(t){let n=e.useContext(_);return r(n,ee(t)),n}(t),a=n.matches[n.matches.length-1];return r(a.route.id,`${t} can only be used on routes that contain a unique "id"`),a.route.id}var ne={};function re(e,t,n){t||ne[e]||(ne[e]=!0,a(!1,n))}function ae({to:t,replace:n,state:o,relative:i}){r(H()," may be used only in the context of a component.");let{static:l}=e.useContext(I);a(!l," must not be used on the initial render in a . This is a no-op, but you should modify your code so the is only ever rendered in response to some user interaction or state change.");let{matches:s}=e.useContext(_),{pathname:u}=z(),c=K(),h=T(t,L(s),u,"path"===i),d=JSON.stringify(h);return e.useEffect(()=>{c(JSON.parse(d),{replace:n,state:o,relative:i})},[c,d,i,n,o]),null}function oe(e){r(!1,"A is only ever to be used as the child of element, never rendered directly. Please wrap your in a .")}function ie({basename:t="/",children:n=null,location:o,navigationType:i="POP",navigator:l,static:u=!1,unstable_useTransitions:c}){r(!H(),"You cannot render a inside another . You should never have more than one in your app.");let h=t.replace(/^\/*/,"/"),d=e.useMemo(()=>({basename:h,navigator:l,static:u,unstable_useTransitions:c,future:{}}),[h,l,u,c]);"string"==typeof o&&(o=s(o));let{pathname:p="/",search:m="",hash:f="",state:v=null,key:g="default"}=o,y=e.useMemo(()=>{let e=C(p,h);return null==e?null:{location:{pathname:e,search:m,hash:f,state:v,key:g},navigationType:i}},[h,p,m,f,v,g,i]);return a(null!=y,` is not able to match the URL "${p}${m}${f}" because it does not start with the basename, so the won't render anything.`),null==y?null:e.createElement(I.Provider,{value:d},e.createElement(B.Provider,{children:n,value:y}))}function le({children:e,location:t}){return q(se(e),t)}function se(t,n=[]){let a=[];return e.Children.forEach(t,(t,o)=>{if(!e.isValidElement(t))return;let i=[...n,o];if(t.type===e.Fragment)return void a.push.apply(a,se(t.props.children,i));r(t.type===oe,`[${"string"==typeof t.type?t.type:t.type.name}] is not a component. All component children of must be a or `),r(!t.props.index||!t.props.children,"An index route cannot have child routes.");let l={id:t.props.id||i.join("-"),caseSensitive:t.props.caseSensitive,element:t.props.element,Component:t.props.Component,index:t.props.index,path:t.props.path,middleware:t.props.middleware,loader:t.props.loader,action:t.props.action,hydrateFallbackElement:t.props.hydrateFallbackElement,HydrateFallback:t.props.HydrateFallback,errorElement:t.props.errorElement,ErrorBoundary:t.props.ErrorBoundary,hasErrorBoundary:!0===t.props.hasErrorBoundary||null!=t.props.ErrorBoundary||null!=t.props.errorElement,shouldRevalidate:t.props.shouldRevalidate,handle:t.props.handle,lazy:t.props.lazy};t.props.children&&(l.children=se(t.props.children,i)),a.push(l)}),a}e.memo(function({routes:e,future:t,state:n,unstable_onError:r}){return q(e,void 0,n,r)});var ue="get",ce="application/x-www-form-urlencoded";function he(e){return"undefined"!=typeof HTMLElement&&e instanceof HTMLElement}var de=null,pe=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function me(e){return null==e||pe.has(e)?e:(a(!1,`"${e}" is not a valid \`encType\` for \`
\`/\`\` and will default to "${ce}"`),null)}function fe(e,t){if(!1===e||null==e)throw new Error(t)}function ve(e){return null!=e&&(null==e.href?"preload"===e.rel&&"string"==typeof e.imageSrcSet&&"string"==typeof e.imageSizes:"string"==typeof e.rel&&"string"==typeof e.href)}function ge(e,t,n,r,a,o){let i=(e,t)=>!n[t]||e.route.id!==n[t].route.id,l=(e,t)=>{var r;return n[t].pathname!==e.pathname||(null==(r=n[t].route.path)?void 0:r.endsWith("*"))&&n[t].params["*"]!==e.params["*"]};return"assets"===o?t.filter((e,t)=>i(e,t)||l(e,t)):"data"===o?t.filter((t,o)=>{var s;let u=r.routes[t.route.id];if(!u||!u.hasLoader)return!1;if(i(t,o)||l(t,o))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(a.pathname+a.search+a.hash,window.origin),currentParams:(null==(s=n[0])?void 0:s.params)||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if("boolean"==typeof r)return r}return!0}):[]}function ye(){let t=e.useContext(D);return fe(t,"You must render this element inside a element"),t}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var we=e.createContext(void 0);function be(){let t=e.useContext(we);return fe(t,"You must render this element inside a element"),t}function Ee(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function xe({page:t,...n}){let{router:r}=ye(),a=e.useMemo(()=>u(r.routes,t,r.basename),[r.routes,t,r.basename]);return a?e.createElement(Ce,{page:t,matches:a,...n}):null}function Ce({page:t,matches:n,...r}){let a=z(),{manifest:o,routeModules:i}=be(),{basename:l}=ye(),{loaderData:s,matches:u}=function(){let t=e.useContext(j);return fe(t,"You must render this element inside a element"),t}(),c=e.useMemo(()=>ge(t,n,u,o,a,"data"),[t,n,u,o,a]),h=e.useMemo(()=>ge(t,n,u,o,a,"assets"),[t,n,u,o,a]),d=e.useMemo(()=>{if(t===a.pathname+a.search+a.hash)return[];let e=new Set,r=!1;if(n.forEach(t=>{var n;let a=o.routes[t.route.id];a&&a.hasLoader&&(!c.some(e=>e.route.id===t.route.id)&&t.route.id in s&&(null==(n=i[t.route.id])?void 0:n.shouldRevalidate)||a.hasClientLoader?r=!0:e.add(t.route.id))}),0===e.size)return[];let u=function(e,t,n){let r="string"==typeof e?new URL(e,"undefined"==typeof window?"server://singlefetch/":window.location.origin):e;return"/"===r.pathname?r.pathname=`_root.${n}`:t&&"/"===C(r.pathname,t)?r.pathname=`${t.replace(/\/$/,"")}/_root.${n}`:r.pathname=`${r.pathname.replace(/\/$/,"")}.${n}`,r}(t,l,"data");return r&&e.size>0&&u.searchParams.set("_routes",n.filter(t=>e.has(t.route.id)).map(e=>e.route.id).join(",")),[u.pathname+u.search]},[l,s,a,o,c,n,t,i]),p=e.useMemo(()=>function(e,t,{includeHydrateFallback:n}={}){return r=e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let a=[r.module];return r.clientActionModule&&(a=a.concat(r.clientActionModule)),r.clientLoaderModule&&(a=a.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(a=a.concat(r.hydrateFallbackModule)),r.imports&&(a=a.concat(r.imports)),a}).flat(1),[...new Set(r)];var r}(h,o),[h,o]),m=function(t){let{manifest:n,routeModules:r}=be(),[a,o]=e.useState([]);return e.useEffect(()=>{let e=!1;return async function(e,t,n){return function(e){let t=new Set;return new Set(void 0),e.reduce((e,n)=>{let r=JSON.stringify(function(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}(n));return t.has(r)||(t.add(r),e.push({key:r,link:n})),e},[])}((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await async function(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(ve).filter(e=>"stylesheet"===e.rel||"preload"===e.rel).map(e=>"stylesheet"===e.rel?{...e,rel:"prefetch",as:"style"}:{...e,rel:"prefetch"}))}(t,n,r).then(t=>{e||o(t)}),()=>{e=!0}},[t,n,r]),a}(h);return e.createElement(e.Fragment,null,d.map(t=>e.createElement("link",{key:t,rel:"prefetch",as:"fetch",href:t,...r})),p.map(t=>e.createElement("link",{key:t,rel:"modulepreload",href:t,...r})),m.map(({key:t,link:n})=>e.createElement("link",{key:t,nonce:r.nonce,...n})))}function Re(...e){return t=>{e.forEach(e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)})}}we.displayName="FrameworkContext";var Se="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;try{Se&&(window.__reactRouterVersion="7.10.1")}catch(Ie){}function $e({basename:t,children:a,unstable_useTransitions:s,window:u}){let c=e.useRef();null==c.current&&(c.current=function(e={}){return function(e,t,a,s={}){let{window:u=document.defaultView,v5Compat:c=!1}=s,h=u.history,d="POP",p=null,m=f();function f(){return(h.state||{idx:null}).idx}function v(){d="POP";let e=f(),t=null==e?null:e-m;m=e,p&&p({action:d,location:y.location,delta:t})}function g(e){return function(e,t=!1){let n="http://localhost";"undefined"!=typeof window&&(n="null"!==window.location.origin?window.location.origin:window.location.href),r(n,"No window.location.(origin|href) available to create URL");let a="string"==typeof e?e:l(e);return a=a.replace(/ $/,"%20"),!t&&a.startsWith("//")&&(a=n+a),new URL(a,n)}(e)}null==m&&(m=0,h.replaceState({...h.state,idx:m},""));let y={get action(){return d},get location(){return e(u,h)},listen(e){if(p)throw new Error("A history only accepts one active listener");return u.addEventListener(n,v),p=e,()=>{u.removeEventListener(n,v),p=null}},createHref:e=>t(u,e),createURL:g,encodeLocation(e){let t=g(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:function(e,t){d="PUSH";let n=i(y.location,e,t);m=f()+1;let r=o(n,m),a=y.createHref(n);try{h.pushState(r,"",a)}catch(l){if(l instanceof DOMException&&"DataCloneError"===l.name)throw l;u.location.assign(a)}c&&p&&p({action:d,location:y.location,delta:1})},replace:function(e,t){d="REPLACE";let n=i(y.location,e,t);m=f();let r=o(n,m),a=y.createHref(n);h.replaceState(r,"",a),c&&p&&p({action:d,location:y.location,delta:0})},go:e=>h.go(e)};return y}(function(e,t){let{pathname:n,search:r,hash:a}=e.location;return i("",{pathname:n,search:r,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||"default")},function(e,t){return"string"==typeof t?t:l(t)},0,e)}({window:u,v5Compat:!0}));let h=c.current,[d,p]=e.useState({action:h.action,location:h.location}),m=e.useCallback(t=>{!1===s?p(t):e.startTransition(()=>p(t))},[s]);return e.useLayoutEffect(()=>h.listen(m),[h,m]),e.createElement(ie,{basename:t,children:a,location:d.location,navigationType:d.action,navigator:h,unstable_useTransitions:!0===s})}var Le=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Te=e.forwardRef(function({onClick:t,discover:n="render",prefetch:o="none",relative:i,reloadDocument:s,replace:u,state:c,target:h,to:d,preventScrollReset:p,viewTransition:m,...f},v){let g,{basename:y,unstable_useTransitions:w}=e.useContext(I),b="string"==typeof d&&Le.test(d),E=!1;if("string"==typeof d&&b&&(g=d,Se))try{let e=new URL(window.location.href),t=d.startsWith("//")?new URL(e.protocol+d):new URL(d),n=C(t.pathname,y);t.origin===e.origin&&null!=n?d=n+t.search+t.hash:E=!0}catch(Ie){a(!1,` contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let x=function(t,{relative:n}={}){r(H(),"useHref() may be used only in the context of a component.");let{basename:a,navigator:o}=e.useContext(I),{hash:i,pathname:l,search:s}=V(t,{relative:n}),u=l;return"/"!==a&&(u="/"===l?a:k([a,l])),o.createHref({pathname:u,search:s,hash:i})}(d,{relative:i}),[R,S,$]=function(t,n){let r=e.useContext(we),[a,o]=e.useState(!1),[i,l]=e.useState(!1),{onFocus:s,onBlur:u,onMouseEnter:c,onMouseLeave:h,onTouchStart:d}=n,p=e.useRef(null);e.useEffect(()=>{if("render"===t&&l(!0),"viewport"===t){let e=new IntersectionObserver(e=>{e.forEach(e=>{l(e.isIntersecting)})},{threshold:.5});return p.current&&e.observe(p.current),()=>{e.disconnect()}}},[t]),e.useEffect(()=>{if(a){let e=setTimeout(()=>{l(!0)},100);return()=>{clearTimeout(e)}}},[a]);let m=()=>{o(!0)},f=()=>{o(!1),l(!1)};return r?"intent"!==t?[i,p,{}]:[i,p,{onFocus:Ee(s,m),onBlur:Ee(u,f),onMouseEnter:Ee(c,m),onMouseLeave:Ee(h,f),onTouchStart:Ee(d,m)}]:[!1,p,{}]}(o,f),L=function(t,{target:n,replace:r,state:a,preventScrollReset:o,relative:i,viewTransition:s,unstable_useTransitions:u}={}){let c=K(),h=z(),d=V(t,{relative:i});return e.useCallback(p=>{if(function(e,t){return!(0!==e.button||t&&"_self"!==t||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e))}(p,n)){p.preventDefault();let n=void 0!==r?r:l(h)===l(d),m=()=>c(t,{replace:n,state:a,preventScrollReset:o,relative:i,viewTransition:s});u?e.startTransition(()=>m()):m()}},[h,c,d,r,a,n,t,o,i,s,u])}(d,{replace:u,state:c,target:h,preventScrollReset:p,relative:i,viewTransition:m,unstable_useTransitions:w}),T=e.createElement("a",{...f,...$,href:g||x,onClick:E||s?t:function(e){t&&t(e),e.defaultPrevented||L(e)},ref:Re(v,S),target:h,"data-discover":b||"render"!==n?void 0:"true"});return R&&!b?e.createElement(e.Fragment,null,T,e.createElement(xe,{page:x})):T});function ke(t){let n=e.useContext(D);return r(n,function(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}(t)),n}Te.displayName="Link",e.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:a="",end:o=!1,style:i,to:l,viewTransition:s,children:u,...c},h){let d=V(l,{relative:c.relative}),p=z(),m=e.useContext(j),{navigator:f,basename:v}=e.useContext(I),g=null!=m&&function(t,{relative:n}={}){let a=e.useContext(W);r(null!=a,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:o}=ke("useViewTransitionState"),i=V(t,{relative:n});if(!a.isTransitioning)return!1;let l=C(a.currentLocation.pathname,o)||a.currentLocation.pathname,s=C(a.nextLocation.pathname,o)||a.nextLocation.pathname;return null!=E(i.pathname,s)||null!=E(i.pathname,l)}(d)&&!0===s,y=f.encodeLocation?f.encodeLocation(d).pathname:d.pathname,w=p.pathname,b=m&&m.navigation&&m.navigation.location?m.navigation.location.pathname:null;n||(w=w.toLowerCase(),b=b?b.toLowerCase():null,y=y.toLowerCase()),b&&v&&(b=C(b,v)||b);const x="/"!==y&&y.endsWith("/")?y.length-1:y.length;let R,S=w===y||!o&&w.startsWith(y)&&"/"===w.charAt(x),$=null!=b&&(b===y||!o&&b.startsWith(y)&&"/"===b.charAt(y.length)),L={isActive:S,isPending:$,isTransitioning:g},T=S?t:void 0;R="function"==typeof a?a(L):[a,S?"active":null,$?"pending":null,g?"transitioning":null].filter(Boolean).join(" ");let k="function"==typeof i?i(L):i;return e.createElement(Te,{...c,"aria-current":T,className:R,ref:h,style:k,to:l,viewTransition:s},"function"==typeof u?u(L):u)}).displayName="NavLink",e.forwardRef(({discover:t="render",fetcherKey:n,navigate:a,reloadDocument:o,replace:i,state:s,method:u=ue,action:c,onSubmit:h,relative:d,preventScrollReset:p,viewTransition:m,...f},v)=>{let{unstable_useTransitions:g}=e.useContext(I),y=function(){let{router:t}=ke("useSubmit"),{basename:n}=e.useContext(I),r=te("useRouteId"),a=t.fetch,o=t.navigate;return e.useCallback(async(e,t={})=>{let{action:i,method:l,encType:s,formData:u,body:c}=function(e,t){let n,r,a,o,i;if(he(l=e)&&"form"===l.tagName.toLowerCase()){let i=e.getAttribute("action");r=i?C(i,t):null,n=e.getAttribute("method")||ue,a=me(e.getAttribute("enctype"))||ce,o=new FormData(e)}else if(function(e){return he(e)&&"button"===e.tagName.toLowerCase()}(e)||function(e){return he(e)&&"input"===e.tagName.toLowerCase()}(e)&&("submit"===e.type||"image"===e.type)){let i=e.form;if(null==i)throw new Error('Cannot submit a